Java Code Examples for net.minecraft.world.World#updateComparatorOutputLevel()

The following examples show how to use net.minecraft.world.World#updateComparatorOutputLevel() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: TofuCraftReload   File: BlockSaltFurnace.java    License: MIT License 6 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (!keepInventory)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntitySaltFurnace)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntitySaltFurnace)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }

    super.breakBlock(worldIn, pos, state);
}
 
Example 2
Source Project: TofuCraftReload   File: BlockTFOven.java    License: MIT License 6 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (!keepInventory)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityTFOven)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityTFOven)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }

    super.breakBlock(worldIn, pos, state);
}
 
Example 3
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (!keepInventory)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntitySoymilkAdvancedAggregator)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntitySoymilkAdvancedAggregator)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }

    super.breakBlock(worldIn, pos, state);
}
 
Example 4
Source Project: TofuCraftReload   File: BlockAggregator.java    License: MIT License 6 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (!keepInventory)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntitySoymilkAggregator)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntitySoymilkAggregator)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }

    super.breakBlock(worldIn, pos, state);
}
 
Example 5
Source Project: TofuCraftReload   File: BlockTFCrasher.java    License: MIT License 6 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (!keepInventory)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityTFCrasher)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityTFCrasher)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }

    super.breakBlock(worldIn, pos, state);
}
 
Example 6
Source Project: TofuCraftReload   File: BlockTFCompressor.java    License: MIT License 6 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (!keepInventory)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityTFCompressor)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityTFCompressor)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }

    super.breakBlock(worldIn, pos, state);
}
 
Example 7
@Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
{
    if (state.getBlock() != newState.getBlock())
    {
        TileEntity te = worldIn.getTileEntity(pos);

        if (te instanceof SawmillTileEntity)
        {
            dropInventoryItems(worldIn, pos, ((SawmillTileEntity) te).getInventory());
            worldIn.updateComparatorOutputLevel(pos, this);
        }

        super.onReplaced(state, worldIn, pos, newState, isMoving);
    }
}
 
Example 8
Source Project: TofuCraftReload   File: BlockTFBattery.java    License: MIT License 5 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
    TileEntity tileentity = worldIn.getTileEntity(pos);
    if (tileentity instanceof TileEntityTofuBattery) {
        InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityTofuBattery) tileentity);
        worldIn.updateComparatorOutputLevel(pos, this);
    }
    super.breakBlock(worldIn, pos, state);
}
 
Example 9
Source Project: TofuCraftReload   File: BlockTFStorage.java    License: MIT License 5 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
    TileEntity tileentity = worldIn.getTileEntity(pos);
    if (tileentity instanceof TileEntityTFStorage) {
        InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityTFStorage) tileentity);
        worldIn.updateComparatorOutputLevel(pos, this);
    }

    super.breakBlock(worldIn, pos, state);
}
 
Example 10
Source Project: Sakura_mod   File: BlockMapleSyrupCauldron.java    License: MIT License 5 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
    if (!keepInventory) {
        TileEntity te = worldIn.getTileEntity(pos);
        if (te instanceof TileEntityMapleCauldron) {
            InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityMapleCauldron)te);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }
    super.breakBlock(worldIn, pos, state);
}
 
Example 11
Source Project: Sakura_mod   File: BlockStoneMortar.java    License: MIT License 5 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
    TileEntity tileentity = worldIn.getTileEntity(pos);
    if (tileentity instanceof TileEntityStoneMortar) {
        InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityStoneMortar) tileentity);
        worldIn.updateComparatorOutputLevel(pos, this);
    }
    super.breakBlock(worldIn, pos, state);
}
 
Example 12
Source Project: Sakura_mod   File: BlockCampfirePot.java    License: MIT License 5 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
    if (!keepInventory) {
        TileEntity te = worldIn.getTileEntity(pos);
        if (te instanceof TileEntityCampfirePot) {
            InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityCampfirePot)te);
            worldIn.updateComparatorOutputLevel(pos, this);
        }

        spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(BlockLoader.CAMPFIRE_IDLE)));
        spawnAsEntity(worldIn, pos, new ItemStack(ItemLoader.POT));
    }

    super.breakBlock(worldIn, pos, state);
}
 
Example 13
@Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
{
    if (newState.getBlock() != state.getBlock())
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof ChoppingBlockTileEntity)
        {
            dropInventoryItems(worldIn, pos, ((ChoppingBlockTileEntity) tileentity).getSlotInventory());
            worldIn.updateComparatorOutputLevel(pos, this);
        }
        super.onReplaced(state, worldIn, pos, newState, isMoving);
    }
}
 
Example 14
@Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
{
    if (newState.getBlock() != state.getBlock())
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof DryingRackTileEntity)
        {
            dropInventoryItems(worldIn, pos, ((DryingRackTileEntity) tileentity).inventory());
            worldIn.updateComparatorOutputLevel(pos, this);
        }
        super.onReplaced(state, worldIn, pos, newState, isMoving);
    }
}
 
Example 15
Source Project: TFC2   File: BlockFirepit.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
	TileEntity tileentity = worldIn.getTileEntity(pos);

	if (tileentity instanceof IInventory)
	{
		InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity);
		worldIn.updateComparatorOutputLevel(pos, this);
	}

	super.breakBlock(worldIn, pos, state);
}
 
Example 16
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
    TileEntityEnderUtilitiesInventory te = getTileEntitySafely(world, pos, TileEntityEnderUtilitiesInventory.class);

    if (te != null && te.getBaseItemHandler() != null)
    {
        InventoryUtils.dropInventoryContentsInWorld(world, pos, te.getBaseItemHandler());
        world.updateComparatorOutputLevel(pos, this);
    }

    world.removeTileEntity(pos);
}
 
Example 17
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
    if (state.getValue(TYPE).retainsContents())
    {
        world.updateComparatorOutputLevel(pos, this);
        world.removeTileEntity(pos);
    }
    else
    {
        super.breakBlock(world, pos, state);
    }
}
 
Example 18
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
    if (state.getValue(CREATIVE) || this.retainsContentsWhenBroken(world, pos, state))
    {
        world.updateComparatorOutputLevel(pos, this);
        world.removeTileEntity(pos);
    }
    else
    {
        TileEntityBarrel te = getTileEntitySafely(world, pos, TileEntityBarrel.class);

        if (te != null)
        {
            InventoryUtils.dropInventoryContentsInWorld(world, pos, te.getUpgradeInventory());

            // Fail-safe for not spawning hundreds of thousands of items in the world,
            // if there is no structure upgrade installed and a barrel is forcibly broken (in Creative mode for example).
            ItemStack stack = te.getBaseItemHandler().getStackInSlot(0);

            if (stack.isEmpty() == false)
            {
                EntityUtils.dropItemStacksInWorld(world, pos, stack, Math.min(stack.getCount(), 4096), true);
            }

            world.updateComparatorOutputLevel(pos, this);
            world.removeTileEntity(pos);
        }
    }
}
 
Example 19
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    worldIn.updateComparatorOutputLevel(pos, this);
    worldIn.removeTileEntity(pos);
}
 
Example 20
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    worldIn.updateComparatorOutputLevel(pos, this);
    worldIn.removeTileEntity(pos);
}