Skip to content

Commit 8a36a44

Browse files
committed
Fix 1.21.1 - 1.21.4 repair code
1 parent dbab198 commit 8a36a44

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

src/main/java/me/drex/essentials/command/impl/misc/RepairCommand.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ protected void registerArguments(LiteralArgumentBuilder<CommandSourceStack> lite
2929
.executes(ctx -> {
3030
CommandSourceStack src = ctx.getSource();
3131
ServerPlayer player = src.getPlayerOrException();
32+
//? if >= 1.21.5 {
3233
for (ItemStack itemStack : player.getInventory()) {
34+
//?} else {
35+
/*for (int i = 0; i < player.getInventory().getContainerSize(); i++) {
36+
ItemStack itemStack = player.getInventory().getItem(i);
37+
*///?}
3338
if (itemStack.isDamaged()) {
3439
itemStack.setDamageValue(0);
3540
}

src/main/java/me/drex/essentials/command/util/CommandUtil.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class CommandUtil {
3333
private static final SimpleCommandExceptionType NO_PLAYERS_FOUND = new SimpleCommandExceptionType(Component.translatable("argument.entity.notfound.player"));
3434

3535
public static GameProfile getGameProfile(CommandContext<CommandSourceStack> context, String argument) throws CommandSyntaxException {
36-
Collection</*?if >= 1.21.9 {*/ net.minecraft.server.players.NameAndId /*?} else {*/ /*GameProfile*/ /*?}*/> profiles = getGameProfiles(context, argument);
36+
Collection</*? if >= 1.21.9 {*/ net.minecraft.server.players.NameAndId /*?} else {*/ /*GameProfile *//*?}*/> profiles = getGameProfiles(context, argument);
3737
if (profiles.isEmpty()) {
3838
throw NO_PLAYERS_FOUND.create();
3939
} else {
@@ -43,9 +43,9 @@ public static GameProfile getGameProfile(CommandContext<CommandSourceStack> cont
4343
var profile = profiles.iterator().next();
4444
//? if >= 1.21.9 {
4545
return new GameProfile(profile.id(), profile.name());
46-
//? } else {
47-
// return profile;
48-
//? }
46+
//?} else {
47+
/*return profile;
48+
*///?}
4949
}
5050
}
5151
}

src/main/java/me/drex/essentials/datagen/ModItemTagProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ protected void addTags(HolderLookup.Provider wrapperLookup) {
1818
//? if >= 1.21.6 {
1919
this.valueLookupBuilder(ModItemTags.HAT_DENY)
2020
//?} else {
21-
/*this.getOrCreateTagBuilder(ModItemTags.HAT_DENY)*/
22-
//?}
21+
/*this.getOrCreateTagBuilder(ModItemTags.HAT_DENY)
22+
*///?}
2323
.add(Items.BEDROCK);
2424
}
2525
}

src/main/java/me/drex/essentials/mixin/async/ServerPlayerMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public ServerPlayerMixin(Level level, GameProfile gameProfile) {
3636
//?} else {
3737
/*public ServerPlayerMixin(Level level, BlockPos blockPos, float f, GameProfile gameProfile) {
3838
super(level, blockPos, f, gameProfile);
39-
}*/
40-
//?}
39+
}
40+
*///?}
4141

4242
@Shadow
4343
public abstract void sendSystemMessage(Component component);

src/main/java/me/drex/essentials/mixin/command/EntitySelectorMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public ServerPlayer allowPartialName(PlayerList playerList, String input, Operat
2828
if (ConfigManager.config().commands.allowPartialNames) {
2929
String lowercasePartial = input.toLowerCase();
3030
List<ServerPlayer> matches = playerList.getPlayers().stream()
31-
.filter(player -> player.getGameProfile()./*?if >= 1.21.9 {*/ name() /*?} else {*/ /*getName()*/ /*?}*/.toLowerCase().startsWith(lowercasePartial))
31+
.filter(player -> player.getGameProfile()./*? if >= 1.21.9 {*/ name() /*?} else {*/ /*getName() *//*?}*/.toLowerCase().startsWith(lowercasePartial))
3232
.toList();
3333

3434
if (matches.isEmpty()) {

src/main/java/me/drex/essentials/storage/DataStorage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static PlayerData getPlayerData(CommandContext<CommandSourceStack> ctx) t
9393

9494
@NotNull
9595
public static PlayerData getOfflinePlayerData(MinecraftServer server, GameProfile profile) {
96-
PlayerData playerData = PlayerDataApi.getCustomDataFor(server, profile./*?if >= 1.21.9 {*/ id() /*?} else {*/ /*getId()*/ /*?}*/, USER_DATA_STORAGE);
96+
PlayerData playerData = PlayerDataApi.getCustomDataFor(server, profile./*? if >= 1.21.9 {*/ id() /*?} else {*/ /*getId() *//*?}*/, USER_DATA_STORAGE);
9797
if (playerData == null) {
9898
playerData = new PlayerData();
9999
}
@@ -110,7 +110,7 @@ public static PlayerData getOfflinePlayerData(MinecraftServer server, UUID uuid)
110110
}
111111

112112
public static void updateOfflinePlayerData(MinecraftServer server, GameProfile profile, PlayerData playerData) {
113-
PlayerDataApi.setCustomDataFor(server, profile./*?if >= 1.21.9 {*/ id() /*?} else {*/ /*getId()*/ /*?}*/, USER_DATA_STORAGE, playerData);
113+
PlayerDataApi.setCustomDataFor(server, profile./*? if >= 1.21.9 {*/ id() /*?} else {*/ /*getId() *//*?}*/, USER_DATA_STORAGE, playerData);
114114
}
115115

116116
public static void updateOfflinePlayerData(MinecraftServer server, UUID uuid, PlayerData playerData) {

src/main/java/me/drex/essentials/util/AsyncChunkLoadUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class AsyncChunkLoadUtil {
2020

2121
//? if >= 1.21.9 {
2222
public static final TicketType ASYNC_CHUNK_LOAD = new TicketType(0L, TicketType.FLAG_LOADING);
23-
//? } else if >= 1.21.5 {
23+
//?} else if >= 1.21.5 {
2424
// public static final TicketType ASYNC_CHUNK_LOAD = register("essentials_async_chunk_load", 0L, false, TicketType.TicketUse.LOADING);
2525
//?} else {
2626
/*public static final TicketType<Unit> ASYNC_CHUNK_LOAD = TicketType.create("essentials_async_chunk_load", (unit, unit2) -> 0);

0 commit comments

Comments
 (0)