summaryrefslogtreecommitdiff
path: root/common/darkknight/jewelrycraft/tileentity
diff options
context:
space:
mode:
authorbspkrs <bspkrs@gmail.com>2013-12-16 14:19:04 -0500
committerbspkrs <bspkrs@gmail.com>2013-12-16 14:19:04 -0500
commitf15bc9e0abff4710d9860bd970b3b6820c5e78c6 (patch)
tree6951055018820b7e604f3825a429c91b77e9eb27 /common/darkknight/jewelrycraft/tileentity
parent43ef55b2424eb49110e27d603adf95a84bf37560 (diff)
tested creation of rings with custom NBT - working!
reformatted source
Diffstat (limited to 'common/darkknight/jewelrycraft/tileentity')
-rw-r--r--common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java37
-rw-r--r--common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java62
2 files changed, 55 insertions, 44 deletions
diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
index 600bc0f..5f60c3f 100644
--- a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
+++ b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
@@ -13,7 +13,7 @@ public class TileEntityMolder extends TileEntity
public int cooling;
public boolean hasMoltenMetal, hasJewelBase, hasMold;
public ItemStack mold, jewelBase, moltenMetal, ringMetal;
-
+
public TileEntityMolder()
{
this.moltenMetal = new ItemStack(0, 0, 0);
@@ -25,7 +25,7 @@ public class TileEntityMolder extends TileEntity
this.hasMoltenMetal = false;
this.hasMold = false;
}
-
+
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -47,7 +47,7 @@ public class TileEntityMolder extends TileEntity
this.ringMetal.writeToNBT(tag2);
nbt.setCompoundTag("ringMetal", tag3);
}
-
+
@Override
public void readFromNBT(NBTTagCompound nbt)
{
@@ -65,40 +65,43 @@ public class TileEntityMolder extends TileEntity
this.ringMetal = new ItemStack(0, 0, 0);
this.ringMetal.readFromNBT(nbt.getCompoundTag("ringMetal"));
}
-
+
public void updateEntity()
{
super.updateEntity();
- if(moltenMetal.itemID != 0)
- {
- this.worldObj.playSoundEffect((double)((float)xCoord + 0.5F), (double)((float)yCoord + 0.5F), (double)((float)zCoord + 0.5F), "random.fizz", 0.5F, 2.6F + 0.2F * 0.8F);
+ if (moltenMetal.itemID != 0)
+ {
+ this.worldObj.playSoundEffect((double) ((float) xCoord + 0.5F), (double) ((float) yCoord + 0.5F), (double) ((float) zCoord + 0.5F), "random.fizz", 0.5F, 2.6F + 0.2F * 0.8F);
for (int l = 0; l < 2; ++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("reddust", (double)xCoord + Math.random(), (double)yCoord + 0.2F, (double)zCoord + Math.random(), 0.0D, 1.0D, 1.0D);
+ this.worldObj.spawnParticle("reddust", (double) xCoord + Math.random(), (double) yCoord + 0.2F, (double) zCoord + Math.random(), 0.0D, 1.0D, 1.0D);
}
}
- if(this.hasMoltenMetal && !this.hasJewelBase)
- {
+ if (this.hasMoltenMetal && !this.hasJewelBase)
+ {
ringMetal = moltenMetal;
- if(cooling > 0) this.cooling--;
- if(cooling == 0)
+ if (cooling > 0)
+ this.cooling--;
+ if (cooling == 0)
{
this.hasMoltenMetal = false;
- if(mold.getItemDamage() == 0) this.jewelBase = moltenMetal;
- else this.jewelBase = new ItemStack(ItemList.ring);
+ if (mold.getItemDamage() == 0)
+ this.jewelBase = moltenMetal;
+ else
+ this.jewelBase = new ItemStack(ItemList.ring);
this.moltenMetal = new ItemStack(0, 0, 0);
this.hasJewelBase = true;
}
}
}
-
+
public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
{
readFromNBT(pkt.data);
}
-
- public Packet getDescriptionPacket()
+
+ public Packet getDescriptionPacket()
{
NBTTagCompound nbtTag = new NBTTagCompound();
this.writeToNBT(nbtTag);
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);