This commit is contained in:
LZX committed 2026-09-28 19:25:43 +08:00
1 parent 4e59e3909e
commit f9f3597e81
11 files changed
+56 -22

No files matched your search

@@ -36,7 +36,7 @@ public class RobeModel extends HumanoidArmorModel<LivingEntity> {
.texOffs(46, 0).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 5.0F, 1.0F, new CubeDeformation(0.0F)) .texOffs(46, 0).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 5.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(76, 0).addBox(-3.8F, 0.5F, -2.8F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)) .texOffs(76, 0).addBox(-3.8F, 0.5F, -2.8F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(76, 0).mirror().addBox(1.8F, 0.5F, -2.8F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) .texOffs(76, 0).mirror().addBox(1.8F, 0.5F, -2.8F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(60, 0).addBox(-1.0F, 4.0F, -3.2F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) .texOffs(60, 0).addBox(-1.0F, 2.0F, -3.2F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(68, 0).addBox(-1.0F, 6.0F, -2.5F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)), .texOffs(68, 0).addBox(-1.0F, 6.0F, -2.5F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)),
PartPose.ZERO PartPose.ZERO
); );
@@ -69,7 +69,7 @@ public class RobeModel extends HumanoidArmorModel<LivingEntity> {
.texOffs(64, 36).addBox(-3.0F, 6.0F, -3.0F, 5.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)) .texOffs(64, 36).addBox(-3.0F, 6.0F, -3.0F, 5.0F, 6.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(10, 52).addBox(-2.4F, 0.0F, -2.9F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)) .texOffs(10, 52).addBox(-2.4F, 0.0F, -2.9F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F))
.texOffs(30, 52).addBox(-3.3F, 6.0F, -1.5F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)), .texOffs(30, 52).addBox(-3.3F, 6.0F, -1.5F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)),
PartPose.offset(-1.9F, 12.0F, 0.0F) PartPose.offset(-2.0F, 12.0F, 0.0F)
); );
// 左腿 (长袍内衬 + 左半侧裙摆,随左腿前后摆动) // 左腿 (长袍内衬 + 左半侧裙摆,随左腿前后摆动)
@@ -79,7 +79,7 @@ public class RobeModel extends HumanoidArmorModel<LivingEntity> {
.texOffs(64, 36).mirror().addBox(-2.0F, 6.0F, -3.0F, 5.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false) .texOffs(64, 36).mirror().addBox(-2.0F, 6.0F, -3.0F, 5.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(10, 52).mirror().addBox(0.4F, 0.0F, -2.9F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) .texOffs(10, 52).mirror().addBox(0.4F, 0.0F, -2.9F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(30, 52).mirror().addBox(2.3F, 6.0F, -1.5F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), .texOffs(30, 52).mirror().addBox(2.3F, 6.0F, -1.5F, 1.0F, 6.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false),
PartPose.offset(1.9F, 12.0F, 0.0F) PartPose.offset(2.0F, 12.0F, 0.0F)
); );
return LayerDefinition.create(meshdefinition, 128, 128); return LayerDefinition.create(meshdefinition, 128, 128);
@@ -81,17 +81,11 @@ public class FallenStar extends Item {
); );
if(players.isEmpty()) return false; if(players.isEmpty()) return false;
ServerPlayer player = players.getFirst(); // 1. 标准包围盒碰撞检测捡起
for (ServerPlayer player : players) {
double attractRange = Math.max(AccessoryUtil.getStarPickupRange(player), MIN_ATTRACT_RADIUS); if (player.getBoundingBox().intersects(summon.getBoundingBox())) {
Vec3 dir = player.getBoundingBox().getCenter().subtract(summon.position());
double dist = dir.length();
if(dist <= attractRange) {
summon.setDeltaMovement(dir.scale(ATTRACT_SPEED));
}
if(dist <= PICKUP_RADIUS) {
ItemStack stack = new ItemStack(ModItems.FALLEN_STAR.get()); ItemStack stack = new ItemStack(ModItems.FALLEN_STAR.get());
if(!player.getInventory().add(stack)) return false; if (player.getInventory().add(stack)) {
player.take(summon, 1); player.take(summon, 1);
player.containerMenu.broadcastChanges(); player.containerMenu.broadcastChanges();
player.playNotifySound( player.playNotifySound(
@@ -103,6 +97,29 @@ public class FallenStar extends Item {
onDied(summon); onDied(summon);
return true; return true;
} }
}
}
// 2. 吸引逻辑(保持原有吸引范围,寻找最近的可吸引玩家)
ServerPlayer closestPlayer = null;
double closestDistSq = Double.MAX_VALUE;
for (ServerPlayer player : players) {
double distSq = summon.distanceToSqr(player);
if (distSq < closestDistSq) {
closestDistSq = distSq;
closestPlayer = player;
}
}
if (closestPlayer != null) {
double attractRange = Math.max(AccessoryUtil.getStarPickupRange(closestPlayer), MIN_ATTRACT_RADIUS);
Vec3 dir = closestPlayer.getBoundingBox().getCenter().subtract(summon.position());
double dist = dir.length();
if (dist <= attractRange) {
summon.setDeltaMovement(dir.scale(ATTRACT_SPEED));
}
}
return false; return false;
} }
}; };
@@ -62,22 +62,39 @@ public class ManaStar extends Item {
); );
if(players.isEmpty()) return false; if(players.isEmpty()) return false;
ServerPlayer player = players.getFirst();
CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA); CompoundTag customData = summon.getEntityData().get(StaticSummon.CUSTOM_DATA);
double attractRange = Math.max(AccessoryUtil.getStarPickupRange(player), customData.contains("min_attract_range") ? customData.getDouble("min_attract_range") : 4.0D);
Vec3 dir = player.getBoundingBox().getCenter().subtract(summon.position()); // 1. 标准包围盒碰撞检测捡起
double dist = dir.length(); for (ServerPlayer player : players) {
if(dist <= attractRange) { if (player.getBoundingBox().intersects(summon.getBoundingBox())) {
summon.setDeltaMovement(dir.scale(ATTRACT_SPEED));
}
if(dist <= PICKUP_RADIUS) {
int amount = customData.contains("mana") ? customData.getInt("mana") : 0; int amount = customData.contains("mana") ? customData.getInt("mana") : 0;
PlayerMana.recoverMana(player, amount); PlayerMana.recoverMana(player, amount);
player.addEffect(new MobEffectInstance(ModEffects.MANA_SURGE, MANA_SURGE_DURATION_TICKS, 0)); player.addEffect(new MobEffectInstance(ModEffects.MANA_SURGE, MANA_SURGE_DURATION_TICKS, 0));
onDied(summon); onDied(summon);
return true; return true;
} }
}
// 2. 吸引逻辑(保持原有基础吸引范围不变,寻找最近的可吸引玩家)
ServerPlayer closestPlayer = null;
double closestDistSq = Double.MAX_VALUE;
for (ServerPlayer player : players) {
double distSq = summon.distanceToSqr(player);
if (distSq < closestDistSq) {
closestDistSq = distSq;
closestPlayer = player;
}
}
if (closestPlayer != null) {
double attractRange = Math.max(AccessoryUtil.getStarPickupRange(closestPlayer), customData.contains("min_attract_range") ? customData.getDouble("min_attract_range") : 4.0D);
Vec3 dir = closestPlayer.getBoundingBox().getCenter().subtract(summon.position());
double dist = dir.length();
if (dist <= attractRange) {
summon.setDeltaMovement(dir.scale(ATTRACT_SPEED));
}
}
return false; return false;
} }
}; };
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB