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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user