当前位置: 首页>>代码示例>>Java>>正文


Java BlockTrapDoor类代码示例

本文整理汇总了Java中net.minecraft.block.BlockTrapDoor的典型用法代码示例。如果您正苦于以下问题:Java BlockTrapDoor类的具体用法?Java BlockTrapDoor怎么用?Java BlockTrapDoor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BlockTrapDoor类属于net.minecraft.block包,在下文中一共展示了BlockTrapDoor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isOnLadder

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:EntityLivingBase.java

示例2: getLidStrength

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
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
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:23,代码来源:QuartzCrystalRecipe.java

示例3: isValid

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
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);
    }
}
 
开发者ID:McJty,项目名称:needtobreath,代码行数:34,代码来源:DimensionData.java

示例4: onBlockActivated

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
@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;
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:13,代码来源:BlockWoodTrapdoor.java

示例5: canGoThroughtTrapDoorOnLadder

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:EntityLivingBase.java

示例6: canGoThroughtTrapDoorOnLadder

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
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;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:EntityLivingBase.java

示例7: getValidVanillaBlockRotations

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
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;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:29,代码来源:RotationHelper.java

示例8: unlockTreasure

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
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);
                  }
              }
          }
      }
  }
 
开发者ID:Modding-Legacy,项目名称:Aether-Legacy,代码行数:34,代码来源:EntityValkyrieQueen.java

示例9: CustomBlockProcessingHandled

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
@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;
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:40,代码来源:StructureModerateHouse.java

示例10: getValidVanillaBlockRotations

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
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;
}
 
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:29,代码来源:RotationHelper.java

示例11: onBlockActivated

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
@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;
}
 
开发者ID:cyanobacterium,项目名称:BaseMetals,代码行数:13,代码来源:BlockMetalTrapDoor.java

示例12: CustomBlockProcessingHandled

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
@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;
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:66,代码来源:StructureAlternateStart.java

示例13: isDoor

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
public static boolean isDoor(final Block block) {
	return block instanceof BlockDoor || block instanceof BlockTrapDoor;
}
 
开发者ID:OreCruncher,项目名称:Restructured,代码行数:4,代码来源:BlockHelper.java

示例14: getBlockType

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
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;
  }
 
开发者ID:SleepyTrousers,项目名称:Structures,代码行数:65,代码来源:RotationHelper.java

示例15: getValidVanillaBlockRotations

import net.minecraft.block.BlockTrapDoor; //导入依赖的package包/类
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;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:5,代码来源:RotationHelper.java


注:本文中的net.minecraft.block.BlockTrapDoor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。