コード例 #1
0
  @Override
  public List addTabCompletionOptions(ICommandSender commandSender, String[] args) {
    if (args.length == 1)
      return getListOfStringsFromIterableMatchingLastWord(
          args, StructureRegistry.INSTANCE.allStructureIDs());
    else if (args.length == 2 || args.length == 3 || args.length == 4) {
      return getListOfStringsMatchingLastWord(args, "~");
    }

    return null;
  }
コード例 #2
0
  @Override
  public void processCommand(ICommandSender commandSender, String[] args) {
    int x, y, z;

    if (args.length <= 0) {
      throw ServerTranslations.wrongUsageException("commands.strucImport.usage");
    }

    String structureName = args[0];
    StructureInfo structureInfo = StructureRegistry.INSTANCE.getStructure(structureName);
    World world = commandSender.getEntityWorld();

    if (structureInfo == null) {
      throw ServerTranslations.commandException("commands.strucImport.noStructure", structureName);
    }

    x = commandSender.getPlayerCoordinates().posX;
    y = commandSender.getPlayerCoordinates().posY;
    z = commandSender.getPlayerCoordinates().posZ;

    if (args.length >= 4) {
      x = MathHelper.floor_double(func_110666_a(commandSender, (double) x, args[1]));
      y = MathHelper.floor_double(func_110666_a(commandSender, (double) y, args[2]));
      z = MathHelper.floor_double(func_110666_a(commandSender, (double) z, args[3]));
    }

    AxisAlignedTransform2D transform = AxisAlignedTransform2D.ORIGINAL;
    BlockCoord coord = new BlockCoord(x, y, z);

    if (structureInfo instanceof GenericStructureInfo)
      OperationRegistry.queueOperation(
          new OperationGenerateStructure(
              (GenericStructureInfo) structureInfo, transform, coord, true),
          commandSender);
    else
      StructureGenerator.directly(
          structureInfo,
          StructureSpawnContext.complete(
              world, world.rand, transform, coord, structureInfo, 0, true));
  }
コード例 #3
0
 @Override
 public void clearCustomFiles() {
   StructureRegistry.INSTANCE.clearCustom();
 }