Search in sources :

Example 1 with SimpleStackHandler

use of betterwithmods.common.blocks.tile.SimpleStackHandler in project BetterWithAddons by DaedalusGame.

the class HopperCratingRecipe method craft.

@Override
public void craft(EntityItem inputStack, World world, BlockPos pos) {
    TileEntityFilteredHopper tile = (TileEntityFilteredHopper) world.getTileEntity(pos);
    SimpleStackHandler inventory = tile.inventory;
    if (!InvUtils.consumeItemsInInventory(inventory, input, 7, false)) {
        return;
    }
    InvUtils.ejectStackWithOffset(world, pos.down(1), this.output.copy());
    this.onCraft(world, pos, inputStack);
}
Also used : TileEntityFilteredHopper(betterwithmods.common.blocks.mechanical.tile.TileEntityFilteredHopper) SimpleStackHandler(betterwithmods.common.blocks.tile.SimpleStackHandler)

Example 2 with SimpleStackHandler

use of betterwithmods.common.blocks.tile.SimpleStackHandler in project BetterWithAddons by DaedalusGame.

the class HopperCratingRecipe method canCraft.

@Override
public boolean canCraft(World world, BlockPos pos) {
    IBlockState crateState = world.getBlockState(pos.down());
    TileEntityFilteredHopper tile = (TileEntityFilteredHopper) world.getTileEntity(pos);
    SimpleStackHandler inventory = tile.inventory;
    if (!isCrate(crateState)) {
        return false;
    }
    return true;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) TileEntityFilteredHopper(betterwithmods.common.blocks.mechanical.tile.TileEntityFilteredHopper) SimpleStackHandler(betterwithmods.common.blocks.tile.SimpleStackHandler)

Aggregations

TileEntityFilteredHopper (betterwithmods.common.blocks.mechanical.tile.TileEntityFilteredHopper)2 SimpleStackHandler (betterwithmods.common.blocks.tile.SimpleStackHandler)2 IBlockState (net.minecraft.block.state.IBlockState)1