Skip to content

Commit 8dfb740

Browse files
committed
Update to 1.21.6-rc1
1 parent c92ac2f commit 8dfb740

18 files changed

+119
-82
lines changed

gradle.properties

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx2G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/develop/
6-
minecraft_version=1.21.5
7-
minecraft_version_dependency=1.21.5
8-
minecraft_version_list=1.21.5
9-
minecraft_version_list_presentable=1.21.5
10-
loader_version=0.16.10
6+
minecraft_version=1.21.6-rc1
7+
minecraft_version_dependency=1.21.6-rc.1
8+
minecraft_version_list=1.21.6
9+
minecraft_version_list_presentable=1.21.6
10+
loader_version=0.16.14
1111

12-
parchment_mcversion=1.21.4
13-
parchment_version=2025.03.23
12+
parchment_mcversion=1.21.5
13+
parchment_version=2025.06.01
1414

1515
# Mod Properties
1616
mod_version=2.10.3
@@ -19,8 +19,8 @@ org.gradle.jvmargs=-Xmx2G
1919

2020
# Dependencies
2121
# also check this on https://fabricmc.net/develop/
22-
fabric_version=0.119.5+1.21.5
23-
clientarguments_version=1.11.2
22+
fabric_version=0.126.1+1.21.6
23+
clientarguments_version=1.11.3
2424
betterconfig_version=2.3.0
2525
seedfinding_core_version=1.200.1
2626
seedfinding_biome_version=1.171.1

regressionTests/playerRandomHierarchy.regressiontest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ net/minecraft/world/entity/LivingEntity.tickEffects ()V <- net/minecraft/world/e
9696
net/minecraft/world/entity/LivingEntity.updateFallFlying ()V <- net/minecraft/world/entity/Entity.random
9797
net/minecraft/world/entity/player/Player.aiStep ()V <- net/minecraft/world/entity/Entity.random
9898
net/minecraft/world/entity/player/Player.onEnchantmentPerformed (Lnet/minecraft/world/item/ItemStack;I)V <- net/minecraft/world/entity/Entity.random
99-
net/minecraft/world/entity/player/Player.readAdditionalSaveData (Lnet/minecraft/nbt/CompoundTag;)V <- net/minecraft/world/entity/Entity.random
99+
net/minecraft/world/entity/player/Player.readAdditionalSaveData (Lnet/minecraft/world/level/storage/ValueInput;)V <- net/minecraft/world/entity/Entity.random

src/main/java/net/earthcomputer/clientcommands/command/ConnectFourCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import net.minecraft.client.gui.screens.Screen;
1515
import net.minecraft.client.multiplayer.ClientPacketListener;
1616
import net.minecraft.client.multiplayer.PlayerInfo;
17-
import net.minecraft.client.renderer.RenderType;
17+
import net.minecraft.client.renderer.RenderPipelines;
1818
import net.minecraft.network.chat.Component;
1919
import net.minecraft.resources.ResourceLocation;
2020
import org.jetbrains.annotations.Nullable;
@@ -227,7 +227,7 @@ public void render(GuiGraphics graphics, int x, int y, boolean transparent) {
227227
case YELLOW -> 16;
228228
};
229229
graphics.blit(
230-
RenderType::guiTextured,
230+
RenderPipelines.GUI_TEXTURED,
231231
ConnectFourGameScreen.PIECES_TEXTURE,
232232
x,
233233
y,
@@ -299,7 +299,7 @@ public void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float
299299
graphics.drawString(this.font, gameStateTranslate, startX + BOARD_WIDTH - this.font.width(gameStateTranslate), startY - 10, 0xff_ffffff);
300300

301301
graphics.blit(
302-
RenderType::guiTextured,
302+
RenderPipelines.GUI_TEXTURED,
303303
BOARD_TEXTURE,
304304
startX,
305305
startY,

src/main/java/net/earthcomputer/clientcommands/command/CreativeTabCommand.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.mojang.datafixers.DataFixer;
99
import com.mojang.logging.LogUtils;
1010
import com.mojang.serialization.Dynamic;
11+
import net.earthcomputer.clientcommands.util.CUtil;
1112
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
1213
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
1314
import net.fabricmc.loader.api.FabricLoader;
@@ -47,7 +48,6 @@
4748
import static net.minecraft.commands.SharedSuggestionProvider.*;
4849

4950
public class CreativeTabCommand {
50-
5151
private static final Logger LOGGER = LogUtils.getLogger();
5252

5353
private static final DynamicCommandExceptionType NOT_FOUND_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.ccreativetab.notFound", arg));
@@ -90,17 +90,13 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
9090
.suggests((ctx, builder) -> suggest(tabs.keySet(), builder))
9191
.then(literal("add")
9292
.then(argument("itemstack", itemStack(context))
93-
.then(argument("count", integer(1))
94-
.executes(ctx -> addStack(ctx.getSource(), getString(ctx, "tab"), getItemStackArgument(ctx, "itemstack").createItemStack(getInteger(ctx, "count"), false))))
9593
.executes(ctx -> addStack(ctx.getSource(), getString(ctx, "tab"), getItemStackArgument(ctx, "itemstack").createItemStack(1, false)))))
9694
.then(literal("remove")
9795
.then(argument("index", integer(0))
9896
.executes(ctx -> removeStack(ctx.getSource(), getString(ctx, "tab"), getInteger(ctx, "index")))))
9997
.then(literal("set")
10098
.then(argument("index", integer(0))
10199
.then(argument("itemstack", itemStack(context))
102-
.then(argument("count", integer(1))
103-
.executes(ctx -> setStack(ctx.getSource(), getString(ctx, "tab"), getInteger(ctx, "index"), getItemStackArgument(ctx, "itemstack").createItemStack(getInteger(ctx, "count"), false))))
104100
.executes(ctx -> setStack(ctx.getSource(), getString(ctx, "tab"), getInteger(ctx, "index"), getItemStackArgument(ctx, "itemstack").createItemStack(1, false))))))
105101
.then(literal("icon")
106102
.then(argument("icon", itemStack(context))
@@ -128,9 +124,7 @@ private static int addTab(FabricClientCommandSource source, String name, ItemSta
128124
throw ILLEGAL_CHARACTER_EXCEPTION.create(name);
129125
}
130126

131-
icon.setCount(1);
132-
133-
tabs.put(name, new Tab((CompoundTag) icon.save(source.registryAccess()), new ListTag()));
127+
tabs.put(name, new Tab(CUtil.saveItemStack(source.registryAccess(), icon), new ListTag()));
134128
saveFile();
135129
source.sendFeedback(Component.translatable("commands.ccreativetab.addTab.success", name));
136130
ClientCommandHelper.sendRequiresRestart();
@@ -157,7 +151,7 @@ private static int addStack(FabricClientCommandSource source, String name, ItemS
157151

158152
Tab tab = tabs.get(name);
159153
ListTag items = tab.items();
160-
items.add(itemStack.save(source.registryAccess()));
154+
items.add(CUtil.saveItemStack(source.registryAccess(), itemStack));
161155

162156
saveFile();
163157
source.sendFeedback(Component.translatable("commands.ccreativetab.addStack.success", itemStack.getDisplayName(), name));
@@ -193,7 +187,7 @@ private static int setStack(FabricClientCommandSource source, String name, int i
193187
if ((index < 0) || (index >= items.size())) {
194188
throw OUT_OF_BOUNDS_EXCEPTION.create(index);
195189
}
196-
items.set(index, itemStack.save(source.registryAccess()));
190+
items.set(index, CUtil.saveItemStack(source.registryAccess(), itemStack));
197191

198192
saveFile();
199193
source.sendFeedback(Component.translatable("commands.ccreativetab.setStack.success", name, index, itemStack.getDisplayName()));
@@ -205,13 +199,12 @@ private static int changeIcon(FabricClientCommandSource source, String name, Ite
205199
if (!tabs.containsKey(name)) {
206200
throw NOT_FOUND_EXCEPTION.create(name);
207201
}
208-
icon.setCount(1);
209202

210203
Tab tab = tabs.get(name);
211204
ListTag items = tab.items();
212-
ItemStack old = ItemStack.parse(source.registryAccess(), tab.icon()).orElse(ItemStack.EMPTY);
205+
ItemStack old = CUtil.parseItemStack(source.registryAccess(), tab.icon()).orElse(ItemStack.EMPTY);
213206

214-
tabs.put(name, new Tab((CompoundTag) icon.save(source.registryAccess()), items));
207+
tabs.put(name, new Tab(CUtil.saveItemStack(source.registryAccess(), icon), items));
215208

216209
saveFile();
217210
source.sendFeedback(Component.translatable("commands.ccreativetab.changeIcon.success", name, old.getDisplayName(), icon.getDisplayName()));
@@ -247,7 +240,7 @@ private static void saveFile() throws CommandSyntaxException {
247240
tab.put("items", value.items());
248241
compoundTag.put(key, tab);
249242
});
250-
rootTag.putInt("DataVersion", SharedConstants.getCurrentVersion().getDataVersion().getVersion());
243+
rootTag.putInt("DataVersion", SharedConstants.getCurrentVersion().dataVersion().version());
251244
rootTag.put("CreativeTabs", compoundTag);
252245
Path newFile = File.createTempFile("creative_tabs", ".dat", configPath.toFile()).toPath();
253246
NbtIo.write(rootTag, newFile);
@@ -275,7 +268,7 @@ private static void loadFile() throws IOException {
275268
}
276269
}
277270
CompoundTag rootTag = rootTagTmp;
278-
final int currentVersion = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
271+
final int currentVersion = SharedConstants.getCurrentVersion().dataVersion().version();
279272
final int fileVersion = rootTag.getIntOr("DataVersion", 99);
280273
CompoundTag compoundTag = rootTag.getCompound("CreativeTabs").orElseGet(() -> rootTag.getCompoundOrEmpty("Groups"));
281274
DataFixer dataFixer = Minecraft.getInstance().getFixerUpper();
@@ -319,7 +312,7 @@ private static void loadFile() throws IOException {
319312
}
320313

321314
private static ItemStack singleItemFromNbt(HolderLookup.Provider holderLookupProvider, CompoundTag nbt) {
322-
ItemStack stack = ItemStack.parse(holderLookupProvider, nbt).orElse(ItemStack.EMPTY);
315+
ItemStack stack = CUtil.parseItemStack(holderLookupProvider, nbt).orElse(ItemStack.EMPTY);
323316
if (!stack.isEmpty()) {
324317
stack.setCount(1);
325318
}

src/main/java/net/earthcomputer/clientcommands/command/KitCommand.java

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,33 @@
88
import com.mojang.datafixers.DataFixer;
99
import com.mojang.logging.LogUtils;
1010
import com.mojang.serialization.Dynamic;
11+
import net.earthcomputer.clientcommands.ClientCommands;
1112
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
12-
import net.fabricmc.loader.api.FabricLoader;
1313
import net.minecraft.ChatFormatting;
1414
import net.minecraft.SharedConstants;
1515
import net.minecraft.Util;
1616
import net.minecraft.client.Minecraft;
1717
import net.minecraft.client.gui.GuiGraphics;
1818
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
19-
import net.minecraft.client.renderer.RenderType;
19+
import net.minecraft.client.renderer.RenderPipelines;
20+
import net.minecraft.core.HolderLookup;
2021
import net.minecraft.nbt.CompoundTag;
2122
import net.minecraft.nbt.ListTag;
2223
import net.minecraft.nbt.NbtIo;
2324
import net.minecraft.nbt.NbtOps;
2425
import net.minecraft.nbt.Tag;
2526
import net.minecraft.network.chat.Component;
27+
import net.minecraft.util.ProblemReporter;
2628
import net.minecraft.util.datafix.fixes.References;
29+
import net.minecraft.world.ContainerHelper;
30+
import net.minecraft.world.ItemStackWithSlot;
2731
import net.minecraft.world.entity.player.Inventory;
2832
import net.minecraft.world.inventory.InventoryMenu;
2933
import net.minecraft.world.inventory.Slot;
3034
import net.minecraft.world.item.ItemStack;
35+
import net.minecraft.world.level.storage.TagValueInput;
36+
import net.minecraft.world.level.storage.TagValueOutput;
37+
import net.minecraft.world.level.storage.ValueInput;
3138
import org.slf4j.Logger;
3239

3340
import java.io.File;
@@ -42,7 +49,6 @@
4249
import static net.minecraft.commands.SharedSuggestionProvider.*;
4350

4451
public class KitCommand {
45-
4652
private static final Logger LOGGER = LogUtils.getLogger();
4753

4854
private static final SimpleCommandExceptionType SAVE_FAILED_EXCEPTION = new SimpleCommandExceptionType(Component.translatable("commands.ckit.saveFile.failed"));
@@ -52,8 +58,6 @@ public class KitCommand {
5258
private static final SimpleCommandExceptionType NOT_CREATIVE_EXCEPTION = new SimpleCommandExceptionType(Component.translatable("commands.ckit.load.notCreative"));
5359
private static final DynamicCommandExceptionType NOT_FOUND_EXCEPTION = new DynamicCommandExceptionType(arg -> Component.translatable("commands.ckit.notFound", arg));
5460

55-
private static final Path configPath = FabricLoader.getInstance().getConfigDir().resolve("clientcommands");
56-
5761
private static final Map<String, ListTag> kits = new HashMap<>();
5862

5963
static {
@@ -95,7 +99,7 @@ private static int create(FabricClientCommandSource source, String name) throws
9599
if (kits.containsKey(name)) {
96100
throw ALREADY_EXISTS_EXCEPTION.create(name);
97101
}
98-
kits.put(name, source.getPlayer().getInventory().save(new ListTag()));
102+
kits.put(name, saveInventory(source.registryAccess(), source.getPlayer().getInventory()));
99103
saveFile();
100104
source.sendFeedback(Component.translatable("commands.ckit.create.success", name));
101105
return Command.SINGLE_SUCCESS;
@@ -114,7 +118,7 @@ private static int edit(FabricClientCommandSource source, String name) throws Co
114118
if (!kits.containsKey(name)) {
115119
throw NOT_FOUND_EXCEPTION.create(name);
116120
}
117-
kits.put(name, source.getPlayer().getInventory().save(new ListTag()));
121+
kits.put(name, saveInventory(source.registryAccess(), source.getPlayer().getInventory()));
118122
saveFile();
119123
source.sendFeedback(Component.translatable("commands.ckit.edit.success", name));
120124
return Command.SINGLE_SUCCESS;
@@ -131,7 +135,7 @@ private static int load(FabricClientCommandSource source, String name, boolean o
131135
}
132136

133137
Inventory tempInv = new Inventory(source.getPlayer(), source.getPlayer().equipment);
134-
tempInv.load(kit);
138+
loadInventory(source.registryAccess(), tempInv, kit);
135139
List<Slot> slots = source.getPlayer().inventoryMenu.slots;
136140
for (int i = 0; i < slots.size(); i++) {
137141
if (slots.get(i).container == source.getPlayer().getInventory()) {
@@ -165,7 +169,7 @@ private static int preview(FabricClientCommandSource source, String name) throws
165169
}
166170

167171
Inventory tempInv = new Inventory(source.getPlayer(), source.getPlayer().equipment);
168-
tempInv.load(kit);
172+
loadInventory(source.registryAccess(), tempInv, kit);
169173
/*
170174
After executing a command, the current screen will be closed (the chat hud).
171175
And if you open a new screen in a command, that new screen will be closed
@@ -181,12 +185,12 @@ private static void saveFile() throws CommandSyntaxException {
181185
CompoundTag rootTag = new CompoundTag();
182186
CompoundTag compoundTag = new CompoundTag();
183187
kits.forEach(compoundTag::put);
184-
rootTag.putInt("DataVersion", SharedConstants.getCurrentVersion().getDataVersion().getVersion());
188+
rootTag.putInt("DataVersion", SharedConstants.getCurrentVersion().dataVersion().version());
185189
rootTag.put("Kits", compoundTag);
186-
Path newFile = File.createTempFile("kits", ".dat", configPath.toFile()).toPath();
190+
Path newFile = File.createTempFile("kits", ".dat", ClientCommands.CONFIG_DIR.toFile()).toPath();
187191
NbtIo.write(rootTag, newFile);
188-
Path backupFile = configPath.resolve("kits.dat_old");
189-
Path currentFile = configPath.resolve("kits.dat");;
192+
Path backupFile = ClientCommands.CONFIG_DIR.resolve("kits.dat_old");
193+
Path currentFile = ClientCommands.CONFIG_DIR.resolve("kits.dat");;
190194
Util.safeReplaceFile(currentFile, newFile, backupFile);
191195
} catch (IOException e) {
192196
throw SAVE_FAILED_EXCEPTION.create();
@@ -195,11 +199,11 @@ private static void saveFile() throws CommandSyntaxException {
195199

196200
private static void loadFile() throws IOException {
197201
kits.clear();
198-
CompoundTag rootTag = NbtIo.read(configPath.resolve("kits.dat"));
202+
CompoundTag rootTag = NbtIo.read(ClientCommands.CONFIG_DIR.resolve("kits.dat"));
199203
if (rootTag == null) {
200204
return;
201205
}
202-
final int currentVersion = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
206+
final int currentVersion = SharedConstants.getCurrentVersion().dataVersion().version();
203207
final int fileVersion = rootTag.getIntOr("DataVersion", 0);
204208
CompoundTag compoundTag = rootTag.getCompoundOrEmpty("Kits");
205209
DataFixer dataFixer = Minecraft.getInstance().getFixerUpper();
@@ -217,6 +221,23 @@ private static void loadFile() throws IOException {
217221
});
218222
}
219223
}
224+
225+
private static void loadInventory(HolderLookup.Provider registries, Inventory inventory, ListTag items) {
226+
CompoundTag nbt = new CompoundTag();
227+
nbt.put(ContainerHelper.TAG_ITEMS, items);
228+
try (ProblemReporter.ScopedCollector collector = new ProblemReporter.ScopedCollector(LOGGER)) {
229+
ValueInput input = TagValueInput.create(collector, registries, nbt);
230+
inventory.load(input.listOrEmpty(ContainerHelper.TAG_ITEMS, ItemStackWithSlot.CODEC));
231+
}
232+
}
233+
234+
private static ListTag saveInventory(HolderLookup.Provider registries, Inventory inventory) {
235+
try (ProblemReporter.ScopedCollector collector = new ProblemReporter.ScopedCollector(LOGGER)) {
236+
TagValueOutput output = TagValueOutput.createWithContext(collector, registries);
237+
inventory.save(output.list(ContainerHelper.TAG_ITEMS, ItemStackWithSlot.CODEC));
238+
return output.buildResult().getListOrEmpty(ContainerHelper.TAG_ITEMS);
239+
}
240+
}
220241
}
221242

222243
class PreviewScreen extends AbstractContainerScreen<InventoryMenu> {
@@ -227,20 +248,19 @@ public PreviewScreen(InventoryMenu menu, Inventory inventory, String name) {
227248

228249
@Override
229250
protected void renderLabels(GuiGraphics graphics, int mouseX, int mouseY) {
230-
graphics.drawString(this.font, this.title, this.titleLabelX, this.titleLabelY, 0x404040, false);
251+
graphics.drawString(this.font, this.title, this.titleLabelX, this.titleLabelY, 0xff404040, false);
231252
}
232253

233254
@Override
234255
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
235-
this.renderBackground(graphics, mouseX, mouseY, delta);
236256
super.render(graphics, mouseX, mouseY, delta);
237257

238258
this.renderTooltip(graphics, mouseX, mouseY);
239259
}
240260

241261
@Override
242262
protected void renderBg(GuiGraphics graphics, float delta, int mouseX, int mouseY) {
243-
graphics.blit(RenderType::guiTextured, INVENTORY_LOCATION, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight, 256, 256);
263+
graphics.blit(RenderPipelines.GUI_TEXTURED, INVENTORY_LOCATION, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight, 256, 256);
244264
}
245265

246266
@Override

src/main/java/net/earthcomputer/clientcommands/command/MinesweeperCommand.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
99
import net.minecraft.client.gui.GuiGraphics;
1010
import net.minecraft.client.gui.screens.Screen;
11-
import net.minecraft.client.renderer.RenderType;
11+
import net.minecraft.client.renderer.RenderPipelines;
1212
import net.minecraft.client.resources.language.I18n;
1313
import net.minecraft.network.chat.Component;
1414
import net.minecraft.resources.ResourceLocation;
@@ -162,10 +162,8 @@ protected void init() {
162162

163163
@Override
164164
public void render(GuiGraphics graphics, int mouseX, int mouseY, float tickDelta) {
165-
renderBackground(graphics, mouseX, mouseY, tickDelta);
166-
167-
graphics.drawString(minecraft.font, I18n.get("minesweeperGame.minesLeft", minesLeft), topLeftX, topLeftY - 10, 0xFFFFFF);
168-
graphics.drawCenteredString(minecraft.font, title.getString(), topLeftX + gameWidth / 2, topLeftY - 20, 0xFFFFFF);
165+
graphics.drawString(minecraft.font, I18n.get("minesweeperGame.minesLeft", minesLeft), topLeftX, topLeftY - 10, 0xFFFFFFFF);
166+
graphics.drawCenteredString(minecraft.font, title.getString(), topLeftX + gameWidth / 2, topLeftY - 20, 0xFFFFFFFF);
169167
{
170168
String str = I18n.get("minesweeperGame.timePlayed", Math.ceilDiv(ticksPlaying, 20));
171169
int color;
@@ -203,7 +201,7 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float tickDelta
203201
}
204202

205203
public void blitSprite(GuiGraphics graphics, Vector2i uv, int x, int y, int width, int height) {
206-
graphics.blit(RenderType::guiTextured, MINESWEEPER_ATLAS, topLeftX + x, topLeftY + y, uv.x, uv.y, width, height, MINESWEEPER_ATLAS_WIDTH, MINESWEEPER_ATLAS_HEIGHT);
204+
graphics.blit(RenderPipelines.GUI_TEXTURED, MINESWEEPER_ATLAS, topLeftX + x, topLeftY + y, uv.x, uv.y, width, height, MINESWEEPER_ATLAS_WIDTH, MINESWEEPER_ATLAS_HEIGHT);
207205
}
208206

209207
@Override

0 commit comments

Comments
 (0)