Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Posts posted by jayxo

  1. hello! I'm trying to add a suffix into the players name based on their health. I've used TabListNameFormat and calling ServerPlayerEntity#refreshTabListName which works perfectly fine, but I want to work with something that can be compatible with any version I would want to port my mod to.

    I'm aware older versions of forge are not supported, and I am not asking for help for older versions.

    thank you!! :)

  2. Ohh alright! I've gotten a .dat file to load into a world, but I'm not sure where to go from here.

    public class StatsManager extends WorldSavedData implements Supplier {
        public Map<UUID, DefaultStatsCapability> players = new HashMap<>();
        public PlayerEntity player = Minecraft.getInstance().player;
        public StatsManager() {
        public void load(CompoundNBT nbt) {
            players.put(player.getUUID(), StatsCapabilityProvider.stats);
        public CompoundNBT save(CompoundNBT nbt) {
            ListNBT listNBT = new ListNBT();
            for (DefaultStatsCapability stats : players.values()) {
            nbt.put("Players", listNBT);
            return nbt;
        public static StatsManager onWorld(ServerWorld world) {
            DimensionSavedDataManager storage = world.getDataStorage();
            StatsManager sup = new StatsManager();
            StatsManager saver = (StatsManager) storage.computeIfAbsent(sup, XLife.MOD_ID);
            return saver;
        public static void onSaved(WorldEvent.Save event) {
            if (!event.getWorld().isClientSide() && event.getWorld() instanceof ServerWorld) {
                StatsManager saver = StatsManager.onWorld((ServerWorld) event.getWorld());
        public Object get() {
            return this;

    I've used RaidManager as somewhat of a template for this, and the forge forums you linked.

  3. this has actually helped out a lot! I definitely think the best option is using WorldSavedData.

    On 10/13/2021 at 8:45 AM, Alpvax said:

    Map<player id, your current player capability data>

    I've now gotten Map<UUID, *>, but for the players capability data, what kind of information would I put there?

  4. 1 hour ago, Alpvax said:

    I assumed that was what you wanted. Currently you get the capability of the player opening the book

    this was actually what one of the issues i had was, i wanted to be able to look at any players book without it always showing my capability information.

    1 hour ago, Alpvax said:

    You need to use the player who "owns" the book instead. So store the "owner's" id in the book somehow (NBT/capablility), then when the book is opened, get the player from the id (they may not exist/be offline, in which case you can't reasonably update), then update the data.

    i actually do have a bit that adds a “owner” nbt data in the book! it stores the players uuid if that would work? i just didn’t know how i would check if it’s connected to the players capability.

    in response to the level/world capability, how would i actually do that? im not sure if it’s useful, also eventually wanted to be able to use a command to get a players book even if they’re offline.

  5. On 9/27/2021 at 7:21 AM, Alpvax said:

    No, I actually meant PlayerInteractEvent.RightClickItem, books don't count as being "used" I don't think

    sorry for such a late response! i actually tried that before, but it would always show the player who opened it info. like i would open your book, and it would display my players capability information instead of yours.


  6. Hello! So I’ve been having an issue with my mod. Basically, every time you die, you get another heart. When you die and respawn, the health bar flashes to 10 hearts before it drops back to the new health. I’m guessing it’s a server-client desync. 

    Is there a way to fix this? This issue happens in every version except for in 1.15.2.

    Any help would be immensely appreciated, thank you! :)

  7. Hello! I have a book that writes down a players life information. I.e. how long they’ve been living, and when they die on that life, how long they lasted and what they died from.

    My question is, is it possible to update content in a written book when it’s opened? Becuase the way it works now, you have to get the book with a command instead of it refreshing it’s content automatically.

    Any help would be extremely helpful! Thank you.

    Here’s a pastebin of the current class that writes in the book: https://pastebin.com/s6X05Nzz

  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.