9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-19 23:09:30 +00:00
Files
Gale/patches/server/0002-Dev-import-deobfuscation-fixes.patch
2024-10-30 11:04:50 -04:00

207 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
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 68dda6a3257ca18c1e6c7659d62455da46d187e2..f8fa36b7c3763fed2392d62188bd210241e8f313 100644
--- a/src/main/java/net/minecraft/util/ExtraCodecs.java
+++ b/src/main/java/net/minecraft/util/ExtraCodecs.java
@@ -223,7 +223,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)
)
@@ -240,14 +240,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) {
@@ -256,7 +256,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 9167bad12e1be3f4163f85987862b044a630b2eb..7ba3a3ca57b55f796a90b700b930f365c3508484 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
@@ -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