diff options
| author | Lance5057 <Lance5057@gmail.com> | 2015-02-23 09:48:07 -0600 |
|---|---|---|
| committer | Lance5057 <Lance5057@gmail.com> | 2015-02-23 09:48:07 -0600 |
| commit | 2f1397cf799804571c1c267f37e9bd89c98ca244 (patch) | |
| tree | 3f7246e265fd3f478036a4fb4fa212498fbd7b5a /src/main/java/gmail/Lance5057/network | |
| parent | da8aa0a9994d1bf635c4ec8b1e98fce46c5ec09d (diff) | |
Revert "Revert "Crest Mount Attempt 3 Part 2""
This reverts commit da8aa0a9994d1bf635c4ec8b1e98fce46c5ec09d.
Diffstat (limited to 'src/main/java/gmail/Lance5057/network')
| -rw-r--r-- | src/main/java/gmail/Lance5057/network/Message_CrestMount.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/main/java/gmail/Lance5057/network/Message_CrestMount.java b/src/main/java/gmail/Lance5057/network/Message_CrestMount.java new file mode 100644 index 0000000..f556a31 --- /dev/null +++ b/src/main/java/gmail/Lance5057/network/Message_CrestMount.java @@ -0,0 +1,57 @@ +package gmail.Lance5057.network; + +import net.minecraft.item.Item; +import gmail.Lance5057.tileentities.TileEntity_CrestMount; +import io.netty.buffer.ByteBuf; +import cpw.mods.fml.common.network.simpleimpl.IMessage; + +public class Message_CrestMount implements IMessage +{ + public int x,y,z; + public int[] inv; + + Message_CrestMount() {} + + Message_CrestMount(TileEntity_CrestMount te) + { + this.x = te.xCoord; + this.y = te.yCoord; + this.z = te.zCoord; + + inv = new int[te.invSize*3]; + for(int i = 0; i<te.invSize; i+=3) + { + if(te.inventory[i]!=null) + { + inv[i] = Item.getIdFromItem(te.inventory[i].getItem()); + inv[i+1] = te.inventory[i].getItemDamage(); + inv[i+2] = te.inventory[i].stackSize; + } + } + } + + @Override + public void fromBytes(ByteBuf buf) { + x = buf.readInt(); + y = buf.readInt(); + z = buf.readInt(); + + for(int i = 0; i<inv.length; i++) + { + inv[i] = buf.readInt(); + } + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(x); + buf.writeInt(y); + buf.writeInt(z); + + for(int i = 0; i<inv.length; i++) + { + buf.writeInt(inv[i]); + } + } + +} |
