Skip to content

Commit 5d3a928

Browse files
committed
Update to 1.21.6-rc1
1 parent 6cf650f commit 5d3a928

File tree

7 files changed

+24
-27
lines changed

7 files changed

+24
-27
lines changed

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ org.gradle.parallel=true
44

55
# Fabric Properties
66
# check these on https://fabricmc.net/develop
7-
minecraft_version=1.21.5
8-
loader_version=0.16.10
7+
minecraft_version=1.21.6-rc1
8+
loader_version=0.16.14
99

1010
# Mod Properties
11-
mod_version=2.1.1
11+
mod_version=2.2.0
1212
maven_group=io.github.misode
1313
archives_base_name=packtest
1414

1515
# Dependencies
16-
fabric_version=0.119.3+1.21.5
16+
fabric_version=0.126.1+1.21.6

src/main/java/io/github/misode/packtest/PackTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import net.minecraft.commands.synchronization.ArgumentUtils;
1616
import net.minecraft.data.registries.VanillaRegistries;
1717
import net.minecraft.gametest.framework.GameTestServer;
18+
import net.minecraft.gametest.framework.GameTestTicker;
1819
import net.minecraft.server.packs.repository.PackRepository;
1920
import net.minecraft.util.GsonHelper;
2021
import net.minecraft.world.level.storage.LevelStorageSource;
@@ -97,7 +98,11 @@ private static void registerCommands(CommandDispatcher<CommandSourceStack> dispa
9798
}
9899

99100
public static void runHeadlessServer(LevelStorageSource.LevelStorageAccess storage, PackRepository packRepository) {
100-
GameTestServer.spin(thread -> GameTestServer.create(thread, storage, packRepository, Optional.empty(), false));
101+
GameTestServer.spin(thread -> {
102+
GameTestServer server = GameTestServer.create(thread, storage, packRepository, Optional.empty(), false);
103+
GameTestTicker.SINGLETON.startTicking();
104+
return server;
105+
});
101106
}
102107

103108
public static String wrapError(String message) {

src/main/java/io/github/misode/packtest/commands/AssertCommand.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99
import com.mojang.brigadier.exceptions.CommandSyntaxException;
1010
import com.mojang.brigadier.exceptions.Dynamic3CommandExceptionType;
1111
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
12-
import com.mojang.brigadier.suggestion.SuggestionProvider;
1312
import io.github.misode.packtest.*;
1413
import it.unimi.dsi.fastutil.ints.IntList;
1514
import net.minecraft.advancements.critereon.MinMaxBounds;
1615
import net.minecraft.commands.CommandBuildContext;
1716
import net.minecraft.commands.CommandSourceStack;
18-
import net.minecraft.commands.SharedSuggestionProvider;
1917
import net.minecraft.commands.arguments.*;
2018
import net.minecraft.commands.arguments.blocks.BlockPredicateArgument;
2119
import net.minecraft.commands.arguments.coordinates.BlockPosArgument;
@@ -28,11 +26,9 @@
2826
import net.minecraft.core.BlockPos;
2927
import net.minecraft.core.Holder;
3028
import net.minecraft.core.registries.BuiltInRegistries;
31-
import net.minecraft.core.registries.Registries;
3229
import net.minecraft.gametest.framework.GameTestHelper;
3330
import net.minecraft.nbt.Tag;
3431
import net.minecraft.network.chat.Component;
35-
import net.minecraft.server.ReloadableServerRegistries;
3632
import net.minecraft.server.commands.data.DataCommands;
3733
import net.minecraft.server.level.ServerPlayer;
3834
import net.minecraft.world.Container;
@@ -71,10 +67,6 @@ public class AssertCommand {
7167
private static final Dynamic3CommandExceptionType ERROR_SOURCE_NOT_A_CONTAINER = new Dynamic3CommandExceptionType(
7268
(x, y, z) -> Component.translatableEscape("commands.item.source.not_a_container", x, y, z)
7369
);
74-
private static final SuggestionProvider<CommandSourceStack> SUGGEST_PREDICATE = (ctx, suggestions) -> {
75-
ReloadableServerRegistries.Holder registries = ctx.getSource().getServer().reloadableRegistries();
76-
return SharedSuggestionProvider.suggestResource(registries.getKeys(Registries.PREDICATE), suggestions);
77-
};
7870

7971
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext buildContext) {
8072
LiteralArgumentBuilder<CommandSourceStack> assertBuilder = literal("assert")
@@ -100,7 +92,6 @@ public static void addConditions(LiteralArgumentBuilder<CommandSourceStack> buil
10092
.executes(expect.apply(AssertCommand::assertEntityInside)))))
10193
.then(literal("predicate")
10294
.then(argument("predicate", ResourceOrIdArgument.lootPredicate(buildContext))
103-
.suggests(SUGGEST_PREDICATE)
10495
.executes(expect.apply(AssertCommand::assertPredicate))))
10596
.then(literal("items")
10697
.then(literal("entity")

src/main/java/io/github/misode/packtest/commands/DummyCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ private static int useBlock(CommandContext<CommandSourceStack> ctx, Direction hi
248248
for (InteractionHand hand : InteractionHand.values()) {
249249
ItemStack handItem = dummy.getItemInHand(hand);
250250
BlockHitResult blockHit = new BlockHitResult(pos, hitDirection, BlockPos.containing(pos), false);
251-
InteractionResult result = dummy.gameMode.useItemOn(dummy, dummy.serverLevel(), handItem, hand, blockHit);
251+
InteractionResult result = dummy.gameMode.useItemOn(dummy, dummy.level(), handItem, hand, blockHit);
252252
if (result.consumesAction()) {
253253
dummy.swing(hand);
254254
return 1;

src/main/java/io/github/misode/packtest/dummy/Dummy.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ public String getUsername() {
9090
}
9191

9292
public void leave(Component reason) {
93-
server.getPlayerList().remove(this);
93+
Objects.requireNonNull(this.getServer()).getPlayerList().remove(this);
9494
this.connection.onDisconnect(new DisconnectionDetails(reason));
9595
}
9696

9797
public void respawn() {
98-
server.getPlayerList().respawn(this, false, Entity.RemovalReason.KILLED);
98+
Objects.requireNonNull(this.getServer()).getPlayerList().respawn(this, false, Entity.RemovalReason.KILLED);
9999
}
100100

101101
@Override
@@ -112,7 +112,7 @@ public void forceSetRotation(float f, float g) {
112112
public void tick() {
113113
if (Objects.requireNonNull(this.getServer()).getTickCount() % 10 == 0) {
114114
this.connection.resetPosition();
115-
this.serverLevel().getChunkSource().move(this);
115+
this.level().getChunkSource().move(this);
116116
}
117117
try {
118118
super.tick();
@@ -124,8 +124,8 @@ public void tick() {
124124
@Override
125125
public void die(DamageSource cause) {
126126
super.die(cause);
127-
if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN)) {
128-
this.server.schedule(new TickTask(this.server.getTickCount(),
127+
if (this.level().getGameRules().getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN)) {
128+
Objects.requireNonNull(this.getServer()).schedule(new TickTask(this.getServer().getTickCount(),
129129
() -> this.connection.handleClientCommand(new ServerboundClientCommandPacket(ServerboundClientCommandPacket.Action.PERFORM_RESPAWN))
130130
));
131131
}

src/main/java/io/github/misode/packtest/mixin/PlayerListMixin.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
import com.llamalad7.mixinextras.sugar.Local;
66
import com.mojang.authlib.GameProfile;
77
import io.github.misode.packtest.dummy.Dummy;
8-
import net.minecraft.nbt.CompoundTag;
98
import net.minecraft.server.MinecraftServer;
109
import net.minecraft.server.level.ClientInformation;
1110
import net.minecraft.server.level.ServerLevel;
1211
import net.minecraft.server.level.ServerPlayer;
1312
import net.minecraft.server.players.PlayerList;
13+
import net.minecraft.util.ProblemReporter;
1414
import net.minecraft.world.entity.Entity;
1515
import net.minecraft.world.entity.player.Player;
1616
import net.minecraft.world.level.storage.PlayerDataStorage;
17+
import net.minecraft.world.level.storage.ValueInput;
1718
import net.minecraft.world.phys.Vec3;
1819
import org.spongepowered.asm.mixin.Mixin;
1920
import org.spongepowered.asm.mixin.injection.At;
@@ -32,19 +33,19 @@
3233
@Mixin(PlayerList.class)
3334
public class PlayerListMixin {
3435
@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) {
3637
if (player instanceof Dummy dummy) {
3738
Vec3 pos = dummy.originalSpawn;
3839
dummy.snapTo(pos.x, pos.y, pos.z, 0, 0);
3940
}
4041
}
4142

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) {
4445
if (player instanceof Dummy) {
4546
return Optional.empty();
4647
} else {
47-
return original.call(playerIo, player);
48+
return original.call(playerIo, player, problemReporter);
4849
}
4950
}
5051

@@ -78,7 +79,7 @@ private void teleportDummy(ServerPlayer serverPlayer, boolean bl, Entity.Removal
7879
if (player instanceof Dummy dummy) {
7980
Vec3 pos = dummy.originalSpawn;
8081
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);
8283
}
8384
}
8485
}

src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"accessWidener": "packtest.accesswidener",
2525
"depends": {
2626
"fabricloader": ">=0.15.10",
27-
"minecraft": ">=1.21.5",
27+
"minecraft": ">=1.21.6",
2828
"java": ">=21",
2929
"fabric-api": "*"
3030
}

0 commit comments

Comments
 (0)