diff --git a/src/main/java/blusunrize/immersiveengineering/client/manual/IEManualInstance.java b/src/main/java/blusunrize/immersiveengineering/client/manual/IEManualInstance.java index cb9d867138..2b17a6db9b 100644 --- a/src/main/java/blusunrize/immersiveengineering/client/manual/IEManualInstance.java +++ b/src/main/java/blusunrize/immersiveengineering/client/manual/IEManualInstance.java @@ -29,6 +29,7 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.resources.language.I18n; import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.common.ModConfigSpec.ConfigValue; import net.neoforged.neoforge.network.PacketDistributor; import java.util.ArrayList; @@ -63,10 +64,10 @@ else if("machines.wireConnectorInput".equals(s)) ); // TODO is this right? UnmodifiableConfig actualCfg = IEServerConfig.CONFIG_SPEC.getValues(); - if(!actualCfg.contains(s)) - return null; + if(actualCfg.get(s) instanceof ConfigValue value) + return value.get(); else - return actualCfg.get(s); + return null; }); /* TODO no longer easily possible? diff --git a/src/main/resources/assets/immersiveengineering/manual/alloy_kiln.json b/src/main/resources/assets/immersiveengineering/manual/alloy_kiln.json index 700da889d7..5daaf8f785 100644 --- a/src/main/resources/assets/immersiveengineering/manual/alloy_kiln.json +++ b/src/main/resources/assets/immersiveengineering/manual/alloy_kiln.json @@ -15,18 +15,18 @@ { "x": 24, "y": 0, - "item": "minecraft:glass", + "id": "minecraft:glass", "count": 2 }, { "x": 42, "y": 0, - "item": "immersiveengineering:dust_iron" + "id": "immersiveengineering:dust_iron" }, { "x": 78, "y": 0, - "item": "immersiveengineering:insulating_glass", + "id": "immersiveengineering:insulating_glass", "count": 2 } ] diff --git a/src/main/resources/assets/immersiveengineering/manual/basic_metal_products.json b/src/main/resources/assets/immersiveengineering/manual/basic_metal_products.json index e9d46a8ed7..1ce59b6057 100644 --- a/src/main/resources/assets/immersiveengineering/manual/basic_metal_products.json +++ b/src/main/resources/assets/immersiveengineering/manual/basic_metal_products.json @@ -15,17 +15,17 @@ { "x": 24, "y": 0, - "item": "minecraft:iron_ingot" + "id": "minecraft:iron_ingot" }, { "x": 42, "y": 0, - "item": "immersiveengineering:coal_coke" + "id": "immersiveengineering:coal_coke" }, { "x": 78, "y": 0, - "item": "immersiveengineering:ingot_steel" + "id": "immersiveengineering:ingot_steel" } ] ] diff --git a/src/main/resources/assets/immersiveengineering/manual/bottling_machine.json b/src/main/resources/assets/immersiveengineering/manual/bottling_machine.json index 6f11ad0c22..c9b45230d3 100644 --- a/src/main/resources/assets/immersiveengineering/manual/bottling_machine.json +++ b/src/main/resources/assets/immersiveengineering/manual/bottling_machine.json @@ -7,21 +7,27 @@ "type": "bottling", "recipes": [ { - "item": "minecraft:potion", - "nbt": { - "Potion": "minecraft:awkward" + "id": "minecraft:potion", + "components": { + "minecraft:potion_contents": { + "potion": "minecraft:awkward" + } } }, { - "item": "minecraft:potion", - "nbt": { - "Potion": "minecraft:strength" + "id": "minecraft:potion", + "components": { + "minecraft:potion_contents": { + "potion": "minecraft:strength" + } } }, { - "item": "minecraft:potion", - "nbt": { - "Potion": "minecraft:swiftness" + "id": "minecraft:potion", + "components": { + "minecraft:potion_contents": { + "potion": "minecraft:swiftness" + } } } ] diff --git a/src/main/resources/assets/immersiveengineering/manual/buzzsaw.json b/src/main/resources/assets/immersiveengineering/manual/buzzsaw.json index 188f069346..21151e30f4 100644 --- a/src/main/resources/assets/immersiveengineering/manual/buzzsaw.json +++ b/src/main/resources/assets/immersiveengineering/manual/buzzsaw.json @@ -22,7 +22,7 @@ "grinding_recipe": { "type": "bottling", "recipe": { - "item": "immersiveengineering:grindingdisk" + "id": "immersiveengineering:grindingdisk" } }, "tank_recipe": { diff --git a/src/main/resources/assets/immersiveengineering/manual/clinker_brick.json b/src/main/resources/assets/immersiveengineering/manual/clinker_brick.json index 736ddf2d4b..84450b0a6e 100644 --- a/src/main/resources/assets/immersiveengineering/manual/clinker_brick.json +++ b/src/main/resources/assets/immersiveengineering/manual/clinker_brick.json @@ -3,7 +3,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:clinker_brick" + "id": "immersiveengineering:clinker_brick" } ] }, @@ -22,13 +22,13 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:stairs_clinker_brick" + "id": "immersiveengineering:stairs_clinker_brick" }, { - "item": "immersiveengineering:wall_clinker_brick" + "id": "immersiveengineering:wall_clinker_brick" }, { - "item": "immersiveengineering:slab_clinker_brick" + "id": "immersiveengineering:slab_clinker_brick" } ] } diff --git a/src/main/resources/assets/immersiveengineering/manual/coke_and_graphite.json b/src/main/resources/assets/immersiveengineering/manual/coke_and_graphite.json index 7721ec03b8..85b8fec05e 100644 --- a/src/main/resources/assets/immersiveengineering/manual/coke_and_graphite.json +++ b/src/main/resources/assets/immersiveengineering/manual/coke_and_graphite.json @@ -3,10 +3,10 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:coal_coke" + "id": "immersiveengineering:coal_coke" }, { - "item": "immersiveengineering:dust_coke" + "id": "immersiveengineering:dust_coke" } ] }, @@ -14,10 +14,10 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:dust_hop_graphite" + "id": "immersiveengineering:dust_hop_graphite" }, { - "item": "immersiveengineering:ingot_hop_graphite" + "id": "immersiveengineering:ingot_hop_graphite" } ] }, diff --git a/src/main/resources/assets/immersiveengineering/manual/concrete.json b/src/main/resources/assets/immersiveengineering/manual/concrete.json index dcc4e3392c..61986de528 100644 --- a/src/main/resources/assets/immersiveengineering/manual/concrete.json +++ b/src/main/resources/assets/immersiveengineering/manual/concrete.json @@ -16,16 +16,16 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:concrete_brick" + "id": "immersiveengineering:concrete_brick" }, { - "item": "immersiveengineering:concrete_brick_cracked" + "id": "immersiveengineering:concrete_brick_cracked" }, { - "item": "immersiveengineering:concrete_pillar" + "id": "immersiveengineering:concrete_pillar" }, { - "item": "immersiveengineering:concrete_chiseled" + "id": "immersiveengineering:concrete_chiseled" } ] }, @@ -33,19 +33,19 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:concrete_sheet" + "id": "immersiveengineering:concrete_sheet" }, { - "item": "immersiveengineering:concrete_quarter" + "id": "immersiveengineering:concrete_quarter" }, { - "item": "immersiveengineering:slab_concrete" + "id": "immersiveengineering:slab_concrete" }, { - "item": "immersiveengineering:concrete_three_quarter" + "id": "immersiveengineering:concrete_three_quarter" }, { - "item": "immersiveengineering:concrete_tile" + "id": "immersiveengineering:concrete_tile" } ] }, diff --git a/src/main/resources/assets/immersiveengineering/manual/ear_defenders.json b/src/main/resources/assets/immersiveengineering/manual/ear_defenders.json index c6a1b0dd4a..af1810f28e 100644 --- a/src/main/resources/assets/immersiveengineering/manual/ear_defenders.json +++ b/src/main/resources/assets/immersiveengineering/manual/ear_defenders.json @@ -11,23 +11,23 @@ { "x": 24, "y": 0, - "item": "immersiveengineering:earmuffs" + "id": "immersiveengineering:earmuffs" }, { "x": 42, "y": 0, "stacks": [ { - "item": "minecraft:white_dye" + "id": "minecraft:white_dye" }, { - "item": "minecraft:red_dye" + "id": "minecraft:red_dye" }, { - "item": "minecraft:green_dye" + "id": "minecraft:green_dye" }, { - "item": "minecraft:blue_dye" + "id": "minecraft:blue_dye" } ] }, @@ -36,27 +36,47 @@ "y": 0, "stacks": [ { - "item": "immersiveengineering:earmuffs", - "nbt": { - "IE:EarmuffColour": 16383998 + "id": "immersiveengineering:earmuffs", + "components": { + "immersiveengineering:color": { + "a": 1, + "r": 0.9764705882352941, + "g": 1.0, + "b": 0.996078431372549 + } } }, { - "item": "immersiveengineering:earmuffs", - "nbt": { - "IE:EarmuffColour": 11546150 + "id": "immersiveengineering:earmuffs", + "components": { + "immersiveengineering:color": { + "a": 1, + "r": 0.6901960784313725, + "g": 0.1803921568627451, + "b": 0.14901960784313725 + } } }, { - "item": "immersiveengineering:earmuffs", - "nbt": { - "IE:EarmuffColour": 6192150 + "id": "immersiveengineering:earmuffs", + "components": { + "immersiveengineering:color": { + "a": 1, + "r": 0.3686274509803922, + "g": 0.48627450980392156, + "b": 0.08627450980392157 + } } }, { - "item": "immersiveengineering:earmuffs", - "nbt": { - "IE:EarmuffColour": 8606770 + "id": "immersiveengineering:earmuffs", + "components": { + "immersiveengineering:color": { + "a": 1, + "r": 0.5137254901960784, + "g": 0.32941176470588235, + "b": 0.19607843137254902 + } } } ] @@ -66,7 +86,7 @@ [ [ { - "item": "immersiveengineering:earmuffs", + "id": "immersiveengineering:earmuffs", "x": 24, "y": 0 }, @@ -75,10 +95,10 @@ "y": 0, "stacks": [ { - "item": "minecraft:leather_helmet" + "id": "minecraft:leather_helmet" }, { - "item": "minecraft:iron_helmet" + "id": "minecraft:iron_helmet" } ] }, @@ -87,20 +107,18 @@ "y": 0, "stacks": [ { - "item": "minecraft:leather_helmet", - "nbt": { - "IE:Earmuffs": { - "id": "immersiveengineering:earmuffs", - "Count": 1 + "id": "minecraft:leather_helmet", + "components": { + "immersiveengineering:contained_earmuff": { + "id": "immersiveengineering:earmuffs" } } }, { - "item": "minecraft:iron_helmet", - "nbt": { - "IE:Earmuffs": { - "id": "immersiveengineering:earmuffs", - "Count": 1 + "id": "minecraft:iron_helmet", + "components": { + "immersiveengineering:contained_earmuff": { + "id": "immersiveengineering:earmuffs" } } } diff --git a/src/main/resources/assets/immersiveengineering/manual/industrial_byproducts.json b/src/main/resources/assets/immersiveengineering/manual/industrial_byproducts.json index 75a20abf18..39f56cc399 100644 --- a/src/main/resources/assets/immersiveengineering/manual/industrial_byproducts.json +++ b/src/main/resources/assets/immersiveengineering/manual/industrial_byproducts.json @@ -3,7 +3,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:dust_sulfur" + "id": "immersiveengineering:dust_sulfur" } ] }, @@ -11,7 +11,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:dust_saltpeter" + "id": "immersiveengineering:dust_saltpeter" } ] }, @@ -19,7 +19,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:slag" + "id": "immersiveengineering:slag" } ] }, diff --git a/src/main/resources/assets/immersiveengineering/manual/industrial_dyes.json b/src/main/resources/assets/immersiveengineering/manual/industrial_dyes.json index f195be51bd..6ae76712da 100644 --- a/src/main/resources/assets/immersiveengineering/manual/industrial_dyes.json +++ b/src/main/resources/assets/immersiveengineering/manual/industrial_dyes.json @@ -3,13 +3,13 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:ingot_lead" + "id": "immersiveengineering:ingot_lead" }, { - "item": "minecraft:white_dye" + "id": "minecraft:white_dye" }, { - "item": "minecraft:red_dye" + "id": "minecraft:red_dye" } ] }, @@ -25,12 +25,12 @@ { "x": 33, "y": 0, - "item": "immersiveengineering:nugget_lead" + "id": "immersiveengineering:nugget_lead" }, { "x": 69, "y": 0, - "item": "minecraft:red_dye" + "id": "minecraft:red_dye" } ] ] diff --git a/src/main/resources/assets/immersiveengineering/manual/industrial_fluids.json b/src/main/resources/assets/immersiveengineering/manual/industrial_fluids.json index 643c92c4c1..d4890ef09f 100644 --- a/src/main/resources/assets/immersiveengineering/manual/industrial_fluids.json +++ b/src/main/resources/assets/immersiveengineering/manual/industrial_fluids.json @@ -3,7 +3,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:creosote_bucket" + "id": "immersiveengineering:creosote_bucket" } ] }, @@ -21,13 +21,13 @@ "type": "bottling", "recipes": [ { - "item": "minecraft:exposed_copper" + "id": "minecraft:exposed_copper" }, { - "item": "minecraft:weathered_copper" + "id": "minecraft:weathered_copper" }, { - "item": "minecraft:oxidized_copper" + "id": "minecraft:oxidized_copper" } ] }, @@ -35,10 +35,10 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:plantoil_bucket" + "id": "immersiveengineering:plantoil_bucket" }, { - "item": "immersiveengineering:ethanol_bucket" + "id": "immersiveengineering:ethanol_bucket" } ] }, @@ -46,7 +46,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:biodiesel_bucket" + "id": "immersiveengineering:biodiesel_bucket" } ] }, @@ -54,7 +54,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:high_power_biodiesel_bucket" + "id": "immersiveengineering:high_power_biodiesel_bucket" } ] }, @@ -62,10 +62,10 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:phenolic_resin_bucket" + "id": "immersiveengineering:phenolic_resin_bucket" }, { - "item": "immersiveengineering:acetaldehyde_bucket" + "id": "immersiveengineering:acetaldehyde_bucket" } ] }, @@ -73,7 +73,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:herbicide_bucket" + "id": "immersiveengineering:herbicide_bucket" } ] }, @@ -87,7 +87,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:potion_bucket" + "id": "immersiveengineering:potion_bucket" } ] } diff --git a/src/main/resources/assets/immersiveengineering/manual/industrial_hemp.json b/src/main/resources/assets/immersiveengineering/manual/industrial_hemp.json index 9bb198e917..3e675e2574 100644 --- a/src/main/resources/assets/immersiveengineering/manual/industrial_hemp.json +++ b/src/main/resources/assets/immersiveengineering/manual/industrial_hemp.json @@ -3,10 +3,10 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:hemp_fiber" + "id": "immersiveengineering:hemp_fiber" }, { - "item": "immersiveengineering:seed" + "id": "immersiveengineering:seed" } ] }, diff --git a/src/main/resources/assets/immersiveengineering/manual/large_constructions.json b/src/main/resources/assets/immersiveengineering/manual/large_constructions.json index 3492d084bc..28ae2fac83 100644 --- a/src/main/resources/assets/immersiveengineering/manual/large_constructions.json +++ b/src/main/resources/assets/immersiveengineering/manual/large_constructions.json @@ -3,10 +3,10 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:crusher" + "id": "immersiveengineering:crusher" }, { - "item": "immersiveengineering:arc_furnace" + "id": "immersiveengineering:arc_furnace" } ] } diff --git a/src/main/resources/assets/immersiveengineering/manual/metal_press.json b/src/main/resources/assets/immersiveengineering/manual/metal_press.json index dc037d78dc..4bb8ef00a9 100644 --- a/src/main/resources/assets/immersiveengineering/manual/metal_press.json +++ b/src/main/resources/assets/immersiveengineering/manual/metal_press.json @@ -24,13 +24,13 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:mold_packing_4" + "id": "immersiveengineering:mold_packing_4" }, { - "item": "immersiveengineering:mold_packing_9" + "id": "immersiveengineering:mold_packing_9" }, { - "item": "immersiveengineering:mold_unpacking" + "id": "immersiveengineering:mold_unpacking" } ] } diff --git a/src/main/resources/assets/immersiveengineering/manual/mineral_deposits.json b/src/main/resources/assets/immersiveengineering/manual/mineral_deposits.json index f5a3d64434..bfa9892ba0 100644 --- a/src/main/resources/assets/immersiveengineering/manual/mineral_deposits.json +++ b/src/main/resources/assets/immersiveengineering/manual/mineral_deposits.json @@ -9,13 +9,25 @@ }, "core_sample": { "type": "item_display", - "item": { - "item": "immersiveengineering:coresample", - "nbt": { - "mineralInfo": [{ - "mineral": "immersiveengineering:mineral/chalcopyrite", - "percentage": 1.0 - }] + "id": { + "id": "immersiveengineering:coresample", + "components": { + "immersiveengineering:coresample_data": { + "veins": [ + { + "mineral": "immersiveengineering:mineral/chalcopyrite", + "percentage": 1.0, + "depletion": 0, + "saturation": 1 + } + ], + "timestamp": 0, + "position": { + "dimension": "minecraft:overworld", + "x": 0, + "z": 0 + } + } } } }, @@ -23,13 +35,13 @@ "type": "item_display", "items": [ { - "item": "minecraft:cobbled_deepslate" + "id": "minecraft:cobbled_deepslate" }, { - "item": "minecraft:cobblestone" + "id": "minecraft:cobblestone" }, { - "item": "minecraft:gravel" + "id": "minecraft:gravel" } ] } diff --git a/src/main/resources/assets/immersiveengineering/manual/ores.json b/src/main/resources/assets/immersiveengineering/manual/ores.json index bc9a8229f7..db143da84b 100644 --- a/src/main/resources/assets/immersiveengineering/manual/ores.json +++ b/src/main/resources/assets/immersiveengineering/manual/ores.json @@ -3,16 +3,16 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:ore_aluminum" + "id": "immersiveengineering:ore_aluminum" }, { - "item": "immersiveengineering:deepslate_ore_aluminum" + "id": "immersiveengineering:deepslate_ore_aluminum" }, { - "item": "immersiveengineering:raw_aluminum" + "id": "immersiveengineering:raw_aluminum" }, { - "item": "immersiveengineering:ingot_aluminum" + "id": "immersiveengineering:ingot_aluminum" } ] }, @@ -20,16 +20,16 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:ore_lead" + "id": "immersiveengineering:ore_lead" }, { - "item": "immersiveengineering:deepslate_ore_lead" + "id": "immersiveengineering:deepslate_ore_lead" }, { - "item": "immersiveengineering:raw_lead" + "id": "immersiveengineering:raw_lead" }, { - "item": "immersiveengineering:ingot_lead" + "id": "immersiveengineering:ingot_lead" } ] }, @@ -37,16 +37,16 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:ore_silver" + "id": "immersiveengineering:ore_silver" }, { - "item": "immersiveengineering:deepslate_ore_silver" + "id": "immersiveengineering:deepslate_ore_silver" }, { - "item": "immersiveengineering:raw_silver" + "id": "immersiveengineering:raw_silver" }, { - "item": "immersiveengineering:ingot_silver" + "id": "immersiveengineering:ingot_silver" } ] }, @@ -54,16 +54,16 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:ore_nickel" + "id": "immersiveengineering:ore_nickel" }, { - "item": "immersiveengineering:deepslate_ore_nickel" + "id": "immersiveengineering:deepslate_ore_nickel" }, { - "item": "immersiveengineering:raw_nickel" + "id": "immersiveengineering:raw_nickel" }, { - "item": "immersiveengineering:ingot_nickel" + "id": "immersiveengineering:ingot_nickel" } ] }, @@ -71,16 +71,16 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:ore_uranium" + "id": "immersiveengineering:ore_uranium" }, { - "item": "immersiveengineering:deepslate_ore_uranium" + "id": "immersiveengineering:deepslate_ore_uranium" }, { - "item": "immersiveengineering:raw_uranium" + "id": "immersiveengineering:raw_uranium" }, { - "item": "immersiveengineering:ingot_uranium" + "id": "immersiveengineering:ingot_uranium" } ] } diff --git a/src/main/resources/assets/immersiveengineering/manual/resin_and_duroplast.json b/src/main/resources/assets/immersiveengineering/manual/resin_and_duroplast.json index eb17924523..2988bccabb 100644 --- a/src/main/resources/assets/immersiveengineering/manual/resin_and_duroplast.json +++ b/src/main/resources/assets/immersiveengineering/manual/resin_and_duroplast.json @@ -3,7 +3,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:phenolic_resin_bucket" + "id": "immersiveengineering:phenolic_resin_bucket" } ] }, @@ -11,23 +11,23 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:duroplast" + "id": "immersiveengineering:duroplast" }, { - "item": "immersiveengineering:plate_duroplast" + "id": "immersiveengineering:plate_duroplast" } ] }, "duroplast_sheet": { "type": "bottling", "recipe": { - "item": "immersiveengineering:plate_duroplast" + "id": "immersiveengineering:plate_duroplast" } }, "duroplast_block": { "type": "bottling", "recipe": { - "item": "immersiveengineering:duroplast" + "id": "immersiveengineering:duroplast" } }, "fiberboard": { @@ -37,7 +37,7 @@ "empty_shell": { "type": "bottling", "recipe": { - "item": "immersiveengineering:empty_shell" + "id": "immersiveengineering:empty_shell" } } } diff --git a/src/main/resources/assets/immersiveengineering/manual/shaders.json b/src/main/resources/assets/immersiveengineering/manual/shaders.json index 286503cb2f..7932c4e69d 100644 --- a/src/main/resources/assets/immersiveengineering/manual/shaders.json +++ b/src/main/resources/assets/immersiveengineering/manual/shaders.json @@ -1,6 +1,6 @@ { "grab_bag": { "type": "item_display", - "item": "shader_bag_epic" + "id": "shader_bag_epic" } } \ No newline at end of file diff --git a/src/main/resources/assets/immersiveengineering/manual/slag_products.json b/src/main/resources/assets/immersiveengineering/manual/slag_products.json index 0ad6e06a97..b6a28009a7 100644 --- a/src/main/resources/assets/immersiveengineering/manual/slag_products.json +++ b/src/main/resources/assets/immersiveengineering/manual/slag_products.json @@ -3,7 +3,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:slag_gravel" + "id": "immersiveengineering:slag_gravel" } ] }, @@ -11,7 +11,7 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:slag_glass" + "id": "immersiveengineering:slag_glass" } ] }, @@ -19,16 +19,16 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:slag_brick" + "id": "immersiveengineering:slag_brick" }, { - "item": "immersiveengineering:stairs_slag_brick" + "id": "immersiveengineering:stairs_slag_brick" }, { - "item": "immersiveengineering:wall_slag_brick" + "id": "immersiveengineering:wall_slag_brick" }, { - "item": "immersiveengineering:slab_slag_brick" + "id": "immersiveengineering:slab_slag_brick" } ] } diff --git a/src/main/resources/assets/immersiveengineering/manual/storage_minecarts.json b/src/main/resources/assets/immersiveengineering/manual/storage_minecarts.json index 1ed8b83f7c..d7e8612112 100644 --- a/src/main/resources/assets/immersiveengineering/manual/storage_minecarts.json +++ b/src/main/resources/assets/immersiveengineering/manual/storage_minecarts.json @@ -3,10 +3,10 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:minecart_woodencrate" + "id": "immersiveengineering:minecart_woodencrate" }, { - "item": "immersiveengineering:minecart_reinforcedcrate" + "id": "immersiveengineering:minecart_reinforcedcrate" } ] }, @@ -14,10 +14,10 @@ "type": "item_display", "items": [ { - "item": "immersiveengineering:minecart_woodenbarrel" + "id": "immersiveengineering:minecart_woodenbarrel" }, { - "item": "immersiveengineering:minecart_metalbarrel" + "id": "immersiveengineering:minecart_metalbarrel" } ] } diff --git a/src/manual/java/blusunrize/lib/manual/ManualInstance.java b/src/manual/java/blusunrize/lib/manual/ManualInstance.java index 00b03b02f8..fc3d7e7342 100644 --- a/src/manual/java/blusunrize/lib/manual/ManualInstance.java +++ b/src/manual/java/blusunrize/lib/manual/ManualInstance.java @@ -125,8 +125,8 @@ public ManualInstance(ResourceLocation texture, int pageWidth, int pageHeight, R registerSpecialElement(name.withPath("item_display"), s -> { NonNullList stacks; - if(s.has("item")) - stacks = NonNullList.withSize(1, ManualUtils.getItemStackFromJson(this, s.get("item"))); + if(s.has("id")) + stacks = NonNullList.withSize(1, ManualUtils.getItemStackFromJson(this, s.get("id"))); else { JsonElement items = s.get("items"); @@ -362,13 +362,20 @@ public void indexRecipes() itemLinks.clear(); getAllEntries().forEach((entry) -> { - List specials = entry.getSpecialData(); - for(SpecialElementData page : specials) + try + { + List specials = entry.getSpecialData(); + for(SpecialElementData page : specials) + { + SpecialManualElement p = page.getElement(); + p.recalculateCraftingRecipes(); + for(ItemStack s : p.getProvidedRecipes()) + itemLinks.put(s.copy(), new ManualLink(entry, page.getAnchor(), page.getOffset())); + } + } catch(Exception x) { - SpecialManualElement p = page.getElement(); - p.recalculateCraftingRecipes(); - for(ItemStack s : p.getProvidedRecipes()) - itemLinks.put(s.copy(), new ManualLink(entry, page.getAnchor(), page.getOffset())); + ManualLogger.LOGGER.error("While calculating recipes for {}", entry.getLocation(), x); + ++numFailedEntries; } }); } @@ -399,7 +406,7 @@ public void reload() manualEntry.initBasic(); } catch(Exception x) { - x.printStackTrace(); + ManualLogger.LOGGER.error("During basic init of entry {}", manualEntry.getLocation(), x); ++numFailedEntries; } }); @@ -410,7 +417,8 @@ public void reload() contentsByName.clear(); contentTree.leafStream().forEach(e -> this.contentsByName.put(e.getLocation(), e)); indexRecipes(); - initialized = true; + if(numFailedEntries==0) + initialized = true; } } @@ -516,7 +524,7 @@ private void loadEntriesInArray(JsonArray entriesOnLevel, List entry.initBasic(); } catch(Exception x) { - x.printStackTrace(); + ManualLogger.LOGGER.error("During basic init of auto entry {}", source, x); ++numFailedEntries; } } diff --git a/src/manual/java/blusunrize/lib/manual/ManualUtils.java b/src/manual/java/blusunrize/lib/manual/ManualUtils.java index b04808a68e..a923ced0be 100644 --- a/src/manual/java/blusunrize/lib/manual/ManualUtils.java +++ b/src/manual/java/blusunrize/lib/manual/ManualUtils.java @@ -31,7 +31,6 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.resources.language.I18n; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; @@ -292,7 +291,7 @@ public static PositionedItemStack parsePosItemStack(JsonElement ele) if(!isNumber(json, "y")) return null; int y = GsonHelper.getAsInt(json, "y"); - if(GsonHelper.isStringValue(json, "item")) + if(GsonHelper.isStringValue(json, "id")) return new PositionedItemStack(readItemStack(json), x, y); else if(GsonHelper.isArrayNode(json, "stacks")) { @@ -332,7 +331,7 @@ public static ManualRecipeRef getRecipeObjFromJson(ManualInstance m, JsonElement JsonObject json = jsonEle.getAsJsonObject(); if(GsonHelper.isStringValue(json, "recipe")) return new ManualRecipeRef(ManualUtils.getLocationForManual(GsonHelper.getAsString(json, "recipe"), m)); - else if(GsonHelper.isStringValue(json, "item")) + else if(GsonHelper.isStringValue(json, "id")) return new ManualRecipeRef(readItemStack(json)); } else if(jsonEle.isJsonArray()) @@ -380,6 +379,6 @@ public static void renderItemStack(GuiGraphics graphics, ItemStack stack, int x, private static ItemStack readItemStack(JsonObject json) { - return ItemStack.CODEC.decode(JsonOps.INSTANCE, json).result().get().getFirst(); + return ItemStack.OPTIONAL_CODEC.decode(JsonOps.INSTANCE, json).result().get().getFirst(); } } diff --git a/src/manual/java/blusunrize/lib/manual/utils/ManualRecipeRef.java b/src/manual/java/blusunrize/lib/manual/utils/ManualRecipeRef.java index 33046f9992..83e823273d 100644 --- a/src/manual/java/blusunrize/lib/manual/utils/ManualRecipeRef.java +++ b/src/manual/java/blusunrize/lib/manual/utils/ManualRecipeRef.java @@ -12,11 +12,9 @@ import blusunrize.lib.manual.PositionedItemStack; import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.*; -import java.util.Map; import java.util.Objects; import java.util.function.Consumer; @@ -81,15 +79,11 @@ public ResourceLocation getRecipeName() void forEachMatchingRecipe(RecipeType type, Consumer out) { RecipeManager recipeManager = Minecraft.getInstance().level.getRecipeManager(); - Map> recipes = PrivateAccess.getRecipes(recipeManager, type); if(isRecipeName()) - { - RecipeHolder recipe = recipes.get(getRecipeName()); - if(recipe!=null) - out.accept(recipe.value()); - } + recipeManager.byKey(getRecipeName()) + .ifPresent(recipeHolder -> out.accept((R)recipeHolder.value())); else - for(RecipeHolder recipe : recipes.values()) + for(RecipeHolder recipe : recipeManager.getAllRecipesFor(type)) if(ManualUtils.stackMatchesObject( recipe.value().getResultItem(Minecraft.getInstance().level.registryAccess()), getResult() )) diff --git a/src/manual/java/blusunrize/lib/manual/utils/PrivateAccess.java b/src/manual/java/blusunrize/lib/manual/utils/PrivateAccess.java deleted file mode 100644 index 147f0d5504..0000000000 --- a/src/manual/java/blusunrize/lib/manual/utils/PrivateAccess.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * BluSunrize - * Copyright (c) 2023 - * - * This code is licensed under "Blu's License of Common Sense" - * Details can be found in the license file in the root folder of this project - */ - -package blusunrize.lib.manual.utils; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.Container; -import net.minecraft.world.item.crafting.*; -import net.neoforged.neoforge.common.util.Lazy; - -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.reflect.Method; -import java.util.Map; - -public class PrivateAccess -{ - private static final Lazy LOOKUP = Lazy.of(MethodHandles::lookup); - private static final Lazy GET_RECIPES_OF_TYPE = Lazy.of(() -> { - try - { - Method reflectionMethod = RecipeManager.class.getDeclaredMethod("byType", RecipeType.class); - reflectionMethod.setAccessible(true); - return LOOKUP.get().unreflect(reflectionMethod); - } catch(IllegalAccessException|NoSuchMethodException e) - { - throw new RuntimeException(e); - } - }); - - @SuppressWarnings("unchecked") - public static > - Map> getRecipes(RecipeManager manager, RecipeType recipeTypeIn) - { - try - { - return (Map>)GET_RECIPES_OF_TYPE.get().invokeExact(manager, recipeTypeIn); - } catch(Throwable throwable) - { - throw new RuntimeException(throwable); - } - } -}