diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-01-29 18:28:37 +0000 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-01-29 18:28:37 +0000 |
| commit | 73ca377dc01f859dabd7b07738cb7aeb762272b1 (patch) | |
| tree | 9c0acccbfbf78e813fb838ab566c96a40c5f36bb /java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java | |
| parent | 06f62473f0622efe6decc32b70516a7c5d3d3572 (diff) | |
Made lots of changes
Diffstat (limited to 'java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java')
| -rw-r--r-- | java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java | 97 |
1 files changed, 55 insertions, 42 deletions
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java index fd2290a..5e91624 100644 --- a/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java +++ b/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java @@ -1,5 +1,8 @@ package darkknight.jewelrycraft.tileentity; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -7,28 +10,31 @@ 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.potion.Potion; +import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.particles.EntityShadowsFX; 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 boolean hasJewelry, hasEndItem, isDirty, hasGem, crafting; + public ItemStack jewelry, endItem, gem; + public int carving, 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.gem = new ItemStack(Item.getItemById(0), 0, 0); this.hasJewelry = false; - this.hasModifier = false; this.hasEndItem = false; - this.hasJewel = false; - this.timer = 0; + this.hasGem = false; + this.crafting = false; + this.carving = 0; this.effect = 0; this.angle = 0; this.isDirty = false; @@ -39,25 +45,22 @@ public class TileEntityJewelrsCraftingTable extends TileEntity { super.writeToNBT(nbt); nbt.setBoolean("hasJewelry", hasJewelry); - nbt.setBoolean("hasModifier", hasModifier); nbt.setBoolean("hasEndItem", hasEndItem); - nbt.setBoolean("hasJewel", hasJewel); - nbt.setInteger("timer", timer); + nbt.setBoolean("hasJewel", hasGem); + nbt.setBoolean("crafting", crafting); + nbt.setInteger("timer", carving); 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.jewelry.writeToNBT(tag1); + nbt.setTag("jewelry", tag1); this.endItem.writeToNBT(tag2); nbt.setTag("endItem", tag2); - this.jewel.writeToNBT(tag3); + this.gem.writeToNBT(tag3); nbt.setTag("jewel", tag3); } @@ -66,21 +69,19 @@ public class TileEntityJewelrsCraftingTable extends TileEntity { super.readFromNBT(nbt); this.hasJewelry = nbt.getBoolean("hasJewelry"); - this.hasModifier = nbt.getBoolean("hasModifier"); this.hasEndItem = nbt.getBoolean("hasEndItem"); - this.hasJewel = nbt.getBoolean("hasJewel"); + this.hasGem = nbt.getBoolean("hasJewel"); + this.crafting = nbt.getBoolean("crafting"); - this.timer = nbt.getInteger("timer"); + this.carving = 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")); + this.gem = new ItemStack(Item.getItemById(0), 0, 0); + this.gem.readFromNBT(nbt.getCompoundTag("jewel")); } @Override @@ -94,34 +95,46 @@ public class TileEntityJewelrsCraftingTable extends TileEntity } if (angle < 360F) angle += 3F; else angle = 0F; - if (this.hasJewelry && (this.hasModifier || this.hasJewel) && !this.hasEndItem) + + if (carving > 0) System.out.println(carving); + if (this.hasJewelry && this.hasGem && !this.hasEndItem && crafting) { - if (timer > 0) + if (carving > 0) carving--; + if (crafting) { - timer--; - for (int l = 0; l < ConfigHandler.jewelryCraftingTime / (timer + 2); ++l) + for (int l = 0; l < ConfigHandler.jewelryCraftingTime / (carving + 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 (this.getBlockMetadata() == 0) this.worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D); + if (this.getBlockMetadata() == 1) this.worldObj.spawnParticle("instantSpell", xCoord + 0.8F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D); + if (this.getBlockMetadata() == 2) this.worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.8F, 0.0D, 0.0D, 0.0D); + if (this.getBlockMetadata() == 3) this.worldObj.spawnParticle("instantSpell", xCoord + 0.2F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D); + } } - if (timer == 0) + if (carving == 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"); + if (hasGem && gem != new ItemStack(Item.getItemById(0), 0, 0)) + { + if (!JewelryNBT.hasTag(jewelry, "gem")) + { + JewelryNBT.addGem(endItem, gem); + this.hasGem = false; + this.gem = new ItemStack(Item.getItemById(0), 0, 0); + } + else + { + ItemStack aux = JewelryNBT.gem(jewelry); + JewelryNBT.addGem(endItem, gem); + gem = aux.copy(); + } + } 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; + carving = -1; + crafting = false; + isDirty = true; } } } |
