mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
65bc2541a3
By: md_5 <git@md-5.net>
209 lines
13 KiB
Diff
209 lines
13 KiB
Diff
--- a/net/minecraft/world/level/GameRules.java
|
|
+++ b/net/minecraft/world/level/GameRules.java
|
|
@@ -55,7 +55,7 @@
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> RULE_SENDCOMMANDFEEDBACK = register("sendCommandFeedback", GameRules.GameRuleCategory.CHAT, GameRules.GameRuleBoolean.create(true));
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> RULE_REDUCEDDEBUGINFO = register("reducedDebugInfo", GameRules.GameRuleCategory.MISC, GameRules.GameRuleBoolean.create(false, (minecraftserver, gamerules_gameruleboolean) -> {
|
|
int i = gamerules_gameruleboolean.get() ? 22 : 23;
|
|
- Iterator iterator = minecraftserver.getPlayerList().getPlayers().iterator();
|
|
+ Iterator iterator = minecraftserver.players().iterator(); // CraftBukkit - per-world
|
|
|
|
while (iterator.hasNext()) {
|
|
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
|
@@ -70,7 +70,7 @@
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleInt> RULE_MAX_ENTITY_CRAMMING = register("maxEntityCramming", GameRules.GameRuleCategory.MOBS, GameRules.GameRuleInt.create(24));
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> RULE_WEATHER_CYCLE = register("doWeatherCycle", GameRules.GameRuleCategory.UPDATES, GameRules.GameRuleBoolean.create(true));
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> RULE_LIMITED_CRAFTING = register("doLimitedCrafting", GameRules.GameRuleCategory.PLAYER, GameRules.GameRuleBoolean.create(false, (minecraftserver, gamerules_gameruleboolean) -> {
|
|
- Iterator iterator = minecraftserver.getPlayerList().getPlayers().iterator();
|
|
+ Iterator iterator = minecraftserver.players().iterator(); // CraftBukkit - per-world
|
|
|
|
while (iterator.hasNext()) {
|
|
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
|
@@ -86,7 +86,7 @@
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> RULE_DISABLE_RAIDS = register("disableRaids", GameRules.GameRuleCategory.MOBS, GameRules.GameRuleBoolean.create(false));
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> RULE_DOINSOMNIA = register("doInsomnia", GameRules.GameRuleCategory.SPAWNING, GameRules.GameRuleBoolean.create(true));
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> RULE_DO_IMMEDIATE_RESPAWN = register("doImmediateRespawn", GameRules.GameRuleCategory.PLAYER, GameRules.GameRuleBoolean.create(false, (minecraftserver, gamerules_gameruleboolean) -> {
|
|
- Iterator iterator = minecraftserver.getPlayerList().getPlayers().iterator();
|
|
+ Iterator iterator = minecraftserver.players().iterator(); // CraftBukkit - per-world
|
|
|
|
while (iterator.hasNext()) {
|
|
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
|
@@ -117,7 +117,7 @@
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> RULE_DO_VINES_SPREAD = register("doVinesSpread", GameRules.GameRuleCategory.UPDATES, GameRules.GameRuleBoolean.create(true));
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> RULE_ENDER_PEARLS_VANISH_ON_DEATH = register("enderPearlsVanishOnDeath", GameRules.GameRuleCategory.PLAYER, GameRules.GameRuleBoolean.create(true));
|
|
public static final GameRules.GameRuleKey<GameRules.GameRuleInt> RULE_SPAWN_CHUNK_RADIUS = register("spawnChunkRadius", GameRules.GameRuleCategory.MISC, GameRules.GameRuleInt.create(2, 0, 32, (minecraftserver, gamerules_gameruleint) -> {
|
|
- WorldServer worldserver = minecraftserver.overworld();
|
|
+ WorldServer worldserver = minecraftserver; // CraftBukkit - per-world
|
|
|
|
worldserver.setDefaultSpawnPos(worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle());
|
|
}));
|
|
@@ -150,7 +150,7 @@
|
|
}
|
|
|
|
public <T extends GameRules.GameRuleValue<T>> T getRule(GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
|
- return (GameRules.GameRuleValue) this.rules.get(gamerules_gamerulekey);
|
|
+ return (T) this.rules.get(gamerules_gamerulekey); // CraftBukkit - decompile error
|
|
}
|
|
|
|
public NBTTagCompound createTag() {
|
|
@@ -164,7 +164,7 @@
|
|
|
|
private void loadFromTag(DynamicLike<?> dynamiclike) {
|
|
this.rules.forEach((gamerules_gamerulekey, gamerules_gamerulevalue) -> {
|
|
- DataResult dataresult = dynamiclike.get(gamerules_gamerulekey.id).asString();
|
|
+ DataResult<String> dataresult = dynamiclike.get(gamerules_gamerulekey.id).asString(); // CraftBukkit - decompile error
|
|
|
|
Objects.requireNonNull(gamerules_gamerulevalue);
|
|
dataresult.ifSuccess(gamerules_gamerulevalue::deserialize);
|
|
@@ -184,17 +184,17 @@
|
|
}
|
|
|
|
private static <T extends GameRules.GameRuleValue<T>> void callVisitorCap(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<?> gamerules_gamerulekey, GameRules.GameRuleDefinition<?> gamerules_gameruledefinition) {
|
|
- gamerules_gamerulevisitor.visit(gamerules_gamerulekey, gamerules_gameruledefinition);
|
|
- gamerules_gameruledefinition.callVisitor(gamerules_gamerulevisitor, gamerules_gamerulekey);
|
|
+ gamerules_gamerulevisitor.visit((GameRules.GameRuleKey<T>) gamerules_gamerulekey, (GameRules.GameRuleDefinition<T>) gamerules_gameruledefinition); // CraftBukkit - decompile error
|
|
+ ((GameRules.GameRuleDefinition<T>) gamerules_gameruledefinition).callVisitor(gamerules_gamerulevisitor, (GameRules.GameRuleKey<T>) gamerules_gamerulekey); // CraftBukkit - decompile error
|
|
}
|
|
|
|
- public void assignFrom(GameRules gamerules, @Nullable MinecraftServer minecraftserver) {
|
|
+ public void assignFrom(GameRules gamerules, @Nullable WorldServer minecraftserver) { // CraftBukkit - per-world
|
|
gamerules.rules.keySet().forEach((gamerules_gamerulekey) -> {
|
|
this.assignCap(gamerules_gamerulekey, gamerules, minecraftserver);
|
|
});
|
|
}
|
|
|
|
- private <T extends GameRules.GameRuleValue<T>> void assignCap(GameRules.GameRuleKey<T> gamerules_gamerulekey, GameRules gamerules, @Nullable MinecraftServer minecraftserver) {
|
|
+ private <T extends GameRules.GameRuleValue<T>> void assignCap(GameRules.GameRuleKey<T> gamerules_gamerulekey, GameRules gamerules, @Nullable WorldServer minecraftserver) { // CraftBukkit - per-world
|
|
T t0 = gamerules.getRule(gamerules_gamerulekey);
|
|
|
|
this.getRule(gamerules_gamerulekey).setFrom(t0, minecraftserver);
|
|
@@ -262,10 +262,10 @@
|
|
|
|
final Supplier<ArgumentType<?>> argument;
|
|
private final Function<GameRules.GameRuleDefinition<T>, T> constructor;
|
|
- final BiConsumer<MinecraftServer, T> callback;
|
|
+ final BiConsumer<WorldServer, T> callback; // CraftBukkit - per-world
|
|
private final GameRules.h<T> visitorCaller;
|
|
|
|
- GameRuleDefinition(Supplier<ArgumentType<?>> supplier, Function<GameRules.GameRuleDefinition<T>, T> function, BiConsumer<MinecraftServer, T> biconsumer, GameRules.h<T> gamerules_h) {
|
|
+ GameRuleDefinition(Supplier<ArgumentType<?>> supplier, Function<GameRules.GameRuleDefinition<T>, T> function, BiConsumer<WorldServer, T> biconsumer, GameRules.h<T> gamerules_h) { // CraftBukkit - per-world
|
|
this.argument = supplier;
|
|
this.constructor = function;
|
|
this.callback = biconsumer;
|
|
@@ -277,7 +277,7 @@
|
|
}
|
|
|
|
public T createRule() {
|
|
- return (GameRules.GameRuleValue) this.constructor.apply(this);
|
|
+ return this.constructor.apply(this); // CraftBukkit - decompile error
|
|
}
|
|
|
|
public void callVisitor(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
|
@@ -297,17 +297,17 @@
|
|
|
|
public void setFromArgument(CommandContext<CommandListenerWrapper> commandcontext, String s) {
|
|
this.updateFromArgument(commandcontext, s);
|
|
- this.onChanged(((CommandListenerWrapper) commandcontext.getSource()).getServer());
|
|
+ this.onChanged(((CommandListenerWrapper) commandcontext.getSource()).getLevel()); // CraftBukkit - per-world
|
|
}
|
|
|
|
- public void onChanged(@Nullable MinecraftServer minecraftserver) {
|
|
+ public void onChanged(@Nullable WorldServer minecraftserver) { // CraftBukkit - per-world
|
|
if (minecraftserver != null) {
|
|
this.type.callback.accept(minecraftserver, this.getSelf());
|
|
}
|
|
|
|
}
|
|
|
|
- protected abstract void deserialize(String s);
|
|
+ public abstract void deserialize(String s); // PAIL - private->public
|
|
|
|
public abstract String serialize();
|
|
|
|
@@ -321,7 +321,7 @@
|
|
|
|
protected abstract T copy();
|
|
|
|
- public abstract void setFrom(T t0, @Nullable MinecraftServer minecraftserver);
|
|
+ public abstract void setFrom(T t0, @Nullable WorldServer minecraftserver); // CraftBukkit - per-world
|
|
}
|
|
|
|
public interface GameRuleVisitor {
|
|
@@ -337,7 +337,7 @@
|
|
|
|
private boolean value;
|
|
|
|
- static GameRules.GameRuleDefinition<GameRules.GameRuleBoolean> create(boolean flag, BiConsumer<MinecraftServer, GameRules.GameRuleBoolean> biconsumer) {
|
|
+ static GameRules.GameRuleDefinition<GameRules.GameRuleBoolean> create(boolean flag, BiConsumer<WorldServer, GameRules.GameRuleBoolean> biconsumer) { // CraftBukkit - per-world
|
|
return new GameRules.GameRuleDefinition<>(BoolArgumentType::bool, (gamerules_gameruledefinition) -> {
|
|
return new GameRules.GameRuleBoolean(gamerules_gameruledefinition, flag);
|
|
}, biconsumer, GameRules.GameRuleVisitor::visitBoolean);
|
|
@@ -362,7 +362,7 @@
|
|
return this.value;
|
|
}
|
|
|
|
- public void set(boolean flag, @Nullable MinecraftServer minecraftserver) {
|
|
+ public void set(boolean flag, @Nullable WorldServer minecraftserver) { // CraftBukkit - per-world
|
|
this.value = flag;
|
|
this.onChanged(minecraftserver);
|
|
}
|
|
@@ -373,7 +373,7 @@
|
|
}
|
|
|
|
@Override
|
|
- protected void deserialize(String s) {
|
|
+ public void deserialize(String s) { // PAIL - protected->public
|
|
this.value = Boolean.parseBoolean(s);
|
|
}
|
|
|
|
@@ -392,7 +392,7 @@
|
|
return new GameRules.GameRuleBoolean(this.type, this.value);
|
|
}
|
|
|
|
- public void setFrom(GameRules.GameRuleBoolean gamerules_gameruleboolean, @Nullable MinecraftServer minecraftserver) {
|
|
+ public void setFrom(GameRules.GameRuleBoolean gamerules_gameruleboolean, @Nullable WorldServer minecraftserver) { // CraftBukkit - per-world
|
|
this.value = gamerules_gameruleboolean.value;
|
|
this.onChanged(minecraftserver);
|
|
}
|
|
@@ -402,13 +402,13 @@
|
|
|
|
private int value;
|
|
|
|
- private static GameRules.GameRuleDefinition<GameRules.GameRuleInt> create(int i, BiConsumer<MinecraftServer, GameRules.GameRuleInt> biconsumer) {
|
|
+ private static GameRules.GameRuleDefinition<GameRules.GameRuleInt> create(int i, BiConsumer<WorldServer, GameRules.GameRuleInt> biconsumer) { // CraftBukkit - per-world
|
|
return new GameRules.GameRuleDefinition<>(IntegerArgumentType::integer, (gamerules_gameruledefinition) -> {
|
|
return new GameRules.GameRuleInt(gamerules_gameruledefinition, i);
|
|
}, biconsumer, GameRules.GameRuleVisitor::visitInteger);
|
|
}
|
|
|
|
- static GameRules.GameRuleDefinition<GameRules.GameRuleInt> create(int i, int j, int k, BiConsumer<MinecraftServer, GameRules.GameRuleInt> biconsumer) {
|
|
+ static GameRules.GameRuleDefinition<GameRules.GameRuleInt> create(int i, int j, int k, BiConsumer<WorldServer, GameRules.GameRuleInt> biconsumer) { // CraftBukkit - per-world
|
|
return new GameRules.GameRuleDefinition<>(() -> {
|
|
return IntegerArgumentType.integer(j, k);
|
|
}, (gamerules_gameruledefinition) -> {
|
|
@@ -435,7 +435,7 @@
|
|
return this.value;
|
|
}
|
|
|
|
- public void set(int i, @Nullable MinecraftServer minecraftserver) {
|
|
+ public void set(int i, @Nullable WorldServer minecraftserver) { // CraftBukkit - per-world
|
|
this.value = i;
|
|
this.onChanged(minecraftserver);
|
|
}
|
|
@@ -446,7 +446,7 @@
|
|
}
|
|
|
|
@Override
|
|
- protected void deserialize(String s) {
|
|
+ public void deserialize(String s) { // PAIL - protected->public
|
|
this.value = safeParse(s);
|
|
}
|
|
|
|
@@ -488,7 +488,7 @@
|
|
return new GameRules.GameRuleInt(this.type, this.value);
|
|
}
|
|
|
|
- public void setFrom(GameRules.GameRuleInt gamerules_gameruleint, @Nullable MinecraftServer minecraftserver) {
|
|
+ public void setFrom(GameRules.GameRuleInt gamerules_gameruleint, @Nullable WorldServer minecraftserver) { // CraftBukkit - per-world
|
|
this.value = gamerules_gameruleint.value;
|
|
this.onChanged(minecraftserver);
|
|
}
|