net.minecraft.util.math.BlockPos.west()方法的使用及代码示例

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

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

BlockPos.west介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

double d3 = Double.MAX_VALUE;
if (!world.isBlockFullCube(blockpos.west()) && d0 < d3)

代码示例来源:origin: SleepyTrousers/EnderIO

private @Nonnull BlockPos findSouthWestCorner(@Nonnull World worldIn, @Nonnull BlockPos pos) {
 BlockPos res = pos;
 int i = 0;
 while (isSingle(worldIn, res.south()) && i < 2) {
  res = res.south();
  i++;
 }
 i = 0;
 while (isSingle(worldIn, res.west()) && i < 2) {
  res = res.west();
  i++;
 }
 return res;
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Deprecated
@Override
public @Nonnull AxisAlignedBB getSelectedBoundingBox(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos) {
 if (bs.getBlock() == this) {
  BlockType bt = bs.getValue(BLOCK_TYPE);
  if (bt != BlockType.SINGLE) {
   BlockPos masterLoc = bt.getLocationOfMaster(pos);
   AxisAlignedBB res = new AxisAlignedBB(masterLoc.south().south().west(), masterLoc.north().east().east().up());
   return res;
  }
 }
 return super.getSelectedBoundingBox(bs, world, pos);
}

代码示例来源:origin: Vazkii/Psi

@Nonnull
@Override
public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess worldIn, BlockPos pos) {
  IBlockState origState = state;
  state = state.withProperty(BLOCK_UP, worldIn.getBlockState(pos.up()).equals(origState));
  state = state.withProperty(BLOCK_DOWN, worldIn.getBlockState(pos.down()).equals(origState));
  state = state.withProperty(BLOCK_NORTH, worldIn.getBlockState(pos.north()).equals(origState));
  state = state.withProperty(BLOCK_SOUTH, worldIn.getBlockState(pos.south()).equals(origState));
  state = state.withProperty(BLOCK_WEST, worldIn.getBlockState(pos.west()).equals(origState));
  state = state.withProperty(BLOCK_EAST, worldIn.getBlockState(pos.east()).equals(origState));
  return state;
}

代码示例来源:origin: Vazkii/Quark

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
  boolean flag = canConnectTo(worldIn, pos.north());
  boolean flag1 = canConnectTo(worldIn, pos.east());
  boolean flag2 = canConnectTo(worldIn, pos.south());
  boolean flag3 = canConnectTo(worldIn, pos.west());
  boolean flag4 = flag && !flag1 && flag2 && !flag3 || !flag && flag1 && !flag2 && flag3;
  return state.withProperty(UP, Boolean.valueOf(!flag4 || !worldIn.isAirBlock(pos.up()))).withProperty(NORTH, Boolean.valueOf(flag)).withProperty(EAST, Boolean.valueOf(flag1)).withProperty(SOUTH, Boolean.valueOf(flag2)).withProperty(WEST, Boolean.valueOf(flag3));
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public @Nonnull IBlockState getActualState(@Nonnull IBlockState state, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) {
 EnumFacing.Axis enumfacing$axis = state.getValue(FACING).getAxis();
 if (enumfacing$axis == EnumFacing.Axis.Z
   && (worldIn.getBlockState(pos.west()).getBlock() instanceof BlockWall || worldIn.getBlockState(pos.east()).getBlock() instanceof BlockWall)
   || enumfacing$axis == EnumFacing.Axis.X
     && (worldIn.getBlockState(pos.north()).getBlock() instanceof BlockWall || worldIn.getBlockState(pos.south()).getBlock() instanceof BlockWall)) {
  state = state.withProperty(IN_WALL, true);
 }
 return state;
}

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

@Override
public List<BlockPos> getPositionsToHarvest(World world, BlockPos pos, IBlockState state) {
  List<BlockPos> ret = new ArrayList<>();
  addPositionIfGourd(ret, world, pos.north());
  addPositionIfGourd(ret, world, pos.west());
  addPositionIfGourd(ret, world, pos.south());
  addPositionIfGourd(ret, world, pos.east());
  return ret;
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

public void generateArchNS(World world, Random rand, BlockPos position) {
  int height = 3 + rand.nextInt(1);
  int width = 1 + rand.nextInt(2);
  for (int sides = 0; sides < height; sides++) {
    world.setBlockState(position.up(sides).east(width / 2), ModBlocks.frozenCobblestone.getDefaultState(), 3);
    world.setBlockState(position.up(sides).west(width / 2), ModBlocks.frozenCobblestone.getDefaultState(), 3);
  }
  for (int way = -1; way < width; way++) {
    world.setBlockState(position.up(height).east(way), ModBlocks.frozenCobblestone.getDefaultState(), 3);
  }
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

public void generateArchNS(World world, Random rand, BlockPos position) {
  int height = 3 + rand.nextInt(1);
  int width = 1 + rand.nextInt(2);
  for (int sides = 0; sides < height; sides++) {
    world.setBlockState(position.up(sides).east(width / 2), ModBlocks.charedCobblestone.getDefaultState(), 3);
    world.setBlockState(position.up(sides).west(width / 2), ModBlocks.charedCobblestone.getDefaultState(), 3);
  }
  for (int way = -1; way < width; way++) {
    world.setBlockState(position.up(height).east(way), ModBlocks.charedCobblestone.getDefaultState(), 3);
  }
}

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

protected void breakAroundOnLevel(World world, BlockPos origin, BlockPos center, float maxHardness) {
  affectBlock(world, origin, center, maxHardness);
  affectBlock(world, origin, center.north(), maxHardness);
  affectBlock(world, origin, center.east(), maxHardness);
  affectBlock(world, origin, center.west(), maxHardness);
  affectBlock(world, origin, center.south(), maxHardness);
  affectBlock(world, origin, center.north().east(), maxHardness);
  affectBlock(world, origin, center.east().south(), maxHardness);
  affectBlock(world, origin, center.south().west(), maxHardness);
  affectBlock(world, origin, center.west().north(), maxHardness);
}

代码示例来源:origin: Vazkii/Quark

@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
  VariedChests.ChestType myType = getCustomType(source, pos);
  return getCustomType(source, pos.north()) == myType ? NORTH_CHEST_AABB : getCustomType(source, pos.south()) == myType ? SOUTH_CHEST_AABB : getCustomType(source, pos.west()) == myType ? WEST_CHEST_AABB : getCustomType(source, pos.east()) == myType ? EAST_CHEST_AABB : NOT_CONNECTED_AABB;
}

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
  int smasherCount = 0;
  smasherCount += world.getBlockState(pos.east()).getBlock() == ROCK_SMASHER ? 1 : 0;
  smasherCount += world.getBlockState(pos.west()) == ROCK_SMASHER ? 1 : 0;
  smasherCount += world.getBlockState(pos.north()) == ROCK_SMASHER ? 1 : 0;
  smasherCount += world.getBlockState(pos.south()) == ROCK_SMASHER ? 1 : 0;
  if (smasherCount < 2) {
    world.setBlockToAir(pos);
  }
}

代码示例来源:origin: vadis365/TheErebus

@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
  if (source.getBlockState(pos.north()).getBlock() == this) {
    return NORTH_CHEST_AABB;
  } else if (source.getBlockState(pos.south()).getBlock() == this) {
    return SOUTH_CHEST_AABB;
  } else if (source.getBlockState(pos.west()).getBlock() == this) {
    return WEST_CHEST_AABB;
  } else {
    return source.getBlockState(pos.east()).getBlock() == this ? EAST_CHEST_AABB : NOT_CONNECTED_AABB;
  }
}

代码示例来源:origin: MrCrayfish/MrCrayfishFurnitureMod

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
{
  return state.withProperty(NORTH, isCoffeeTable(world, pos.north())).withProperty(EAST, isCoffeeTable(world, pos.east())).withProperty(SOUTH, isCoffeeTable(world, pos.south())).withProperty(WEST, isCoffeeTable(world, pos.west()));
}

代码示例来源:origin: MrCrayfish/MrCrayfishFurnitureMod

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
{
  return state.withProperty(NORTH, isHedge(world, pos.north())).withProperty(EAST, isHedge(world, pos.east())).withProperty(SOUTH, isHedge(world, pos.south())).withProperty(WEST, isHedge(world, pos.west()));
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
  boolean canNorth = this.canConnectTo(worldIn, pos.north());
  boolean canEast = this.canConnectTo(worldIn, pos.east());
  boolean canSouth = this.canConnectTo(worldIn, pos.south());
  boolean canWest = this.canConnectTo(worldIn, pos.west());
  boolean flag4 = canNorth && !canEast && canSouth && !canWest || !canNorth && canEast && !canSouth && canWest;
  return state.withProperty(UP, !flag4 || !worldIn.isAirBlock(pos.up())).withProperty(NORTH, canNorth).withProperty(EAST, canEast).withProperty(SOUTH, canSouth).withProperty(WEST, canWest);
}

代码示例来源:origin: lawremi/CustomOreGen

public boolean matchesAt(World world, Random rand, BlockPos pos) {
  return 
    this.descriptorMatchesAt(center, world, rand, pos) &&
    this.descriptorMatchesAt(above, world, rand, pos.up()) &&
    this.descriptorMatchesAt(below, world, rand, pos.down()) && 
    
    (this.descriptorMatchesAt(beside, world, rand, pos.north()) ||
    this.descriptorMatchesAt(beside, world, rand, pos.east()) ||
    this.descriptorMatchesAt(beside, world, rand, pos.south()) ||
    this.descriptorMatchesAt(beside, world, rand, pos.west())) &&
    
    this.touchesAt(world, rand, pos);
}

代码示例来源:origin: Ellpeck/ActuallyAdditions

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){
  boolean flag = this.canConnectTo(worldIn, pos.north());
  boolean flag1 = this.canConnectTo(worldIn, pos.east());
  boolean flag2 = this.canConnectTo(worldIn, pos.south());
  boolean flag3 = this.canConnectTo(worldIn, pos.west());
  boolean flag4 = flag && !flag1 && flag2 && !flag3 || !flag && flag1 && !flag2 && flag3;
  return state.withProperty(BlockWall.UP, !flag4 || !worldIn.isAirBlock(pos.up())).withProperty(BlockWall.NORTH, flag).withProperty(BlockWall.EAST, flag1).withProperty(BlockWall.SOUTH, flag2).withProperty(BlockWall.WEST, flag3);
}

代码示例来源:origin: MrCrayfish/MrCrayfishFurnitureMod

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
{
  boolean forward = world.getBlockState(pos.north()).getBlock() == this;
  boolean back = world.getBlockState(pos.south()).getBlock() == this;
  boolean left = world.getBlockState(pos.west()).getBlock() == this;
  boolean right = world.getBlockState(pos.east()).getBlock() == this;
  return state.withProperty(BACK, back).withProperty(FORWARD, forward).withProperty(LEFT, left).withProperty(RIGHT, right);
}

代码示例来源:origin: MrCrayfish/MrCrayfishFurnitureMod

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
{
  boolean back = world.getBlockState(pos.south()).getBlock() == this;
  boolean forward = world.getBlockState(pos.north()).getBlock() == this;
  boolean left = world.getBlockState(pos.west()).getBlock() == this;
  boolean right = world.getBlockState(pos.east()).getBlock() == this;
  return state.withProperty(BACK, back).withProperty(FORWARD, forward).withProperty(LEFT, left).withProperty(RIGHT, right);
}

相关文章