From 47a7ca7e092691b6921b038283759e46818d0292 Mon Sep 17 00:00:00 2001 From: SD Date: Mon, 30 Nov 2020 13:26:21 +0530 Subject: [PATCH] More teleport fixes --- .../rift/registry/PocketEntrancePointer.java | 23 ++++++++----------- .../dimdev/dimdoors/rift/registry/Rift.java | 14 +++++------ 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java b/src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java index 26ac7d00..924915c5 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java @@ -8,17 +8,15 @@ import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.World; public class PocketEntrancePointer extends RegistryVertex { // TODO: PocketRiftPointer superclass? - public static final Codec CODEC = RecordCodecBuilder.create(instance -> { - return instance.group( - DynamicSerializableUuid.CODEC.fieldOf("id").forGetter(a -> a.id), - World.CODEC.fieldOf("pocketDim").forGetter(a -> a.pocketDim), - Codec.INT.fieldOf("pocketId").forGetter(a -> a.pocketId) - ).apply(instance, (id, pocketDim, pocketId) -> { - PocketEntrancePointer pointer = new PocketEntrancePointer(pocketDim, pocketId); - pointer.id = id; - return pointer; - }); - }); + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + DynamicSerializableUuid.CODEC.fieldOf("id").forGetter(a -> a.id), + World.CODEC.fieldOf("pocketDim").forGetter(a -> a.pocketDim), + Codec.INT.fieldOf("pocketId").forGetter(a -> a.pocketId) + ).apply(instance, (id, pocketDim, pocketId) -> { + PocketEntrancePointer pointer = new PocketEntrancePointer(pocketDim, pocketId); + pointer.id = id; + return pointer; + })); public RegistryKey pocketDim; public int pocketId; @@ -28,9 +26,6 @@ public class PocketEntrancePointer extends RegistryVertex { // TODO: PocketRiftP this.pocketId = pocketId; } - public PocketEntrancePointer() { - } - @Override public RegistryVertexType getType() { return RegistryVertexType.ENTRANCE; diff --git a/src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java b/src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java index 8fed2d12..9651d6cd 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java @@ -12,14 +12,12 @@ import org.dimdev.dimdoors.util.Location; import net.minecraft.util.dynamic.DynamicSerializableUuid; public class Rift extends RegistryVertex { - public static final Codec CODEC = RecordCodecBuilder.create(instance -> { - return instance.group( - DynamicSerializableUuid.CODEC.fieldOf("id").forGetter(a -> a.id), - Location.CODEC.fieldOf("location").forGetter(a -> a.location), - Codec.BOOL.fieldOf("isDetached").forGetter(a -> a.isDetached), - LinkProperties.CODEC.fieldOf("properties").forGetter(a -> a.properties) - ).apply(instance, Rift::new); - }); + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + DynamicSerializableUuid.CODEC.fieldOf("id").forGetter(a -> a.id), + Location.CODEC.fieldOf("location").forGetter(a -> a.location), + Codec.BOOL.fieldOf("isDetached").forGetter(a -> a.isDetached), + LinkProperties.CODEC.fieldOf("properties").forGetter(a -> a.properties) + ).apply(instance, Rift::new)); private static final Logger LOGGER = LogManager.getLogger(); public Location location;