9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-29 11:59:11 +00:00

fix(bukkit): 修复玩家载具坐骑问题

This commit is contained in:
jhqwqmc
2025-04-01 06:28:51 +08:00
parent 1c96a38e71
commit 2947505ba0
3 changed files with 8 additions and 3 deletions

View File

@@ -377,7 +377,7 @@ public class BukkitFurnitureManager implements FurnitureManager {
Location vehicleLocation = vehicle.getLocation();
Location originalLocation = vehicleLocation.clone();
originalLocation.setY(furniture.location().getY());
Location targetLocation = originalLocation.clone().add(vehicleLocation.getDirection());
Location targetLocation = originalLocation.clone().add(vehicleLocation.getDirection().multiply(1.1));
if (!isSafeLocation(targetLocation)) {
targetLocation = findSafeLocationNearby(originalLocation);
if (targetLocation == null) return;
@@ -426,7 +426,7 @@ public class BukkitFurnitureManager implements FurnitureManager {
World world = location.getWorld();
if (world == null) return true;
try {
Collection<Entity> nearbyEntities = world.getNearbyEntities(location, 0.5, 2, 0.5);
Collection<Entity> nearbyEntities = world.getNearbyEntities(location, 0.38, 2, 0.38);
for (Entity bukkitEntity : nearbyEntities) {
if (bukkitEntity instanceof Player) continue;
Object nmsEntity = FastNMS.INSTANCE.method$CraftEntity$getHandle(bukkitEntity);

View File

@@ -135,6 +135,11 @@ public class LoadedFurniture {
double z2 = z - offset2.z();
Object aabb = FastNMS.INSTANCE.constructor$AABB(x1, y1, z1, x2, y2, z2);
CollisionEntity entity = FastNMS.INSTANCE.createCollisionEntity(world, aabb, x, y, z, collider.canBeHitByProjectile());
fakeEntityIds.add(entity.getId());
mainEntityIds.add(entity.getId());
for (HitBox hitBox : placement.hitBoxes()) {
this.hitBoxes.put(entity.getId(), hitBox);
}
FastNMS.INSTANCE.method$LevelWriter$addFreshEntity(world, entity);
this.collisionEntities[i] = entity;
}