diff options
| author | bspkrs <bspkrs@gmail.com> | 2013-12-16 14:19:04 -0500 |
|---|---|---|
| committer | bspkrs <bspkrs@gmail.com> | 2013-12-16 14:19:04 -0500 |
| commit | f15bc9e0abff4710d9860bd970b3b6820c5e78c6 (patch) | |
| tree | 6951055018820b7e604f3825a429c91b77e9eb27 /common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java | |
| parent | 43ef55b2424eb49110e27d603adf95a84bf37560 (diff) | |
tested creation of rings with custom NBT - working!
reformatted source
Diffstat (limited to 'common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java')
| -rw-r--r-- | common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java index 85503c9..514d879 100644 --- a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java +++ b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java @@ -10,20 +10,20 @@ import net.minecraft.tileentity.TileEntity; public class TileEntitySmelter extends TileEntity { - public int melting, flow, n=0, p=0; + public int melting, flow, n = 0, p = 0; public boolean hasMetal, hasMoltenMetal; public ItemStack metal, moltenMetal; - + public TileEntitySmelter() { this.melting = 0; this.flow = 0; this.hasMetal = false; - this.hasMoltenMetal= false; + this.hasMoltenMetal = false; this.metal = new ItemStack(0, 0, 0); this.moltenMetal = new ItemStack(0, 0, 0); } - + @Override public void writeToNBT(NBTTagCompound nbt) { @@ -38,7 +38,7 @@ public class TileEntitySmelter extends TileEntity this.moltenMetal.writeToNBT(tag1); nbt.setCompoundTag("moltenMetal", tag1); } - + @Override public void readFromNBT(NBTTagCompound nbt) { @@ -51,40 +51,48 @@ public class TileEntitySmelter extends TileEntity this.moltenMetal = new ItemStack(0, 0, 0); this.moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal")); } - + public void updateEntity() { super.updateEntity(); Random rand = new Random(); - if(p>0)--p; - else p=5; - if(n == 0 && p == 0){ - flow+=16; - if(flow >= 16*20) n=1; + if (p > 0) + --p; + else + p = 5; + if (n == 0 && p == 0) + { + flow += 16; + if (flow >= 16 * 20) + n = 1; } - if(n == 1 && p == 0){ - flow-=16; - if(flow <= 0) n=0; + if (n == 1 && p == 0) + { + flow -= 16; + if (flow <= 0) + n = 0; } - if(this.melting > 0) - { + if (this.melting > 0) + { for (int l = 0; l < 5; ++l) { //EntityFX entityfx = new EntityReddustFX(this.worldObj, (double)xCoord + Math.random(), (double)yCoord + 0.2D, (double)zCoord + Math.random(), 0.0F, 0.0F, 0.0F); - this.worldObj.spawnParticle("flame", (double)xCoord, (double)yCoord + 1.5F, (double)zCoord, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", (double) xCoord, (double) yCoord + 1.5F, (double) zCoord, 0.0D, 0.0D, 0.0D); } } - if(rand.nextInt(65) == 0){ - double d5 = (double)((float)this.xCoord + rand.nextFloat()); - double d7 = (double)this.yCoord; - double d6 = (double)((float)this.zCoord + rand.nextFloat()); + if (rand.nextInt(65) == 0) + { + double d5 = (double) ((float) this.xCoord + rand.nextFloat()); + double d7 = (double) this.yCoord; + double d6 = (double) ((float) this.zCoord + rand.nextFloat()); //this.worldObj.spawnParticle("lava", d5, d7, d6, 0.0D, 0.0D, 0.0D); this.worldObj.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false); } - if(this.hasMetal) - { - if(melting > 0) this.melting--; - if(melting == 0) + if (this.hasMetal) + { + if (melting > 0) + this.melting--; + if (melting == 0) { this.hasMetal = false; this.moltenMetal = metal; @@ -93,8 +101,8 @@ public class TileEntitySmelter extends TileEntity } } } - - public Packet getDescriptionPacket() + + public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); this.writeToNBT(nbtTag); |
