From 2d90cb8aaf1bb339c90eff50f9af54e9bc7244f9 Mon Sep 17 00:00:00 2001 From: craisinlord Date: Wed, 7 Oct 2026 22:47:49 -0500 Subject: [PATCH] tweaks --- .../portalgun/PortalGunCollisionHelper.java | 26 +++++++++++++++++++ .../portalgun/PortalGunPortalEntity.java | 9 ------- .../resources/assets/antarchy/lang/en_us.json | 3 +++ 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/portalgun/PortalGunCollisionHelper.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/portalgun/PortalGunCollisionHelper.java index 63ffe32b..bad8617d 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/portalgun/PortalGunCollisionHelper.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/portalgun/PortalGunCollisionHelper.java @@ -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) diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/portalgun/PortalGunPortalEntity.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/portalgun/PortalGunPortalEntity.java index 454f54d1..a888ddbd 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/portalgun/PortalGunPortalEntity.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/portalgun/PortalGunPortalEntity.java @@ -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 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) { diff --git a/common-1.21.1/src/main/resources/assets/antarchy/lang/en_us.json b/common-1.21.1/src/main/resources/assets/antarchy/lang/en_us.json index 8e6426aa..b55fc033 100644 --- a/common-1.21.1/src/main/resources/assets/antarchy/lang/en_us.json +++ b/common-1.21.1/src/main/resources/assets/antarchy/lang/en_us.json @@ -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",