summaryrefslogtreecommitdiff
path: root/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-04-15 22:41:43 +0300
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-04-15 22:41:43 +0300
commit4b8b13b34d7a8fd0ee7c7b13f11be9c2bf3b5d18 (patch)
treeb49bc483d576ec3abeb2e18523e4511ecce353d3 /eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity
parent86398ed60db321f86e8d98f191107fdac2c93760 (diff)
More 1.7 stuff
Diffstat (limited to 'eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity')
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java27
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java17
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java16
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java19
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java22
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java21
6 files changed, 114 insertions, 8 deletions
diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
index 3fbac17..62ef646 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
@@ -9,6 +9,9 @@ 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;
@@ -57,7 +60,7 @@ public class TileEntityAltar extends TileEntity
if(isDirty)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = true;
+ isDirty = false;
}
if(hasObject && playerName != "")
{
@@ -87,8 +90,8 @@ public class TileEntityAltar extends TileEntity
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).equals(Blocks.farmland)) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
- if(!worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k).equals(Blocks.farmland)) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k), 5);
+ 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);
}
}
@@ -116,12 +119,26 @@ public class TileEntityAltar extends TileEntity
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).equals(Blocks.farmland)) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
- if(!worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k).equals(Blocks.farmland)) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k), 5);
+ 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/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
index 28f4daa..186f78a 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
@@ -1,6 +1,9 @@
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;
@@ -54,4 +57,18 @@ public class TileEntityBlockShadow extends TileEntity
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/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
index 6c0effc..35def5c 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
@@ -3,7 +3,9 @@ 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
@@ -89,4 +91,18 @@ public class TileEntityDisplayer extends TileEntity
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/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
index 5a883d6..13b689d 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
@@ -4,6 +4,9 @@ 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;
@@ -86,7 +89,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
super.updateEntity();
if(isDirty){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = true;
+ isDirty = false;
}
if(angle<360F)angle+=3F;
else angle=0F;
@@ -121,4 +124,18 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
}
}
}
+
+ 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/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
index e37c2e4..e985f6f 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
@@ -3,6 +3,9 @@ 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;
@@ -71,8 +74,9 @@ public class TileEntityMolder extends TileEntity
{
super.updateEntity();
if(isDirty){
+ this.markDirty();
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = true;
+ isDirty = false;
}
if (moltenMetal.getItem() != Item.getItemById(0))
{
@@ -99,7 +103,23 @@ public class TileEntityMolder extends TileEntity
this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
this.hasJewelBase = true;
cooling = -1;
+ this.isDirty = true;
+ this.markDirty();
}
}
}
+
+ 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/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
index 9d71ced..53a9f82 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
@@ -5,6 +5,9 @@ import java.util.Random;
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
@@ -59,7 +62,7 @@ public class TileEntitySmelter extends TileEntity
Random rand = new Random();
if(isDirty){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = true;
+ isDirty = false;
}
if (p > 0)
--p;
@@ -100,7 +103,23 @@ public class TileEntitySmelter extends TileEntity
this.metal = new ItemStack(Item.getItemById(0), 0, 0);
this.hasMoltenMetal = true;
melting = -1;
+ this.isDirty = true;
+ this.markDirty();
}
}
}
+
+ 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);
+ }
}