From 8b86021a04bf7bb45489f8e59043061c6693ac45 Mon Sep 17 00:00:00 2001 From: craisinlord Date: Sun, 13 Sep 2026 11:24:50 -0500 Subject: [PATCH] Emp scorp spawn fix Wormy caves tweak Beam maybe fixed?? --- .../client/renderer/RoyalBeamRenderTypes.java | 2 +- .../client/renderer/RoyalBossRenderer.java | 10 ++-- .../RoyalElementalProjectileRenderer.java | 14 ++++- .../client/renderer/RoyalMountRenderer.java | 51 +++++++++++++++---- .../content/entity/EmperorScorpionEntity.java | 24 +++++++-- .../content/entity/ManticoreEntity.java | 1 + .../content/entity/ant/AntTeleportHelper.java | 36 ++++++++++--- .../content/entity/royal/KingEntity.java | 41 +++++++++++++++ .../content/entity/royal/RoyalBossEntity.java | 36 +++++++++++-- .../data/antarchy/dimension/cavaryn.json | 4 +- .../entity/multipart/MultipartPartEntity.java | 2 +- .../entity/multipart/MultipartPartEntity.java | 2 +- 12 files changed, 186 insertions(+), 37 deletions(-) diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalBeamRenderTypes.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalBeamRenderTypes.java index ed243204..51b2221f 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalBeamRenderTypes.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalBeamRenderTypes.java @@ -13,7 +13,7 @@ public class RoyalBeamRenderTypes extends RenderType { } public static RenderType beam(ResourceLocation texture) { - return create("royal_beam", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, true, + return create("tremorzilla_beam", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, true, CompositeState.builder() .setTextureState(new TextureStateShard(texture, false, false)) .setShaderState(RenderStateShard.RENDERTYPE_ENERGY_SWIRL_SHADER) diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalBossRenderer.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalBossRenderer.java index 8059ff41..af43c516 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalBossRenderer.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalBossRenderer.java @@ -246,7 +246,7 @@ public class RoyalBossRenderer extends GeoEntityRenderer { beamVertex(vertices, pose, d, minU, maxV, 255); } - private static void drawBeamImpact(VertexConsumer vertices, org.joml.Matrix4f pose, float z, float size) { + static void drawBeamImpact(VertexConsumer vertices, org.joml.Matrix4f pose, float z, float size) { PoseStack endpoint = new PoseStack(); endpoint.last().pose().set(pose); endpoint.translate(0.0D, 0.0D, z); @@ -325,17 +325,17 @@ public class RoyalBossRenderer extends GeoEntityRenderer { private static void vertex(VertexConsumer vertices, org.joml.Matrix4f pose, Vec3 pos, float u, float v) { vertices.addVertex(pose, (float) pos.x, (float) pos.y, (float) pos.z) - .setColor(255, 255, 255, 255).setUv(u, v) + .setColor(1.0F, 1.0F, 1.0F, 1.0F).setUv(u, v) .setOverlay(net.minecraft.client.renderer.texture.OverlayTexture.NO_OVERLAY) - .setLight(0x00F000F0) + .setLight(240) .setNormal(0.0F, 1.0F, 0.0F); } private static void beamVertex(VertexConsumer vertices, org.joml.Matrix4f pose, Vec3 pos, float u, float v, int alpha) { vertices.addVertex(pose, (float) pos.x, (float) pos.y, (float) pos.z) - .setColor(255, 255, 255, alpha).setUv(u, v) + .setColor(1.0F, 1.0F, 1.0F, alpha / 255.0F).setUv(u, v) .setOverlay(OverlayTexture.NO_OVERLAY) - .setLight(0x00F000F0) + .setLight(240) .setNormal(0.0F, -1.0F, 0.0F); } } diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalElementalProjectileRenderer.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalElementalProjectileRenderer.java index c66d6987..f18b68ec 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalElementalProjectileRenderer.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalElementalProjectileRenderer.java @@ -10,6 +10,7 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; import software.bernie.geckolib.cache.object.BakedGeoModel; import software.bernie.geckolib.renderer.GeoEntityRenderer; @@ -41,8 +42,17 @@ public class RoyalElementalProjectileRenderer extends GeoEntityRenderer 1.0E-6D) { + double horizontal = travel.horizontalDistance(); + yaw = (float) (Mth.atan2(travel.z, travel.x) * Mth.RAD_TO_DEG) - 90.0F; + pitch = (float) (Mth.atan2(horizontal, travel.y) * Mth.RAD_TO_DEG) - 90.0F; + } else { + yaw = Mth.rotLerp(partialTick, entity.yRotO, entity.getYRot()); + pitch = Mth.lerp(partialTick, entity.xRotO, entity.getXRot()); + } poseStack.mulPose(Axis.YP.rotationDegrees(180.0F - yaw)); poseStack.mulPose(Axis.XP.rotationDegrees(-pitch)); if (!entity.isIceball()) { diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalMountRenderer.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalMountRenderer.java index d8728a4a..b3cc96fd 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalMountRenderer.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/client/renderer/RoyalMountRenderer.java @@ -73,6 +73,7 @@ public class RoyalMountRenderer extends GeoEntityRenderer { Vec3 side = dir.cross(new Vec3(0.0D, 1.0D, 0.0D)); if (side.lengthSqr() < 1.0E-4D) side = dir.cross(new Vec3(1.0D, 0.0D, 0.0D)); side = side.normalize(); + Vec3 side2 = dir.cross(side).normalize(); ResourceLocation outer = QUEEN_OUTER; ResourceLocation inner = QUEEN_INNER; ResourceLocation[] endTextures = {QUEEN_END_1, QUEEN_END_2}; @@ -85,17 +86,45 @@ public class RoyalMountRenderer extends GeoEntityRenderer { } float time = entity.tickCount + partialTick; float outerV = -time * 0.25F; - org.joml.Matrix4f pose = poseStack.last().pose(); - Vec3 side2 = dir.cross(side).normalize(); - VertexConsumer outerBuffer = bufferSource.getBuffer(RoyalBeamRenderTypes.beam(outer)); - drawBeamTube(outerBuffer, pose, start, finish, side, side2, 0.44F, 8, outerV, 0.0F, 0.55F, 0.15F, 0); float innerV = -time * 0.25F * 0.5F; + float yaw = (float) Math.atan2(dir.z, dir.x); + float pitch = (float) Math.acos(dir.y); + poseStack.pushPose(); + poseStack.translate(start.x, start.y, start.z); + poseStack.mulPose(com.mojang.math.Axis.YP.rotation((float) (Math.PI * 0.5D - yaw))); + poseStack.mulPose(com.mojang.math.Axis.XP.rotation((float) (-Math.PI * 0.5D + pitch))); + poseStack.mulPose(com.mojang.math.Axis.ZP.rotationDegrees(45.0F)); + org.joml.Matrix4f pose = poseStack.last().pose(); VertexConsumer innerBuffer = bufferSource.getBuffer(RoyalBeamRenderTypes.beam(inner)); - drawBeamTube(innerBuffer, pose, start, finish, side, side2, 0.375F, 4, innerV, 1.0F, 0.55F, 0.5F, 255); - float impactSize = 0.375F + 0.09F * Mth.sin(time * 0.6F); + drawLocalBeam(innerBuffer, pose, length, 0.375F, 4, innerV, 0.5F); + VertexConsumer outerBuffer = bufferSource.getBuffer(RoyalBeamRenderTypes.beam(outer)); + drawLocalBeam(outerBuffer, pose, length, 0.44F, 8, outerV, 0.15F); ResourceLocation endTexture = endTextures[(entity.tickCount / 2) % endTextures.length]; VertexConsumer endBuffer = bufferSource.getBuffer(RoyalBeamRenderTypes.beam(endTexture)); - drawBeamImpact(endBuffer, pose, finish.subtract(dir.scale(0.375D)), dir, side, side2, impactSize); + RoyalBossRenderer.drawBeamImpact(endBuffer, pose, (float) length - 1.5F, 0.375F); + poseStack.popPose(); + } + + private static void drawLocalBeam(VertexConsumer vertices, org.joml.Matrix4f pose, double length, + float radius, int sections, float scroll, float uvLengthScale) { + float endV = scroll + (float) length * uvLengthScale; + float previousX = -radius; + float previousY = 0.0F; + float previousU = 0.0F; + for (int i = 0; i <= sections; i++) { + float angle = (float) (Math.PI + Math.PI * 2.0D * i / sections); + float currentX = Mth.cos(angle) * radius; + float currentY = Mth.sin(angle) * radius; + emitBeamQuad(vertices, pose, + new Vec3(previousX * 0.55D, previousY * 0.55D, 0.0D), + new Vec3(previousX, previousY, length), + new Vec3(currentX, currentY, length), + new Vec3(currentX * 0.55D, currentY * 0.55D, 0.0D), + previousU, scroll, i + 1.0F, endV, 255); + previousX = currentX; + previousY = currentY; + previousU = i + 1.0F; + } } private static void drawBeamTube(VertexConsumer vertices, org.joml.Matrix4f pose, Vec3 start, Vec3 end, @@ -153,12 +182,12 @@ public class RoyalMountRenderer extends GeoEntityRenderer { } private static void vertex(VertexConsumer vertices, org.joml.Matrix4f pose, Vec3 pos, float u, float v) { - vertices.addVertex(pose, (float) pos.x, (float) pos.y, (float) pos.z).setColor(255, 255, 255, 255).setUv(u, v) - .setOverlay(net.minecraft.client.renderer.texture.OverlayTexture.NO_OVERLAY).setLight(0x00F000F0).setNormal(0.0F, 1.0F, 0.0F); + vertices.addVertex(pose, (float) pos.x, (float) pos.y, (float) pos.z).setColor(1.0F, 1.0F, 1.0F, 1.0F).setUv(u, v) + .setOverlay(net.minecraft.client.renderer.texture.OverlayTexture.NO_OVERLAY).setLight(240).setNormal(0.0F, 1.0F, 0.0F); } private static void beamVertex(VertexConsumer vertices, org.joml.Matrix4f pose, Vec3 pos, float u, float v, int alpha) { - vertices.addVertex(pose, (float) pos.x, (float) pos.y, (float) pos.z).setColor(255, 255, 255, alpha).setUv(u, v) - .setOverlay(net.minecraft.client.renderer.texture.OverlayTexture.NO_OVERLAY).setLight(0x00F000F0).setNormal(0.0F, -1.0F, 0.0F); + vertices.addVertex(pose, (float) pos.x, (float) pos.y, (float) pos.z).setColor(1.0F, 1.0F, 1.0F, alpha / 255.0F).setUv(u, v) + .setOverlay(net.minecraft.client.renderer.texture.OverlayTexture.NO_OVERLAY).setLight(240).setNormal(0.0F, -1.0F, 0.0F); } } diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/EmperorScorpionEntity.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/EmperorScorpionEntity.java index 177143d0..226a3fb7 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/EmperorScorpionEntity.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/EmperorScorpionEntity.java @@ -47,6 +47,8 @@ import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; import software.bernie.geckolib.animatable.GeoEntity; @@ -108,6 +110,8 @@ public class EmperorScorpionEntity extends Monster implements GeoEntity { private static final ResourceKey THORAXIS_KEY = ResourceKey.create(Registries.DIMENSION, ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "thoraxis")); + private static final ResourceKey DREAM_DUNES = ResourceKey.create( + Registries.BIOME, ResourceLocation.fromNamespaceAndPath(Antarchy.MODID, "dream_dunes")); private static final RawAnimation IDLE_ANIM = RawAnimation.begin().thenLoop("idle"); private static final RawAnimation WALK_ANIM = RawAnimation.begin().thenLoop("walk"); @@ -237,11 +241,23 @@ public class EmperorScorpionEntity extends Monster implements GeoEntity { if (!level.getLevel().dimension().equals(THORAXIS_KEY)) { return false; } - if (ThoraxisUndersideManager.shouldSpawnInvertedOnDreamSand(level, pos)) { - return level.getDifficulty() != Difficulty.PEACEFUL; + if (level.getDifficulty() == Difficulty.PEACEFUL) { + return false; } - return level.getDifficulty() != Difficulty.PEACEFUL - && Monster.checkMonsterSpawnRules(entityType, level, spawnReason, pos, random); + if (ThoraxisUndersideManager.shouldSpawnInvertedOnDreamSand(level, pos)) { + return true; + } + // Dream Dunes can use Dream Sandstone as the ceiling surface too. Keep + // the Emperor restricted to a supported underside position, but do + // not require the surface to be the narrower Dream Sand variant. + if (pos.getY() < 0 && level.getBiome(pos).is(DREAM_DUNES) && level.isEmptyBlock(pos)) { + BlockState below = level.getBlockState(pos.below()); + BlockState above = level.getBlockState(pos.above()); + boolean floorSupport = !below.is(Blocks.BEDROCK) && below.isFaceSturdy(level, pos.below(), Direction.UP); + boolean ceilingSupport = !above.is(Blocks.BEDROCK) && above.isFaceSturdy(level, pos.above(), Direction.DOWN); + return floorSupport || ceilingSupport; + } + return Monster.checkMonsterSpawnRules(entityType, level, spawnReason, pos, random); } @Override diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/ManticoreEntity.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/ManticoreEntity.java index 0457a07c..8559d19f 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/ManticoreEntity.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/ManticoreEntity.java @@ -2,6 +2,7 @@ package com.craisinlord.antarchy.content.entity; import com.craisinlord.antarchy.config.AntarchySettings; import com.craisinlord.antarchy.content.AntarchyObjects; +import com.craisinlord.antarchy.content.AntarchySoundEvents; import com.craisinlord.antarchy.content.entity.royal.QueenEntity; import com.craisinlord.antarchy.content.gravity.AntarchyGravityApi; import com.craisinlord.antarchy.content.gravity.AntarchyGravityDirection; diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/ant/AntTeleportHelper.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/ant/AntTeleportHelper.java index 8d132000..b14d65c6 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/ant/AntTeleportHelper.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/ant/AntTeleportHelper.java @@ -27,7 +27,9 @@ import net.minecraft.world.entity.vehicle.DismountHelper; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.portal.DimensionTransition; import net.minecraft.world.phys.Vec3; @@ -254,12 +256,7 @@ public final class AntTeleportHelper { return safeArrivalPos; } - if (destination.hasChunkAt(preferredPos)) { - BlockPos fallbackPos = player.adjustSpawnLocation(destination, preferredPos); - return Vec3.atBottomCenterOf(fallbackPos); - } - - return Vec3.atBottomCenterOf(getClampedFallbackPosition(destination, preferredPos)); + return createEmergencyArrivalPlatform(destination, preferredPos); } @Nullable @@ -414,4 +411,31 @@ public final class AntTeleportHelper { int maxY = destination.getMaxBuildHeight() - 1; return new BlockPos(preferredPos.getX(), Mth.clamp(preferredPos.getY(), minY, maxY), preferredPos.getZ()); } + + /** + * Last-resort landing location for custom dimensions whose generated spawn + * area has no valid player-sized space. The normal search always runs first; + * this only modifies terrain when there is no safe generated location. + */ + private static Vec3 createEmergencyArrivalPlatform(ServerLevel destination, BlockPos preferredPos) { + BlockPos center = getClampedFallbackPosition(destination, preferredPos); + int minY = destination.getMinBuildHeight() + 1; + int maxY = destination.getMaxBuildHeight() - 2; + center = new BlockPos(center.getX(), Mth.clamp(center.getY(), minY, maxY), center.getZ()); + + destination.getChunkAt(center); + BlockState platformState = Blocks.STONE.defaultBlockState(); + + for (int xOffset = -2; xOffset <= 2; xOffset++) { + for (int zOffset = -2; zOffset <= 2; zOffset++) { + BlockPos column = center.offset(xOffset, 0, zOffset); + destination.setBlock(column.below(), platformState, Block.UPDATE_ALL); + for (int yOffset = 0; yOffset <= 3; yOffset++) { + destination.removeBlock(column.above(yOffset), false); + } + } + } + + return Vec3.atBottomCenterOf(center); + } } diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/KingEntity.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/KingEntity.java index bba9cd6e..5de49b4a 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/KingEntity.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/KingEntity.java @@ -89,6 +89,8 @@ public class KingEntity extends RoyalBossEntity { private static final int BEHAVIOR_SCORE_CAP = 12; /** Keep the tree-bound patrol safely inside the authored tree footprint. */ private static final double TREE_ORBIT_RADIUS = 128.0D; + private static final double TREE_RETURN_RADIUS = 192.0D; + private static final double TREE_RETURN_RELEASE_RADIUS = 144.0D; private static final double TREE_ORBIT_ANGLE_STEP = 0.014D; private static final int TREE_ORBIT_PATH_SAMPLES = 16; @@ -102,6 +104,7 @@ public class KingEntity extends RoyalBossEntity { private double treePatrolMaximumY; private double treePatrolAngle; private boolean treePatrolBound; + private boolean returningToTree; private int patrolCooldownTicks; private int decreeCooldownTicks; private int activeDecreeTicks; @@ -360,6 +363,10 @@ public class KingEntity extends RoyalBossEntity { @Override public void tick() { + if (!this.level().isClientSide && this.shouldReturnToTree()) { + this.returningToTree = true; + this.setTarget(null); + } super.tick(); if (this.level().isClientSide) { return; @@ -372,6 +379,21 @@ public class KingEntity extends RoyalBossEntity { ServerLevel serverLevel = (ServerLevel) this.level(); this.iceBuildup.entrySet().removeIf(entry -> serverLevel.getEntity(entry.getKey()) == null); if (this.iceBuildup.size() > 16) this.iceBuildup.clear(); + if (this.returningToTree) { + this.setTarget(null); + this.decreeRetreatPressure = false; + if (this.treePatrolBound && this.treePatrolCenter != null) { + this.setRoyalFlying(true); + if (this.isWithinTreeReturnReleaseRadius()) { + this.returningToTree = false; + } else { + this.tickTreePatrol(); + return; + } + } else { + this.returningToTree = false; + } + } LivingEntity target = this.getTarget(); if (target != null && !this.isDeadOrDying() && this.level() instanceof ServerLevel level) { this.trackBehavior(target); @@ -426,6 +448,25 @@ public class KingEntity extends RoyalBossEntity { } } + private boolean shouldReturnToTree() { + return this.treePatrolBound && this.treePatrolCenter != null + && this.horizontalDistanceToTreeSqr() > TREE_RETURN_RADIUS * TREE_RETURN_RADIUS; + } + + private boolean isWithinTreeReturnReleaseRadius() { + return this.treePatrolCenter != null + && this.horizontalDistanceToTreeSqr() <= TREE_RETURN_RELEASE_RADIUS * TREE_RETURN_RELEASE_RADIUS; + } + + private double horizontalDistanceToTreeSqr() { + if (this.treePatrolCenter == null) { + return 0.0D; + } + double dx = this.getX() - this.treePatrolCenter.x; + double dz = this.getZ() - this.treePatrolCenter.z; + return dx * dx + dz * dz; + } + @Nullable private Vec3 findTreePatrolWaypoint(Vec3 center, double angle) { for (int attempt = 0; attempt < 10; attempt++) { diff --git a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/RoyalBossEntity.java b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/RoyalBossEntity.java index 860043df..a5a56bfc 100644 --- a/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/RoyalBossEntity.java +++ b/common-1.21.1/src/main/java/com/craisinlord/antarchy/content/entity/royal/RoyalBossEntity.java @@ -174,6 +174,9 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult private final PathNavigation flyingNavigation; private int locomotionDecisionTicks = 80; private boolean landingForCombat; + @Nullable + private Vec3 aerialCombatAnchor; + private int aerialCombatAnchorTicks; @Nullable private Entity[] multipartParts; @@ -452,10 +455,12 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult } this.tickCombatLocomotionMode(primaryTarget); - this.getLookControl().setLookAt(primaryTarget, 30.0F, 30.0F); + boolean aeriallyStabilized = this.steerTowardTarget(primaryTarget); + if (!aeriallyStabilized) { + this.getLookControl().setLookAt(primaryTarget, 30.0F, 30.0F); + } this.assignHeadTargets(primaryTarget); this.tickRoyalBeam(primaryTarget); - this.steerTowardTarget(primaryTarget); this.tickBodyCrush(); Phase phase = this.phase(); @@ -649,7 +654,7 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult return true; } - private void steerTowardTarget(LivingEntity target) { + private boolean steerTowardTarget(LivingEntity target) { double dx = target.getX() - this.getX(); double dz = target.getZ() - this.getZ(); double horizontalDistance = Math.sqrt(dx * dx + dz * dz); @@ -666,14 +671,36 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult double approachSpeed = anyHeadInBiteRange ? 1.0D : this.biteApproachSpeed(); if (!this.isRoyalFlying()) { + this.aerialCombatAnchor = null; + this.aerialCombatAnchorTicks = 0; if (atStandoff) { this.getNavigation().stop(); } else { this.getMoveControl().setWantedPosition(wanted.x, target.getY(), wanted.z, approachSpeed); } - return; + return false; } + double verticalDistance = Math.abs(target.getY() + target.getBbHeight() * 0.5D + - (this.getY() + this.getBbHeight() * 0.5D)); + if (!this.landingForCombat && verticalDistance > 6.0D) { + if (this.aerialCombatAnchor == null || this.aerialCombatAnchorTicks-- <= 0) { + double anchorX = this.getX(); + double anchorZ = this.getZ(); + if (horizontalDistance > 10.0D) { + anchorX = wanted.x; + anchorZ = wanted.z; + } + this.aerialCombatAnchor = new Vec3(anchorX, this.getY(), anchorZ); + this.aerialCombatAnchorTicks = 20; + } + Vec3 anchor = this.aerialCombatAnchor; + this.getMoveControl().setWantedPosition(anchor.x, anchor.y, anchor.z, Math.min(approachSpeed, 0.85D)); + return true; + } + this.aerialCombatAnchor = null; + this.aerialCombatAnchorTicks = 0; + boolean inverted = AntarchyGravityApi.isGravityInverted(this); double groundBelowTarget = this.groundYBelow(wanted.x, wanted.z); double wantedY = this.landingForCombat @@ -689,6 +716,7 @@ public abstract class RoyalBossEntity extends Monster implements GeoEntity, Mult } else { this.getMoveControl().setWantedPosition(wanted.x, wantedY, wanted.z, approachSpeed); } + return false; } private void tickCombatLocomotionMode(LivingEntity target) { diff --git a/common-1.21.1/src/main/resources/data/antarchy/dimension/cavaryn.json b/common-1.21.1/src/main/resources/data/antarchy/dimension/cavaryn.json index 38e6f371..b1388103 100644 --- a/common-1.21.1/src/main/resources/data/antarchy/dimension/cavaryn.json +++ b/common-1.21.1/src/main/resources/data/antarchy/dimension/cavaryn.json @@ -179,8 +179,8 @@ 0.9 ], "depth": [ - 0.15, - 2.0 + -2.0, + -0.1 ], "offset": 0.0 }, diff --git a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/entity/multipart/MultipartPartEntity.java b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/entity/multipart/MultipartPartEntity.java index 4558ff17..0f4b4646 100644 --- a/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/entity/multipart/MultipartPartEntity.java +++ b/fabric-1.21.1/src/main/java/com/craisinlord/antarchy/fabric/entity/multipart/MultipartPartEntity.java @@ -83,7 +83,7 @@ public class MultipartPartEntity extends Entity implements MultipartPartAccess { Vec3 right = new Vec3(forward.z, 0.0D, -forward.x); Vec3 localOffset = new Vec3( forward.x * definition.forwardOffset() + right.x * definition.lateralOffset(), - definition.yOffset() + (AntarchyGravityApi.isGravityInverted(parent) ? definition.height() : 0.0D), + definition.yOffset(), forward.z * definition.forwardOffset() + right.z * definition.lateralOffset()); Vec3 offset = AntarchyGravityRotationUtil.vecPlayerToWorld(localOffset, AntarchyGravityApi.getGravityDirection(parent)); Vec3 position = parent.position().add(offset); diff --git a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/entity/multipart/MultipartPartEntity.java b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/entity/multipart/MultipartPartEntity.java index 7693bb21..7b8fece3 100644 --- a/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/entity/multipart/MultipartPartEntity.java +++ b/neoforge-1.21.1/src/main/java/com/craisinlord/antarchy/neoforge/entity/multipart/MultipartPartEntity.java @@ -86,7 +86,7 @@ public class MultipartPartEntity extends PartEntity implements OwnableEn Vec3 right = new Vec3(forward.z, 0.0D, -forward.x); Vec3 localOffset = new Vec3( forward.x * this.definition.forwardOffset() + right.x * this.definition.lateralOffset(), - this.definition.yOffset() + (AntarchyGravityApi.isGravityInverted(parent) ? this.definition.height() : 0.0D), + this.definition.yOffset(), forward.z * this.definition.forwardOffset() + right.z * this.definition.lateralOffset()); Vec3 offset = AntarchyGravityRotationUtil.vecPlayerToWorld(localOffset, AntarchyGravityApi.getGravityDirection(parent)); Vec3 position = parent.position().add(offset);