Skip to content

Commit

Permalink
Update to Minecraft 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenithRogue committed Nov 11, 2024
1 parent f631257 commit 51125f2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.6
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.9
# Mod Properties
mod_version=1.0.5
mod_version=1.0.6
maven_group=dev.zenithknight.mcmods
archives_base_name=expandeddata
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.95.0+1.20.4
fabric_version=0.107.3+1.21.3
7 changes: 6 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
#Sun Nov 10 16:21:47 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -40,13 +39,13 @@ public void setNbt(NbtCompound nbt) throws CommandSyntaxException {
// We do this to prevent block entities from dropping contents on change
if (this.entity != null) {
BlockEntity blockEntity = this.world.getBlockEntity(this.pos);
blockEntity.readNbt(new NbtCompound());
blockEntity.read(new NbtCompound(), this.entity.getWorld().getRegistryManager());
blockEntity.markDirty();
}
this.world.setBlockState(this.pos, blockState);
if (blockState.hasBlockEntity()){
BlockEntity blockEntity = this.world.getBlockEntity(this.pos);
blockEntity.readNbt(nbt);
blockEntity.read(nbt, this.entity.getWorld().getRegistryManager());
blockEntity.markDirty();
}
}
Expand All @@ -55,7 +54,7 @@ public NbtCompound getNbt() throws CommandSyntaxException {
NbtCompound nbt = new NbtCompound();
// If this is a block entity, initialize nbt from there
if (this.entity != null) {
nbt = this.entity.createNbtWithIdentifyingData();
nbt = this.entity.createNbtWithIdentifyingData(this.entity.getWorld().getRegistryManager());
} else {
nbt.putInt("x", this.pos.getX());
nbt.putInt("y", this.pos.getY());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,23 @@ private static void entityToNbtMixin(Entity entity, CallbackInfoReturnable<NbtCo
if (entity instanceof PlayerEntity) {
ItemStack itemStack;
if (!(itemStack = ((PlayerEntity) entity).currentScreenHandler.getCursorStack()).isEmpty()) {
nbtCompound.put("CursorItem", itemStack.writeNbt(new NbtCompound()));
nbtCompound.put("CursorItem", itemStack.toNbt(entity.getRegistryManager()));
}
if (!((PlayerEntity) entity).playerScreenHandler.getCraftingInput().isEmpty()) {
PlayerScreenHandler screenHandler = ((PlayerEntity) entity).playerScreenHandler;
RecipeInputInventory craftingInput = screenHandler.getCraftingInput();
NbtList nbtList = new NbtList();
for(int i = 0; i < craftingInput.size(); ++i) {
NbtCompound stackNbtCompound = craftingInput.getStack(i).writeNbt(new NbtCompound());
stackNbtCompound.putByte("Slot", (byte) i);
nbtList.add(stackNbtCompound);
for(int i = 0; i < 4; ++i) {
ItemStack testStack = craftingInput.getStack(i);
if (!testStack.isEmpty()) {
NbtCompound stackNbtCompound = (NbtCompound) craftingInput.getStack(i).toNbt(entity.getRegistryManager());
stackNbtCompound.putByte("Slot", (byte) i);
nbtList.add(stackNbtCompound);
}
}
nbtCompound.put("CraftingItems", nbtList);
if (screenHandler.getSlot(screenHandler.getCraftingResultSlotIndex()).hasStack()) {
nbtCompound.put("CraftingResult", screenHandler.getSlot(screenHandler.getCraftingResultSlotIndex()).getStack().writeNbt(new NbtCompound()));
if (screenHandler.getOutputSlot().hasStack()) {
nbtCompound.put("CraftingResult", screenHandler.getOutputSlot().getStack().toNbt(entity.getRegistryManager()));
}
}
}
Expand Down

0 comments on commit 51125f2

Please sign in to comment.