parent
00013865b0
commit
638d1d31de
9 changed files with 62 additions and 43 deletions
|
@ -144,7 +144,15 @@
|
|||
for(ResourcePackInfo resourcepackinfo : this.field_195577_ad.func_198980_d()) {
|
||||
if (stringbuilder.length() > 0) {
|
||||
stringbuilder.append(", ");
|
||||
@@ -1284,6 +1304,7 @@
|
||||
@@ -1275,6 +1295,7 @@
|
||||
this.func_184103_al().func_193244_w();
|
||||
this.field_200258_al.func_240946_a_(this.field_195576_ac.func_240960_a_());
|
||||
this.field_240765_ak_.func_195410_a(this.field_195576_ac.func_240970_h_());
|
||||
+ this.func_184103_al().func_181057_v().forEach(this.func_184103_al()::func_187243_f); //Forge: Fix newly added/modified commands not being sent to the client when commands reload.
|
||||
}, this);
|
||||
if (this.func_213162_bc()) {
|
||||
this.func_213161_c(completablefuture::isDone);
|
||||
@@ -1284,6 +1305,7 @@
|
||||
}
|
||||
|
||||
public static DatapackCodec func_240772_a_(ResourcePackList<ResourcePackInfo> p_240772_0_, DatapackCodec p_240772_1_, boolean p_240772_2_) {
|
||||
|
@ -152,7 +160,7 @@
|
|||
p_240772_0_.func_198983_a();
|
||||
if (p_240772_2_) {
|
||||
p_240772_0_.func_198985_a(Collections.singleton("vanilla"));
|
||||
@@ -1437,6 +1458,31 @@
|
||||
@@ -1437,6 +1459,31 @@
|
||||
|
||||
public abstract boolean func_213199_b(GameProfile p_213199_1_);
|
||||
|
||||
|
@ -184,7 +192,7 @@
|
|||
public void func_223711_a(Path p_223711_1_) throws IOException {
|
||||
Path path = p_223711_1_.resolve("levels");
|
||||
|
||||
@@ -1564,4 +1610,8 @@
|
||||
@@ -1564,4 +1611,8 @@
|
||||
public IServerConfiguration func_240793_aU_() {
|
||||
return this.field_240768_i_;
|
||||
}
|
||||
|
|
27
patches/minecraft/net/minecraft/util/RegistryKey.java.patch
Normal file
27
patches/minecraft/net/minecraft/util/RegistryKey.java.patch
Normal file
|
@ -0,0 +1,27 @@
|
|||
--- a/net/minecraft/util/RegistryKey.java
|
||||
+++ b/net/minecraft/util/RegistryKey.java
|
||||
@@ -6,7 +6,7 @@
|
||||
import java.util.function.Function;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
-public class RegistryKey<T> {
|
||||
+public class RegistryKey<T> implements Comparable<RegistryKey<?>> {
|
||||
private static final Map<String, RegistryKey<?>> field_240898_a_ = Collections.synchronizedMap(Maps.newIdentityHashMap());
|
||||
private final ResourceLocation field_240899_b_;
|
||||
private final ResourceLocation field_240900_c_;
|
||||
@@ -44,4 +44,15 @@
|
||||
return func_240903_a_(p_240902_0_, p_240907_1_);
|
||||
};
|
||||
}
|
||||
+
|
||||
+ public ResourceLocation getRegistryName() {
|
||||
+ return this.field_240899_b_;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int compareTo(RegistryKey<?> o) {
|
||||
+ int ret = this.getRegistryName().compareTo(o.getRegistryName());
|
||||
+ if (ret == 0) ret = this.func_240901_a_().compareTo(o.func_240901_a_());
|
||||
+ return ret;
|
||||
+ }
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/util/text/Style.java
|
||||
+++ b/net/minecraft/util/text/Style.java
|
||||
@@ -120,6 +120,18 @@
|
||||
@@ -118,6 +118,18 @@
|
||||
return new Style(this.field_150247_b, this.field_150248_c, p_240722_1_, this.field_150246_e, this.field_150243_f, this.field_150244_g, this.field_150251_h, this.field_150252_i, this.field_179990_j, this.field_240710_l_);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,21 +96,8 @@ public class ChunkGenWorker implements IWorker
|
|||
@Override
|
||||
public boolean doWork()
|
||||
{
|
||||
/*
|
||||
ServerWorld world = DimensionManager.getWorld(listener.getServer(), dim, false, false);
|
||||
if (world == null)
|
||||
{
|
||||
world = DimensionManager.initWorld(listener.getServer(), dim);
|
||||
if (world == null)
|
||||
{
|
||||
listener.sendFeedback(new TranslationTextComponent("commands.forge.gen.dim_fail", dim), true);
|
||||
queue.clear();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Check how many things are pending save, and slow down world gen if to many
|
||||
AnvilChunkLoader loader = world.getChunkProvider().chunkLoader instanceof AnvilChunkLoader ? (AnvilChunkLoader)world.getChunkProvider().chunkLoader : null;
|
||||
AnvilChunkLoader loader = dim.getChunkProvider().chunkLoader instanceof AnvilChunkLoader ? (AnvilChunkLoader)world.getChunkProvider().chunkLoader : null;
|
||||
if (loader != null && loader.getPendingSaveCount() > 100)
|
||||
{
|
||||
|
||||
|
@ -121,17 +108,17 @@ public class ChunkGenWorker implements IWorker
|
|||
}
|
||||
return false;
|
||||
}
|
||||
* /
|
||||
*/
|
||||
|
||||
BlockPos next = queue.poll();
|
||||
|
||||
if (next != null)
|
||||
{
|
||||
// While we work we don't want to cause world load spam so pause unloading the world.
|
||||
/* TODO: Readd if/when we introduce world unloading, or get Mojang to do it.
|
||||
if (keepingLoaded == null)
|
||||
{
|
||||
keepingLoaded = DimensionManager.keepLoaded(dim, true);
|
||||
}
|
||||
*/
|
||||
|
||||
if (++lastNotification >= notificationFrequency || lastNotifcationTime < System.currentTimeMillis() - 60*1000)
|
||||
{
|
||||
|
@ -143,10 +130,10 @@ public class ChunkGenWorker implements IWorker
|
|||
int x = next.getX();
|
||||
int z = next.getZ();
|
||||
|
||||
if (!world.chunkExists(x, z)) { //Chunk is unloaded
|
||||
IChunk chunk = world.getChunk(x, z, ChunkStatus.EMPTY, true);
|
||||
if (!dim.chunkExists(x, z)) { //Chunk is unloaded
|
||||
IChunk chunk = dim.getChunk(x, z, ChunkStatus.EMPTY, true);
|
||||
if (!chunk.getStatus().isAtLeast(ChunkStatus.FULL)) {
|
||||
chunk = world.getChunk(x, z, ChunkStatus.FULL);
|
||||
chunk = dim.getChunk(x, z, ChunkStatus.FULL);
|
||||
genned++; //There isn't a way to check if the chunk is actually created just if it was loaded
|
||||
}
|
||||
}
|
||||
|
@ -154,14 +141,13 @@ public class ChunkGenWorker implements IWorker
|
|||
|
||||
if (queue.size() == 0)
|
||||
{
|
||||
listener.sendFeedback(new TranslationTextComponent("commands.forge.gen.complete", genned, total, DimensionType.getKey(dim)), true);
|
||||
listener.sendFeedback(new TranslationTextComponent("commands.forge.gen.complete", genned, total, dim.func_234923_W_().func_240901_a_()), true);
|
||||
/* TODO: Readd if/when we introduce world unloading, or get Mojang to do it.
|
||||
if (keepingLoaded != null && !keepingLoaded)
|
||||
{
|
||||
DimensionManager.keepLoaded(dim, false);
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,11 @@ package net.minecraftforge.server.command;
|
|||
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.command.Commands;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -39,19 +42,13 @@ public class CommandDimensions
|
|||
.requires(cs->cs.hasPermissionLevel(0)) //permission
|
||||
.executes(ctx -> {
|
||||
ctx.getSource().sendFeedback(new TranslationTextComponent("commands.forge.dimensions.list"), true);
|
||||
/*
|
||||
Map<String, List<String>> types = new HashMap<>();
|
||||
for (DimensionType dim : DimensionType.getAll()) {
|
||||
String key = dim.getModType() == null ? "Vanilla" : dim.getModType().getRegistryName().toString();
|
||||
types.computeIfAbsent(key, k -> new ArrayList<>()).add(DimensionType.getKey(dim).toString());
|
||||
Map<ResourceLocation, List<ResourceLocation>> types = new HashMap<>();
|
||||
for (ServerWorld dim : ctx.getSource().getServer().getWorlds()) {
|
||||
types.computeIfAbsent(dim.func_234922_V_().func_240901_a_(), k -> new ArrayList<>()).add(dim.func_234923_W_().func_240901_a_());
|
||||
}
|
||||
|
||||
types.keySet().stream().sorted().forEach(key -> {
|
||||
ctx.getSource().sendFeedback(new StringTextComponent(key + ": " + types.get(key).stream().sorted().collect(Collectors.joining(", "))), false);
|
||||
});
|
||||
*/
|
||||
ctx.getSource().getServer().func_240770_D_().stream().sorted().forEach(key -> {
|
||||
ctx.getSource().sendFeedback(new StringTextComponent(key.func_240901_a_().toString()), false);
|
||||
ctx.getSource().sendFeedback(new StringTextComponent(key + ": " + types.get(key).stream().map(ResourceLocation::toString).sorted().collect(Collectors.joining(", "))), false);
|
||||
});
|
||||
return 0;
|
||||
});
|
||||
|
|
|
@ -69,7 +69,7 @@ class CommandEntity
|
|||
return Commands.literal("list")
|
||||
.requires(cs->cs.hasPermissionLevel(2)) //permission
|
||||
.then(Commands.argument("filter", StringArgumentType.string())
|
||||
.suggests((ctx, builder) -> ISuggestionProvider.suggest(ForgeRegistries.ENTITIES.getKeys().stream().map(ResourceLocation::toString), builder))
|
||||
.suggests((ctx, builder) -> ISuggestionProvider.suggest(ForgeRegistries.ENTITIES.getKeys().stream().map(ResourceLocation::toString).map(StringArgumentType::escapeIfRequired), builder))
|
||||
.then(Commands.argument("dim", DimensionArgument.getDimension())
|
||||
.executes(ctx -> execute(ctx.getSource(), StringArgumentType.getString(ctx, "filter"), DimensionArgument.getDimensionArgument(ctx, "dim").func_234923_W_()))
|
||||
)
|
||||
|
|
|
@ -44,7 +44,7 @@ public class CommandModList {
|
|||
modFile.getModInfos().get(0).getModId(),
|
||||
modFile.getModInfos().get(0).getVersion(),
|
||||
modFile.getModInfos().size())).
|
||||
collect(Collectors.joining("\n• ","• ", ""))),
|
||||
collect(Collectors.joining("\n\u2022 ","\n\u2022 ", ""))),
|
||||
false);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ class CommandTps
|
|||
for (ServerWorld dim : ctx.getSource().getServer().getWorlds())
|
||||
sendTime(ctx.getSource(), dim);
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
double meanTickTime = mean(ctx.getSource().getServer().tickTimeArray) * 1.0E-6D;
|
||||
double meanTPS = Math.min(1000.0/meanTickTime, 20);
|
||||
ctx.getSource().sendFeedback(new TranslationTextComponent("commands.forge.tps.summary.all", TIME_FORMATTER.format(meanTickTime), TIME_FORMATTER.format(meanTPS)), false);
|
||||
|
@ -62,7 +63,7 @@ class CommandTps
|
|||
|
||||
double worldTickTime = mean(times) * 1.0E-6D;
|
||||
double worldTPS = Math.min(1000.0 / worldTickTime, 20);
|
||||
cs.sendFeedback(new TranslationTextComponent("commands.forge.tps.summary.named", dim.func_234923_W_().toString(), dim.func_234922_V_().toString(), TIME_FORMATTER.format(worldTickTime), TIME_FORMATTER.format(worldTPS)), false);
|
||||
cs.sendFeedback(new TranslationTextComponent("commands.forge.tps.summary.named", dim.func_234923_W_().func_240901_a_().toString(), dim.func_234922_V_().func_240901_a_().toString(), TIME_FORMATTER.format(worldTickTime), TIME_FORMATTER.format(worldTPS)), false);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ class CommandTrack
|
|||
double averageTimings = data.getAverageTimings();
|
||||
String tickTime = (averageTimings > 1000 ? TIME_FORMAT.format(averageTimings / 1000) : TIME_FORMAT.format(averageTimings)) + (averageTimings < 1000 ? "\u03bcs" : "ms");
|
||||
|
||||
return new TranslationTextComponent("commands.forge.tracking.timing_entry", entity.getType().getRegistryName(), entity.world.func_234923_W_().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime);
|
||||
return new TranslationTextComponent("commands.forge.tracking.timing_entry", entity.getType().getRegistryName(), entity.world.func_234923_W_().func_240901_a_().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ class CommandTrack
|
|||
|
||||
double averageTimings = data.getAverageTimings();
|
||||
String tickTime = (averageTimings > 1000 ? TIME_FORMAT.format(averageTimings / 1000) : TIME_FORMAT.format(averageTimings)) + (averageTimings < 1000 ? "\u03bcs" : "ms");
|
||||
return new TranslationTextComponent("commands.forge.tracking.timing_entry", te.getType().getRegistryName(), te.getWorld().func_234923_W_().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime);
|
||||
return new TranslationTextComponent("commands.forge.tracking.timing_entry", te.getType().getRegistryName(), te.getWorld().func_234923_W_().func_240901_a_().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue