Skip to content

Commit

Permalink
fix: Fix last commit compile errors on Fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Jan 11, 2025
1 parent 75f47e1 commit 07b4f01
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
28 changes: 28 additions & 0 deletions fabric/src/main/java/net/blay09/mods/balm/mixin/EntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
public class EntityMixin implements BalmEntity {

private CompoundTag balmData = new CompoundTag();
private CompoundTag forgeBalmData = new CompoundTag();
private CompoundTag neoforgeBalmData = new CompoundTag();

@Inject(method = "load(Lnet/minecraft/nbt/CompoundTag;)V", at = @At("HEAD"))
private void load(CompoundTag compound, CallbackInfo callbackInfo) {
Expand All @@ -24,6 +26,12 @@ private void load(CompoundTag compound, CallbackInfo callbackInfo) {
balmData = playerPersisted.getCompound("BalmData");
}
}
if (compound.contains("ForgeData")) {
forgeBalmData = compound.getCompound("ForgeData").getCompound("PlayerPersisted").getCompound("BalmData");
}
if (compound.contains("NeoForgeData")) {
neoforgeBalmData = compound.getCompound("NeoForgeData").getCompound("PlayerPersisted").getCompound("BalmData");
}
}

@Inject(method = "saveWithoutId(Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/nbt/CompoundTag;", at = @At("HEAD"))
Expand All @@ -42,4 +50,24 @@ public CompoundTag getFabricBalmData() {
public void setFabricBalmData(CompoundTag tag) {
this.balmData = tag;
}

@Override
public CompoundTag getForgeBalmData() {
return forgeBalmData;
}

@Override
public void setForgeBalmData(CompoundTag tag) {
this.forgeBalmData = tag;
}

@Override
public CompoundTag getNeoForgeBalmData() {
return neoforgeBalmData;
}

@Override
public void setNeoForgeBalmData(CompoundTag tag) {
this.neoforgeBalmData = tag;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,12 @@ public class EntityMixin implements BalmEntity {
private void load(CompoundTag compound, CallbackInfo callbackInfo) {
if (compound.contains("BalmData")) {
fabricBalmData = compound.getCompound("BalmData");
} else if (compound.contains("NeoForgeData")) {
}
if (compound.contains("NeoForgeData")) {
neoforgeBalmData = compound.getCompound("NeoForgeData").getCompound("PlayerPersisted").getCompound("BalmData");
}
}

@Inject(method = "saveWithoutId(Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/nbt/CompoundTag;", at = @At("HEAD"))
private void saveWithoutId(CompoundTag compound, CallbackInfoReturnable<CompoundTag> callbackInfo) {
compound.put("BalmData", fabricBalmData);
}

@Override
public CompoundTag getFabricBalmData() {
return fabricBalmData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public class EntityMixin implements BalmEntity {
private void load(CompoundTag compound, CallbackInfo callbackInfo) {
if (compound.contains("BalmData")) {
fabricBalmData = compound.getCompound("BalmData");
} else if (compound.contains("ForgeData")) {
}
if (compound.contains("ForgeData")) {
forgeBalmData = compound.getCompound("ForgeData").getCompound("PlayerPersisted").getCompound("BalmData");
}
}
Expand Down

0 comments on commit 07b4f01

Please sign in to comment.