mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-26 02:19:23 +00:00
fix colliders
This commit is contained in:
@@ -359,6 +359,7 @@ public class BukkitFurnitureManager implements FurnitureManager {
|
||||
int collisionEntityId = FastNMS.INSTANCE.method$Entity$getId(collisionEntity);
|
||||
this.furnitureByCollisionEntitiesId.put(collisionEntityId, loadedFurniture);
|
||||
}
|
||||
loadedFurniture.initializeColliders();
|
||||
return loadedFurniture;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,12 +138,18 @@ public class LoadedFurniture {
|
||||
double z2 = z + offset2.z() - offset.z();
|
||||
Object aabb = FastNMS.INSTANCE.constructor$AABB(x1, y1, z1, x2, y2, z2);
|
||||
CollisionEntity entity = FastNMS.INSTANCE.createCollisionShulker(world, aabb, x, y, z, collider.canBeHitByProjectile());
|
||||
FastNMS.INSTANCE.method$LevelWriter$addFreshEntity(world, entity);
|
||||
this.collisionEntities[i] = entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void initializeColliders() {
|
||||
Object world = FastNMS.INSTANCE.field$CraftWorld$ServerLevel(this.location.getWorld());
|
||||
for (CollisionEntity entity : this.collisionEntities) {
|
||||
FastNMS.INSTANCE.method$LevelWriter$addFreshEntity(world, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Object spawnPacket(Player player) {
|
||||
// TODO hasPermission might be slow, can we use a faster way in the future?
|
||||
|
||||
Reference in New Issue
Block a user