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

The following examples show how to use net.minecraft.world.World#updateComparatorOutputLevel() . 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: BlockTFOven.java    From TofuCraftReload with 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 2
Source File: BlockAdvancedAggregator.java    From TofuCraftReload with 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 TileEntitySoymilkAdvancedAggregator)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntitySoymilkAdvancedAggregator)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }

    super.breakBlock(worldIn, pos, state);
}
 
Example 3
Source File: BlockAggregator.java    From TofuCraftReload with 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 4
Source File: BlockTFCrasher.java    From TofuCraftReload with 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 5
Source File: BlockTFCompressor.java    From TofuCraftReload with 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 6
Source File: BlockSaltFurnace.java    From TofuCraftReload with 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 7
Source File: SawmillBlock.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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 File: BlockCampfirePot.java    From Sakura_mod with 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 9
Source File: BlockBarrel.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 10
Source File: BlockStorage.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 11
Source File: BlockEnderUtilitiesInventory.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 12
Source File: BlockFirepit.java    From TFC2 with 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 13
Source File: DryingRackBlock.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@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 14
Source File: ChoppingBlock.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@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 15
Source File: BlockStoneMortar.java    From Sakura_mod with 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 16
Source File: BlockMapleSyrupCauldron.java    From Sakura_mod with 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 17
Source File: BlockTFStorage.java    From TofuCraftReload with 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 18
Source File: BlockTFBattery.java    From TofuCraftReload with 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 19
Source File: BlockMSU.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    worldIn.updateComparatorOutputLevel(pos, this);
    worldIn.removeTileEntity(pos);
}
 
Example 20
Source File: BlockASU.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    worldIn.updateComparatorOutputLevel(pos, this);
    worldIn.removeTileEntity(pos);
}