From 9f407dfb76136bb15ed3a395ee7bdeff86f6e48f Mon Sep 17 00:00:00 2001 From: Sollace Date: Tue, 21 May 2024 21:27:18 +0100 Subject: [PATCH] Revert "Change ether to use type keys" This reverts commit 2ca337a8b813e2bf4fe3bd4949338aa476c568e4. --- .../minelittlepony/unicopia/server/world/Ether.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/server/world/Ether.java b/src/main/java/com/minelittlepony/unicopia/server/world/Ether.java index 1dd46a92..73ffa38d 100644 --- a/src/main/java/com/minelittlepony/unicopia/server/world/Ether.java +++ b/src/main/java/com/minelittlepony/unicopia/server/world/Ether.java @@ -25,7 +25,7 @@ public class Ether extends PersistentState { return WorldOverlay.getPersistableStorage(world, ID, Ether::new, Ether::new); } - private final Map, Map>>> endpoints; + private final Map>>> endpoints; private final Object locker = new Object(); @@ -33,7 +33,7 @@ public class Ether extends PersistentState { Ether(World world, NbtCompound compound) { this.world = world; - this.endpoints = NbtSerialisable.readMap(compound.getCompound("endpoints"), id -> SpellType.getKey(Identifier.tryParse(id)), typeNbt -> { + this.endpoints = NbtSerialisable.readMap(compound.getCompound("endpoints"), Identifier::tryParse, typeNbt -> { return NbtSerialisable.readMap((NbtCompound)typeNbt, UUID::fromString, entityNbt -> { return NbtSerialisable.readMap((NbtCompound)entityNbt, UUID::fromString, Entry::new); }); @@ -49,7 +49,7 @@ public class Ether extends PersistentState { public NbtCompound writeNbt(NbtCompound compound) { synchronized (locker) { pruneNodes(); - compound.put("endpoints", NbtSerialisable.writeMap(endpoints, type -> type.getId().toString(), entities -> { + compound.put("endpoints", NbtSerialisable.writeMap(endpoints, Identifier::toString, entities -> { return NbtSerialisable.writeMap(entities, UUID::toString, spells -> { return NbtSerialisable.writeMap(spells, UUID::toString, Entry::toNBT); }); @@ -62,7 +62,7 @@ public class Ether extends PersistentState { public Entry getOrCreate(T spell, Caster caster) { synchronized (locker) { Entry entry = (Entry)endpoints - .computeIfAbsent(spell.getTypeAndTraits().type(), typeId -> new HashMap<>()) + .computeIfAbsent(spell.getTypeAndTraits().type().getId(), typeId -> new HashMap<>()) .computeIfAbsent(caster.asEntity().getUuid(), entityId -> new HashMap<>()) .computeIfAbsent(spell.getUuid(), spellid -> { markDirty(); @@ -82,7 +82,7 @@ public class Ether extends PersistentState { public void remove(SpellType spellType, UUID entityId) { synchronized (locker) { - endpoints.computeIfPresent(spellType, (typeId, entries) -> { + endpoints.computeIfPresent(spellType.getId(), (typeId, entries) -> { if (entries.remove(entityId) != null) { markDirty(); }