net.minecraft.util.EnumFacing.rotateYCCW()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(104)

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

EnumFacing.rotateYCCW介绍

暂无

代码示例

代码示例来源:origin: raoulvdberge/refinedstorage

public EnumFacing cycle(EnumFacing previous) {
    switch (this) {
      case ANY:
      case ANY_FACE_PLAYER:
        return previous.ordinal() + 1 >= EnumFacing.VALUES.length ? EnumFacing.VALUES[0] : EnumFacing.VALUES[previous.ordinal() + 1];
      case HORIZONTAL:
        return previous.rotateYCCW();
      default:
        return previous;
    }
  }
}

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

@Override
@SideOnly(Side.CLIENT)
public List<Pair<IBlockState, ItemStack>> mapItemRender(@Nonnull Block block, @Nonnull ItemStack stack, @Nonnull ItemQuadCollector itemQuadCollector) {
 List<Pair<IBlockState, ItemStack>> states = new ArrayList<Pair<IBlockState, ItemStack>>();
 IBlockState defaultState = block.getDefaultState();
 states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.sides), (ItemStack) null));
 for (EnumFacing facing : EnumFacing.Plane.HORIZONTAL) {
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, EnumFacing.UP)), (ItemStack) null));
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, EnumFacing.DOWN)), (ItemStack) null));
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, facing.rotateYCCW())), (ItemStack) null));
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, facing.rotateYCCW(), EnumFacing.UP)), (ItemStack) null));
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, facing.rotateYCCW(), EnumFacing.DOWN)), (ItemStack) null));
 }
 return states;
}

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

@Override
protected Set<BlockPos> getAdditionalPartPositions(BlockPos pos, EnumFacing facing) {
  return ImmutableSet.of(pos.offset(facing.rotateY()), pos.offset(facing.rotateYCCW()));
}

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

@Override
@SideOnly(Side.CLIENT)
public List<Pair<IBlockState, ItemStack>> mapItemRender(@Nonnull Block block, @Nonnull ItemStack stack, @Nonnull ItemQuadCollector itemQuadCollector) {
 List<Pair<IBlockState, ItemStack>> states = new ArrayList<Pair<IBlockState, ItemStack>>();
 IBlockState defaultState = block.getDefaultState();
 SolarType bankType = SolarType.getTypeFromMeta(stack.getItemDamage());
 defaultState = defaultState.withProperty(SolarType.KIND, bankType);
 states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.sides), (ItemStack) null));
 for (EnumFacing facing : EnumFacing.Plane.HORIZONTAL) {
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, EnumFacing.DOWN)), (ItemStack) null));
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, facing.rotateYCCW(), EnumFacing.DOWN)), (ItemStack) null));
 }
 return states;
}

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

@Override
@SideOnly(Side.CLIENT)
public List<Pair<IBlockState, ItemStack>> mapItemRender(@Nonnull Block block, @Nonnull ItemStack stack, @Nonnull ItemQuadCollector itemQuadCollector) {
 List<Pair<IBlockState, ItemStack>> states = new ArrayList<Pair<IBlockState, ItemStack>>();
 IBlockState defaultState = block.getDefaultState();
 states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.sides).withProperty(CapBankType.KIND, CapBankType.NONE), (ItemStack) null));
 CapBankType bankType = CapBankType.getTypeFromMeta(stack.getItemDamage());
 defaultState = defaultState.withProperty(CapBankType.KIND, bankType);
 for (EnumFacing facing : EnumFacing.Plane.HORIZONTAL) {
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, EnumFacing.UP)), (ItemStack) null));
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, EnumFacing.DOWN)), (ItemStack) null));
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, facing.rotateYCCW())), (ItemStack) null));
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, facing.rotateYCCW(), EnumFacing.UP)), (ItemStack) null));
  states.add(Pair.of(defaultState.withProperty(RENDER, EnumMergingBlockRenderMode.get(facing, facing.rotateYCCW(), EnumFacing.DOWN)), (ItemStack) null));
 }
 return states;
}

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

@Override
protected Set<BlockPos> getAdditionalPartPositions(BlockPos pos, EnumFacing facing) {
  return ImmutableSet.of(pos.up(), pos.offset(facing.rotateY()), pos.offset(facing.rotateYCCW()));
}

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

EnumFacing rotate(VertexTransform xForm, EnumFacing dir) {
 if (xForm instanceof VertexRotationFacing) {
  double angle = ((VertexRotationFacing) xForm).getAngle();
  if (angle < ROTATION_AMOUNT * 0.5 || angle >= ROTATION_AMOUNT * 3.5) {
   return dir;
  } else if (angle >= ROTATION_AMOUNT * 0.5 && angle < ROTATION_AMOUNT * 1.5) {
   return dir.rotateY();
  } else if (angle >= ROTATION_AMOUNT * 1.5 && angle < ROTATION_AMOUNT * 2.5) {
   return dir.getOpposite();
  } else if (angle >= ROTATION_AMOUNT * 2.5 && angle < ROTATION_AMOUNT * 3.5) {
   return dir.rotateYCCW();
  }
 }
 return dir;
}

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

public EnumFacing rotateFacing(EnumFacing facing, EnumFacing rotation)
{
  switch (rotation)
  {
  case EAST:
    return facing.rotateY();
  case SOUTH:
    return facing.rotateY().rotateY();
  case WEST:
    return facing.rotateYCCW();
  case NORTH:
  default:
    return facing;
  }
}

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

/**
 * Move the structure left.
 */
private void moveLeftClicked()
{
  Settings.instance.moveTo(new BlockPos(0, 0, 0).offset(this.mc.player.getHorizontalFacing().rotateYCCW()));
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

public BlockPos getOpposite(BlockPos pos, IBlockState state) {
  EnumFacing facing = state.getValue(FACING);
  BlockHalf half = state.getValue(HALF);
  return pos.offset(half == BlockHalf.MAIN ? facing.rotateYCCW() : facing.rotateY());
}

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

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
  EnumFacing facing = state.getValue(FACING);
  return state.withProperty(LEFT, worldIn.getBlockState(pos.offset(facing.rotateYCCW())).getBlock() instanceof BlockBlinds);
}

代码示例来源:origin: TeamWizardry/Wizardry

private BlockPos getOtherTableBlock(IBlockState tablePart, BlockPos tablePartPos) {
  return tablePartPos.offset(tablePart.getValue(ISLEFTSIDE) ? tablePart.getValue(FACING).rotateYCCW() : tablePart.getValue(FACING).rotateY());
}

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

@Override
public void placeAdditionalParts(World world, BlockPos pos, EnumFacing facing) {
  placeSideBlock(world, pos, pos.offset(facing.rotateY()), facing.getOpposite());
  placeSideBlock(world, pos, pos.offset(facing.rotateYCCW()), facing);
}

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

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
  EnumFacing facing = state.getValue(FACING);
  EnumFacing offset = state.getValue(HINGE) == BlockDoor.EnumHingePosition.LEFT ? facing.rotateY() : facing.rotateYCCW();
  IBlockState adjacentBlock = worldIn.getBlockState(pos.offset(offset));
  return state.withProperty(POLE, !(adjacentBlock.getBlock() instanceof BlockUpgradedGate));
}

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

private static BlockPos getBlockPosRelativeTo(IBlockAccess world, BlockPos pos, EnumFacing facing, Direction dir)
{
  switch(dir)
  {
    case LEFT:
      return pos.offset(facing.rotateY());
    case RIGHT:
      return pos.offset(facing.rotateYCCW());
    case UP:
      return pos.offset(facing);
    case DOWN:
      return pos.offset(facing.getOpposite());
    default:
      return pos;
  }
}

代码示例来源:origin: RS485/LogisticsPipes

private static void removeIfHasConnectedSide(List<PipeMount> mountCanidates) {
  boolean sides[] = new boolean[6];
  for (PipeMount mount : mountCanidates) {
    sides[mount.dir.ordinal()] = true;
  }
  for (int i = 2; i < 6; i++) {
    EnumFacing dir = EnumFacing.getFront(i);
    EnumFacing rot = dir.rotateY();
    if (sides[dir.ordinal()] && sides[rot.ordinal()]) {
      reduceToOnePerSide(mountCanidates, dir, dir.rotateYCCW());
      reduceToOnePerSide(mountCanidates, rot, rot.rotateY());
    }
  }
}

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

@Override
public void placeAdditionalParts(World world, BlockPos pos, EnumFacing facing) {
  world.setBlockState(pos.up(), AWStructureBlocks.TOTEM_PART.getDefaultState().withProperty(VISIBLE, false));
  WorldTools.getTile(world, pos.up(), TileTotemPart.class).ifPresent(t -> t.setMainBlockPos(pos));
  placeWingBlock(world, pos, pos.offset(facing.rotateY()), facing.getOpposite());
  placeWingBlock(world, pos, pos.offset(facing.rotateYCCW()), facing);
}

代码示例来源:origin: thraaawn/CompactMachines

public BlockPos getInvalidBlockInField(int magnitude) {
  if(!isMaster()) {
    return null;
  }
  int fieldDimension = (magnitude+1) * 2 - 1;
  BlockPos center = this.getPos().offset(this.getDirection(), magnitude);
  BlockPos topLeft = center.offset(EnumFacing.UP, magnitude).offset(this.getDirection().rotateYCCW(), magnitude);
  List<BlockPos> positionsToCheck = StructureTools.getCubePositions(topLeft, fieldDimension, fieldDimension, fieldDimension, false);
  for(BlockPos pos : positionsToCheck) {
    if(!getWorld().isAirBlock(pos)) {
      return pos;
    }
  }
  return null;
}

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

private boolean canJoeSee(EntityLivingBase ent) {
 Vec3d entPos = new Vec3d(ent.posX, ent.posY + ent.getEyeHeight(), ent.posZ);
 for (EnumFacing facing1 : new EnumFacing[] { facing, facing.rotateY(), facing.rotateYCCW() }) {
  if (this.world.rayTraceBlocks(new Vec3d(getPos().getX() + faceMidPoints[facing1.ordinal()][0], getPos().getY() + faceMidPoints[facing1.ordinal()][1],
    getPos().getZ() + faceMidPoints[facing1.ordinal()][2]), entPos) == null)
   return true;
 }
 return false;
}

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

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
  boolean open = !state.getValue(OPENED);
  worldIn.setBlockState(pos, state.withProperty(OPENED, open));
  EnumFacing rot = state.getValue(FACING);
  EnumFacing offset = state.getValue(HINGE) == BlockDoor.EnumHingePosition.LEFT ? rot.rotateY() : rot.rotateYCCW();
  IBlockState adjacentBlock = worldIn.getBlockState(pos.offset(offset));
  if(adjacentBlock.getBlock() instanceof BlockUpgradedGate && adjacentBlock.getValue(FACING) == rot && adjacentBlock.getValue(HINGE) != state.getValue(HINGE))
  {
    worldIn.setBlockState(pos.offset(offset), adjacentBlock.withProperty(OPENED, open));
  }
  this.openGate(worldIn, pos, EnumFacing.UP, rot, state.getValue(HINGE), open, 4);
  this.openGate(worldIn, pos, EnumFacing.DOWN, rot, state.getValue(HINGE), open, 4);
  worldIn.playEvent(playerIn, state.getValue(OPENED) ? 1008 : 1014, pos, 0);
  return true;
}

相关文章