Solved Separating Materials By Rarity

Discussion in 'Plugin Development' started by Smeary_Subset, Sep 28, 2022.

Thread Status:
Not open for further replies.
  1. Offline

    Smeary_Subset

    I'm trying to separate all materials by how hard it is to get them into 3 lists: easyMaterials, normalMaterials, and difficultMaterials. I have also excluded a specific selection of materials, which are put into a list called excludedMaterials.

    In my onEnable(), all lists are generated. When I enter /Test <easy/normal/hard/excluded>, the appropriate list is outputted.

    However, for some reason any material that isn't excluded is being put into easyMaterials, leaving the normal and difficult lists empty. I'm very confused how this is could possibly happen. Materials like Cake are being put in easyMaterials even when they aren't detected (in theory) by the isEasy() method.

    Am I missing something obvious here??

    Code:
    public final class Driver extends JavaPlugin implements Listener {
        private List<Material> easyMaterials;
        private List<Material> normalMaterials;
        private List<Material> difficultMaterials;
        private List<Material> excludedMaterials;
    
        @Override
        public void onEnable() {
            generateAllLists();
        }
    
        @Override
        public void onDisable() {}
    
        @Override
        public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, String label, String[] args) {
            if(label.equalsIgnoreCase("Test"))
                if(sender.hasPermission("Test.use")) {
                    String category = args[0];
    
                    switch (category) {
                        case "Easy":
                            printListContents(easyMaterials);
                            break;
                        case "Normal":
                            printListContents(normalMaterials);
                            break;
                        case "Difficult":
                            printListContents(difficultMaterials);
                            break;
                        case "Excluded":
                            printListContents(excludedMaterials);
                            break;
                    }
                }
            return true;
        }
    
        private void generateAllLists() {
            this.easyMaterials = new ArrayList<>();
            this.normalMaterials = new ArrayList<>();
            this.difficultMaterials = new ArrayList<>();
            this.excludedMaterials = new ArrayList<>();
    
    
            Material[] allMaterials = Material.values();
            for(Material mat : allMaterials) {
                if(isWanted(mat)) {
                    if(isEasy(mat))
                        easyMaterials.add(mat);
                    else if(isNormal(mat))
                        normalMaterials.add(mat);
                    else
                        difficultMaterials.add(mat);
                }
                else
                    excludedMaterials.add(mat);
            }
        }
    
        private boolean isWanted(Material mat) {
            String name = mat.name();
            return !(!mat.isBlock() || name.contains("EXPOSED") || name.contains("OXIDIZED") || name.contains("WEATHERED") ||
                    name.contains("SHULKER") || name.contains("CONCRETE_POWDER") || name.contains("END") ||
                    name.contains("COMMAND_BLOCK") || name.contains("INFESTED") || name.contains("HEAD") ||
                    name.contains("SKULL") || mat.name().contains("PURPUR") || name.contains("AIR") ||
                    name.contains("CHORUS") || name.contains("PRISMARINE") || name.contains("_ANVIL") ||
                    name.contains("ATTACHED") || name.contains("WITHER") || name.contains("STRUCTURE") ||
                    mat == Material.DEBUG_STICK || mat == Material.BARRIER || mat == Material.KNOWLEDGE_BOOK ||
                    mat == Material.LODESTONE || mat == Material.RESPAWN_ANCHOR ||
                    mat == Material.PETRIFIED_OAK_SLAB ||
                    mat == Material.DRAGON_EGG || mat == Material.BEACON || mat == Material.CONDUIT ||
                    mat == Material.NETHERITE_BLOCK || mat == Material.ANCIENT_DEBRIS ||
                    mat == Material.GLOW_LICHEN || mat == Material.LIGHT || mat == Material.PRISMARINE ||
                    mat == Material.JIGSAW || mat == Material.LAVA ||
                    mat == Material.MOVING_PISTON || mat == Material.FROSTED_ICE);
        }
    
        private boolean isEasy(Material mat) {
            String name = mat.name();
            boolean bool = name.contains("OAK") || name.contains("SPRUCE") || name.contains("ACACIA") || name.contains("BIRCH") ||
                    name.contains("GRANITE") || name.contains("DIORITE") || name.contains("ANDESITE") ||
                    (name.contains("SAND") && !name.contains("RED") || !name.contains("SOUL")) ||
                    (name.contains("STONE") && !name.contains("MOSSY") && !name.contains("GLOW") && !name.contains("BLACK")
                            && !name.contains("RED") && !name.contains("DRIP")) ||
                    (name.contains("GRASS") && !name.contains("SEA")) ||
                    (name.contains("DIRT") && !name.contains("ROOTED")) ||
                    (name.contains("MUSHROOM") && !name.contains("BLOCK") || !name.contains("STEM")) ||
                    (name.contains("TORCH") && !name.contains("SOUL")) ||
                    name.contains("DANDELION") || name.contains("POPPY") ||
                    mat == Material.MUD || mat == Material.GRAVEL || mat == Material.COAL_ORE || mat == Material.IRON_ORE ||
                    mat == Material.COPPER_ORE || mat == Material.GLASS || mat == Material.KELP || mat == Material.CLAY ||
                    mat == Material.CHEST ||
                    mat == Material.CRAFTING_TABLE || mat == Material.FARMLAND || mat == Material.FURNACE ||
                    mat == Material.LADDER || mat == Material.TERRACOTTA || mat == Material.LILAC || mat == Material.LEVER ||
                    mat == Material.LIGHTNING_ROD || mat == Material.FLOWER_POT || mat == Material.COMPOSTER ||
                    mat == Material.BARREL || mat == Material.SMOKER || mat == Material.CARTOGRAPHY_TABLE ||
                    mat == Material.GRINDSTONE || mat == Material.LANTERN || mat == Material.CAMPFIRE ||
                    mat == Material.WATER || mat == Material.ITEM_FRAME || mat == Material.FIRE;
            Bukkit.getLogger().info(bool + "");
            return bool;
        }
    
        private boolean isNormal(Material mat) {
            String name = mat.name();
            boolean bool = (name.contains("DEEPSLATE") && !name.contains("GOLD") && !name.contains("REDSTONE") &&
                    !name.contains("EMERALD") && !name.contains("LAPIS") && !name.contains("DIAMOND")) ||
                    name.contains("COPPER") || name.contains("IRON") ||
                    name.contains("TERRACOTTA") || name.contains("CONCRETE") ||
                    name.contains("WOOL") || name.contains("CARPET") || name.contains("BED") || name.contains("BANNER") ||
                    name.contains("CANDLE") ||
                    (name.contains("GLASS") && !name.contains("TINTED")) ||
                    name.contains("DARK_OAK") || name.contains("MANGROVE") || name.contains("JUNGLE") ||
                    (name.contains("STONE") && name.contains("MOSSY")) ||
                    name.contains("TULIP") ||
                    (name.contains("BRICK") && !name.contains("NETHER") || !name.contains("QUARTZ") ||
                            !name.contains("BLACK")) ||
                    (name.contains("RAW") && !name.contains("GOLD")) ||
                    (name.contains("SEA") && !name.contains("LANTERN")) ||
                    name.contains("FERN") || name.contains("MUSHROOM") || name.contains("MELON") ||
                    name.contains("PUMPKIN") || name.contains("MUD") || name.contains("SNOW") ||
                    (name.contains("ICE") && !name.contains("BLUE")) ||
                    name.contains("CAULDRON") || name.contains("TRIP") || name.contains("KELP") ||
                    (name.contains("RAIL") && !name.contains("POWERED")) ||
                    name.contains("TABLE") || name.contains("BEE") ||
                    name.contains("AZURE_BLUET") || name.contains("BLUE_ORCHID") || name.contains("OXEYE_DAISY") ||
                    name.contains("CORNFLOWER") || name.contains("PEONY") || name.contains("DEAD_BUSH") ||
                    mat == Material.TUFF || mat == Material.PODZOL || mat == Material.BEDROCK ||
                    mat == Material.COAL_BLOCK || mat == Material.COBWEB || mat == Material.SUGAR_CANE ||
                    mat == Material.CHAIN || mat == Material.VINE || mat == Material.CACTUS ||
                    mat == Material.JACK_O_LANTERN || mat == Material.LILY_PAD || mat == Material.HAY_BLOCK ||
                    mat == Material.REPEATER || mat == Material.COMPARATOR || mat == Material.PISTON ||
                    mat == Material.SCAFFOLDING || mat == Material.HONEY_BLOCK || mat == Material.HOPPER ||
                    mat == Material.DISPENSER || mat == Material.DROPPER || mat == Material.LECTERN ||
                    mat == Material.BOOKSHELF || mat == Material.TRAPPED_CHEST || mat == Material.NOTE_BLOCK ||
                    mat == Material.LOOM || mat == Material.BLAST_FURNACE || mat == Material.BUBBLE_COLUMN ||
                    mat == Material.SWEET_BERRY_BUSH;
            Bukkit.getLogger().info(bool + "");
            return bool;
        }
    
    
        private void printListContents(List<Material> list) {
            Logger logger = Bukkit.getLogger();
            for(Material mat : list) {
                logger.info(mat.name());
            }
            logger.log(Level.WARNING, list.size() + "");
        }
    }
     
  2. Offline

    CraftCreeper6

    You've complicated this massively, the number of ors, ands, and nots makes things incredibly difficult to understand, and is no doubt contributing to you not being able to find the issue!

    Simplify this, make 3 lists and populate them at the start, then just run list#contains(Material.XYZ).
     
    Strahan likes this.
  3. Offline

    Smeary_Subset

    I understand your point, but I did it this way because writing out the 1000 or so items in Minecraft manually would just be ridiculous and time consuming. I'll keep digging at it and if I can't resolve it, I'll have to resort to that
     
  4. Offline

    timtower Administrator Administrator Moderator

  5. Offline

    Smeary_Subset

    What do you mean? Like writing an allEasy() function that lists all the easy blocks? I would still have to go through all the items manually
     
  6. Offline

    CraftCreeper6

    You've essentially already gone through the items manually, granted you've used contains in some instances.

    The number of lines of code isn't a problem with things like this, if you're still concerned, use a YML file and read from there instead, though I would really just go through the items manually.

    Make yourself a little script to make the work easier, create a list of every item you want to index and have the program ask where what tier you want it to be in, then just output like this:
    Code:
    list1.add(Material.SOME_MATERIAL);
    for each item.
    By no means is this a quick process but it'll be far easier for you to diagnose issues with it should they arise.
     
  7. Online

    Strahan

    I agree with this. It'd be so much cleaner to just bite the bullet and list them out. It won't take more than a few minutes to do, and will make things much simpler.

    I'd use config to make future updates simple. Just dump all the Materials to text. Here, I'll do that for you:
    Show Spoiler
    Code:
      - ACACIA_BOAT
      - ACACIA_BUTTON
      - ACACIA_CHEST_BOAT
      - ACACIA_DOOR
      - ACACIA_FENCE
      - ACACIA_FENCE_GATE
      - ACACIA_LEAVES
      - ACACIA_LOG
      - ACACIA_PLANKS
      - ACACIA_PRESSURE_PLATE
      - ACACIA_SAPLING
      - ACACIA_SIGN
      - ACACIA_SLAB
      - ACACIA_STAIRS
      - ACACIA_TRAPDOOR
      - ACACIA_WALL_SIGN
      - ACACIA_WOOD
      - ACTIVATOR_RAIL
      - AIR
      - ALLAY_SPAWN_EGG
      - ALLIUM
      - AMETHYST_BLOCK
      - AMETHYST_CLUSTER
      - AMETHYST_SHARD
      - ANCIENT_DEBRIS
      - ANDESITE
      - ANDESITE_SLAB
      - ANDESITE_STAIRS
      - ANDESITE_WALL
      - ANVIL
      - APPLE
      - ARMOR_STAND
      - ARROW
      - ATTACHED_MELON_STEM
      - ATTACHED_PUMPKIN_STEM
      - AXOLOTL_BUCKET
      - AXOLOTL_SPAWN_EGG
      - AZALEA
      - AZALEA_LEAVES
      - AZURE_BLUET
      - BAKED_POTATO
      - BAMBOO
      - BAMBOO_SAPLING
      - BARREL
      - BARRIER
      - BASALT
      - BAT_SPAWN_EGG
      - BEACON
      - BEDROCK
      - BEE_NEST
      - BEE_SPAWN_EGG
      - BEEF
      - BEEHIVE
      - BEETROOT
      - BEETROOT_SEEDS
      - BEETROOT_SOUP
      - BEETROOTS
      - BELL
      - BIG_DRIPLEAF
      - BIG_DRIPLEAF_STEM
      - BIRCH_BOAT
      - BIRCH_BUTTON
      - BIRCH_CHEST_BOAT
      - BIRCH_DOOR
      - BIRCH_FENCE
      - BIRCH_FENCE_GATE
      - BIRCH_LEAVES
      - BIRCH_LOG
      - BIRCH_PLANKS
      - BIRCH_PRESSURE_PLATE
      - BIRCH_SAPLING
      - BIRCH_SIGN
      - BIRCH_SLAB
      - BIRCH_STAIRS
      - BIRCH_TRAPDOOR
      - BIRCH_WALL_SIGN
      - BIRCH_WOOD
      - BLACK_BANNER
      - BLACK_BED
      - BLACK_CANDLE
      - BLACK_CANDLE_CAKE
      - BLACK_CARPET
      - BLACK_CONCRETE
      - BLACK_CONCRETE_POWDER
      - BLACK_DYE
      - BLACK_GLAZED_TERRACOTTA
      - BLACK_SHULKER_BOX
      - BLACK_STAINED_GLASS
      - BLACK_STAINED_GLASS_PANE
      - BLACK_TERRACOTTA
      - BLACK_WALL_BANNER
      - BLACK_WOOL
      - BLACKSTONE
      - BLACKSTONE_SLAB
      - BLACKSTONE_STAIRS
      - BLACKSTONE_WALL
      - BLAST_FURNACE
      - BLAZE_POWDER
      - BLAZE_ROD
      - BLAZE_SPAWN_EGG
      - BLUE_BANNER
      - BLUE_BED
      - BLUE_CANDLE
      - BLUE_CANDLE_CAKE
      - BLUE_CARPET
      - BLUE_CONCRETE
      - BLUE_CONCRETE_POWDER
      - BLUE_DYE
      - BLUE_GLAZED_TERRACOTTA
      - BLUE_ICE
      - BLUE_ORCHID
      - BLUE_SHULKER_BOX
      - BLUE_STAINED_GLASS
      - BLUE_STAINED_GLASS_PANE
      - BLUE_TERRACOTTA
      - BLUE_WALL_BANNER
      - BLUE_WOOL
      - BONE
      - BONE_BLOCK
      - BONE_MEAL
      - BOOK
      - BOOKSHELF
      - BOW
      - BOWL
      - BRAIN_CORAL
      - BRAIN_CORAL_BLOCK
      - BRAIN_CORAL_FAN
      - BRAIN_CORAL_WALL_FAN
      - BREAD
      - BREWING_STAND
      - BRICK
      - BRICK_SLAB
      - BRICK_STAIRS
      - BRICK_WALL
      - BRICKS
      - BROWN_BANNER
      - BROWN_BED
      - BROWN_CANDLE
      - BROWN_CANDLE_CAKE
      - BROWN_CARPET
      - BROWN_CONCRETE
      - BROWN_CONCRETE_POWDER
      - BROWN_DYE
      - BROWN_GLAZED_TERRACOTTA
      - BROWN_MUSHROOM
      - BROWN_MUSHROOM_BLOCK
      - BROWN_SHULKER_BOX
      - BROWN_STAINED_GLASS
      - BROWN_STAINED_GLASS_PANE
      - BROWN_TERRACOTTA
      - BROWN_WALL_BANNER
      - BROWN_WOOL
      - BUBBLE_COLUMN
      - BUBBLE_CORAL
      - BUBBLE_CORAL_BLOCK
      - BUBBLE_CORAL_FAN
      - BUBBLE_CORAL_WALL_FAN
      - BUCKET
      - BUDDING_AMETHYST
      - BUNDLE
      - CACTUS
      - CAKE
      - CALCITE
      - CAMPFIRE
      - CANDLE
      - CANDLE_CAKE
      - CARROT
      - CARROT_ON_A_STICK
      - CARROTS
      - CARTOGRAPHY_TABLE
      - CARVED_PUMPKIN
      - CAT_SPAWN_EGG
      - CAULDRON
      - CAVE_AIR
      - CAVE_SPIDER_SPAWN_EGG
      - CAVE_VINES
      - CAVE_VINES_PLANT
      - CHAIN
      - CHAIN_COMMAND_BLOCK
      - CHAINMAIL_BOOTS
      - CHAINMAIL_CHESTPLATE
      - CHAINMAIL_HELMET
      - CHAINMAIL_LEGGINGS
      - CHARCOAL
      - CHEST
      - CHEST_MINECART
      - CHICKEN
      - CHICKEN_SPAWN_EGG
      - CHIPPED_ANVIL
      - CHISELED_DEEPSLATE
      - CHISELED_NETHER_BRICKS
      - CHISELED_POLISHED_BLACKSTONE
      - CHISELED_QUARTZ_BLOCK
      - CHISELED_RED_SANDSTONE
      - CHISELED_SANDSTONE
      - CHISELED_STONE_BRICKS
      - CHORUS_FLOWER
      - CHORUS_FRUIT
      - CHORUS_PLANT
      - CLAY
      - CLAY_BALL
      - CLOCK
      - COAL
      - COAL_BLOCK
      - COAL_ORE
      - COARSE_DIRT
      - COBBLED_DEEPSLATE
      - COBBLED_DEEPSLATE_SLAB
      - COBBLED_DEEPSLATE_STAIRS
      - COBBLED_DEEPSLATE_WALL
      - COBBLESTONE
      - COBBLESTONE_SLAB
      - COBBLESTONE_STAIRS
      - COBBLESTONE_WALL
      - COBWEB
      - COCOA
      - COCOA_BEANS
      - COD
      - COD_BUCKET
      - COD_SPAWN_EGG
      - COMMAND_BLOCK
      - COMMAND_BLOCK_MINECART
      - COMPARATOR
      - COMPASS
      - COMPOSTER
      - CONDUIT
      - COOKED_BEEF
      - COOKED_CHICKEN
      - COOKED_COD
      - COOKED_MUTTON
      - COOKED_PORKCHOP
      - COOKED_RABBIT
      - COOKED_SALMON
      - COOKIE
      - COPPER_BLOCK
      - COPPER_INGOT
      - COPPER_ORE
      - CORNFLOWER
      - COW_SPAWN_EGG
      - CRACKED_DEEPSLATE_BRICKS
      - CRACKED_DEEPSLATE_TILES
      - CRACKED_NETHER_BRICKS
      - CRACKED_POLISHED_BLACKSTONE_BRICKS
      - CRACKED_STONE_BRICKS
      - CRAFTING_TABLE
      - CREEPER_BANNER_PATTERN
      - CREEPER_HEAD
      - CREEPER_SPAWN_EGG
      - CREEPER_WALL_HEAD
      - CRIMSON_BUTTON
      - CRIMSON_DOOR
      - CRIMSON_FENCE
      - CRIMSON_FENCE_GATE
      - CRIMSON_FUNGUS
      - CRIMSON_HYPHAE
      - CRIMSON_NYLIUM
      - CRIMSON_PLANKS
      - CRIMSON_PRESSURE_PLATE
      - CRIMSON_ROOTS
      - CRIMSON_SIGN
      - CRIMSON_SLAB
      - CRIMSON_STAIRS
      - CRIMSON_STEM
      - CRIMSON_TRAPDOOR
      - CRIMSON_WALL_SIGN
      - CROSSBOW
      - CRYING_OBSIDIAN
      - CUT_COPPER
      - CUT_COPPER_SLAB
      - CUT_COPPER_STAIRS
      - CUT_RED_SANDSTONE
      - CUT_RED_SANDSTONE_SLAB
      - CUT_SANDSTONE
      - CUT_SANDSTONE_SLAB
      - CYAN_BANNER
      - CYAN_BED
      - CYAN_CANDLE
      - CYAN_CANDLE_CAKE
      - CYAN_CARPET
      - CYAN_CONCRETE
      - CYAN_CONCRETE_POWDER
      - CYAN_DYE
      - CYAN_GLAZED_TERRACOTTA
      - CYAN_SHULKER_BOX
      - CYAN_STAINED_GLASS
      - CYAN_STAINED_GLASS_PANE
      - CYAN_TERRACOTTA
      - CYAN_WALL_BANNER
      - CYAN_WOOL
      - DAMAGED_ANVIL
      - DANDELION
      - DARK_OAK_BOAT
      - DARK_OAK_BUTTON
      - DARK_OAK_CHEST_BOAT
      - DARK_OAK_DOOR
      - DARK_OAK_FENCE
      - DARK_OAK_FENCE_GATE
      - DARK_OAK_LEAVES
      - DARK_OAK_LOG
      - DARK_OAK_PLANKS
      - DARK_OAK_PRESSURE_PLATE
      - DARK_OAK_SAPLING
      - DARK_OAK_SIGN
      - DARK_OAK_SLAB
      - DARK_OAK_STAIRS
      - DARK_OAK_TRAPDOOR
      - DARK_OAK_WALL_SIGN
      - DARK_OAK_WOOD
      - DARK_PRISMARINE
      - DARK_PRISMARINE_SLAB
      - DARK_PRISMARINE_STAIRS
      - DAYLIGHT_DETECTOR
      - DEAD_BRAIN_CORAL
      - DEAD_BRAIN_CORAL_BLOCK
      - DEAD_BRAIN_CORAL_FAN
      - DEAD_BRAIN_CORAL_WALL_FAN
      - DEAD_BUBBLE_CORAL
      - DEAD_BUBBLE_CORAL_BLOCK
      - DEAD_BUBBLE_CORAL_FAN
      - DEAD_BUBBLE_CORAL_WALL_FAN
      - DEAD_BUSH
      - DEAD_FIRE_CORAL
      - DEAD_FIRE_CORAL_BLOCK
      - DEAD_FIRE_CORAL_FAN
      - DEAD_FIRE_CORAL_WALL_FAN
      - DEAD_HORN_CORAL
      - DEAD_HORN_CORAL_BLOCK
      - DEAD_HORN_CORAL_FAN
      - DEAD_HORN_CORAL_WALL_FAN
      - DEAD_TUBE_CORAL
      - DEAD_TUBE_CORAL_BLOCK
      - DEAD_TUBE_CORAL_FAN
      - DEAD_TUBE_CORAL_WALL_FAN
      - DEBUG_STICK
      - DEEPSLATE
      - DEEPSLATE_BRICK_SLAB
      - DEEPSLATE_BRICK_STAIRS
      - DEEPSLATE_BRICK_WALL
      - DEEPSLATE_BRICKS
      - DEEPSLATE_COAL_ORE
      - DEEPSLATE_COPPER_ORE
      - DEEPSLATE_DIAMOND_ORE
      - DEEPSLATE_EMERALD_ORE
      - DEEPSLATE_GOLD_ORE
      - DEEPSLATE_IRON_ORE
      - DEEPSLATE_LAPIS_ORE
      - DEEPSLATE_REDSTONE_ORE
      - DEEPSLATE_TILE_SLAB
      - DEEPSLATE_TILE_STAIRS
      - DEEPSLATE_TILE_WALL
      - DEEPSLATE_TILES
      - DETECTOR_RAIL
      - DIAMOND
      - DIAMOND_AXE
      - DIAMOND_BLOCK
      - DIAMOND_BOOTS
      - DIAMOND_CHESTPLATE
      - DIAMOND_HELMET
      - DIAMOND_HOE
      - DIAMOND_HORSE_ARMOR
      - DIAMOND_LEGGINGS
      - DIAMOND_ORE
      - DIAMOND_PICKAXE
      - DIAMOND_SHOVEL
      - DIAMOND_SWORD
      - DIORITE
      - DIORITE_SLAB
      - DIORITE_STAIRS
      - DIORITE_WALL
      - DIRT
      - DIRT_PATH
      - DISC_FRAGMENT_5
      - DISPENSER
      - DOLPHIN_SPAWN_EGG
      - DONKEY_SPAWN_EGG
      - DRAGON_BREATH
      - DRAGON_EGG
      - DRAGON_HEAD
      - DRAGON_WALL_HEAD
      - DRIED_KELP
      - DRIED_KELP_BLOCK
      - DRIPSTONE_BLOCK
      - DROPPER
      - DROWNED_SPAWN_EGG
      - ECHO_SHARD
      - EGG
      - ELDER_GUARDIAN_SPAWN_EGG
      - ELYTRA
      - EMERALD
      - EMERALD_BLOCK
      - EMERALD_ORE
      - ENCHANTED_BOOK
      - ENCHANTED_GOLDEN_APPLE
      - ENCHANTING_TABLE
      - END_CRYSTAL
      - END_GATEWAY
      - END_PORTAL
      - END_PORTAL_FRAME
      - END_ROD
      - END_STONE
      - END_STONE_BRICK_SLAB
      - END_STONE_BRICK_STAIRS
      - END_STONE_BRICK_WALL
      - END_STONE_BRICKS
      - ENDER_CHEST
      - ENDER_EYE
      - ENDER_PEARL
      - ENDERMAN_SPAWN_EGG
      - ENDERMITE_SPAWN_EGG
      - EVOKER_SPAWN_EGG
      - EXPERIENCE_BOTTLE
      - EXPOSED_COPPER
      - EXPOSED_CUT_COPPER
      - EXPOSED_CUT_COPPER_SLAB
      - EXPOSED_CUT_COPPER_STAIRS
      - FARMLAND
      - FEATHER
      - FERMENTED_SPIDER_EYE
      - FERN
      - FILLED_MAP
      - FIRE
      - FIRE_CHARGE
      - FIRE_CORAL
      - FIRE_CORAL_BLOCK
      - FIRE_CORAL_FAN
      - FIRE_CORAL_WALL_FAN
      - FIREWORK_ROCKET
      - FIREWORK_STAR
      - FISHING_ROD
      - FLETCHING_TABLE
      - FLINT
      - FLINT_AND_STEEL
      - FLOWER_BANNER_PATTERN
      - FLOWER_POT
      - FLOWERING_AZALEA
      - FLOWERING_AZALEA_LEAVES
      - FOX_SPAWN_EGG
      - FROG_SPAWN_EGG
      - FROGSPAWN
      - FROSTED_ICE
      - FURNACE
      - FURNACE_MINECART
      - GHAST_SPAWN_EGG
      - GHAST_TEAR
      - GILDED_BLACKSTONE
      - GLASS
      - GLASS_BOTTLE
      - GLASS_PANE
      - GLISTERING_MELON_SLICE
      - GLOBE_BANNER_PATTERN
      - GLOW_BERRIES
      - GLOW_INK_SAC
      - GLOW_ITEM_FRAME
      - GLOW_LICHEN
      - GLOW_SQUID_SPAWN_EGG
      - GLOWSTONE
      - GLOWSTONE_DUST
      - GOAT_HORN
      - GOAT_SPAWN_EGG
      - GOLD_BLOCK
      - GOLD_INGOT
      - GOLD_NUGGET
      - GOLD_ORE
      - GOLDEN_APPLE
      - GOLDEN_AXE
      - GOLDEN_BOOTS
      - GOLDEN_CARROT
      - GOLDEN_CHESTPLATE
      - GOLDEN_HELMET
      - GOLDEN_HOE
      - GOLDEN_HORSE_ARMOR
      - GOLDEN_LEGGINGS
      - GOLDEN_PICKAXE
      - GOLDEN_SHOVEL
      - GOLDEN_SWORD
      - GRANITE
      - GRANITE_SLAB
      - GRANITE_STAIRS
      - GRANITE_WALL
      - GRASS
      - GRASS_BLOCK
      - GRAVEL
      - GRAY_BANNER
      - GRAY_BED
      - GRAY_CANDLE
      - GRAY_CANDLE_CAKE
      - GRAY_CARPET
      - GRAY_CONCRETE
      - GRAY_CONCRETE_POWDER
      - GRAY_DYE
      - GRAY_GLAZED_TERRACOTTA
      - GRAY_SHULKER_BOX
      - GRAY_STAINED_GLASS
      - GRAY_STAINED_GLASS_PANE
      - GRAY_TERRACOTTA
      - GRAY_WALL_BANNER
      - GRAY_WOOL
      - GREEN_BANNER
      - GREEN_BED
      - GREEN_CANDLE
      - GREEN_CANDLE_CAKE
      - GREEN_CARPET
      - GREEN_CONCRETE
      - GREEN_CONCRETE_POWDER
      - GREEN_DYE
      - GREEN_GLAZED_TERRACOTTA
      - GREEN_SHULKER_BOX
      - GREEN_STAINED_GLASS
      - GREEN_STAINED_GLASS_PANE
      - GREEN_TERRACOTTA
      - GREEN_WALL_BANNER
      - GREEN_WOOL
      - GRINDSTONE
      - GUARDIAN_SPAWN_EGG
      - GUNPOWDER
      - HANGING_ROOTS
      - HAY_BLOCK
      - HEART_OF_THE_SEA
      - HEAVY_WEIGHTED_PRESSURE_PLATE
      - HOGLIN_SPAWN_EGG
      - HONEY_BLOCK
      - HONEY_BOTTLE
      - HONEYCOMB
      - HONEYCOMB_BLOCK
      - HOPPER
      - HOPPER_MINECART
      - HORN_CORAL
      - HORN_CORAL_BLOCK
      - HORN_CORAL_FAN
      - HORN_CORAL_WALL_FAN
      - HORSE_SPAWN_EGG
      - HUSK_SPAWN_EGG
      - ICE
      - INFESTED_CHISELED_STONE_BRICKS
      - INFESTED_COBBLESTONE
      - INFESTED_CRACKED_STONE_BRICKS
      - INFESTED_DEEPSLATE
      - INFESTED_MOSSY_STONE_BRICKS
      - INFESTED_STONE
      - INFESTED_STONE_BRICKS
      - INK_SAC
      - IRON_AXE
      - IRON_BARS
      - IRON_BLOCK
      - IRON_BOOTS
      - IRON_CHESTPLATE
      - IRON_DOOR
      - IRON_HELMET
      - IRON_HOE
      - IRON_HORSE_ARMOR
      - IRON_INGOT
      - IRON_LEGGINGS
      - IRON_NUGGET
      - IRON_ORE
      - IRON_PICKAXE
      - IRON_SHOVEL
      - IRON_SWORD
      - IRON_TRAPDOOR
      - ITEM_FRAME
      - JACK_O_LANTERN
      - JIGSAW
      - JUKEBOX
      - JUNGLE_BOAT
      - JUNGLE_BUTTON
      - JUNGLE_CHEST_BOAT
      - JUNGLE_DOOR
      - JUNGLE_FENCE
      - JUNGLE_FENCE_GATE
      - JUNGLE_LEAVES
      - JUNGLE_LOG
      - JUNGLE_PLANKS
      - JUNGLE_PRESSURE_PLATE
      - JUNGLE_SAPLING
      - JUNGLE_SIGN
      - JUNGLE_SLAB
      - JUNGLE_STAIRS
      - JUNGLE_TRAPDOOR
      - JUNGLE_WALL_SIGN
      - JUNGLE_WOOD
      - KELP
      - KELP_PLANT
      - KNOWLEDGE_BOOK
      - LADDER
      - LANTERN
      - LAPIS_BLOCK
      - LAPIS_LAZULI
      - LAPIS_ORE
      - LARGE_AMETHYST_BUD
      - LARGE_FERN
      - LAVA
      - LAVA_BUCKET
      - LAVA_CAULDRON
      - LEAD
      - LEATHER
      - LEATHER_BOOTS
      - LEATHER_CHESTPLATE
      - LEATHER_HELMET
      - LEATHER_HORSE_ARMOR
      - LEATHER_LEGGINGS
      - LECTERN
      - LEVER
      - LIGHT
      - LIGHT_BLUE_BANNER
      - LIGHT_BLUE_BED
      - LIGHT_BLUE_CANDLE
      - LIGHT_BLUE_CANDLE_CAKE
      - LIGHT_BLUE_CARPET
      - LIGHT_BLUE_CONCRETE
      - LIGHT_BLUE_CONCRETE_POWDER
      - LIGHT_BLUE_DYE
      - LIGHT_BLUE_GLAZED_TERRACOTTA
      - LIGHT_BLUE_SHULKER_BOX
      - LIGHT_BLUE_STAINED_GLASS
      - LIGHT_BLUE_STAINED_GLASS_PANE
      - LIGHT_BLUE_TERRACOTTA
      - LIGHT_BLUE_WALL_BANNER
      - LIGHT_BLUE_WOOL
      - LIGHT_GRAY_BANNER
      - LIGHT_GRAY_BED
      - LIGHT_GRAY_CANDLE
      - LIGHT_GRAY_CANDLE_CAKE
      - LIGHT_GRAY_CARPET
      - LIGHT_GRAY_CONCRETE
      - LIGHT_GRAY_CONCRETE_POWDER
      - LIGHT_GRAY_DYE
      - LIGHT_GRAY_GLAZED_TERRACOTTA
      - LIGHT_GRAY_SHULKER_BOX
      - LIGHT_GRAY_STAINED_GLASS
      - LIGHT_GRAY_STAINED_GLASS_PANE
      - LIGHT_GRAY_TERRACOTTA
      - LIGHT_GRAY_WALL_BANNER
      - LIGHT_GRAY_WOOL
      - LIGHT_WEIGHTED_PRESSURE_PLATE
      - LIGHTNING_ROD
      - LILAC
      - LILY_OF_THE_VALLEY
      - LILY_PAD
      - LIME_BANNER
      - LIME_BED
      - LIME_CANDLE
      - LIME_CANDLE_CAKE
      - LIME_CARPET
      - LIME_CONCRETE
      - LIME_CONCRETE_POWDER
      - LIME_DYE
      - LIME_GLAZED_TERRACOTTA
      - LIME_SHULKER_BOX
      - LIME_STAINED_GLASS
      - LIME_STAINED_GLASS_PANE
      - LIME_TERRACOTTA
      - LIME_WALL_BANNER
      - LIME_WOOL
      - LINGERING_POTION
      - LLAMA_SPAWN_EGG
      - LODESTONE
      - LOOM
      - MAGENTA_BANNER
      - MAGENTA_BED
      - MAGENTA_CANDLE
      - MAGENTA_CANDLE_CAKE
      - MAGENTA_CARPET
      - MAGENTA_CONCRETE
      - MAGENTA_CONCRETE_POWDER
      - MAGENTA_DYE
      - MAGENTA_GLAZED_TERRACOTTA
      - MAGENTA_SHULKER_BOX
      - MAGENTA_STAINED_GLASS
      - MAGENTA_STAINED_GLASS_PANE
      - MAGENTA_TERRACOTTA
      - MAGENTA_WALL_BANNER
      - MAGENTA_WOOL
      - MAGMA_BLOCK
      - MAGMA_CREAM
      - MAGMA_CUBE_SPAWN_EGG
      - MANGROVE_BOAT
      - MANGROVE_BUTTON
      - MANGROVE_CHEST_BOAT
      - MANGROVE_DOOR
      - MANGROVE_FENCE
      - MANGROVE_FENCE_GATE
      - MANGROVE_LEAVES
      - MANGROVE_LOG
      - MANGROVE_PLANKS
      - MANGROVE_PRESSURE_PLATE
      - MANGROVE_PROPAGULE
      - MANGROVE_ROOTS
      - MANGROVE_SIGN
      - MANGROVE_SLAB
      - MANGROVE_STAIRS
      - MANGROVE_TRAPDOOR
      - MANGROVE_WALL_SIGN
      - MANGROVE_WOOD
      - MAP
      - MEDIUM_AMETHYST_BUD
      - MELON
      - MELON_SEEDS
      - MELON_SLICE
      - MELON_STEM
      - MILK_BUCKET
      - MINECART
      - MOJANG_BANNER_PATTERN
      - MOOSHROOM_SPAWN_EGG
      - MOSS_BLOCK
      - MOSS_CARPET
      - MOSSY_COBBLESTONE
      - MOSSY_COBBLESTONE_SLAB
      - MOSSY_COBBLESTONE_STAIRS
      - MOSSY_COBBLESTONE_WALL
      - MOSSY_STONE_BRICK_SLAB
      - MOSSY_STONE_BRICK_STAIRS
      - MOSSY_STONE_BRICK_WALL
      - MOSSY_STONE_BRICKS
      - MOVING_PISTON
      - MUD
      - MUD_BRICK_SLAB
      - MUD_BRICK_STAIRS
      - MUD_BRICK_WALL
      - MUD_BRICKS
      - MUDDY_MANGROVE_ROOTS
      - MULE_SPAWN_EGG
      - MUSHROOM_STEM
      - MUSHROOM_STEW
      - MUSIC_DISC_11
      - MUSIC_DISC_13
      - MUSIC_DISC_5
      - MUSIC_DISC_BLOCKS
      - MUSIC_DISC_CAT
      - MUSIC_DISC_CHIRP
      - MUSIC_DISC_FAR
      - MUSIC_DISC_MALL
      - MUSIC_DISC_MELLOHI
      - MUSIC_DISC_OTHERSIDE
      - MUSIC_DISC_PIGSTEP
      - MUSIC_DISC_STAL
      - MUSIC_DISC_STRAD
      - MUSIC_DISC_WAIT
      - MUSIC_DISC_WARD
      - MUTTON
      - MYCELIUM
      - NAME_TAG
      - NAUTILUS_SHELL
      - NETHER_BRICK
      - NETHER_BRICK_FENCE
      - NETHER_BRICK_SLAB
      - NETHER_BRICK_STAIRS
      - NETHER_BRICK_WALL
      - NETHER_BRICKS
      - NETHER_GOLD_ORE
      - NETHER_PORTAL
      - NETHER_QUARTZ_ORE
      - NETHER_SPROUTS
      - NETHER_STAR
      - NETHER_WART
      - NETHER_WART_BLOCK
      - NETHERITE_AXE
      - NETHERITE_BLOCK
      - NETHERITE_BOOTS
      - NETHERITE_CHESTPLATE
      - NETHERITE_HELMET
      - NETHERITE_HOE
      - NETHERITE_INGOT
      - NETHERITE_LEGGINGS
      - NETHERITE_PICKAXE
      - NETHERITE_SCRAP
      - NETHERITE_SHOVEL
      - NETHERITE_SWORD
      - NETHERRACK
      - NOTE_BLOCK
      - OAK_BOAT
      - OAK_BUTTON
      - OAK_CHEST_BOAT
      - OAK_DOOR
      - OAK_FENCE
      - OAK_FENCE_GATE
      - OAK_LEAVES
      - OAK_LOG
      - OAK_PLANKS
      - OAK_PRESSURE_PLATE
      - OAK_SAPLING
      - OAK_SIGN
      - OAK_SLAB
      - OAK_STAIRS
      - OAK_TRAPDOOR
      - OAK_WALL_SIGN
      - OAK_WOOD
      - OBSERVER
      - OBSIDIAN
      - OCELOT_SPAWN_EGG
      - OCHRE_FROGLIGHT
      - ORANGE_BANNER
      - ORANGE_BED
      - ORANGE_CANDLE
      - ORANGE_CANDLE_CAKE
      - ORANGE_CARPET
      - ORANGE_CONCRETE
      - ORANGE_CONCRETE_POWDER
      - ORANGE_DYE
      - ORANGE_GLAZED_TERRACOTTA
      - ORANGE_SHULKER_BOX
      - ORANGE_STAINED_GLASS
      - ORANGE_STAINED_GLASS_PANE
      - ORANGE_TERRACOTTA
      - ORANGE_TULIP
      - ORANGE_WALL_BANNER
      - ORANGE_WOOL
      - OXEYE_DAISY
      - OXIDIZED_COPPER
      - OXIDIZED_CUT_COPPER
      - OXIDIZED_CUT_COPPER_SLAB
      - OXIDIZED_CUT_COPPER_STAIRS
      - PACKED_ICE
      - PACKED_MUD
      - PAINTING
      - PANDA_SPAWN_EGG
      - PAPER
      - PARROT_SPAWN_EGG
      - PEARLESCENT_FROGLIGHT
      - PEONY
      - PETRIFIED_OAK_SLAB
      - PHANTOM_MEMBRANE
      - PHANTOM_SPAWN_EGG
      - PIG_SPAWN_EGG
      - PIGLIN_BANNER_PATTERN
      - PIGLIN_BRUTE_SPAWN_EGG
      - PIGLIN_SPAWN_EGG
      - PILLAGER_SPAWN_EGG
      - PINK_BANNER
      - PINK_BED
      - PINK_CANDLE
      - PINK_CANDLE_CAKE
      - PINK_CARPET
      - PINK_CONCRETE
      - PINK_CONCRETE_POWDER
      - PINK_DYE
      - PINK_GLAZED_TERRACOTTA
      - PINK_SHULKER_BOX
      - PINK_STAINED_GLASS
      - PINK_STAINED_GLASS_PANE
      - PINK_TERRACOTTA
      - PINK_TULIP
      - PINK_WALL_BANNER
      - PINK_WOOL
      - PISTON
      - PISTON_HEAD
      - PLAYER_HEAD
      - PLAYER_WALL_HEAD
      - PODZOL
      - POINTED_DRIPSTONE
      - POISONOUS_POTATO
      - POLAR_BEAR_SPAWN_EGG
      - POLISHED_ANDESITE
      - POLISHED_ANDESITE_SLAB
      - POLISHED_ANDESITE_STAIRS
      - POLISHED_BASALT
      - POLISHED_BLACKSTONE
      - POLISHED_BLACKSTONE_BRICK_SLAB
      - POLISHED_BLACKSTONE_BRICK_STAIRS
      - POLISHED_BLACKSTONE_BRICK_WALL
      - POLISHED_BLACKSTONE_BRICKS
      - POLISHED_BLACKSTONE_BUTTON
      - POLISHED_BLACKSTONE_PRESSURE_PLATE
      - POLISHED_BLACKSTONE_SLAB
      - POLISHED_BLACKSTONE_STAIRS
      - POLISHED_BLACKSTONE_WALL
      - POLISHED_DEEPSLATE
      - POLISHED_DEEPSLATE_SLAB
      - POLISHED_DEEPSLATE_STAIRS
      - POLISHED_DEEPSLATE_WALL
      - POLISHED_DIORITE
      - POLISHED_DIORITE_SLAB
      - POLISHED_DIORITE_STAIRS
      - POLISHED_GRANITE
      - POLISHED_GRANITE_SLAB
      - POLISHED_GRANITE_STAIRS
      - POPPED_CHORUS_FRUIT
      - POPPY
      - PORKCHOP
      - POTATO
      - POTATOES
      - POTION
      - POTTED_ACACIA_SAPLING
      - POTTED_ALLIUM
      - POTTED_AZALEA_BUSH
      - POTTED_AZURE_BLUET
      - POTTED_BAMBOO
      - POTTED_BIRCH_SAPLING
      - POTTED_BLUE_ORCHID
      - POTTED_BROWN_MUSHROOM
      - POTTED_CACTUS
      - POTTED_CORNFLOWER
      - POTTED_CRIMSON_FUNGUS
      - POTTED_CRIMSON_ROOTS
      - POTTED_DANDELION
      - POTTED_DARK_OAK_SAPLING
      - POTTED_DEAD_BUSH
      - POTTED_FERN
      - POTTED_FLOWERING_AZALEA_BUSH
      - POTTED_JUNGLE_SAPLING
      - POTTED_LILY_OF_THE_VALLEY
      - POTTED_MANGROVE_PROPAGULE
      - POTTED_OAK_SAPLING
      - POTTED_ORANGE_TULIP
      - POTTED_OXEYE_DAISY
      - POTTED_PINK_TULIP
      - POTTED_POPPY
      - POTTED_RED_MUSHROOM
      - POTTED_RED_TULIP
      - POTTED_SPRUCE_SAPLING
      - POTTED_WARPED_FUNGUS
      - POTTED_WARPED_ROOTS
      - POTTED_WHITE_TULIP
      - POTTED_WITHER_ROSE
      - POWDER_SNOW
      - POWDER_SNOW_BUCKET
      - POWDER_SNOW_CAULDRON
      - POWERED_RAIL
      - PRISMARINE
      - PRISMARINE_BRICK_SLAB
      - PRISMARINE_BRICK_STAIRS
      - PRISMARINE_BRICKS
      - PRISMARINE_CRYSTALS
      - PRISMARINE_SHARD
      - PRISMARINE_SLAB
      - PRISMARINE_STAIRS
      - PRISMARINE_WALL
      - PUFFERFISH
      - PUFFERFISH_BUCKET
      - PUFFERFISH_SPAWN_EGG
      - PUMPKIN
      - PUMPKIN_PIE
      - PUMPKIN_SEEDS
      - PUMPKIN_STEM
      - PURPLE_BANNER
      - PURPLE_BED
      - PURPLE_CANDLE
      - PURPLE_CANDLE_CAKE
      - PURPLE_CARPET
      - PURPLE_CONCRETE
      - PURPLE_CONCRETE_POWDER
      - PURPLE_DYE
      - PURPLE_GLAZED_TERRACOTTA
      - PURPLE_SHULKER_BOX
      - PURPLE_STAINED_GLASS
      - PURPLE_STAINED_GLASS_PANE
      - PURPLE_TERRACOTTA
      - PURPLE_WALL_BANNER
      - PURPLE_WOOL
      - PURPUR_BLOCK
      - PURPUR_PILLAR
      - PURPUR_SLAB
      - PURPUR_STAIRS
      - QUARTZ
      - QUARTZ_BLOCK
      - QUARTZ_BRICKS
      - QUARTZ_PILLAR
      - QUARTZ_SLAB
      - QUARTZ_STAIRS
      - RABBIT
      - RABBIT_FOOT
      - RABBIT_HIDE
      - RABBIT_SPAWN_EGG
      - RABBIT_STEW
      - RAIL
      - RAVAGER_SPAWN_EGG
      - RAW_COPPER
      - RAW_COPPER_BLOCK
      - RAW_GOLD
      - RAW_GOLD_BLOCK
      - RAW_IRON
      - RAW_IRON_BLOCK
      - RECOVERY_COMPASS
      - RED_BANNER
      - RED_BED
      - RED_CANDLE
      - RED_CANDLE_CAKE
      - RED_CARPET
      - RED_CONCRETE
      - RED_CONCRETE_POWDER
      - RED_DYE
      - RED_GLAZED_TERRACOTTA
      - RED_MUSHROOM
      - RED_MUSHROOM_BLOCK
      - RED_NETHER_BRICK_SLAB
      - RED_NETHER_BRICK_STAIRS
      - RED_NETHER_BRICK_WALL
      - RED_NETHER_BRICKS
      - RED_SAND
      - RED_SANDSTONE
      - RED_SANDSTONE_SLAB
      - RED_SANDSTONE_STAIRS
      - RED_SANDSTONE_WALL
      - RED_SHULKER_BOX
      - RED_STAINED_GLASS
      - RED_STAINED_GLASS_PANE
      - RED_TERRACOTTA
      - RED_TULIP
      - RED_WALL_BANNER
      - RED_WOOL
      - REDSTONE
      - REDSTONE_BLOCK
      - REDSTONE_LAMP
      - REDSTONE_ORE
      - REDSTONE_TORCH
      - REDSTONE_WALL_TORCH
      - REDSTONE_WIRE
      - REINFORCED_DEEPSLATE
      - REPEATER
      - REPEATING_COMMAND_BLOCK
      - RESPAWN_ANCHOR
      - ROOTED_DIRT
      - ROSE_BUSH
      - ROTTEN_FLESH
      - SADDLE
      - SALMON
      - SALMON_BUCKET
      - SALMON_SPAWN_EGG
      - SAND
      - SANDSTONE
      - SANDSTONE_SLAB
      - SANDSTONE_STAIRS
      - SANDSTONE_WALL
      - SCAFFOLDING
      - SCULK
      - SCULK_CATALYST
      - SCULK_SENSOR
      - SCULK_SHRIEKER
      - SCULK_VEIN
      - SCUTE
      - SEA_LANTERN
      - SEA_PICKLE
      - SEAGRASS
      - SHEARS
      - SHEEP_SPAWN_EGG
      - SHIELD
      - SHROOMLIGHT
      - SHULKER_BOX
      - SHULKER_SHELL
      - SHULKER_SPAWN_EGG
      - SILVERFISH_SPAWN_EGG
      - SKELETON_HORSE_SPAWN_EGG
      - SKELETON_SKULL
      - SKELETON_SPAWN_EGG
      - SKELETON_WALL_SKULL
      - SKULL_BANNER_PATTERN
      - SLIME_BALL
      - SLIME_BLOCK
      - SLIME_SPAWN_EGG
      - SMALL_AMETHYST_BUD
      - SMALL_DRIPLEAF
      - SMITHING_TABLE
      - SMOKER
      - SMOOTH_BASALT
      - SMOOTH_QUARTZ
      - SMOOTH_QUARTZ_SLAB
      - SMOOTH_QUARTZ_STAIRS
      - SMOOTH_RED_SANDSTONE
      - SMOOTH_RED_SANDSTONE_SLAB
      - SMOOTH_RED_SANDSTONE_STAIRS
      - SMOOTH_SANDSTONE
      - SMOOTH_SANDSTONE_SLAB
      - SMOOTH_SANDSTONE_STAIRS
      - SMOOTH_STONE
      - SMOOTH_STONE_SLAB
      - SNOW
      - SNOW_BLOCK
      - SNOWBALL
      - SOUL_CAMPFIRE
      - SOUL_FIRE
      - SOUL_LANTERN
      - SOUL_SAND
      - SOUL_SOIL
      - SOUL_TORCH
      - SOUL_WALL_TORCH
      - SPAWNER
      - SPECTRAL_ARROW
      - SPIDER_EYE
      - SPIDER_SPAWN_EGG
      - SPLASH_POTION
      - SPONGE
      - SPORE_BLOSSOM
      - SPRUCE_BOAT
      - SPRUCE_BUTTON
      - SPRUCE_CHEST_BOAT
      - SPRUCE_DOOR
      - SPRUCE_FENCE
      - SPRUCE_FENCE_GATE
      - SPRUCE_LEAVES
      - SPRUCE_LOG
      - SPRUCE_PLANKS
      - SPRUCE_PRESSURE_PLATE
      - SPRUCE_SAPLING
      - SPRUCE_SIGN
      - SPRUCE_SLAB
      - SPRUCE_STAIRS
      - SPRUCE_TRAPDOOR
      - SPRUCE_WALL_SIGN
      - SPRUCE_WOOD
      - SPYGLASS
      - SQUID_SPAWN_EGG
      - STICK
      - STICKY_PISTON
      - STONE
      - STONE_AXE
      - STONE_BRICK_SLAB
      - STONE_BRICK_STAIRS
      - STONE_BRICK_WALL
      - STONE_BRICKS
      - STONE_BUTTON
      - STONE_HOE
      - STONE_PICKAXE
      - STONE_PRESSURE_PLATE
      - STONE_SHOVEL
      - STONE_SLAB
      - STONE_STAIRS
      - STONE_SWORD
      - STONECUTTER
      - STRAY_SPAWN_EGG
      - STRIDER_SPAWN_EGG
      - STRING
      - STRIPPED_ACACIA_LOG
      - STRIPPED_ACACIA_WOOD
      - STRIPPED_BIRCH_LOG
      - STRIPPED_BIRCH_WOOD
      - STRIPPED_CRIMSON_HYPHAE
      - STRIPPED_CRIMSON_STEM
      - STRIPPED_DARK_OAK_LOG
      - STRIPPED_DARK_OAK_WOOD
      - STRIPPED_JUNGLE_LOG
      - STRIPPED_JUNGLE_WOOD
      - STRIPPED_MANGROVE_LOG
      - STRIPPED_MANGROVE_WOOD
      - STRIPPED_OAK_LOG
      - STRIPPED_OAK_WOOD
      - STRIPPED_SPRUCE_LOG
      - STRIPPED_SPRUCE_WOOD
      - STRIPPED_WARPED_HYPHAE
      - STRIPPED_WARPED_STEM
      - STRUCTURE_BLOCK
      - STRUCTURE_VOID
      - SUGAR
      - SUGAR_CANE
      - SUNFLOWER
      - SUSPICIOUS_STEW
      - SWEET_BERRIES
      - SWEET_BERRY_BUSH
      - TADPOLE_BUCKET
      - TADPOLE_SPAWN_EGG
      - TALL_GRASS
      - TALL_SEAGRASS
      - TARGET
      - TERRACOTTA
      - TINTED_GLASS
      - TIPPED_ARROW
      - TNT
      - TNT_MINECART
      - TORCH
      - TOTEM_OF_UNDYING
      - TRADER_LLAMA_SPAWN_EGG
      - TRAPPED_CHEST
      - TRIDENT
      - TRIPWIRE
      - TRIPWIRE_HOOK
      - TROPICAL_FISH
      - TROPICAL_FISH_BUCKET
      - TROPICAL_FISH_SPAWN_EGG
      - TUBE_CORAL
      - TUBE_CORAL_BLOCK
      - TUBE_CORAL_FAN
      - TUBE_CORAL_WALL_FAN
      - TUFF
      - TURTLE_EGG
      - TURTLE_HELMET
      - TURTLE_SPAWN_EGG
      - TWISTING_VINES
      - TWISTING_VINES_PLANT
      - VERDANT_FROGLIGHT
      - VEX_SPAWN_EGG
      - VILLAGER_SPAWN_EGG
      - VINDICATOR_SPAWN_EGG
      - VINE
      - VOID_AIR
      - WALL_TORCH
      - WANDERING_TRADER_SPAWN_EGG
      - WARDEN_SPAWN_EGG
      - WARPED_BUTTON
      - WARPED_DOOR
      - WARPED_FENCE
      - WARPED_FENCE_GATE
      - WARPED_FUNGUS
      - WARPED_FUNGUS_ON_A_STICK
      - WARPED_HYPHAE
      - WARPED_NYLIUM
      - WARPED_PLANKS
      - WARPED_PRESSURE_PLATE
      - WARPED_ROOTS
      - WARPED_SIGN
      - WARPED_SLAB
      - WARPED_STAIRS
      - WARPED_STEM
      - WARPED_TRAPDOOR
      - WARPED_WALL_SIGN
      - WARPED_WART_BLOCK
      - WATER
      - WATER_BUCKET
      - WATER_CAULDRON
      - WAXED_COPPER_BLOCK
      - WAXED_CUT_COPPER
      - WAXED_CUT_COPPER_SLAB
      - WAXED_CUT_COPPER_STAIRS
      - WAXED_EXPOSED_COPPER
      - WAXED_EXPOSED_CUT_COPPER
      - WAXED_EXPOSED_CUT_COPPER_SLAB
      - WAXED_EXPOSED_CUT_COPPER_STAIRS
      - WAXED_OXIDIZED_COPPER
      - WAXED_OXIDIZED_CUT_COPPER
      - WAXED_OXIDIZED_CUT_COPPER_SLAB
      - WAXED_OXIDIZED_CUT_COPPER_STAIRS
      - WAXED_WEATHERED_COPPER
      - WAXED_WEATHERED_CUT_COPPER
      - WAXED_WEATHERED_CUT_COPPER_SLAB
      - WAXED_WEATHERED_CUT_COPPER_STAIRS
      - WEATHERED_COPPER
      - WEATHERED_CUT_COPPER
      - WEATHERED_CUT_COPPER_SLAB
      - WEATHERED_CUT_COPPER_STAIRS
      - WEEPING_VINES
      - WEEPING_VINES_PLANT
      - WET_SPONGE
      - WHEAT
      - WHEAT_SEEDS
      - WHITE_BANNER
      - WHITE_BED
      - WHITE_CANDLE
      - WHITE_CANDLE_CAKE
      - WHITE_CARPET
      - WHITE_CONCRETE
      - WHITE_CONCRETE_POWDER
      - WHITE_DYE
      - WHITE_GLAZED_TERRACOTTA
      - WHITE_SHULKER_BOX
      - WHITE_STAINED_GLASS
      - WHITE_STAINED_GLASS_PANE
      - WHITE_TERRACOTTA
      - WHITE_TULIP
      - WHITE_WALL_BANNER
      - WHITE_WOOL
      - WITCH_SPAWN_EGG
      - WITHER_ROSE
      - WITHER_SKELETON_SKULL
      - WITHER_SKELETON_SPAWN_EGG
      - WITHER_SKELETON_WALL_SKULL
      - WOLF_SPAWN_EGG
      - WOODEN_AXE
      - WOODEN_HOE
      - WOODEN_PICKAXE
      - WOODEN_SHOVEL
      - WOODEN_SWORD
      - WRITABLE_BOOK
      - WRITTEN_BOOK
      - YELLOW_BANNER
      - YELLOW_BED
      - YELLOW_CANDLE
      - YELLOW_CANDLE_CAKE
      - YELLOW_CARPET
      - YELLOW_CONCRETE
      - YELLOW_CONCRETE_POWDER
      - YELLOW_DYE
      - YELLOW_GLAZED_TERRACOTTA
      - YELLOW_SHULKER_BOX
      - YELLOW_STAINED_GLASS
      - YELLOW_STAINED_GLASS_PANE
      - YELLOW_TERRACOTTA
      - YELLOW_WALL_BANNER
      - YELLOW_WOOL
      - ZOGLIN_SPAWN_EGG
      - ZOMBIE_HEAD
      - ZOMBIE_HORSE_SPAWN_EGG
      - ZOMBIE_SPAWN_EGG
      - ZOMBIE_VILLAGER_SPAWN_EGG
      - ZOMBIE_WALL_HEAD
      - ZOMBIFIED_PIGLIN_SPAWN_EGG

    Those are already prefixed for being in a List so you'd just copy and paste them to the appropriate sections of a config. Something like:
    Code:
    materials:
      easy:
      - OAK_PLANKS
      normal:
      - RED_WOOL
      wanted:
      - COMMAND_BLOCK
    Then during your onLoad, you'd populate your collection. I'd personally do it up something like:
    Code:
    private Map<MaterialClass, List<Material>> classifiedMaterials = new HashMap<>();
    
    public enum MaterialClass {
      EASY,
      NORMAL,
      WANTED
    }
    
    private void populateMaterials() {
      for (MaterialClass mc : MaterialClass.values()) {
        List<Material> materials = new ArrayList<>();
        for (String materialName : getConfig().getStringList("materials." + mc.name().toLowerCase())) {
          Material m = Material.matchMaterial(materialName);
          if (m == null) {
            getLogger().warning("** Invalid material specified in list " + mc.name() + ": " + materialName);
            continue;
          }
    
          materials.add(m);
        }
        classifiedMaterials.put(mc, materials);
      }
    }
    
    public boolean isMaterialClass(Material m, MaterialClass mc) {
      return classifiedMaterials.containsKey(mc) ? classifiedMaterials.get(mc).contains(m) : false;
    }
    
    public List<MaterialClass> getMaterialClasses(Material m) {
      List<MaterialClass> ret = new ArrayList<>();
      for (Map.Entry<MaterialClass, List<Material>> entry : classifiedMaterials.entrySet()) {
        if (!entry.getValue().contains(m)) continue;
        ret.add(entry.getKey());
      }
      return ret;
    }
    Could probably compress that a bit with streams, but I'm stream stupid so I do it the long way lol
     
    Last edited: Sep 29, 2022
  8. Offline

    Smeary_Subset


    Thank you both for the help! I went in and made a text file with pre-categorizing all the materials (I actually already had them pre-categorized in a word doc), then used a scanner to iterate through them and add them to the appropriate list. You are both right, this is a way simpler solution.


    Code:
    public final class Driver extends JavaPlugin implements Listener {
        public static final String ALL_WANTED_MATERIALS = "./plugins/Data/BlockShuffle/AllWantedMaterials.txt";
        private List<Material> easyMaterials;
        private List<Material> normalMaterials;
        private List<Material> difficultMaterials;
        private List<Material> excludedMaterials;
    
        @Override
        public void onEnable() {
            Bukkit.getPluginManager().registerEvents(this, this);
            generateAllLists();
        }
    
        @Override
        public void onDisable() {}
    
        @Override
        public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, String label, String[] args) {
            if(label.equalsIgnoreCase("Test"))
                if(sender.hasPermission("Test.use")) {
                    String category = args[0];
    
                    switch (category) {
                        case "Easy":
                            printListContents(easyMaterials);
                            break;
                        case "Normal":
                            printListContents(normalMaterials);
                            break;
                        case "Difficult":
                            printListContents(difficultMaterials);
                            break;
                        case "Excluded":
                            printListContents(excludedMaterials);
                            break;
                    }
                }
            return true;
        }
    
        private void generateAllLists() {
            easyMaterials = new ArrayList<>();
            normalMaterials = new ArrayList<>();
            difficultMaterials = new ArrayList<>();
            excludedMaterials = new ArrayList<>();
    
            File allWantedMaterials = new File(ALL_WANTED_MATERIALS);
            try {
                Scanner scanner = new Scanner(allWantedMaterials);
    
                String category = "";
                String line = "";
                Material mat;
                while(scanner.hasNextLine()) {
                    line = scanner.nextLine();
                    if(line.equals("Easy:") || line.equals("Normal:") || line.equals("Difficult:")) {
                        category = line;
                        continue;
                    }
    
                    try {
                        mat = Material.valueOf(line);
                        switch (category) {
                            case "Easy:":
                                easyMaterials.add(mat);
                                break;
                            case "Normal:":
                                normalMaterials.add(mat);
                                break;
                            case "Difficult:":
                                difficultMaterials.add(mat);
                                break;
                        }
                    } catch (Exception e) {
                        Bukkit.getLogger().log(Level.WARNING, "No material found for: " + line);
                    }
                }
            } catch (FileNotFoundException ignored) {
                Bukkit.getLogger().log(Level.SEVERE, "File not found!");
            }
        }
    
    
        private void printListContents(List<Material> list) {
            Logger logger = Bukkit.getLogger();
            for(Material mat : list) {
                logger.info(mat.name());
            }
            logger.log(Level.WARNING, list.size() + "");
        }
    }
     
    Strahan likes this.
  9. Online

    Strahan

    Just a suggestion; you should check if args have been passed before attempting to use them, and you should either upper or lowercase the category when you get it from args[0] before switching on it to avoid a failure if someone forgets to capitalize the category. I'd also throw a default: in the switch to yell at people if they put the wrong value.

    Also just out of curiosity, why are you using Scanner and not the built in YML config system? It'd be simpler. I'd also suggest Material#matchMaterial as you don't have to futz around with error trapping; it just returns null when it fails and it is cool with stuff like "AnViL" and "diamond block", which would cause valueOf to puke.
     
  10. Offline

    Smeary_Subset

    No one is "putting in a material". Everything is preloaded at the beginning, so users aren't choosing or inputting what materials are being used for the game. I made a test plugin that outputted all the materials that I wanted to include using my isWanted method and then manually sorted them in a text file.

    Which brings me to your question about the scanner. I am using a scanner because I had already sorted the material names in a text file (before you sent that message with all of them in config file), and there was no point in putting them into a yml
     
  11. Online

    Strahan

    You never know what the future brings. You may decide down the road to change the loadout.

    That said, the only time I said talked about "putting something in", I wasn't talking about materials. I was referring to the category.
     
  12. Offline

    Smeary_Subset

    You are correct, down the line I certainly may want to change the loadout. Whether I use a yml configuration or a text file, I can still change the loadout. Just given that it was already in a non-config format I chose a scanner.

    I accounted for the category in the scanner. The beginning of each category list begins with "Easy", "Normal", or "Difficult". If the scanner goes over that string, I know that I am in that category.

    Oh - and just to let you know the code that I posted was from a test plugin...not the actual minigame. Players aren't actually going to be typing the command /test <category>. That was just for me, hence why I didn't bother checking for correct arguments or correct number of arguments.
     
  13. Online

    Strahan

    I saw that you accounted for it, you just didn't validate it. Which was my point. As to the fact it's a test plugin, well, sorry but my mind reading skills aren't up to par unfortunately ;)
     
Thread Status:
Not open for further replies.

Share This Page