summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/tileentity
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-09-17 19:10:05 +0300
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-09-17 19:10:05 +0300
commit06f62473f0622efe6decc32b70516a7c5d3d3572 (patch)
treeebf54c96117f9917cd93740a89763c26abde06af /src/main/java/darkknight/jewelrycraft/tileentity
parent852cfd0e13631320624d528213ec8c80cffe8743 (diff)
1.7.10
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/tileentity')
-rw-r--r--src/main/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java144
-rw-r--r--src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java74
-rw-r--r--src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java108
-rw-r--r--src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java141
-rw-r--r--src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java127
-rw-r--r--src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java159
6 files changed, 0 insertions, 753 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
deleted file mode 100644
index 62ef646..0000000
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package darkknight.jewelrycraft.tileentity;
-
-import java.util.List;
-
-import net.minecraft.block.Block;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import darkknight.jewelrycraft.util.JewelryNBT;
-
-public class TileEntityAltar extends TileEntity
-{
- public ItemStack object;
- public boolean isDirty, hasObject;
- public String playerName;
-
- public TileEntityAltar()
- {
- this.hasObject = false;
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
- this.isDirty = false;
- this.playerName = "";
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- NBTTagCompound tag = new NBTTagCompound();
- this.object.writeToNBT(tag);
- nbt.setTag("object", tag);
- nbt.setBoolean("hasObject", hasObject);
- nbt.setString("playerName", playerName);
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
- this.object.readFromNBT(nbt.getCompoundTag("object"));
- this.hasObject = nbt.getBoolean("hasObject");
- this.playerName = nbt.getString("playerName");
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public void updateEntity()
- {
- super.updateEntity();
-
- if(isDirty)
- {
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- if(hasObject && playerName != "")
- {
- //int playerPosX = (int)player.posX, playerPosY = (int)player.posY, playerPosZ = (int)player.posZ;
- List entitiesR = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1D, zCoord, xCoord + 0.5D, yCoord + 2D, zCoord + 0.5D));
- List entitiesN = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5D, yCoord + 1D, zCoord - 0.5D, xCoord + 1.5D, yCoord + 2D, zCoord + 1.5D));
- if(object.getUnlocalizedName().contains("ring"))
- {
- if (JewelryNBT.isJewelX(object, new ItemStack(Items.ender_pearl)) && JewelryNBT.dimension(object) != -2 && JewelryNBT.playerPosX(object) != -1 && JewelryNBT.playerPosY(object) != -1 && JewelryNBT.playerPosZ(object) != -1)
- {
- double posX = JewelryNBT.playerPosX(object), posY = JewelryNBT.playerPosY(object), posZ = JewelryNBT.playerPosZ(object);
- int dimension = JewelryNBT.dimension(object);
- for(int i = 0; i < entitiesR.size(); i++)
- {
- EntityLivingBase entity = (EntityLivingBase) entitiesR.get(i);
- if (!JewelryNBT.isDimensionX(object, entity.dimension) && JewelryNBT.isModifierX(object, new ItemStack(Items.bed))){
- entity.travelToDimension(dimension);
- entity.setPositionAndUpdate(posX, posY, posZ);
- }
- else if(JewelryNBT.isDimensionX(object, entity.dimension)) entity.setPositionAndUpdate(posX, posY, posZ);
- }
- }
- if (JewelryNBT.isModifierX(object, new ItemStack(Items.dye, 1, 15)))
- {
- for(int i=-1; i<=1; i++)
- for(int j=-1; j<=1; j++)
- for(int k=-1; k<=1; k++)
- {
- //if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) == Block.dirt.blockID && (worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == 0 || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.crops.blockID) || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.potato.blockID) worldObj.setBlock(xCoord + i, yCoord + j, zCoord + k, Block.tilledField.blockID);
- if(worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) == Blocks.farmland) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
- if(worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) != Blocks.farmland) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k), 5);
- //JewelrycraftUtil.applyBonemeal(object, worldObj, xCoord + i, yCoord + j, zCoord + k, player);
- }
- }
- }
- else if(object.getUnlocalizedName().contains("necklace"))
- {
- if (JewelryNBT.isJewelX(object, new ItemStack(Items.ender_pearl)) && JewelryNBT.dimension(object) != -2 && JewelryNBT.playerPosX(object) != -1 && JewelryNBT.playerPosY(object) != -1 && JewelryNBT.playerPosZ(object) != -1)
- {
- double posX = JewelryNBT.playerPosX(object), posY = JewelryNBT.playerPosY(object), posZ = JewelryNBT.playerPosZ(object);
- int dimension = JewelryNBT.dimension(object);
- for(int i = 0; i < entitiesN.size(); i++)
- {
- EntityLivingBase entity = (EntityLivingBase) entitiesN.get(i);
- if (!JewelryNBT.isDimensionX(object, entity.dimension) && JewelryNBT.isModifierX(object, new ItemStack(Items.bed))){
- entity.travelToDimension(dimension);
- entity.setPositionAndUpdate(posX, posY, posZ);
- }
- else if(JewelryNBT.isDimensionX(object, entity.dimension)) entity.setPositionAndUpdate(posX, posY, posZ);
- }
- }
- if (JewelryNBT.isModifierX(object, new ItemStack(Items.dye, 1, 15)))
- {
- for(int i=-3; i<=3; i++)
- for(int j=-1; j<=1; j++)
- for(int k=-3; k<=3; k++)
- {
- //if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) == Block.dirt.blockID && (worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == 0 || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.crops.blockID) || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.potato.blockID) worldObj.setBlock(xCoord + i, yCoord + j, zCoord + k, Block.tilledField.blockID);
- if(worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) == Blocks.farmland) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
- if(worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) != Blocks.farmland) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k), 5);
- //JewelrycraftUtil.applyBonemeal(object, worldObj, xCoord + i, yCoord + j, zCoord + k, player);
- }
- }
- }
- }
- }
-
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
- }
-
- @Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
-}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
deleted file mode 100644
index 186f78a..0000000
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package darkknight.jewelrycraft.tileentity;
-
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.MathHelper;
-import net.minecraft.world.EnumSkyBlock;
-
-public class TileEntityBlockShadow extends TileEntity
-{
- public int metadata;
-
- public TileEntityBlockShadow()
- {
- this.metadata = -1;
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setInteger("metadata", metadata);
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- this.metadata = nbt.getInteger("metadata");
- }
-
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- int blockLight, realLight;
- int lightValue = worldObj.getSavedLightValue(EnumSkyBlock.Sky, xCoord, yCoord, zCoord) - worldObj.skylightSubtracted;
- float sunPosAngle = worldObj.getCelestialAngleRadians(1.0F);
-
- if (sunPosAngle < (float)Math.PI) sunPosAngle += (0.0F - sunPosAngle) * 0.2F;
- else sunPosAngle += (((float)Math.PI * 2F) - sunPosAngle) * 0.2F;
-
- lightValue = Math.round((float)lightValue * MathHelper.cos(sunPosAngle));
-
- if (lightValue < 0) lightValue = 0;
- if (lightValue > 15) lightValue = 15;
-
- blockLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getSavedLightValue(EnumSkyBlock.Block, xCoord & 15, yCoord, zCoord & 15);
- realLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getBlockLightValue(xCoord & 15, yCoord, zCoord & 15, 0);
-
- if((blockLight == 0 && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) || (lightValue >= blockLight)) metadata = 15 - lightValue;
- else if(!worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) metadata = 15 - realLight;
- else if(lightValue < blockLight) metadata = 15 - blockLight;
-
- worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metadata, 2);
- worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
- }
-
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
- }
-
- @Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
-}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
deleted file mode 100644
index 35def5c..0000000
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package darkknight.jewelrycraft.tileentity;
-
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
-import net.minecraft.tileentity.TileEntity;
-
-public class TileEntityDisplayer extends TileEntity
-{
- public float ringTranslation1, ringTranslation2, ringTranslation3, rotAngle;
- public boolean isDescending1, isDescending2, isDescending3, isDirty, hasObject;
- public ItemStack object;
- public int quantity;
-
- public TileEntityDisplayer()
- {
- this.ringTranslation1 = 0;
- this.ringTranslation2 = 0;
- this.ringTranslation3 = 0;
- this.rotAngle = 0;
- this.quantity = 0;
- this.isDescending1 = false;
- this.isDescending2 = false;
- this.isDescending3 = false;
- this.isDirty = false;
- this.hasObject = false;
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setFloat("translation1", ringTranslation1);
- nbt.setFloat("translation2", ringTranslation2);
- nbt.setFloat("translation3", ringTranslation3);
- nbt.setFloat("angle", rotAngle);
- nbt.setInteger("quantity", quantity);
- nbt.setBoolean("descending1", isDescending1);
- nbt.setBoolean("descending2", isDescending2);
- nbt.setBoolean("descending3", isDescending3);
- nbt.setBoolean("hasObject", hasObject);
- NBTTagCompound tag = new NBTTagCompound();
- this.object.writeToNBT(tag);
- nbt.setTag("object", tag);
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- this.ringTranslation1 = nbt.getFloat("translation1");
- this.ringTranslation2 = nbt.getFloat("translation2");
- this.ringTranslation3 = nbt.getFloat("translation3");
- this.rotAngle = nbt.getFloat("angle");
- this.quantity = nbt.getInteger("quantity");
- this.isDescending1 = nbt.getBoolean("descending1");
- this.isDescending2 = nbt.getBoolean("descending2");
- this.isDescending3 = nbt.getBoolean("descending3");
- this.hasObject = nbt.getBoolean("hasObject");
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
- this.object.readFromNBT(nbt.getCompoundTag("object"));
- }
-
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- if(isDirty)
- {
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- if(ringTranslation1 >= 0.6) isDescending1 = true;
- if(ringTranslation1 <= 0) isDescending1 = false;
- if(!isDescending1) ringTranslation1 += 0.05;
- if(isDescending1) ringTranslation1 -= 0.05;
-
- if(ringTranslation2 >= 0.6) isDescending2 = true;
- if(ringTranslation2 <= 0) isDescending2 = false;
- if(!isDescending2) ringTranslation2 += 0.04;
- if(isDescending2) ringTranslation2 -= 0.04;
-
- if(ringTranslation3 >= 0.6) isDescending3 = true;
- if(ringTranslation3 <= 0) isDescending3 = false;
- if(!isDescending3) ringTranslation3 += 0.03;
- if(isDescending3) ringTranslation3 -= 0.03;
- if(rotAngle < 360F) rotAngle += 6F;
- if(rotAngle>=360F) rotAngle = 0F;
- }
-
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
- }
-
- @Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
-}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
deleted file mode 100644
index 13b689d..0000000
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package darkknight.jewelrycraft.tileentity;
-
-import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
-import net.minecraft.tileentity.TileEntity;
-import darkknight.jewelrycraft.config.ConfigHandler;
-import darkknight.jewelrycraft.util.JewelryNBT;
-
-public class TileEntityJewelrsCraftingTable extends TileEntity
-{
- public boolean hasJewelry, hasModifier, hasEndItem, isDirty, hasJewel;
- public ItemStack jewelry, modifier, endItem, jewel;
- public int timer, effect;
- public float angle;
-
- public TileEntityJewelrsCraftingTable()
- {
- this.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- this.modifier = new ItemStack(Item.getItemById(0), 0, 0);
- this.endItem = new ItemStack(Item.getItemById(0), 0, 0);
- this.jewel = new ItemStack(Item.getItemById(0), 0, 0);
- this.hasJewelry = false;
- this.hasModifier = false;
- this.hasEndItem = false;
- this.hasJewel = false;
- this.timer = 0;
- this.effect = 0;
- this.angle = 0;
- this.isDirty = false;
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setBoolean("hasJewelry", hasJewelry);
- nbt.setBoolean("hasModifier", hasModifier);
- nbt.setBoolean("hasEndItem", hasEndItem);
- nbt.setBoolean("hasJewel", hasJewel);
- nbt.setInteger("timer", timer);
- nbt.setInteger("effect", effect);
- nbt.setFloat("angle", angle);
-
- NBTTagCompound tag = new NBTTagCompound();
- NBTTagCompound tag1 = new NBTTagCompound();
- NBTTagCompound tag2 = new NBTTagCompound();
- NBTTagCompound tag3 = new NBTTagCompound();
-
- this.jewelry.writeToNBT(tag);
- nbt.setTag("jewelry", tag);
- this.modifier.writeToNBT(tag1);
- nbt.setTag("modifier", tag1);
- this.endItem.writeToNBT(tag2);
- nbt.setTag("endItem", tag2);
- this.jewel.writeToNBT(tag3);
- nbt.setTag("jewel", tag3);
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- this.hasJewelry = nbt.getBoolean("hasJewelry");
- this.hasModifier = nbt.getBoolean("hasModifier");
- this.hasEndItem = nbt.getBoolean("hasEndItem");
- this.hasJewel = nbt.getBoolean("hasJewel");
-
- this.timer = nbt.getInteger("timer");
- this.effect = nbt.getInteger("effect");
- this.angle = nbt.getFloat("angle");
- this.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- this.jewelry.readFromNBT(nbt.getCompoundTag("jewelry"));
- this.modifier = new ItemStack(Item.getItemById(0), 0, 0);
- this.modifier.readFromNBT(nbt.getCompoundTag("modifier"));
- this.endItem = new ItemStack(Item.getItemById(0), 0, 0);
- this.endItem.readFromNBT(nbt.getCompoundTag("endItem"));
- this.jewel = new ItemStack(Item.getItemById(0), 0, 0);
- this.jewel.readFromNBT(nbt.getCompoundTag("jewel"));
- }
-
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- if(isDirty){
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- if(angle<360F)angle+=3F;
- else angle=0F;
- if (this.hasJewelry && (this.hasModifier || this.hasJewel) && !this.hasEndItem)
- {
- if (timer > 0)
- {
- timer--;
- for (int l = 0; l < ConfigHandler.jewelryCraftingTime/(timer + 2); ++l)
- {
- if(this.getBlockMetadata() == 0) this.worldObj.spawnParticle("witchMagic", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D);
- if(this.getBlockMetadata() == 1) this.worldObj.spawnParticle("witchMagic", xCoord + 0.8F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
- if(this.getBlockMetadata() == 2) this.worldObj.spawnParticle("witchMagic", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.8F, 0.0D, 0.0D, 0.0D);
- if(this.getBlockMetadata() == 3) this.worldObj.spawnParticle("witchMagic", xCoord + 0.2F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
- }
- }
- if (timer == 0)
- {
- this.hasEndItem = true;
- this.endItem = jewelry.copy();
- if (hasModifier && modifier != new ItemStack(Item.getItemById(0), 0, 0)) JewelryNBT.addModifier(endItem, modifier);
- if (hasJewel && jewel != new ItemStack(Item.getItemById(0), 0, 0)) JewelryNBT.addJewel(endItem, jewel);
- if (hasJewel && hasModifier && JewelryNBT.isJewelX(endItem, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(endItem, new ItemStack(Items.book))) JewelryNBT.addMode(endItem, "Disenchant");
- if (hasModifier && JewelryNBT.isModifierEffectType(endItem)) JewelryNBT.addMode(endItem, "Activated");
- this.hasJewelry = false;
- this.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- this.hasModifier = false;
- this.modifier = new ItemStack(Item.getItemById(0), 0, 0);
- this.hasJewel = false;
- this.jewel = new ItemStack(Item.getItemById(0), 0, 0);
- timer = -1;
- }
- }
- }
-
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
- }
-
- @Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
-}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
deleted file mode 100644
index a1b0561..0000000
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package darkknight.jewelrycraft.tileentity;
-
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
-import net.minecraft.tileentity.TileEntity;
-import darkknight.jewelrycraft.item.ItemList;
-import darkknight.jewelrycraft.util.JewelryNBT;
-
-public class TileEntityMolder extends TileEntity
-{
- public int cooling;
- public boolean hasMoltenMetal, hasJewelBase, hasMold, isDirty;
- public ItemStack mold, jewelBase, moltenMetal, ringMetal;
- public float quantity;
-
- public TileEntityMolder()
- {
- this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
- this.mold = new ItemStack(Item.getItemById(0), 0, 0);
- this.ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.cooling = 0;
- this.quantity = 0f;
- this.hasJewelBase = false;
- this.hasMoltenMetal = false;
- this.hasMold = false;
- this.isDirty = false;
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setInteger("cooling", cooling);
- nbt.setFloat("quantity", quantity);
- nbt.setBoolean("hasJewelBase", hasJewelBase);
- nbt.setBoolean("hasMoltenMetal", hasMoltenMetal);
- nbt.setBoolean("hasMold", hasMold);
- NBTTagCompound tag = new NBTTagCompound();
- NBTTagCompound tag1 = new NBTTagCompound();
- NBTTagCompound tag2 = new NBTTagCompound();
- NBTTagCompound tag3 = new NBTTagCompound();
- this.mold.writeToNBT(tag);
- nbt.setTag("mold", tag);
- this.jewelBase.writeToNBT(tag1);
- nbt.setTag("jewelBase", tag1);
- this.moltenMetal.writeToNBT(tag2);
- nbt.setTag("moltenMetal", tag2);
- this.ringMetal.writeToNBT(tag3);
- nbt.setTag("ringMetal", tag3);
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- this.cooling = nbt.getInteger("cooling");
- this.quantity = nbt.getFloat("quantity");
- this.hasJewelBase = nbt.getBoolean("hasJewelBase");
- this.hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
- this.hasMold = nbt.getBoolean("hasMold");
- this.mold = new ItemStack(Item.getItemById(0), 0, 0);
- this.mold.readFromNBT(nbt.getCompoundTag("mold"));
- this.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
- this.jewelBase.readFromNBT(nbt.getCompoundTag("jewelBase"));
- this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
- this.ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.ringMetal.readFromNBT(nbt.getCompoundTag("ringMetal"));
- }
-
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- if(isDirty){
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- if (moltenMetal.getItem() != Item.getItemById(0))
- {
-// if(worldObj.rand.nextInt(20) == 0) this.worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.fizz", 0.5F, 1F);
- for (int l = 0; l < 2; ++l)
- this.worldObj.spawnParticle("reddust", xCoord + Math.random(), (double) yCoord + 0.2F, zCoord + Math.random(), 0.0D, 1.0D, 1.0D);
- }
- if (this.hasMoltenMetal && !this.hasJewelBase)
- {
- ringMetal = moltenMetal;
- if (cooling > 0 && quantity > 0.9f) this.cooling--;
- if (cooling == 0)
- {
- this.hasMoltenMetal = false;
- if (mold.getItemDamage() == 0)
- this.jewelBase = moltenMetal;
- else if (mold.getItemDamage() == 1)
- this.jewelBase = new ItemStack(ItemList.ring);
- else
- this.jewelBase = new ItemStack(ItemList.necklace);
- if(mold.getItemDamage() != 0 && jewelBase != new ItemStack(Item.getItemById(0), 0, 0))
- JewelryNBT.addMetal(jewelBase, ringMetal);
- this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.hasJewelBase = true;
- cooling = -1;
- quantity = 0f;
- isDirty = true;
- }
- }
- }
-
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
- }
-
- @Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
-}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
deleted file mode 100644
index 5f4be83..0000000
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package darkknight.jewelrycraft.tileentity;
-
-import java.util.Random;
-
-import darkknight.jewelrycraft.config.ConfigHandler;
-
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-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;
-
- public TileEntitySmelter()
- {
- this.melting = 0;
- this.pouring = false;
- this.flow = 0;
- this.quantity = 0f;
- this.hasMetal = false;
- this.hasMoltenMetal = false;
- this.metal = new ItemStack(Item.getItemById(0), 0, 0);
- this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.isDirty = false;
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setInteger("melting", melting);
- nbt.setFloat("quantity", quantity);
- nbt.setBoolean("hasMetal", hasMetal);
- nbt.setBoolean("hasMoltenMetal", hasMoltenMetal);
- nbt.setBoolean("pouring", pouring);
- NBTTagCompound tag = new NBTTagCompound();
- NBTTagCompound tag1 = new NBTTagCompound();
- this.metal.writeToNBT(tag);
- nbt.setTag("metal", tag);
- this.moltenMetal.writeToNBT(tag1);
- nbt.setTag("moltenMetal", tag1);
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- this.melting = nbt.getInteger("melting");
- this.quantity = nbt.getFloat("quantity");
- this.hasMetal = nbt.getBoolean("hasMetal");
- this.hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
- this.pouring = nbt.getBoolean("pouring");
- this.metal = new ItemStack(Item.getItemById(0), 0, 0);
- this.metal.readFromNBT(nbt.getCompoundTag("metal"));
- this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
- }
-
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- Random rand = new Random();
- if(isDirty){
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- 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 (this.hasMetal)
- {
- for (int l = 0; l < 2; ++l)
- this.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 = this.xCoord + rand.nextFloat();
- double d7 = this.yCoord;
- double d6 = this.zCoord + rand.nextFloat();
- 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)
- {
- this.hasMetal = false;
- this.moltenMetal = metal;
- this.metal = new ItemStack(Item.getItemById(0), 0, 0);
- this.hasMoltenMetal = true;
- this.quantity = 1f;
- melting = -1;
- this.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);
- if(pouring){
- quantity -= 0.01f;
- me.quantity += 0.01f;
- if(!me.hasMoltenMetal)
- {
- me.moltenMetal = moltenMetal;
- me.hasMoltenMetal = true;
- }
- if(quantity < 0){
- quantity = 0f;
- hasMoltenMetal = false;
- moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- pouring = false;
- me.cooling = ConfigHandler.ingotCoolingTime;
- }
- }
- }
-
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
- }
-
- @Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
-}