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

jayxo

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by jayxo

  1. so there’s no way i could make something that would be compatible with anything < 1.16?
  2. i was wondering if theres a way i can write it in 1.16 and it still be compatible with older and future versions. just so i don’t have to constantly find a new way of doing the same thing.
  3. 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!!
  4. 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() { super(XLife.MOD_ID); } 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()) { stats.save(nbt); listNBT.add(nbt); } 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); storage.set(saver); return saver; } public static void onSaved(WorldEvent.Save event) { if (!event.getWorld().isClientSide() && event.getWorld() instanceof ServerWorld) { StatsManager saver = StatsManager.onWorld((ServerWorld) event.getWorld()); saver.setDirty(); } } @Override public Object get() { return this; } } I've used RaidManager as somewhat of a template for this, and the forge forums you linked.
  5. this has actually helped out a lot! I definitely think the best option is using WorldSavedData. I've now gotten Map<UUID, *>, but for the players capability data, what kind of information would I put there?
  6. 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. 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.
  7. yeah! i was saying that in reference to this
  8. this is the HealthBookUtils.class https://pastebin.com/s6X05Nzz i didn’t want to rewrite the entire vanilla written book since i could use nbt data.
  9. what would i use to do that exactly?
  10. 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. https://pastebin.com/3qpwP8BF
  11. https://github.com/jayhillx/XLife/blob/main/src/main/java/com/jayhill/xlife/common/capability/health/HealthEvents.java#L103 this is for the respawn event
  12. 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!
  13. 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.