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

增强配方原料检测

This commit is contained in:
XiaoMoMi
2025-08-05 20:51:59 +08:00
parent afeec47672
commit 0d3f216bac
3 changed files with 21 additions and 12 deletions

View File

@@ -401,15 +401,13 @@ public class BukkitItemManager extends AbstractItemManager<ItemStack> {
for (Object item : (Iterable<?>) MBuiltInRegistries.ITEM) {
Object resourceLocation = FastNMS.INSTANCE.method$Registry$getKey(MBuiltInRegistries.ITEM, item);
Key itemKey = KeyUtils.resourceLocationToKey(resourceLocation);
if (itemKey.namespace().equals("minecraft")) {
VANILLA_ITEMS.add(itemKey);
UniqueKey uniqueKey = UniqueKey.create(itemKey);
Object mcHolder = FastNMS.INSTANCE.method$Registry$getHolderByResourceKey(MBuiltInRegistries.ITEM, FastNMS.INSTANCE.method$ResourceKey$create(MRegistries.ITEM, resourceLocation)).get();
Set<Object> tags = (Set<Object>) CoreReflections.field$Holder$Reference$tags.get(mcHolder);
for (Object tag : tags) {
Key tagId = Key.of(CoreReflections.field$TagKey$location.get(tag).toString());
VANILLA_ITEM_TAGS.computeIfAbsent(tagId, (key) -> new ArrayList<>()).add(uniqueKey);
}
VANILLA_ITEMS.add(itemKey);
UniqueKey uniqueKey = UniqueKey.create(itemKey);
Object mcHolder = FastNMS.INSTANCE.method$Registry$getHolderByResourceKey(MBuiltInRegistries.ITEM, FastNMS.INSTANCE.method$ResourceKey$create(MRegistries.ITEM, resourceLocation)).get();
Set<Object> tags = (Set<Object>) CoreReflections.field$Holder$Reference$tags.get(mcHolder);
for (Object tag : tags) {
Key tagId = Key.of(CoreReflections.field$TagKey$location.get(tag).toString());
VANILLA_ITEM_TAGS.computeIfAbsent(tagId, (key) -> new ArrayList<>()).add(uniqueKey);
}
}
} catch (ReflectiveOperationException e) {