Revert "More teleport fixes"

This reverts commit 47a7ca7e09.
This commit is contained in:
SD 2020-12-12 12:26:28 +05:30
parent 47a7ca7e09
commit b9f82195b4
No known key found for this signature in database
GPG key ID: E36B57EE08544BC5
2 changed files with 22 additions and 15 deletions

View file

@ -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<PocketEntrancePointer> 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<PocketEntrancePointer> 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<World> pocketDim;
public int pocketId;
@ -26,6 +28,9 @@ public class PocketEntrancePointer extends RegistryVertex { // TODO: PocketRiftP
this.pocketId = pocketId;
}
public PocketEntrancePointer() {
}
@Override
public RegistryVertexType<? extends RegistryVertex> getType() {
return RegistryVertexType.ENTRANCE;

View file

@ -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<Rift> 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<Rift> 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;