private boolean canGoThroughtTrapDoorOnLadder(BlockPos pos, IBlockState state) { if (((Boolean)state.getValue(BlockTrapDoor.OPEN)).booleanValue()) { IBlockState iblockstate = this.world.getBlockState(pos.down()); if (iblockstate.getBlock() == Blocks.LADDER && iblockstate.getValue(BlockLadder.FACING) == state.getValue(BlockTrapDoor.FACING)) { return true; } } return false; }
private boolean canGoThroughtTrapDoorOnLadder(BlockPos pos, IBlockState state) { if (((Boolean)state.getValue(BlockTrapDoor.OPEN)).booleanValue()) { IBlockState iblockstate = this.worldObj.getBlockState(pos.down()); if (iblockstate.getBlock() == Blocks.LADDER && iblockstate.getValue(BlockLadder.FACING) == state.getValue(BlockTrapDoor.FACING)) { return true; } } return false; }
public static ForgeDirection[] getValidVanillaBlockRotations(Block block) { return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireHook || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockRailDetector || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block == Blocks.field_150444_as || block == Blocks.field_150472_an || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator || block instanceof BlockTrapDoor || block instanceof BlockHugeMushroom || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS; }
@SuppressWarnings("unused") private int getLadderHeight(Entity e, int offset) { int ladders = 0; for(int i = (int) e.posY; i < 256; i++){ Block var1 = mc.theWorld.getBlockState(new BlockPos(e.posX, i + offset, e.posZ)).getBlock(); if(var1 instanceof BlockAir){ break; }else if(var1 instanceof BlockLadder || var1 instanceof BlockVine){ ladders++; } return ladders; } return -1; }
public static ForgeDirection[] getValidVanillaBlockRotations(Block block) { return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireHook || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockRailDetector || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block == Blocks.wall_sign || block == Blocks.standing_sign || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator || block instanceof BlockTrapDoor || block instanceof BlockHugeMushroom || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS; }
@Override public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List<BlockPos> availableBlocks) { EnumFacing enumfacing = (EnumFacing)state.getValue(BlockLadder.FACING); return availableBlocks.contains(pos.offset(enumfacing.getOpposite())); }
@Override public List<BlockPos> getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List<BlockPos> availableBlocks) { EnumFacing enumfacing = (EnumFacing)state.getValue(BlockLadder.FACING); ArrayList<BlockPos> poses = new ArrayList<BlockPos>(); poses.add(pos); poses.add(pos.offset(enumfacing.getOpposite())); int height = 100; BlockPos highPos = pos; while(height > 1) { highPos = highPos.add(0, 1, 0); IBlockState state1 = world.getBlockState(highPos); if(BlockLadder.class.isInstance(state1.getBlock())) { EnumFacing enumfacing1 = (EnumFacing)state1.getValue(BlockLadder.FACING); poses.add(highPos); poses.add(highPos.offset(enumfacing1.getOpposite())); height--; } else { break; } } return poses; }
/** * Returns true if the whip can grapple the block at the position */ protected boolean canGrabBlock(Block block, BlockPos pos, EnumFacing face) { if (block instanceof IWhipBlock) { return ((IWhipBlock) block).canGrabBlock(getType(), getThrower(), worldObj, pos, face); } switch (getType()) { case WHIP_MAGIC: // this excludes things like dirt, most plants, etc. if (block instanceof BlockSandStone || block instanceof BlockHugeMushroom || (block.getMaterial().blocksMovement() && block.getBlockHardness(worldObj, pos) > 1.0F)) { return true; } // otherwise, fall through to standard case: case WHIP_SHORT: case WHIP_LONG: int clear = 0; if (isSideClear(pos.east()) && isSideClear(pos.west())) { ++clear; } if (isSideClear(pos.up()) && isSideClear(pos.down())) { ++clear; } if (isSideClear(pos.south()) && isSideClear(pos.north())) { ++clear; } return (clear > 1 && (block instanceof BlockFence || block instanceof BlockLog || block instanceof BlockLever || block instanceof BlockSign || block instanceof BlockLadder)); } return false; }
private static BlockType getBlockType(Block block) { if(block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockCocoa) { return BlockType.BED; } if(block instanceof BlockRail) { return BlockType.RAIL; } if(block instanceof BlockRailPowered || block instanceof BlockRailDetector) { return BlockType.RAIL_POWERED; } if(block instanceof BlockStairs) { return BlockType.STAIR; } if(block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block == Blocks.wall_sign) { return BlockType.CHEST; } if(block == Blocks.standing_sign) { return BlockType.SIGNPOST; } if(block instanceof BlockDoor) { return BlockType.DOOR; } if(block instanceof BlockButton) { return BlockType.BUTTON; } if(block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator) { return BlockType.REDSTONE_REPEATER; } if(block instanceof BlockTrapDoor) { return BlockType.TRAPDOOR; } if(block instanceof BlockHugeMushroom) { return BlockType.MUSHROOM_CAP; } if(block instanceof BlockVine) { return BlockType.VINE; } if(block instanceof BlockSkull) { return BlockType.SKULL; } if(block instanceof BlockAnvil) { return BlockType.ANVIL; } if(block instanceof BlockLog) { return BlockType.LOG; } if(block instanceof BlockDispenser || block instanceof BlockPistonBase || block instanceof BlockPistonExtension || block instanceof BlockHopper) { return BlockType.DISPENSER; } if(block instanceof BlockTorch) { return BlockType.TORCH; } if(block instanceof BlockLever) { return BlockType.LEVER; } if(block instanceof BlockTripWireHook) { return BlockType.TRIP_WIRE_HOOK; } return null; }
public static ForgeDirection[] getValidVanillaBlockRotations(Block block) { return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireSource || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockDetectorRail || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block.blockID == Block.signWall.blockID || block.blockID == Block.signPost.blockID || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockComparator || block instanceof BlockTrapDoor || block instanceof BlockMushroomCap || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS; }