Java Code Examples for net.minecraft.init.Blocks#HOPPER

The following examples show how to use net.minecraft.init.Blocks#HOPPER . 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
@Override
public boolean canMineBlock(IBlockState blockState, ItemStack stack) {
    Block block = blockState.getBlock();
    String tool = block.getHarvestTool(blockState);
    return (tool != null && tool.equals("wrench"))
        || blockState.getMaterial() == Material.PISTON
        || block == Blocks.HOPPER
        || block == Blocks.DISPENSER
        || block == Blocks.DROPPER
        || blockState.getMaterial() == Material.IRON;
}
 
Example 2
Source Project: Kettle   File: MCUtil.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Nullable
public static TileEntityHopper getHopper(World world, BlockPos pos) {
    Chunk chunk = world.getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4);
    if (chunk != null && chunk.getBlockState(pos).getBlock() == Blocks.HOPPER) {
        TileEntity tileEntity = chunk.getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE);
        if (tileEntity instanceof TileEntityHopper) {
            return (TileEntityHopper) tileEntity;
        }
    }
    return null;
}
 
Example 3
public static void generate(IWorldEditor editor, Cardinal dir, Coord pos){
	MetaBlock hopper = new MetaBlock(Blocks.HOPPER);
	if(Arrays.asList(Cardinal.directions).contains(dir)){
		hopper.withProperty(BlockHopper.FACING, Cardinal.facing(Cardinal.reverse(dir)));
	}
	hopper.set(editor, pos);
}