summaryrefslogtreecommitdiff
path: root/common/darkknight/jewelrycraft/block
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-24 21:01:41 +0200
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-24 21:01:41 +0200
commit1997f4547812121223836dcacfcb31ea63acdda6 (patch)
treec6962617e7c2374b9d7393846d94bc99c21f940c /common/darkknight/jewelrycraft/block
parent198677e5b01009a65d243da1d25a14f879df659c (diff)
Fixed some bugs with tile entities, fixed rings rendering issue, added interdimensional teleporting rings and ender chest ring
Diffstat (limited to 'common/darkknight/jewelrycraft/block')
-rw-r--r--common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java22
-rw-r--r--common/darkknight/jewelrycraft/block/BlockMolder.java1
-rw-r--r--common/darkknight/jewelrycraft/block/BlockSmelter.java21
3 files changed, 32 insertions, 12 deletions
diff --git a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
index c9372a9..ebbae64 100644
--- a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
+++ b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
@@ -43,12 +43,15 @@ public class BlockJewelrsCraftingTable extends BlockContainer
modifiers.add(new ItemStack(Item.sugar));
modifiers.add(new ItemStack(Block.chest));
modifiers.add(new ItemStack(Item.pickaxeIron));
+ modifiers.add(new ItemStack(Item.bed));
+ modifiers.add(new ItemStack(Item.eyeOfEnder));
//Jewels
jewel.add(new ItemStack(Item.enderPearl));
jewel.add(new ItemStack(Item.diamond));
jewel.add(new ItemStack(Item.emerald));
jewel.add(new ItemStack(Block.obsidian));
+ jewel.add(new ItemStack(Item.netherStar));
//Jewelry
jewelry.add(new ItemStack(ItemList.ring));
@@ -73,7 +76,6 @@ public class BlockJewelrsCraftingTable extends BlockContainer
ItemStack item = entityPlayer.inventory.getCurrentItem();
if (te != null && !world.isRemote)
{
- te.isDirty = true;
if (!te.hasEndItem && !te.hasJewelry && item != null && isJewelry(item))
{
if(te.hasModifier && te.hasJewel && item.hasTagCompound() && item.getTagCompound().hasKey("modifier") && item.getTagCompound().hasKey("jewel"))
@@ -88,6 +90,8 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.hasJewelry = true;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
entityPlayer.inventory.onInventoryChanged();
+ world.setBlockTileEntity(i, j, k, te);
+ te.isDirty = true;
}
}
if (!te.hasEndItem && !te.hasModifier && item != null && isModifier(item))
@@ -101,6 +105,8 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.hasModifier = true;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
entityPlayer.inventory.onInventoryChanged();
+ world.setBlockTileEntity(i, j, k, te);
+ te.isDirty = true;
}
}
if (!te.hasEndItem && !te.hasJewel && item != null && isJewel(item))
@@ -114,6 +120,8 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.hasJewel = true;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
entityPlayer.inventory.onInventoryChanged();
+ world.setBlockTileEntity(i, j, k, te);
+ te.isDirty = true;
}
}
if (te.timer <= 0 && !te.hasEndItem && te.hasJewelry && (te.hasModifier || te.hasJewel)){ te.timer = ConfigHandler.jewelryCraftingTime; te.angle = 0;}
@@ -126,6 +134,8 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.hasModifier = false;
te.timer = 0;
te.angle = 0F;
+ world.markTileEntityForDespawn(te);
+ world.setBlockTileEntity(i, j, k, te);
}
if (te.hasJewelry && entityPlayer.isSneaking())
{
@@ -134,6 +144,8 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.hasJewelry = false;
te.timer = 0;
te.angle = 0F;
+ world.markTileEntityForDespawn(te);
+ world.setBlockTileEntity(i, j, k, te);
}
if (te.hasJewel && entityPlayer.isSneaking())
{
@@ -142,9 +154,9 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.hasJewel = false;
te.timer = 0;
te.angle = 0F;
+ world.markTileEntityForDespawn(te);
+ world.setBlockTileEntity(i, j, k, te);
}
- te.isDirty = true;
- world.setBlockTileEntity(i, j, k, te);
}
return true;
}
@@ -206,6 +218,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
if (te.hasJewelry) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelry.copy());
if (te.hasJewel) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewel.copy());
if (te.hasEndItem) dropItem(te.worldObj, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy());
+ world.markTileEntityForDespawn(te);
}
super.breakBlock(world, i, j, k, par5, par6);
}
@@ -228,12 +241,13 @@ public class BlockJewelrsCraftingTable extends BlockContainer
dropItem(te.worldObj, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy());
te.endItem = new ItemStack(0, 0, 0);
te.hasEndItem = false;
+ world.markTileEntityForDespawn(te);
+ world.setBlockTileEntity(i, j, k, te);
}
else if (te.hasJewelry && (te.hasModifier || te.hasJewel) && te.timer > 0 && te.jewelry != null) player.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.table.iscrafting", te.jewelry.getDisplayName()) + " (" + ((ConfigHandler.jewelryCraftingTime - te.timer) * 100 / ConfigHandler.jewelryCraftingTime) + "%)");
else if ((!te.hasModifier || !te.hasJewel) && !te.hasJewelry) player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.missingjewelryandmodifierorjewel"));
else if (!te.hasJewelry) player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.missingjewelry"));
else if (!te.hasModifier || !te.hasJewel) player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.missingmodifierorjewel"));
- te.isDirty = true;
}
}
diff --git a/common/darkknight/jewelrycraft/block/BlockMolder.java b/common/darkknight/jewelrycraft/block/BlockMolder.java
index cae036e..f26c232 100644
--- a/common/darkknight/jewelrycraft/block/BlockMolder.java
+++ b/common/darkknight/jewelrycraft/block/BlockMolder.java
@@ -84,6 +84,7 @@ public class BlockMolder extends BlockContainer
{
if(te.hasJewelBase) dropItem(te.worldObj, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.jewelBase.copy());
if(te.hasMold) dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.mold.copy());
+ world.markTileEntityForDespawn(te);
}
super.breakBlock(world, i, j, k, par5, par6);
diff --git a/common/darkknight/jewelrycraft/block/BlockSmelter.java b/common/darkknight/jewelrycraft/block/BlockSmelter.java
index c762005..472d3b8 100644
--- a/common/darkknight/jewelrycraft/block/BlockSmelter.java
+++ b/common/darkknight/jewelrycraft/block/BlockSmelter.java
@@ -51,7 +51,10 @@ public class BlockSmelter extends BlockContainer
public void breakBlock(World world, int i, int j, int k, int par5, int par6)
{
TileEntitySmelter te = (TileEntitySmelter) world.getBlockTileEntity(i, j, k);
- if (te != null && te.hasMetal) dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.metal.copy());
+ if (te != null && te.hasMetal){
+ dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.metal.copy());
+ world.markTileEntityForDespawn(te);
+ }
super.breakBlock(world, i, j, k, par5, par6);
}
@@ -62,7 +65,7 @@ public class BlockSmelter extends BlockContainer
ItemStack item = entityPlayer.inventory.getCurrentItem();
if (te != null && !world.isRemote)
{
- if (!te.hasMetal && !te.hasMoltenMetal && item != null && item.getUnlocalizedName().toLowerCase().contains("ingot") && !item.getUnlocalizedName().toLowerCase().contains("mold"))
+ if (!te.hasMetal && !te.hasMoltenMetal && item != null && (item.getUnlocalizedName().toLowerCase().contains("ingot") || entityPlayer.username.equals("sor1n")) && !item.getUnlocalizedName().toLowerCase().contains("mold"))
{
entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.smelter.nowsmeltingingot", item.getDisplayName()));
te.metal = item.copy();
@@ -70,6 +73,7 @@ public class BlockSmelter extends BlockContainer
te.hasMetal = true;
te.melting = ConfigHandler.ingotMeltingTime;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
+ te.isDirty = true;
}
else if (te.hasMetal && !te.hasMoltenMetal && item != null && item.getDisplayName().contains("Ingot") && !item.getDisplayName().contains("Mold"))
entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.smelter.alreadyhasingot", te.metal.getDisplayName()));
@@ -84,10 +88,11 @@ public class BlockSmelter extends BlockContainer
{
dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.metal.copy());
te.hasMetal = false;
- te.melting = 0;
+ te.melting = -1;
+ world.markTileEntityForDespawn(te);
+ world.setBlockTileEntity(i, j, k, te);
}
- world.setBlockTileEntity(i, j, k, te);
- te.isDirty = true;
+ if(te != null) world.setBlockTileEntity(i, j, k, te);
}
return true;
}
@@ -106,7 +111,7 @@ public class BlockSmelter extends BlockContainer
else if (world.getBlockMetadata(i, j, k) == 3)
me = (TileEntityMolder) world.getBlockTileEntity(i - 1, j, k);
- if (me != null && !world.isRemote)
+ if (te != null && me != null && !world.isRemote)
{
if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) && me != null && me.hasMold && !me.hasMoltenMetal && !me.hasJewelBase)
{
@@ -116,7 +121,8 @@ public class BlockSmelter extends BlockContainer
te.moltenMetal = new ItemStack(0, 0, 0);
te.hasMoltenMetal = false;
me.isDirty = true;
- te.isDirty = true;
+ world.markTileEntityForDespawn(te);
+ world.setBlockTileEntity(i, j, k, te);
}
else if (te.hasMetal && te.melting > 0)
player.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.smelter.metalismelting", te.metal.getDisplayName()) + " (" + ((ConfigHandler.ingotMeltingTime - te.melting)*100/ConfigHandler.ingotMeltingTime) + "%)");
@@ -130,7 +136,6 @@ public class BlockSmelter extends BlockContainer
player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.smelter.modlerhasitem"));
else
player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.smelter.empty"));
- te.isDirty = true;
}
}