9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 01:49:30 +00:00

修复常加载区块潜影贝

This commit is contained in:
XiaoMoMi
2025-04-08 15:51:00 +08:00
parent 9d33a58727
commit b49698b02d
2 changed files with 14 additions and 1 deletions

View File

@@ -217,6 +217,8 @@ public class BukkitFurnitureManager extends AbstractFurnitureManager {
for (Entity entity : entities) {
if (entity instanceof ItemDisplay display) {
handleBaseEntityLoadEarly(display);
} else if (entity instanceof Shulker shulker) {
handleCollisionEntityLoadOnEntitiesLoad(shulker);
}
}
}
@@ -366,10 +368,19 @@ public class BukkitFurnitureManager extends AbstractFurnitureManager {
}
public void handleCollisionEntityLoadOnEntitiesLoad(Shulker shulker) {
// remove the shulker if it's on chunk load stage
// faster
if (FastNMS.INSTANCE.method$CraftEntity$getHandle(shulker) instanceof CollisionEntity) {
shulker.remove();
return;
}
// not a collision entity
Byte flag = shulker.getPersistentDataContainer().get(FURNITURE_COLLISION, PersistentDataType.BYTE);
if (flag == null || flag != 1) {
return;
}
shulker.remove();
}
private AnchorType getAnchorType(Entity baseEntity, CustomFurniture furniture) {

View File

@@ -45,6 +45,8 @@ public class FurnitureEventListener implements Listener {
for (Entity entity : entities) {
if (entity instanceof ItemDisplay itemDisplay) {
this.manager.handleBaseEntityLoadEarly(itemDisplay);
} else if (entity instanceof Shulker shulker) {
this.manager.handleCollisionEntityLoadOnEntitiesLoad(shulker);
}
}
}