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 924915c5..26ac7d00 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java @@ -8,15 +8,17 @@ 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 -> 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 -> { + 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 RegistryKey pocketDim; public int pocketId; @@ -26,6 +28,9 @@ 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 9651d6cd..8fed2d12 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java @@ -12,12 +12,14 @@ 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 -> 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 -> { + 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); + }); private static final Logger LOGGER = LogManager.getLogger(); public Location location;