net.minecraft.util.Rotation类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(106)

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

Rotation介绍

暂无

代码示例

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

public EnumFacing getFacing(Rotation rotation) {
    return rotation.rotate(this.facing);
  }
}

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

public TemplateRuleVanillaSkull(World world, BlockPos pos, IBlockState state, int turns) {
  super(world, pos, state, turns);
  skullRotation = Rotation.values()[turns % 4].rotate(tag.getInteger("Rot"), 16);
}

代码示例来源:origin: PrinceOfAmber/Cyclic

public Rotation getRotation() {
 return Rotation.values()[this.rotation];
}

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

@Override
@SuppressWarnings("deprecation")
public void deserializeNBT(NBTTagCompound nbt) {
  building = Building.REGISTRY.get(new ResourceLocation(nbt.getString("Building")));
  pos = NBTHelper.readBlockPos("Building", nbt);
  //TODO: Remove in 0.7+
  if (nbt.hasKey("Direction")) {
    Direction direction = Direction.valueOf(nbt.getString("Direction"));
    rotation = direction.getRotation();
  } else rotation = Rotation.valueOf(nbt.getString("Rotation"));
}

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

@Override
  public int hashCode() {
    return (getRotation() == null ? 0 : getRotation().hashCode()) ^
        (getBuilding() == null ? 0 : getBuilding().hashCode());
  }
}

代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft

/**
 * This only sets the properties used by ITreeGenerator.addStructureToWorld
 *
 * @param rand For generating random settings
 * @return A set of placement settings with random rotation
 */
static PlacementSettings getRandomSettings(Random rand)
{
  return getDefaultSettings().setRotation(Rotation.values()[rand.nextInt(Rotation.values().length)]);
}

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

generator.setRotation(Rotation.valueOf(args[1].toUpperCase(Locale.ENGLISH)));
} catch (IllegalArgumentException e) {
  throw new CommandException("commands.spawnjc.notrot", args[1]);

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

public static EnumFacing rotate(Mirror mirror, Rotation rotation, EnumFacing original) {
  return rotation.rotate(mirror.mirror(original));
}

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

private TileEntitySkull setTileProperties(int turns, TileEntitySkull te) {
  te.setSkullRotation(Rotation.values()[turns % 4].rotate(skullRotation, 16));
  return te;
}

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

@Override
protected void growTree(World world, BlockPos pos) {
  Rotation rotation = Rotation.values()[world.rand.nextInt(Rotation.values().length)];
  template.placeBlocks(world, getAdjustedPositionBasedOnRotation(pos, rotation), rotation, null, ONLY_AIR);
}

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

@SuppressWarnings("deprecation")
public static BuildingStage readFromNBT(NBTTagCompound nbt) {
  BuildingStage stage = new BuildingStage();
  stage.building = Building.REGISTRY.get(new ResourceLocation(nbt.getString("CurrentlyBuilding")));
  stage.template = BuildingRegistry.INSTANCE.getTemplateForBuilding(stage.building);
  //TODO: Remove in 0.7+
  if (nbt.hasKey("Direction")) {
    Direction direction = Direction.valueOf(nbt.getString("Direction"));
    stage.rotation = direction.getRotation();
  } else stage.rotation = Rotation.valueOf(nbt.getString("Rotation"));
  stage.pos = new BlockPos(nbt.getInteger("BuildingX"), nbt.getInteger("BuildingY"), nbt.getInteger("BuildingZ"));
  if (nbt.hasKey("Stage")) {
    stage.index = nbt.getInteger("Index");
    stage.stage = ConstructionStage.values()[nbt.getInteger("Stage")];
  }
  return stage;
}

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

/**
 * Convert the BlockState into the correct metadata value.
 *
 * @deprecated (Remove this as soon as minecraft offers anything better).
 */
@NotNull
@Override
@Deprecated
public IBlockState withRotation(@NotNull final IBlockState state, final Rotation rot)
{
  return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
}

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

Template template = world.getStructureTemplateManager().getTemplate(server, PirateShips.SHIP_STRUCTURE);
PlacementSettings settings = new PlacementSettings();
settings.setRotation(Rotation.values()[random.nextInt(Rotation.values().length)]);
    EnumFacing chestFacing = settings.getRotation().rotate(EnumFacing.byName(chestOrientation));
    IBlockState chestState = Blocks.CHEST.getDefaultState().withProperty(BlockChest.FACING, chestFacing);
    world.setBlockState(dataPos, chestState);
  case "cannon":
    String dispenserOrientation = tokens[1];
    EnumFacing dispenserFacing = settings.getRotation().rotate(EnumFacing.byName(dispenserOrientation));
    IBlockState dispenserState = Blocks.DISPENSER.getDefaultState().withProperty(BlockDispenser.FACING, dispenserFacing);
    world.setBlockState(dataPos, dispenserState);

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

protected StructureGenerator(Random rand, int sizeX, int sizeY, int sizeZ) {
  this.horizontalPos = -1;
  this.sizeX = sizeX;
  this.sizeY = sizeY;
  this.sizeZ = sizeZ;
  Rotation[] rotations = Rotation.values();
  this.rotation = rotations[rand.nextInt(rotations.length)];
  Mirror[] mirrors = Mirror.values();
  this.mirror = mirrors[rand.nextInt(mirrors.length)];
}

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

@Nonnull
@Override
public IBlockState withRotation(@Nonnull IBlockState state, Rotation rot) {
  return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
}

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

@Override
  public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) {
    if(args.length == 1) {
      return getListOfStringsMatchingLastWord(args, Lists.newArrayList("visitor_center", "raptor_paddock"));
    } else if(args.length == 2) {
      return getListOfStringsMatchingLastWord(args, Stream.of(Rotation.values()).map(Enum::name).map(String::toLowerCase).collect(Collectors.toList()));
    } else if(args.length == 3) {
      return getListOfStringsMatchingLastWord(args, Stream.of(Mirror.values()).map(Enum::name).map(String::toLowerCase).collect(Collectors.toList()));
    }
    return Lists.newArrayList();
  }
}

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

@Nonnull
@Override
public IBlockState withRotation(@Nonnull IBlockState state, Rotation rot) {
  return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
}

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

@Override
  public IBlockState getState(int turns) {
    return super.getState(turns).withRotation(Rotation.values()[turns % 4]);
  }
}

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

@Override
public @Nonnull IBlockState withRotation(@Nonnull IBlockState state, @Nonnull Rotation rot) {
 return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
}

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

public TemplateRuleBanner(World world, BlockPos pos, IBlockState state, int turns) {
  super(world, pos, state.getBlock() == Blocks.STANDING_BANNER ? BlockTools.rotateFacing(state.withRotation(Rotation.values()[turns % 4]), turns) : state, turns);
}

相关文章

微信公众号

最新文章

更多