summaryrefslogtreecommitdiff
path: root/java/darkknight/jewelrycraft/block
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-02-21 21:31:16 +0000
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-02-21 21:31:16 +0000
commit420faddca46e70e3a70def168fb4e452ef193b0d (patch)
tree247e334012e4bf9e4fa6d42718bf601ce6bd42d9 /java/darkknight/jewelrycraft/block
parent3f4c717de5ebc9b942d65ae45ac87c43bdf8a31b (diff)
Added just a butt ton of stuff, also thanks to pau101 for helping me with the Hand Pedestal animation :)
Diffstat (limited to 'java/darkknight/jewelrycraft/block')
-rw-r--r--java/darkknight/jewelrycraft/block/BlockDisplayer.java239
-rw-r--r--java/darkknight/jewelrycraft/block/BlockGlow.java39
-rw-r--r--java/darkknight/jewelrycraft/block/BlockHandPedestal.java117
-rw-r--r--java/darkknight/jewelrycraft/block/BlockJCOre.java6
-rw-r--r--java/darkknight/jewelrycraft/block/BlockJewelAltar.java101
-rw-r--r--java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java166
-rw-r--r--java/darkknight/jewelrycraft/block/BlockList.java14
-rw-r--r--java/darkknight/jewelrycraft/block/BlockMolder.java117
-rw-r--r--java/darkknight/jewelrycraft/block/BlockMoltenMetal.java236
-rw-r--r--java/darkknight/jewelrycraft/block/BlockShadow.java120
-rw-r--r--java/darkknight/jewelrycraft/block/BlockShadowEye.java61
-rw-r--r--java/darkknight/jewelrycraft/block/BlockShadowHand.java74
-rw-r--r--java/darkknight/jewelrycraft/block/BlockSmelter.java138
13 files changed, 896 insertions, 532 deletions
diff --git a/java/darkknight/jewelrycraft/block/BlockDisplayer.java b/java/darkknight/jewelrycraft/block/BlockDisplayer.java
index 3bb8fbb..50c7c13 100644
--- a/java/darkknight/jewelrycraft/block/BlockDisplayer.java
+++ b/java/darkknight/jewelrycraft/block/BlockDisplayer.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.block;
import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -21,164 +20,175 @@ public class BlockDisplayer extends BlockContainer
{
Random rand = new Random();
+ /**
+ * @param par2Material
+ */
protected BlockDisplayer(Material par2Material)
{
super(par2Material);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityDisplayer();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@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.getTileEntity(i, j, k);
+ TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null)
- {
- if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote)
- {
- if (!te.hasObject)
- {
+ if (te != null){
+ if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote){
+ if (!te.hasObject){
te.object = item.copy();
te.quantity += item.stackSize;
te.object.stackSize = 1;
te.hasObject = true;
if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
te.isDirty = true;
+ }else if (te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
+ te.isDirty = true;
+ }else if (!te.object.hasTagCompound() && !item.hasTagCompound()){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
+ te.isDirty = true;
}
- else if (te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage())
- {
- if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound()))
- {
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
- te.isDirty = true;
- }
- else if (!te.object.hasTagCompound() && !item.hasTagCompound())
- {
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
- te.isDirty = true;
- }
+ }else if (item == null || item == new ItemStack(Item.getItemById(0), 0, 0)) if (!entityPlayer.capabilities.isCreativeMode) for(int inv = 0; inv < entityPlayer.inventory.getSizeInventory(); inv++){
+ item = entityPlayer.inventory.getStackInSlot(inv);
+ if (item != null && te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
+ te.isDirty = true;
+ te.markDirty();
+ }else if (!te.object.hasTagCompound() && !item.hasTagCompound()){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
+ te.isDirty = true;
}
}
- else if (item == null || item == new ItemStack(Item.getItemById(0), 0, 0))
- {
- if (!entityPlayer.capabilities.isCreativeMode)
- {
- for (int inv = 0; inv < entityPlayer.inventory.getSizeInventory(); inv++)
- {
- item = entityPlayer.inventory.getStackInSlot(inv);
- if (item != null && te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage())
- {
- if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound()))
- {
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
- te.isDirty = true;
- te.markDirty();
- }
- else if (!te.object.hasTagCompound() && !item.hasTagCompound())
- {
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
- te.isDirty = true;
- }
- }
- }
- }
- else if(entityPlayer.capabilities.isCreativeMode && te.hasObject && te.object.getItem() != null)
- {
- te.quantity += 64;
- te.isDirty = true;
- }
+ else if (entityPlayer.capabilities.isCreativeMode && te.hasObject && te.object.getItem() != null){
+ te.quantity += 64;
+ te.isDirty = true;
}
- te.isDirty = true;
+ te.isDirty = true;
}
return true;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
- TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k);
- if (te != null && !world.isRemote)
- {
- if (te.hasObject && te.object != null && te.object != new ItemStack(Item.getItemById(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();
- te.isDirty = true;
- }
- else
- {
- te.object.stackSize = te.quantity - 1;
- player.inventory.addItemStackToInventory(te.object);
- te.hasObject = false;
- te.object = new ItemStack(Item.getItemById(0), 0, 0);
- te.quantity = 0;
- te.isDirty = true;
- }
- te.isDirty = true;
- }
- else
- {
- if (te.quantity >= 2)
- {
- player.inventory.addItemStackToInventory(te.object);
- te.object.stackSize = 1;
- te.quantity--;
- te.isDirty = true;
- }
- else
- {
- player.inventory.addItemStackToInventory(te.object);
- te.object.stackSize = 1;
- te.hasObject = false;
- te.object = new ItemStack(Item.getItemById(0), 0, 0);
- te.quantity = 0;
- te.isDirty = true;
- }
- te.isDirty = true;
- }
+ TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
+ if (te != null && !world.isRemote) if (te.hasObject && te.object != null && te.object != new ItemStack(Item.getItemById(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();
+ te.isDirty = true;
+ }else{
+ te.object.stackSize = te.quantity - 1;
+ player.inventory.addItemStackToInventory(te.object);
+ te.hasObject = false;
+ te.object = new ItemStack(Item.getItemById(0), 0, 0);
+ te.quantity = 0;
+ te.isDirty = true;
}
+ te.isDirty = true;
+ }else{
+ if (te.quantity >= 2){
+ player.inventory.addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.quantity--;
+ te.isDirty = true;
+ }else{
+ player.inventory.addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.hasObject = false;
+ te.object = new ItemStack(Item.getItemById(0), 0, 0);
+ te.quantity = 0;
+ te.isDirty = true;
+ }
+ te.isDirty = true;
}
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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);
@@ -188,20 +198,34 @@ public class BlockDisplayer extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block block, int par6)
{
- TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k);
-
- if (te != null && te.hasObject)
- {
+ TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
+ if (te != null && te.hasObject){
te.object.stackSize = te.quantity;
- dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.object);
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.object);
world.removeTileEntity(i, j, k);
}
-
super.breakBlock(world, i, j, k, block, par6);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -209,9 +233,12 @@ public class BlockDisplayer extends BlockContainer
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param icon
+ */
@Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("jewelrycraft:displayer");
+ blockIcon = icon.registerIcon("jewelrycraft:displayer");
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockGlow.java b/java/darkknight/jewelrycraft/block/BlockGlow.java
deleted file mode 100644
index 39f7b26..0000000
--- a/java/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()
- {
- super(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/java/darkknight/jewelrycraft/block/BlockHandPedestal.java b/java/darkknight/jewelrycraft/block/BlockHandPedestal.java
index 95fecfc..6fe5b7f 100644
--- a/java/darkknight/jewelrycraft/block/BlockHandPedestal.java
+++ b/java/darkknight/jewelrycraft/block/BlockHandPedestal.java
@@ -1,7 +1,5 @@
package darkknight.jewelrycraft.block;
-import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -9,7 +7,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
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.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
@@ -19,106 +16,156 @@ import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
public class BlockHandPedestal extends BlockContainer
{
- Random rand = new Random();
- protected BlockHandPedestal(Material par2Material)
+ /**
+ * @param material
+ */
+ protected BlockHandPedestal(Material material)
{
- super(par2Material);
- this.setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
+ super(material);
+ setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityHandPedestal();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
- TileEntityHandPedestal te = (TileEntityHandPedestal) world.getTileEntity(i, j, k);
+ TileEntityHandPedestal te = (TileEntityHandPedestal)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null)
- {
- if (!te.hasObject && item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote)
- {
- te.object = item.copy();
- te.object.stackSize = 1;
- te.hasObject = true;
+ if (te != null){
+ if (!world.isRemote && te.getHeldItemStack() == null && item != null){
+ te.setHeldItemStack(item.copy());
+ te.closeHand();
if (!entityPlayer.capabilities.isCreativeMode) item.stackSize--;
- te.isDirty = true;
te.markDirty();
+ }else if (entityPlayer.isSneaking()) if (entityPlayer.inventory.addItemStackToInventory(te.getHeldItemStack())){
+ te.removeHeldItemStack();
+ te.openHand();
}
- else if(entityPlayer.isSneaking())
- {
- if(entityPlayer.inventory.addItemStackToInventory(te.object))
- {
- te.hasObject = false;
- te.object = new ItemStack(Item.getItemById(0), 0, 0);
- }
- }
- te.isDirty = true;
te.markDirty();
}
return true;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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 entityitem = new EntityItem(world, x + 0.5, y + 1.5, z + 0.5, stack);
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.11000000298023224D;
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block block, int par6)
{
- TileEntityHandPedestal te = (TileEntityHandPedestal) world.getTileEntity(i, j, k);
-
- if (te != null && te.hasObject)
- {
- dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.object);
+ TileEntityHandPedestal te = (TileEntityHandPedestal)world.getTileEntity(i, j, k);
+ if (te != null && te.getHeldItemStack() != null){
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack());
world.removeTileEntity(i, j, k);
}
-
super.breakBlock(world, i, j, k, block, par6);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
- int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8.0F / 360.0F + 0.5D) & 7;
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8 / 360 + 0.5) & 7;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param icon
+ */
@Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("minecraft:stonebrick");
+ blockIcon = icon.registerIcon("minecraft:stonebrick");
}
-}
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/block/BlockJCOre.java b/java/darkknight/jewelrycraft/block/BlockJCOre.java
index e6bb31c..6fafe66 100644
--- a/java/darkknight/jewelrycraft/block/BlockJCOre.java
+++ b/java/darkknight/jewelrycraft/block/BlockJCOre.java
@@ -2,11 +2,13 @@ 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 BlockJCOre extends Block
{
+
+ /**
+ *
+ */
protected BlockJCOre()
{
super(Material.rock);
diff --git a/java/darkknight/jewelrycraft/block/BlockJewelAltar.java b/java/darkknight/jewelrycraft/block/BlockJewelAltar.java
index 4e53832..e0a43bc 100644
--- a/java/darkknight/jewelrycraft/block/BlockJewelAltar.java
+++ b/java/darkknight/jewelrycraft/block/BlockJewelAltar.java
@@ -18,44 +18,71 @@ import darkknight.jewelrycraft.tileentity.TileEntityAltar;
public class BlockJewelAltar extends BlockContainer
{
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
private IIcon altarSide;
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
private IIcon altarBottom;
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
private IIcon altarTop;
+ /**
+ *
+ */
public BlockJewelAltar()
{
super(Material.iron);
}
+ /**
+ * @param par0
+ * @return
+ */
public static boolean isNormalCube(int par0)
{
return true;
}
+ /**
+ * @param par1IconRegister
+ */
+ @Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
- this.altarSide = par1IconRegister.registerIcon(this.getTextureName() + "_" + "side");
- this.altarBottom = par1IconRegister.registerIcon(this.getTextureName() + "_" + "bottom");
- this.altarTop = par1IconRegister.registerIcon(this.getTextureName() + "_" + "top");
+ altarSide = par1IconRegister.registerIcon(getTextureName() + "_" + "side");
+ altarBottom = par1IconRegister.registerIcon(getTextureName() + "_" + "bottom");
+ altarTop = par1IconRegister.registerIcon(getTextureName() + "_" + "top");
}
+ /**
+ * @param par1
+ * @param par2
+ * @return
+ */
+ @Override
public IIcon getIcon(int par1, int par2)
{
- return par1 == 1 ? this.altarTop : (par1 == 0 ? this.altarBottom : this.altarSide);
+ return par1 == 1 ? altarTop : par1 == 0 ? altarBottom : altarSide;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@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.getTileEntity(i, j, k);
+ TileEntityAltar te = (TileEntityAltar)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && !world.isRemote)
- {
- if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && (item.getItem() == ItemList.ring || item.getItem() == ItemList.necklace) && !te.hasObject)
- {
+ if (te != null && !world.isRemote){
+ if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && (item.getItem() == ItemList.ring || item.getItem() == ItemList.necklace) && !te.hasObject){
te.object = item.copy();
item.stackSize = 0;
te.playerName = entityPlayer.getDisplayName();
@@ -63,9 +90,7 @@ public class BlockJewelAltar extends BlockContainer
te.markDirty();
te.hasObject = true;
}
-
- if (te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.hasObject && entityPlayer.isSneaking())
- {
+ if (te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.hasObject && entityPlayer.isSneaking()){
entityPlayer.inventory.addItemStackToInventory(te.object);
te.object = new ItemStack(Item.getItemById(0), 0, 0);
te.playerName = "";
@@ -77,18 +102,27 @@ public class BlockJewelAltar extends BlockContainer
return true;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
- TileEntityAltar te = (TileEntityAltar) world.getTileEntity(i, j, k);
- if (te != null && !world.isRemote)
- {
- if (te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0))
- {
- }
- }
+ TileEntityAltar te = (TileEntityAltar)world.getTileEntity(i, j, k);
+ if (te != null && !world.isRemote) if (te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0)){}
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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);
@@ -98,19 +132,30 @@ public class BlockJewelAltar extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block block, int par6)
{
- TileEntityAltar te = (TileEntityAltar) world.getTileEntity(i, j, k);
-
- if (te != null && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0))
- {
- dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.object);
+ TileEntityAltar te = (TileEntityAltar)world.getTileEntity(i, j, k);
+ if (te != null && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0)){
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.object);
world.removeTileEntity(i, j, k);
}
-
super.breakBlock(world, i, j, k, block, par6);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
diff --git a/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
index f9dfc67..fae445e 100644
--- a/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
+++ b/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.block;
import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -25,49 +24,68 @@ public class BlockJewelrsCraftingTable extends BlockContainer
{
Random rand = new Random();
+ /**
+ * @param par2Material
+ */
protected BlockJewelrsCraftingTable(Material par2Material)
{
super(par2Material);
- this.setBlockBounds(0.0F, 0F, 0.0F, 1.0F, 0.8F, 1.0F);
+ setBlockBounds(0.0F, 0F, 0.0F, 1.0F, 0.8F, 1.0F);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityJewelrsCraftingTable();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@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.getTileEntity(i, j, k);
+ TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && !world.isRemote)
- {
+ if (te != null && !world.isRemote){
if (te.hasEndItem && item != null) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.hasenditem")));
- if (!te.hasEndItem && !te.hasJewelry && item != null && JewelrycraftUtil.isJewelry(item))
- {
+ if (!te.hasEndItem && !te.hasJewelry && item != null && JewelrycraftUtil.isJewelry(item)){
te.jewelry = item.copy();
te.hasJewelry = true;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
te.isDirty = true;
}
- if (!te.hasEndItem && !te.hasGem && item != null && JewelrycraftUtil.isGem(item))
- {
+ if (!te.hasEndItem && !te.hasGem && item != null && JewelrycraftUtil.isGem(item)){
te.gem = item.copy();
te.gem.stackSize = 1;
te.hasGem = true;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
te.isDirty = true;
}
- if (!te.hasEndItem && te.hasJewelry && te.hasGem && !te.crafting)
- {
+ if (!te.hasEndItem && te.hasJewelry && te.hasGem && !te.crafting){
te.carving = ConfigHandler.jewelryCraftingTime;
te.angle = 0;
te.crafting = true;
@@ -77,6 +95,13 @@ public class BlockJewelrsCraftingTable extends BlockContainer
return true;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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);
@@ -86,19 +111,35 @@ public class BlockJewelrsCraftingTable extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param par5
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
{
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
- if (te != null)
- {
- if (te.hasJewelry) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelry.copy());
- if (te.hasGem) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.gem.copy());
- if (te.hasEndItem) dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy());
+ TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable)world.getTileEntity(i, j, k);
+ if (te != null){
+ if (te.hasJewelry) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.jewelry.copy());
+ if (te.hasGem) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.gem.copy());
+ if (te.hasEndItem) dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.endItem.copy());
world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, par5, par6);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -106,71 +147,84 @@ public class BlockJewelrsCraftingTable extends BlockContainer
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
- if (te != null && !world.isRemote)
- {
- if (player.isSneaking())
- {
- if (te.hasJewelry)
- {
- dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelry.copy());
- te.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- te.hasJewelry = false;
- te.carving = -1;
- te.crafting = false;
- te.angle = 0F;
- te.isDirty = true;
- }
- if (te.hasGem)
- {
- dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.gem.copy());
- te.gem = new ItemStack(Item.getItemById(0), 0, 0);
- te.hasGem = false;
- te.carving = -1;
- te.crafting = false;
- te.angle = 0F;
- te.isDirty = true;
- }
+ TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable)world.getTileEntity(i, j, k);
+ if (te != null && !world.isRemote) if (player.isSneaking()){
+ if (te.hasJewelry){
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.jewelry.copy());
+ te.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ te.hasJewelry = false;
+ te.carving = -1;
+ te.crafting = false;
+ te.angle = 0F;
+ te.isDirty = true;
}
- else
- {
- if (te.hasEndItem)
- {
- dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy());
- te.endItem = new ItemStack(Item.getItemById(0), 0, 0);
- te.hasEndItem = false;
- te.isDirty = true;
- }
- else if (te.hasJewelry && te.hasGem && te.carving > 0 && te.jewelry != null) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.table.iscrafting", te.jewelry.getDisplayName()) + " (" + ((ConfigHandler.jewelryCraftingTime - te.carving) * 100 / ConfigHandler.jewelryCraftingTime) + "%)"));
- else if (!te.hasGem) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missinggem")));
- else if (!te.hasJewelry) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missingjewelry")));
+ if (te.hasGem){
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.gem.copy());
+ te.gem = new ItemStack(Item.getItemById(0), 0, 0);
+ te.hasGem = false;
+ te.carving = -1;
+ te.crafting = false;
+ te.angle = 0F;
+ te.isDirty = true;
}
- }
+ }else if (te.hasEndItem){
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.endItem.copy());
+ te.endItem = new ItemStack(Item.getItemById(0), 0, 0);
+ te.hasEndItem = false;
+ te.isDirty = true;
+ }else if (te.hasJewelry && te.hasGem && te.carving > 0 && te.jewelry != null) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.table.iscrafting", te.jewelry.getDisplayName()) + " (" + (ConfigHandler.jewelryCraftingTime - te.carving) * 100 / ConfigHandler.jewelryCraftingTime + "%)"));
+ else if (!te.hasGem) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missinggem")));
+ else if (!te.hasJewelry) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missingjewelry")));
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param icon
+ */
+ @Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("jewelrycraft:jewelrsCraftingTable");
+ blockIcon = icon.registerIcon("jewelrycraft:jewelrsCraftingTable");
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockList.java b/java/darkknight/jewelrycraft/block/BlockList.java
index b244a19..80a984c 100644
--- a/java/darkknight/jewelrycraft/block/BlockList.java
+++ b/java/darkknight/jewelrycraft/block/BlockList.java
@@ -19,18 +19,18 @@ import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
public class BlockList
{
- public static Block shadowOre, glow, smelter, molder, displayer, jewelCraftingTable, shadowBlock, shadowEye, jewelAltar, handPedestal, shadowHand;
+ public static Block shadowOre, smelter, molder, displayer, jewelCraftingTable, shadowBlock, shadowEye, jewelAltar, handPedestal, shadowHand;
public static BlockMoltenMetal moltenMetal;
public static Fluid moltenMetalFluid;
-
private static boolean isInitialized = false;
+ /**
+ * @param e
+ */
public static void preInit(FMLPreInitializationEvent e)
{
- if (!isInitialized)
- {
+ if (!isInitialized){
shadowOre = new BlockJCOre().setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypePiston).setBlockTextureName("jewelrycraft:oreShadow").setBlockName("Jewelrycraft.oreShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
- glow = new BlockGlow().setBlockName("Jewelrycraft.glow").setLightLevel(1F);
smelter = new BlockSmelter().setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName("Jewelrycraft.smelter").setCreativeTab(JewelrycraftMod.jewelrycraft);
molder = new BlockMolder(Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName("Jewelrycraft.molder").setCreativeTab(JewelrycraftMod.jewelrycraft);
displayer = new BlockDisplayer(Material.iron).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypeMetal).setBlockName("Jewelrycraft.displayer").setCreativeTab(JewelrycraftMod.jewelrycraft);
@@ -40,7 +40,6 @@ public class BlockList
shadowEye = new BlockShadowEye().setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName("Jewelrycraft.shadowEye").setCreativeTab(JewelrycraftMod.jewelrycraft);
handPedestal = new BlockHandPedestal(Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName("Jewelrycraft.handPedestal").setCreativeTab(JewelrycraftMod.jewelrycraft);
shadowHand = new BlockShadowHand(Material.rock).setStepSound(Block.soundTypePiston).setBlockName("Jewelrycraft.shadowHand").setCreativeTab(JewelrycraftMod.jewelrycraft).setBlockUnbreakable();
-
GameRegistry.registerBlock(shadowOre, "shadowOre");
GameRegistry.registerBlock(shadowBlock, "shadowBlock");
GameRegistry.registerBlock(smelter, "Smelter");
@@ -51,7 +50,6 @@ public class BlockList
GameRegistry.registerBlock(shadowEye, "Shadow Eye");
GameRegistry.registerBlock(handPedestal, "Stone Bricks Pedestal");
GameRegistry.registerBlock(shadowHand, "Shadow Hand");
-
GameRegistry.registerTileEntity(TileEntitySmelter.class, "jewelrycraft:smelter");
GameRegistry.registerTileEntity(TileEntityMolder.class, "jewelrycraft:molder");
GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, "jewelrycraft:table");
@@ -61,12 +59,10 @@ public class BlockList
GameRegistry.registerTileEntity(TileEntityShadowEye.class, "jewelrycraft:shadowEye");
GameRegistry.registerTileEntity(TileEntityHandPedestal.class, "jewelrycraft:handPedestal");
GameRegistry.registerTileEntity(TileEntityShadowHand.class, "jewelrycraft:shadowHand");
-
moltenMetalFluid = new Fluid("metal.molten").setLuminosity(15).setDensity(3000).setTemperature(2000).setViscosity(6000);
if (!FluidRegistry.registerFluid(moltenMetalFluid)) moltenMetalFluid = FluidRegistry.getFluid("metal.molten");
moltenMetal = new BlockMoltenMetal(moltenMetalFluid, Material.lava);
GameRegistry.registerBlock(moltenMetal, "moltenMetalLiquid");
-
isInitialized = true;
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockMolder.java b/java/darkknight/jewelrycraft/block/BlockMolder.java
index 8b7d47d..ce5e58b 100644
--- a/java/darkknight/jewelrycraft/block/BlockMolder.java
+++ b/java/darkknight/jewelrycraft/block/BlockMolder.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.block;
import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -25,51 +24,77 @@ public class BlockMolder extends BlockContainer
{
Random rand = new Random();
+ /**
+ * @param par2Material
+ */
protected BlockMolder(Material par2Material)
{
super(par2Material);
- this.setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F);
+ setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityMolder();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@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.getTileEntity(i, j, k);
+ TileEntityMolder te = (TileEntityMolder)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && !world.isRemote)
- {
- if (item != null && !te.hasMold && item.getItem() == ItemList.molds)
- {
+ if (te != null && !world.isRemote){
+ if (item != null && !te.hasMold && item.getItem() == ItemList.molds){
te.mold = item.copy();
te.hasMold = true;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
entityPlayer.addChatMessage(new ChatComponentText(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());
+ if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal){
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy());
te.mold = new ItemStack(Item.getItemById(0), 0, 0);
te.hasMold = false;
te.isDirty = true;
- }
- else if (te.hasMoltenMetal) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.hasmoltenmetal")));
+ }else if (te.hasMoltenMetal) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.hasmoltenmetal")));
}
return true;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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);
@@ -79,20 +104,34 @@ public class BlockMolder extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param par5
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
{
- TileEntityMolder te = (TileEntityMolder) world.getTileEntity(i, j, k);
-
- if (te != null)
- {
- if (te.hasJewelBase) dropItem(te.getWorldObj(), (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());
+ TileEntityMolder te = (TileEntityMolder)world.getTileEntity(i, j, k);
+ if (te != null){
+ if (te.hasJewelBase) dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.jewelBase.copy());
+ if (te.hasMold) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy());
world.removeTileEntity(i, j, k);
}
-
super.breakBlock(world, i, j, k, par5, par6);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -100,45 +139,67 @@ public class BlockMolder extends BlockContainer
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
- TileEntityMolder me = (TileEntityMolder) world.getTileEntity(i, j, k);
- if (me != null && !world.isRemote)
- {
- if (me.hasJewelBase)
- {
- dropItem(me.getWorldObj(), (double) me.xCoord, (double) me.yCoord, (double) me.zCoord, me.jewelBase.copy());
+ TileEntityMolder me = (TileEntityMolder)world.getTileEntity(i, j, k);
+ if (me != null && !world.isRemote){
+ if (me.hasJewelBase){
+ dropItem(me.getWorldObj(), me.xCoord, me.yCoord, me.zCoord, me.jewelBase.copy());
me.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
me.hasJewelBase = false;
- }
- else if (me.hasMoltenMetal && me.cooling >= 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.metaliscooling") + " (" + ((ConfigHandler.ingotCoolingTime - me.cooling) * 100 / ConfigHandler.ingotCoolingTime) + "%)"));
+ }else if (me.hasMoltenMetal && me.cooling >= 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.metaliscooling") + " (" + (ConfigHandler.ingotCoolingTime - me.cooling) * 100 / ConfigHandler.ingotCoolingTime + "%)"));
else if (me.mold.getItem() == ItemList.molds && !me.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldisempty")));
else if (me.mold.getItem() != ItemList.molds) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldismissing")));
me.isDirty = true;
}
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param icon
+ */
+ @Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("jewelrycraft:molder");
+ blockIcon = icon.registerIcon("jewelrycraft:molder");
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java b/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
index da3c5c1..ee67aff 100644
--- a/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
+++ b/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
@@ -1,29 +1,14 @@
package darkknight.jewelrycraft.block;
-import java.awt.image.BufferedImage;
import java.io.IOException;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import java.util.Random;
-
-import javax.imageio.ImageIO;
-
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.client.renderer.texture.TextureManager;
-import net.minecraft.client.resources.IResourceManager;
import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic;
@@ -33,39 +18,56 @@ import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.network.PacketRequestLiquidData;
import darkknight.jewelrycraft.network.PacketSendLiquidData;
-import darkknight.jewelrycraft.util.JewelryNBT;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class BlockMoltenMetal extends BlockFluidClassic
{
-
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
protected IIcon stillIcon;
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
protected IIcon flowingIcon;
+ /**
+ * @param fluid
+ * @param material
+ */
public BlockMoltenMetal(Fluid fluid, Material material)
{
super(fluid, material);
setBlockName("Jewelrycraft.moltenMetal");
- this.setQuantaPerBlock(5);
- this.setRenderPass(1);
+ setQuantaPerBlock(5);
+ setRenderPass(1);
setLightLevel(15f);
}
+ /**
+ * @param side
+ * @param meta
+ * @return
+ */
@Override
public IIcon getIcon(int side, int meta)
{
- return (side == 0 || side == 1) ? stillIcon : flowingIcon;
+ return side == 0 || side == 1 ? stillIcon : flowingIcon;
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param register
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public void registerBlockIcons(IIconRegister register)
{
stillIcon = register.registerIcon("jewelrycraft:moltenMetalStill");
flowingIcon = register.registerIcon("jewelrycraft:moltenMetalFlow");
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
@Override
public boolean canDisplace(IBlockAccess world, int x, int y, int z)
{
@@ -73,6 +75,13 @@ public class BlockMoltenMetal extends BlockFluidClassic
return super.canDisplace(world, x, y, z);
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
@Override
public boolean displaceIfPossible(World world, int x, int y, int z)
{
@@ -80,87 +89,77 @@ public class BlockMoltenMetal extends BlockFluidClassic
return super.displaceIfPossible(world, x, y, z);
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
@Override
protected boolean canFlowInto(IBlockAccess world, int x, int y, int z)
{
if (world.getBlock(x, y, z).isAir(world, x, y, z)) return true;
-
Block block = world.getBlock(x, y, z);
- if (block == this) { return false; }
-
- if (displacements.containsKey(block)) { return displacements.get(block); }
-
+ if (block == this) return false;
+ if (displacements.containsKey(block)) return displacements.get(block);
Material material = block.getMaterial();
- if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal) { return false; }
-
+ if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal) return false;
int density = getDensity(world, x, y, z);
- if (density == Integer.MAX_VALUE) { return true; }
-
- if (this.density > density)
- {
- return true;
- }
- else
- {
- return false;
- }
+ if (density == Integer.MAX_VALUE) return true;
+ if (this.density > density) return true;
+ else return false;
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @return
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int i, int j, int k)
{
- try
- {
+ try{
return color(world, i, j, k, false, null);
}
- catch (IOException e)
- {
+ catch(IOException e){
e.printStackTrace();
}
return 0;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param rand
+ */
@Override
public void updateTick(World world, int x, int y, int z, Random rand)
{
int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z);
int expQuanta = -101;
-
// check adjacent block levels if non-source
- if (quantaRemaining < quantaPerBlock)
- {
+ if (quantaRemaining < quantaPerBlock){
int y2 = y - densityDir;
-
- if ((world.getBlock(x, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
- (world.getBlock(x - 1, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x - 1, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
- (world.getBlock(x + 1, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x + 1, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
- (world.getBlock(x, y2, z - 1) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z - 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
- (world.getBlock(x, y2, z + 1) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z + 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))))
- {
- expQuanta = quantaPerBlock - 1;
- }
- else
- {
+ if (world.getBlock(x, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId))) || world.getBlock(x - 1, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x - 1, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId))) || world.getBlock(x + 1, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x + 1, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId))) || world.getBlock(x, y2, z - 1) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z - 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId))) || world.getBlock(x, y2, z + 1) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z + 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) expQuanta = quantaPerBlock - 1;
+ else{
int maxQuanta = -100;
- if(JewelrycraftMod.saveData.getString(stringFromLocation(x - 1, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta);
- if(JewelrycraftMod.saveData.getString(stringFromLocation(x + 1, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta);
- if(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z - 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta);
- if(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z + 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta);
-
+ if (JewelrycraftMod.saveData.getString(stringFromLocation(x - 1, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta);
+ if (JewelrycraftMod.saveData.getString(stringFromLocation(x + 1, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta);
+ if (JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z - 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta);
+ if (JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z + 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta);
expQuanta = maxQuanta - 1;
}
-
// decay calculation
- if (expQuanta != quantaRemaining)
- {
+ if (expQuanta != quantaRemaining){
quantaRemaining = expQuanta;
-
- if (expQuanta <= 0)
- {
- world.setBlock(x, y, z, Blocks.air);
- }
- else
- {
+ if (expQuanta <= 0) world.setBlock(x, y, z, Blocks.air);
+ else{
world.setBlockMetadataWithNotify(x, y, z, quantaPerBlock - expQuanta, 3);
world.scheduleBlockUpdate(x, y, z, this, tickRate);
world.notifyBlocksOfNeighborChange(x, y, z, this);
@@ -169,61 +168,51 @@ public class BlockMoltenMetal extends BlockFluidClassic
}
// This is a "source" block, set meta to zero, and send a server only
// update
- else if (quantaRemaining >= quantaPerBlock)
- {
- world.setBlockMetadataWithNotify(x, y, z, 0, 2);
- }
-
+ else if (quantaRemaining >= quantaPerBlock) world.setBlockMetadataWithNotify(x, y, z, 0, 2);
String originData = JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId));
-
// Flow vertically if possible
- if (canDisplace(world, x, y + densityDir, z))
- {
+ if (canDisplace(world, x, y + densityDir, z)){
JewelrycraftMod.saveData.setString(stringFromLocation(x, y + densityDir, z, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
flowIntoBlock(world, x, y + densityDir, z, 1, originData);
return;
}
-
// Flow outward if possible
int flowMeta = quantaPerBlock - quantaRemaining + 1;
- if (flowMeta >= quantaPerBlock) { return; }
-
- if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z))
- {
- if (world.getBlock(x, y - densityDir, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y - densityDir, z, world.provider.dimensionId))))
- {
- flowMeta = 1;
- }
+ if (flowMeta >= quantaPerBlock) return;
+ if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z)){
+ if (world.getBlock(x, y - densityDir, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y - densityDir, z, world.provider.dimensionId)))) flowMeta = 1;
boolean flowTo[] = getOptimalFlowDirections(world, x, y, z);
-
- if (flowTo[0])
- {
+ if (flowTo[0]){
if (JewelrycraftMod.saveData.getTag(stringFromLocation(x - 1, y, z, world.provider.dimensionId)) == null || world.getBlock(x - 1, y, z).isAir(world, x - 1, y, z)) JewelrycraftMod.saveData.setString(stringFromLocation(x - 1, y, z, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
flowIntoBlock(world, x - 1, y, z, flowMeta, originData);
}
- if (flowTo[1])
- {
+ if (flowTo[1]){
if (JewelrycraftMod.saveData.getTag(stringFromLocation(x + 1, y, z, world.provider.dimensionId)) == null || world.getBlock(x + 1, y, z).isAir(world, x + 1, y, z)) JewelrycraftMod.saveData.setString(stringFromLocation(x + 1, y, z, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
flowIntoBlock(world, x + 1, y, z, flowMeta, originData);
}
- if (flowTo[2])
- {
+ if (flowTo[2]){
if (JewelrycraftMod.saveData.getTag(stringFromLocation(x, y, z - 1, world.provider.dimensionId)) == null || world.getBlock(x, y, z - 1).isAir(world, x, y, z - 1)) JewelrycraftMod.saveData.setString(stringFromLocation(x, y, z - 1, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
flowIntoBlock(world, x, y, z - 1, flowMeta, originData);
}
- if (flowTo[3])
- {
+ if (flowTo[3]){
if (JewelrycraftMod.saveData.getTag(stringFromLocation(x, y, z + 1, world.provider.dimensionId)) == null || world.getBlock(x, y, z + 1).isAir(world, x, y, z + 1)) JewelrycraftMod.saveData.setString(stringFromLocation(x, y, z + 1, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
flowIntoBlock(world, x, y, z + 1, flowMeta, originData);
}
}
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param meta
+ * @param originData
+ */
public void flowIntoBlock(World world, int x, int y, int z, int meta, String originData)
{
if (meta < 0 || world.isRemote) return;
- if (displaceIfPossible(world, x, y, z))
- {
+ if (displaceIfPossible(world, x, y, z)){
world.setBlock(x, y, z, this, meta, 3);
JewelrycraftMod.saveData.setString(stringFromLocation(x, y, z, world.provider.dimensionId), originData);
String[] data = originData.split(":");
@@ -231,30 +220,34 @@ public class BlockMoltenMetal extends BlockFluidClassic
}
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param forcecolor
+ * @param itemC
+ * @return
+ * @throws IOException
+ */
+ @SideOnly (Side.CLIENT)
public static int color(IBlockAccess world, int i, int j, int k, boolean forcecolor, Item itemC) throws IOException
{
String ingotData = JewelrycraftMod.clientData.getString(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k) + " " + Minecraft.getMinecraft().theWorld.provider.dimensionId);
- if (ingotData == "")
- {
+ if (ingotData == ""){
JewelrycraftMod.netWrapper.sendToServer(new PacketRequestLiquidData(Minecraft.getMinecraft().theWorld.provider.dimensionId, i, j, k));
return 0xFFFFFF;
- }
- else
- {
+ }else{
String[] splitData = ingotData.split(":");
- if (splitData.length == 3)
- {
- int itemID, itemDamage, color;
- try
- {
- itemID = Integer.parseInt(splitData[0]);
- itemDamage = Integer.parseInt(splitData[1]);
+ if (splitData.length == 3){
+ int color;
+ try{
+ Integer.parseInt(splitData[0]);
+ Integer.parseInt(splitData[1]);
color = Integer.parseInt(splitData[2]);
return color;
}
- catch (Exception e)
- {
+ catch(Exception e){
e.printStackTrace();
}
}
@@ -262,6 +255,13 @@ public class BlockMoltenMetal extends BlockFluidClassic
return 16777215;
}
+ /**
+ * @param x
+ * @param y
+ * @param z
+ * @param dimID
+ * @return
+ */
public static String stringFromLocation(int x, int y, int z, int dimID)
{
return x + " " + y + " " + z + " " + dimID;
diff --git a/java/darkknight/jewelrycraft/block/BlockShadow.java b/java/darkknight/jewelrycraft/block/BlockShadow.java
index 4e8acf5..b175fe6 100644
--- a/java/darkknight/jewelrycraft/block/BlockShadow.java
+++ b/java/darkknight/jewelrycraft/block/BlockShadow.java
@@ -1,114 +1,192 @@
package darkknight.jewelrycraft.block;
-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.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow;
public class BlockShadow extends BlockContainer
{
private IIcon[] iconArray;
- private static final String __OBFID = "CL_00000312";
+ /**
+ *
+ */
public BlockShadow()
{
super(Material.iron);
- this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
+ /**
+ * @return
+ */
+ @Override
public int getRenderBlockPass()
{
return 1;
}
+ /**
+ * @param worldObj
+ * @param x
+ * @param y
+ * @param z
+ * @param beaconX
+ * @param beaconY
+ * @param beaconZ
+ * @return
+ */
public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
{
return true;
}
+ /**
+ * @return
+ */
+ @Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
+ @Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param side
+ * @return
+ */
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side)
{
return false;
}
+ /**
+ * @param par0
+ * @return
+ */
public static boolean isNormalCube(int par0)
{
return true;
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityBlockShadow();
}
+ /**
+ * @param par1IconRegister
+ */
+ @Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
- this.iconArray = new IIcon[16];
-
- for (int i = 0; i < this.iconArray.length; ++i)
- {
- this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + (15 - i));
- }
+ iconArray = new IIcon[16];
+ for(int i = 0; i < iconArray.length; ++i)
+ iconArray[i] = par1IconRegister.registerIcon(getTextureName() + (15 - i));
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ @Override
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);
}
+ /**
+ * @param par1IBlockAccess
+ * @param par2
+ * @param par3
+ * @param par4
+ */
+ @Override
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);
+ setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
+ /**
+ * @param p_149646_1_
+ * @param p_149646_2_
+ * @param p_149646_3_
+ * @param p_149646_4_
+ * @param p_149646_5_
+ * @return
+ */
+ @Override
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 (this == BlockList.shadowBlock)
- {
- if (block == this) { return false; }
- }
-
+ if (this == BlockList.shadowBlock) 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_);
}
+ /**
+ * @return
+ */
+ @Override
public boolean hasComparatorInputOverride()
{
return true;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param meta
+ * @return
+ */
+ @Override
public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
{
return world.getBlockMetadata(x, y, z);
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param side
+ * @param meta
+ * @return
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
- return this.iconArray[meta];
+ return iconArray[meta];
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockShadowEye.java b/java/darkknight/jewelrycraft/block/BlockShadowEye.java
index 94ece2a..1db2099 100644
--- a/java/darkknight/jewelrycraft/block/BlockShadowEye.java
+++ b/java/darkknight/jewelrycraft/block/BlockShadowEye.java
@@ -1,7 +1,6 @@
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.IIconRegister;
@@ -18,41 +17,78 @@ public class BlockShadowEye extends BlockContainer
{
Random rand = new Random();
+ /**
+ *
+ */
protected BlockShadowEye()
{
super(Material.rock);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityShadowEye();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
@@ -61,11 +97,25 @@ public class BlockShadowEye extends BlockContainer
return true;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
- {
- }
+ {}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -73,9 +123,12 @@ public class BlockShadowEye extends BlockContainer
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param icon
+ */
@Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("minecraft:stonebrick");
+ blockIcon = icon.registerIcon("minecraft:stonebrick");
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockShadowHand.java b/java/darkknight/jewelrycraft/block/BlockShadowHand.java
index 2af6d02..45a260f 100644
--- a/java/darkknight/jewelrycraft/block/BlockShadowHand.java
+++ b/java/darkknight/jewelrycraft/block/BlockShadowHand.java
@@ -1,7 +1,5 @@
package darkknight.jewelrycraft.block;
-import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -17,44 +15,75 @@ import darkknight.jewelrycraft.tileentity.TileEntityShadowHand;
public class BlockShadowHand extends BlockContainer
{
- Random rand = new Random();
- protected BlockShadowHand(Material par2Material)
+ /**
+ * @param material
+ */
+ protected BlockShadowHand(Material material)
{
- super(par2Material);
- this.setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
+ super(material);
+ setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityShadowHand();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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);
@@ -64,19 +93,33 @@ public class BlockShadowHand extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block block, int par6)
{
- TileEntityShadowHand te = (TileEntityShadowHand) world.getTileEntity(i, j, k);
-
- if (te != null && te.hasObject)
- {
- dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.object);
+ TileEntityShadowHand te = (TileEntityShadowHand)world.getTileEntity(i, j, k);
+ if (te != null && te.getHeldItemStack() != null){
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack());
world.removeTileEntity(i, j, k);
}
-
super.breakBlock(world, i, j, k, block, par6);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -84,9 +127,12 @@ public class BlockShadowHand extends BlockContainer
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param icon
+ */
@Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("minecraft:coal_block");
+ blockIcon = icon.registerIcon("minecraft:coal_block");
}
-}
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/block/BlockSmelter.java b/java/darkknight/jewelrycraft/block/BlockSmelter.java
index a4d379b..6d51a52 100644
--- a/java/darkknight/jewelrycraft/block/BlockSmelter.java
+++ b/java/darkknight/jewelrycraft/block/BlockSmelter.java
@@ -2,7 +2,6 @@ package darkknight.jewelrycraft.block;
import java.io.IOException;
import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -51,6 +50,15 @@ public class BlockSmelter extends BlockContainer
return false;
}
+ /**
+ * Spawns an item in the world at the specified location
+ *
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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);
@@ -61,33 +69,29 @@ public class BlockSmelter extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ @Override
public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
{
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
- if (te != null)
- {
- if (te.hasMetal) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.metal.copy());
- if (te.hasMoltenMetal && te.moltenMetal != null && Item.getIdFromItem(te.moltenMetal.getItem()) > 0)
- {
+ TileEntitySmelter te = (TileEntitySmelter)world.getTileEntity(i, j, k);
+ if (te != null){
+ if (te.hasMetal) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.metal.copy());
+ if (te.hasMoltenMetal && te.moltenMetal != null && Item.getIdFromItem(te.moltenMetal.getItem()) > 0){
ItemStack metal = te.moltenMetal;
ItemStack item = te.moltenMetal;
if (Item.getIdFromItem(metal.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(metal.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(metal.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(metal.getItem()) == Block.getIdFromBlock(Blocks.carpet)) metal.setItemDamage(15 - metal.getItemDamage());
int color = 16777215;
JewelryNBT.addMetal(item, metal);
- try
- {
+ try{
color = ItemMoltenMetalBucket.color(item, 1);
System.out.println(color);
}
- catch (IOException e)
- {
+ catch(IOException e){
e.printStackTrace();
}
JewelrycraftMod.saveData.setString(i + " " + j + " " + k + " " + world.provider.dimensionId, Item.getIdFromItem(metal.getItem()) + ":" + metal.getItemDamage() + ":" + color);
JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, i, j, k, Item.getIdFromItem(metal.getItem()), metal.getItemDamage(), color));
-
world.setBlock(i, j, k, BlockList.moltenMetal, 0, 3);
- int quant = (int) (te.quantity * 10);
+ int quant = (int)(te.quantity * 10);
if (quant == 1) world.setBlockMetadataWithNotify(i, j, k, 4, 3);
if (quant == 2) world.setBlockMetadataWithNotify(i, j, k, 4, 3);
if (quant == 3) world.setBlockMetadataWithNotify(i, j, k, 3, 3);
@@ -106,10 +110,9 @@ public class BlockSmelter extends BlockContainer
@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.getTileEntity(i, j, k);
+ TileEntitySmelter te = (TileEntitySmelter)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && te.hasMoltenMetal && te.quantity >= 0.9f && !te.pouring && item != null && item.getItem() == Items.bucket)
- {
+ if (te != null && te.hasMoltenMetal && te.quantity >= 0.9f && !te.pouring && item != null && item.getItem() == Items.bucket){
te.quantity = 0f;
te.hasMoltenMetal = false;
ItemStack metalBucket = new ItemStack(ItemList.bucket, 1);
@@ -121,48 +124,41 @@ public class BlockSmelter extends BlockContainer
te.isDirty = true;
return true;
}
- if (te != null && !world.isRemote)
- {
- if (te.hasMetal && entityPlayer.isSneaking())
- {
- dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.metal.copy());
+ if (te != null && !world.isRemote){
+ if (te.hasMetal && entityPlayer.isSneaking()){
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.metal.copy());
te.hasMetal = false;
te.melting = -1;
te.isDirty = true;
}
- if (item != null && item.getItem() != null && !(item.getItem() instanceof ItemMoltenMetalBucket))
- {
+ if (item != null && item.getItem() != null && !(item.getItem() instanceof ItemMoltenMetalBucket)){
int index = -1;
- for (int a = 0; a < JewelrycraftUtil.jamcraftPlayers.size(); a++)
- if (entityPlayer.getDisplayName().equals(JewelrycraftUtil.jamcraftPlayers.get(a))) index = a;
- boolean canPlace = (item != null && (JewelrycraftUtil.isMetal(item) || JewelrycraftUtil.isOre(item) || index >= 0));
+ for(int a = 0; a < JewelrycraftUtil.jamcraftPlayers.size(); a++)
+ if (entityPlayer.getUniqueID().toString().equals(JewelrycraftUtil.jamcraftPlayers.get(a))) index = a;
+ if(entityPlayer.capabilities.isCreativeMode) index = 1;
+ boolean canPlace = item != null && (JewelrycraftUtil.isMetal(item) || JewelrycraftUtil.isOre(item) || index >= 0);
boolean isOre = false, oreCoincidesWithMetal = false, itemCoincidesWithMetal = false, itemCoincidesWithMoltenMetal = false, overflow = false;
isOre = JewelrycraftUtil.isOre(item);
if (te.metal != null && te.metal.getItem() != null) itemCoincidesWithMetal = item.getItem().equals(te.metal.getItem()) && item.getItemDamage() == te.metal.getItemDamage();
- if (te.moltenMetal != null && te.moltenMetal.getItem() != null)
- {
+ if (te.moltenMetal != null && te.moltenMetal.getItem() != null){
itemCoincidesWithMoltenMetal = item.getItem().equals(te.moltenMetal.getItem()) && item.getItemDamage() == te.moltenMetal.getItemDamage();
if (isOre) oreCoincidesWithMetal = te.moltenMetal.getItem().equals(JewelrycraftUtil.getIngotFromOre(item.getItem()).getItem()) && te.moltenMetal.getItemDamage() == JewelrycraftUtil.getIngotFromOre(item.getItem()).getItemDamage();
}
- overflow = isOre ? (te.metal.stackSize * 0.2f + te.quantity < 0.8f) : (te.metal.stackSize * 0.1f + te.quantity < 0.9f);
+ overflow = isOre ? te.metal.stackSize * 0.2f + te.quantity < 0.8f : te.metal.stackSize * 0.1f + te.quantity < 0.9f;
boolean isValid = te.hasMoltenMetal ? itemCoincidesWithMoltenMetal : true;
- if (te.quantity < 0.9f && !te.pouring && canPlace && isValid)
- {
- boolean check = isOre ? (oreCoincidesWithMetal && te.quantity < 0.8f) : itemCoincidesWithMoltenMetal;
+ if (te.quantity < 0.9f && !te.pouring && canPlace && isValid){
+ boolean check = isOre ? oreCoincidesWithMetal && te.quantity < 0.8f : itemCoincidesWithMoltenMetal;
boolean check2 = isOre ? oreCoincidesWithMetal : itemCoincidesWithMetal;
- if ((!te.hasMetal && !te.hasMoltenMetal) || (!te.hasMetal && te.hasMoltenMetal && check))
- {
+ if (!te.hasMetal && !te.hasMoltenMetal || !te.hasMetal && te.hasMoltenMetal && check){
entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.nowsmeltingingot", item.getDisplayName())));
te.metal = item.copy();
-// if (Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.carpet)) te.metal.setItemDamage(15 - te.metal.getItemDamage());
+ // if (Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.carpet)) te.metal.setItemDamage(15 - te.metal.getItemDamage());
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 && check2 && overflow) || (te.hasMetal && !te.hasMoltenMetal && itemCoincidesWithMetal && overflow))
- {
+ }else if (te.hasMetal && te.hasMoltenMetal && check2 && overflow || te.hasMetal && !te.hasMoltenMetal && itemCoincidesWithMetal && overflow){
entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("Smelting extra " + (isOre ? "ores" : "ingots") + " (" + (te.metal.stackSize + 1) + ")")));
te.metal.stackSize++;
te.hasMetal = true;
@@ -171,26 +167,21 @@ public class BlockSmelter extends BlockContainer
te.isDirty = true;
}
te.isDirty = true;
- }
- else if (item != null && (te.hasMetal || te.hasMoltenMetal) && !itemCoincidesWithMoltenMetal && te.quantity < 0.9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("Item does not match contents!")));
+ }else if (item != null && (te.hasMetal || te.hasMoltenMetal) && !itemCoincidesWithMoltenMetal && te.quantity < 0.9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("Item does not match contents!")));
else if (item != null && !item.getUnlocalizedName().toLowerCase().contains("ingot") && te.quantity < 0.9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.itemrenamedtoingot")));
else if (item != null && te.quantity >= 0.9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("Smelter is at full capacity.")));
- }
- else if (item != null && item.getItem() != null && item.getItem() instanceof ItemMoltenMetalBucket && !te.hasMoltenMetal && !te.hasMetal)
- {
+ }else if (item != null && item.getItem() != null && item.getItem() instanceof ItemMoltenMetalBucket && !te.hasMoltenMetal && !te.hasMetal){
te.hasMoltenMetal = true;
ItemStack ingot = JewelryNBT.ingot(item);
if (Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.carpet)) ingot.setItemDamage(15 - ingot.getItemDamage());
te.moltenMetal = ingot;
te.quantity = 0.9f;
te.isDirty = true;
- if (!entityPlayer.capabilities.isCreativeMode)
- {
+ if (!entityPlayer.capabilities.isCreativeMode){
--item.stackSize;
dropItem(world, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, new ItemStack(Items.bucket));
}
- }
- else if (item == null && te.hasMoltenMetal && te.moltenMetal.getItem() != null) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.hasmolteningot", te.moltenMetal.getDisplayName())));
+ }else if (item == null && te.hasMoltenMetal && te.moltenMetal.getItem() != null) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.hasmolteningot", te.moltenMetal.getDisplayName())));
world.setTileEntity(i, j, k, te);
}
return true;
@@ -199,30 +190,33 @@ public class BlockSmelter extends BlockContainer
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
+ TileEntitySmelter te = (TileEntitySmelter)world.getTileEntity(i, j, k);
TileEntityMolder me = null;
- if (world.getBlockMetadata(i, j, k) == 0 && world.getTileEntity(i, j, k - 1) != null && world.getTileEntity(i, j, k - 1) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i, j, k - 1);
- else if (world.getBlockMetadata(i, j, k) == 1 && world.getTileEntity(i + 1, j, k) != null && world.getTileEntity(i + 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i + 1, j, k);
- else if (world.getBlockMetadata(i, j, k) == 2 && world.getTileEntity(i, j, k + 1) != null && world.getTileEntity(i, j, k + 1) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i, j, k + 1);
- else if (world.getBlockMetadata(i, j, k) == 3 && world.getTileEntity(i - 1, j, k) != null && world.getTileEntity(i - 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(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)
- {
- te.pouring = true;
- te.isDirty = true;
- }
- else if (te.hasMetal && te.melting > 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.metalismelting", te.metal.getDisplayName()) + " (" + (((ConfigHandler.ingotMeltingTime*te.metal.stackSize) - te.melting) * 100 / (ConfigHandler.ingotMeltingTime*te.metal.stackSize)) + "%)"));
- else if (te.hasMoltenMetal && !isConnectedToMolder(world, i, j, k)) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderismissing")));
- else if (!me.hasMold && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasnomold")));
- else if (me.hasMoltenMetal && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasmoltenmetal")));
- else if (me.hasJewelBase && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.modlerhasitem")));
- else player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.empty")));
- }
-
+ if (world.getBlockMetadata(i, j, k) == 0 && world.getTileEntity(i, j, k - 1) != null && world.getTileEntity(i, j, k - 1) instanceof TileEntityMolder) me = (TileEntityMolder)world.getTileEntity(i, j, k - 1);
+ else if (world.getBlockMetadata(i, j, k) == 1 && world.getTileEntity(i + 1, j, k) != null && world.getTileEntity(i + 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder)world.getTileEntity(i + 1, j, k);
+ else if (world.getBlockMetadata(i, j, k) == 2 && world.getTileEntity(i, j, k + 1) != null && world.getTileEntity(i, j, k + 1) instanceof TileEntityMolder) me = (TileEntityMolder)world.getTileEntity(i, j, k + 1);
+ else if (world.getBlockMetadata(i, j, k) == 3 && world.getTileEntity(i - 1, j, k) != null && world.getTileEntity(i - 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder)world.getTileEntity(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){
+ te.pouring = true;
+ te.isDirty = true;
+// System.out.println(Block.getBlockById(Item.getIdFromItem(te.moltenMetal.getItem())));
+ }else if (te.hasMetal && te.melting > 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.metalismelting", te.metal.getDisplayName()) + " (" + (ConfigHandler.ingotMeltingTime * te.metal.stackSize - te.melting) * 100 / (ConfigHandler.ingotMeltingTime * te.metal.stackSize) + "%)"));
+ else if (te.hasMoltenMetal && !isConnectedToMolder(world, i, j, k)) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderismissing")));
+ else if (!me.hasMold && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasnomold")));
+ else if (me.hasMoltenMetal && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasmoltenmetal")));
+ else if (me.hasJewelBase && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.modlerhasitem")));
+ else player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.empty")));
}
+ /**
+ * Determines if a molder is placed in front of this
+ *
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @return true if a molder is attached, false otherwise
+ */
public boolean isConnectedToMolder(World world, int i, int j, int k)
{
int blockMeta = world.getBlockMetadata(i, j, k);
@@ -232,14 +226,14 @@ public class BlockSmelter extends BlockContainer
else if (blockMeta == 3 && world.getBlock(i - 1, j, k) instanceof BlockMolder) 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)
{
@@ -258,9 +252,9 @@ public class BlockSmelter extends BlockContainer
return -1;
}
+ @Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("jewelrycraft:smelter");
+ blockIcon = icon.registerIcon("jewelrycraft:smelter");
}
-
}