net.minecraft.block.Block.isBed()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中net.minecraft.block.Block.isBed()方法的一些代码示例,展示了Block.isBed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.isBed()方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:isBed

Block.isBed介绍

暂无

代码示例

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@SideOnly(Side.CLIENT)
public float getBedOrientationInDegrees() {
  BlockPos bedLocation = getBedPosition();
  IBlockState state = bedLocation == null ? null : this.world.getBlockState(bedLocation);
  if (state != null && state.getBlock().isBed(state, world, bedLocation, this)) {
    EnumFacing enumfacing = state.getBlock().getBedDirection(state, world, bedLocation);
    switch (enumfacing) {
      case SOUTH:
        return 90.0F;
      case WEST:
        return 0.0F;
      case NORTH:
        return 270.0F;
      case EAST:
        return 180.0F;
    }
  }
  return 0.0F;
}

代码示例来源:origin: ldtteam/minecolonies

if (world.getBlockState(event.getPos()).getBlock().isBed(world.getBlockState(event.getPos()), world, event.getPos(), player))

代码示例来源:origin: ldtteam/minecolonies

/**
 * Returns the orientation of the bed in degrees.
 */
@SideOnly(Side.CLIENT)
public float getBedOrientationInDegrees()
{
  final IBlockState state = getBedLocation() == null ? null : citizen.world.getBlockState(getBedLocation());
  if (state != null && state.getBlock().isBed(state, citizen.world, getBedLocation(), citizen))
  {
    final EnumFacing enumfacing = state.getBlock().getBedDirection(state, citizen.world, getBedLocation());
    switch (enumfacing)
    {
      case SOUTH:
        return NINETY_DEGREE;
      case WEST:
        return 0.0F;
      case NORTH:
        return THREE_QUARTERS;
      case EAST:
        return HALF_ROTATION;
      default:
        return 0F;
    }
  }
  return 0.0F;
}

代码示例来源:origin: ldtteam/minecolonies

/**
 * Get the X render offset.
 * @return the offset.
 */
public float getRenderOffsetX()
{
  if (!isAsleep())
  {
    return 0;
  }
  final IBlockState state = citizen.world.isBlockLoaded(getBedLocation()) ? citizen.world.getBlockState(getBedLocation()) : null;
  final boolean isBed = state != null && state.getBlock().isBed(state, citizen.world, getBedLocation(), citizen);
  final EnumFacing enumfacing = isBed && state.getBlock() instanceof BlockHorizontal ? state.getValue(BlockHorizontal.FACING) : null;
  if (enumfacing == null)
  {
    return 0;
  }
  return SLEEPING_RENDER_OFFSET * (float) enumfacing.getXOffset();
}

代码示例来源:origin: ldtteam/minecolonies

/**
   * Get the z render offset.
   * @return the offset.
   */
  public float getRenderOffsetZ()
  {
    if (!isAsleep())
    {
      return 0;
    }

    final IBlockState state = citizen.world.isBlockLoaded(getBedLocation()) ? citizen.world.getBlockState(getBedLocation()) : null;
    final boolean isBed = state != null && state.getBlock().isBed(state, citizen.world, getBedLocation(), citizen);
    final EnumFacing enumfacing = isBed && state.getBlock() instanceof BlockHorizontal ? state.getValue(BlockHorizontal.FACING) : null;

    if (enumfacing == null)
    {
      return 0;
    }

    return SLEEPING_RENDER_OFFSET * (float) enumfacing.getZOffset();
  }
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

if (state != null && state.getBlock().isBed(state, player.world, bedLocation, player)) {
  EnumFacing enumfacing = state.getBlock().getBedDirection(state, player.world, bedLocation);
  float f = 0.5F;

代码示例来源:origin: ldtteam/minecolonies

/**
 * Attempts a sleep interaction with the citizen and the given bed.
 *
 * @param bedLocation The possible location to sleep.
 */
public void trySleep(final BlockPos bedLocation)
{
  final IBlockState state = citizen.world.isBlockLoaded(bedLocation) ? citizen.world.getBlockState(bedLocation) : null;
  final boolean isBed = state != null && state.getBlock().isBed(state, citizen.world, bedLocation, citizen);
  if (!isBed)
  {
    return;
  }
  citizen.setPosition( ((float) bedLocation.getX() + HALF_BLOCK),
   (double) ((float) bedLocation.getY()),
   ((float) bedLocation.getZ() + HALF_BLOCK));
  citizen.motionX = 0.0D;
  citizen.motionY = 0.0D;
  citizen.motionZ = 0.0D;
  //Remove item while citizen is asleep.
  citizen.getCitizenItemHandler().removeHeldItem();
  setIsAsleep(true);
  if (citizen.getCitizenData() != null)
  {
    citizen.getCitizenData().setBedPos(bedLocation);
  }
  citizen.getDataManager().set(DATA_BED_POS, bedLocation);
}

代码示例来源:origin: TeamLapen/Vampirism

if (state != null && state.getBlock().isBed(state, player.world, bedLocation, player)) {
  EnumFacing enumfacing = state.getBlock().getBedDirection(state, player.world, bedLocation);
  float f = 0.5F;

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

if (block != null && block.isBed(state, entity.world, bedPos, entity)) {
  angleYaw = (float) (block.getBedDirection(state, entity.world, bedPos).getHorizontalIndex() * 90);
  angleYaw += 180;

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

if (block != null && block.isBed(state, entityIn.world, bedPos, entityIn)) {
  angleYaw = (float) (block.getBedDirection(state, entityIn.world, bedPos).getHorizontalIndex() * 90);

代码示例来源:origin: TeamLapen/Vampirism

boolean bed = state.getBlock().isBed(state, player.getEntityWorld(), player.bedLocation, player);
if (!bed) {
  wakeUpPlayer(true, true, false);

相关文章

Block类方法