Testing the creation of hell
This commit is contained in:
parent
796e75b1f9
commit
a2b006105e
2587 changed files with 0 additions and 129617 deletions
|
@ -0,0 +1,332 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.common.ArmourComponent;
|
||||
import WayofTime.alchemicalWizardry.common.items.BoundArmour;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ArmourForge extends Block
|
||||
{
|
||||
public static List<ArmourComponent> helmetList = new ArrayList();
|
||||
public static List<ArmourComponent> plateList = new ArrayList();
|
||||
public static List<ArmourComponent> leggingsList = new ArrayList();
|
||||
public static List<ArmourComponent> bootsList = new ArrayList();
|
||||
|
||||
public ArmourForge()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("armourForge");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SoulForge");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int armourType = getArmourType(world, x, y, z);
|
||||
|
||||
if (armourType == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int direction = getDirectionForArmourType(world, x, y, z, armourType);
|
||||
|
||||
if (!isParadigmValid(armourType, direction, world, x, y, z))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
List<ArmourComponent> list = null;
|
||||
ItemStack armourPiece = null;
|
||||
|
||||
switch (armourType)
|
||||
{
|
||||
case 0:
|
||||
list = plateList;
|
||||
armourPiece = new ItemStack(ModItems.boundPlate, 1, 0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
list = leggingsList;
|
||||
armourPiece = new ItemStack(ModItems.boundLeggings, 1, 0);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
list = helmetList;
|
||||
armourPiece = new ItemStack(ModItems.boundHelmet, 1, 0);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
list = bootsList;
|
||||
armourPiece = new ItemStack(ModItems.boundBoots, 1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (armourPiece == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (armourPiece.stackTagCompound == null)
|
||||
{
|
||||
armourPiece.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
for (ArmourComponent ac : list)
|
||||
{
|
||||
int xOff = ac.getXOff();
|
||||
int zOff = ac.getZOff();
|
||||
TileEntity tileEntity;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
tileEntity = world.getTileEntity(x + xOff, y, z - zOff);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tileEntity = world.getTileEntity(x + zOff, y, z + xOff);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
tileEntity = world.getTileEntity(x - xOff, y, z + zOff);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
tileEntity = world.getTileEntity(x - zOff, y, z - xOff);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
tileEntity = world.getTileEntity(x + xOff, y + zOff, z);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
tileEntity = world.getTileEntity(x, y + zOff, z + xOff);
|
||||
break;
|
||||
|
||||
default:
|
||||
tileEntity = null;
|
||||
}
|
||||
|
||||
if (tileEntity instanceof TESocket)
|
||||
{
|
||||
ItemStack itemStack = ((TESocket) tileEntity).getStackInSlot(0);
|
||||
int xCoord = tileEntity.xCoord;
|
||||
int yCoord = tileEntity.yCoord;
|
||||
int zCoord = tileEntity.zCoord;
|
||||
((TESocket) tileEntity).setInventorySlotContents(0, null);
|
||||
world.setBlockToAir(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
Item item = itemStack.getItem();
|
||||
|
||||
if (item instanceof ArmourUpgrade)
|
||||
{
|
||||
((BoundArmour) armourPiece.getItem()).hasAddedToInventory(armourPiece, itemStack.copy());
|
||||
((TESocket) tileEntity).setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (armourPiece != null)
|
||||
{
|
||||
int xOff = (world.rand.nextInt(11) - 5);
|
||||
int zOff = (int) (Math.sqrt(25 - xOff * xOff) * (world.rand.nextInt(2) - 0.5) * 2);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x + xOff, y + 5, z + zOff));
|
||||
world.spawnEntityInWorld(new EntityItem(world, x, y + 1, z, armourPiece));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//0 for plate, 1 for leggings, 2 for helmet, 3 for boots
|
||||
public int getArmourType(World world, int x, int y, int z)
|
||||
{
|
||||
for (int i = 0; i <= 3; i++)
|
||||
{
|
||||
if (getDirectionForArmourType(world, x, y, z, i) != -1)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getDirectionForArmourType(World world, int x, int y, int z, int armourType)
|
||||
{
|
||||
for (int i = 1; i <= 6; i++)
|
||||
{
|
||||
if (isParadigmValid(armourType, i, world, x, y, z))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean isParadigmValid(int armourType, int direction, World world, int x, int y, int z)
|
||||
{
|
||||
List<ArmourComponent> list = null;
|
||||
|
||||
switch (armourType)
|
||||
{
|
||||
case 0:
|
||||
list = plateList;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
list = leggingsList;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
list = helmetList;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
list = bootsList;
|
||||
break;
|
||||
}
|
||||
|
||||
if (list == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ArmourComponent ac : list)
|
||||
{
|
||||
int xOff = ac.getXOff();
|
||||
int zOff = ac.getZOff();
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case 1:
|
||||
if (!(world.getTileEntity(x + xOff, y, z - zOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (!(world.getTileEntity(x + zOff, y, z + xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (!(world.getTileEntity(x - xOff, y, z + zOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (!(world.getTileEntity(x - zOff, y, z - xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (!(world.getTileEntity(x + xOff, y + zOff, z) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if (!(world.getTileEntity(x, y + zOff, z + xOff) instanceof TESocket))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void initializeRecipes()
|
||||
{
|
||||
helmetList.add(new ArmourComponent(-1, 1));
|
||||
helmetList.add(new ArmourComponent(0, 1));
|
||||
helmetList.add(new ArmourComponent(1, 1));
|
||||
helmetList.add(new ArmourComponent(-1, 0));
|
||||
helmetList.add(new ArmourComponent(1, 0));
|
||||
bootsList.add(new ArmourComponent(-1, 1));
|
||||
bootsList.add(new ArmourComponent(1, 1));
|
||||
bootsList.add(new ArmourComponent(-1, 0));
|
||||
bootsList.add(new ArmourComponent(1, 0));
|
||||
plateList.add(new ArmourComponent(-1, 0));
|
||||
plateList.add(new ArmourComponent(1, 0));
|
||||
plateList.add(new ArmourComponent(-1, -1));
|
||||
plateList.add(new ArmourComponent(0, -1));
|
||||
plateList.add(new ArmourComponent(1, -1));
|
||||
plateList.add(new ArmourComponent(-1, -2));
|
||||
plateList.add(new ArmourComponent(0, -2));
|
||||
plateList.add(new ArmourComponent(1, -2));
|
||||
leggingsList.add(new ArmourComponent(-1, 1));
|
||||
leggingsList.add(new ArmourComponent(0, 1));
|
||||
leggingsList.add(new ArmourComponent(1, 1));
|
||||
leggingsList.add(new ArmourComponent(-1, 0));
|
||||
leggingsList.add(new ArmourComponent(1, 0));
|
||||
leggingsList.add(new ArmourComponent(-1, -1));
|
||||
leggingsList.add(new ArmourComponent(1, -1));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,167 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAlchemicCalcinator extends BlockContainer
|
||||
{
|
||||
public BlockAlchemicCalcinator()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("alchemicCalcinator");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEAlchemicCalcinator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof IReagentManipulator)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (playerItem.getItem() instanceof IBloodOrb)
|
||||
{
|
||||
if (tileEntity.getStackInSlot(0) == null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
}
|
||||
} else if (tileEntity.getStackInSlot(1) == null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(1, newItem);
|
||||
}
|
||||
|
||||
} else if (playerItem == null)
|
||||
{
|
||||
if (tileEntity.getStackInSlot(1) != null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1));
|
||||
tileEntity.setInventorySlotContents(1, null);
|
||||
} else if (tileEntity.getStackInSlot(0) != null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
|
||||
tileEntity.getWorldObj().markBlockForUpdate(x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,273 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyBattery;
|
||||
import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAltar extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockAltar()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodAltar");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEAltar)
|
||||
{
|
||||
ItemStack stack = ((TEAltar) tile).getStackInSlot(0);
|
||||
|
||||
if (stack != null && stack.getItem() instanceof EnergyBattery)
|
||||
{
|
||||
EnergyBattery bloodOrb = (EnergyBattery) stack.getItem();
|
||||
int maxEssence = bloodOrb.getMaxEssence();
|
||||
int currentEssence = bloodOrb.getCurrentEssence(stack);
|
||||
int level = currentEssence * 15 / maxEssence;
|
||||
return ((int) (Math.min(15, level))) % 16;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem().equals(ModItems.divinationSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (playerItem.getItem().equals(ModItems.itemSeerSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (playerItem.getItem().equals(ModItems.sigilOfHolding))
|
||||
{
|
||||
ItemStack item = ((SigilOfHolding) playerItem.getItem()).getCurrentItem(playerItem);
|
||||
|
||||
if (item != null && item.getItem().equals(ModItems.divinationSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (item != null && item.getItem().equals(ModItems.itemSeerSigil))
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
} else
|
||||
{
|
||||
tileEntity.sendMoreChatInfoToPlayer(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
tileEntity.startCycle();
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
|
||||
|
||||
if (!tileEntity.isActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TEAltar();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BlockBelljar extends BlockContainer
|
||||
{
|
||||
public BlockBelljar()
|
||||
{
|
||||
super(Material.glass);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("crystalBelljar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack stack)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEBellJar)
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag != null)
|
||||
{
|
||||
((TEBellJar) tile).readTankNBTOnPlace(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEBellJar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TEBellJar)
|
||||
{
|
||||
return ((TEBellJar) tile).getRSPowerOutput();
|
||||
}
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
|
||||
{
|
||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
super.onBlockHarvested(world, x, y, z, meta, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEBellJar)
|
||||
{
|
||||
ItemStack drop = new ItemStack(this);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
((TEBellJar) tile).writeTankNBT(tag);
|
||||
drop.stackTagCompound = tag;
|
||||
|
||||
list.add(drop);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockBloodLightSource extends Block
|
||||
{
|
||||
public BlockBloodLightSource()
|
||||
{
|
||||
super(Material.cloth);
|
||||
this.setBlockName("blockBloodLightSource");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
float f = (float) 1.0F;
|
||||
float f1 = f * 0.6F + 0.4F;
|
||||
float f2 = f * f * 0.7F - 0.5F;
|
||||
float f3 = f * f * 0.6F - 0.7F;
|
||||
world.spawnParticle("reddust", x + 0.5D + rand.nextGaussian() / 8, y + 0.5D, z + 0.5D + rand.nextGaussian() / 8, f1, f2, f3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
this.setBlockBounds(0.40F, 0.40F, 0.40F, 0.60F, 0.60F, 0.60F);
|
||||
}
|
||||
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockConduit extends BlockOrientable
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockConduit()
|
||||
{
|
||||
super();
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockConduit");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Top");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int noClue)
|
||||
{
|
||||
return new TEConduit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockDemonPortal extends BlockContainer
|
||||
{
|
||||
public BlockDemonPortal()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("demonPortal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TEDemonPortal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TEDemonPortal tileEntity = (TEDemonPortal) world.getTileEntity(x, y, z);
|
||||
|
||||
tileEntity.rightClickBlock(player, side);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.BlankSpell;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockHomHeart extends BlockContainer
|
||||
{
|
||||
public IIcon bottomIcon;
|
||||
public IIcon topIcon;
|
||||
public IIcon sideIcon;
|
||||
|
||||
public BlockHomHeart()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockHomHeart");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_top");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_bottom");
|
||||
this.sideIcon = iconRegister.registerIcon("AlchemicalWizardry:HomHeart_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEHomHeart tileEntity = (TEHomHeart) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof BlankSpell)
|
||||
{
|
||||
if (playerItem.stackTagCompound == null)
|
||||
{
|
||||
playerItem.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.stackTagCompound;
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int metaMaybe)
|
||||
{
|
||||
return new TEHomHeart();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.ActivationCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMasterStone extends BlockContainer
|
||||
{
|
||||
public BlockMasterStone()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("blockMasterStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:MasterStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TEMasterStone)
|
||||
{
|
||||
((TEMasterStone) tile).useOnRitualBroken();
|
||||
}
|
||||
|
||||
super.onBlockHarvested(world, x, y, z, meta, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEMasterStone tileEntity = (TEMasterStone) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = playerItem.getItem();
|
||||
|
||||
if (!(item instanceof ActivationCrystal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ActivationCrystal acItem = (ActivationCrystal) item;
|
||||
tileEntity.setOwner(acItem.getOwnerName(playerItem));
|
||||
tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), player);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEMasterStone();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,205 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockOrientable extends BlockContainer
|
||||
{
|
||||
public BlockOrientable()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int dunno)
|
||||
{
|
||||
return new TEOrientable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
//Right-click orients the output face. Shift-right-click orients the input face.
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ForgeDirection sideClicked = ForgeDirection.getOrientation(side);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TEOrientable)
|
||||
{
|
||||
TEOrientable newTile = (TEOrientable) tile;
|
||||
if (player.isSneaking())
|
||||
{
|
||||
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection()) + 1;
|
||||
|
||||
if (nextSide > 5)
|
||||
{
|
||||
nextSide = 0;
|
||||
}
|
||||
if (ForgeDirection.getOrientation(nextSide) == newTile.getOutputDirection())
|
||||
{
|
||||
nextSide++;
|
||||
if (nextSide > 5)
|
||||
{
|
||||
nextSide = 0;
|
||||
}
|
||||
}
|
||||
|
||||
newTile.setInputDirection(ForgeDirection.getOrientation(nextSide));
|
||||
} else
|
||||
{
|
||||
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getOutputDirection()) + 1;
|
||||
|
||||
if (nextSide > 5)
|
||||
{
|
||||
nextSide = 0;
|
||||
}
|
||||
if (ForgeDirection.getOrientation(nextSide) == newTile.getInputDirection())
|
||||
{
|
||||
nextSide++;
|
||||
if (nextSide > 5)
|
||||
{
|
||||
nextSide = 0;
|
||||
}
|
||||
}
|
||||
|
||||
newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide));
|
||||
}
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getTextureIndexForSideAndOrientation(int side, ForgeDirection input, ForgeDirection output)
|
||||
{
|
||||
if (ForgeDirection.getOrientation(side) == input)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (ForgeDirection.getOrientation(side) == output)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (ForgeDirection.getOrientation(side) == output.getOpposite())
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case 0: //BOTTOM
|
||||
switch (output)
|
||||
{
|
||||
case NORTH:
|
||||
return 2; //UP
|
||||
case SOUTH:
|
||||
return 3; //DOWN
|
||||
case EAST:
|
||||
return 4; //LEFT
|
||||
case WEST:
|
||||
return 5; //RIGHT
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: //TOP
|
||||
switch (output)
|
||||
{
|
||||
case NORTH:
|
||||
return 2; //UP
|
||||
case SOUTH:
|
||||
return 3; //DOWN
|
||||
case EAST:
|
||||
return 5;
|
||||
case WEST:
|
||||
return 4;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2: //NORTH
|
||||
switch (output)
|
||||
{
|
||||
case DOWN:
|
||||
return 3;
|
||||
case UP:
|
||||
return 2;
|
||||
case EAST:
|
||||
return 4;
|
||||
case WEST:
|
||||
return 5;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3: //SOUTH
|
||||
switch (output)
|
||||
{
|
||||
case DOWN:
|
||||
return 3;
|
||||
case UP:
|
||||
return 2;
|
||||
case EAST:
|
||||
return 5;
|
||||
case WEST:
|
||||
return 4;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4: //WEST
|
||||
switch (output)
|
||||
{
|
||||
case DOWN:
|
||||
return 3;
|
||||
case UP:
|
||||
return 2;
|
||||
case NORTH:
|
||||
return 5;
|
||||
case SOUTH:
|
||||
return 4;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5: //EAST
|
||||
switch (output)
|
||||
{
|
||||
case DOWN:
|
||||
return 3;
|
||||
case UP:
|
||||
return 2;
|
||||
case NORTH:
|
||||
return 4;
|
||||
case SOUTH:
|
||||
return 5;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,179 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPedestal extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockPedestal()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodPedestal");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:ArcanePedestal");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEPedestal tileEntity = (TEPedestal) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEPedestal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)
|
||||
{
|
||||
float f = 0.3125F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
|
||||
return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,179 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPlinth extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockPlinth()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodPlinth");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:ArcanePlinth");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TEPlinth tileEntity = (TEPlinth) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEPlinth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)
|
||||
{
|
||||
float f = 0.0625F;
|
||||
this.setBlockBounds(f, 0.0F, f, 1.0f - f, 0.875f, 1.0f - f);
|
||||
return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockReagentConduit extends BlockContainer
|
||||
{
|
||||
public BlockReagentConduit()
|
||||
{
|
||||
super(Material.cloth);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("blockReagentConduit");
|
||||
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SimpleTransCircle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEReagentConduit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESchematicSaver;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSchematicSaver extends BlockContainer
|
||||
{
|
||||
public BlockSchematicSaver()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("schematicSaver");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TESchematicSaver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TESchematicSaver tileEntity = (TESchematicSaver) world.getTileEntity(x, y, z);
|
||||
|
||||
tileEntity.rightClickBlock(player, side);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESocket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSocket extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockSocket()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodSocket");
|
||||
//func_111022_d("AlchemicalWizardry:blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TESocket tileEntity = (TESocket) world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
if (tileEntity.getStackInSlot(0) == null && playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof ArmourUpgrade)
|
||||
{
|
||||
ItemStack newItem = playerItem.copy();
|
||||
newItem.stackSize = 1;
|
||||
--playerItem.stackSize;
|
||||
tileEntity.setInventorySlotContents(0, newItem);
|
||||
}
|
||||
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
|
||||
{
|
||||
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
|
||||
tileEntity.setInventorySlotContents(0, null);
|
||||
tileEntity.setActive();
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESocket();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSpectralContainer extends BlockContainer
|
||||
{
|
||||
public BlockSpectralContainer()
|
||||
{
|
||||
super(Material.cloth);
|
||||
this.setBlockName("blockSpectralContainer");
|
||||
this.setBlockBounds(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlockBloodLight");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return new TESpectralContainer();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class BlockSpellEffect extends BlockOrientable
|
||||
{
|
||||
public BlockSpellEffect()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEffect");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellEffectBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.blockSpellEffect))
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class BlockSpellEnhancement extends BlockOrientable
|
||||
{
|
||||
public BlockSpellEnhancement()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellEnhancement");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellEnhancementBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.blockSpellEnhancement))
|
||||
{
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class BlockSpellModifier extends BlockOrientable
|
||||
{
|
||||
public BlockSpellModifier()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellModifier");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellModifierBlock();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.blockSpellModifier))
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockSpellParadigm extends BlockOrientable
|
||||
{
|
||||
public static final float minPos = (3f / 16f);
|
||||
public static final float maxPos = (13f / 16f);
|
||||
|
||||
public BlockSpellParadigm()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("blockSpellParadigm");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TESpellParadigmBlock();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.blockSpellParadigm))
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
|
||||
if (stack != null && stack.getItem() instanceof ItemComplexSpellCrystal)
|
||||
{
|
||||
if (stack.stackTagCompound == null)
|
||||
{
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = stack.stackTagCompound;
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockMobSpawner;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockTeleposer extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockTeleposer()
|
||||
{
|
||||
super(Material.rock);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodTeleposer");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
TETeleposer tileEntity = (TETeleposer) world.getTileEntity(x, y, z);
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof TelepositionFocus)
|
||||
{
|
||||
if (playerItem.stackTagCompound == null)
|
||||
{
|
||||
playerItem.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.stackTagCompound;
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TETeleposer();
|
||||
}
|
||||
|
||||
public static boolean swapBlocks(World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
|
||||
{
|
||||
TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi);
|
||||
TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf);
|
||||
TileEntity tileI;
|
||||
TileEntity tileF;
|
||||
|
||||
NBTTagCompound nbttag1 = new NBTTagCompound();
|
||||
NBTTagCompound nbttag2 = new NBTTagCompound();
|
||||
|
||||
if (tileEntityI != null)
|
||||
{
|
||||
tileEntityI.writeToNBT(nbttag1);
|
||||
}
|
||||
|
||||
if (tileEntityF != null)
|
||||
{
|
||||
tileEntityF.writeToNBT(nbttag2);
|
||||
}
|
||||
|
||||
Block blockI = worldI.getBlock(xi, yi, zi);
|
||||
Block blockF = worldF.getBlock(xf, yf, zf);
|
||||
|
||||
|
||||
if (blockI.equals(Blocks.air) && blockF.equals(Blocks.air))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (blockI instanceof BlockMobSpawner || blockF instanceof BlockMobSpawner)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int metaI = worldI.getBlockMetadata(xi, yi, zi);
|
||||
int metaF = worldF.getBlockMetadata(xf, yf, zf);
|
||||
worldI.playSoundEffect(xi, yi, zi, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldF.playSoundEffect(xf, yf, zf, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
//CLEAR TILES
|
||||
Block finalBlock = blockF;
|
||||
|
||||
if (finalBlock != null)
|
||||
{
|
||||
TileEntity tileToSet = finalBlock.createTileEntity(worldF, metaF);
|
||||
|
||||
worldF.setTileEntity(xf, yf, zf, tileToSet);
|
||||
}
|
||||
|
||||
Block initialBlock = blockI;
|
||||
|
||||
if (initialBlock != null)
|
||||
{
|
||||
TileEntity tileToSet = initialBlock.createTileEntity(worldI, metaI);
|
||||
|
||||
worldI.setTileEntity(xi, yi, zi, tileToSet);
|
||||
}
|
||||
|
||||
//TILES CLEARED
|
||||
worldF.setBlock(xf, yf, zf, initialBlock, metaI, 3);
|
||||
|
||||
if (tileEntityI != null)
|
||||
{
|
||||
TileEntity newTileEntityI = TileEntity.createAndLoadEntity(nbttag1);
|
||||
worldF.setTileEntity(xf, yf, zf, newTileEntityI);
|
||||
newTileEntityI.xCoord = xf;
|
||||
newTileEntityI.yCoord = yf;
|
||||
newTileEntityI.zCoord = zf;
|
||||
}
|
||||
|
||||
worldI.setBlock(xi, yi, zi, finalBlock, metaF, 3);
|
||||
|
||||
if (tileEntityF != null)
|
||||
{
|
||||
TileEntity newTileEntityF = TileEntity.createAndLoadEntity(nbttag2);
|
||||
worldI.setTileEntity(xi, yi, zi, newTileEntityF);
|
||||
newTileEntityF.xCoord = xi;
|
||||
newTileEntityF.yCoord = yi;
|
||||
newTileEntityF.zCoord = zi;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,175 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockWritingTable extends BlockContainer
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon topIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon1;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon sideIcon2;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon bottomIcon;
|
||||
|
||||
public BlockWritingTable()
|
||||
{
|
||||
super(Material.wood);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("blockWritingTable");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:AlchemicChemistrySet");
|
||||
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType1");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_SideType2");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodAltar_Bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float what, float these, float are)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity == null || player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//code to open gui explained later
|
||||
player.openGui(AlchemicalWizardry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack item = inventory.getStackInSlot(i);
|
||||
|
||||
if (item != null && item.stackSize > 0)
|
||||
{
|
||||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world,
|
||||
x + rx, y + ry, z + rz,
|
||||
new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
item.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TEWritingTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.9375F, 0.5625F);
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
this.setBlockBoundsForItemRender();
|
||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender()
|
||||
{
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BloodRune extends Block
|
||||
{
|
||||
//private Icon bloodRuneIcon;
|
||||
private IIcon altarCapacityRuneIcon;
|
||||
private IIcon dislocationRuneIcon;
|
||||
private IIcon orbCapacityRuneIcon;
|
||||
private IIcon betterCapacityRuneIcon;
|
||||
|
||||
public BloodRune()
|
||||
{
|
||||
super(Material.iron);
|
||||
this.setBlockName("bloodRune");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BlankRune");
|
||||
this.altarCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:AltarCapacityRune");
|
||||
this.dislocationRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:DislocationRune");
|
||||
this.orbCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:OrbCapacityRune");
|
||||
this.betterCapacityRuneIcon = iconRegister.registerIcon("AlchemicalWizardry:BetterCapacityRune");
|
||||
}
|
||||
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
switch (metaData)
|
||||
{
|
||||
case 0:
|
||||
return 0;
|
||||
|
||||
case 1: //Altar Capacity rune
|
||||
return 5;
|
||||
|
||||
case 2: //Filling/emptying rune
|
||||
return 6;
|
||||
|
||||
case 3: //Orb Capacity rune
|
||||
return 7;
|
||||
|
||||
case 4: //Better Capacity rune
|
||||
return 8;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
if (this.equals(ModBlocks.bloodRune))
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
par3List.add(new ItemStack(par1, 1, 3));
|
||||
par3List.add(new ItemStack(par1, 1, 4));
|
||||
} else
|
||||
{
|
||||
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return blockIcon;
|
||||
|
||||
case 1:
|
||||
return altarCapacityRuneIcon;
|
||||
|
||||
case 2:
|
||||
return dislocationRuneIcon;
|
||||
|
||||
case 3:
|
||||
return this.orbCapacityRuneIcon;
|
||||
|
||||
case 4:
|
||||
return this.betterCapacityRuneIcon;
|
||||
|
||||
default:
|
||||
return blockIcon;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return metadata;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class BloodStoneBrick extends Block
|
||||
{
|
||||
public BloodStoneBrick()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodStoneBrick");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodStoneBrick");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class EfficiencyRune extends BloodRune
|
||||
{
|
||||
public EfficiencyRune()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("efficiencyRune");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:EfficiencyRune");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class EmptySocket extends Block
|
||||
{
|
||||
public EmptySocket()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("emptySocket");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:EmptySocket");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IOrientable
|
||||
{
|
||||
public ForgeDirection getInputDirection();
|
||||
|
||||
public ForgeDirection getOutputDirection();
|
||||
|
||||
public void setInputDirection(ForgeDirection direction);
|
||||
|
||||
public void setOutputDirection(ForgeDirection direction);
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ImperfectRitualStone extends Block
|
||||
{
|
||||
public ImperfectRitualStone()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("imperfectRitualStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:ImperfectRitualStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xOff, float yOff, float zOff)
|
||||
{
|
||||
{
|
||||
Block block = world.getBlock(x, y + 1, z);
|
||||
|
||||
if (block == Blocks.water)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode && !world.isRemote)
|
||||
{
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
}
|
||||
|
||||
world.getWorldInfo().setRaining(true);
|
||||
|
||||
if (world.isRemote)
|
||||
{
|
||||
world.setRainStrength(1.0F);
|
||||
world.setThunderStrength(1.0f);
|
||||
}
|
||||
|
||||
world.getWorldInfo().setThunderTime(0);
|
||||
world.getWorldInfo().setThundering(true);
|
||||
return true;
|
||||
} else if (block == Blocks.coal_block)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode && !world.isRemote)
|
||||
{
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
EntityZombie zomb = new EntityZombie(world);
|
||||
zomb.setPosition(x + 0.5, y + 2, z + 0.5);
|
||||
zomb.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 2000));
|
||||
zomb.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20000, 7));
|
||||
zomb.addPotionEffect(new PotionEffect(Potion.resistance.id, 20000, 3));
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(zomb);
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (block == Blocks.lapis_block)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode && !world.isRemote)
|
||||
{
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
world.setWorldTime((world.getWorldTime() / 24000) * 24000 + 13800);
|
||||
}
|
||||
} else if (block == Blocks.bedrock)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode && !world.isRemote)
|
||||
{
|
||||
EnergyItems.drainPlayerNetwork(player, 5000);
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
world.addWeatherEffect(new EntityLightningBolt(world, x, y + 2, z));
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(Potion.resistance.id, 60 * 20, 1));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class LargeBloodStoneBrick extends Block
|
||||
{
|
||||
public LargeBloodStoneBrick()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("largeBloodStoneBrick");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:LargeBloodStoneBrick");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
|
||||
public class LifeEssenceBlock extends BlockFluidClassic
|
||||
{
|
||||
public LifeEssenceBlock()
|
||||
{
|
||||
super(AlchemicalWizardry.lifeEssenceFluid, Material.water);
|
||||
AlchemicalWizardry.lifeEssenceFluid.setBlock(this);
|
||||
this.setBlockName("lifeEssenceFluidBlock");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:lifeEssenceStill");
|
||||
AlchemicalWizardry.lifeEssenceFluid.setFlowingIcon(blockIcon);
|
||||
AlchemicalWizardry.lifeEssenceFluid.setStillIcon(blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.canDisplace(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, int x, int y, int z)
|
||||
{
|
||||
if (world.getBlock(x, y, z).getMaterial().isLiquid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.displaceIfPossible(world, x, y, z);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.rituals.IRitualStone;
|
||||
import WayofTime.alchemicalWizardry.common.items.ScribeTool;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class RitualStone extends Block implements IRitualStone
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon blankIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon waterStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon fireStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon earthStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon airStoneIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon duskStoneIcon;
|
||||
|
||||
public RitualStone()
|
||||
{
|
||||
super(Material.iron);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
this.setBlockName("ritualStone");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blankIcon = iconRegister.registerIcon("AlchemicalWizardry:RitualStone");
|
||||
this.waterStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:WaterRitualStone");
|
||||
this.fireStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:FireRitualStone");
|
||||
this.earthStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:EarthRitualStone");
|
||||
this.airStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:AirRitualStone");
|
||||
this.duskStoneIcon = iconRegister.registerIcon("AlchemicalWizardry:DuskRitualStone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int metadata)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = playerItem.getItem();
|
||||
|
||||
if (!(item instanceof ScribeTool))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (playerItem.getMaxDamage() <= playerItem.getItemDamage() && !(playerItem.getMaxDamage() == 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ScribeTool scribeTool = (ScribeTool) item;
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
playerItem.setItemDamage(playerItem.getItemDamage() + 1);
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, scribeTool.getType(), 3);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
return blankIcon;
|
||||
|
||||
case 1:
|
||||
return waterStoneIcon;
|
||||
|
||||
case 2:
|
||||
return fireStoneIcon;
|
||||
|
||||
case 3:
|
||||
return earthStoneIcon;
|
||||
|
||||
case 4:
|
||||
return airStoneIcon;
|
||||
|
||||
case 5:
|
||||
return duskStoneIcon;
|
||||
|
||||
default:
|
||||
return blankIcon;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class RuneOfSacrifice extends BloodRune
|
||||
{
|
||||
public RuneOfSacrifice()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("runeOfSacrifice");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:RuneOfSacrifice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class RuneOfSelfSacrifice extends BloodRune
|
||||
{
|
||||
public RuneOfSelfSacrifice()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("runeOfSelfSacrifice");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:RuneOfSelfSacrifice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SpectralBlock extends BlockContainer
|
||||
{
|
||||
public SpectralBlock()
|
||||
{
|
||||
super(Material.rock);
|
||||
this.setBlockName("spectralBlock");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SpectralBlock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
Block d;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
|
||||
{
|
||||
Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
|
||||
if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block == this)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
|
||||
*/
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
if (playerItem != null)
|
||||
{
|
||||
if (playerItem.getItem() instanceof ItemBlock)
|
||||
{
|
||||
world.setBlock(x, y, z, ((ItemBlock) (playerItem.getItem())).field_150939_a, playerItem.getItemDamage(), 3);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
playerItem.stackSize--;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
||||
{
|
||||
return new TESpectralBlock();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
public class SpeedRune extends BloodRune
|
||||
{
|
||||
public SpeedRune()
|
||||
{
|
||||
super();
|
||||
this.setBlockName("speedRune");
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SpeedRune");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRuneEffect(int metaData)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue