Fix #1281 Crash when trying to place Forestry tiles above Y=255

This commit is contained in:
mezz committed 2016-06-03 16:35:06 -07:00
1 parent cde076e702
commit 42425e3500
2 files changed
+21 -17

No files matched your search

@@ -73,14 +73,16 @@ public class ItemBlockPile<B extends Block> extends ItemBlockForestry<Block> {
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
boolean placed = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState);
if(block == PluginArboriculture.blocks.piles.get(EnumPileType.WOOD)){
if (block.hasTileEntity(newState)) {
if (stack.hasTagCompound()) {
TilePile tile = TileUtil.getTile(world, pos, TilePile.class);
if (tile != null) {
tile.readFromNBT(stack.getTagCompound());
tile.setPos(pos);
tile.markDirty();
if (placed) {
if (block == PluginArboriculture.blocks.piles.get(EnumPileType.WOOD)) {
if (block.hasTileEntity(newState)) {
if (stack.hasTagCompound()) {
TilePile tile = TileUtil.getTile(world, pos, TilePile.class);
if (tile != null) {
tile.readFromNBT(stack.getTagCompound());
tile.setPos(pos);
tile.markDirty();
}
}
}
}
@@ -58,18 +58,20 @@ public class ItemBlockForestry<B extends Block> extends ItemBlock {
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
boolean placed = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState);
if (block.hasTileEntity(newState)) {
if (stack.getItem() instanceof ItemBlockNBT && stack.hasTagCompound()) {
TileForestry tile = TileUtil.getTile(world, pos, TileForestry.class);
if (tile != null) {
tile.readFromNBT(stack.getTagCompound());
tile.setPos(pos);
if (placed) {
if (block.hasTileEntity(newState)) {
if (stack.getItem() instanceof ItemBlockNBT && stack.hasTagCompound()) {
TileForestry tile = TileUtil.getTile(world, pos, TileForestry.class);
if (tile != null) {
tile.readFromNBT(stack.getTagCompound());
tile.setPos(pos);
}
}
}
}
if (block instanceof BlockBase) {
((BlockBase) block).rotateAfterPlacement(player, world, pos, side);
if (block instanceof BlockBase) {
((BlockBase) block).rotateAfterPlacement(player, world, pos, side);
}
}
return placed;