Java 类net.minecraft.block.BlockTrapDoor 实例源码

项目:Backmemed    文件:EntityLivingBase.java   
/**
 * returns true if this entity is by a ladder, false otherwise
 */
public boolean isOnLadder()
{
    int i = MathHelper.floor(this.posX);
    int j = MathHelper.floor(this.getEntityBoundingBox().minY);
    int k = MathHelper.floor(this.posZ);

    if (this instanceof EntityPlayer && ((EntityPlayer)this).isSpectator())
    {
        return false;
    }
    else
    {
        BlockPos blockpos = new BlockPos(i, j, k);
        IBlockState iblockstate = this.world.getBlockState(blockpos);
        Block block = iblockstate.getBlock();
        return block != Blocks.LADDER && block != Blocks.VINE ? block instanceof BlockTrapDoor && this.canGoThroughtTrapDoorOnLadder(blockpos, iblockstate) : true;
    }
}
项目:BetterWithAddons    文件:QuartzCrystalRecipe.java   
private int getLidStrength(World world, BlockPos pos, IBlockState state)
{
    Block block = state.getBlock();
    //Check the shape first. Trapdoors have holes but whatever.
    if(state.isSideSolid(world,pos,EnumFacing.DOWN) || (block instanceof BlockTrapDoor && !state.getValue(BlockTrapDoor.OPEN) && state.getValue(BlockTrapDoor.HALF) == BlockTrapDoor.DoorHalf.BOTTOM))
    {
        Material material = state.getMaterial();
        float hardness = state.getBlockHardness(world,pos);

        //Material checks next
        if(material.isLiquid() || material.isReplaceable())
            return 0; //just replace with air
        else if(hardness < 1.5f || material.getCanBurn())
            return 1; //destroy without drop to prevent easy solutions to acquiring piles for the reaction
        else if(hardness < 5.0f)
            return 2; //destroy with drop
        else
            return 3; //stable
    }

    return -1; //don't even remove this block
}
项目:needtobreath    文件:DimensionData.java   
public boolean isValid(World world, long pos) {
    if (pos == -1L) {
        return false;
    }
    BlockPos p = BlockPos.fromLong(pos);
    IBlockState state = world.getBlockState(p);
    Block block = state.getBlock();

    if (Config.getBlocksBlocking().contains(block.getRegistryName())) {
        // Special case for doors
        if (block instanceof BlockDoor) {
            return state.getValue(BlockDoor.OPEN);
        }
        if (block instanceof BlockTrapDoor) {
            return state.getValue(BlockTrapDoor.OPEN);
        }

        return false;
    }
    if (Config.getBlocksNonBlocking().contains(block.getRegistryName())) {
        return true;
    }

    if (block.isAir(state, world, p)) {
        return true;
    } else {
        AxisAlignedBB box = state.getCollisionBoundingBox(world, p);
        if (box == null) {
            return true;
        }
        return !block.isOpaqueCube(state);
    }
}
项目:Got-Wood    文件:BlockWoodTrapdoor.java   
@Override
public boolean onBlockActivated(final World world, final BlockPos coord, IBlockState state,
                                final EntityPlayer player, EnumHand hand, ItemStack heldItem, final EnumFacing facing,
                                final float partialX, final float partialY, final float partialZ) {
    if (this.wood.getToolHarvestLevel() > 1)
        return true;

    IBlockState newState = state.cycleProperty(BlockTrapDoor.OPEN);
    worldIn.setBlockState(pos, newState, 2);
    worldIn.playEvent(playerIn, newState.getValue(BlockTrapDoor.OPEN) ? 1012 : 1006, pos, 0);
    return true;
}
项目:Backmemed    文件:EntityLivingBase.java   
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;
}
项目:CustomWorldGen    文件:EntityLivingBase.java   
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;
}
项目:TRHS_Club_Mod_2016    文件:RotationHelper.java   
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;
}
项目:Aether-Legacy    文件:EntityValkyrieQueen.java   
private void unlockTreasure() 
  {
IBlockState state = Blocks.TRAPDOOR.getDefaultState();
this.worldObj.setBlockState(new BlockPos(this.dungeonX + 16, dungeonY + 1, dungeonZ + 9), state.withProperty(BlockTrapDoor.FACING, EnumFacing.SOUTH), 2);
this.worldObj.setBlockState(new BlockPos(this.dungeonX + 17, dungeonY + 1, dungeonZ + 9), state.withProperty(BlockTrapDoor.FACING, EnumFacing.SOUTH), 2);
this.worldObj.setBlockState(new BlockPos(this.dungeonX + 16, dungeonY + 1, dungeonZ + 10), state.withProperty(BlockTrapDoor.FACING, EnumFacing.NORTH), 2);
this.worldObj.setBlockState(new BlockPos(this.dungeonX + 17, dungeonY + 1, dungeonZ + 10), state.withProperty(BlockTrapDoor.FACING, EnumFacing.NORTH), 2);

      for (int x = this.dungeonX - 27; x < this.dungeonX + 30; x++)
      {
          for (int y = this.dungeonY - 1; y < this.dungeonY + 22; y++) 
          {
              for (int z = this.dungeonZ - 6; z < this.dungeonZ + 26; z++) 
              {
                BlockPos pos = new BlockPos(x, y, z);
                  IBlockState block = this.worldObj.getBlockState(pos);

                  if (block == BlocksAether.locked_dungeon_block.getDefaultState().withProperty(BlockDungeonBase.dungeon_stone, EnumStoneType.Angelic))
                  {
                    this.worldObj.setBlockState(pos, BlocksAether.dungeon_block.getDefaultState().withProperty(BlockDungeonBase.dungeon_stone, EnumStoneType.Angelic), 2);
                  }
                  if (block == BlocksAether.dungeon_block.getDefaultState().withProperty(BlockDungeonBase.dungeon_stone, EnumStoneType.Angelic)) 
                  {
                    this.worldObj.setBlockState(pos, BlocksAether.dungeon_block.getDefaultState().withProperty(BlockDungeonBase.dungeon_stone, EnumStoneType.Angelic), 2);
                  }
                  if (block == BlocksAether.locked_dungeon_block.getDefaultState().withProperty(BlockDungeonBase.dungeon_stone, EnumStoneType.Light_angelic)) 
                  {
                    this.worldObj.setBlockState(pos, BlocksAether.dungeon_block.getDefaultState().withProperty(BlockDungeonBase.dungeon_stone, EnumStoneType.Light_angelic), 2);
                  }
              }
          }
      }
  }
项目:MC-Prefab    文件:StructureModerateHouse.java   
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos,
        EnumFacing assumedNorth, Block foundBlock, IBlockState blockState, EntityPlayer player)
{
    if (foundBlock instanceof BlockFurnace)
    {
        if (this.furnacePosition == null)
        {
            this.furnacePosition = new ArrayList<BlockPos>();
        }

        this.furnacePosition.add(block.getStartingPosition().getRelativePosition(
                originalPos, 
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing));
    }
    else if (foundBlock instanceof BlockChest && !((ModerateHouseConfiguration)configuration).addChests)
    {
        return true;
    }
    else if (foundBlock instanceof BlockChest && this.chestPosition == null)
    {
        this.chestPosition = block.getStartingPosition().getRelativePosition(
                originalPos, 
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockTrapDoor)
    {
        // The trap door will still be added, but the mine shaft may not be
        // built.
        this.trapDoorPosition = block.getStartingPosition().getRelativePosition(
                originalPos, 
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }

    return false;
}
项目:CauldronGit    文件:RotationHelper.java   
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;
}
项目:BaseMetals    文件:BlockMetalTrapDoor.java   
@Override
public boolean onBlockActivated(final World world, final BlockPos coord, IBlockState state,
                                final EntityPlayer player, EnumHand hand, ItemStack heldItem, final EnumFacing facing,
                                final float partialX, final float partialY, final float partialZ) {
    if (this.metal.getToolHarvestLevel() > 1) {
        return true;
    }
    state = state.cycleProperty(BlockTrapDoor.OPEN);
    world.setBlockState(coord, state, 2);
    world.playEvent(player, ((Boolean)state.getValue(BlockTrapDoor.OPEN)) ? 1003 : 1006, coord, 0);
    return true;
}
项目:ExpandedRailsMod    文件:EntityLivingBase.java   
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;
}
项目:Cauldron    文件:RotationHelper.java   
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;
}
项目:Cauldron    文件:RotationHelper.java   
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;
}
项目:Cauldron    文件:RotationHelper.java   
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;
}
项目:MC-Prefab    文件:StructureAlternateStart.java   
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos,
        EnumFacing assumedNorth, Block foundBlock, IBlockState blockState, EntityPlayer player)
{
    HouseConfiguration houseConfig = (HouseConfiguration) configuration;

    if ((!houseConfig.addBed && foundBlock instanceof BlockBed) || (!houseConfig.addChest && foundBlock instanceof BlockChest)
            || (!houseConfig.addTorches && foundBlock instanceof BlockTorch)
            || (!houseConfig.addCraftingTable && (foundBlock instanceof BlockWorkbench || foundBlock instanceof BlockFurnace)))
    {
        // Don't place the block, returning true means that this has been
        // "handled"
        return true;
    }

    if (foundBlock instanceof BlockFurnace)
    {
        this.furnacePosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockTrapDoor && houseConfig.addMineShaft)
    {
        // The trap door will still be added, but the mine shaft may not be
        // built.
        this.trapDoorPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockChest && this.chestPosition == null)
    {
        this.chestPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }
    else if (foundBlock instanceof BlockStandingSign)
    {
        this.signPosition = block.getStartingPosition().getRelativePosition(
                originalPos,
                this.getClearSpace().getShape().getDirection(),
                configuration.houseFacing);
    }

    if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS.getRegistryName().getResourceDomain())
            && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS.getRegistryName().getResourcePath()))
    {
        blockState = blockState.withProperty(BlockStainedGlass.COLOR, houseConfig.glassColor);
        block.setBlockState(blockState);
        this.priorityOneBlocks.add(block);

        return true;
    }
    else if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourceDomain())
            && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourcePath()))
    {
        block.setBlockState(foundBlock.getStateFromMeta(houseConfig.glassColor.getMetadata()));
        this.priorityOneBlocks.add(block);
        return true;
    }

    return false;
}
项目:Restructured    文件:BlockHelper.java   
public static boolean isDoor(final Block block) {
    return block instanceof BlockDoor || block instanceof BlockTrapDoor;
}
项目:Structures    文件:RotationHelper.java   
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;
  }
项目:RuneCraftery    文件:RotationHelper.java   
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;
}
项目:RuneCraftery    文件:RotationHelper.java   
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;
}
项目:BetterNutritionMod    文件:RotationHelper.java   
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;
}
项目:OpenBlocks    文件:BlockLadder.java   
@Override
public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) {
    return world.getBlockState(pos).getValue(BlockTrapDoor.OPEN);
}