diff options
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java')
| -rwxr-xr-x | src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java | 99 |
1 files changed, 33 insertions, 66 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java index dd73951..6982888 100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java @@ -14,10 +14,10 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity;
public class TileEntitySmelter extends TileEntity {
- public int melting, flow, n = 0, p = 0;
- public boolean hasMetal, hasMoltenMetal, isDirty, pouring;
- public ItemStack metal, moltenMetal;
- public float quantity, pouredQuantity = 0.1f;
+ public int melting, flow, n = 0, p = 0;
+ public boolean hasMetal, hasMoltenMetal, isDirty, pouring;
+ public ItemStack metal, moltenMetal;
+ public float quantity, pouredQuantity = 0.1f;
/**
*
@@ -78,8 +78,7 @@ public class TileEntitySmelter extends TileEntity { super.updateEntity();
Random rand = new Random();
if (isDirty) {
- worldObj.markBlockForUpdate(xCoord, yCoord,
- zCoord);
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
if (p > 0)
@@ -98,19 +97,14 @@ public class TileEntitySmelter extends TileEntity { }
if (hasMetal)
for (int l = 0; l < 2; ++l)
- worldObj.spawnParticle("flame",
- xCoord + rand.nextFloat(),
- (double) yCoord + 0.3F,
- zCoord + rand.nextFloat(),
- 0.0D, 0.0D, 0.0D);
+ worldObj.spawnParticle("flame", xCoord + rand.nextFloat(), (double) yCoord + 0.3F,
+ zCoord + rand.nextFloat(), 0.0D, 0.0D, 0.0D);
if (rand.nextInt(65) == 0) {
double d5 = xCoord + rand.nextFloat();
double d7 = yCoord;
double d6 = zCoord + rand.nextFloat();
- worldObj.playSound(d5, d7, d6, "liquid.lavapop",
- 0.2F + rand.nextFloat() * 0.2F,
- 0.9F + rand.nextFloat() * 0.15F,
- false);
+ worldObj.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F,
+ 0.9F + rand.nextFloat() * 0.15F, false);
}
if (hasMetal && !hasMoltenMetal) {
boolean isOre = JewelrycraftUtil.isOre(metal);
@@ -119,16 +113,12 @@ public class TileEntitySmelter extends TileEntity { if (melting == 0) {
hasMetal = false;
if (!isOre) {
- if (JewelryNBT.ingot(
- metal) == null)
+ if (JewelryNBT.ingot(metal) == null)
moltenMetal = metal;
else
- moltenMetal = JewelryNBT
- .ingot(metal);
+ moltenMetal = JewelryNBT.ingot(metal);
} else {
- moltenMetal = JewelrycraftUtil
- .getIngotFromOre(
- metal);
+ moltenMetal = JewelrycraftUtil.getIngotFromOre(metal);
moltenMetal.stackSize *= 2;
}
hasMoltenMetal = true;
@@ -136,8 +126,7 @@ public class TileEntitySmelter extends TileEntity { quantity = 0.1f * metal.stackSize;
else
quantity = 0.2f * metal.stackSize;
- metal = new ItemStack(Item.getItemById(0),
- 0, 0);
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
melting = -1;
isDirty = true;
}
@@ -150,52 +139,33 @@ public class TileEntitySmelter extends TileEntity { if (!isOre)
moltenMetal.stackSize += metal.stackSize;
else
- moltenMetal.stackSize += metal.stackSize
- * 2;
+ moltenMetal.stackSize += metal.stackSize * 2;
if (!isOre)
quantity += 0.1f * metal.stackSize;
else
quantity += 0.2f * metal.stackSize;
- metal = new ItemStack(Item.getItemById(0),
- 0, 0);
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
melting = -1;
isDirty = true;
}
}
TileEntityMolder me = null;
if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0
- && worldObj.getTileEntity(xCoord, yCoord,
- zCoord - 1) != null
- && worldObj.getTileEntity(xCoord, yCoord,
- zCoord - 1) instanceof TileEntityMolder)
- me = (TileEntityMolder) worldObj.getTileEntity(
- xCoord, yCoord, zCoord - 1);
- else if (worldObj.getBlockMetadata(xCoord, yCoord,
- zCoord) == 1
- && worldObj.getTileEntity(xCoord + 1,
- yCoord, zCoord) != null
- && worldObj.getTileEntity(xCoord + 1,
- yCoord,
- zCoord) instanceof TileEntityMolder)
- me = (TileEntityMolder) worldObj.getTileEntity(
- xCoord + 1, yCoord, zCoord);
- else if (worldObj.getBlockMetadata(xCoord, yCoord,
- zCoord) == 2
- && worldObj.getTileEntity(xCoord, yCoord,
- zCoord + 1) != null
- && worldObj.getTileEntity(xCoord, yCoord,
- zCoord + 1) instanceof TileEntityMolder)
- me = (TileEntityMolder) worldObj.getTileEntity(
- xCoord, yCoord, zCoord + 1);
- else if (worldObj.getBlockMetadata(xCoord, yCoord,
- zCoord) == 3
- && worldObj.getTileEntity(xCoord - 1,
- yCoord, zCoord) != null
- && worldObj.getTileEntity(xCoord - 1,
- yCoord,
- zCoord) instanceof TileEntityMolder)
- me = (TileEntityMolder) worldObj.getTileEntity(
- xCoord - 1, yCoord, zCoord);
+ && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) != null
+ && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord, yCoord, zCoord - 1);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1
+ && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) != null
+ && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord + 1, yCoord, zCoord);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 2
+ && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) != null
+ && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord, yCoord, zCoord + 1);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 3
+ && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) != null
+ && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) instanceof TileEntityMolder)
+ me = (TileEntityMolder) worldObj.getTileEntity(xCoord - 1, yCoord, zCoord);
if (pouring && pouredQuantity > 0f) {
quantity -= 0.01f;
pouredQuantity -= 0.01f;
@@ -212,8 +182,7 @@ public class TileEntitySmelter extends TileEntity { if (quantity <= 0f) {
quantity = 0f;
hasMoltenMetal = false;
- moltenMetal = new ItemStack(
- Item.getItemById(0), 0, 0);
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
me.cooling = ConfigHandler.INGOT_COOLING_TIME;
}
me.isDirty = true;
@@ -227,8 +196,7 @@ public class TileEntitySmelter extends TileEntity { public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord,
- zCoord, 1, nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
/**
@@ -236,8 +204,7 @@ public class TileEntitySmelter extends TileEntity { * @param packet
*/
@Override
- public void onDataPacket(NetworkManager net,
- S35PacketUpdateTileEntity packet) {
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
|
