diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2014-04-14 11:58:43 +0300 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2014-04-14 11:58:43 +0300 |
| commit | 1a692ab45df3d88a6cc247cc9f4c0a41c7715264 (patch) | |
| tree | 1854960d78be20ef09c9f098f5e2eb92837019dd /common/darkknight/jewelrycraft/block | |
| parent | f965cf88704f1e5e674d98308cbe0f4451d7edeb (diff) | |
Updating to 1.7
Diffstat (limited to 'common/darkknight/jewelrycraft/block')
8 files changed, 0 insertions, 1035 deletions
diff --git a/common/darkknight/jewelrycraft/block/BlockDisplayer.java b/common/darkknight/jewelrycraft/block/BlockDisplayer.java deleted file mode 100644 index 794e38c..0000000 --- a/common/darkknight/jewelrycraft/block/BlockDisplayer.java +++ /dev/null @@ -1,178 +0,0 @@ -package darkknight.jewelrycraft.block; - -import java.util.Random; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import darkknight.jewelrycraft.tileentity.TileEntityDisplayer; - -public class BlockDisplayer extends BlockContainer -{ - Random rand = new Random(); - - protected BlockDisplayer(int par1, Material par2Material) - { - super(par1, par2Material); - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileEntityDisplayer(); - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) - { - return false; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public int getRenderType() - { - return -1; - } - - @Override - public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { - TileEntityDisplayer te = (TileEntityDisplayer) world.getBlockTileEntity(i, j, k); - ItemStack item = entityPlayer.inventory.getCurrentItem(); - if (te != null && item != null && item != new ItemStack(0, 0, 0) && !world.isRemote) - { - if(!te.hasObject) - { - te.object = item.copy(); - te.object.stackSize = 1; - te.quantity += item.stackSize; - te.hasObject = true; - if (!entityPlayer.capabilities.isCreativeMode) item.stackSize = 0; - te.isDirty = true; - } - else if(te.object.itemID == item.itemID && te.object != null && te.object != new ItemStack(0, 0, 0) && te.object.getItemDamage() == item.getItemDamage()) - { - if(te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())) - { - te.quantity += item.stackSize; - te.object.stackSize = 1; - if (!entityPlayer.capabilities.isCreativeMode) item.stackSize = 0; - te.isDirty = true; - } - else if(!te.object.hasTagCompound() && !item.hasTagCompound()) - { - te.quantity += item.stackSize; - te.object.stackSize = 1; - if (!entityPlayer.capabilities.isCreativeMode) item.stackSize = 0; - te.isDirty = true; - } - } - } - return true; - } - - @Override - public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) - { - TileEntityDisplayer te = (TileEntityDisplayer) world.getBlockTileEntity(i, j, k); - if (te != null && !world.isRemote) - { - if (te.hasObject && te.object != null && te.object != new ItemStack(0, 0, 0) && player.inventory.addItemStackToInventory(te.object)) - { - if(player.isSneaking()) - { - if(te.quantity > te.object.getMaxStackSize()) - { - te.object.stackSize = te.object.getMaxStackSize() - 1; - player.inventory.addItemStackToInventory(te.object); - te.object.stackSize = 1; - te.quantity -= te.object.getMaxStackSize(); - } - else - { - te.object.stackSize = te.quantity - 1; - player.inventory.addItemStackToInventory(te.object); - te.hasObject = false; - te.object = new ItemStack(0, 0, 0); - te.quantity = 0; - } - te.isDirty = true; - } - else - { - if(te.quantity >= 2) - { - player.inventory.addItemStackToInventory(te.object); - te.object.stackSize = 1; - --te.quantity; - } - else - { - player.inventory.addItemStackToInventory(te.object); - te.object.stackSize = 1; - te.hasObject = false; - te.object = new ItemStack(0, 0, 0); - te.quantity = 0; - } - te.isDirty = true; - } - } - } - } - - public void dropItem(World world, double x, double y, double z, ItemStack stack) - { - EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack); - entityitem.motionX = 0; - entityitem.motionZ = 0; - entityitem.motionY = 0.11000000298023224D; - world.spawnEntityInWorld(entityitem); - } - - public void breakBlock(World world, int i, int j, int k, int par5, int par6) - { - TileEntityDisplayer te = (TileEntityDisplayer) world.getBlockTileEntity(i, j, k); - - if (te != null && te.hasObject) - { - te.object.stackSize = te.quantity; - dropItem(te.worldObj, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.object); - world.markTileEntityForDespawn(te); - } - - super.breakBlock(world, i, j, k, par5, par6); - } - - @Override - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) - { - int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - world.setBlockMetadataWithNotify(i, j, k, rotation, 2); - } - - @Override - public void registerIcons(IconRegister icon) - { - this.blockIcon = icon.registerIcon("jewelrycraft:displayer"); - } -} diff --git a/common/darkknight/jewelrycraft/block/BlockGlow.java b/common/darkknight/jewelrycraft/block/BlockGlow.java deleted file mode 100644 index 9a34552..0000000 --- a/common/darkknight/jewelrycraft/block/BlockGlow.java +++ /dev/null @@ -1,39 +0,0 @@ -package darkknight.jewelrycraft.block; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.World; - -public class BlockGlow extends Block -{ - protected BlockGlow(int par1) - { - super(par1, Material.air); - } - - public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i) - { - return null; - } - - public boolean isCollidable() - { - return false; - } - - public boolean isOpaqueCube() - { - return false; - } - - public boolean renderAsNormalBlock() - { - return false; - } - - public int getRenderType() - { - return -1; - } -} diff --git a/common/darkknight/jewelrycraft/block/BlockJewelAltar.java b/common/darkknight/jewelrycraft/block/BlockJewelAltar.java deleted file mode 100644 index 2fab829..0000000 --- a/common/darkknight/jewelrycraft/block/BlockJewelAltar.java +++ /dev/null @@ -1,115 +0,0 @@ -package darkknight.jewelrycraft.block; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import darkknight.jewelrycraft.item.ItemList; -import darkknight.jewelrycraft.tileentity.*; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; -import net.minecraft.world.World; - -public class BlockJewelAltar extends BlockContainer -{ - @SideOnly(Side.CLIENT) - private Icon altarSide; - @SideOnly(Side.CLIENT) - private Icon altarBottom; - @SideOnly(Side.CLIENT) - private Icon altarTop; - - public BlockJewelAltar(int par1) - { - super(par1, Material.iron); - } - - public static boolean isNormalCube(int par0) - { - return true; - } - - public void registerIcons(IconRegister par1IconRegister) - { - this.altarSide = par1IconRegister.registerIcon(this.getTextureName() + "_" + "side"); - this.altarBottom = par1IconRegister.registerIcon(this.getTextureName() + "_" + "bottom"); - this.altarTop = par1IconRegister.registerIcon(this.getTextureName() + "_" + "top"); - } - - public Icon getIcon(int par1, int par2) - { - return par1 == 1 ? this.altarTop : (par1 == 0 ? this.altarBottom : this.altarSide); - } - - @Override - public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { - TileEntityAltar te = (TileEntityAltar) world.getBlockTileEntity(i, j, k); - ItemStack item = entityPlayer.inventory.getCurrentItem(); - if (te != null && !world.isRemote) - { - if(item != null && item != new ItemStack(0, 0, 0) && (item.itemID == ItemList.ring.itemID || item.itemID == ItemList.necklace.itemID) && !te.hasObject) - { - te.object = item.copy(); - item.stackSize = 0; - te.playerName = entityPlayer.username; - te.isDirty = true; - te.hasObject = true; - } - - if(te.object != null && te.object != new ItemStack(0, 0, 0) && te.hasObject && entityPlayer.isSneaking()) - { - entityPlayer.inventory.addItemStackToInventory(te.object); - te.object = new ItemStack(0, 0, 0); - te.playerName = ""; - te.isDirty = true; - te.hasObject = false; - } - } - return true; - } - - @Override - public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) - { - TileEntityAltar te = (TileEntityAltar) world.getBlockTileEntity(i, j, k); - if (te != null && !world.isRemote) - { - if (te.object != null && te.object != new ItemStack(0, 0, 0)) - { - } - } - } - - public void dropItem(World world, double x, double y, double z, ItemStack stack) - { - EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack); - entityitem.motionX = 0; - entityitem.motionZ = 0; - entityitem.motionY = 0.11000000298023224D; - world.spawnEntityInWorld(entityitem); - } - - public void breakBlock(World world, int i, int j, int k, int par5, int par6) - { - TileEntityAltar te = (TileEntityAltar) world.getBlockTileEntity(i, j, k); - - if (te != null && te.object != null && te.object != new ItemStack(0, 0, 0)) - { - dropItem(te.worldObj, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.object); - world.markTileEntityForDespawn(te); - } - - super.breakBlock(world, i, j, k, par5, par6); - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileEntityAltar(); - } -} diff --git a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java deleted file mode 100644 index bf1d82f..0000000 --- a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java +++ /dev/null @@ -1,212 +0,0 @@ -package darkknight.jewelrycraft.block; - -import java.util.Random; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable; -import darkknight.jewelrycraft.util.JewelrycraftUtil; - -public class BlockJewelrsCraftingTable extends BlockContainer -{ - Random rand = new Random(); - - protected BlockJewelrsCraftingTable(int par1, Material par2Material) - { - super(par1, par2Material); - this.setBlockBounds(0.0F, 0F, 0.0F, 1.0F, 0.8F, 1.0F); - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileEntityJewelrsCraftingTable(); - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @Override - public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { - TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getBlockTileEntity(i, j, k); - ItemStack item = entityPlayer.inventory.getCurrentItem(); - if (te != null && !world.isRemote) - { - if (!te.hasEndItem && !te.hasJewelry && item != null && JewelrycraftUtil.isJewelry(item)) - { - if(te.hasModifier && te.hasJewel && item.hasTagCompound() && item.getTagCompound().hasKey("modifier") && item.getTagCompound().hasKey("jewel")) - entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrymodifiedfull")); - else if(te.hasJewel && item.hasTagCompound() && item.getTagCompound().hasKey("jewel")) - entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsjewel")); - else if(te.hasModifier && item.hasTagCompound() && item.getTagCompound().hasKey("modifier")) - entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsmodifier")); - else - { - te.jewelry = item.copy(); - te.hasJewelry = true; - if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; - entityPlayer.inventory.onInventoryChanged(); - world.setBlockTileEntity(i, j, k, te); - te.isDirty = true; - } - } - if (!te.hasEndItem && !te.hasModifier && item != null && JewelrycraftUtil.isModifier(item)) - { - if(te.hasJewelry && te.jewelry.hasTagCompound() && te.jewelry.getTagCompound().hasKey("modifier")) - entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsmodifier")); - else - { - te.modifier = item.copy(); - te.modifier.stackSize = 1; - te.hasModifier = true; - if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; - entityPlayer.inventory.onInventoryChanged(); - world.setBlockTileEntity(i, j, k, te); - te.isDirty = true; - } - } - if (!te.hasEndItem && !te.hasJewel && item != null && JewelrycraftUtil.isJewel(item)) - { - if(te.hasJewelry && te.jewelry.hasTagCompound() && te.jewelry.getTagCompound().hasKey("jewel")) - entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsjewel")); - else - { - te.jewel = item.copy(); - te.jewel.stackSize = 1; - te.hasJewel = true; - if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; - entityPlayer.inventory.onInventoryChanged(); - world.setBlockTileEntity(i, j, k, te); - te.isDirty = true; - } - } - if (te.timer <= 0 && !te.hasEndItem && te.hasJewelry && (te.hasModifier || te.hasJewel)){ te.timer = ConfigHandler.jewelryCraftingTime; te.angle = 0;} - if (te.hasEndItem && item != null) entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.hasenditem")); - - if (te.hasModifier && entityPlayer.isSneaking()) - { - dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.modifier.copy()); - te.modifier = new ItemStack(0, 0, 0); - te.hasModifier = false; - te.timer = 0; - te.angle = 0F; - te.isDirty = true; - world.markTileEntityForDespawn(te); - world.setBlockTileEntity(i, j, k, te); - } - if (te.hasJewelry && entityPlayer.isSneaking()) - { - dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelry.copy()); - te.jewelry = new ItemStack(0, 0, 0); - te.hasJewelry = false; - te.timer = 0; - te.angle = 0F; - te.isDirty = true; - world.markTileEntityForDespawn(te); - world.setBlockTileEntity(i, j, k, te); - } - if (te.hasJewel && entityPlayer.isSneaking()) - { - dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewel.copy()); - te.jewel = new ItemStack(0, 0, 0); - te.hasJewel = false; - te.timer = 0; - te.angle = 0F; - te.isDirty = true; - world.markTileEntityForDespawn(te); - world.setBlockTileEntity(i, j, k, te); - } - } - return true; - } - - public void dropItem(World world, double x, double y, double z, ItemStack stack) - { - EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack); - entityitem.motionX = 0; - entityitem.motionZ = 0; - entityitem.motionY = 0.21000000298023224D; - world.spawnEntityInWorld(entityitem); - } - - public void breakBlock(World world, int i, int j, int k, int par5, int par6) - { - TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getBlockTileEntity(i, j, k); - if (te != null) - { - if (te.hasModifier) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.modifier.copy()); - if (te.hasJewelry) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelry.copy()); - if (te.hasJewel) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewel.copy()); - if (te.hasEndItem) dropItem(te.worldObj, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy()); - world.markTileEntityForDespawn(te); - } - super.breakBlock(world, i, j, k, par5, par6); - } - - @Override - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) - { - int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - world.setBlockMetadataWithNotify(i, j, k, rotation, 2); - } - - @Override - public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) - { - TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getBlockTileEntity(i, j, k); - if (te != null && !world.isRemote) - { - if (te.hasEndItem) - { - dropItem(te.worldObj, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy()); - te.endItem = new ItemStack(0, 0, 0); - te.hasEndItem = false; - te.isDirty = true; - world.markTileEntityForDespawn(te); - world.setBlockTileEntity(i, j, k, te); - } - else if (te.hasJewelry && (te.hasModifier || te.hasJewel) && te.timer > 0 && te.jewelry != null) player.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.table.iscrafting", te.jewelry.getDisplayName()) + " (" + ((ConfigHandler.jewelryCraftingTime - te.timer) * 100 / ConfigHandler.jewelryCraftingTime) + "%)"); - else if ((!te.hasModifier || !te.hasJewel) && !te.hasJewelry) player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missingjewelryandmodifierorjewel")); - else if (!te.hasJewelry) player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missingjewelry")); - else if (!te.hasModifier || !te.hasJewel) player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missingmodifierorjewel")); - } - } - - @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) - { - return false; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public int getRenderType() - { - return -1; - } - - @Override - public void registerIcons(IconRegister icon) - { - this.blockIcon = icon.registerIcon("jewelrycraft:jewelrsCraftingTable"); - } -} diff --git a/common/darkknight/jewelrycraft/block/BlockList.java b/common/darkknight/jewelrycraft/block/BlockList.java deleted file mode 100644 index 5f7cbe6..0000000 --- a/common/darkknight/jewelrycraft/block/BlockList.java +++ /dev/null @@ -1,55 +0,0 @@ -package darkknight.jewelrycraft.block; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.registry.GameRegistry; -import darkknight.jewelrycraft.JewelrycraftMod; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.tileentity.*; - -public class BlockList -{ - public static Block shadowOre; - public static Block glow; - public static Block smelter; - public static Block molder; - public static Block displayer; - public static Block jewelCraftingTable; - public static Block shadowBlock; - public static Block jewelAltar; - - private static boolean isInitialized = false; - - public static void preInit(FMLPreInitializationEvent e) - { - if (!isInitialized) - { - shadowOre = new Block(ConfigHandler.idShadowOre, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setTextureName("jewelrycraft:oreShadow").setUnlocalizedName("Jewelrycraft.oreShadow").setCreativeTab(JewelrycraftMod.jewelrycraft); - glow = new BlockGlow(ConfigHandler.idGlow).setUnlocalizedName("Jewelrycraft.glow").setLightValue(1F); - smelter = new BlockSmelter(ConfigHandler.idSmelter, Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Jewelrycraft.smelter").setCreativeTab(JewelrycraftMod.jewelrycraft); - molder = new BlockMolder(ConfigHandler.idMolder, Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Jewelrycraft.molder").setCreativeTab(JewelrycraftMod.jewelrycraft); - displayer = new BlockDisplayer(ConfigHandler.idDisplayer, Material.iron).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("Jewelrycraft.displayer").setCreativeTab(JewelrycraftMod.jewelrycraft); - jewelCraftingTable = new BlockJewelrsCraftingTable(ConfigHandler.idJewelCraftingTable, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Jewelrycraft.jewelCraftingTable").setCreativeTab(JewelrycraftMod.jewelrycraft); - shadowBlock = new BlockShadow(ConfigHandler.idShadowBlock).setHardness(5.0F).setResistance(7.0F).setStepSound(Block.soundMetalFootstep).setTextureName("jewelrycraft:blockShadow").setUnlocalizedName("Jewelrycraft.blockShadow").setCreativeTab(JewelrycraftMod.jewelrycraft); - jewelAltar = new BlockJewelAltar(ConfigHandler.idAltar).setHardness(5.0F).setResistance(2.0F).setStepSound(Block.soundMetalFootstep).setTextureName("jewelrycraft:altar").setUnlocalizedName("Jewelrycraft.altar").setCreativeTab(JewelrycraftMod.jewelrycraft); - - GameRegistry.registerBlock(shadowOre, "shadowOre"); - GameRegistry.registerBlock(shadowBlock, "shadowBlock"); - GameRegistry.registerBlock(smelter, "Smelter"); - GameRegistry.registerBlock(molder, "Molder"); - GameRegistry.registerBlock(jewelCraftingTable, "jewelCraftingTable"); - GameRegistry.registerBlock(displayer, "Displayer"); - GameRegistry.registerBlock(jewelAltar, "Altar"); - - GameRegistry.registerTileEntity(TileEntitySmelter.class, "30"); - GameRegistry.registerTileEntity(TileEntityMolder.class, "31"); - GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, "32"); - GameRegistry.registerTileEntity(TileEntityDisplayer.class, "33"); - GameRegistry.registerTileEntity(TileEntityBlockShadow.class, "34"); - GameRegistry.registerTileEntity(TileEntityAltar.class, "35"); - - isInitialized = true; - } - } -} diff --git a/common/darkknight/jewelrycraft/block/BlockMolder.java b/common/darkknight/jewelrycraft/block/BlockMolder.java deleted file mode 100644 index f64b122..0000000 --- a/common/darkknight/jewelrycraft/block/BlockMolder.java +++ /dev/null @@ -1,145 +0,0 @@ -package darkknight.jewelrycraft.block; - -import java.util.Random; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.item.ItemList; -import darkknight.jewelrycraft.tileentity.TileEntityMolder; - -public class BlockMolder extends BlockContainer -{ - Random rand = new Random(); - - protected BlockMolder(int par1, Material par2Material) - { - super(par1, par2Material); - this.setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F); - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileEntityMolder(); - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @Override - public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { - TileEntityMolder te = (TileEntityMolder) world.getBlockTileEntity(i, j, k); - ItemStack item = entityPlayer.inventory.getCurrentItem(); - if (te != null && !world.isRemote) - { - if(item != null && !te.hasMold && item.itemID == ItemList.molds.itemID) - { - te.mold = item.copy(); - te.hasMold = true; - if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; - entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.molder.addedmold", te.mold.getDisplayName())); - te.isDirty = true; - } - if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal) - { - dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.mold.copy()); - te.mold = new ItemStack(0, 0, 0); - te.hasMold = false; - te.isDirty = true; - } - else if(te.hasMoltenMetal) entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.hasmoltenmetal")); - } - return true; - } - - public void dropItem(World world, double x, double y, double z, ItemStack stack) - { - EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack); - entityitem.motionX = 0; - entityitem.motionZ = 0; - entityitem.motionY = 0.11000000298023224D; - world.spawnEntityInWorld(entityitem); - } - - public void breakBlock(World world, int i, int j, int k, int par5, int par6) - { - TileEntityMolder te = (TileEntityMolder) world.getBlockTileEntity(i, j, k); - - if (te != null) - { - if(te.hasJewelBase) dropItem(te.worldObj, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.jewelBase.copy()); - if(te.hasMold) dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.mold.copy()); - world.markTileEntityForDespawn(te); - } - - super.breakBlock(world, i, j, k, par5, par6); - } - - @Override - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) - { - int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - world.setBlockMetadataWithNotify(i, j, k, rotation, 2); - } - - @Override - public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) - { - TileEntityMolder me = (TileEntityMolder) world.getBlockTileEntity(i, j, k); - if (me != null && !world.isRemote) - { - if (me.hasJewelBase) - { - dropItem(me.worldObj, (double)me.xCoord, (double)me.yCoord, (double)me.zCoord, me.jewelBase.copy()); - me.jewelBase = new ItemStack(0, 0, 0); - me.hasJewelBase = false; - } - else if (me.hasMoltenMetal && me.cooling > 0) - player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.metaliscooling") + " (" + ((ConfigHandler.ingotCoolingTime - me.cooling)*100/ConfigHandler.ingotCoolingTime) + "%)"); - else if (me.mold.itemID == ItemList.molds.itemID && !me.hasMoltenMetal) - player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldisempty")); - else if (me.mold.itemID != ItemList.molds.itemID) - player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldismissing")); - me.isDirty = true; - } - } - - @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) - { - return false; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public int getRenderType() - { - return -1; - } - - @Override - public void registerIcons(IconRegister icon) - { - this.blockIcon = icon.registerIcon("jewelrycraft:molder"); - } -} diff --git a/common/darkknight/jewelrycraft/block/BlockShadow.java b/common/darkknight/jewelrycraft/block/BlockShadow.java deleted file mode 100644 index 1e58d54..0000000 --- a/common/darkknight/jewelrycraft/block/BlockShadow.java +++ /dev/null @@ -1,100 +0,0 @@ -package darkknight.jewelrycraft.block; - -import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.Icon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; - -public class BlockShadow extends BlockContainer -{ - private Icon[] iconArray; - - public BlockShadow(int par1) - { - super(par1, Material.iron); - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - - public int getRenderBlockPass() - { - return 1; - } - - public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) - { - return true; - } - - public boolean isOpaqueCube() - { - return false; - } - - public boolean renderAsNormalBlock() - { - return false; - } - - public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) - { - return false; - } - - public static boolean isNormalCube(int par0) - { - return true; - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileEntityBlockShadow(); - } - - public void registerIcons(IconRegister par1IconRegister) - { - this.iconArray = new Icon[16]; - - for (int i = 0; i < this.iconArray.length; ++i) - { - this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + (15 - i)); - } - } - - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) - { - if(world.getBlockMetadata(x, y, z) == 15) return null; - return super.getCollisionBoundingBoxFromPool(world, x, y, z); - } - - public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) - { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - - public boolean shouldSideBeRendered(IBlockAccess iBlockAccess, int par2, int par3, int par4, int par5) - { - return iBlockAccess.isAirBlock(par2, par3, par4)?true:iBlockAccess.isBlockNormalCube(par2, par3, par4)?false:(iBlockAccess.getBlockId(par2, par3, par4) == BlockList.shadowBlock.blockID)?false:true; - } - - public boolean hasComparatorInputOverride() - { - return true; - } - - public int getComparatorInputOverride(World world, int x, int y, int z, int meta) - { - return world.getBlockMetadata(x, y, z); - } - - public Icon getIcon(int par1, int par2) - { - return this.iconArray[par2]; - } -} diff --git a/common/darkknight/jewelrycraft/block/BlockSmelter.java b/common/darkknight/jewelrycraft/block/BlockSmelter.java deleted file mode 100644 index 79fe7d6..0000000 --- a/common/darkknight/jewelrycraft/block/BlockSmelter.java +++ /dev/null @@ -1,191 +0,0 @@ -package darkknight.jewelrycraft.block; - -import java.util.Random; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraft.util.StatCollector; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.tileentity.TileEntityMolder; -import darkknight.jewelrycraft.tileentity.TileEntitySmelter; -import darkknight.jewelrycraft.util.JewelrycraftUtil; - -public class BlockSmelter extends BlockContainer -{ - Random rand = new Random(); - - protected BlockSmelter(int par1, Material par2Material) - { - super(par1, par2Material); - } - - @Override - public TileEntity createNewTileEntity(World world) - { - return new TileEntitySmelter(); - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - public void dropItem(World world, double x, double y, double z, ItemStack stack) - { - EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.3D, z + 0.5D, stack); - entityitem.motionX = 0; - entityitem.motionZ = 0; - entityitem.motionY = 0.11000000298023224D; - world.spawnEntityInWorld(entityitem); - } - - public void breakBlock(World world, int i, int j, int k, int par5, int par6) - { - TileEntitySmelter te = (TileEntitySmelter) world.getBlockTileEntity(i, j, k); - if (te != null && te.hasMetal){ - dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.metal.copy()); - world.markTileEntityForDespawn(te); - } - super.breakBlock(world, i, j, k, par5, par6); - } - - @Override - public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { - TileEntitySmelter te = (TileEntitySmelter) world.getBlockTileEntity(i, j, k); - ItemStack item = entityPlayer.inventory.getCurrentItem(); - if (te != null && !world.isRemote) - { - int index = -1; - for(int a = 0; a < JewelrycraftUtil.jamcraftPlayers.size(); a++) if(entityPlayer.username.equals(JewelrycraftUtil.jamcraftPlayers.get(a))) index = a; - if (!te.hasMetal && !te.hasMoltenMetal && item != null && (item.getUnlocalizedName().toLowerCase().contains("ingot") || index != -1) && !item.getUnlocalizedName().toLowerCase().contains("mold")) - { - entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.nowsmeltingingot", item.getDisplayName())); - te.metal = item.copy(); - te.metal.stackSize = 1; - te.hasMetal = true; - te.melting = ConfigHandler.ingotMeltingTime; - if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; - te.isDirty = true; - } - else if (te.hasMetal && !te.hasMoltenMetal && item != null && item.getDisplayName().contains("Ingot") && !item.getDisplayName().contains("Mold")) - entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.alreadyhasingot", te.metal.getDisplayName())); - else if (te.hasMoltenMetal) - entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.hasmolteningot", te.moltenMetal.getDisplayName())); - else if (item != null && !item.getUnlocalizedName().toLowerCase().contains("ingot") && item.getDisplayName().contains("Ingot")) - entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.itemrenamedtoingot")); - else if (item != null && (!item.getUnlocalizedName().toLowerCase().contains("ingot") || item.getUnlocalizedName().toLowerCase().contains("mold"))) - entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.itemneedstobeingot")); - - if (te.hasMetal && entityPlayer.isSneaking()) - { - dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.metal.copy()); - te.hasMetal = false; - te.melting = -1; - world.markTileEntityForDespawn(te); - world.setBlockTileEntity(i, j, k, te); - } - if(te != null) world.setBlockTileEntity(i, j, k, te); - } - return true; - } - - @Override - public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) - { - TileEntitySmelter te = (TileEntitySmelter) world.getBlockTileEntity(i, j, k); - TileEntityMolder me = null; - if (world.getBlockMetadata(i, j, k) == 0 && world.getBlockTileEntity(i, j, k - 1) != null && world.getBlockTileEntity(i, j, k - 1) instanceof TileEntityMolder) - me = (TileEntityMolder) world.getBlockTileEntity(i, j, k - 1); - else if (world.getBlockMetadata(i, j, k) == 1 && world.getBlockTileEntity(i + 1, j, k) != null && world.getBlockTileEntity(i + 1, j, k) instanceof TileEntityMolder) - me = (TileEntityMolder) world.getBlockTileEntity(i + 1, j, k); - else if (world.getBlockMetadata(i, j, k) == 2 && world.getBlockTileEntity(i, j, k + 1) != null && world.getBlockTileEntity(i, j, k + 1) instanceof TileEntityMolder) - me = (TileEntityMolder) world.getBlockTileEntity(i, j, k + 1); - else if (world.getBlockMetadata(i, j, k) == 3 && world.getBlockTileEntity(i - 1, j, k) != null && world.getBlockTileEntity(i - 1, j, k) instanceof TileEntityMolder) - me = (TileEntityMolder) world.getBlockTileEntity(i - 1, j, k); - - if (te != null && me != null && !world.isRemote) - { - if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) && me != null && me.hasMold && !me.hasMoltenMetal && !me.hasJewelBase) - { - me.moltenMetal = te.moltenMetal; - me.hasMoltenMetal = true; - me.cooling = ConfigHandler.ingotCoolingTime; - te.moltenMetal = new ItemStack(0, 0, 0); - te.hasMoltenMetal = false; - me.isDirty = true; - world.markTileEntityForDespawn(te); - world.setBlockTileEntity(i, j, k, te); - } - else if (te.hasMetal && te.melting > 0) - player.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.metalismelting", te.metal.getDisplayName()) + " (" + ((ConfigHandler.ingotMeltingTime - te.melting)*100/ConfigHandler.ingotMeltingTime) + "%)"); - else if (te.hasMoltenMetal && !isConnectedToMolder(world, i, j, k)) - player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderismissing")); - else if (!me.hasMold && te.hasMoltenMetal) - player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasnomold")); - else if (me.hasMoltenMetal && te.hasMoltenMetal) - player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasmoltenmetal")); - else if (me.hasJewelBase && te.hasMoltenMetal) - player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.modlerhasitem")); - else - player.addChatMessage(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.empty")); - } - - } - - public boolean isConnectedToMolder(World world, int i, int j, int k) - { - int blockMeta = world.getBlockMetadata(i, j, k); - if (blockMeta == 0 && world.getBlockId(i, j, k - 1) == BlockList.molder.blockID) - return true; - else if (blockMeta == 1 && world.getBlockId(i + 1, j, k) == BlockList.molder.blockID) - return true; - else if (blockMeta == 2 && world.getBlockId(i, j, k + 1) == BlockList.molder.blockID) - return true; - else if (blockMeta == 3 && world.getBlockId(i - 1, j, k) == BlockList.molder.blockID) - return true; - return false; - } - - @Override - public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) - { - int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - world.setBlockMetadataWithNotify(i, j, k, rotation, 2); - } - - @Override - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) - { - return false; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public int getRenderType() - { - return -1; - } - - @Override - public void registerIcons(IconRegister icon) - { - this.blockIcon = icon.registerIcon("jewelrycraft:smelter"); - } - -} |
