diff --git a/Allay-API/src/main/java/org/allaymc/api/block/tag/BlockTag.java b/Allay-API/src/main/java/org/allaymc/api/block/tag/BlockTag.java new file mode 100644 index 000000000..f564176c8 --- /dev/null +++ b/Allay-API/src/main/java/org/allaymc/api/block/tag/BlockTag.java @@ -0,0 +1,9 @@ +package org.allaymc.api.block.tag; + +/** + * Allay Project 2024/6/11 + * + * @author daoge_cmd + */ +public record BlockTag(String name) { +} diff --git a/Allay-API/src/main/java/org/allaymc/api/block/type/BlockTypeBuilder.java b/Allay-API/src/main/java/org/allaymc/api/block/type/BlockTypeBuilder.java index 21de2d4f2..476fc37e4 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/type/BlockTypeBuilder.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/type/BlockTypeBuilder.java @@ -6,6 +6,7 @@ import org.allaymc.api.block.component.common.BlockBaseComponent; import org.allaymc.api.block.component.common.CustomBlockComponent; import org.allaymc.api.block.property.type.BlockPropertyType; +import org.allaymc.api.block.tag.BlockTag; import org.allaymc.api.blockentity.type.BlockEntityType; import org.allaymc.api.data.VanillaBlockId; import org.allaymc.api.utils.Identifier; @@ -73,6 +74,8 @@ private Map listComponentToMap(List BlockTypeBuilder setBlockBaseComponentSupplier(Function, BlockBaseComponent> blockBaseComponentSupplier); + BlockTypeBuilder setBlockTags(BlockTag... blockTags); + BlockType build(); interface BlockTypeBuilderFactory { diff --git a/Allay-API/src/main/java/org/allaymc/api/data/VanillaBlockTags.java b/Allay-API/src/main/java/org/allaymc/api/data/VanillaBlockTags.java new file mode 100644 index 000000000..0797b9eb4 --- /dev/null +++ b/Allay-API/src/main/java/org/allaymc/api/data/VanillaBlockTags.java @@ -0,0 +1,85 @@ +package org.allaymc.api.data; + +import java.lang.String; +import java.util.HashMap; +import java.util.Map; +import org.allaymc.api.block.tag.BlockTag; + +/** + * Automatically generated by {@code org.allaymc.codegen.VanillaBlockTagGen}
+ * Allay Project

+ * @author daoge_cmd + */ +public interface VanillaBlockTags { + Map NAME_TO_TAG = new HashMap<>(); + + BlockTag CROP = create("minecraft:crop"); + + BlockTag LOG = create("log"); + + BlockTag STONE_PICK_DIGGABLE = create("stone_pick_diggable"); + + BlockTag GRASS = create("grass"); + + BlockTag OAK = create("oak"); + + BlockTag WOOD = create("wood"); + + BlockTag DARK_OAK = create("dark_oak"); + + BlockTag FERTILIZE_AREA = create("fertilize_area"); + + BlockTag SPRUCE = create("spruce"); + + BlockTag GOLD_PICK_DIGGABLE = create("gold_pick_diggable"); + + BlockTag TRAPDOORS = create("trapdoors"); + + BlockTag IRON_PICK_DIGGABLE = create("iron_pick_diggable"); + + BlockTag BIRCH = create("birch"); + + BlockTag RAIL = create("rail"); + + BlockTag DIRT = create("dirt"); + + BlockTag METAL = create("metal"); + + BlockTag TEXT_SIGN = create("text_sign"); + + BlockTag WATER = create("water"); + + BlockTag DIAMOND_PICK_DIGGABLE = create("diamond_pick_diggable"); + + BlockTag STONE = create("stone"); + + BlockTag GRAVEL = create("gravel"); + + BlockTag SAND = create("sand"); + + BlockTag SNOW = create("snow"); + + BlockTag PLANT = create("plant"); + + BlockTag WOOD_PICK_DIGGABLE = create("wood_pick_diggable"); + + BlockTag ACACIA = create("acacia"); + + BlockTag NOT_FEATURE_REPLACEABLE = create("not_feature_replaceable"); + + BlockTag JUNGLE = create("jungle"); + + BlockTag MOB_SPAWNER = create("mob_spawner"); + + BlockTag PUMPKIN = create("pumpkin"); + + static BlockTag create(String name) { + var tag = new BlockTag(name); + NAME_TO_TAG.put(name, tag); + return tag; + } + + static BlockTag getTagByName(String name) { + return NAME_TO_TAG.get(name); + } +} diff --git a/Allay-CodeGen/src/main/java/org/allaymc/codegen/VanillaBlockTagGen.java b/Allay-CodeGen/src/main/java/org/allaymc/codegen/VanillaBlockTagGen.java new file mode 100644 index 000000000..b52171cc6 --- /dev/null +++ b/Allay-CodeGen/src/main/java/org/allaymc/codegen/VanillaBlockTagGen.java @@ -0,0 +1,95 @@ +package org.allaymc.codegen; + +import com.google.gson.JsonParser; +import com.squareup.javapoet.*; +import lombok.SneakyThrows; +import org.allaymc.dependence.StringUtils; + +import javax.lang.model.element.Modifier; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Allay Project 2023/11/18 + * + * @author daoge_cmd + */ +public class VanillaBlockTagGen { + static final Path BLOCK_TAGS_FILE_PATH = Path.of(CodeGen.DATA_PATH + "block_tags.json"); + static final ClassName BLOCK_TAG_CLASS = ClassName.get("org.allaymc.api.block.tag", "BlockTag"); + static final Set KEYS = new HashSet<>(); + static final String JAVA_DOC = """ + Automatically generated by {@code org.allaymc.codegen.VanillaBlockTagGen}
+ Allay Project

+ @author daoge_cmd + """; + + static { + try { + JsonParser + .parseReader(Files.newBufferedReader(BLOCK_TAGS_FILE_PATH)) + .getAsJsonObject() + .entrySet() + .forEach(entry -> KEYS.add(entry.getKey())); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static void main(String[] args) { + generate(); + } + + @SneakyThrows + public static void generate() { + TypeSpec.Builder codeBuilder = TypeSpec.interfaceBuilder("VanillaBlockTags") + .addJavadoc(JAVA_DOC) + .addModifiers(Modifier.PUBLIC) + .addField( + FieldSpec + .builder(ParameterizedTypeName.get(ClassName.get(Map.class), ClassName.get(String.class), BLOCK_TAG_CLASS), "NAME_TO_TAG", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL) + .initializer("new $T<>()", HashMap.class) + .build() + ) + .addMethod( + MethodSpec + .methodBuilder("create") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(BLOCK_TAG_CLASS) + .addParameter(String.class, "name") + .addStatement("var tag = new $T(name)", BLOCK_TAG_CLASS) + .addStatement("NAME_TO_TAG.put(name, tag)") + .addStatement("return tag") + .build() + ) + .addMethod( + MethodSpec + .methodBuilder("getTagByName") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(BLOCK_TAG_CLASS) + .addParameter(String.class, "name") + .addStatement("return NAME_TO_TAG.get(name)") + .build() + ); + var fieldNames = new HashSet(); + for (var key : KEYS) { + var fieldName = StringUtils.fastTwoPartSplit(key, ":", "")[1].toUpperCase(); + fieldNames.add(fieldName); + codeBuilder.addField( + FieldSpec + .builder(BLOCK_TAG_CLASS, fieldName) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL) + .initializer("create($S)", key) + .build() + ); + } + + var javaFile = JavaFile.builder("org.allaymc.api.data", codeBuilder.build()).build(); + Files.writeString(Path.of("Allay-API/src/main/java/org/allaymc/api/data/VanillaBlockTags.java"), javaFile.toString()); + } +} diff --git a/Allay-Data/resources/block_tags.json b/Allay-Data/resources/block_tags.json new file mode 100644 index 000000000..e11a71f80 --- /dev/null +++ b/Allay-Data/resources/block_tags.json @@ -0,0 +1,438 @@ +{ + "acacia": [ + "acacia_log" + ], + "birch": [ + "birch_log" + ], + "dark_oak": [ + "dark_oak_log" + ], + "diamond_pick_diggable": [ + "raw_gold_block", + "obsidian", + "gold_ore", + "coal_ore", + "redstone_ore", + "diamond_ore", + "lit_redstone_ore", + "iron_ore", + "deepslate_gold_ore", + "deepslate_emerald_ore", + "deepslate_redstone_ore", + "deepslate_coal_ore", + "deepslate_iron_ore", + "emerald_ore", + "lit_deepslate_redstone_ore", + "lapis_ore", + "deepslate_diamond_ore", + "raw_iron_block" + ], + "dirt": [ + "muddy_mangrove_roots", + "mycelium", + "farmland", + "podzol", + "dirt_with_roots", + "dirt", + "grass_block", + "moss_block", + "mud" + ], + "fertilize_area": [ + "azure_bluet", + "lily_of_the_valley", + "yellow_flower", + "allium", + "poppy", + "blue_orchid", + "crimson_nylium", + "pink_tulip", + "white_tulip", + "cornflower", + "grass_block", + "warped_nylium", + "moss_block", + "orange_tulip", + "oxeye_daisy", + "red_tulip" + ], + "gold_pick_diggable": [], + "grass": [ + "dirt", + "grass_block", + "grass_path" + ], + "gravel": [ + "suspicious_gravel", + "gravel" + ], + "iron_pick_diggable": [ + "raw_gold_block", + "gold_ore", + "coal_ore", + "redstone_ore", + "diamond_ore", + "lit_redstone_ore", + "iron_ore", + "deepslate_gold_ore", + "deepslate_emerald_ore", + "deepslate_redstone_ore", + "deepslate_coal_ore", + "deepslate_iron_ore", + "emerald_ore", + "lit_deepslate_redstone_ore", + "lapis_ore", + "deepslate_diamond_ore", + "raw_iron_block" + ], + "jungle": [ + "jungle_log" + ], + "log": [ + "jungle_log", + "oak_log", + "birch_log", + "dark_oak_log", + "spruce_log", + "acacia_log" + ], + "metal": [ + "gold_block", + "iron_door", + "iron_bars", + "cauldron", + "iron_block" + ], + "minecraft:crop": [ + "pitcher_crop", + "potatoes", + "beetroot", + "carrots", + "sweet_berry_bush", + "torchflower_crop", + "wheat" + ], + "mob_spawner": [ + "mob_spawner" + ], + "not_feature_replaceable": [ + "chiseled_bookshelf", + "mob_spawner", + "end_portal_frame", + "vault", + "bedrock", + "chest", + "trial_spawner" + ], + "oak": [ + "oak_log" + ], + "plant": [ + "pitcher_crop", + "dark_oak_sapling", + "oak_sapling", + "pitcher_plant", + "spruce_sapling", + "double_plant", + "jungle_sapling", + "acacia_sapling", + "birch_sapling" + ], + "pumpkin": [ + "pumpkin", + "lit_pumpkin", + "carved_pumpkin" + ], + "rail": [ + "activator_rail", + "rail", + "detector_rail", + "golden_rail" + ], + "sand": [ + "suspicious_sand", + "sand" + ], + "snow": [ + "snow_layer" + ], + "spruce": [ + "spruce_log" + ], + "stone": [ + "granite", + "diorite", + "mossy_cobblestone", + "polished_granite", + "stone_button", + "andesite", + "stone", + "dripstone_block", + "cobblestone_wall", + "cobblestone", + "stone_stairs", + "stone_pressure_plate", + "stone_block_slab", + "brick_block", + "polished_diorite", + "double_stone_block_slab", + "polished_andesite" + ], + "stone_pick_diggable": [ + "waxed_oxidized_chiseled_copper", + "deepslate_copper_ore", + "waxed_oxidized_cut_copper", + "waxed_exposed_chiseled_copper", + "weathered_chiseled_copper", + "oxidized_cut_copper_stairs", + "copper_grate", + "waxed_cut_copper_stairs", + "waxed_exposed_copper_grate", + "exposed_copper", + "waxed_copper_bulb", + "waxed_exposed_copper", + "waxed_weathered_copper", + "waxed_oxidized_cut_copper_slab", + "oxidized_copper_bulb", + "oxidized_copper", + "copper_ore", + "waxed_weathered_chiseled_copper", + "weathered_copper_grate", + "waxed_exposed_cut_copper", + "waxed_exposed_cut_copper_stairs", + "waxed_exposed_copper_bulb", + "weathered_cut_copper_stairs", + "waxed_weathered_copper_grate", + "copper_bulb", + "exposed_cut_copper_stairs", + "cut_copper_stairs", + "copper_block", + "cut_copper", + "waxed_weathered_cut_copper", + "oxidized_chiseled_copper", + "raw_copper_block", + "exposed_copper_grate", + "waxed_copper_grate", + "oxidized_cut_copper", + "chiseled_copper", + "waxed_oxidized_cut_copper_stairs", + "waxed_weathered_copper_bulb", + "exposed_cut_copper", + "waxed_weathered_cut_copper_stairs", + "exposed_copper_bulb", + "waxed_oxidized_copper_bulb", + "exposed_chiseled_copper", + "oxidized_copper_grate", + "weathered_cut_copper", + "waxed_cut_copper", + "waxed_oxidized_copper", + "weathered_copper_bulb", + "waxed_copper", + "waxed_oxidized_double_cut_copper_slab", + "waxed_chiseled_copper", + "waxed_oxidized_copper_grate", + "weathered_copper" + ], + "text_sign": [ + "birch_standing_sign", + "cherry_hanging_sign", + "crimson_wall_sign", + "warped_wall_sign", + "birch_hanging_sign", + "acacia_hanging_sign", + "dark_oak_hanging_sign", + "acacia_wall_sign", + "jungle_hanging_sign", + "mangrove_standing_sign", + "jungle_wall_sign", + "bamboo_hanging_sign", + "oak_hanging_sign", + "wall_sign", + "mangrove_wall_sign", + "darkoak_wall_sign", + "standing_sign", + "spruce_hanging_sign", + "cherry_standing_sign", + "mangrove_hanging_sign", + "warped_hanging_sign", + "jungle_standing_sign", + "acacia_standing_sign", + "birch_wall_sign", + "bamboo_wall_sign", + "spruce_standing_sign", + "crimson_hanging_sign", + "warped_standing_sign", + "bamboo_standing_sign", + "crimson_standing_sign", + "darkoak_standing_sign", + "spruce_wall_sign", + "cherry_wall_sign" + ], + "trapdoors": [ + "trapdoor", + "iron_trapdoor", + "cherry_trapdoor", + "waxed_copper_trapdoor", + "crimson_trapdoor", + "mangrove_trapdoor", + "oxidized_copper_trapdoor", + "warped_trapdoor", + "waxed_weathered_copper_trapdoor", + "waxed_oxidized_copper_trapdoor", + "bamboo_trapdoor", + "jungle_trapdoor", + "acacia_trapdoor", + "copper_trapdoor", + "waxed_exposed_copper_trapdoor", + "exposed_copper_trapdoor", + "weathered_copper_trapdoor", + "spruce_trapdoor", + "birch_trapdoor", + "dark_oak_trapdoor" + ], + "water": [ + "flowing_water", + "water" + ], + "wood": [ + "dark_oak_wood", + "birch_standing_sign", + "fence_gate", + "dark_oak_button", + "jungle_button", + "spruce_stairs", + "cherry_pressure_plate", + "cherry_hanging_sign", + "stripped_dark_oak_log", + "jungle_log", + "trapdoor", + "stripped_acacia_wood", + "oak_stairs", + "oak_log", + "stripped_jungle_wood", + "mangrove_log", + "jungle_fence", + "spruce_fence", + "dark_oak_slab", + "birch_hanging_sign", + "stripped_jungle_log", + "birch_log", + "stripped_spruce_wood", + "birch_wood", + "jungle_wood", + "cherry_trapdoor", + "spruce_double_slab", + "dark_oak_log", + "acacia_hanging_sign", + "dark_oak_hanging_sign", + "dark_oak_planks", + "birch_pressure_plate", + "oak_double_slab", + "jungle_pressure_plate", + "acacia_wall_sign", + "smithing_table", + "wooden_door", + "spruce_pressure_plate", + "birch_fence_gate", + "jungle_hanging_sign", + "birch_slab", + "mangrove_pressure_plate", + "jungle_slab", + "dark_oak_double_slab", + "mangrove_wood", + "dark_oak_fence_gate", + "mangrove_standing_sign", + "stripped_mangrove_wood", + "spruce_log", + "oak_slab", + "spruce_button", + "acacia_log", + "jungle_wall_sign", + "acacia_door", + "stripped_cherry_log", + "acacia_planks", + "mangrove_trapdoor", + "barrel", + "stripped_birch_wood", + "cherry_button", + "mangrove_fence_gate", + "bamboo_hanging_sign", + "spruce_door", + "stripped_oak_wood", + "oak_hanging_sign", + "stripped_dark_oak_wood", + "oak_wood", + "wall_sign", + "stripped_cherry_wood", + "bamboo_fence_gate", + "dark_oak_stairs", + "acacia_pressure_plate", + "bamboo_trapdoor", + "mangrove_wall_sign", + "birch_planks", + "darkoak_wall_sign", + "jungle_fence_gate", + "jungle_trapdoor", + "acacia_trapdoor", + "standing_sign", + "acacia_double_slab", + "dark_oak_door", + "oak_fence", + "spruce_hanging_sign", + "fletching_table", + "stripped_acacia_log", + "cherry_standing_sign", + "mangrove_hanging_sign", + "dark_oak_pressure_plate", + "stripped_birch_log", + "warped_hanging_sign", + "jungle_standing_sign", + "bamboo_pressure_plate", + "jungle_door", + "acacia_stairs", + "acacia_standing_sign", + "stripped_spruce_log", + "wooden_button", + "bamboo_button", + "spruce_trapdoor", + "spruce_fence_gate", + "jungle_planks", + "birch_trapdoor", + "birch_wall_sign", + "bamboo_wall_sign", + "acacia_wood", + "jungle_stairs", + "birch_stairs", + "spruce_slab", + "spruce_standing_sign", + "mangrove_button", + "dark_oak_fence", + "birch_door", + "cherry_wood", + "crimson_hanging_sign", + "bamboo_standing_sign", + "acacia_button", + "cherry_log", + "darkoak_standing_sign", + "spruce_wall_sign", + "dark_oak_trapdoor", + "oak_planks", + "stripped_oak_log", + "acacia_slab", + "jungle_double_slab", + "spruce_wood", + "acacia_fence_gate", + "cherry_wall_sign", + "birch_button", + "spruce_planks", + "wooden_pressure_plate", + "birch_fence", + "birch_double_slab", + "acacia_fence", + "cherry_fence_gate", + "ladder", + "stripped_mangrove_log" + ], + "wood_pick_diggable": [] +} \ No newline at end of file diff --git a/Allay-Server/src/main/java/org/allaymc/server/block/type/AllayBlockType.java b/Allay-Server/src/main/java/org/allaymc/server/block/type/AllayBlockType.java index abb1e5191..57444f403 100644 --- a/Allay-Server/src/main/java/org/allaymc/server/block/type/AllayBlockType.java +++ b/Allay-Server/src/main/java/org/allaymc/server/block/type/AllayBlockType.java @@ -1,6 +1,7 @@ package org.allaymc.server.block.type; import com.google.common.collect.ImmutableList; +import com.google.gson.JsonParser; import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; @@ -15,15 +16,16 @@ import org.allaymc.api.block.property.type.BlockPropertyType; import org.allaymc.api.block.registry.BlockTypeRegistry; import org.allaymc.api.block.registry.VanillaBlockAttributeRegistry; +import org.allaymc.api.block.tag.BlockTag; import org.allaymc.api.block.type.BlockState; import org.allaymc.api.block.type.BlockType; import org.allaymc.api.block.type.BlockTypeBuilder; import org.allaymc.api.blockentity.type.BlockEntityType; +import org.allaymc.api.data.*; +import org.allaymc.api.utils.AllayStringUtils; import org.allaymc.api.utils.Identifier; import org.allaymc.api.component.interfaces.Component; import org.allaymc.api.component.interfaces.ComponentProvider; -import org.allaymc.api.data.VanillaBlockId; -import org.allaymc.api.data.VanillaItemMetaBlockStateBiMap; import org.allaymc.api.item.ItemStack; import org.allaymc.api.item.init.SimpleItemStackInitInfo; import org.allaymc.api.item.registry.ItemTypeRegistry; @@ -42,6 +44,7 @@ import org.cloudburstmc.nbt.NbtMap; import org.jetbrains.annotations.UnmodifiableView; +import java.io.InputStreamReader; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -80,10 +83,11 @@ public static long computeSpecialValue(byte specialValueBits, BlockPropertyType. @Getter private final Map blockStateHashMap; @Getter - private final Map specialValueMap; @Getter private final byte specialValueBits; + @Getter + private final Set blockTags; private Class injectedClass; @Getter @@ -97,11 +101,13 @@ private AllayBlockType(Class interfaceClass, List components, Map> properties, Identifier identifier, - ItemType blockItemType) { + ItemType blockItemType, + Set blockTags) { this.interfaceClass = interfaceClass; this.components = components; this.properties = Collections.unmodifiableMap(properties); this.identifier = identifier; + this.blockTags = blockTags; this.blockItemType = blockItemType; this.blockStateHashMap = initStates(); byte specialValueBits = 0; @@ -344,6 +350,25 @@ private BlockState getNewBlockState(BlockPropertyType.BlockPropertyValue implements BlockTypeBuilder { + // Use array instead of set to reduce memory usage + protected static final Map VANILLA_BLOCK_TAGS; + + static { + Map> blockId2tags = new HashMap<>(); + JsonParser.parseReader(new InputStreamReader(Objects.requireNonNull(AllayBlockType.class.getClassLoader().getResourceAsStream("block_tags.json")))) + .getAsJsonObject() + .entrySet() + .forEach(entry -> { + var tag = VanillaBlockTags.getTagByName(entry.getKey()); + entry.getValue().getAsJsonArray().forEach(blockId -> { + var id = VanillaBlockId.valueOf(AllayStringUtils.fastTwoPartSplit(blockId.getAsString(), ":", "")[1].toUpperCase()); + blockId2tags.computeIfAbsent(id, unused -> new HashSet<>()).add(tag); + }); + }); + VANILLA_BLOCK_TAGS = new HashMap<>(); + blockId2tags.forEach((id, tags) -> VANILLA_BLOCK_TAGS.put(id, tags.toArray(new BlockTag[0]))); + } + protected Class interfaceClass; protected Map components = new HashMap<>(); protected Map> properties = new HashMap<>(); @@ -352,6 +377,7 @@ public static class Builder implements BlockTypeBuilder protected ItemType hardItemType; protected boolean isCustomBlock = false; protected Function, BlockBaseComponent> blockBaseComponentSupplier = BlockBaseComponentImpl::new; + protected Set blockTags = Set.of(); public Builder(Class interfaceClass) { if (interfaceClass == null) @@ -425,12 +451,19 @@ public Builder setBlockBaseComponentSupplier(Function, BlockBase return this; } + @Override + public BlockTypeBuilder setBlockTags(BlockTag... blockTags) { + // Unmodifiable set + this.blockTags = Set.of(blockTags); + return this; + } + @Override public AllayBlockType build() { Objects.requireNonNull(identifier, "Identifier cannot be null!"); prepareItemType(); var listComponents = new ArrayList<>(components.values()); - var type = new AllayBlockType<>(interfaceClass, listComponents, properties, identifier, itemType); + var type = new AllayBlockType<>(interfaceClass, listComponents, properties, identifier, itemType, blockTags); if (!components.containsKey(BlockBaseComponentImpl.IDENTIFIER)) listComponents.add(blockBaseComponentSupplier.apply(type)); if (!components.containsKey(BlockAttributeComponentImpl.IDENTIFIER)) diff --git a/Allay-Server/src/main/java/org/allaymc/server/item/type/AllayItemType.java b/Allay-Server/src/main/java/org/allaymc/server/item/type/AllayItemType.java index 283d44c20..70ecc35d1 100644 --- a/Allay-Server/src/main/java/org/allaymc/server/item/type/AllayItemType.java +++ b/Allay-Server/src/main/java/org/allaymc/server/item/type/AllayItemType.java @@ -57,7 +57,6 @@ public final class AllayItemType implements ItemType { @Getter private final Set itemTags; @Getter - private BlockType blockTypeCache; private boolean haveTriedInitBlockTypeCache; diff --git a/docs/core_and_architecture/update_to_the_next_protocol_version.md b/docs/core_and_architecture/update_to_the_next_protocol_version.md index a4f7e554b..24776421b 100644 --- a/docs/core_and_architecture/update_to_the_next_protocol_version.md +++ b/docs/core_and_architecture/update_to_the_next_protocol_version.md @@ -61,7 +61,7 @@ file usually doesn't change much in minor updates. **Step two, check if there are any new entities in `entity_id_map.json`**. If so, first run `VanillaEntityIdEnumGen`, then run `VanillaEntityInterfaceGen`. This file usually doesn't change much in minor updates. -**Step three, check for changes in `item_tags.json`**. If changes exist, run `VanillaItemTagGen`. +**Step three, check for changes in `item_tags.json` and `block_tags.json`**. If changes exist, run `VanillaItemTagGen` or `VanillaBlockTagGen`. **Step four, check for changes in `block_property_types.json`**. If changes exist, run `VanillaBlockPropertyTypeGen`. diff --git a/docs/core_and_architecture/update_to_the_next_protocol_version.zh.md b/docs/core_and_architecture/update_to_the_next_protocol_version.zh.md index 8485559ba..1465e40d5 100644 --- a/docs/core_and_architecture/update_to_the_next_protocol_version.zh.md +++ b/docs/core_and_architecture/update_to_the_next_protocol_version.zh.md @@ -52,7 +52,7 @@ Allay通过代码生成完成大部分重复工作。接下来我们将注意力 **第二步,检查`entity_id_map.json`里面是否存在新的实体**。若存在,先运行`VanillaEntityIdEnumGen`,然后运行`VanillaEntityInterfaceGen`。此文件小版本更新通常不会发生改变。 -**第三步,检查`item_tags.json`里面是否存在变动**。若存在,运行`VanillaItemTagGen`。 +**第三步,检查`item_tags.json`以及`block_tags.json`里面是否存在变动**。若存在,运行`VanillaItemTagGen`或`VanillaBlockTagGen`。 **第四步,检查`block_property_types.json`里面是否存在变动**。若存在,运行`VanillaBlockPropertyTypeGen`。