Fix errors in commands and getDimension->getId
This commit is contained in:
parent
c59caa4b92
commit
e3a931bf96
6 changed files with 13 additions and 11 deletions
|
@ -75,7 +75,7 @@ public class WorldSpecificSaveHandler implements ISaveHandler
|
|||
File file = new File(dataDir, name + ".dat");
|
||||
if (!file.exists())
|
||||
{
|
||||
switch (world.provider.getDimension())
|
||||
switch (world.provider.getId())
|
||||
{
|
||||
case -1:
|
||||
if (name.equalsIgnoreCase("FORTRESS")) copyFile(name, file);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class BlockSnapshot
|
|||
public BlockSnapshot(World world, BlockPos pos, IBlockState state, @Nullable NBTTagCompound nbt)
|
||||
{
|
||||
this.setWorld(world);
|
||||
this.dimId = world.provider.getDimension();
|
||||
this.dimId = world.provider.getId();
|
||||
this.pos = pos.toImmutable();
|
||||
this.setReplacedBlock(state);
|
||||
this.registryName = state.getBlock().getRegistryName();
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.google.common.collect.Maps;
|
|||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
|
||||
|
@ -78,12 +79,12 @@ class CommandEntity
|
|||
.suggests((ctx, builder) -> ISuggestionProvider.func_197013_a(DimensionManager.getIDStream().sorted().map(id -> id.toString()), builder))
|
||||
.executes(ctx -> execute(ctx.getSource(), StringArgumentType.getString(ctx, "filter"), IntegerArgumentType.getInteger(ctx, "dim")))
|
||||
)
|
||||
.executes(ctx -> execute(ctx.getSource(), StringArgumentType.getString(ctx, "filter"), ctx.getSource().func_197023_e().provider.getDimension()))
|
||||
.executes(ctx -> execute(ctx.getSource(), StringArgumentType.getString(ctx, "filter"), ctx.getSource().func_197023_e().provider.getId()))
|
||||
)
|
||||
.executes(ctx -> execute(ctx.getSource(), "*", ctx.getSource().func_197023_e().provider.getDimension()));
|
||||
.executes(ctx -> execute(ctx.getSource(), "*", ctx.getSource().func_197023_e().provider.getId()));
|
||||
}
|
||||
|
||||
private static int execute(CommandSource sender, String filter, int dim) throws CommandException
|
||||
private static int execute(CommandSource sender, String filter, int dim) throws CommandSyntaxException
|
||||
{
|
||||
final String cleanFilter = filter.replace("?", ".?").replace("*", ".*?");
|
||||
|
||||
|
@ -128,6 +129,7 @@ class CommandEntity
|
|||
if (limit-- == 0) break;
|
||||
sender.func_197030_a(new TextComponentString(" " + e.getValue() + ": " + e.getKey().x + ", " + e.getKey().z), true);
|
||||
}
|
||||
return toSort.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -153,6 +155,7 @@ class CommandEntity
|
|||
int count = info.stream().mapToInt(Pair::getRight).sum();
|
||||
sender.func_197030_a(new TextComponentTranslation("commands.forge.entity.list.multiple.header", count), true);
|
||||
info.forEach(e -> sender.func_197030_a(new TextComponentString(" " + e.getValue() + ": " + e.getKey()), true));
|
||||
return info.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class CommandGenerate
|
|||
)
|
||||
.executes(ctx -> execute(ctx.getSource(), BlockPosArgument.func_197274_b(ctx, "pos"), getInt(ctx, "count"), getInt(ctx, "dim"), -1))
|
||||
)
|
||||
.executes(ctx -> execute(ctx.getSource(), BlockPosArgument.func_197274_b(ctx, "pos"), getInt(ctx, "count"), ctx.getSource().func_197023_e().provider.getDimension(), -1))
|
||||
.executes(ctx -> execute(ctx.getSource(), BlockPosArgument.func_197274_b(ctx, "pos"), getInt(ctx, "count"), ctx.getSource().func_197023_e().provider.getId(), -1))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -76,5 +76,7 @@ class CommandGenerate
|
|||
ChunkGenWorker worker = new ChunkGenWorker(source, chunkpos, count, dim, interval);
|
||||
source.func_197030_a(worker.getStartMessage(source), true);
|
||||
WorldWorkerManager.addWorker(worker);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,13 +19,10 @@
|
|||
|
||||
package net.minecraftforge.server.command;
|
||||
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.command.Commands;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.ISuggestionProvider;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.command.arguments.BlockPosArgument;
|
||||
import net.minecraft.command.arguments.EntityArgument;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
|
|
@ -185,7 +185,7 @@ class CommandTrack
|
|||
double averageTimings = data.getAverageTimings();
|
||||
String tickTime = (averageTimings > 1000 ? TIME_FORMAT.format(averageTimings / 1000) : TIME_FORMAT.format(averageTimings)) + (averageTimings < 1000 ? "µs" : "ms");
|
||||
|
||||
return new TextComponentTranslation("commands.forge.tracking.timing_entry", entity.func_200600_R().getRegistryName(), TrackResults.getWorldName(entity.world.provider.getDimension()), pos.getX(), pos.getY(), pos.getZ(), tickTime);
|
||||
return new TextComponentTranslation("commands.forge.tracking.timing_entry", entity.func_200600_R().getRegistryName(), TrackResults.getWorldName(entity.world.provider.getId()), pos.getX(), pos.getY(), pos.getZ(), tickTime);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ class CommandTrack
|
|||
|
||||
double averageTimings = data.getAverageTimings();
|
||||
String tickTime = (averageTimings > 1000 ? TIME_FORMAT.format(averageTimings / 1000) : TIME_FORMAT.format(averageTimings)) + (averageTimings < 1000 ? "µs" : "ms");
|
||||
return new TextComponentTranslation("commands.forge.tracking.timing_entry", te.func_200662_C().getRegistryName(), TrackResults.getWorldName(te.getWorld().provider.getDimension()), pos.getX(), pos.getY(), pos.getZ(), tickTime);
|
||||
return new TextComponentTranslation("commands.forge.tracking.timing_entry", te.func_200662_C().getRegistryName(), TrackResults.getWorldName(te.getWorld().provider.getId()), pos.getX(), pos.getY(), pos.getZ(), tickTime);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue