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

The following examples show how to use net.minecraft.init.Blocks#HOPPER . 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: ToolWrench.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 File: MCUtil.java    From Kettle with 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
Source File: Hopper.java    From minecraft-roguelike with GNU General Public License v3.0 5 votes vote down vote up
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);
}