Skip to content

Commit

Permalink
Fix incorrect positions in multiblock logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Nov 15, 2015
1 parent 9323d89 commit 392ea28
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameData;

Expand Down Expand Up @@ -110,7 +111,7 @@ public void notifyMasterOfChange()
{
if (this.hasValidMaster())
{
IMasterLogic logic = (IMasterLogic) this.worldObj.getTileEntity(this.pos);
IMasterLogic logic = (IMasterLogic) this.worldObj.getTileEntity(this.master);
logic.notifyChange(this, this.pos);
}
}
Expand All @@ -124,7 +125,7 @@ public void readCustomNBT(NBTTagCompound tags)
int yCenter = tags.getInteger("yCenter");
int zCenter = tags.getInteger("zCenter");
this.master = new BlockPos(xCenter, yCenter, zCenter);
this.masterBlock = GameData.getBlockRegistry().getObject(tags.getString("MasterBlockName"));
this.masterBlock = GameData.getBlockRegistry().getObject(new ResourceLocation(tags.getString("MasterBlockName")));
this.state = Block.getStateById(tags.getInteger("masterState"));
}
}
Expand All @@ -137,7 +138,7 @@ public void writeCustomNBT(NBTTagCompound tags)
tags.setInteger("xCenter", this.master.getX());
tags.setInteger("yCenter", this.master.getY());
tags.setInteger("zCenter", this.master.getZ());
tags.setString("MasterBlockName", (String) GameData.getBlockRegistry().getNameForObject(this.masterBlock));
tags.setString("MasterBlockName", GameData.getBlockRegistry().getNameForObject(this.masterBlock).toString());
tags.setInteger("masterState", Block.getStateId(this.state));
}
}
Expand Down

0 comments on commit 392ea28

Please sign in to comment.