public void build() { if (!sentBuildCommands) { int widthOfHome = HomeManager.getHomeSize(1); sentBuildCommands = true; for (int x = this.xCoord - widthOfHome; x <= xCoord + widthOfHome; x++) { for (int z = zCoord - widthOfHome; z <= zCoord + widthOfHome; z++) { addBuildingTask(new BuildingTask(x, yCoord - 2, z, Block.bedrock.blockID)); if (x == xCoord - widthOfHome) addBuildingTask(new BuildingTask(x, yCoord - 1, z, Block.stone.blockID)); if (x == xCoord + widthOfHome) addBuildingTask(new BuildingTask(x, yCoord - 1, z, Block.stone.blockID)); } addBuildingTask(new BuildingTask(x, yCoord - 1, zCoord + widthOfHome, Block.stone.blockID)); addBuildingTask(new BuildingTask(x, yCoord - 1, zCoord - widthOfHome, Block.stone.blockID)); } super .build(); // Always call Super.Build at end This way if its alrdy completed, we clear the // list. Avoiding server load. } }
public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); if (!homeName.isEmpty()) nbt.setString(HOME_NAME, homeName); }
public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); if (nbt.hasKey(HOME_NAME)) homeName = nbt.getString(HOME_NAME); }