9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-archived-patches/removed/1.21.4/mcserver/0002-Dev-import-deobfuscation-fixes.patch
2025-06-29 23:39:55 +08:00

209 lines
12 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Tue, 29 Nov 2022 15:16:54 +0100
Subject: [PATCH] Dev import deobfuscation fixes
Removed since Paper 1.21.4, hardfork
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..e8b8c453a7ff7af0a60ae915cfd85aba313139c9 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<T extends ExecutionCommandSource<T>> {
}
RedirectModifier<T> redirectModifier = commandContext.getRedirectModifier();
- if (redirectModifier instanceof CustomModifierExecutor<T> customModifierExecutor) {
+ if (redirectModifier instanceof CustomModifierExecutor.ModifierAdapter<T> customModifierExecutor) { // Gale - dev import deobfuscation fixes
customModifierExecutor.apply(baseSource, list, contextChain, chainModifiers, ExecutionControl.create(context, frame));
return;
}
@@ -92,11 +92,11 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
if (list.isEmpty()) {
if (chainModifiers.isReturn()) {
- context.queueNext(new CommandQueueEntry<>(frame, FallthroughTask.instance()));
+ context.queueNext(new CommandQueueEntry<T>(frame, FallthroughTask.instance())); // Gale - dev import deobfuscation fixes
}
} else {
CommandContext<T> commandContext2 = contextChain.getTopContext();
- if (commandContext2.getCommand() instanceof CustomCommandExecutor<T> customCommandExecutor) {
+ if (commandContext2.getCommand() instanceof CustomCommandExecutor.CommandAdapter<T> customCommandExecutor) { // Gale - dev import deobfuscation fixes
ExecutionControl<T> 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 eaa47e644926d6ec32e1c70523a0e713bc4c4906..4e7ed7fa08fabb4c253c75db41f7f24947aefff0 100644
--- a/src/main/java/net/minecraft/util/ExtraCodecs.java
+++ b/src/main/java/net/minecraft/util/ExtraCodecs.java
@@ -226,7 +226,7 @@ public class ExtraCodecs {
P object2 = listx.get(1);
return combineFunction.apply(object, object2);
}), pair -> ImmutableList.of(leftFunction.apply((I)pair), rightFunction.apply((I)pair)));
- Codec<I> codec3 = RecordCodecBuilder.<Pair>create(
+ Codec<I> codec3 = RecordCodecBuilder.<Pair<P, P>>create( // Gale - dev import deobfuscation fixes
instance -> instance.group(codec.fieldOf(leftFieldName).forGetter(Pair::getFirst), codec.fieldOf(rightFieldName).forGetter(Pair::getSecond))
.apply(instance, Pair::of)
)
@@ -243,14 +243,14 @@ public class ExtraCodecs {
});
}
- public static <A> ResultFunction<A> orElsePartial(A object) {
+ public static <A> ResultFunction<A> orElsePartial(A objectA) { // Gale - dev import deobfuscation fixes
return new ResultFunction<A>() {
public <T> DataResult<Pair<A, T>> apply(DynamicOps<T> dynamicOps, T object, DataResult<Pair<A, T>> dataResult) {
MutableObject<String> mutableObject = new MutableObject<>();
Optional<Pair<A, T>> 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(objectA, object)); // Gale - dev import deobfuscation fixes
}
public <T> DataResult<T> coApply(DynamicOps<T> dynamicOps, A object, DataResult<T> dataResult) {
@@ -259,7 +259,7 @@ public class ExtraCodecs {
@Override
public String toString() {
- return "OrElsePartial[" + object + "]";
+ return "OrElsePartial[" + objectA + "]"; // Gale - dev import deobfuscation fixes
}
};
}
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..3f48037d5d6a4965b895fde69825d3b2a74770e8 100644
--- a/src/main/java/net/minecraft/util/datafix/fixes/ChunkProtoTickListFix.java
+++ b/src/main/java/net/minecraft/util/datafix/fixes/ChunkProtoTickListFix.java
@@ -186,7 +186,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()
+ ImmutableMap.<Dynamic<?>, Dynamic<?>>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 7174613ef2cac0f27c72dcfa2f822199ffbc79e5..38428ba2c522108f4f9f7986bc3535d1232ac1f8 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/SurfaceRules.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/SurfaceRules.java
@@ -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
@@ -522,12 +522,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
@@ -663,12 +665,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
@@ -756,26 +758,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;
}
}
@@ -803,10 +811,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
@@ -841,10 +849,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