9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

添加判断是否是基岩版玩家api

This commit is contained in:
jhqwqmc
2025-12-07 15:54:31 +08:00
parent ef143abcbe
commit b2241fc5f5
2 changed files with 12 additions and 0 deletions

View File

@@ -168,6 +168,8 @@ public class BukkitServerPlayer extends Player {
private int lastHitFurnitureTick;
// 控制展示实体可见距离
private double displayEntityViewDistance;
// 是否是基岩版
private Tristate isBedrock = Tristate.UNDEFINED;
public BukkitServerPlayer(BukkitCraftEngine plugin, @Nullable Channel channel) {
this.channel = channel;
@@ -1517,6 +1519,14 @@ public class BukkitServerPlayer extends Player {
return FastNMS.INSTANCE.method$Inventory$clearOrCountMatchingItems(inventory, predicate, count, craftSlots);
}
@Override
public boolean isBedrock() {
if (this.isBedrock == Tristate.UNDEFINED) {
this.isBedrock = Tristate.of(this.plugin.compatibilityManager().isBedrockPlayer(this));
}
return this.isBedrock.asBoolean();
}
@Override
public void addTrackedFurniture(int entityId, Furniture furniture) {
this.trackedFurniture.put(entityId, new VirtualCullableObject(furniture));