From 346937ba4a5558a3bc00d5ed6ebf36077af608f1 Mon Sep 17 00:00:00 2001 From: Sen Date: Sun, 20 Jul 2025 10:11:56 +0200 Subject: [PATCH] blocks/items init cleanup --- .../common/block/foliage/BlockFarmland.java | 4 + common/src/main/java/common/init/Blocks.java | 165 ++++++++++-------- common/src/main/java/common/init/Items.java | 19 +- 3 files changed, 109 insertions(+), 79 deletions(-) diff --git a/common/src/main/java/common/block/foliage/BlockFarmland.java b/common/src/main/java/common/block/foliage/BlockFarmland.java index 257bd4e7..ac79f2d7 100755 --- a/common/src/main/java/common/block/foliage/BlockFarmland.java +++ b/common/src/main/java/common/block/foliage/BlockFarmland.java @@ -162,4 +162,8 @@ public class BlockFarmland extends Block public boolean getSumBrightness() { return true; } + + protected boolean hasRegisteredItem() { + return false; + } } diff --git a/common/src/main/java/common/init/Blocks.java b/common/src/main/java/common/init/Blocks.java index c56bddff..53f03b0d 100755 --- a/common/src/main/java/common/init/Blocks.java +++ b/common/src/main/java/common/init/Blocks.java @@ -36,18 +36,18 @@ public abstract class Blocks { public static final BlockStairs acacia_stairs = get("acacia_stairs"); public static final BlockStaticLiquid acid = get("acid"); public static final BlockFlower allium = get("allium"); - public static final Block aluminium_block = get("aluminium_block"); - public static final BlockOre aluminium_ore = get("aluminium_ore"); - public static final Block antimony_block = get("antimony_block"); - public static final BlockOre antimony_ore = get("antimony_ore"); + public static final BlockMetalBlock aluminium_block = get("aluminium_block"); + public static final BlockMetalOre aluminium_ore = get("aluminium_ore"); + public static final BlockMetalBlock antimony_block = get("antimony_block"); + public static final BlockMetalOre antimony_ore = get("antimony_ore"); public static final BlockAnvil anvil = get("anvil"); public static final BlockAnvil anvil_damaged_1 = get("anvil_damaged_1"); public static final BlockAnvil anvil_damaged_2 = get("anvil_damaged_2"); public static final Block ardite_block = get("ardite_block"); public static final BlockOre ardite_ore = get("ardite_ore"); - public static final Block arsenic_block = get("arsenic_block"); - public static final BlockOre arsenic_ore = get("arsenic_ore"); - public static final Block ash = get("ash"); + public static final BlockMetalBlock arsenic_block = get("arsenic_block"); + public static final BlockMetalOre arsenic_ore = get("arsenic_ore"); + public static final BlockFalling ash = get("ash"); public static final BlockWorkbench assembly_unit = get("assembly_unit"); public static final BlockEffectGenerator effect_generator = get("effect_generator"); public static final BlockBedrock bedrock = get("bedrock"); @@ -64,8 +64,8 @@ public abstract class Blocks { public static final BlockSapling birch_sapling = get("birch_sapling"); public static final BlockSlab birch_slab = get("birch_slab"); public static final BlockStairs birch_stairs = get("birch_stairs"); - public static final Block bismuth_block = get("bismuth_block"); - public static final BlockOre bismuth_ore = get("bismuth_ore"); + public static final BlockMetalBlock bismuth_block = get("bismuth_block"); + public static final BlockMetalOre bismuth_ore = get("bismuth_ore"); public static final BlockBed black_bed = get("black_bed"); public static final Block black_brick = get("black_brick"); public static final BlockFence black_brick_fence = get("black_brick_fence"); @@ -77,8 +77,8 @@ public abstract class Blocks { public static final BlockStainedGlass black_glass = get("black_glass"); public static final BlockStainedGlassPane black_glass_pane = get("black_glass_pane"); public static final BlockFlower black_lotus = get("black_lotus"); - public static final Block black_metal_block = get("black_metal_block"); - public static final BlockOre black_metal_ore = get("black_metal_ore"); + public static final BlockMetalBlock black_metal_block = get("black_metal_block"); + public static final BlockMetalOre black_metal_ore = get("black_metal_ore"); public static final BlockQuartz black_quartz_block = get("black_quartz_block"); public static final BlockOre black_quartz_ore = get("black_quartz_ore"); public static final BlockQuartz black_quartz_ornaments = get("black_quartz_ornaments"); @@ -129,8 +129,8 @@ public abstract class Blocks { public static final BlockWool brown_wool = get("brown_wool"); public static final BlockCactus cactus = get("cactus"); public static final BlockCake cake = get("cake"); - public static final Block calcium_block = get("calcium_block"); - public static final BlockOre calcium_ore = get("calcium_ore"); + public static final BlockMetalBlock calcium_block = get("calcium_block"); + public static final BlockMetalOre calcium_ore = get("calcium_ore"); public static final BlockCarrot carrots = get("carrots"); public static final BlockSandStone carved_sandstone = get("carved_sandstone"); public static final Block carved_stonebrick = get("carved_stonebrick"); @@ -150,23 +150,23 @@ public abstract class Blocks { public static final BlockSlab cherry_slab = get("cherry_slab"); public static final BlockStairs cherry_stairs = get("cherry_stairs"); public static final BlockChest chest = get("chest"); - public static final Block chrome_block = get("chrome_block"); - public static final BlockOre chrome_ore = get("chrome_ore"); + public static final BlockMetalBlock chrome_block = get("chrome_block"); + public static final BlockMetalOre chrome_ore = get("chrome_ore"); public static final Block cinnabar_block = get("cinnabar_block"); public static final BlockOre cinnabar_ore = get("cinnabar_ore"); public static final BlockClay clay = get("clay"); public static final Block coal_block = get("coal_block"); public static final BlockOre coal_ore = get("coal_ore"); public static final Block coarse_dirt = get("coarse_dirt"); - public static final Block cobalt_block = get("cobalt_block"); - public static final BlockOre cobalt_ore = get("cobalt_ore"); + public static final BlockMetalBlock cobalt_block = get("cobalt_block"); + public static final BlockMetalOre cobalt_ore = get("cobalt_ore"); public static final Block cobblestone = get("cobblestone"); public static final BlockSlab cobblestone_slab = get("cobblestone_slab"); public static final BlockStairs cobblestone_stairs = get("cobblestone_stairs"); public static final BlockWall cobblestone_wall = get("cobblestone_wall"); public static final BlockWorkbench construction_table = get("construction_table"); - public static final Block copper_block = get("copper_block"); - public static final BlockOre copper_ore = get("copper_ore"); + public static final BlockMetalBlock copper_block = get("copper_block"); + public static final BlockMetalOre copper_ore = get("copper_ore"); public static final BlockCore core = get("core"); public static final Block cracked_stonebrick = get("cracked_stonebrick"); public static final BlockCarpet cyan_carpet = get("cyan_carpet"); @@ -238,8 +238,8 @@ public abstract class Blocks { public static final BlockGlass glass = get("glass"); public static final BlockPane glass_pane = get("glass_pane"); public static final BlockGlowstone glowstone = get("glowstone"); - public static final Block gold_block = get("gold_block"); - public static final BlockOre gold_ore = get("gold_ore"); + public static final BlockMetalBlock gold_block = get("gold_block"); + public static final BlockMetalOre gold_ore = get("gold_ore"); public static final BlockStaticLiquid goo = get("goo"); public static final BlockGrass grass = get("grass"); public static final BlockGravel gravel = get("gravel"); @@ -263,12 +263,12 @@ public abstract class Blocks { public static final BlockFlower houstonia = get("houstonia"); public static final BlockStaticLiquid hydrogen = get("hydrogen"); public static final BlockIce ice = get("ice"); - public static final Block iodine_block = get("iodine_block"); - public static final BlockOre iodine_ore = get("iodine_ore"); + public static final BlockMetalBlock iodine_block = get("iodine_block"); + public static final BlockMetalOre iodine_ore = get("iodine_ore"); public static final BlockPane iron_bars = get("iron_bars"); - public static final Block iron_block = get("iron_block"); + public static final BlockMetalBlock iron_block = get("iron_block"); public static final BlockDoor iron_door = get("iron_door"); - public static final BlockOre iron_ore = get("iron_ore"); + public static final BlockMetalOre iron_ore = get("iron_ore"); public static final BlockTrapDoor iron_trapdoor = get("iron_trapdoor"); public static final BlockDoor jungle_door = get("jungle_door"); public static final BlockFence jungle_fence = get("jungle_fence"); @@ -289,8 +289,8 @@ public abstract class Blocks { public static final BlockDoublePlant large_fern = get("large_fern"); public static final BlockDoublePlant large_tallgrass = get("large_tallgrass"); public static final BlockStaticLiquid lava = get("lava"); - public static final Block lead_block = get("lead_block"); - public static final BlockOre lead_ore = get("lead_ore"); + public static final BlockMetalBlock lead_block = get("lead_block"); + public static final BlockMetalOre lead_ore = get("lead_ore"); public static final BlockLever lever = get("lever"); public static final BlockCarpet light_blue_carpet = get("light_blue_carpet"); public static final BlockColoredClay light_blue_clay = get("light_blue_clay"); @@ -304,18 +304,18 @@ public abstract class Blocks { public static final BlockStainedGlassPane lime_glass_pane = get("lime_glass_pane"); public static final BlockWool lime_wool = get("lime_wool"); public static final BlockFurnace lit_furnace = get("lit_furnace"); - public static final Block lithium_block = get("lithium_block"); - public static final BlockOre lithium_ore = get("lithium_ore"); + public static final BlockMetalBlock lithium_block = get("lithium_block"); + public static final BlockMetalOre lithium_ore = get("lithium_ore"); public static final BlockCarpet magenta_carpet = get("magenta_carpet"); public static final BlockColoredClay magenta_clay = get("magenta_clay"); public static final BlockStainedGlass magenta_glass = get("magenta_glass"); public static final BlockStainedGlassPane magenta_glass_pane = get("magenta_glass_pane"); public static final BlockWool magenta_wool = get("magenta_wool"); public static final BlockStaticLiquid magma = get("magma"); - public static final Block magnesium_block = get("magnesium_block"); - public static final BlockOre magnesium_ore = get("magnesium_ore"); - public static final Block manganese_block = get("manganese_block"); - public static final BlockOre manganese_ore = get("manganese_ore"); + public static final BlockMetalBlock magnesium_block = get("magnesium_block"); + public static final BlockMetalOre magnesium_ore = get("magnesium_ore"); + public static final BlockMetalBlock manganese_block = get("manganese_block"); + public static final BlockMetalOre manganese_ore = get("manganese_ore"); public static final BlockDoor maple_door = get("maple_door"); public static final BlockFence maple_fence = get("maple_fence"); public static final BlockFenceGate maple_fence_gate = get("maple_fence_gate"); @@ -339,14 +339,14 @@ public abstract class Blocks { public static final BlockWall mossy_cobblestone_wall = get("mossy_cobblestone_wall"); public static final Block mossy_stonebrick = get("mossy_stonebrick"); public static final BlockMycelium mycelium = get("mycelium"); - public static final Block neodymium_block = get("neodymium_block"); - public static final BlockOre neodymium_ore = get("neodymium_ore"); - public static final Block neptunium_block = get("neptunium_block"); - public static final BlockOre neptunium_ore = get("neptunium_ore"); + public static final BlockMetalBlock neodymium_block = get("neodymium_block"); + public static final BlockMetalOre neodymium_ore = get("neodymium_ore"); + public static final BlockMetalBlock neptunium_block = get("neptunium_block"); + public static final BlockMetalOre neptunium_ore = get("neptunium_ore"); public static final Block nichun_block = get("nichun_block"); public static final BlockOre nichun_ore = get("nichun_ore"); - public static final Block nickel_block = get("nickel_block"); - public static final BlockOre nickel_ore = get("nickel_ore"); + public static final BlockMetalBlock nickel_block = get("nickel_block"); + public static final BlockMetalOre nickel_ore = get("nickel_ore"); public static final BlockStaticLiquid nukage = get("nukage"); public static final BlockNuke nuke = get("nuke"); public static final BlockDoor oak_door = get("oak_door"); @@ -371,11 +371,11 @@ public abstract class Blocks { public static final BlockWool orange_wool = get("orange_wool"); public static final BlockPackedIce packed_ice = get("packed_ice"); public static final BlockDoublePlant paeonia = get("paeonia"); - public static final Block palladium_block = get("palladium_block"); - public static final BlockOre palladium_ore = get("palladium_ore"); + public static final BlockMetalBlock palladium_block = get("palladium_block"); + public static final BlockMetalOre palladium_ore = get("palladium_ore"); public static final Block pentagram = get("pentagram"); - public static final Block phosphor_block = get("phosphor_block"); - public static final BlockOre phosphor_ore = get("phosphor_ore"); + public static final BlockMetalBlock phosphor_block = get("phosphor_block"); + public static final BlockMetalOre phosphor_ore = get("phosphor_ore"); public static final BlockCarpet pink_carpet = get("pink_carpet"); public static final BlockColoredClay pink_clay = get("pink_clay"); public static final BlockStainedGlass pink_glass = get("pink_glass"); @@ -385,19 +385,19 @@ public abstract class Blocks { public static final BlockPistonBase piston = get("piston"); public static final BlockPistonHead piston_head = get("piston_head"); public static final BlockPistonHead sticky_piston_head = get("sticky_piston_head"); - public static final Block platinum_block = get("platinum_block"); - public static final BlockOre platinum_ore = get("platinum_ore"); - public static final Block plutonium_block = get("plutonium_block"); - public static final BlockOre plutonium_ore = get("plutonium_ore"); + public static final BlockMetalBlock platinum_block = get("platinum_block"); + public static final BlockMetalOre platinum_ore = get("platinum_ore"); + public static final BlockMetalBlock plutonium_block = get("plutonium_block"); + public static final BlockMetalOre plutonium_ore = get("plutonium_ore"); public static final BlockPodzol podzol = get("podzol"); public static final BlockFlower poppy = get("poppy"); public static final BlockPortal portal = get("portal"); public static final BlockPortalFrame portal_frame = get("portal_frame"); - public static final Block potassium_block = get("potassium_block"); - public static final BlockOre potassium_ore = get("potassium_ore"); + public static final BlockMetalBlock potassium_block = get("potassium_block"); + public static final BlockMetalOre potassium_ore = get("potassium_ore"); public static final BlockPotato potatoes = get("potatoes"); - public static final Block praseodymium_block = get("praseodymium_block"); - public static final BlockOre praseodymium_ore = get("praseodymium_ore"); + public static final BlockMetalBlock praseodymium_block = get("praseodymium_block"); + public static final BlockMetalOre praseodymium_ore = get("praseodymium_ore"); public static final BlockPumpkin pumpkin = get("pumpkin"); public static final BlockStem pumpkin_stem = get("pumpkin_stem"); public static final BlockBed purple_bed = get("purple_bed"); @@ -412,8 +412,8 @@ public abstract class Blocks { public static final BlockQuartzPillar quartz_pillar = get("quartz_pillar"); public static final BlockSlab quartz_slab = get("quartz_slab"); public static final BlockStairs quartz_stairs = get("quartz_stairs"); - public static final Block radium_block = get("radium_block"); - public static final BlockOre radium_ore = get("radium_ore"); + public static final BlockMetalBlock radium_block = get("radium_block"); + public static final BlockMetalOre radium_ore = get("radium_ore"); public static final BlockRail rail = get("rail"); public static final BlockBed red_bed = get("red_bed"); public static final BlockButton red_button = get("red_button"); @@ -438,17 +438,17 @@ public abstract class Blocks { public static final BlockSandStone sandstone = get("sandstone"); public static final BlockSlab sandstone_slab = get("sandstone_slab"); public static final BlockStairs sandstone_stairs = get("sandstone_stairs"); - public static final Block selenium_block = get("selenium_block"); - public static final BlockOre selenium_ore = get("selenium_ore"); + public static final BlockMetalBlock selenium_block = get("selenium_block"); + public static final BlockMetalOre selenium_ore = get("selenium_ore"); public static final BlockStandingSign sign = get("sign"); - public static final Block silicon_block = get("silicon_block"); - public static final BlockOre silicon_ore = get("silicon_ore"); - public static final Block silver_block = get("silver_block"); + public static final BlockMetalBlock silicon_block = get("silicon_block"); + public static final BlockMetalOre silicon_ore = get("silicon_ore"); + public static final BlockMetalBlock silver_block = get("silver_block"); public static final BlockCarpet silver_carpet = get("silver_carpet"); public static final BlockColoredClay silver_clay = get("silver_clay"); public static final BlockStainedGlass silver_glass = get("silver_glass"); public static final BlockStainedGlassPane silver_glass_pane = get("silver_glass_pane"); - public static final BlockOre silver_ore = get("silver_ore"); + public static final BlockMetalOre silver_ore = get("silver_ore"); public static final BlockWool silver_wool = get("silver_wool"); public static final BlockSkull skull = get("skull"); public static final BlockStaticLiquid slime = get("slime"); @@ -457,8 +457,8 @@ public abstract class Blocks { public static final BlockSandStone smooth_sandstone = get("smooth_sandstone"); public static final BlockSnowBlock snow = get("snow"); public static final BlockSnow snow_layer = get("snow_layer"); - public static final Block sodium_block = get("sodium_block"); - public static final BlockOre sodium_ore = get("sodium_ore"); + public static final BlockMetalBlock sodium_block = get("sodium_block"); + public static final BlockMetalOre sodium_ore = get("sodium_ore"); public static final BlockSoulFire soul_fire = get("soul_fire"); public static final BlockSoulSand soul_sand = get("soul_sand"); public static final BlockWart soul_warts = get("soul_warts"); @@ -487,8 +487,8 @@ public abstract class Blocks { public static final BlockSlab stonebrick_slab = get("stonebrick_slab"); public static final BlockStairs stonebrick_stairs = get("stonebrick_stairs"); public static final BlockTripWire string = get("string"); - public static final Block sulfur_block = get("sulfur_block"); - public static final BlockOre sulfur_ore = get("sulfur_ore"); + public static final BlockMetalBlock sulfur_block = get("sulfur_block"); + public static final BlockMetalOre sulfur_ore = get("sulfur_ore"); public static final BlockDoublePlant sunflower = get("sunflower"); public static final BlockDoublePlant syringa = get("syringa"); public static final BlockTallGrass tallgrass = get("tallgrass"); @@ -510,10 +510,10 @@ public abstract class Blocks { public static final BlockSlab tian_slab = get("tian_slab"); public static final BlockTianSoil tian_soil = get("tian_soil"); public static final BlockStairs tian_stairs = get("tian_stairs"); - public static final Block tin_block = get("tin_block"); - public static final BlockOre tin_ore = get("tin_ore"); - public static final Block titanium_block = get("titanium_block"); - public static final BlockOre titanium_ore = get("titanium_ore"); + public static final BlockMetalBlock tin_block = get("tin_block"); + public static final BlockMetalOre tin_ore = get("tin_ore"); + public static final BlockMetalBlock titanium_block = get("titanium_block"); + public static final BlockMetalOre titanium_ore = get("titanium_ore"); public static final BlockTNT tnt = get("tnt"); public static final BlockTNT tnt_1 = get("tnt_1"); public static final BlockTNT tnt_2 = get("tnt_2"); @@ -524,12 +524,12 @@ public abstract class Blocks { public static final BlockTNT tnt_7 = get("tnt_7"); public static final BlockTrapDoor trapdoor = get("trapdoor"); public static final BlockTripWireHook tripwire_hook = get("tripwire_hook"); - public static final Block tungsten_block = get("tungsten_block"); - public static final BlockOre tungsten_ore = get("tungsten_ore"); - public static final Block uranium_block = get("uranium_block"); - public static final BlockOre uranium_ore = get("uranium_ore"); - public static final Block vanadium_block = get("vanadium_block"); - public static final BlockOre vanadium_ore = get("vanadium_ore"); + public static final BlockMetalBlock tungsten_block = get("tungsten_block"); + public static final BlockMetalOre tungsten_ore = get("tungsten_ore"); + public static final BlockMetalBlock uranium_block = get("uranium_block"); + public static final BlockMetalOre uranium_ore = get("uranium_ore"); + public static final BlockMetalBlock vanadium_block = get("vanadium_block"); + public static final BlockMetalOre vanadium_ore = get("vanadium_ore"); public static final BlockVine vine = get("vine"); public static final BlockWallSign wall_sign = get("wall_sign"); public static final BlockWarpChest warp_chest = get("warp_chest"); @@ -552,8 +552,8 @@ public abstract class Blocks { public static final BlockStainedGlass yellow_glass = get("yellow_glass"); public static final BlockStainedGlassPane yellow_glass_pane = get("yellow_glass_pane"); public static final BlockWool yellow_wool = get("yellow_wool"); - public static final Block zinc_block = get("zinc_block"); - public static final BlockOre zinc_ore = get("zinc_ore"); + public static final BlockMetalBlock zinc_block = get("zinc_block"); + public static final BlockMetalOre zinc_ore = get("zinc_ore"); public static final Block concrete = get("concrete"); public static final BlockSlab concrete_slab = get("concrete_slab"); public static final BlockStairs concrete_stairs = get("concrete_stairs"); @@ -602,15 +602,26 @@ public abstract class Blocks { static { if(Util.DEVMODE) { Set blocks = Sets.newHashSet(BlockRegistry.blocks()); + List invalid = Lists.newArrayList(); for(Field field : Blocks.class.getDeclaredFields()) { if(Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && Block.class.isAssignableFrom(field.getType())) try { - blocks.remove(field.get(null)); + Block block = (Block)field.get(null); + if(field.getType() != block.getClass()) + invalid.add(String.format("\tpublic static final %s %s = get(\"%s\");\n", block.getClass().getSimpleName(), BlockRegistry.getName(block), BlockRegistry.getName(block))); + blocks.remove(block); } catch(IllegalArgumentException | IllegalAccessException e) { Util.throwUnchecked(e); } } + if(!invalid.isEmpty()) { + System.err.printf("\n*** -------------------------------------------------------------- ***\n\n"); + for(String item : invalid) { + System.err.printf(item); + } + System.err.printf("\n^^^ " + Blocks.class.getCanonicalName() + ": Falscher Klassentyp, Bitte Quellcode ersetzen ^^^\n"); + } if(!blocks.isEmpty()) { List list = Lists.newArrayList(blocks); Collections.sort(list, Comparator.comparing(block -> BlockRegistry.getName(block))); @@ -622,6 +633,8 @@ public abstract class Blocks { System.err.printf("\n^^^ " + Blocks.class.getCanonicalName() + ": Blockliste ist unvollständig, Bitte neuen Quellcode einfügen ^^^\n"); System.exit(1); } + if(!invalid.isEmpty()) + System.exit(1); } } } diff --git a/common/src/main/java/common/init/Items.java b/common/src/main/java/common/init/Items.java index 7f2b07de..c0b3be01 100755 --- a/common/src/main/java/common/init/Items.java +++ b/common/src/main/java/common/init/Items.java @@ -58,6 +58,7 @@ import common.item.tool.ItemShovel; import common.item.tool.ItemSpaceNavigator; import common.item.tool.ItemWeatherToken; import common.item.weapon.ItemAmmo; +import common.item.weapon.ItemArrow; import common.item.weapon.ItemBanHammer; import common.item.weapon.ItemBoltgun; import common.item.weapon.ItemBow; @@ -104,7 +105,7 @@ public abstract class Items { public static final ItemArmor ardite_leggings = get("ardite_leggings"); public static final Item ardite_ore = get("ardite_ore"); public static final ItemSword ardite_sword = get("ardite_sword"); - public static final Item arrow = get("arrow"); + public static final ItemArrow arrow = get("arrow"); public static final Item arsenic_block = get("arsenic_block"); public static final Item arsenic_ore = get("arsenic_ore"); public static final ItemMetal arsenic_powder = get("arsenic_powder"); @@ -344,7 +345,6 @@ public abstract class Items { public static final Item enchanting_table = get("enchanting_table"); public static final ItemExpBottle experience_bottle = get("experience_bottle"); public static final ItemExterminator exterminator = get("exterminator"); - public static final Item farmland = get("farmland"); public static final Item feather = get("feather"); public static final Item fermented_spider_eye = get("fermented_spider_eye"); public static final Item fern = get("fern"); @@ -1002,10 +1002,14 @@ public abstract class Items { static { if(Util.DEVMODE) { Set items = Sets.newHashSet(ItemRegistry.items()); + List invalid = Lists.newArrayList(); for(Field field : Items.class.getDeclaredFields()) { if(Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && Item.class.isAssignableFrom(field.getType())) try { - items.remove(field.get(null)); + Item item = (Item)field.get(null); + if(field.getType() != item.getClass()) + invalid.add(String.format("\tpublic static final %s %s = get(\"%s\");\n", item.getClass().getSimpleName(), ItemRegistry.getName(item), ItemRegistry.getName(item))); + items.remove(item); } catch(IllegalArgumentException | IllegalAccessException e) { Util.throwUnchecked(e); @@ -1016,6 +1020,13 @@ public abstract class Items { if(item instanceof ItemCharTemplate || item instanceof ItemMobTemplate) iter.remove(); } + if(!invalid.isEmpty()) { + System.err.printf("\n*** -------------------------------------------------------------- ***\n\n"); + for(String item : invalid) { + System.err.printf(item); + } + System.err.printf("\n^^^ " + Items.class.getCanonicalName() + ": Falscher Klassentyp, Bitte Quellcode ersetzen ^^^\n"); + } if(!items.isEmpty()) { List list = Lists.newArrayList(items); Collections.sort(list, Comparator.comparing(item -> ItemRegistry.getName(item))); @@ -1027,6 +1038,8 @@ public abstract class Items { System.err.printf("\n^^^ " + Items.class.getCanonicalName() + ": Gegenstandsliste ist unvollständig, Bitte neuen Quellcode einfügen ^^^\n"); System.exit(1); } + if(!invalid.isEmpty()) + System.exit(1); } } }