Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repairing changes to Limbo options #436

Open
wants to merge 3 commits into
base: 1.20.1-multiplatform
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/src/main/java/org/dimdev/dimdoors/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public static class Limbo {
@Tooltip public boolean hardcoreLimbo = false;
@Tooltip public int limboReturnDistance = 5000;
@Tooltip public float limboBlocksCorruptingExitWorldAmount = 5;
@Tooltip @Nullable public ResourceKey<Level> escapeTargetWorld = Level.OVERWORLD;
@Tooltip public String escapeTargetWorld = "";
@Tooltip public int escapeTargetWorldYSpawn = 64;
@Tooltip public boolean escapeToWorldSpawn = false;
public boolean shouldUseLimbo(ResourceKey<Level> level) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Rotations;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -63,11 +65,11 @@ public boolean receiveEntity(Entity entity, Vec3 relativePos, Rotations relative
}
Location destLoc;

if (((ServerPlayer) entity.level().getPlayerByUUID(uuid)).getRespawnPosition() != null && DimensionalDoors.getConfig().getLimboConfig().escapeTargetWorld == null && !DimensionalDoors.getConfig().getLimboConfig().escapeToWorldSpawn) {
LOGGER.log(Level.INFO, "Sending player from limbo to their spawnpoint, good luck!");
destLoc = new Location(((ServerPlayer) entity.level().getPlayerByUUID(uuid)).getRespawnDimension(), ((ServerPlayer) entity.level().getPlayerByUUID(uuid)).getRespawnPosition());
} else if (DimensionalDoors.getConfig().getLimboConfig().escapeTargetWorld != null && !DimensionalDoors.getConfig().getLimboConfig().escapeToWorldSpawn) {
targetWorldResourceKey = DimensionalDoors.getConfig().getLimboConfig().escapeTargetWorld;
if (((ServerPlayer) entity.level().getPlayerByUUID(uuid)).getRespawnPosition() != null && DimensionalDoors.getConfig().getLimboConfig().escapeTargetWorld == "" && !DimensionalDoors.getConfig().getLimboConfig().escapeToWorldSpawn) {
LOGGER.log(Level.INFO, "Sending player from limbo to their spawnpoint, good luck!");
destLoc = new Location(((ServerPlayer) entity.level().getPlayerByUUID(uuid)).getRespawnDimension(), ((ServerPlayer) entity.level().getPlayerByUUID(uuid)).getRespawnPosition());
} else if (DimensionalDoors.getConfig().getLimboConfig().escapeTargetWorld != "" && !DimensionalDoors.getConfig().getLimboConfig().escapeToWorldSpawn) {
targetWorldResourceKey = ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(DimensionalDoors.getConfig().getLimboConfig().escapeTargetWorld);
if (DimensionalDoors.getWorld(targetWorldResourceKey) != null) {
LOGGER.log(Level.INFO, "Sending player from limbo to the exit dimension, good luck!");
destLoc = new Location(DimensionalDoors.getWorld(targetWorldResourceKey), new BlockPos(entity.blockPosition().getX(), DimensionalDoors.getConfig().getLimboConfig().escapeTargetWorldYSpawn, entity.blockPosition().getZ()));
Expand Down