mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 09:59:20 +00:00
fix(furniture): 修复家具互动逻辑
This commit is contained in:
@@ -361,9 +361,6 @@ public class BukkitFurnitureManager implements FurnitureManager {
|
||||
int collisionEntityId = (int) Reflections.method$Entity$getId.invoke(collisionEntity);
|
||||
this.furnitureByCollisionEntitiesId.put(collisionEntityId, loadedFurniture);
|
||||
this.furnitureByEntityId.put(collisionEntityId, loadedFurniture);
|
||||
for (HitBox hitBox : loadedFurniture.placement().hitBoxes()) {
|
||||
loadedFurniture.hitBoxes().put(collisionEntityId, hitBox);
|
||||
}
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ public class LoadedFurniture {
|
||||
}
|
||||
for (HitBox hitBox : placement.hitBoxes()) {
|
||||
int[] ids = hitBox.acquireEntityIds(Reflections.instance$Entity$ENTITY_COUNTER::incrementAndGet);
|
||||
int lastEntityId = -1;
|
||||
for (int entityId : ids) {
|
||||
fakeEntityIds.add(entityId);
|
||||
mainEntityIds.add(entityId);
|
||||
@@ -109,6 +110,11 @@ public class LoadedFurniture {
|
||||
}
|
||||
});
|
||||
this.hitBoxes.put(entityId, hitBox);
|
||||
lastEntityId = entityId;
|
||||
}
|
||||
// 预测添加一个CollisionEntity
|
||||
if (lastEntityId != -1) {
|
||||
this.hitBoxes.put(lastEntityId + 1, hitBox);
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -690,7 +690,6 @@ public class PacketConsumers {
|
||||
Object actionType = Reflections.method$ServerboundInteractPacket$Action$getType.invoke(action);
|
||||
if (actionType == null) return;
|
||||
LoadedFurniture furniture = BukkitFurnitureManager.instance().getLoadedFurnitureByEntityId(entityId);
|
||||
player.sendMessage("Interact with " + entityId + " " + actionType + " " + furniture);
|
||||
if (furniture == null) return;
|
||||
Location location = furniture.baseEntity().getLocation();
|
||||
BukkitServerPlayer serverPlayer = (BukkitServerPlayer) user;
|
||||
|
||||
Reference in New Issue
Block a user