net.minecraft.block.BlockWorkbench Java Examples

The following examples show how to use net.minecraft.block.BlockWorkbench. 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: CraftHumanEntity.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
public InventoryView openWorkbench(Location location, boolean force) {
    if (!force) {
        Block block = location.getBlock();
        if (block.getType() != Material.WORKBENCH) {
            return null;
        }
    }
    if (location == null) {
        location = getLocation();
    }
    getHandle().displayGui(new BlockWorkbench.InterfaceCraftingTable(getHandle().world, new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ())));
    if (force) {
        getHandle().inventoryContainer.checkReachable = false;
    }
    return getHandle().inventoryContainer.getBukkitView();
}
 
Example #2
Source File: EntityAIMakingFood.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
protected boolean shouldMoveTo(World worldIn, BlockPos pos) {
    if (!worldIn.isAirBlock(pos.up())) {
        return false;
    } else {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();

        if (block instanceof BlockWorkbench) {
            return true;
        }

        return false;
    }
}
 
Example #3
Source File: NearbyCraftCommandsImplementation.java    From malmo with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onBlockDestroy(BlockEvent.BreakEvent event) {
    if (!event.isCanceled() && event.getState().getBlock() instanceof BlockWorkbench)
        for (int i = craftingTables.size() - 1; i >= 0; i--)
            if (craftingTables.get(i).equals(event.getPos()))
                craftingTables.remove(i);
}
 
Example #4
Source File: NearbyCraftCommandsImplementation.java    From malmo with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onBlockPlace(BlockEvent.PlaceEvent event) {
    if (!event.isCanceled() && event.getPlacedBlock().getBlock() instanceof BlockWorkbench)
        craftingTables.add(event.getPos());
}