1515import lombok .ToString ;
1616import net .minecraft .entity .Entity ;
1717import net .minecraft .nbt .NBTTagCompound ;
18+ import org .dimdev .pocketlib .VirtualLocation ;
1819
1920import java .util .UUID ;
2021
2122@ Getter @ AllArgsConstructor @ Builder (toBuilder = true ) @ ToString
2223public class EscapeDestination extends RiftDestination {
23- //public EscapeDestination() {}
24+ boolean canEscapeLimbo = false ;
25+
26+ public EscapeDestination () {}
2427
2528 @ Override
2629 public void readFromNBT (NBTTagCompound nbt ) {
@@ -35,19 +38,20 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
3538
3639 @ Override
3740 public boolean teleport (RotatedLocation loc , Entity entity ) {
38- if (!ModDimensions .isDimDoorsPocketDimension (entity .world )) {
39- if (entity .world .provider instanceof WorldProviderLimbo ) {
40- DimDoors .sendTranslatedMessage (entity , "rifts.destinations.escape.cannot_escape_limbo" );
41- } else {
42- DimDoors .sendTranslatedMessage (entity , "rifts.destinations.escape.not_in_pocket_dim" );
43- }
41+ if (!ModDimensions .isDimDoorsPocketDimension (entity .world ) && !(entity .world .provider instanceof WorldProviderLimbo )) {
42+ DimDoors .sendTranslatedMessage (entity , "rifts.destinations.escape.not_in_pocket_dim" );
4443 return false ;
4544 }
45+ if (entity .world .provider instanceof WorldProviderLimbo && !canEscapeLimbo ) {
46+ DimDoors .sendTranslatedMessage (entity , "rifts.destinations.escape.cannot_escape_limbo" );
47+ return false ;
48+ }
49+
4650 UUID uuid = entity .getUniqueID ();
4751 if (uuid != null ) {
4852 Location destLoc = RiftRegistry .instance ().getOverworldRift (uuid );
49- if (destLoc != null && destLoc .getTileEntity () instanceof TileEntityRift ) {
50- // TeleportUtils.teleport(entity, new VirtualLocation(destLoc, rift.virtualLocation.getDepth ()).projectToWorld()); // TODO
53+ if (destLoc != null && destLoc .getTileEntity () instanceof TileEntityRift || canEscapeLimbo ) {
54+ TeleportUtils .teleport (entity , VirtualLocation . fromLocation ( loc . getLocation ()).projectToWorld (false ));
5155 return true ;
5256 } else {
5357 if (destLoc == null ) {
0 commit comments