reset entity fall distance after EscapeTarget teleport

comment out redundant teleportation in EscapeTarget
This commit is contained in:
CreepyCre 2021-10-28 00:02:35 +02:00
parent 270b2c81a2
commit 912839afbe
2 changed files with 20 additions and 18 deletions

View file

@ -7,7 +7,6 @@ import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import net.minecraft.client.render.WorldRenderer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.dimdev.dimdoors.client.CustomBreakBlockHandler;

View file

@ -78,6 +78,7 @@ public class EscapeTarget extends VirtualTarget implements EntityTarget { // TOD
}
/*
if (destLoc != null && destLoc.getBlockEntity() instanceof RiftBlockEntity || this.canEscapeLimbo) {
//Location location = VirtualLocation.fromLocation(new Location((ServerWorld) entity.world, entity.getBlockPos())).projectToWorld(false);
TeleportUtil.teleport(entity, destLoc.getWorld(), destLoc.getBlockPos(), relativeAngle, relativeVelocity);
@ -91,11 +92,13 @@ public class EscapeTarget extends VirtualTarget implements EntityTarget { // TOD
TeleportUtil.teleport(entity, ModDimensions.LIMBO_DIMENSION, new BlockPos(this.location.getX(), this.location.getY(), this.location.getZ()), relativeAngle, relativeVelocity);
}
}
*/
if (destLoc != null && this.canEscapeLimbo) {
Location location = VirtualLocation.fromLocation(new Location((ServerWorld) entity.world, destLoc.pos)).projectToWorld(false);
TeleportUtil.teleport(entity, location.getWorld(), location.getBlockPos(), relativeAngle, relativeVelocity);
entity = TeleportUtil.teleport(entity, location.getWorld(), location.getBlockPos(), relativeAngle, relativeVelocity);
entity.fallDistance = 0;
Random random = new Random();
BlockPos.iterateOutwards(location.pos.add(0, -4, 0), 3, 2, 3).forEach((pos1 -> {
if (random.nextFloat() < (1 / ((float) location.pos.getSquaredDistance(pos1))) * DimensionalDoorsInitializer.getConfig().getLimboConfig().limboBlocksCorruptingOverworldAmount) {
@ -107,15 +110,15 @@ public class EscapeTarget extends VirtualTarget implements EntityTarget { // TOD
}
}
}));
}
else {
} else {
if (destLoc == null) {
chat(entity, new TranslatableText("rifts.destinations.escape.did_not_use_rift"));
} else {
chat(entity, new TranslatableText("rifts.destinations.escape.rift_has_closed"));
}
if (ModDimensions.LIMBO_DIMENSION != null) {
TeleportUtil.teleport(entity, ModDimensions.LIMBO_DIMENSION, new BlockPos(this.location.getX(), this.location.getY(), this.location.getZ()), relativeAngle, relativeVelocity);
entity = TeleportUtil.teleport(entity, ModDimensions.LIMBO_DIMENSION, new BlockPos(this.location.getX(), this.location.getY(), this.location.getZ()), relativeAngle, relativeVelocity);
entity.fallDistance = 0;
}
}
return true;