Java Code Examples for net.minecraft.tileentity.TileEntity#validate()
The following examples show how to use
net.minecraft.tileentity.TileEntity#validate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockAggregator.java From TofuCraftReload with MIT License | 7 votes |
public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, BlockLoader.TFAGGREGATOR_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFAGGREGATOR_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } else { worldIn.setBlockState(pos, BlockLoader.TFAGGREGATOR.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFAGGREGATOR.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } }
Example 2
Source File: BlockSaltFurnace.java From TofuCraftReload with MIT License | 6 votes |
public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, BlockLoader.SALTFURNACE_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.SALTFURNACE_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } else { worldIn.setBlockState(pos, BlockLoader.SALTFURNACE.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.SALTFURNACE.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } }
Example 3
Source File: BlockTFOven.java From TofuCraftReload with MIT License | 6 votes |
public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, BlockLoader.TFOVEN_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFOVEN_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } else { worldIn.setBlockState(pos, BlockLoader.TFOVEN.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFOVEN.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } }
Example 4
Source File: BlockAdvancedAggregator.java From TofuCraftReload with MIT License | 6 votes |
public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, BlockLoader.TFAdvancedAGGREGATOR_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFAdvancedAGGREGATOR_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } else { worldIn.setBlockState(pos, BlockLoader.TFAdvancedAGGREGATOR.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFAdvancedAGGREGATOR.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } }
Example 5
Source File: BlockTFCrasher.java From TofuCraftReload with MIT License | 6 votes |
public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, BlockLoader.TFCRASHER_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFCRASHER_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } else { worldIn.setBlockState(pos, BlockLoader.TFCRASHER.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFCRASHER.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } }
Example 6
Source File: BlockTFCompressor.java From TofuCraftReload with MIT License | 6 votes |
public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, BlockLoader.TFCOMPRESSOR_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFCOMPRESSOR_LIT.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } else { worldIn.setBlockState(pos, BlockLoader.TFCOMPRESSOR.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, BlockLoader.TFCOMPRESSOR.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } }
Example 7
Source File: BlockCampfirePot.java From Sakura_mod with MIT License | 6 votes |
public static void setState(boolean active, World worldIn, BlockPos pos) { TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, BlockLoader.CAMPFIRE_POT_LIT.getDefaultState()); worldIn.setBlockState(pos, BlockLoader.CAMPFIRE_POT_LIT.getDefaultState()); } else { worldIn.setBlockState(pos, BlockLoader.CAMPFIRE_POT_IDLE.getDefaultState()); worldIn.setBlockState(pos, BlockLoader.CAMPFIRE_POT_IDLE.getDefaultState()); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } }
Example 8
Source File: BlockCampfire.java From Sakura_mod with MIT License | 6 votes |
public static void setState(boolean active, World worldIn, BlockPos pos) { TileEntity tileentity = worldIn.getTileEntity(pos); keepInventory = true; if (active) { worldIn.setBlockState(pos, BlockLoader.CAMPFIRE_LIT.getDefaultState()); } else { worldIn.setBlockState(pos, BlockLoader.CAMPFIRE_IDLE.getDefaultState()); } keepInventory = false; if (tileentity != null) { tileentity.validate(); worldIn.setTileEntity(pos, tileentity); } }
Example 9
Source File: Harvester.java From EmergingTechnology with MIT License | 6 votes |
public static void rotateFacing(EnumFacing facing, World worldIn, BlockPos pos) { if (!worldIn.isBlockLoaded(pos)) { return; } IBlockState state = worldIn.getBlockState(pos); TileEntity tileEntity = worldIn.getTileEntity(pos); worldIn.setBlockState(pos, state.withProperty(FACING, facing), 3); if (tileEntity != null) { tileEntity.validate(); worldIn.setTileEntity(pos, tileEntity); } }
Example 10
Source File: MovingBlock.java From Framez with GNU General Public License v3.0 | 6 votes |
@Override public void startMoving(boolean invalidate, boolean validate) { TileEntity te = getTileEntity(); if (te != null) { if (invalidate) te.invalidate(); } if (!getWorld().isRemote) { BlockUtils.setBlockSneaky(getWorld(), getX(), getY(), getZ(), Blocks.air); getWorld().setBlockMetadataWithNotify(getX(), getY(), getZ(), 0, 2); } if (te != null) BlockUtils.removeTileEntity(getWorld(), getX(), getY(), getZ()); if (te != null && validate) { te.setWorldObj(FakeWorld.getFakeWorld(this)); te.validate(); } }
Example 11
Source File: Light.java From EmergingTechnology with MIT License | 5 votes |
public static void setState(boolean hasPower, int bulbType, World worldIn, BlockPos pos) { IBlockState state = worldIn.getBlockState(pos); TileEntity tileEntity = worldIn.getTileEntity(pos); worldIn.setBlockState(pos, ModBlocks.light.getDefaultState().withProperty(FACING, state.getValue(FACING)) .withProperty(POWERED, hasPower).withProperty(BULBTYPE, bulbType), 3); if (tileEntity != null) { tileEntity.validate(); worldIn.setTileEntity(pos, tileEntity); } }
Example 12
Source File: MovingBlock.java From Framez with GNU General Public License v3.0 | 5 votes |
@Override public void finishMoving(boolean invalidate, boolean validate) { Vec3i newLocation = getStructure().getMovement().transform(new Vec3i(this)); TileEntity te = getTileEntity(); if (te != null && invalidate) te.invalidate(); // if (!newLocation.getWorld().isRemote) { if (getWorld().isRemote) { newLocation.getWorld().setBlock(newLocation.getX(), newLocation.getY(), newLocation.getZ(), getBlock(), 0, 0); } else { BlockUtils.setBlockSneaky(newLocation.getWorld(), newLocation.getX(), newLocation.getY(), newLocation.getZ(), getBlock()); } newLocation.getWorld().setBlockMetadataWithNotify(newLocation.getX(), newLocation.getY(), newLocation.getZ(), getMetadata(), 2); // } if (te != null) { te.setWorldObj(newLocation.getWorld()); te.xCoord = newLocation.getX(); te.yCoord = newLocation.getY(); te.zCoord = newLocation.getZ(); if (validate) te.validate(); BlockUtils.setTileEntity(newLocation.getWorld(), newLocation.getX(), newLocation.getY(), newLocation.getZ(), te); } }