tweaks
This commit is contained in:
1 parent
dcf5eb3cb1
commit
2d90cb8aaf
3 files changed
+29
-9
No files matched your search
+26
@@ -43,6 +43,9 @@ public final class PortalGunCollisionHelper {
|
||||
return collided;
|
||||
}
|
||||
PortalGunWorldPortalShape shape = portal.getWorldPortalShape();
|
||||
if (canWalkIntoFloorPortal(startBox, movement, portal, shape)) {
|
||||
return movement;
|
||||
}
|
||||
Vec3 normal = portal.getNormalVec().normalize();
|
||||
double desiredNormal = movement.dot(normal);
|
||||
double collidedNormal = collided.dot(normal);
|
||||
@@ -57,6 +60,29 @@ public final class PortalGunCollisionHelper {
|
||||
return applyBorderCollision(entity, startBox, adjusted, portal);
|
||||
}
|
||||
|
||||
private static boolean canWalkIntoFloorPortal(AABB startBox, Vec3 movement, PortalGunPortalEntity portal, PortalGunWorldPortalShape shape) {
|
||||
Vec3 normal = portal.getNormalVec().normalize();
|
||||
if (Math.abs(normal.y) < 0.9D) {
|
||||
return false;
|
||||
}
|
||||
AABB endBox = startBox.move(movement);
|
||||
return overlapsPortalOpeningFromSurface(startBox, shape) || overlapsPortalOpeningFromSurface(endBox, shape);
|
||||
}
|
||||
|
||||
private static boolean overlapsPortalOpeningFromSurface(AABB box, PortalGunWorldPortalShape shape) {
|
||||
if (!shape.intersectsPortalColumn(box, EDGE_PADDING, EDGE_PADDING, PLANE_TOLERANCE)) {
|
||||
return false;
|
||||
}
|
||||
double minDepth = Double.POSITIVE_INFINITY;
|
||||
double maxDepth = Double.NEGATIVE_INFINITY;
|
||||
for (Vec3 corner : corners(box)) {
|
||||
double depth = shape.localCoords(corner).depth();
|
||||
minDepth = Math.min(minDepth, depth);
|
||||
maxDepth = Math.max(maxDepth, depth);
|
||||
}
|
||||
return maxDepth > 0.0D && minDepth >= -PLANE_TOLERANCE;
|
||||
}
|
||||
|
||||
private static boolean canUsePortalPassThrough(Entity entity, AABB startBox, Vec3 movement, PortalGunPortalEntity portal, PortalGunWorldPortalShape shape) {
|
||||
AABB endBox = startBox.move(movement);
|
||||
if (!portal.getPortalInsides(entity).intersects(startBox)
|
||||
|
||||
-9
@@ -620,14 +620,6 @@ public class PortalGunPortalEntity extends Entity implements GeoEntity {
|
||||
return this.teleportCooldowns.containsKey(entity.getUUID()) || entity.getPortalCooldown() > 0;
|
||||
}
|
||||
|
||||
private static Vec3 clampPortalMotion(Vec3 motion) {
|
||||
return new Vec3(clampPortalMotionComponent(motion.x), clampPortalMotionComponent(motion.y), clampPortalMotionComponent(motion.z));
|
||||
}
|
||||
|
||||
private static double clampPortalMotionComponent(double motion) {
|
||||
return Math.abs(motion) > 0.99D ? motion / (Math.abs(motion) + 0.001D) : motion;
|
||||
}
|
||||
|
||||
private void teleportEntity(Entity entity, PortalGunPortalEntity destination, Vec3 currentProbe, Vec3 entryMotion, double normalOffset) {
|
||||
List<EntityTeleportState> group = new java.util.ArrayList<>();
|
||||
collectTeleportGroup(entity, null, group);
|
||||
@@ -650,7 +642,6 @@ public class PortalGunPortalEntity extends Entity implements GeoEntity {
|
||||
Vec3 memberMotion = member == entity
|
||||
? transformedMotion
|
||||
: PortalGunTransformUtil.transformVector(this, destination, state.motion());
|
||||
memberMotion = clampPortalMotion(memberMotion);
|
||||
float yaw = PortalGunTransformUtil.yawFromLook(memberLook);
|
||||
float pitch = PortalGunTransformUtil.pitchFromLook(memberLook);
|
||||
if (member instanceof ServerPlayer player && destination.level() instanceof ServerLevel destinationLevel) {
|
||||
|
||||
@@ -1027,6 +1027,9 @@
|
||||
"subtitles.antarchy.portal_open_blue": "Blue portal opens",
|
||||
"subtitles.antarchy.portal_open_orange": "Orange portal opens",
|
||||
"subtitles.antarchy.portal_fizzle": "Portal fizzles",
|
||||
"subtitles.antarchy.portal_ambient": "Portal hums",
|
||||
"subtitles.antarchy.portal_enter": "Entity enters a portal",
|
||||
"subtitles.antarchy.portal_exit": "Entity exits a portal",
|
||||
"subtitles.antarchy.bed_bug_ambient": "Bed Bug chirps",
|
||||
"subtitles.antarchy.bed_bug_hurt": "Bed Bug hurts",
|
||||
"subtitles.antarchy.bed_bug_attack": "Bed Bug bites",
|
||||
|
||||
Reference in new issue
Block a user