|
5 | 5 | import com.llamalad7.mixinextras.sugar.Local; |
6 | 6 | import com.mojang.authlib.GameProfile; |
7 | 7 | import io.github.misode.packtest.dummy.Dummy; |
8 | | -import net.minecraft.nbt.CompoundTag; |
9 | 8 | import net.minecraft.server.MinecraftServer; |
10 | 9 | import net.minecraft.server.level.ClientInformation; |
11 | 10 | import net.minecraft.server.level.ServerLevel; |
12 | 11 | import net.minecraft.server.level.ServerPlayer; |
13 | 12 | import net.minecraft.server.players.PlayerList; |
| 13 | +import net.minecraft.util.ProblemReporter; |
14 | 14 | import net.minecraft.world.entity.Entity; |
15 | 15 | import net.minecraft.world.entity.player.Player; |
16 | 16 | import net.minecraft.world.level.storage.PlayerDataStorage; |
| 17 | +import net.minecraft.world.level.storage.ValueInput; |
17 | 18 | import net.minecraft.world.phys.Vec3; |
18 | 19 | import org.spongepowered.asm.mixin.Mixin; |
19 | 20 | import org.spongepowered.asm.mixin.injection.At; |
|
32 | 33 | @Mixin(PlayerList.class) |
33 | 34 | public class PlayerListMixin { |
34 | 35 | @Inject(method = "load", at = @At(value = "RETURN", shift = At.Shift.BEFORE)) |
35 | | - private void fixStartingPos(ServerPlayer player, CallbackInfoReturnable<CompoundTag> cir) { |
| 36 | + private void fixStartingPos(ServerPlayer player, ProblemReporter problemReporter, CallbackInfoReturnable<Optional<ValueInput>> cir) { |
36 | 37 | if (player instanceof Dummy dummy) { |
37 | 38 | Vec3 pos = dummy.originalSpawn; |
38 | 39 | dummy.snapTo(pos.x, pos.y, pos.z, 0, 0); |
39 | 40 | } |
40 | 41 | } |
41 | 42 |
|
42 | | - @WrapOperation(method = "load", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/storage/PlayerDataStorage;load(Lnet/minecraft/world/entity/player/Player;)Ljava/util/Optional;")) |
43 | | - private Optional<CompoundTag> skipLoadDummy(PlayerDataStorage playerIo, Player player, Operation<Optional<CompoundTag>> original) { |
| 43 | + @WrapOperation(method = "load", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/storage/PlayerDataStorage;load(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/util/ProblemReporter;)Ljava/util/Optional;")) |
| 44 | + private Optional<ValueInput> skipLoadDummy(PlayerDataStorage playerIo, Player player, ProblemReporter problemReporter, Operation<Optional<ValueInput>> original) { |
44 | 45 | if (player instanceof Dummy) { |
45 | 46 | return Optional.empty(); |
46 | 47 | } else { |
47 | | - return original.call(playerIo, player); |
| 48 | + return original.call(playerIo, player, problemReporter); |
48 | 49 | } |
49 | 50 | } |
50 | 51 |
|
@@ -78,7 +79,7 @@ private void teleportDummy(ServerPlayer serverPlayer, boolean bl, Entity.Removal |
78 | 79 | if (player instanceof Dummy dummy) { |
79 | 80 | Vec3 pos = dummy.originalSpawn; |
80 | 81 | dummy.snapTo(pos.x, pos.y, pos.z, 0, 0); |
81 | | - dummy.teleportTo(dummy.serverLevel(), pos.x, pos.y, pos.z, Set.of(), 0, 0, true); |
| 82 | + dummy.teleportTo(dummy.level(), pos.x, pos.y, pos.z, Set.of(), 0, 0, true); |
82 | 83 | } |
83 | 84 | } |
84 | 85 | } |
0 commit comments