Java Code Examples for net.minecraft.world.World.setTileEntity()

The following are Jave code examples for showing how to use setTileEntity() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Technical   File: Grinder.java   Source Code and License 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.GrinderActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.GrinderIdle);

	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   Source Code and License 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: BetterBeginningsReborn   File: BlockObsidianKiln.java   Source Code and License 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 4
Project: Technical   File: RepairingForgeMedium.java   Source Code and License 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.RepairingForgeMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.RepairingForgeMediumIdle);

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

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 5
Project: DecompiledMinecraft   File: BlockFurnace.java   Source Code and License 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 6
Project: CustomWorldGen   File: BlockFurnace.java   Source Code and License 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 7
Project: Technical   File: CentrifugeMedium.java   Source Code and License 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.CentrifugeMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.CentrifugeMediumIdle);

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

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 8
Project: Technical   File: ElectricFurnaceBasic.java   Source Code and License 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.ElectricFurnaceBasicActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectricFurnaceBasicIdle);

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

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 9
Project: BetterBeginningsReborn   File: BlockEnderSmelter.java   Source Code and License 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.enderSmelterLit.getDefaultState()
                .withProperty(FACING, state.getValue(FACING)), 3);
    }
    else
    {
        world.setBlockState(pos, RegisterBlocks.enderSmelter.getDefaultState()
                .withProperty(FACING, state.getValue(FACING)), 3);
    }

    if (tileEntity != null)
    {
        tileEntity.validate();
        world.setTileEntity(pos, tileEntity);
    }
}
 
Example 10
Project: Technical   File: ElectricFurnaceMedium.java   Source Code and License 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.ElectricFurnaceMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectricFurnaceMediumIdle);

	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: ElectrolyserMedium.java   Source Code and License 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.ElectrolyserMediumActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectrolyserMediumIdle);

	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: Pump.java   Source Code and License 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.PumpActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.PumpIdle);

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

	if (tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 13
Project: Technical   File: BlastFurnaceAdvanced.java   Source Code and License 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 14
Project: Technical   File: Electrolyser.java   Source Code and License 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.ElectrolyserActive);
	else
		world.setBlock(x, y, z, TechnicalBlock.ElectrolyserIdle);

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

	if(tileEntity != null) {
		tileEntity.validate();
		world.setTileEntity(x, y, z, tileEntity);
	}
}
 
Example 15
Project: Technical   File: Washer.java   Source Code and License 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 16
Project: Mods   File: BlockAmmoFurnace.java   Source Code and License 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);
	}
}
 
Example 17
Project: CustomWorldGen   File: BlockRedstoneComparator.java   Source Code and License Vote up 4 votes
/**
 * Called after the block is set in the Chunk data, but before the Tile Entity is set
 */
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    super.onBlockAdded(worldIn, pos, state);
    worldIn.setTileEntity(pos, this.createNewTileEntity(worldIn, 0));
}
 
Example 18
Project: Backmemed   File: BlockPistonBase.java   Source Code and License Vote up 4 votes
private boolean doMove(World worldIn, BlockPos pos, EnumFacing direction, boolean extending)
{
    if (!extending)
    {
        worldIn.setBlockToAir(pos.offset(direction));
    }

    BlockPistonStructureHelper blockpistonstructurehelper = new BlockPistonStructureHelper(worldIn, pos, direction, extending);

    if (!blockpistonstructurehelper.canMove())
    {
        return false;
    }
    else
    {
        List<BlockPos> list = blockpistonstructurehelper.getBlocksToMove();
        List<IBlockState> list1 = Lists.<IBlockState>newArrayList();

        for (int i = 0; i < list.size(); ++i)
        {
            BlockPos blockpos = (BlockPos)list.get(i);
            list1.add(worldIn.getBlockState(blockpos).getActualState(worldIn, blockpos));
        }

        List<BlockPos> list2 = blockpistonstructurehelper.getBlocksToDestroy();
        int k = list.size() + list2.size();
        IBlockState[] aiblockstate = new IBlockState[k];
        EnumFacing enumfacing = extending ? direction : direction.getOpposite();

        for (int j = list2.size() - 1; j >= 0; --j)
        {
            BlockPos blockpos1 = (BlockPos)list2.get(j);
            IBlockState iblockstate = worldIn.getBlockState(blockpos1);
            iblockstate.getBlock().dropBlockAsItem(worldIn, blockpos1, iblockstate, 0);
            worldIn.setBlockState(blockpos1, Blocks.AIR.getDefaultState(), 4);
            --k;
            aiblockstate[k] = iblockstate;
        }

        for (int l = list.size() - 1; l >= 0; --l)
        {
            BlockPos blockpos3 = (BlockPos)list.get(l);
            IBlockState iblockstate2 = worldIn.getBlockState(blockpos3);
            worldIn.setBlockState(blockpos3, Blocks.AIR.getDefaultState(), 2);
            blockpos3 = blockpos3.offset(enumfacing);
            worldIn.setBlockState(blockpos3, Blocks.PISTON_EXTENSION.getDefaultState().withProperty(FACING, direction), 4);
            worldIn.setTileEntity(blockpos3, BlockPistonMoving.createTilePiston((IBlockState)list1.get(l), direction, extending, false));
            --k;
            aiblockstate[k] = iblockstate2;
        }

        BlockPos blockpos2 = pos.offset(direction);

        if (extending)
        {
            BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = this.isSticky ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT;
            IBlockState iblockstate3 = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.FACING, direction).withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype);
            IBlockState iblockstate1 = Blocks.PISTON_EXTENSION.getDefaultState().withProperty(BlockPistonMoving.FACING, direction).withProperty(BlockPistonMoving.TYPE, this.isSticky ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT);
            worldIn.setBlockState(blockpos2, iblockstate1, 4);
            worldIn.setTileEntity(blockpos2, BlockPistonMoving.createTilePiston(iblockstate3, direction, true, true));
        }

        for (int i1 = list2.size() - 1; i1 >= 0; --i1)
        {
            worldIn.notifyNeighborsOfStateChange((BlockPos)list2.get(i1), aiblockstate[k++].getBlock(), false);
        }

        for (int j1 = list.size() - 1; j1 >= 0; --j1)
        {
            worldIn.notifyNeighborsOfStateChange((BlockPos)list.get(j1), aiblockstate[k++].getBlock(), false);
        }

        if (extending)
        {
            worldIn.notifyNeighborsOfStateChange(blockpos2, Blocks.PISTON_HEAD, false);
        }

        return true;
    }
}
 
Example 19
Project: BaseClient   File: BlockRedstoneComparator.java   Source Code and License Vote up 4 votes
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    super.onBlockAdded(worldIn, pos, state);
    worldIn.setTileEntity(pos, this.createNewTileEntity(worldIn, 0));
}
 
Example 20
Project: StructureUtils   File: StructureTransformer.java   Source Code and License Vote up 3 votes
public void test() {

		Template.BlockInfo template$blockinfo1 = null;
		BlockPos blockpos = null;
		World world = null;

		TileEntity tileEntity2 = TileEntity.create(world, template$blockinfo1.tileentityData);

		world.setTileEntity(blockpos, tileEntity2);
	}