Skip to content

Commit

Permalink
Differnet way to save persistent data
Browse files Browse the repository at this point in the history
  • Loading branch information
RedRogue10 committed Jul 27, 2024
1 parent 53c66dc commit 8ede4bb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.miavalley.roughleaderboards.mixin;


import net.miavalley.roughleaderboards.util.IEntityDataSaver;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NbtCompound;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(Entity.class)
public abstract class ModEntityDataSaverMixin implements IEntityDataSaver {
private NbtCompound persistentData;


@Override
public NbtCompound getPersistentData() {
if (this.persistentData == null) {
this.persistentData = new NbtCompound();
}
return persistentData;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.miavalley.roughleaderboards.util;

import net.minecraft.nbt.NbtCompound;

public interface IEntityDataSaver {
NbtCompound getPersistentData();
}

0 comments on commit 8ede4bb

Please sign in to comment.