Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void readFromNBT(NBTTagCompound compound) {
- super.readFromNBT(compound);
- isFormed = compound.getBoolean("isFormed");
- checkBefore = compound.getBoolean("checkBefore");
- if (isFormed) {
- byte size = compound.getByte("Size");
- components.clear();
- for (int i = 0; i < size; i++) {
- int[] arr = compound.getIntArray("component" + i);
- TileEntityMachineBase te = (TileEntityMachineBase) worldObj.getTileEntity(arr[0], yCoord, arr[1]);
- components.add(te);
- }
- }
- }
- @Override
- public Packet getDescriptionPacket() {
- NBTTagCompound tagCompound = new NBTTagCompound();
- writeToNBT(tagCompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tagCompound);
- }
- @Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
- NBTTagCompound tag = pkt.func_148857_g();
- readFromNBT(tag);
- }
- @Override
- public void writeToNBT(NBTTagCompound compound) {
- super.writeToNBT(compound);
- compound.setBoolean("isFormed", isFormed);
- compound.setBoolean("checkBefore", checkBefore);
- if (isFormed()) {
- compound.setByte("Size", (byte) components.size());
- for (int i = 0; i < components.size(); i++) {
- TileEntityMachineBase te = components.get(i);
- System.out.println("Saving te #" + i);
- compound.setIntArray("component" + i, new int[]{te.xCoord, te.zCoord});
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement