@Override public void onBlockPlacedBy( World world, int x0, int y0, int z0, EntityLivingBase entityLiving, ItemStack itemStack) { super.onBlockPlacedBy(world, x0, y0, z0, entityLiving, itemStack); TileEntity tile = world.getTileEntity(x0, y0, z0); boolean validSpot = true; for (int x = -1; x <= 1; x++) { for (int y = 0; y < 3; y += 2) { for (int z = -1; z <= 1; z++) { if (!(x == 0 && y == 0 && z == 0)) { Block blockAt = world.getBlock(x0 + x, y0 + y, z0 + z); if (!blockAt.getMaterial().isReplaceable()) { validSpot = false; } } } } } if (!validSpot) { world.setBlockToAir(x0, y0, z0); if (entityLiving instanceof EntityPlayer) { if (!world.isRemote) { ((EntityPlayer) entityLiving) .addChatMessage( new ChatComponentText( EnumColor.RED + GCCoreUtil.translate("gui.warning.noroom"))); } ((EntityPlayer) entityLiving) .inventory.addItemStackToInventory(new ItemStack(Item.getItemFromBlock(this), 1, 0)); } return; } if (tile instanceof TileEntityShortRangeTelepad) { ((TileEntityShortRangeTelepad) tile).onCreate(new BlockVec3(x0, y0, z0)); ((TileEntityShortRangeTelepad) tile) .setOwner(((EntityPlayer) entityLiving).getGameProfile().getName()); } }