Skip to content

Commit 51125f2

Browse files
committed
Update to Minecraft 1.21.3
1 parent f631257 commit 51125f2

5 files changed

Lines changed: 25 additions & 18 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.1-SNAPSHOT'
2+
id 'fabric-loom' version '1.7-SNAPSHOT'
33
id 'maven-publish'
44
}
55

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
org.gradle.jvmargs=-Xmx1G
33
# Fabric Properties
44
# check these on https://modmuss50.me/fabric.html
5-
minecraft_version=1.20.4
6-
yarn_mappings=1.20.4+build.3
7-
loader_version=0.15.6
5+
minecraft_version=1.21.3
6+
yarn_mappings=1.21.3+build.2
7+
loader_version=0.16.9
88
# Mod Properties
9-
mod_version=1.0.5
9+
mod_version=1.0.6
1010
maven_group=dev.zenithknight.mcmods
1111
archives_base_name=expandeddata
1212
# Dependencies
1313
# check this on https://modmuss50.me/fabric.html
14-
fabric_version=0.95.0+1.20.4
14+
fabric_version=0.107.3+1.21.3
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
1+
#Sun Nov 10 16:21:47 CST 2024
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
5+
zipStoreBase=GRADLE_USER_HOME
6+
zipStorePath=wrapper/dists

src/main/java/dev/zenithknight/mcmods/expandeddata/common/DataObjects/BlockStateDataObject.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import net.minecraft.nbt.NbtCompound;
99
import net.minecraft.nbt.NbtElement;
1010
import net.minecraft.nbt.NbtHelper;
11-
import net.minecraft.registry.Registries;
1211
import net.minecraft.registry.RegistryKeys;
1312
import net.minecraft.server.world.ServerWorld;
1413
import net.minecraft.text.Text;
@@ -40,13 +39,13 @@ public void setNbt(NbtCompound nbt) throws CommandSyntaxException {
4039
// We do this to prevent block entities from dropping contents on change
4140
if (this.entity != null) {
4241
BlockEntity blockEntity = this.world.getBlockEntity(this.pos);
43-
blockEntity.readNbt(new NbtCompound());
42+
blockEntity.read(new NbtCompound(), this.entity.getWorld().getRegistryManager());
4443
blockEntity.markDirty();
4544
}
4645
this.world.setBlockState(this.pos, blockState);
4746
if (blockState.hasBlockEntity()){
4847
BlockEntity blockEntity = this.world.getBlockEntity(this.pos);
49-
blockEntity.readNbt(nbt);
48+
blockEntity.read(nbt, this.entity.getWorld().getRegistryManager());
5049
blockEntity.markDirty();
5150
}
5251
}
@@ -55,7 +54,7 @@ public NbtCompound getNbt() throws CommandSyntaxException {
5554
NbtCompound nbt = new NbtCompound();
5655
// If this is a block entity, initialize nbt from there
5756
if (this.entity != null) {
58-
nbt = this.entity.createNbtWithIdentifyingData();
57+
nbt = this.entity.createNbtWithIdentifyingData(this.entity.getWorld().getRegistryManager());
5958
} else {
6059
nbt.putInt("x", this.pos.getX());
6160
nbt.putInt("y", this.pos.getY());

src/main/java/dev/zenithknight/mcmods/expandeddata/mixin/NbtPredicateMixin.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,23 @@ private static void entityToNbtMixin(Entity entity, CallbackInfoReturnable<NbtCo
2020
if (entity instanceof PlayerEntity) {
2121
ItemStack itemStack;
2222
if (!(itemStack = ((PlayerEntity) entity).currentScreenHandler.getCursorStack()).isEmpty()) {
23-
nbtCompound.put("CursorItem", itemStack.writeNbt(new NbtCompound()));
23+
nbtCompound.put("CursorItem", itemStack.toNbt(entity.getRegistryManager()));
2424
}
2525
if (!((PlayerEntity) entity).playerScreenHandler.getCraftingInput().isEmpty()) {
2626
PlayerScreenHandler screenHandler = ((PlayerEntity) entity).playerScreenHandler;
2727
RecipeInputInventory craftingInput = screenHandler.getCraftingInput();
2828
NbtList nbtList = new NbtList();
29-
for(int i = 0; i < craftingInput.size(); ++i) {
30-
NbtCompound stackNbtCompound = craftingInput.getStack(i).writeNbt(new NbtCompound());
31-
stackNbtCompound.putByte("Slot", (byte) i);
32-
nbtList.add(stackNbtCompound);
29+
for(int i = 0; i < 4; ++i) {
30+
ItemStack testStack = craftingInput.getStack(i);
31+
if (!testStack.isEmpty()) {
32+
NbtCompound stackNbtCompound = (NbtCompound) craftingInput.getStack(i).toNbt(entity.getRegistryManager());
33+
stackNbtCompound.putByte("Slot", (byte) i);
34+
nbtList.add(stackNbtCompound);
35+
}
3336
}
3437
nbtCompound.put("CraftingItems", nbtList);
35-
if (screenHandler.getSlot(screenHandler.getCraftingResultSlotIndex()).hasStack()) {
36-
nbtCompound.put("CraftingResult", screenHandler.getSlot(screenHandler.getCraftingResultSlotIndex()).getStack().writeNbt(new NbtCompound()));
38+
if (screenHandler.getOutputSlot().hasStack()) {
39+
nbtCompound.put("CraftingResult", screenHandler.getOutputSlot().getStack().toNbt(entity.getRegistryManager()));
3740
}
3841
}
3942
}

0 commit comments

Comments
 (0)