Java Code Examples for net.minecraft.tileentity.TileEntity.validate()

The following are Jave code examples for showing how to use validate() of the net.minecraft.tileentity.TileEntity class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Technical   File: Washer.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if(active)
		world.setBlock(x, y, z, TechnicalBlock.WasherActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.WasherIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 2
Project: Randores2   File: CraftiniumForge.java   View Source Code Vote up 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, CraftingBlocks.craftiniumForgeLit.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        worldIn.setBlockState(pos, CraftingBlocks.craftiniumForgeLit.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
    } else {
        worldIn.setBlockState(pos, CraftingBlocks.craftiniumForge.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        worldIn.setBlockState(pos, CraftingBlocks.craftiniumForge.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
    }

    keepInventory = false;

    if (tileentity != null) {
        tileentity.validate();
        worldIn.setTileEntity(pos, tileentity);
    }
}
 
Example 3
Project: Technical   File: CentrifugeAdvanced.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if(active)
		world.setBlock(x, y, z, TechnicalBlock.CentrifugeAdvancedActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.CentrifugeAdvancedIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 4
Project: DecompiledMinecraft   File: BlockFurnace.java   View Source Code Vote up 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, Blocks.lit_furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        worldIn.setBlockState(pos, Blocks.lit_furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
    }
    else
    {
        worldIn.setBlockState(pos, Blocks.furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        worldIn.setBlockState(pos, Blocks.furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
    }

    keepInventory = false;

    if (tileentity != null)
    {
        tileentity.validate();
        worldIn.setTileEntity(pos, tileentity);
    }
}
 
Example 5
Project: DecompiledMinecraft   File: Chunk.java   View Source Code Vote up 6 votes
public void addTileEntity(BlockPos pos, TileEntity tileEntityIn)
{
    tileEntityIn.setWorldObj(this.worldObj);
    tileEntityIn.setPos(pos);

    if (this.getBlock(pos) instanceof ITileEntityProvider)
    {
        if (this.chunkTileEntityMap.containsKey(pos))
        {
            ((TileEntity)this.chunkTileEntityMap.get(pos)).invalidate();
        }

        tileEntityIn.validate();
        this.chunkTileEntityMap.put(pos, tileEntityIn);
    }
}
 
Example 6
Project: BetterBeginningsReborn   File: BlockCampfire.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean lit, World world, BlockPos pos)
{
    TileEntity tileEntity = world.getTileEntity(pos);
    isAlteringLit = true;

    if (lit)
    {
        world.setBlockState(pos, RegisterBlocks.campfireLit.getDefaultState(), 3);
    }
    else
    {
        world.setBlockState(pos, RegisterBlocks.campfire.getDefaultState(), 3);
    }

    isAlteringLit = false;

    if (tileEntity != null)
    {
        tileEntity.validate();
        world.setTileEntity(pos, tileEntity);
    }
}
 
Example 7
Project: BaseClient   File: Chunk.java   View Source Code Vote up 6 votes
public void addTileEntity(BlockPos pos, TileEntity tileEntityIn)
{
    tileEntityIn.setWorldObj(this.worldObj);
    tileEntityIn.setPos(pos);

    if (this.getBlock(pos) instanceof ITileEntityProvider)
    {
        if (this.chunkTileEntityMap.containsKey(pos))
        {
            ((TileEntity)this.chunkTileEntityMap.get(pos)).invalidate();
        }

        tileEntityIn.validate();
        this.chunkTileEntityMap.put(pos, tileEntityIn);
    }
}
 
Example 8
Project: Technical   File: BlastFurnaceBasic.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if (active)
		world.setBlock(x, y, z, TechnicalBlock.BlastFurnaceBasicActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.BlastFurnaceBasicIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 9
Project: BaseClient   File: Chunk.java   View Source Code Vote up 6 votes
public void addTileEntity(BlockPos pos, TileEntity tileEntityIn)
{
    tileEntityIn.setWorldObj(this.worldObj);
    tileEntityIn.setPos(pos);

    if (this.getBlock(pos) instanceof ITileEntityProvider)
    {
        if (this.chunkTileEntityMap.containsKey(pos))
        {
            ((TileEntity)this.chunkTileEntityMap.get(pos)).invalidate();
        }

        tileEntityIn.validate();
        this.chunkTileEntityMap.put(pos, tileEntityIn);
    }
}
 
Example 10
Project: Technical   File: GrinderMedium.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if(active)
		world.setBlock(x, y, z, TechnicalBlock.GrinderMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.GrinderMediumIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 11
Project: Technical   File: Centrifuge.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if(active)
		world.setBlock(x, y, z, TechnicalBlock.CentrifugeActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.CentrifugeIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 12
Project: Technical   File: BlastFurnaceAdvanced.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if (active)
		world.setBlock(x, y, z, TechnicalBlock.BlastFurnaceAdvancedActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.BlastFurnaceAdvancedIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 13
Project: Backmemed   File: BlockFurnace.java   View Source Code Vote up 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, Blocks.LIT_FURNACE.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        worldIn.setBlockState(pos, Blocks.LIT_FURNACE.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
    }
    else
    {
        worldIn.setBlockState(pos, Blocks.FURNACE.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        worldIn.setBlockState(pos, Blocks.FURNACE.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
    }

    keepInventory = false;

    if (tileentity != null)
    {
        tileentity.validate();
        worldIn.setTileEntity(pos, tileentity);
    }
}
 
Example 14
Project: BetterBeginningsReborn   File: BlockObsidianKiln.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean lit, World world, BlockPos pos)
{
    IBlockState state = world.getBlockState(pos);
    TileEntity tileEntity = world.getTileEntity(pos);

    if (lit)
    {
        world.setBlockState(pos, RegisterBlocks.obsidianKilnLit.getDefaultState()
                .withProperty(FACING, state.getValue(FACING)), 3);
    }
    else
    {
        world.setBlockState(pos, RegisterBlocks.obsidianKiln.getDefaultState()
                .withProperty(FACING, state.getValue(FACING)), 3);
    }

    if (tileEntity != null)
    {
        tileEntity.validate();
        world.setTileEntity(pos, tileEntity);
    }
}
 
Example 15
Project: Technical   File: ElectricFurnaceAdvanced.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if (active)
		world.setBlock(x, y, z, TechnicalBlock.ElectricFurnaceAdvancedActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectricFurnaceAdvancedIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 16
Project: BetterBeginningsReborn   File: BlockNetherBrickOven.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean lit, World world, BlockPos pos)
{
    IBlockState state = world.getBlockState(pos);
    TileEntity tileEntity = world.getTileEntity(pos);

    if (lit)
    {
        world.setBlockState(pos, RegisterBlocks.netherBrickOvenLit.getDefaultState()
                .withProperty(FACING, state.getValue(FACING)), 3);
    }
    else
    {
        world.setBlockState(pos, RegisterBlocks.netherBrickOven.getDefaultState()
                .withProperty(FACING, state.getValue(FACING)), 3);
    }

    if (tileEntity != null)
    {
        tileEntity.validate();
        world.setTileEntity(pos, tileEntity);
    }
}
 
Example 17
Project: BetterBeginningsReborn   File: BlockKiln.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean flag, World world, BlockPos pos)
{
    IBlockState iblockstate = world.getBlockState(pos);
    TileEntity tileentity = world.getTileEntity(pos);

    if (flag)
    {
        world.setBlockState(pos, RegisterBlocks.kilnLit.getDefaultState()
                .withProperty(FACING, iblockstate.getValue(FACING)), 3);
    }
    else
    {
        world.setBlockState(pos, RegisterBlocks.kiln.getDefaultState()
                .withProperty(FACING, iblockstate.getValue(FACING)), 3);
    }

    if (tileentity != null)
    {
        tileentity.validate();
        world.setTileEntity(pos, tileentity);
    }
}
 
Example 18
Project: Technical   File: MinerMedium.java   View Source Code Vote up 6 votes
public static void updateBlockState(boolean active, World world, int x, int y, int z) {
	int direction = world.getBlockMetadata(x, y, z);
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	isBurning = true;

	if (active)
		world.setBlock(x, y, z, TechnicalBlock.MinerMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.MinerMediumIdle);

	isBurning = false;
	world.setBlockMetadataWithNotify(x, y, z, direction, 2);

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 19
Project: Machines-and-Stuff   File: BlockBaseGenerator.java   View Source Code Vote up 5 votes
public static void setState(boolean active, World worldIn, BlockPos pos) {
    IBlockState iblockstate = worldIn.getBlockState(pos);
    TileEntity tileentity = worldIn.getTileEntity(pos);
    worldIn.setBlockState(pos, iblockstate.getBlock().getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)).withProperty(isActive, active), 3);
    
    if(tileentity != null) {
        tileentity.validate();
        worldIn.setTileEntity(pos, tileentity);
        PacketHandler.INSTANCE.sendToAllAround(new MessageGenerator(tileentity), new NetworkRegistry.TargetPoint(worldIn.provider.getDimension(), tileentity.getPos().getX(), tileentity.getPos().getY(), tileentity.getPos().getZ(), 128d));
    }
}
 
Example 20
Project: Mods   File: BlockAmmoFurnace.java   View Source Code Vote up 5 votes
public static void setState(boolean active, World worldIn, BlockPos pos) {
	IBlockState iblockstate = worldIn.getBlockState(pos);
	TileEntity tileentity = worldIn.getTileEntity(pos);

	worldIn.setBlockState(pos, iblockstate.withProperty(BURNING, active));

	if (tileentity != null) {
		tileentity.validate();
		worldIn.setTileEntity(pos, tileentity);
	}
}