fix glitchy same world teleport
fix private pocket door in other pocket dimensions
This commit is contained in:
parent
26280c221a
commit
67534c81dd
4 changed files with 19 additions and 5 deletions
|
@ -8,7 +8,6 @@ import org.dimdev.dimdoors.block.ModBlocks;
|
|||
import org.dimdev.dimdoors.entity.ModEntityTypes;
|
||||
import org.dimdev.dimdoors.fluid.ModFluids;
|
||||
import org.dimdev.dimdoors.rift.registry.LinkProperties;
|
||||
import org.dimdev.dimdoors.rift.targets.EscapeTarget;
|
||||
import org.dimdev.dimdoors.rift.targets.PrivatePocketExitTarget;
|
||||
import org.dimdev.dimdoors.rift.targets.PrivatePocketTarget;
|
||||
import org.dimdev.dimdoors.rift.targets.PublicPocketTarget;
|
||||
|
@ -53,7 +52,7 @@ public final class ModItems {
|
|||
ModBlocks.QUARTZ_DIMENSIONAL_DOOR,
|
||||
new Item.Settings().group(DIMENSIONAL_DOORS).maxCount(1),
|
||||
rift -> {
|
||||
if (ModDimensions.isPocketDimension(rift.getWorld())) {
|
||||
if (ModDimensions.isPrivatePocketDimension(rift.getWorld())) {
|
||||
rift.setDestination(new PrivatePocketExitTarget()); // exit
|
||||
} else {
|
||||
rift.setDestination(new PrivatePocketTarget()); // entrances
|
||||
|
|
|
@ -32,7 +32,7 @@ public class PrivatePocketExitTarget extends VirtualTarget implements EntityTarg
|
|||
if (uuid != null) {
|
||||
destLoc = DimensionalRegistry.getRiftRegistry().getPrivatePocketExit(uuid);
|
||||
Pocket pocket = DimensionalRegistry.getPrivateRegistry().getPrivatePocket(uuid);
|
||||
if (ModDimensions.isPersonalPocketDimension(this.location.getWorld()) && pocket != null && DimensionalRegistry.getPocketDirectory(pocket.getWorld()).getPocketAt(this.location.pos).equals(pocket)) {
|
||||
if (ModDimensions.isPrivatePocketDimension(this.location.getWorld()) && pocket != null && DimensionalRegistry.getPocketDirectory(pocket.getWorld()).getPocketAt(this.location.pos).equals(pocket)) {
|
||||
DimensionalRegistry.getRiftRegistry().setLastPrivatePocketEntrance(uuid, this.location); // Remember which exit was used for next time the pocket is entered
|
||||
}
|
||||
if (destLoc == null || !(destLoc.getBlockEntity() instanceof RiftBlockEntity)) {
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.world.TeleportTarget;
|
|||
import net.minecraft.world.World;
|
||||
|
||||
import net.fabricmc.fabric.api.dimension.v1.FabricDimensions;
|
||||
import org.dimdev.dimdoors.util.math.MathUtil;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public final class TeleportUtil {
|
||||
|
@ -31,6 +30,13 @@ public final class TeleportUtil {
|
|||
throw new UnsupportedOperationException("Only supported on ServerWorld");
|
||||
}
|
||||
|
||||
if (entity.world.getRegistryKey().equals(world.getRegistryKey())) {
|
||||
entity.yaw = yaw;
|
||||
entity.teleport(pos.x, pos.y, pos.z);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
return FabricDimensions.teleport(entity, (ServerWorld) world, new TeleportTarget(pos, entity.getVelocity(), yaw, entity.getPitch(1.0F)));
|
||||
}
|
||||
|
||||
|
@ -39,6 +45,15 @@ public final class TeleportUtil {
|
|||
throw new UnsupportedOperationException("Only supported on ServerWorld");
|
||||
}
|
||||
|
||||
if (entity.world.getRegistryKey().equals(world.getRegistryKey())) {
|
||||
entity.yaw = angle.getYaw();
|
||||
entity.pitch = angle.getPitch();
|
||||
entity.teleport(pos.x, pos.y, pos.z);
|
||||
entity.setVelocity(velocity);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
return FabricDimensions.teleport(entity, (ServerWorld) world, new TeleportTarget(pos, velocity, angle.getYaw(), angle.getPitch()));
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public final class ModDimensions {
|
|||
return isPocketDimension(world.getRegistryKey());
|
||||
}
|
||||
|
||||
public static boolean isPersonalPocketDimension(World world) {
|
||||
public static boolean isPrivatePocketDimension(World world) {
|
||||
return world != null && world == PERSONAL_POCKET_DIMENSION;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue