summaryrefslogtreecommitdiff
path: root/java/darkknight/jewelrycraft/tileentity
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-01-29 18:28:37 +0000
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-01-29 18:28:37 +0000
commit73ca377dc01f859dabd7b07738cb7aeb762272b1 (patch)
tree9c0acccbfbf78e813fb838ab566c96a40c5f36bb /java/darkknight/jewelrycraft/tileentity
parent06f62473f0622efe6decc32b70516a7c5d3d3572 (diff)
Made lots of changes
Diffstat (limited to 'java/darkknight/jewelrycraft/tileentity')
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java4
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java18
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java68
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java97
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java275
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java74
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java18
7 files changed, 497 insertions, 57 deletions
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java b/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
index 4226471..6a43cb3 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
@@ -70,7 +70,7 @@ public class TileEntityAltar extends TileEntity
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)
+ if (JewelryNBT.isGemX(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);
@@ -111,7 +111,7 @@ public class TileEntityAltar extends TileEntity
}
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)
+ if (JewelryNBT.isGemX(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);
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java b/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
index d027e6a..7a678e2 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
@@ -1,5 +1,7 @@
package darkknight.jewelrycraft.tileentity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -13,15 +15,16 @@ 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 int quantity, infoIndex, timer = 0;
public TileEntityDisplayer()
{
- this.ringTranslation1 = 0;
- this.ringTranslation2 = 0;
- this.ringTranslation3 = 0;
+ this.ringTranslation1 = 0.6f;
+ this.ringTranslation2 = 0.3f;
+ this.ringTranslation3 = 0.0f;
this.rotAngle = 0;
this.quantity = 0;
+ this.infoIndex = 1;
this.isDescending1 = false;
this.isDescending2 = false;
this.isDescending3 = false;
@@ -39,6 +42,7 @@ public class TileEntityDisplayer extends TileEntity
nbt.setFloat("translation3", ringTranslation3);
nbt.setFloat("angle", rotAngle);
nbt.setInteger("quantity", quantity);
+ nbt.setInteger("infoIndex", infoIndex);
nbt.setBoolean("descending1", isDescending1);
nbt.setBoolean("descending2", isDescending2);
nbt.setBoolean("descending3", isDescending3);
@@ -57,6 +61,7 @@ public class TileEntityDisplayer extends TileEntity
this.ringTranslation3 = nbt.getFloat("translation3");
this.rotAngle = nbt.getFloat("angle");
this.quantity = nbt.getInteger("quantity");
+ this.infoIndex = nbt.getInteger("infoIndex");
this.isDescending1 = nbt.getBoolean("descending1");
this.isDescending2 = nbt.getBoolean("descending2");
this.isDescending3 = nbt.getBoolean("descending3");
@@ -90,6 +95,11 @@ public class TileEntityDisplayer extends TileEntity
if (isDescending3) ringTranslation3 -= 0.03;
if (rotAngle < 360F) rotAngle += 6F;
if (rotAngle >= 360F) rotAngle = 0F;
+ timer++;
+ if(timer >= 20){
+ infoIndex++;
+ timer = 0;
+ }
}
public Packet getDescriptionPacket()
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java b/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java
new file mode 100644
index 0000000..f42ad75
--- /dev/null
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java
@@ -0,0 +1,68 @@
+package darkknight.jewelrycraft.tileentity;
+
+import java.util.List;
+
+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 TileEntityHandPedestal extends TileEntity
+{
+ public boolean isDirty, hasObject;
+ public ItemStack object = new ItemStack(Item.getItemById(0), 0, 0);
+
+ public TileEntityHandPedestal()
+ {
+ this.isDirty = false;
+ this.hasObject = false;
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ 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.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;
+ }
+ //System.out.println(Item.getIdFromItem(object.getItem()));
+ }
+
+ 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/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;
}
}
}
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java b/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java
new file mode 100644
index 0000000..0aff8df
--- /dev/null
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java
@@ -0,0 +1,275 @@
+package darkknight.jewelrycraft.tileentity;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+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.world.World;
+import darkknight.jewelrycraft.block.BlockHandPedestal;
+import darkknight.jewelrycraft.block.BlockList;
+import darkknight.jewelrycraft.particles.EntityShadowsFX;
+import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.PlayerUtils;
+
+public class TileEntityShadowEye extends TileEntity
+{
+ public int opening, timer, t = 20;
+ public boolean active;
+ public int field_145926_a;
+ public float field_145933_i;
+ public float field_145931_j;
+ public float field_145930_m;
+ public float field_145927_n;
+ public ArrayList<ItemStack> pedestalItems = new ArrayList<ItemStack>();
+
+ public TileEntityShadowEye()
+ {
+ this.opening = 1;
+ this.timer = 20;
+ this.active = false;
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ nbt.setInteger("opening", opening);
+ nbt.setInteger("timer", timer);
+ nbt.setBoolean("active", active);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ super.readFromNBT(nbt);
+ this.opening = nbt.getInteger("opening");
+ this.timer = nbt.getInteger("timer");
+ this.active = nbt.getBoolean("active");
+ }
+
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+ boolean valid = isValidStructure(worldObj, xCoord, yCoord, zCoord, blockMetadata);
+ if (active) timer--;
+ if (opening == 4 && timer <= 0)
+ {
+ active = false;
+ }
+ if (!active && timer <= 0 && opening != 1)
+ {
+ if (t > 0) t--;
+ if (t <= 0)
+ {
+ opening--;
+ t = 20;
+ }
+ }
+ if (opening == 4)
+ {
+ addData(worldObj, xCoord, yCoord, zCoord);
+ TileEntityHandPedestal target = (TileEntityHandPedestal) worldObj.getTileEntity(xCoord, yCoord - 3, zCoord);
+ if (target != null && target.object != null && target.object.getItem() != null) JewelryNBT.addModifiers(target.object, pedestalItems);
+ }
+ if (active && timer <= 0)
+ {
+ if (opening < 4)
+ {
+ opening++;
+ timer = 20;
+ }
+ if (valid && opening == 4) timer = 200;
+ else if (!valid)
+ {
+ active = false;
+ timer = -1;
+ }
+ }
+ EntityPlayer player1 = this.worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 7F);
+ if (player1 != null)
+ {
+ NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player1, "Jewelrycraft");
+ persistTag.setBoolean("nearStartedRitual", false);
+ }
+ if (active && opening == 4)
+ {
+ float din = 6F;
+ int i = Minecraft.getMinecraft().gameSettings.particleSetting;
+
+ for (float x = -din; x <= din; x += 0.2F)
+ for (float z = -din; z <= din; z += 0.2F)
+ if (x * x + z * z >= din * din - 1 && x * x + z * z <= din * din + 1) Minecraft.getMinecraft().effectRenderer.addEffect(new EntityShadowsFX(worldObj, xCoord + x + 0.5F, yCoord - 0.5F, zCoord + z + 0.5F, 15F, 0.04F - 0.01F * i));
+
+ for (int l = 0; l <= 2 - i; l++)
+ worldObj.spawnParticle("depthsuspend", xCoord + 6.5F - worldObj.rand.nextInt(9) - worldObj.rand.nextFloat(), yCoord - 2F + worldObj.rand.nextFloat(), zCoord + 6.5F - worldObj.rand.nextInt(9) - worldObj.rand.nextFloat(), 0, 0, 0);
+ EntityPlayer player = this.worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 6F);
+ if (player != null)
+ {
+ NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ persistTag.setBoolean("nearStartedRitual", true);
+ }
+ }
+ try
+ {
+ // System.out.println(pedestalItems);
+ }
+ catch (Exception e)
+ {
+ // System.out.println(e);
+ }
+ }
+
+ public boolean isValidStructure(World world, int x, int y, int z, int metadata)
+ {
+ if (world.getBlockMetadata(x, y, z) == 0 || world.getBlockMetadata(x, y, z) == 2)
+ {
+ // Layers from top to bottom
+ // 1st Layer
+ if (world.getBlock(x, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z) != 5) return false;
+ if (world.getBlock(x + 1, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x + 1, y + 1, z) != 5) return false;
+ if (world.getBlock(x - 1, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x - 1, y + 1, z) != 5) return false;
+ // 2nd Layer
+ if (world.getBlock(x + 2, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x + 2, y, z) != 1) return false;
+ if (world.getBlock(x + 1, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x + 1, y, z) != 4) return false;
+ if (world.getBlock(x - 1, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x - 1, y, z) != 5) return false;
+ if (world.getBlock(x - 2, y, z) != Blocks.stone_brick_stairs || world.getBlockMetadata(x - 2, y, z) != 0) return false;
+ // 3rd Layer
+ if (world.getBlock(x + 2, y - 1, z) != Blocks.stonebrick) return false;
+ if (world.getBlock(x - 2, y - 1, z) != Blocks.stonebrick) return false;
+ // 4th Layer
+ if (world.getBlock(x + 2, y - 2, z) != Blocks.stonebrick) return false;
+ if (world.getBlock(x - 2, y - 2, z) != Blocks.stonebrick) return false;
+ // 5th Layer
+ if (world.getBlock(x + 2, y - 3, z) != Blocks.stonebrick) return false;
+ if (world.getBlock(x - 2, y - 3, z) != Blocks.stonebrick) return false;
+ }
+ else if (world.getBlockMetadata(x, y, z) == 1 || world.getBlockMetadata(x, y, z) == 3)
+ {
+ // Layers from top to bottom
+ // 1st Layer
+ if (world.getBlock(x, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z) != 5) return false;
+ if (world.getBlock(x, y + 1, z + 1) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z + 1) != 5) return false;
+ if (world.getBlock(x, y + 1, z - 1) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z - 1) != 5) return false;
+ // 2nd Layer
+ if (world.getBlock(x, y, z + 2) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z + 2) != 3) return false;
+ if (world.getBlock(x, y, z + 1) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z + 1) != 6) return false;
+ if (world.getBlock(x, y, z - 1) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z - 1) != 7) return false;
+ if (world.getBlock(x, y, z - 2) != Blocks.stone_brick_stairs || world.getBlockMetadata(x, y, z - 2) != 2) return false;
+ // 3rd Layer
+ if (world.getBlock(x, y - 1, z + 2) != Blocks.stonebrick) return false;
+ if (world.getBlock(x, y - 1, z - 2) != Blocks.stonebrick) return false;
+ // 4th Layer
+ if (world.getBlock(x, y - 2, z + 2) != Blocks.stonebrick) return false;
+ if (world.getBlock(x, y - 2, z - 2) != Blocks.stonebrick) return false;
+ // 5th Layer
+ if (world.getBlock(x, y - 3, z + 2) != Blocks.stonebrick) return false;
+ if (world.getBlock(x, y - 3, z - 2) != Blocks.stonebrick) return false;
+ }
+ // 3rd Layer
+ if (world.getBlock(x - 4, y - 1, z - 4) != BlockList.shadowBlock) return false;
+ if (world.getBlock(x - 4, y - 1, z + 4) != BlockList.shadowBlock) return false;
+ if (world.getBlock(x + 4, y - 1, z - 4) != BlockList.shadowBlock) return false;
+ if (world.getBlock(x + 4, y - 1, z + 4) != BlockList.shadowBlock) return false;
+ // 4th Layer
+ if (world.getBlock(x - 4, y - 2, z - 4) != Blocks.stonebrick) return false;
+ if (world.getBlock(x - 4, y - 2, z + 4) != Blocks.stonebrick) return false;
+ if (world.getBlock(x + 4, y - 2, z - 4) != Blocks.stonebrick) return false;
+ if (world.getBlock(x + 4, y - 2, z + 4) != Blocks.stonebrick) return false;
+ // 5th Layer
+ // Pillars
+ if (world.getBlock(x - 4, y - 3, z - 4) != Blocks.stonebrick) return false;
+ if (world.getBlock(x - 4, y - 3, z + 4) != Blocks.stonebrick) return false;
+ if (world.getBlock(x + 4, y - 3, z - 4) != Blocks.stonebrick) return false;
+ if (world.getBlock(x + 4, y - 3, z + 4) != Blocks.stonebrick) return false;
+ // Pedestals
+ if (!(world.getBlock(x, y - 3, z) instanceof BlockHandPedestal)) return false;
+ if (world.getBlock(x - 4, y - 3, z + 2) != BlockList.handPedestal || world.getBlockMetadata(x - 4, y - 3, z + 2) != 1) return false;
+ if (world.getBlock(x - 5, y - 3, z) != BlockList.handPedestal || world.getBlockMetadata(x - 5, y - 3, z) != 2) return false;
+ if (world.getBlock(x - 4, y - 3, z - 2) != BlockList.handPedestal || world.getBlockMetadata(x - 4, y - 3, z - 2) != 3) return false;
+
+ if (world.getBlock(x - 2, y - 3, z - 4) != BlockList.handPedestal || world.getBlockMetadata(x - 2, y - 3, z - 4) != 3) return false;
+ if (world.getBlock(x, y - 3, z - 5) != BlockList.handPedestal || world.getBlockMetadata(x, y - 3, z - 5) != 4) return false;
+ if (world.getBlock(x + 2, y - 3, z - 4) != BlockList.handPedestal || world.getBlockMetadata(x + 2, y - 3, z - 4) != 5) return false;
+
+ if (world.getBlock(x + 4, y - 3, z - 2) != BlockList.handPedestal || world.getBlockMetadata(x + 4, y - 3, z - 2) != 5) return false;
+ if (world.getBlock(x + 5, y - 3, z) != BlockList.handPedestal || world.getBlockMetadata(x + 5, y - 3, z) != 6) return false;
+ if (world.getBlock(x + 4, y - 3, z + 2) != BlockList.handPedestal || world.getBlockMetadata(x + 4, y - 3, z + 2) != 7) return false;
+
+ if (world.getBlock(x + 2, y - 3, z + 4) != BlockList.handPedestal || world.getBlockMetadata(x + 2, y - 3, z + 4) != 7) return false;
+ if (world.getBlock(x, y - 3, z + 5) != BlockList.handPedestal || world.getBlockMetadata(x, y - 3, z + 5) != 0) return false;
+ if (world.getBlock(x - 2, y - 3, z + 4) != BlockList.handPedestal || world.getBlockMetadata(x - 2, y - 3, z + 4) != 1) return false;
+ return true;
+ }
+
+ public void addData(World world, int x, int y, int z)
+ {
+ pedestalItems.clear();
+ // addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x, y -
+ // 3, z));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 2, y - 3, z - 4));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 4, y - 3, z + 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x, y - 3, z - 5));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 2, y - 3, z - 4));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 4, y - 3, z - 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 5, y - 3, z));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 4, y - 3, z - 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 5, y - 3, z));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 4, y - 3, z + 2));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 2, y - 3, z + 4));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x, y - 3, z + 5));
+ addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 2, y - 3, z + 4));
+ }
+
+ public void addPedestalInfo(TileEntityHandPedestal pedestal)
+ {
+ System.out.println(pedestalItems);
+ if (pedestal != null && pedestal.object != null && pedestal.object.getItem() != null)
+ {
+ if (pedestalItems.isEmpty()) pedestalItems.add(pedestal.object.copy());
+ else
+ {
+ boolean hasItem = false;
+ int index = 0;
+ for (int ind = 0; ind < pedestalItems.size() && !hasItem; ind++)
+ {
+ if (pedestal.object.getItem().equals(pedestalItems.get(ind).getItem()) && pedestal.object.getItemDamage() == pedestalItems.get(ind).getItemDamage())
+ {
+ index = ind;
+ hasItem = true;
+ if (pedestal.object.hasTagCompound() && pedestalItems.get(ind).hasTagCompound() && !pedestal.object.getTagCompound().equals(pedestalItems.get(ind).getTagCompound())) hasItem = false;
+ }
+ }
+ if (!hasItem) pedestalItems.add(pedestal.object.copy());
+ else
+ {
+ ItemStack object = pedestalItems.get(index).copy();
+ object.stackSize++;
+ pedestalItems.set(index, object);
+ }
+ }
+ }
+ }
+
+ 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/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java b/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java
new file mode 100644
index 0000000..1a274ec
--- /dev/null
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java
@@ -0,0 +1,74 @@
+package darkknight.jewelrycraft.tileentity;
+
+import java.util.List;
+
+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 TileEntityShadowHand extends TileEntity
+{
+ public boolean isDirty, hasObject;
+ public ItemStack object = new ItemStack(Item.getItemById(0), 0, 0);
+ public float grip;
+
+ public TileEntityShadowHand()
+ {
+ this.isDirty = false;
+ this.hasObject = false;
+ this.grip = 0f;
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ nbt.setBoolean("hasObject", hasObject);
+ nbt.setFloat("Grip", grip);
+ NBTTagCompound tag = new NBTTagCompound();
+ this.object.writeToNBT(tag);
+ nbt.setTag("object", tag);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ super.readFromNBT(nbt);
+ this.hasObject = nbt.getBoolean("hasObject");
+ this.grip = nbt.getFloat("Grip");
+ 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(grip <= 10f) grip++;
+ else grip = 0;
+ //System.out.println(Item.getIdFromItem(object.getItem()));
+ }
+
+ 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/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
index 3330bd2..22d0465 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
@@ -106,15 +106,15 @@ public class TileEntitySmelter extends TileEntity
if (melting == 0)
{
this.hasMetal = false;
- if(!isOre) this.moltenMetal = metal;
- else{
+ if (!isOre) this.moltenMetal = metal;
+ else
+ {
this.moltenMetal = JewelrycraftUtil.getIngotFromOre(metal.getItem());
- moltenMetal.stackSize*=2;
+ moltenMetal.stackSize *= 2;
}
-// System.out.println(JewelrycraftUtil.getIngotFromOre(metal) + " | " + JewelrycraftUtil.ores + " | " + JewelrycraftUtil.oreToIngot);
this.hasMoltenMetal = true;
- if(!isOre) this.quantity = 0.1f * metal.stackSize;
- else this.quantity = 0.2f * metal.stackSize;
+ if (!isOre) this.quantity = 0.1f * metal.stackSize;
+ else this.quantity = 0.2f * metal.stackSize;
this.metal = new ItemStack(Item.getItemById(0), 0, 0);
melting = -1;
this.isDirty = true;
@@ -127,9 +127,9 @@ public class TileEntitySmelter extends TileEntity
if (melting == 0)
{
this.hasMetal = false;
- if(!isOre) this.moltenMetal.stackSize += this.metal.stackSize;
- else this.moltenMetal.stackSize += this.metal.stackSize*2;
- if(!isOre) this.quantity += 0.1f * metal.stackSize;
+ if (!isOre) this.moltenMetal.stackSize += this.metal.stackSize;
+ else this.moltenMetal.stackSize += this.metal.stackSize * 2;
+ if (!isOre) this.quantity += 0.1f * metal.stackSize;
else this.quantity += 0.2f * metal.stackSize;
this.metal = new ItemStack(Item.getItemById(0), 0, 0);
melting = -1;