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

添加全部物品分类

This commit is contained in:
XiaoMoMi
2025-12-05 04:39:00 +08:00
parent eea83e16fb
commit ab5a92b18a
6 changed files with 30 additions and 8 deletions

View File

@@ -509,11 +509,10 @@ items:
textures: textures:
texture: minecraft:block/custom/palm_planks texture: minecraft:block/custom/palm_planks
items#pfence: items#fence:
default:palm_fence: default:palm_fence:
material: nether_brick material: nether_brick
data: data::item-name: <!i><l10n:item.palm_fence>
item-name: <!i><l10n:item.palm_fence>
model: model:
type: minecraft:model type: minecraft:model
path: minecraft:item/custom/palm_fence_inventory path: minecraft:item/custom/palm_fence_inventory
@@ -526,6 +525,7 @@ items#pfence:
block: default:palm_fence block: default:palm_fence
default:palm_fence_post: default:palm_fence_post:
material: nether_brick material: nether_brick
data::item-name: <!i><l10n:item.palm_fence_gate>
model: model:
type: minecraft:model type: minecraft:model
path: minecraft:block/custom/palm_fence_post path: minecraft:block/custom/palm_fence_post
@@ -535,6 +535,7 @@ items#pfence:
texture: minecraft:block/custom/palm_planks texture: minecraft:block/custom/palm_planks
default:palm_fence_side: default:palm_fence_side:
material: nether_brick material: nether_brick
data::item-name: <!i><l10n:item.palm_fence_gate>
model: model:
type: minecraft:model type: minecraft:model
path: minecraft:block/custom/palm_fence_side path: minecraft:block/custom/palm_fence_side
@@ -593,6 +594,7 @@ items#button:
block: default:palm_button block: default:palm_button
default:palm_button_pressed: default:palm_button_pressed:
material: nether_brick material: nether_brick
data::item-name: <!i><l10n:item.palm_button>
model: model:
type: minecraft:model type: minecraft:model
path: minecraft:block/custom/palm_button_pressed path: minecraft:block/custom/palm_button_pressed
@@ -602,6 +604,7 @@ items#button:
texture: minecraft:block/custom/palm_planks texture: minecraft:block/custom/palm_planks
default:palm_button_not_pressed: default:palm_button_not_pressed:
material: nether_brick material: nether_brick
data::item-name: <!i><l10n:item.palm_button>
model: model:
type: minecraft:model type: minecraft:model
path: minecraft:block/custom/palm_button_not_pressed path: minecraft:block/custom/palm_button_not_pressed

View File

@@ -20,15 +20,15 @@ items:
default:flower_basket_ground: default:flower_basket_ground:
material: nether_brick material: nether_brick
model: minecraft:item/custom/flower_basket_ground model: minecraft:item/custom/flower_basket_ground
item-name: <!i><l10n:item.flower_basket> data::item-name: <!i><l10n:item.flower_basket>
default:flower_basket_wall: default:flower_basket_wall:
material: nether_brick material: nether_brick
model: minecraft:item/custom/flower_basket_wall model: minecraft:item/custom/flower_basket_wall
item-name: <!i><l10n:item.flower_basket> data::item-name: <!i><l10n:item.flower_basket>
default:flower_basket_ceiling: default:flower_basket_ceiling:
material: nether_brick material: nether_brick
model: minecraft:item/custom/flower_basket_ceiling model: minecraft:item/custom/flower_basket_ceiling
item-name: <!i><l10n:item.flower_basket> data::item-name: <!i><l10n:item.flower_basket>
furniture: furniture:
default:flower_basket: default:flower_basket:
events: events:

View File

@@ -1,3 +1,12 @@
categories:
craftengine:all:
priority: -1000
name: <!i><white><l10n:category.all.name></white>
icon: minecraft:command_block
conditions:
- type: permission
permission: craftengine.admin
all-items: true
images: images:
internal:item_browser: internal:item_browser:
height: 140 height: 140

View File

@@ -12,6 +12,7 @@ translations:
internal.cooking_info: Recipe Information internal.cooking_info: Recipe Information
internal.cooking_info.0: 'Time: <arg:cooking_time>ticks' internal.cooking_info.0: 'Time: <arg:cooking_time>ticks'
internal.cooking_info.1: 'Experience: <arg:cooking_experience>' internal.cooking_info.1: 'Experience: <arg:cooking_experience>'
category.all.name: 'All Items'
zh_cn: zh_cn:
internal.next_page: 下一页 internal.next_page: 下一页
internal.previous_page: 上一页 internal.previous_page: 上一页
@@ -25,6 +26,7 @@ translations:
internal.cooking_info: 配方信息 internal.cooking_info: 配方信息
internal.cooking_info.0: '时间: <arg:cooking_time>刻' internal.cooking_info.0: '时间: <arg:cooking_time>刻'
internal.cooking_info.1: '经验: <arg:cooking_experience>' internal.cooking_info.1: '经验: <arg:cooking_experience>'
category.all.name: '全部物品'
de: de:
internal.next_page: Nächste Seite internal.next_page: Nächste Seite
internal.previous_page: Vorherige Seite internal.previous_page: Vorherige Seite

View File

@@ -51,7 +51,7 @@ public abstract class AbstractItemManager<I> extends AbstractModelGenerator impl
private final ItemParser itemParser; private final ItemParser itemParser;
private final EquipmentParser equipmentParser; private final EquipmentParser equipmentParser;
protected final Map<String, ExternalItemSource<I>> externalItemSources = new HashMap<>(); protected final Map<String, ExternalItemSource<I>> externalItemSources = new HashMap<>();
protected final Map<Key, CustomItem<I>> customItemsById = new HashMap<>(); protected final Map<Key, CustomItem<I>> customItemsById = new LinkedHashMap<>();
protected final Map<String, CustomItem<I>> customItemsByPath = new HashMap<>(); protected final Map<String, CustomItem<I>> customItemsByPath = new HashMap<>();
protected final Map<Key, List<UniqueKey>> customItemTags = new HashMap<>(); protected final Map<Key, List<UniqueKey>> customItemTags = new HashMap<>();
protected final Map<Key, ModernItemModel> modernItemModels1_21_4 = new HashMap<>(); protected final Map<Key, ModernItemModel> modernItemModels1_21_4 = new HashMap<>();

View File

@@ -7,6 +7,7 @@ import net.momirealms.craftengine.core.entity.player.Player;
import net.momirealms.craftengine.core.item.Item; import net.momirealms.craftengine.core.item.Item;
import net.momirealms.craftengine.core.item.ItemBuildContext; import net.momirealms.craftengine.core.item.ItemBuildContext;
import net.momirealms.craftengine.core.item.ItemKeys; import net.momirealms.craftengine.core.item.ItemKeys;
import net.momirealms.craftengine.core.item.ItemManager;
import net.momirealms.craftengine.core.item.recipe.*; import net.momirealms.craftengine.core.item.recipe.*;
import net.momirealms.craftengine.core.pack.LoadingSequence; import net.momirealms.craftengine.core.pack.LoadingSequence;
import net.momirealms.craftengine.core.pack.Pack; import net.momirealms.craftengine.core.pack.Pack;
@@ -24,6 +25,7 @@ import net.momirealms.craftengine.core.util.*;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@SuppressWarnings("DuplicatedCode") @SuppressWarnings("DuplicatedCode")
public class ItemBrowserManagerImpl implements ItemBrowserManager { public class ItemBrowserManagerImpl implements ItemBrowserManager {
@@ -120,7 +122,13 @@ public class ItemBrowserManagerImpl implements ItemBrowserManager {
@Override @Override
public void parseSection(Pack pack, Path path, String node, Key id, Map<String, Object> section) { public void parseSection(Pack pack, Path path, String node, Key id, Map<String, Object> section) {
String name = section.getOrDefault("name", id).toString(); String name = section.getOrDefault("name", id).toString();
List<String> members = MiscUtils.getAsStringList(section.getOrDefault("list", List.of())); List<String> members;
if (ResourceConfigUtils.getAsBoolean(section.get("all-items"), "all-items")) {
ItemManager<?> itemManager = ItemBrowserManagerImpl.this.plugin.itemManager();
members = itemManager.loadedItems().keySet().stream().filter(it -> !itemManager.isVanillaItem(it)).map(Key::asString).collect(Collectors.toList());
} else {
members = MiscUtils.getAsStringList(section.getOrDefault("list", List.of()));
}
Key icon = Key.of(section.getOrDefault("icon", ItemKeys.STONE).toString()); Key icon = Key.of(section.getOrDefault("icon", ItemKeys.STONE).toString());
int priority = ResourceConfigUtils.getAsInt(section.getOrDefault("priority", 0), "priority"); int priority = ResourceConfigUtils.getAsInt(section.getOrDefault("priority", 0), "priority");
List<String> lore = MiscUtils.getAsStringList(section.getOrDefault("lore", List.of())); List<String> lore = MiscUtils.getAsStringList(section.getOrDefault("lore", List.of()));