From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers Date: Tue, 29 Nov 2022 15:16:54 +0100 Subject: [PATCH] Dev import deobfuscation fixes License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) Gale - https://galemc.org diff --git a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java index b0d26b0eadb2a43924629424a6c13198aace8f69..bcba8224b9a210bced04ff370a73b3067109fa71 100644 --- a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java +++ b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java @@ -52,7 +52,7 @@ public class BuildContexts> { } RedirectModifier redirectModifier = commandContext.getRedirectModifier(); - if (redirectModifier instanceof CustomModifierExecutor customModifierExecutor) { + if (redirectModifier instanceof CustomModifierExecutor customModifierExecutor) { // Gale - dev import deobfuscation fixes customModifierExecutor.apply(baseSource, list, contextChain, chainModifiers, ExecutionControl.create(context, frame)); return; } @@ -92,11 +92,11 @@ public class BuildContexts> { if (list.isEmpty()) { if (chainModifiers.isReturn()) { - context.queueNext(new CommandQueueEntry<>(frame, FallthroughTask.instance())); + context.queueNext(new CommandQueueEntry<>(frame, (EntryAction) FallthroughTask.instance())); // Gale - dev import deobfuscation fixes } } else { CommandContext commandContext2 = contextChain.getTopContext(); - if (commandContext2.getCommand() instanceof CustomCommandExecutor customCommandExecutor) { + if (commandContext2.getCommand() instanceof CustomCommandExecutor customCommandExecutor) { // Gale - dev import deobfuscation fixes ExecutionControl executionControl = ExecutionControl.create(context, frame); for (T executionCommandSource2 : list) { diff --git a/src/main/java/net/minecraft/util/ExtraCodecs.java b/src/main/java/net/minecraft/util/ExtraCodecs.java index 68dda6a3257ca18c1e6c7659d62455da46d187e2..24a478c0e874692964fb1c670277aca94f273749 100644 --- a/src/main/java/net/minecraft/util/ExtraCodecs.java +++ b/src/main/java/net/minecraft/util/ExtraCodecs.java @@ -224,7 +224,7 @@ public class ExtraCodecs { return combineFunction.apply(object, object2); }), pair -> ImmutableList.of(leftFunction.apply((I)pair), rightFunction.apply((I)pair))); Codec codec3 = RecordCodecBuilder.create( - instance -> instance.group(codec.fieldOf(leftFieldName).forGetter(Pair::getFirst), codec.fieldOf(rightFieldName).forGetter(Pair::getSecond)) + instance -> instance.group(codec.fieldOf(leftFieldName).forGetter(pair -> (P) pair.getFirst()), codec.fieldOf(rightFieldName).forGetter(pair -> (P) pair.getSecond())) // Gale - dev import deobfuscation fixes .apply(instance, Pair::of) ) .comapFlatMap( @@ -247,7 +247,7 @@ public class ExtraCodecs { Optional> optional = dataResult.resultOrPartial(mutableObject::setValue); return optional.isPresent() ? dataResult - : DataResult.error(() -> "(" + mutableObject.getValue() + " -> using default)", Pair.of(object, object)); + : DataResult.error(() -> "(" + mutableObject.getValue() + " -> using default)", Pair.of((A) object, object)); // Gale - dev import deobfuscation fixes } public DataResult coApply(DynamicOps dynamicOps, A object, DataResult dataResult) { diff --git a/src/main/java/net/minecraft/util/datafix/fixes/ChunkProtoTickListFix.java b/src/main/java/net/minecraft/util/datafix/fixes/ChunkProtoTickListFix.java index 2942534d265416a3693848d76538c04735bc14fa..1665e457bbfea822f5822c31f6c93f3a0d6fa7a3 100644 --- a/src/main/java/net/minecraft/util/datafix/fixes/ChunkProtoTickListFix.java +++ b/src/main/java/net/minecraft/util/datafix/fixes/ChunkProtoTickListFix.java @@ -18,6 +18,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.function.Function; import java.util.function.Supplier; @@ -186,7 +187,7 @@ public class ChunkProtoTickListFix extends DataFix { int k = packedLocalPos >>> 8 & 15; String string = blockIdGetter.apply(sectionSupplier != null ? sectionSupplier.get().get(i, j, k) : null); return levelDynamic.createMap( - ImmutableMap.builder() + (Map) ImmutableMap.builder() // Gale - dev import deobfuscation fixes .put(levelDynamic.createString("i"), levelDynamic.createString(string)) .put(levelDynamic.createString("x"), levelDynamic.createInt(sectionX * 16 + i)) .put(levelDynamic.createString("y"), levelDynamic.createInt(sectionY * 16 + j)) diff --git a/src/main/java/net/minecraft/world/level/levelgen/SurfaceRules.java b/src/main/java/net/minecraft/world/level/levelgen/SurfaceRules.java index 9167bad12e1be3f4163f85987862b044a630b2eb..9df053ddff459d4aab478106c6e66a5fc3cda8f6 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/SurfaceRules.java +++ b/src/main/java/net/minecraft/world/level/levelgen/SurfaceRules.java @@ -155,7 +155,7 @@ public class SurfaceRules { @Override public SurfaceRules.SurfaceRule apply(SurfaceRules.Context context) { - return context.system::getBand; + return (x, y, z) -> context.system.getBand(x, y, z); // Gale - dev import deobfuscation fixes } } @@ -177,10 +177,10 @@ public class SurfaceRules { } @Override - public SurfaceRules.Condition apply(SurfaceRules.Context context) { + public SurfaceRules.Condition apply(SurfaceRules.Context givenContext) { // Gale - dev import deobfuscation fixes class BiomeCondition extends SurfaceRules.LazyYCondition { BiomeCondition() { - super(context); + super(givenContext); // Gale - dev import deobfuscation fixes } @Override @@ -514,12 +514,14 @@ public class SurfaceRules { } @Override - public SurfaceRules.Condition apply(SurfaceRules.Context context) { - final NormalNoise normalNoise = context.randomState.getOrCreateNoise(this.noise); + // Gale start - dev import deobfuscation fixes + public SurfaceRules.Condition apply(SurfaceRules.Context givenContext) { + final NormalNoise normalNoise = givenContext.randomState.getOrCreateNoise(this.noise); + // Gale end - dev import deobfuscation fixes class NoiseThresholdCondition extends SurfaceRules.LazyXZCondition { NoiseThresholdCondition() { - super(context); + super(givenContext); // Gale - dev import deobfuscation fixes } @Override @@ -655,12 +657,12 @@ public class SurfaceRules { } @Override - public SurfaceRules.Condition apply(SurfaceRules.Context context) { + public SurfaceRules.Condition apply(SurfaceRules.Context givenContext) { // Gale - dev import deobfuscation fixes final boolean bl = this.surfaceType == CaveSurface.CEILING; class StoneDepthCondition extends SurfaceRules.LazyYCondition { StoneDepthCondition() { - super(context); + super(givenContext); // Gale - dev import deobfuscation fixes } @Override @@ -748,26 +750,32 @@ public class SurfaceRules { } @Override - public SurfaceRules.Condition apply(SurfaceRules.Context context) { - final int i = this.trueAtAndBelow().resolveY(context.context); - final int j = this.falseAtAndAbove().resolveY(context.context); - final PositionalRandomFactory positionalRandomFactory = context.randomState.getOrCreateRandomFactory(this.randomName()); + // Gale start - dev import deobfuscation fixes + public SurfaceRules.Condition apply(SurfaceRules.Context givenContext) { + final int i = this.trueAtAndBelow().resolveY(givenContext.context); + final int j = this.falseAtAndAbove().resolveY(givenContext.context); + final PositionalRandomFactory positionalRandomFactory = givenContext.randomState.getOrCreateRandomFactory(this.randomName()); + // Gale end - dev import deobfuscation fixes class VerticalGradientCondition extends SurfaceRules.LazyYCondition { VerticalGradientCondition() { - super(context); + super(givenContext); // Gale - dev import deobfuscation fixes } @Override protected boolean compute() { - int i = this.context.blockY; - if (i <= i) { + // Gale start - dev import deobfuscation fixes + int i2 = this.context.blockY; + if (i2 <= i) { + // Gale end - dev import deobfuscation fixes return true; - } else if (i >= j) { + } else if (i2 >= j) { // Gale - dev import deobfuscation fixes return false; } else { - double d = Mth.map((double)i, (double)i, (double)j, 1.0, 0.0); - RandomSource randomSource = positionalRandomFactory.at(this.context.blockX, i, this.context.blockZ); + // Gale start - dev import deobfuscation fixes + double d = Mth.map((double)i2, (double)i, (double)j, 1.0, 0.0); + RandomSource randomSource = positionalRandomFactory.at(this.context.blockX, i2, this.context.blockZ); + // Gale end - dev import deobfuscation fixes return (double)randomSource.nextFloat() < d; } } @@ -795,10 +803,10 @@ public class SurfaceRules { } @Override - public SurfaceRules.Condition apply(SurfaceRules.Context context) { + public SurfaceRules.Condition apply(SurfaceRules.Context givenContext) { // Gale - dev import deobfuscation fixes class WaterCondition extends SurfaceRules.LazyYCondition { WaterCondition() { - super(context); + super(givenContext); // Gale - dev import deobfuscation fixes } @Override @@ -833,10 +841,10 @@ public class SurfaceRules { } @Override - public SurfaceRules.Condition apply(SurfaceRules.Context context) { + public SurfaceRules.Condition apply(SurfaceRules.Context givenContext) { // Gale - dev import deobfuscation fixes class YCondition extends SurfaceRules.LazyYCondition { YCondition() { - super(context); + super(givenContext); // Gale - dev import deobfuscation fixes } @Override