From 1a692ab45df3d88a6cc247cc9f4c0a41c7715264 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Mon, 14 Apr 2014 11:58:43 +0300 Subject: Updating to 1.7 --- .../jewelrycraft/tileentity/TileEntityAltar.java | 145 --------------------- .../tileentity/TileEntityBlockShadow.java | 77 ----------- .../tileentity/TileEntityDisplayer.java | 110 ---------------- .../tileentity/TileEntityJewelrsCraftingTable.java | 143 -------------------- .../jewelrycraft/tileentity/TileEntityMolder.java | 124 ------------------ .../jewelrycraft/tileentity/TileEntitySmelter.java | 125 ------------------ 6 files changed, 724 deletions(-) delete mode 100644 common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java delete mode 100644 common/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java delete mode 100644 common/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java delete mode 100644 common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java delete mode 100644 common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java delete mode 100644 common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java (limited to 'common/darkknight/jewelrycraft/tileentity') diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java b/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java deleted file mode 100644 index a0c0a3e..0000000 --- a/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java +++ /dev/null @@ -1,145 +0,0 @@ -package darkknight.jewelrycraft.tileentity; - -import java.util.List; - -import darkknight.jewelrycraft.util.JewelryNBT; -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; - -public class TileEntityAltar extends TileEntity -{ - public ItemStack object; - public boolean isDirty, hasObject; - public String playerName; - - public TileEntityAltar() - { - this.hasObject = false; - this.object = new ItemStack(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.setCompoundTag("object", tag); - nbt.setBoolean("hasObject", hasObject); - nbt.setString("playerName", playerName); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - this.object = new ItemStack(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 = true; - } - 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(Item.enderPearl)) && 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(Item.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(Item.dyePowder, 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.getBlockId(xCoord + i, yCoord + j, zCoord + k) == Block.tilledField.blockID) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7); - if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) != Block.tilledField.blockID) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlockId(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(Item.enderPearl)) && 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(Item.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(Item.dyePowder, 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.getBlockId(xCoord + i, yCoord + j, zCoord + k) == Block.tilledField.blockID) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7); - if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) != Block.tilledField.blockID) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k), 5); - //JewelrycraftUtil.applyBonemeal(object, worldObj, xCoord + i, yCoord + j, zCoord + k, player); - } - } - } - } - } - - @Override - public Packet getDescriptionPacket() - { - Packet132TileEntityData packet = (Packet132TileEntityData) super.getDescriptionPacket(); - NBTTagCompound dataTag = packet != null ? packet.data : new NBTTagCompound(); - writeToNBT(dataTag); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, dataTag); - } - - @Override - public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) - { - super.onDataPacket(net, pkt); - NBTTagCompound tag = pkt != null ? pkt.data : new NBTTagCompound(); - readFromNBT(tag); - } -} diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java b/common/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java deleted file mode 100644 index 138d0ab..0000000 --- a/common/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java +++ /dev/null @@ -1,77 +0,0 @@ -package darkknight.jewelrycraft.tileentity; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; -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.getBlockId(xCoord, yCoord, zCoord)); - } - - @Override - public Packet getDescriptionPacket() - { - Packet132TileEntityData packet = (Packet132TileEntityData) super.getDescriptionPacket(); - NBTTagCompound dataTag = packet != null ? packet.data : new NBTTagCompound(); - writeToNBT(dataTag); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, dataTag); - } - - @Override - public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) - { - super.onDataPacket(net, pkt); - NBTTagCompound tag = pkt != null ? pkt.data : new NBTTagCompound(); - readFromNBT(tag); - } -} diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java b/common/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java deleted file mode 100644 index c3eba49..0000000 --- a/common/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java +++ /dev/null @@ -1,110 +0,0 @@ -package darkknight.jewelrycraft.tileentity; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; -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(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.setCompoundTag("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(0, 0, 0); - this.object.readFromNBT(nbt.getCompoundTag("object")); - } - - @Override - public void updateEntity() - { - super.updateEntity(); - if(isDirty) - { - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - isDirty = true; - } - 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; - } - - @Override - public Packet getDescriptionPacket() - { - Packet132TileEntityData packet = (Packet132TileEntityData) super.getDescriptionPacket(); - NBTTagCompound dataTag = packet != null ? packet.data : new NBTTagCompound(); - writeToNBT(dataTag); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, dataTag); - } - - @Override - public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) - { - super.onDataPacket(net, pkt); - NBTTagCompound tag = pkt != null ? pkt.data : new NBTTagCompound(); - readFromNBT(tag); - } -} diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java deleted file mode 100644 index 69fd69a..0000000 --- a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java +++ /dev/null @@ -1,143 +0,0 @@ -package darkknight.jewelrycraft.tileentity; - -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.util.JewelryNBT; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; -import net.minecraft.tileentity.TileEntity; - -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(0, 0, 0); - this.modifier = new ItemStack(0, 0, 0); - this.endItem = new ItemStack(0, 0, 0); - this.jewel = new ItemStack(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.setCompoundTag("jewelry", tag); - this.modifier.writeToNBT(tag1); - nbt.setCompoundTag("modifier", tag1); - this.endItem.writeToNBT(tag2); - nbt.setCompoundTag("endItem", tag2); - this.jewel.writeToNBT(tag3); - nbt.setCompoundTag("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(0, 0, 0); - this.jewelry.readFromNBT(nbt.getCompoundTag("jewelry")); - this.modifier = new ItemStack(0, 0, 0); - this.modifier.readFromNBT(nbt.getCompoundTag("modifier")); - this.endItem = new ItemStack(0, 0, 0); - this.endItem.readFromNBT(nbt.getCompoundTag("endItem")); - this.jewel = new ItemStack(0, 0, 0); - this.jewel.readFromNBT(nbt.getCompoundTag("jewel")); - } - - @Override - public void updateEntity() - { - super.updateEntity(); - if(isDirty){ - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - isDirty = true; - } - 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(0, 0, 0)) JewelryNBT.addModifier(endItem, modifier); - if (hasJewel && jewel != new ItemStack(0, 0, 0)) JewelryNBT.addJewel(endItem, jewel); - if (hasJewel && hasModifier && JewelryNBT.isJewelX(endItem, new ItemStack(Item.netherStar)) && JewelryNBT.isModifierX(endItem, new ItemStack(Item.book))) JewelryNBT.addMode(endItem, "Disenchant"); - if (hasModifier && JewelryNBT.isModifierEffectType(endItem)) JewelryNBT.addMode(endItem, "Activated"); - this.hasJewelry = false; - this.jewelry = new ItemStack(0, 0, 0); - this.hasModifier = false; - this.modifier = new ItemStack(0, 0, 0); - this.hasJewel = false; - this.jewel = new ItemStack(0, 0, 0); - timer = -1; - } - } - } - - @Override - public Packet getDescriptionPacket() - { - Packet132TileEntityData packet = (Packet132TileEntityData) super.getDescriptionPacket(); - NBTTagCompound dataTag = packet != null ? packet.data : new NBTTagCompound(); - writeToNBT(dataTag); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, dataTag); - } - - @Override - public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) - { - super.onDataPacket(net, pkt); - NBTTagCompound tag = pkt != null ? pkt.data : new NBTTagCompound(); - readFromNBT(tag); - } -} diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java deleted file mode 100644 index 05e6e34..0000000 --- a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java +++ /dev/null @@ -1,124 +0,0 @@ -package darkknight.jewelrycraft.tileentity; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; -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 TileEntityMolder() - { - this.moltenMetal = new ItemStack(0, 0, 0); - this.jewelBase = new ItemStack(0, 0, 0); - this.mold = new ItemStack(0, 0, 0); - this.ringMetal = new ItemStack(0, 0, 0); - this.cooling = 0; - 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.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.setCompoundTag("mold", tag); - this.jewelBase.writeToNBT(tag1); - nbt.setCompoundTag("jewelBase", tag1); - this.moltenMetal.writeToNBT(tag2); - nbt.setCompoundTag("moltenMetal", tag2); - this.ringMetal.writeToNBT(tag3); - nbt.setCompoundTag("ringMetal", tag3); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - this.cooling = nbt.getInteger("cooling"); - this.hasJewelBase = nbt.getBoolean("hasJewelBase"); - this.hasMoltenMetal = nbt.getBoolean("hasMoltenMetal"); - this.hasMold = nbt.getBoolean("hasMold"); - this.mold = new ItemStack(0, 0, 0); - this.mold.readFromNBT(nbt.getCompoundTag("mold")); - this.jewelBase = new ItemStack(0, 0, 0); - this.jewelBase.readFromNBT(nbt.getCompoundTag("jewelBase")); - this.moltenMetal = new ItemStack(0, 0, 0); - this.moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal")); - this.ringMetal = new ItemStack(0, 0, 0); - this.ringMetal.readFromNBT(nbt.getCompoundTag("ringMetal")); - } - - @Override - public void updateEntity() - { - super.updateEntity(); - if(isDirty){ - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - isDirty = true; - } - if (moltenMetal.itemID != 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) - 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(0, 0, 0)) - JewelryNBT.addMetal(jewelBase, ringMetal); - this.moltenMetal = new ItemStack(0, 0, 0); - this.hasJewelBase = true; - cooling = -1; - } - } - } - - @Override - public Packet getDescriptionPacket() - { - Packet132TileEntityData packet = (Packet132TileEntityData) super.getDescriptionPacket(); - NBTTagCompound dataTag = packet != null ? packet.data : new NBTTagCompound(); - writeToNBT(dataTag); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, dataTag); - } - - @Override - public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) - { - super.onDataPacket(net, pkt); - NBTTagCompound tag = pkt != null ? pkt.data : new NBTTagCompound(); - readFromNBT(tag); - } -} diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java deleted file mode 100644 index 1012741..0000000 --- a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java +++ /dev/null @@ -1,125 +0,0 @@ -package darkknight.jewelrycraft.tileentity; - -import java.util.Random; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; -import net.minecraft.tileentity.TileEntity; - -public class TileEntitySmelter extends TileEntity -{ - public int melting, flow, n = 0, p = 0; - public boolean hasMetal, hasMoltenMetal, isDirty; - public ItemStack metal, moltenMetal; - - public TileEntitySmelter() - { - this.melting = 0; - this.flow = 0; - this.hasMetal = false; - this.hasMoltenMetal = false; - this.metal = new ItemStack(0, 0, 0); - this.moltenMetal = new ItemStack(0, 0, 0); - this.isDirty = false; - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setInteger("melting", melting); - nbt.setBoolean("hasMetal", hasMetal); - nbt.setBoolean("hasMoltenMetal", hasMoltenMetal); - NBTTagCompound tag = new NBTTagCompound(); - NBTTagCompound tag1 = new NBTTagCompound(); - this.metal.writeToNBT(tag); - nbt.setCompoundTag("metal", tag); - this.moltenMetal.writeToNBT(tag1); - nbt.setCompoundTag("moltenMetal", tag1); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - this.melting = nbt.getInteger("melting"); - this.hasMetal = nbt.getBoolean("hasMetal"); - this.hasMoltenMetal = nbt.getBoolean("hasMoltenMetal"); - this.metal = new ItemStack(0, 0, 0); - this.metal.readFromNBT(nbt.getCompoundTag("metal")); - this.moltenMetal = new ItemStack(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 = true; - } - 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(0, 0, 0); - this.hasMoltenMetal = true; - melting = -1; - } - } - } - - @Override - public Packet getDescriptionPacket() - { - Packet132TileEntityData packet = (Packet132TileEntityData) super.getDescriptionPacket(); - NBTTagCompound dataTag = packet != null ? packet.data : new NBTTagCompound(); - writeToNBT(dataTag); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, dataTag); - } - - @Override - public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) - { - super.onDataPacket(net, pkt); - NBTTagCompound tag = pkt != null ? pkt.data : new NBTTagCompound(); - readFromNBT(tag); - } -} -- cgit v1.2.3