Skip to content

Commit 73af963

Browse files
committed
fix 1.14-1.15.2 crashes again
1 parent a7f0b3b commit 73af963

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

1.14-1.18.2/src/main/java/net/set/spawn/mod/mixin/ServerPlayerEntityMixin.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import net.minecraft.server.network.ServerPlayerEntity;
99
import net.minecraft.server.world.ServerWorld;
1010
import net.minecraft.text.*;
11-
import net.minecraft.util.Formatting;
1211
import net.minecraft.util.math.*;
1312
import net.set.spawn.mod.*;
1413
import net.set.spawn.mod.interfaces.MinecraftServerExtended;
@@ -73,12 +72,23 @@ private int setSpawn(
7372
return originalResult;
7473
}
7574

75+
@Dynamic
7676
@ModifyExpressionValue(
7777
method = "moveToSpawn",
78-
at = @At(
79-
value = "INVOKE",
80-
target = "Lnet/minecraft/server/network/SpawnLocating;findOverworldSpawn(Lnet/minecraft/server/world/ServerWorld;IIZ)Lnet/minecraft/util/math/BlockPos;"
81-
)
78+
at = {
79+
@At(
80+
value = "INVOKE",
81+
target = "Lnet/minecraft/server/network/SpawnLocating;findOverworldSpawn(Lnet/minecraft/server/world/ServerWorld;IIZ)Lnet/minecraft/util/math/BlockPos;"
82+
),
83+
@At(
84+
value = "INVOKE",
85+
// Dimension#getTopSpawningBlockPosition
86+
target = "Lnet/minecraft/class_2869;method_12444(IIZ)Lnet/minecraft/class_2338;",
87+
remap = false
88+
)
89+
},
90+
require = 1,
91+
allow = 1
8292
)
8393
private BlockPos captureIfHasGrassBlock(
8494
BlockPos blockPos,
@@ -154,7 +164,8 @@ private void sendErrorMessage(CallbackInfo ci) {
154164
@Inject(method = "method_14235(Lnet/minecraft/class_1703;)V", at = @At("TAIL"), require = 0, remap = false)
155165
private void sendErrorMessage2(CallbackInfo ci) {
156166
if (this.setSpawnError != null) {
157-
this.sendMessage(new LiteralText(this.setSpawnError + " This run is not verifiable.").formatted(Formatting.RED), false);
167+
// sorry the code is bad. it is the only way.
168+
this.sendMessage(new LiteralText("§c" + this.setSpawnError + " This run is not verifiable."), false);
158169
this.setSpawnError = null;
159170
}
160171
}

0 commit comments

Comments
 (0)