diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index 95ba0e036c6..7011369b3f6 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -924,7 +924,6 @@ "block.gtceu.mv_wiremill": "ɹ§ ןןıɯǝɹıM pǝɔuɐʌpⱯq§", "block.gtceu.mv_world_accelerator": "ɹ§ ɹoʇɐɹǝןǝɔɔⱯ pןɹoM pǝɔuɐʌpⱯq§", "block.gtceu.naquadah_coil_block": "ʞɔoןᗺ ןıoƆ ɥɐpɐnbɐN", - "block.gtceu.natural_gas": "sɐ⅁ ןɐɹnʇɐN", "block.gtceu.network_switch": "ɥɔʇıʍS ʞɹoʍʇǝN", "block.gtceu.nichrome_coil_block": "ʞɔoןᗺ ןıoƆ ǝɯoɹɥɔıN", "block.gtceu.noise_hazard_sign_block": "ʞɔoןᗺ ubıS pɹɐzɐH ǝsıoN", @@ -936,9 +935,6 @@ "block.gtceu.normal_optical_pipe.tooltip": "ㄥ§ɐʇɐᗡ ɥɔɹɐǝsǝᴚɟ§ ɹo ㄥ§uoıʇɐʇndɯoƆɟ§ buıʇʇıɯsuɐɹ⟘ㄥ§", "block.gtceu.object_holder": "ɹǝpןoH ʇɔǝظqO", "block.gtceu.oil": "ןıO", - "block.gtceu.oil_heavy": "ןıO ʎʌɐǝH", - "block.gtceu.oil_light": "ןıO ʇɥbıꞀ", - "block.gtceu.oil_medium": "ןıO ʍɐᴚ", "block.gtceu.opv_1024a_laser_source_hatch": "ɥɔʇɐH ǝɔɹnoS ɹǝsɐꞀ ɹ§Ɐǝ§ㄣᄅ0'Ɩ ɹ§ΛdOן§6§", "block.gtceu.opv_1024a_laser_target_hatch": "ɥɔʇɐH ʇǝbɹɐ⟘ ɹǝsɐꞀ ɹ§Ɐǝ§ㄣᄅ0'Ɩ ɹ§ΛdOן§6§", "block.gtceu.opv_16a_energy_converter": "ɹǝʇɹǝʌuoƆ ʎbɹǝuƎ ɹ§Ɐǝ§9Ɩ ɹ§ΛdOן§6§", @@ -1153,6 +1149,7 @@ "block.gtceu.substation_capacitor.tooltip_empty": "uoıʇɐʇsqnS ɹǝʍoԀ ɹnoʎ uı ǝɔɐds buıןןıɟ ɹoℲㄥ§", "block.gtceu.substation_capacitor.tooltip_filled": "∩Ǝ %dɟ§ :ʎʇıɔɐdɐƆ ʎbɹǝuƎɔ§", "block.gtceu.superconducting_coil": "ʞɔoןᗺ ןıoƆ buıʇɔnpuoɔɹǝdnS", + "block.gtceu.surface_rock": "ʞɔoᴚ ǝɔɐɟɹnS %s", "block.gtceu.tempered_glass": "ssɐן⅁ pǝɹǝdɯǝ⟘", "block.gtceu.test_mui": "ınW ʇsǝ⟘", "block.gtceu.the_end_marker": "puƎ ǝɥ⟘", @@ -1743,7 +1740,6 @@ "block.gtceu.zpm_transformer_4a": "ɹǝɯɹoɟsuɐɹ⟘ )xㄣ( dɯⱯ-ıH ɹ§ǝbɐʇןoΛ WԀZɔ§", "block.gtceu.zpm_wiremill": "ɹ§III ןןıɯǝɹıM ǝʇıןƎɔ§", "block.gtceu.zpm_world_accelerator": "ɹ§III ɹoʇɐɹǝןǝɔɔⱯ pןɹoM ǝʇıןƎɔ§", - "block.gtceu.surface_rock": "ʞɔoᴚ ǝɔɐɟɹnS %s", "button.gtceu.mark_as_depleted.name": "pǝʇǝןdǝᗡ sɐ ʞɹɐW", "button.gtceu.toggle_waypoint.name": "ʇuıodʎɐM ǝןbbo⟘", "command.gtceu.cape.failure.does_not_exist": "ʇsıxǝ ʇou sǝop %s ǝdɐƆ", @@ -1981,6 +1977,7 @@ "config.jade.plugin_gtceu.ldp_endpoint": "oɟuI ʇuıodpuƎ ǝuıןǝdıԀ ǝɔuɐʇsıᗡ buoꞀ ]nƎƆ⟘⅁[", "config.jade.plugin_gtceu.machine_mode": "ǝpoW ǝuıɥɔɐW ]nƎƆ⟘⅁[", "config.jade.plugin_gtceu.maintenance_info": "oɟuI ǝɔuɐuǝʇuıɐW ]nƎƆ⟘⅁[", + "config.jade.plugin_gtceu.me_grid_connected": "oɟuI ǝuıɥɔɐW pǝʇɔǝuuoƆ pıɹ⅁ ]nƎƆ⟘⅁[", "config.jade.plugin_gtceu.me_pattern_buffer": "oɟuI ɹǝɟɟnᗺ uɹǝʇʇɐԀ ]nƎƆ⟘⅁[", "config.jade.plugin_gtceu.me_pattern_buffer_proxy": "oɟuI ʎxoɹԀ ɹǝɟɟnᗺ uɹǝʇʇɐԀ ]nƎƆ⟘⅁[", "config.jade.plugin_gtceu.multiblock_structure": "ǝɹnʇɔnɹʇS ʞɔoןᗺıʇןnW ]nƎƆ⟘⅁[", @@ -2552,7 +2549,7 @@ "gtceu.item_pipe.priority": "%dɟ§ :ʎʇıɹoıɹԀ6§", "gtceu.jade.amperage_use": "Ɐ %s", "gtceu.jade.at": " @ ", - "gtceu.jade.changes_eu_sec": "s/∩Ǝ %s", + "gtceu.jade.changes_eu_tick": "ʇ/∩Ǝ %s", "gtceu.jade.cleaned_this_second": "s/%s :pɹɐzɐɥ pǝuɐǝןƆ", "gtceu.jade.days": "sʎɐp %s", "gtceu.jade.energy_stored": "∩Ǝ %d / %d", @@ -5462,7 +5459,7 @@ "material.gtceu.platinum_group_sludge": "ǝbpnןS dnoɹ⅁ ɯnuıʇɐןԀ", "material.gtceu.platinum_raw": "ʍɐᴚ ɯnuıʇɐןԀ", "material.gtceu.platinum_sludge_residue": "ǝnpısǝᴚ ǝbpnןS ɯnuıʇɐןԀ", - "material.gtceu.plutonium_239": "6Ɛᄅ ɯnıuoʇnןԀ", + "material.gtceu.plutonium": "6Ɛᄅ ɯnıuoʇnןԀ", "material.gtceu.plutonium_241": "Ɩㄣᄅ ɯnıuoʇnןԀ", "material.gtceu.pollucite": "ǝʇıɔnןןoԀ", "material.gtceu.polonium": "ɯnıuoןoԀ", @@ -5648,8 +5645,8 @@ "material.gtceu.tungstic_acid": "pıɔⱯ ɔıʇsbun⟘", "material.gtceu.ultimet": "ʇǝɯıʇן∩", "material.gtceu.uraninite": "ǝʇıuıuɐɹ∩", + "material.gtceu.uranium": "8Ɛᄅ ɯnıuɐɹ∩", "material.gtceu.uranium_235": "ϛƐᄅ ɯnıuɐɹ∩", - "material.gtceu.uranium_238": "8Ɛᄅ ɯnıuɐɹ∩", "material.gtceu.uranium_hexafluoride": "ǝpıɹonןɟɐxǝH ɯnıuɐɹ∩", "material.gtceu.uranium_rhodium_dinaquadide": "ǝpıpɐnbɐuıᗡ ɯnıpoɥᴚ ɯnıuɐɹ∩", "material.gtceu.uranium_triplatinum": "ɯnuıʇɐןdıɹ⟘ ɯnıuɐɹ∩", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index 44b7f4a6f0c..c5593fd4685 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -924,7 +924,6 @@ "block.gtceu.mv_wiremill": "§bAdvanced Wiremill §r", "block.gtceu.mv_world_accelerator": "§bAdvanced World Accelerator §r", "block.gtceu.naquadah_coil_block": "Naquadah Coil Block", - "block.gtceu.natural_gas": "Natural Gas", "block.gtceu.network_switch": "Network Switch", "block.gtceu.nichrome_coil_block": "Nichrome Coil Block", "block.gtceu.noise_hazard_sign_block": "Noise Hazard Sign Block", @@ -936,9 +935,6 @@ "block.gtceu.normal_optical_pipe.tooltip": "§7Transmitting §fComputation§7 or §fResearch Data§7", "block.gtceu.object_holder": "Object Holder", "block.gtceu.oil": "Oil", - "block.gtceu.oil_heavy": "Heavy Oil", - "block.gtceu.oil_light": "Light Oil", - "block.gtceu.oil_medium": "Raw Oil", "block.gtceu.opv_1024a_laser_source_hatch": "§9§lOpV§r 1,024§eA§r Laser Source Hatch", "block.gtceu.opv_1024a_laser_target_hatch": "§9§lOpV§r 1,024§eA§r Laser Target Hatch", "block.gtceu.opv_16a_energy_converter": "§9§lOpV§r 16§eA§r Energy Converter", @@ -1153,6 +1149,7 @@ "block.gtceu.substation_capacitor.tooltip_empty": "§7For filling space in your Power Substation", "block.gtceu.substation_capacitor.tooltip_filled": "§cEnergy Capacity: §f%d EU", "block.gtceu.superconducting_coil": "Superconducting Coil Block", + "block.gtceu.surface_rock": "%s Surface Rock", "block.gtceu.tempered_glass": "Tempered Glass", "block.gtceu.test_mui": "Test Mui", "block.gtceu.the_end_marker": "The End", @@ -1743,7 +1740,6 @@ "block.gtceu.zpm_transformer_4a": "§cZPM Voltage§r Hi-Amp (4x) Transformer", "block.gtceu.zpm_wiremill": "§cElite Wiremill III§r", "block.gtceu.zpm_world_accelerator": "§cElite World Accelerator III§r", - "block.gtceu.surface_rock": "%s Surface Rock", "button.gtceu.mark_as_depleted.name": "Mark as Depleted", "button.gtceu.toggle_waypoint.name": "Toggle Waypoint", "command.gtceu.cape.failure.does_not_exist": "Cape %s does not exist", @@ -1981,6 +1977,7 @@ "config.jade.plugin_gtceu.ldp_endpoint": "[GTCEu] Long Distance Pipeline Endpoint Info", "config.jade.plugin_gtceu.machine_mode": "[GTCEu] Machine Mode", "config.jade.plugin_gtceu.maintenance_info": "[GTCEu] Maintenance Info", + "config.jade.plugin_gtceu.me_grid_connected": "[GTCEu] Grid Connected Machine Info", "config.jade.plugin_gtceu.me_pattern_buffer": "[GTCEu] Pattern Buffer Info", "config.jade.plugin_gtceu.me_pattern_buffer_proxy": "[GTCEu] Pattern Buffer Proxy Info", "config.jade.plugin_gtceu.multiblock_structure": "[GTCEu] MultiBlock Structure", @@ -2552,7 +2549,7 @@ "gtceu.item_pipe.priority": "§9Priority: §f%d", "gtceu.jade.amperage_use": "%s A", "gtceu.jade.at": " @ ", - "gtceu.jade.changes_eu_sec": "%s EU/s", + "gtceu.jade.changes_eu_tick": "%s EU/t", "gtceu.jade.cleaned_this_second": "Cleaned hazard: %s/s", "gtceu.jade.days": "%s days", "gtceu.jade.energy_stored": "%d / %d EU", @@ -5462,7 +5459,7 @@ "material.gtceu.platinum_group_sludge": "Platinum Group Sludge", "material.gtceu.platinum_raw": "Platinum Raw", "material.gtceu.platinum_sludge_residue": "Platinum Sludge Residue", - "material.gtceu.plutonium_239": "Plutonium 239", + "material.gtceu.plutonium": "Plutonium 239", "material.gtceu.plutonium_241": "Plutonium 241", "material.gtceu.pollucite": "Pollucite", "material.gtceu.polonium": "Polonium", @@ -5648,8 +5645,8 @@ "material.gtceu.tungstic_acid": "Tungstic Acid", "material.gtceu.ultimet": "Ultimet", "material.gtceu.uraninite": "Uraninite", + "material.gtceu.uranium": "Uranium 238", "material.gtceu.uranium_235": "Uranium 235", - "material.gtceu.uranium_238": "Uranium 238", "material.gtceu.uranium_hexafluoride": "Uranium Hexafluoride", "material.gtceu.uranium_rhodium_dinaquadide": "Uranium Rhodium Dinaquadide", "material.gtceu.uranium_triplatinum": "Uranium Triplatinum", diff --git a/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/abandoned_mineshaft.json b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/abandoned_mineshaft.json new file mode 100644 index 00000000000..d47bdc59975 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/abandoned_mineshaft.json @@ -0,0 +1,14 @@ +{ + "type": "neoforge:add_table", + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.addLoot" + }, + { + "condition": "neoforge:loot_table_id", + "loot_table_id": "minecraft:chests/abandoned_mineshaft" + } + ], + "table": "gtceu:chests/extra/abandoned_mineshaft" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/desert_pyramid.json b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/desert_pyramid.json new file mode 100644 index 00000000000..d3799bcbd5e --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/desert_pyramid.json @@ -0,0 +1,14 @@ +{ + "type": "neoforge:add_table", + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.addLoot" + }, + { + "condition": "neoforge:loot_table_id", + "loot_table_id": "minecraft:chests/desert_pyramid" + } + ], + "table": "gtceu:chests/extra/desert_pyramid" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/jungle_temple.json b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/jungle_temple.json new file mode 100644 index 00000000000..4c3e508546a --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/jungle_temple.json @@ -0,0 +1,14 @@ +{ + "type": "neoforge:add_table", + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.addLoot" + }, + { + "condition": "neoforge:loot_table_id", + "loot_table_id": "minecraft:chests/jungle_temple" + } + ], + "table": "gtceu:chests/extra/jungle_temple" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/jungle_temple_dispenser.json b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/jungle_temple_dispenser.json new file mode 100644 index 00000000000..41fb88f7882 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/jungle_temple_dispenser.json @@ -0,0 +1,14 @@ +{ + "type": "neoforge:add_table", + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.addLoot" + }, + { + "condition": "neoforge:loot_table_id", + "loot_table_id": "minecraft:chests/jungle_temple_dispenser" + } + ], + "table": "gtceu:chests/extra/jungle_temple_dispenser" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/simple_dungeon.json b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/simple_dungeon.json new file mode 100644 index 00000000000..b44324427f9 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/simple_dungeon.json @@ -0,0 +1,14 @@ +{ + "type": "neoforge:add_table", + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.addLoot" + }, + { + "condition": "neoforge:loot_table_id", + "loot_table_id": "minecraft:chests/simple_dungeon" + } + ], + "table": "gtceu:chests/extra/simple_dungeon" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/spawn_bonus_chest.json b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/spawn_bonus_chest.json new file mode 100644 index 00000000000..45e2dfe89b0 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/spawn_bonus_chest.json @@ -0,0 +1,14 @@ +{ + "type": "neoforge:add_table", + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.addLoot" + }, + { + "condition": "neoforge:loot_table_id", + "loot_table_id": "minecraft:chests/spawn_bonus_chest" + } + ], + "table": "gtceu:chests/extra/spawn_bonus_chest" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/stronghold_corridor.json b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/stronghold_corridor.json new file mode 100644 index 00000000000..7a430759d27 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/stronghold_corridor.json @@ -0,0 +1,14 @@ +{ + "type": "neoforge:add_table", + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.addLoot" + }, + { + "condition": "neoforge:loot_table_id", + "loot_table_id": "minecraft:chests/stronghold_corridor" + } + ], + "table": "gtceu:chests/extra/stronghold_corridor" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/stronghold_crossing.json b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/stronghold_crossing.json new file mode 100644 index 00000000000..81aa3885c0c --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/stronghold_crossing.json @@ -0,0 +1,14 @@ +{ + "type": "neoforge:add_table", + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.addLoot" + }, + { + "condition": "neoforge:loot_table_id", + "loot_table_id": "minecraft:chests/stronghold_crossing" + } + ], + "table": "gtceu:chests/extra/stronghold_crossing" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/village_weaponsmith.json b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/village_weaponsmith.json new file mode 100644 index 00000000000..c56bddda6c5 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_modifiers/chests/extra/village_weaponsmith.json @@ -0,0 +1,14 @@ +{ + "type": "neoforge:add_table", + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.addLoot" + }, + { + "condition": "neoforge:loot_table_id", + "loot_table_id": "minecraft:chests/village/village_weaponsmith" + } + ], + "table": "gtceu:chests/extra/village_weaponsmith" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_table/chests/extra/abandoned_mineshaft.json b/src/generated/resources/data/gtceu/loot_table/chests/extra/abandoned_mineshaft.json new file mode 100644 index 00000000000..925e2f45a6c --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_table/chests/extra/abandoned_mineshaft.json @@ -0,0 +1,476 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:silver_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:lead_ingot", + "weight": 3 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:steel_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:bronze_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:manganese_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:green_sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:olivine_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:red_garnet_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:yellow_garnet_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:ruby_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "minecraft:emerald", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 3.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 2.0, + "min": -1.0 + } + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.increaseDungeonLoot" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:silver_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:lead_ingot", + "weight": 3 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:steel_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:bronze_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:manganese_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:green_sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:olivine_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:red_garnet_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:yellow_garnet_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:ruby_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "minecraft:emerald", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 3.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 2.0, + "min": -1.0 + } + } + ], + "random_sequence": "gtceu:chests/extra/abandoned_mineshaft" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_table/chests/extra/desert_pyramid.json b/src/generated/resources/data/gtceu/loot_table/chests/extra/desert_pyramid.json new file mode 100644 index 00000000000..c57a91ae06c --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_table/chests/extra/desert_pyramid.json @@ -0,0 +1,288 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 16.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:silver_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:platinum_ingot", + "weight": 4 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:ruby_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:green_sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:olivine_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:red_garnet_gem", + "weight": 4 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:yellow_garnet_gem", + "weight": 4 + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": -1.0 + } + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.increaseDungeonLoot" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 16.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:silver_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:platinum_ingot", + "weight": 4 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:ruby_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:green_sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:olivine_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:red_garnet_gem", + "weight": 4 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:yellow_garnet_gem", + "weight": 4 + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": -1.0 + } + } + ], + "random_sequence": "gtceu:chests/extra/desert_pyramid" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_table/chests/extra/jungle_temple.json b/src/generated/resources/data/gtceu/loot_table/chests/extra/jungle_temple.json new file mode 100644 index 00000000000..1b6b228a761 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_table/chests/extra/jungle_temple.json @@ -0,0 +1,278 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "chance": 0.01, + "condition": "minecraft:random_chance" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "charge": 9223372036854775807, + "function": "gtceu:set_eu_charge" + } + ], + "name": "gtceu:zero_point_module" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 16.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:bronze_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:ruby_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:green_sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:olivine_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:red_garnet_gem", + "weight": 4 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:yellow_garnet_gem", + "weight": 4 + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 4.0, + "min": -1.0 + } + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.increaseDungeonLoot" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 16.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:bronze_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:ruby_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:green_sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:olivine_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:red_garnet_gem", + "weight": 4 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:yellow_garnet_gem", + "weight": 4 + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 4.0, + "min": -1.0 + } + } + ], + "random_sequence": "gtceu:chests/extra/jungle_temple" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_table/chests/extra/jungle_temple_dispenser.json b/src/generated/resources/data/gtceu/loot_table/chests/extra/jungle_temple_dispenser.json new file mode 100644 index 00000000000..09ffa29ab15 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_table/chests/extra/jungle_temple_dispenser.json @@ -0,0 +1,31 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "minecraft:fire_charge" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 1.0, + "min": 0.0 + } + } + ], + "random_sequence": "gtceu:chests/extra/jungle_temple_dispenser" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_table/chests/extra/simple_dungeon.json b/src/generated/resources/data/gtceu/loot_table/chests/extra/simple_dungeon.json new file mode 100644 index 00000000000..63e4a8d3cbd --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_table/chests/extra/simple_dungeon.json @@ -0,0 +1,572 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:purple_drink", + "weight": 15 + }, + { + "type": "minecraft:item", + "name": "gtceu:sus_record" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 1.0, + "min": -2.0 + } + }, + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:purple_drink", + "weight": 8 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:silver_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:lead_ingot", + "weight": 3 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:steel_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:bronze_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:manganese_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "minecraft:emerald", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:ruby_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:green_sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:olivine_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:red_garnet_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:yellow_garnet_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:neodymium_dust", + "weight": 4 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:chromium_dust", + "weight": 4 + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 2.0, + "min": -1.0 + } + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.increaseDungeonLoot" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:purple_drink", + "weight": 8 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:silver_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:lead_ingot", + "weight": 3 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:steel_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:bronze_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:manganese_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "minecraft:emerald", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:ruby_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:green_sapphire_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:olivine_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:red_garnet_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:yellow_garnet_gem", + "weight": 2 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:neodymium_dust", + "weight": 4 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 6.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:chromium_dust", + "weight": 4 + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 2.0, + "min": -1.0 + } + } + ], + "random_sequence": "gtceu:chests/extra/simple_dungeon" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_table/chests/extra/spawn_bonus_chest.json b/src/generated/resources/data/gtceu/loot_table/chests/extra/spawn_bonus_chest.json new file mode 100644 index 00000000000..0d7ec3be8d8 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_table/chests/extra/spawn_bonus_chest.json @@ -0,0 +1,62 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 16.0, + "min": 8.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:purple_drink" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 1.0, + "min": 0.0 + } + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.increaseDungeonLoot" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 16.0, + "min": 8.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:purple_drink" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 2.0, + "min": 1.0 + } + } + ], + "random_sequence": "gtceu:chests/extra/spawn_bonus_chest" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_table/chests/extra/stronghold_corridor.json b/src/generated/resources/data/gtceu/loot_table/chests/extra/stronghold_corridor.json new file mode 100644 index 00000000000..cfb939af393 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_table/chests/extra/stronghold_corridor.json @@ -0,0 +1,92 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 3.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 2.0, + "min": -2.0 + } + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.increaseDungeonLoot" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 3.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 2.0, + "min": -2.0 + } + } + ], + "random_sequence": "gtceu:chests/extra/stronghold_corridor" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_table/chests/extra/stronghold_crossing.json b/src/generated/resources/data/gtceu/loot_table/chests/extra/stronghold_crossing.json new file mode 100644 index 00000000000..dbcee56f450 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_table/chests/extra/stronghold_crossing.json @@ -0,0 +1,224 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 16.0, + "min": 8.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:steel_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 16.0, + "min": 8.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:bronze_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:manganese_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:neodymium_dust", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:chromium_dust", + "weight": 6 + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": -1.0 + } + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.increaseDungeonLoot" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 16.0, + "min": 8.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:steel_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 16.0, + "min": 8.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:bronze_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:manganese_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:neodymium_dust", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:chromium_dust", + "weight": 6 + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 3.0, + "min": -1.0 + } + } + ], + "random_sequence": "gtceu:chests/extra/stronghold_crossing" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/loot_table/chests/extra/village_weaponsmith.json b/src/generated/resources/data/gtceu/loot_table/chests/extra/village_weaponsmith.json new file mode 100644 index 00000000000..e847fecb412 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_table/chests/extra/village_weaponsmith.json @@ -0,0 +1,254 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:chromium_dust", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:neodymium_dust", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:manganese_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:steel_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:bronze_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:brass_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 4.0, + "min": -1.0 + } + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "gtceu:config_value", + "config_field": "worldgen.increaseDungeonLoot" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 4.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:chromium_dust", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:neodymium_dust", + "weight": 6 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:manganese_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:steel_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:bronze_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:brass_ingot", + "weight": 12 + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 12.0, + "min": 4.0 + }, + "function": "minecraft:set_count" + } + ], + "name": "gtceu:damascus_steel_ingot" + } + ], + "rolls": { + "type": "minecraft:uniform", + "max": 4.0, + "min": -1.0 + } + } + ], + "random_sequence": "gtceu:chests/extra/village_weaponsmith" +} \ No newline at end of file diff --git a/src/generated/resources/data/neoforge/loot_modifiers/global_loot_modifiers.json b/src/generated/resources/data/neoforge/loot_modifiers/global_loot_modifiers.json new file mode 100644 index 00000000000..b27e8fd19c4 --- /dev/null +++ b/src/generated/resources/data/neoforge/loot_modifiers/global_loot_modifiers.json @@ -0,0 +1,14 @@ +{ + "entries": [ + "gtceu:chests/extra/spawn_bonus_chest", + "gtceu:chests/extra/simple_dungeon", + "gtceu:chests/extra/desert_pyramid", + "gtceu:chests/extra/jungle_temple", + "gtceu:chests/extra/jungle_temple_dispenser", + "gtceu:chests/extra/abandoned_mineshaft", + "gtceu:chests/extra/village_weaponsmith", + "gtceu:chests/extra/stronghold_crossing", + "gtceu:chests/extra/stronghold_corridor" + ], + "replace": false +} \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/ChemicalHelper.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/ChemicalHelper.java index b691d4694de..7aa0534ef4e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/ChemicalHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/ChemicalHelper.java @@ -19,6 +19,7 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; @@ -245,6 +246,16 @@ public static List getItems(MaterialEntry materialEntry) { }).stream().map(Supplier::get).collect(Collectors.toList()); } + public static Item getItem(MaterialEntry materialEntry) { + List items = getItems(materialEntry); + if (items.isEmpty()) return Items.AIR; + return items.get(0).asItem(); + } + + public static Item getItem(TagPrefix tagPrefix, Material material) { + return getItem(new MaterialEntry(tagPrefix, material)); + } + public static ItemStack get(MaterialEntry materialEntry, int size) { var list = getItems(materialEntry); if (list.isEmpty()) return ItemStack.EMPTY; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/Material.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/Material.java index 3b8189aa7df..66bd87a4de2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/Material.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/Material.java @@ -23,7 +23,6 @@ import com.gregtechceu.gtceu.utils.GTMath; import com.gregtechceu.gtceu.utils.TagUtil; -import com.mojang.serialization.Codec; import net.minecraft.core.Holder; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -38,6 +37,7 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; +import com.mojang.serialization.Codec; import dev.latvian.mods.rhino.util.RemapPrefixForJS; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/MaterialEntry.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/MaterialEntry.java index 61b9d6a00de..bd31b707656 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/MaterialEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/MaterialEntry.java @@ -6,8 +6,9 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTMaterials; -import com.google.common.base.Preconditions; import net.minecraft.resources.ResourceLocation; + +import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTLayerPattern.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTLayerPattern.java index 0743486f00d..c7c8903baf0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTLayerPattern.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTLayerPattern.java @@ -2,7 +2,6 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.Block; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java index bb7db463479..cf0da6cb52d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.registry.registrate.entry.PlainEntry; import com.gregtechceu.gtceu.common.registry.GTRegistration; + import net.minecraft.tags.BlockTags; import net.minecraft.world.level.Level; import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/WeightedMaterial.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/WeightedMaterial.java index 36637c06d06..947b6be0d65 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/WeightedMaterial.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/WeightedMaterial.java @@ -1,7 +1,6 @@ package com.gregtechceu.gtceu.api.data.worldgen.bedrockore; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.utils.WeightedEntry; import com.mojang.serialization.Codec; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/SurfaceIndicatorGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/SurfaceIndicatorGenerator.java index dda8a83a5a4..761f3d800ce 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/SurfaceIndicatorGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/SurfaceIndicatorGenerator.java @@ -5,7 +5,6 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.IndicatorGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.GeneratedVeinMetadata; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreIndicatorPlacer; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTMaterialBlocks; import net.minecraft.core.BlockPos; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/ClassicVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/ClassicVeinGenerator.java index 463b5a69e24..b2547ba704e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/ClassicVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/ClassicVeinGenerator.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreVeinUtil; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/DikeVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/DikeVeinGenerator.java index b4532b20666..aa2d46f7ef6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/DikeVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/DikeVeinGenerator.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreVeinUtil; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.utils.GTUtil; import com.gregtechceu.gtceu.utils.WeightedEntry; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/StandardVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/StandardVeinGenerator.java index 24f72e59271..6bc4fb1cd82 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/StandardVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/StandardVeinGenerator.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreVeinUtil; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/VeinedVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/VeinedVeinGenerator.java index 9cc5ddce630..57466de3386 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/VeinedVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/VeinedVeinGenerator.java @@ -7,8 +7,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreVeinUtil; -import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.gregtechceu.gtceu.common.data.GTWorldgen; +import com.gregtechceu.gtceu.common.data.worldgen.GTDensityFunctions; import com.gregtechceu.gtceu.utils.GTUtil; import com.gregtechceu.gtceu.utils.WeightedEntry; @@ -125,17 +124,15 @@ public Map generate(WorldGenLevel level, RandomSource } final Blender finalizedBlender = blender; - DensityFunction veinToggle = mapToNoise(densityFunctions.get(GTWorldgen.NEW_ORE_VEIN_TOGGLE), + DensityFunction veinToggle = mapToNoise(densityFunctions.get(GTDensityFunctions.NEW_ORE_VEIN_TOGGLE), randomState); - DensityFunction veinRidged = mapToNoise(densityFunctions.get(GTWorldgen.NEW_ORE_VEIN_RIDGED), + DensityFunction veinRidged = mapToNoise(densityFunctions.get(GTDensityFunctions.NEW_ORE_VEIN_RIDGED), randomState); int size = entry.clusterSize().sample(random); int radius = Mth.ceil(size / 2f); - int placedCount = 0; - int randOffsetX = random.nextInt(16); int randOffsetY = random.nextInt(16); int randOffsetZ = random.nextInt(16); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/DimensionFilter.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/DimensionFilter.java deleted file mode 100644 index eb1aceab63a..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/DimensionFilter.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.gregtechceu.gtceu.api.data.worldgen.modifier; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.HolderSet; -import net.minecraft.core.RegistryCodecs; -import net.minecraft.core.registries.Registries; -import net.minecraft.util.RandomSource; -import net.minecraft.world.level.dimension.DimensionType; -import net.minecraft.world.level.levelgen.placement.PlacementContext; -import net.minecraft.world.level.levelgen.placement.PlacementFilter; -import net.minecraft.world.level.levelgen.placement.PlacementModifierType; - -import com.mojang.serialization.MapCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; - -public class DimensionFilter extends PlacementFilter { - - public static final PlacementModifierType DIMENSION_FILTER = () -> DimensionFilter.CODEC; - - public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group( - RegistryCodecs.homogeneousList(Registries.DIMENSION_TYPE).fieldOf("dimension_id") - .forGetter(filter -> filter.dimensionId)) - .apply(instance, DimensionFilter::new)); - - public HolderSet dimensionId; - - public DimensionFilter(HolderSet dimensionId) { - this.dimensionId = dimensionId; - } - - @Override - protected boolean shouldPlace(PlacementContext context, RandomSource random, BlockPos pos) { - return this.dimensionId.contains(context.getLevel().getLevel().dimensionTypeRegistration()); - } - - @Override - public PlacementModifierType type() { - return DIMENSION_FILTER; - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/FrequencyModifier.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/FrequencyModifier.java deleted file mode 100644 index 294e5575495..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/FrequencyModifier.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.gregtechceu.gtceu.api.data.worldgen.modifier; - -import net.minecraft.core.BlockPos; -import net.minecraft.util.ExtraCodecs; -import net.minecraft.util.Mth; -import net.minecraft.util.RandomSource; -import net.minecraft.world.level.levelgen.placement.PlacementContext; -import net.minecraft.world.level.levelgen.placement.PlacementModifier; -import net.minecraft.world.level.levelgen.placement.PlacementModifierType; - -import com.mojang.serialization.MapCodec; - -import java.util.stream.Stream; - -public class FrequencyModifier extends PlacementModifier { - - public static final PlacementModifierType FREQUENCY_MODIFIER = () -> FrequencyModifier.CODEC; - - public static final MapCodec CODEC = ExtraCodecs.POSITIVE_FLOAT.fieldOf("chance") - .xmap(FrequencyModifier::new, (modifier) -> modifier.frequency); - - private final float frequency; - - public FrequencyModifier(float frequency) { - this.frequency = frequency; - } - - @Override - public Stream getPositions(PlacementContext context, RandomSource random, BlockPos pos) { - int count = getCount(frequency, random); - if (count == 0) { - return Stream.empty(); - } - return Stream.of(pos); - } - - public int getCount(float frequency, RandomSource random) { - int floored = Mth.floor(frequency); - return floored + (random.nextFloat() < (frequency - floored) ? 1 : 0); - } - - @Override - public PlacementModifierType type() { - return FREQUENCY_MODIFIER; - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/GTPlacementModifiers.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/GTPlacementModifiers.java deleted file mode 100644 index 4c8a9a45343..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/GTPlacementModifiers.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.gregtechceu.gtceu.api.data.worldgen.modifier; - -import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.common.worldgen.modifier.RubberTreeChancePlacement; - -import net.minecraft.core.registries.Registries; -import net.minecraft.world.level.levelgen.placement.PlacementModifier; -import net.minecraft.world.level.levelgen.placement.PlacementModifierType; -import net.neoforged.bus.api.IEventBus; -import net.neoforged.neoforge.registries.DeferredRegister; - -public class GTPlacementModifiers { - - public static final DeferredRegister> PLACEMENT_MODIFIER = DeferredRegister - .create(Registries.PLACEMENT_MODIFIER_TYPE, GTCEu.MOD_ID); - - public static PlacementModifierType register(String name, - PlacementModifierType value) { - PLACEMENT_MODIFIER.register(name, () -> (PlacementModifierType) value); - return value; - } - - public static void init(IEventBus modBus) { - PLACEMENT_MODIFIER.register(modBus); - register("frequency", () -> FrequencyModifier.CODEC); - register("dimension", () -> DimensionFilter.CODEC); - register("biome_placement", () -> BiomePlacement.CODEC); - register("rubber_tree_chance", () -> RubberTreeChancePlacement.CODEC); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/package-info.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/package-info.java deleted file mode 100644 index 67cd414bc98..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -@ParametersAreNonnullByDefault -@MethodsReturnNonnullByDefault -@FieldsAreNonnullByDefault -package com.gregtechceu.gtceu.api.data.worldgen.modifier; - -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidBuilder.java index 347670df3c4..6806d824eaf 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidBuilder.java @@ -295,6 +295,7 @@ public Supplier build(Material material, FluidStorageKey key, G .setData(ProviderType.LANG, NonNullBiConsumer.noop()); if (this.hasFluidBlock) { builder.block() + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) .color(() -> () -> (state, level, pos, index) -> { return IClientFluidTypeExtensions.of(state.getFluidState()) .getTintColor(state.getFluidState(), level, pos); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/prospector/ProspectorMode.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/prospector/ProspectorMode.java index e8aa10e7073..034a3aaee0d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/prospector/ProspectorMode.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/prospector/ProspectorMode.java @@ -336,7 +336,10 @@ public int getItemColor(BedrockOreInfo item) { public IDrawable getItemIcon(BedrockOreInfo item) { Material material = item.material; ItemStack stack = GTUtil.getFirstNonEmpty( - ChemicalHelper.get(GTRegistries.TAG_PREFIXES.get(ResourceLocation.parse(GTCEu.appendIdString(ConfigHolder.INSTANCE.machines.bedrockOreDropTagPrefix))), material), + ChemicalHelper.get( + GTRegistries.TAG_PREFIXES.get(ResourceLocation.parse( + GTCEu.appendIdString(ConfigHolder.INSTANCE.machines.bedrockOreDropTagPrefix))), + material), ChemicalHelper.get(TagPrefix.crushed, material), ChemicalHelper.get(TagPrefix.gem, material), ChemicalHelper.get(TagPrefix.ore, material), diff --git a/src/main/java/com/gregtechceu/gtceu/api/loot/modifier/package-info.java b/src/main/java/com/gregtechceu/gtceu/api/loot/modifier/package-info.java new file mode 100644 index 00000000000..0dffd93bb72 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/loot/modifier/package-info.java @@ -0,0 +1,4 @@ +@NotNullByDefault +package com.gregtechceu.gtceu.api.loot.modifier; + +import org.jetbrains.annotations.NotNullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/api/loot/serializer/package-info.java b/src/main/java/com/gregtechceu/gtceu/api/loot/serializer/package-info.java new file mode 100644 index 00000000000..74aad1850d3 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/loot/serializer/package-info.java @@ -0,0 +1,4 @@ +@NotNullByDefault +package com.gregtechceu.gtceu.api.loot.serializer; + +import org.jetbrains.annotations.NotNullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java index 59a9df12586..0cd928d4ff9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java @@ -51,10 +51,6 @@ public class MachineDefinition implements Supplier, ItemLike { @Getter private final ResourceLocation id; - // This is only stored here for KJS use. - @Getter - @Setter - private @Nullable String langValue; @Setter private Supplier blockSupplier; @Setter diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifier.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifier.java index 7210c7cee33..ecf371717d1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifier.java @@ -51,7 +51,8 @@ public interface RecipeModifier { * @return {@link ModifierFunction#NULL} */ static ModifierFunction nullWrongType(Class type, MetaMachine actual) { - GTCEu.LOGGER.error("Incorrect use of modifier, expected machine of type {}, received {} (id {})", type.getSimpleName(), + GTCEu.LOGGER.error("Incorrect use of modifier, expected machine of type {}, received {} (id {})", + type.getSimpleName(), actual.getClass().getSimpleName(), actual.getDefinition().getId()); return ModifierFunction.NULL; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java index ae5c692cb51..fa8b0a1a760 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java @@ -25,7 +25,6 @@ import net.minecraft.core.MappedRegistry; import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; @@ -110,7 +109,7 @@ private Keys() {} // - once for the actual recipe type registry addRegistryToLoadOrder(Registries.RECIPE_TYPE, null); // - a duplicate entry for the custom KubeJS builder type - addRegistryToLoadOrder(Keys.RECIPE_TYPE, BuiltInRegistries.RECIPE_TYPE); + addRegistryToLoadOrder(Keys.RECIPE_TYPE, null); } public static final Registry DIMENSION_MARKERS = makeRegistry(Keys.DIMENSION_MARKER, false); public static final Registry> RECIPE_CONDITIONS = makeRegistry(Keys.RECIPE_CONDITION); diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTRegistrate.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTRegistrate.java index 71a6a57b091..8bd471a57ac 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTRegistrate.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTRegistrate.java @@ -62,7 +62,6 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; import java.util.Optional; import java.util.concurrent.atomic.AtomicBoolean; @@ -71,6 +70,8 @@ import java.util.function.Function; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.Conditions.hasOreProperty; @ParametersAreNonnullByDefault @@ -208,16 +209,19 @@ public SingleblockMachineBuilder machine(P pare BiFunction blockFactory, BiFunction itemFactory, MachineInstanceFactory blockEntityFactory) { - return entry(name, callback -> new SingleblockMachineBuilder<>(this, parent, name, callback, definitionFactory, blockFactory, itemFactory, blockEntityFactory)); + return entry(name, callback -> new SingleblockMachineBuilder<>(this, parent, name, callback, definitionFactory, + blockFactory, itemFactory, blockEntityFactory)); } - public SingleblockMachineBuilder machine(String name, MachineInstanceFactory blockEntityFactory) { + public SingleblockMachineBuilder machine(String name, + MachineInstanceFactory blockEntityFactory) { return machine(this, name, blockEntityFactory); } public SingleblockMachineBuilder machine(P parent, String name, MachineInstanceFactory blockEntityFactory) { - return entry(name, callback -> new SingleblockMachineBuilder<>(this, parent, name, callback, MachineDefinition::new, MetaMachineBlock::new, MetaMachineItem::new, blockEntityFactory)); + return entry(name, callback -> new SingleblockMachineBuilder<>(this, parent, name, callback, + MachineDefinition::new, MetaMachineBlock::new, MetaMachineItem::new, blockEntityFactory)); } // Multiblock machines @@ -233,7 +237,8 @@ public MultiblockMachineBuilder BiFunction blockFactory, BiFunction itemFactory, MachineInstanceFactory blockEntityFactory) { - return entry(name, callback -> new MultiblockMachineBuilder<>(this, parent, name, callback, blockFactory, itemFactory, blockEntityFactory)); + return entry(name, callback -> new MultiblockMachineBuilder<>(this, parent, name, callback, blockFactory, + itemFactory, blockEntityFactory)); } public MultiblockMachineBuilder multiblock(String name, @@ -243,7 +248,8 @@ public MultiblockMachineBuilder MultiblockMachineBuilder multiblock(P parent, String name, MachineInstanceFactory blockEntityFactory) { - return entry(name, callback -> new MultiblockMachineBuilder<>(this, parent, name, callback, MetaMachineBlock::new, MetaMachineItem::new, blockEntityFactory)); + return entry(name, callback -> new MultiblockMachineBuilder<>(this, parent, name, callback, + MetaMachineBlock::new, MetaMachineItem::new, blockEntityFactory)); } // Recipe types @@ -389,7 +395,8 @@ public PlainEntry plain(P parent, ResourceKey> registryTyp return plain(parent, currentName(), registryType, factory); } - public PlainEntry plain(P parent, String name, ResourceKey> registryType, NonNullSupplier factory) { + public PlainEntry plain(P parent, String name, ResourceKey> registryType, + NonNullSupplier factory) { return entry(name, callback -> new PlainNoConfigBuilder<>(this, parent, name, callback, registryType, factory)) .register(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/MachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/MachineBuilder.java index ec758791d84..052871b0ef3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/MachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/MachineBuilder.java @@ -31,11 +31,6 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.model.builder.MachineModelBuilder; -import com.tterrag.registrate.builders.AbstractBuilder; -import com.tterrag.registrate.builders.BlockEntityBuilder; -import com.tterrag.registrate.util.entry.BlockEntityEntry; -import com.tterrag.registrate.util.entry.BlockEntry; -import com.tterrag.registrate.util.entry.ItemEntry; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.client.renderer.RenderType; @@ -58,10 +53,13 @@ import net.neoforged.neoforge.registries.DeferredHolder; import brachy.modularui.theme.ThemeAPI; -import com.tterrag.registrate.builders.BuilderCallback; -import com.tterrag.registrate.builders.ItemBuilder; +import com.tterrag.registrate.builders.*; import com.tterrag.registrate.providers.DataGenContext; import com.tterrag.registrate.providers.ProviderType; +import com.tterrag.registrate.providers.RegistrateLangProvider; +import com.tterrag.registrate.util.entry.BlockEntityEntry; +import com.tterrag.registrate.util.entry.BlockEntry; +import com.tterrag.registrate.util.entry.ItemEntry; import com.tterrag.registrate.util.nullness.*; import dev.latvian.mods.rhino.util.HideFromJS; import dev.latvian.mods.rhino.util.RemapPrefixForJS; @@ -86,12 +84,13 @@ @MethodsReturnNonnullByDefault @RemapPrefixForJS("kjs$") @Accessors(chain = true, fluent = true) -public class MachineBuilder> extends AbstractBuilder { +public class MachineBuilder> + extends AbstractBuilder { protected final BiFunction blockFactory; protected final BiFunction itemFactory; - protected boolean defaultBlock = true, defaultItem = true, defaultBlockEntity = false; + protected boolean defaultBlock = true, defaultItem = true, defaultBlockEntity = true; @Setter(onMethod_ = @ApiStatus.Internal) protected MachineInstanceFactory instanceFactory; @@ -159,6 +158,8 @@ public MachineBuilder(GTRegistrate owner, P parent, String name, BuilderCallback this.itemFactory = itemFactory; this.instanceFactory = instanceFactory; this.definition = definition; + + this.defaultLang(); } @SuppressWarnings("unchecked") @@ -291,8 +292,23 @@ public S ui(@Nullable PanelFactory ui) { return getThis(); } + public S defaultLang() { + this.langValue = RegistrateLangProvider.toEnglishName(getName()); + return lang(MachineDefinition::getDescriptionId); + } + + public S lang(String name) { + this.langValue = name; + return lang(MachineDefinition::getDescriptionId, name); + } + public S langValue(@Nullable String langValue) { this.langValue = langValue; + if (langValue != null) { + this.lang(MachineDefinition::getDescriptionId, langValue); + } else { + this.setData(ProviderType.LANG, NonNullBiConsumer.noop()); + } return getThis(); } @@ -635,7 +651,6 @@ public D createEntry() { if (model == null && blockModel == null) { simpleModel(getOwner().makeResourceLocation("block/machine/template/" + getName())); } - definition.setLangValue(langValue); final BlockEntry block; if (defaultBlock) { @@ -707,7 +722,7 @@ public D createEntry() { public GTBlockBuilder block() { this.defaultBlock = false; return getOwner().block(getThis(), getName(), p -> BlockBuilderWrapper.makeBlock(getThis(), getEntry(), p)) - .lang(this.langValue) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) // do not gen any lang keys .color(() -> () -> MetaMachineBlock::colorTinted) .initialProperties(() -> Blocks.DISPENSER) .properties(BlockBehaviour.Properties::noLootTable) diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/MultiblockMachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/MultiblockMachineBuilder.java index 336f366ec8d..976ecc7f5f3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/MultiblockMachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/MultiblockMachineBuilder.java @@ -35,7 +35,8 @@ import java.util.function.*; @Accessors(chain = true, fluent = true) -public class MultiblockMachineBuilder extends MachineBuilder> { +public class MultiblockMachineBuilder extends + MachineBuilder> { private boolean generator; private final Map> patterns; @@ -51,7 +52,8 @@ public MultiblockMachineBuilder(GTRegistrate owner, P parent, String name, Build BiFunction blockFactory, BiFunction itemFactory, MachineInstanceFactory instanceFactory) { - super(owner, parent, name, callback, MultiblockMachineDefinition::new, blockFactory, itemFactory, instanceFactory); + super(owner, parent, name, callback, MultiblockMachineDefinition::new, blockFactory, itemFactory, + instanceFactory); this.patterns = new Object2ReferenceOpenHashMap<>(); allowExtendedFacing(true); allowCoverOnFront(true); @@ -69,7 +71,8 @@ public MultiblockMachineBuilder pattern(Function pattern(String structureName, Function pattern) { + public MultiblockMachineBuilder pattern(String structureName, + Function pattern) { this.patterns.put(structureName, pattern); return getThis(); } @@ -117,7 +120,8 @@ public MultiblockMachineDefinition createEntry() { MultiblockMachineDefinition definition = super.createEntry(); definition.setGenerator(generator); if (patterns.isEmpty()) { - throw new IllegalStateException("Missing default structure pattern for " + getOwner().makeResourceLocation(getName())); + throw new IllegalStateException( + "Missing default structure pattern for " + getOwner().makeResourceLocation(getName())); } for (Map.Entry> entry : patterns.entrySet()) { definition.setPattern(entry.getKey(), GTMemoizer.memoize(() -> entry.getValue().apply(definition))); diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/PlainBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/PlainBuilder.java index e30320608ad..e36cf55261c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/PlainBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/PlainBuilder.java @@ -12,7 +12,8 @@ public abstract class PlainBuilder> extends AbstractBuilder { - public PlainBuilder(AbstractRegistrate owner, P parent, String name, BuilderCallback callback, ResourceKey> registryKey) { + public PlainBuilder(AbstractRegistrate owner, P parent, String name, BuilderCallback callback, + ResourceKey> registryKey) { super(owner, parent, name, callback, registryKey); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/SingleblockMachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/SingleblockMachineBuilder.java index 675d4427b76..22e32875e52 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/SingleblockMachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/builder/SingleblockMachineBuilder.java @@ -8,16 +8,18 @@ import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; import com.gregtechceu.gtceu.api.registry.registrate.entry.MachineEntry; -import com.tterrag.registrate.builders.BuilderCallback; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.state.BlockBehaviour; import net.neoforged.neoforge.registries.DeferredHolder; +import com.tterrag.registrate.builders.BuilderCallback; + import java.util.function.BiFunction; import java.util.function.Function; -public class SingleblockMachineBuilder extends MachineBuilder> { +public class SingleblockMachineBuilder + extends MachineBuilder> { public SingleblockMachineBuilder(GTRegistrate owner, P parent, String name, BuilderCallback callback, Function definition, diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/entry/MachineEntry.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/entry/MachineEntry.java index a9aa3cc00e6..dde3173a06e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/entry/MachineEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/entry/MachineEntry.java @@ -66,7 +66,8 @@ public Singleblock(AbstractRegistrate owner, DeferredHolder { - public Multiblock(AbstractRegistrate owner, DeferredHolder key) { + public Multiblock(AbstractRegistrate owner, + DeferredHolder key) { super(owner, key); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java index 793dfb933b3..975014628ce 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java @@ -38,7 +38,6 @@ import com.gregtechceu.gtceu.common.item.LampBlockItem; import com.gregtechceu.gtceu.common.item.QuantumTankMachineItem; import com.gregtechceu.gtceu.common.mui.GTGuiTextures; -import com.gregtechceu.gtceu.common.mui.GTGuiTheme; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.model.builder.PipeModelBuilder; import com.gregtechceu.gtceu.data.pack.event.RegisterDynamicResourcesEvent; @@ -61,7 +60,6 @@ import net.neoforged.bus.api.EventPriority; import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.ModLoadingContext; import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; import net.neoforged.neoforge.client.event.*; import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions; @@ -87,7 +85,6 @@ public static void init(IEventBus modBus) { NeoForge.EVENT_BUS.register(GTParticleManager.INSTANCE); GTGuiTextures.init(); - ModLoadingContext.get().getActiveContainer().getEventBus().addListener(GTGuiTheme::onReloadThemes); } @SubscribeEvent diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java index 3b8df7f0b02..ae4f2ef7cee 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java @@ -107,7 +107,8 @@ protected static void copyOreModelWithBaseStone(TagPrefix tagPrefix, TagPrefix.O GTDynamicResourcePack.addBlockModel( iconSet.id - .withPath(ORE_MODEL_NAME_FORMAT.formatted(iconSet.getName(), tagPrefix.getName(), iconType.name())), + .withPath(ORE_MODEL_NAME_FORMAT.formatted(iconSet.getName(), tagPrefix.getName(), + iconType.name())), newJson); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java b/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java index 6f95972cf65..55835a9e7ad 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java @@ -17,7 +17,6 @@ import com.gregtechceu.gtceu.api.data.worldgen.bedrockore.BedrockOreDefinition; import com.gregtechceu.gtceu.api.data.worldgen.generator.IndicatorGenerators; import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerators; -import com.gregtechceu.gtceu.api.data.worldgen.modifier.GTPlacementModifiers; import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.item.MetaMachineItem; @@ -45,7 +44,11 @@ import com.gregtechceu.gtceu.common.data.*; import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.item.*; +import com.gregtechceu.gtceu.common.data.loot.GTLootConditions; +import com.gregtechceu.gtceu.common.data.loot.GTLootFunctions; import com.gregtechceu.gtceu.common.data.materials.GTFoods; +import com.gregtechceu.gtceu.common.data.worldgen.GTFeatures; +import com.gregtechceu.gtceu.common.data.worldgen.GTPlacementModifiers; import com.gregtechceu.gtceu.common.fluid.potion.BottleItemFluidHandler; import com.gregtechceu.gtceu.common.fluid.potion.PotionItemFluidHandler; import com.gregtechceu.gtceu.common.item.DrumMachineItem; @@ -60,7 +63,6 @@ import com.gregtechceu.gtceu.core.mixins.registrate.AbstractRegistrateAccessor; import com.gregtechceu.gtceu.data.GregTechDatagen; import com.gregtechceu.gtceu.data.lang.MaterialLangGenerator; -import com.gregtechceu.gtceu.data.loot.ChestGenHooks; import com.gregtechceu.gtceu.data.pack.GTDynamicDataPack; import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack; import com.gregtechceu.gtceu.data.pack.GTPackSource; @@ -151,6 +153,8 @@ public static void init(final IEventBus modBus) { GTFeatures.init(modBus); GTPlacementModifiers.init(modBus); GTValueProviderTypes.init(modBus); + GTLootConditions.init(modBus); + GTLootFunctions.init(modBus); GTPatternErrors.init(modBus); @@ -202,7 +206,6 @@ public static void init(final IEventBus modBus) { CustomBlockRotations.init(); SyncedKeyMappings.init(); MachineOwner.init(); - ChestGenHooks.init(modBus); // MUI stuff GuiManager.registerFactory(MachineUIFactory.INSTANCE); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GCYMRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GCYMRecipeTypes.java index decf829da6b..7ac6af5c9ef 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GCYMRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GCYMRecipeTypes.java @@ -13,7 +13,8 @@ public class GCYMRecipeTypes { ////////////////////////////////////// // ******* Multiblock *******// ////////////////////////////////////// - public final static GTRecipeType ALLOY_BLAST_RECIPES = GTRegistration.REGISTRATE.recipeType("alloy_blast_smelter", MULTIBLOCK) + public final static GTRecipeType ALLOY_BLAST_RECIPES = GTRegistration.REGISTRATE + .recipeType("alloy_blast_smelter", MULTIBLOCK) .setMaxIOSize(9, 0, 3, 1) .setEUIO(IO.IN) .UI(builder -> builder diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java index 43afdf52eae..80c4abdd903 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java @@ -20,6 +20,7 @@ import com.gregtechceu.gtceu.common.block.explosive.PowderbarrelBlock; import com.gregtechceu.gtceu.common.data.blocks.GTDevBlocks; import com.gregtechceu.gtceu.common.data.models.GTModels; +import com.gregtechceu.gtceu.common.data.worldgen.GTConfiguredFeatures; import com.gregtechceu.gtceu.common.item.LampBlockItem; import com.gregtechceu.gtceu.common.item.LaserPipeBlockItem; import com.gregtechceu.gtceu.common.pipelike.duct.DuctPipeType; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java index 3d6fd4e1697..26cedcd44f9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java @@ -1,7 +1,6 @@ package com.gregtechceu.gtceu.common.data; import com.gregtechceu.gtceu.api.data.chemical.Element; -import com.tterrag.registrate.util.entry.RegistryEntry; import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTFeatures.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTFeatures.java deleted file mode 100644 index 6ad8db2b4a1..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTFeatures.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.gregtechceu.gtceu.common.data; - -import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.data.worldgen.modifier.BiomePlacement; -import com.gregtechceu.gtceu.api.data.worldgen.modifier.DimensionFilter; -import com.gregtechceu.gtceu.api.data.worldgen.modifier.FrequencyModifier; -import com.gregtechceu.gtceu.common.worldgen.feature.FluidSproutFeature; -import com.gregtechceu.gtceu.common.worldgen.feature.StoneBlobFeature; -import com.gregtechceu.gtceu.common.worldgen.modifier.RubberTreeChancePlacement; - -import net.minecraft.core.registries.Registries; -import net.minecraft.world.level.levelgen.feature.Feature; -import net.neoforged.bus.api.IEventBus; -import net.neoforged.neoforge.registries.DeferredHolder; -import net.neoforged.neoforge.registries.DeferredRegister; - -public class GTFeatures { - - private static final DeferredRegister> FEATURES = DeferredRegister.create(Registries.FEATURE, - GTCEu.MOD_ID); - - public static final DeferredHolder, StoneBlobFeature> STONE_BLOB = FEATURES.register( - "stone_blob", - StoneBlobFeature::new); - public static final DeferredHolder, FluidSproutFeature> FLUID_SPROUT = FEATURES.register( - "fluid_sprout", - FluidSproutFeature::new); - - private static void init() { - Object inst = FrequencyModifier.FREQUENCY_MODIFIER; // seemingly useless access to init the class in time - inst = DimensionFilter.DIMENSION_FILTER; - inst = BiomePlacement.BIOME_PLACEMENT; - inst = RubberTreeChancePlacement.RUBBER_TREE_CHANCE_PLACEMENT; - } - - public static void init(IEventBus modEventBus) { - init(); - FEATURES.register(modEventBus); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java index bc8d167de88..d0494ada327 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java @@ -126,7 +126,8 @@ public class GTMachines { REGISTRATE, "extractor", GTRecipeTypes.EXTRACTOR_RECIPES); - public static final Pair STEAM_MACERATOR = registerSteamMachines(REGISTRATE, + public static final Pair STEAM_MACERATOR = registerSteamMachines( + REGISTRATE, "steam_macerator", SimpleSteamMachine::new, (pressure, builder) -> builder .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.MACERATOR_RECIPES) @@ -153,7 +154,8 @@ public class GTMachines { public static final Pair STEAM_ROCK_CRUSHER = registerSimpleSteamMachines( REGISTRATE, "rock_crusher", GTRecipeTypes.ROCK_BREAKER_RECIPES); - public static final Pair STEAM_MINER = registerSteamMachines(REGISTRATE, + public static final Pair STEAM_MINER = registerSteamMachines( + REGISTRATE, "steam_miner", (holder, isHP) -> isHP ? new SteamMinerMachine(holder, true, 240, 6, 0, 32) : new SteamMinerMachine(holder, false, 320, 4, 0, 16), @@ -178,7 +180,8 @@ public class GTMachines { ////////////////////////////////////// // *** SimpleTieredMachine ***// ////////////////////////////////////// - public static final MachineEntry.Singleblock[] HULL = GTMachineUtils.registerTieredMachines(REGISTRATE, "machine_hull", + public static final MachineEntry.Singleblock[] HULL = GTMachineUtils.registerTieredMachines(REGISTRATE, + "machine_hull", HullMachine::new, (tier, builder) -> builder .rotationState(RotationState.ALL) @@ -190,7 +193,8 @@ public class GTMachines { .register(), ALL_TIERS); - public static final MachineEntry.Singleblock[] ELECTRIC_FURNACE = new SimpleMachineBuilder(REGISTRATE, "electric_furnace", + public static final MachineEntry.Singleblock[] ELECTRIC_FURNACE = new SimpleMachineBuilder(REGISTRATE, + "electric_furnace", GTRecipeTypes.FURNACE_RECIPES).register(); public static final MachineEntry.Singleblock[] ALLOY_SMELTER = new SimpleMachineBuilder(REGISTRATE, "alloy_smelter", GTRecipeTypes.ALLOY_SMELTER_RECIPES).register(); @@ -230,7 +234,8 @@ public class GTMachines { GTRecipeTypes.CENTRIFUGE_RECIPES).tankScalingFunction(largeTankSizeFunction).register(); public static final MachineEntry.Singleblock[] CHEMICAL_BATH = new SimpleMachineBuilder(REGISTRATE, "chemical_bath", GTRecipeTypes.CHEMICAL_BATH_RECIPES).tankScalingFunction(hvCappedTankSizeFunction).register(); - public static final MachineEntry.Singleblock[] CHEMICAL_REACTOR = new SimpleMachineBuilder(REGISTRATE, "chemical_reactor", + public static final MachineEntry.Singleblock[] CHEMICAL_REACTOR = new SimpleMachineBuilder(REGISTRATE, + "chemical_reactor", GTRecipeTypes.CHEMICAL_RECIPES) .tankScalingFunction(tier -> 16 * FluidType.BUCKET_VOLUME) .hasPollutionDebuff(true) @@ -262,7 +267,8 @@ public class GTMachines { GTRecipeTypes.FLUID_HEATER_RECIPES) .tankScalingFunction(hvCappedTankSizeFunction) .register(); - public static final MachineEntry.Singleblock[] FLUID_SOLIDIFIER = new SimpleMachineBuilder(REGISTRATE, "fluid_solidifier", + public static final MachineEntry.Singleblock[] FLUID_SOLIDIFIER = new SimpleMachineBuilder(REGISTRATE, + "fluid_solidifier", GTRecipeTypes.FLUID_SOLIDFICATION_RECIPES) .tankScalingFunction(hvCappedTankSizeFunction) .register(); @@ -287,7 +293,8 @@ public class GTMachines { .register(); public static final MachineEntry.Singleblock[] POLARIZER = new SimpleMachineBuilder(REGISTRATE, "polarizer", GTRecipeTypes.POLARIZER_RECIPES).register(); - public static final MachineEntry.Singleblock[] LASER_ENGRAVER = new SimpleMachineBuilder(REGISTRATE, "laser_engraver", + public static final MachineEntry.Singleblock[] LASER_ENGRAVER = new SimpleMachineBuilder(REGISTRATE, + "laser_engraver", GTRecipeTypes.LASER_ENGRAVER_RECIPES) .tankScalingFunction(defaultTankSizeFunction) .hasPollutionDebuff(true) @@ -377,7 +384,8 @@ public class GTMachines { "Hi-Amp (2x)", 2); public static final MachineEntry.Singleblock[] HI_AMP_TRANSFORMER_4A = registerTransformerMachines(REGISTRATE, "Hi-Amp (4x)", 4); - public static final MachineEntry.Singleblock[] POWER_TRANSFORMER = registerTransformerMachines(REGISTRATE, "Power", 16); + public static final MachineEntry.Singleblock[] POWER_TRANSFORMER = registerTransformerMachines(REGISTRATE, "Power", + 16); public static final MachineEntry.Singleblock[] ENERGY_CONVERTER_1A = registerConverter(REGISTRATE, 1); public static final MachineEntry.Singleblock[] ENERGY_CONVERTER_4A = registerConverter(REGISTRATE, 4); @@ -445,7 +453,8 @@ public class GTMachines { .register(), LV, MV, HV, EV); - public static final MachineEntry.Singleblock[] FISHER = registerTieredMachines(REGISTRATE, "fisher", FisherMachine::new, + public static final MachineEntry.Singleblock[] FISHER = registerTieredMachines(REGISTRATE, "fisher", + FisherMachine::new, (tier, builder) -> builder .rotationState(RotationState.ALL) // .editableUI(FisherMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("fisher"), (tier + 1) * (tier + 1))) @@ -508,7 +517,8 @@ public class GTMachines { .register(), LV, MV, HV); - public static final MachineEntry.Singleblock[] WORLD_ACCELERATOR = registerTieredMachines(REGISTRATE, "world_accelerator", + public static final MachineEntry.Singleblock[] WORLD_ACCELERATOR = registerTieredMachines(REGISTRATE, + "world_accelerator", WorldAcceleratorMachine::new, (tier, builder) -> builder .rotationState(RotationState.NONE) @@ -645,24 +655,32 @@ public class GTMachines { .hasBER(true) .register(); - public static final MachineEntry.Singleblock[] SUPER_CHEST = registerQuantumChests(REGISTRATE, "super_chest", LOW_TIERS); + public static final MachineEntry.Singleblock[] SUPER_CHEST = registerQuantumChests(REGISTRATE, "super_chest", + LOW_TIERS); public static final MachineEntry.Singleblock[] QUANTUM_CHEST = registerQuantumChests(REGISTRATE, "quantum_chest", HIGH_TIERS); - public static final MachineEntry.Singleblock[] SUPER_TANK = registerQuantumTanks(REGISTRATE, "super_tank", LOW_TIERS); - public static final MachineEntry.Singleblock[] QUANTUM_TANK = registerQuantumTanks(REGISTRATE, "quantum_tank", HIGH_TIERS); + public static final MachineEntry.Singleblock[] SUPER_TANK = registerQuantumTanks(REGISTRATE, "super_tank", + LOW_TIERS); + public static final MachineEntry.Singleblock[] QUANTUM_TANK = registerQuantumTanks(REGISTRATE, "quantum_tank", + HIGH_TIERS); - public static MachineEntry.Singleblock WOODEN_CRATE = registerCrate(REGISTRATE, GTMaterials.Wood, 27, 9, "Wooden Crate"); - public static MachineEntry.Singleblock BRONZE_CRATE = registerCrate(REGISTRATE, GTMaterials.Bronze, 54, 9, "Bronze Crate"); - public static MachineEntry.Singleblock STEEL_CRATE = registerCrate(REGISTRATE, GTMaterials.Steel, 72, 9, "Steel Crate"); + public static MachineEntry.Singleblock WOODEN_CRATE = registerCrate(REGISTRATE, GTMaterials.Wood, 27, 9, + "Wooden Crate"); + public static MachineEntry.Singleblock BRONZE_CRATE = registerCrate(REGISTRATE, GTMaterials.Bronze, 54, 9, + "Bronze Crate"); + public static MachineEntry.Singleblock STEEL_CRATE = registerCrate(REGISTRATE, GTMaterials.Steel, 72, 9, + "Steel Crate"); public static MachineEntry.Singleblock ALUMINIUM_CRATE = registerCrate(REGISTRATE, GTMaterials.Aluminium, 90, 10, "Aluminium Crate"); - public static MachineEntry.Singleblock STAINLESS_STEEL_CRATE = registerCrate(REGISTRATE, GTMaterials.StainlessSteel, 108, + public static MachineEntry.Singleblock STAINLESS_STEEL_CRATE = registerCrate(REGISTRATE, GTMaterials.StainlessSteel, + 108, 12, "Stainless Steel Crate"); public static MachineEntry.Singleblock TITANIUM_CRATE = registerCrate(REGISTRATE, GTMaterials.Titanium, 126, 14, "Titanium Crate"); - public static MachineEntry.Singleblock TUNGSTENSTEEL_CRATE = registerCrate(REGISTRATE, GTMaterials.TungstenSteel, 144, 16, + public static MachineEntry.Singleblock TUNGSTENSTEEL_CRATE = registerCrate(REGISTRATE, GTMaterials.TungstenSteel, + 144, 16, "Tungstensteel Crate"); public static MachineEntry.Singleblock WOODEN_DRUM = registerDrum(REGISTRATE, GTMaterials.Wood, @@ -964,7 +982,8 @@ public class GTMachines { .allowCoverOnFront(true) .register(); - public static final MachineEntry.Singleblock COKE_OVEN_HATCH = REGISTRATE.machine("coke_oven_hatch", CokeOvenHatch::new) + public static final MachineEntry.Singleblock COKE_OVEN_HATCH = REGISTRATE + .machine("coke_oven_hatch", CokeOvenHatch::new) .rotationState(RotationState.ALL) .modelProperty(IS_FORMED, false) .tooltips(Component.translatable("gtceu.part_sharing.disabled")) @@ -972,7 +991,8 @@ public class GTMachines { .themeId(GTGuiTheme.PRIMITIVE.getId()) .register(); - public static final MachineEntry.Singleblock PUMP_HATCH = REGISTRATE.machine("pump_hatch", PumpHatchPartMachine::new) + public static final MachineEntry.Singleblock PUMP_HATCH = REGISTRATE + .machine("pump_hatch", PumpHatchPartMachine::new) .rotationState(RotationState.ALL) .abilities(PartAbility.PUMP_FLUID_HATCH) .modelProperty(IS_FORMED, false) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTValueProviderTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTValueProviderTypes.java index 61562c5b5fe..8ec0c78f068 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTValueProviderTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTValueProviderTypes.java @@ -15,29 +15,18 @@ public class GTValueProviderTypes { - private static final DeferredRegister> INT_PROVIDER_TYPE_REGISTER = DeferredRegister.create( - Registries.INT_PROVIDER_TYPE, - GTCEu.MOD_ID); - private static final DeferredRegister> FLOAT_PROVIDER_TYPE_REGISTER = DeferredRegister.create( - Registries.FLOAT_PROVIDER_TYPE, - GTCEu.MOD_ID); - - public static final DeferredHolder, IntProviderType> FLOORED = INT_PROVIDER_TYPE_REGISTER - .register( - "floored", - () -> () -> FlooredInt.CODEC); - - public static final DeferredHolder, FloatProviderType> MULTIPLIED = FLOAT_PROVIDER_TYPE_REGISTER - .register("multiplied", - () -> () -> MultipliedFloat.CODEC); - public static final DeferredHolder, FloatProviderType> ADDED = FLOAT_PROVIDER_TYPE_REGISTER - .register( - "added", - () -> () -> AddedFloat.CODEC); - public static final DeferredHolder, FloatProviderType> CASTED = FLOAT_PROVIDER_TYPE_REGISTER - .register( - "casted", - () -> () -> CastedFloat.CODEC); + // spotless:off + public static final DeferredRegister> INT_PROVIDER_TYPE_REGISTER = DeferredRegister.create(Registries.INT_PROVIDER_TYPE, GTCEu.MOD_ID); + public static final DeferredRegister> FLOAT_PROVIDER_TYPE_REGISTER = DeferredRegister.create(Registries.FLOAT_PROVIDER_TYPE, GTCEu.MOD_ID); + + + public static final DeferredHolder, IntProviderType> FLOORED = INT_PROVIDER_TYPE_REGISTER.register("floored", () -> () -> FlooredInt.CODEC); + + public static final DeferredHolder, FloatProviderType> MULTIPLIED = FLOAT_PROVIDER_TYPE_REGISTER.register("multiplied", () -> () -> MultipliedFloat.CODEC); + public static final DeferredHolder, FloatProviderType> ADDED = FLOAT_PROVIDER_TYPE_REGISTER.register("added", () -> () -> AddedFloat.CODEC); + public static final DeferredHolder, FloatProviderType> CASTED = FLOAT_PROVIDER_TYPE_REGISTER.register("casted", () -> () -> CastedFloat.CODEC); + + // spotless:on public static void init(IEventBus bus) { INT_PROVIDER_TYPE_REGISTER.register(bus); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/loot/GTLootConditions.java b/src/main/java/com/gregtechceu/gtceu/common/data/loot/GTLootConditions.java new file mode 100644 index 00000000000..f3faa73012a --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/data/loot/GTLootConditions.java @@ -0,0 +1,25 @@ +package com.gregtechceu.gtceu.common.data.loot; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.common.loot.condition.GTConfigValueCondition; + +import net.minecraft.core.registries.Registries; +import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; + +public class GTLootConditions { + // spotless:off + + public static final DeferredRegister LOOT_CONDITION_TYPES = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE, GTCEu.MOD_ID); + + + public static final DeferredHolder CONFIG_VALUE = LOOT_CONDITION_TYPES.register("config_value", () -> new LootItemConditionType(GTConfigValueCondition.CODEC)); + + // spotless:on + + public static void init(IEventBus modBus) { + LOOT_CONDITION_TYPES.register(modBus); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/loot/GTLootFunctions.java b/src/main/java/com/gregtechceu/gtceu/common/data/loot/GTLootFunctions.java new file mode 100644 index 00000000000..c0e19d244ff --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/data/loot/GTLootFunctions.java @@ -0,0 +1,25 @@ +package com.gregtechceu.gtceu.common.data.loot; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.common.loot.function.SetEUChargeFunction; + +import net.minecraft.core.registries.Registries; +import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; + +public class GTLootFunctions { + // spotless:off + + public static final DeferredRegister> LOOT_FUNCTION_TYPES = DeferredRegister.create(Registries.LOOT_FUNCTION_TYPE, GTCEu.MOD_ID); + + + public static final DeferredHolder, LootItemFunctionType> SET_EU_CHARGE = LOOT_FUNCTION_TYPES.register("set_eu_charge", () -> new LootItemFunctionType<>(SetEUChargeFunction.CODEC)); + + // spotless:on + + public static void init(IEventBus modBus) { + LOOT_FUNCTION_TYPES.register(modBus); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java index e4f0c23511e..f7b126cf1ae 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMachineUtils.java @@ -122,11 +122,11 @@ public class GTMachineUtils { public static Object2IntMap DRUM_CAPACITY = new Object2IntArrayMap<>(); - public static final PartAbility[] DUAL_INPUT_HATCH_ABILITIES = new PartAbility[]{ + public static final PartAbility[] DUAL_INPUT_HATCH_ABILITIES = new PartAbility[] { PartAbility.IMPORT_ITEMS, PartAbility.IMPORT_FLUIDS, }; - public static final PartAbility[] DUAL_OUTPUT_HATCH_ABILITIES = new PartAbility[]{ + public static final PartAbility[] DUAL_OUTPUT_HATCH_ABILITIES = new PartAbility[] { PartAbility.EXPORT_ITEMS, PartAbility.EXPORT_FLUIDS, }; @@ -678,7 +678,7 @@ public static MachineEntry.Multiblock registerLargeCombustionEngine(GTRegistrate .where('Y', controller(definition)) .build()) .recoveryItems( - () -> new ItemLike[]{ + () -> new ItemLike[] { GTMaterialItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get() }) .workableCasingModel(casingTexture, overlayModel) .tooltips( @@ -730,7 +730,7 @@ public static MachineEntry.Multiblock registerLargeTurbine(GTRegistrate registra .or(autoAbilities(true, needsMuffler, false))) .build()) .recoveryItems( - () -> new ItemLike[]{ + () -> new ItemLike[] { GTMaterialItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get() }) .workableCasingModel(casingTexture, overlayModel) .tooltips( @@ -853,8 +853,8 @@ public MachineEntry.Singleblock[] register() { (holder, tier) -> new SimpleTieredMachine(holder, tier, tankScalingFunction), (tier, builder) -> { if (hasPollutionDebuff) { builder.recipeModifiers(GTRecipeModifiers.ENVIRONMENT_REQUIREMENT - .apply(GTMedicalConditions.CARBON_MONOXIDE_POISONING, 100 * tier), - GTRecipeModifiers.OC_NON_PERFECT) + .apply(GTMedicalConditions.CARBON_MONOXIDE_POISONING, 100 * tier), + GTRecipeModifiers.OC_NON_PERFECT) .conditionalTooltip(defaultEnvironmentRequirement(), ConfigHolder.INSTANCE.gameplay.environmentalHazards); } else { diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java index ba44583e721..81334ef958f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTMultiMachines.java @@ -6,8 +6,6 @@ import com.gregtechceu.gtceu.api.data.RotationState; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.fluids.PropertyFluidFilter; -import com.gregtechceu.gtceu.api.machine.MachineDefinition; -import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.machine.multiblock.CoilWorkableElectricMultiblockMachine; import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility; import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTResearchMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTResearchMachines.java index 0272ec79769..63cd4ac7b88 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTResearchMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTResearchMachines.java @@ -80,7 +80,8 @@ public class GTResearchMachines { GTCEu.id("block/multiblock/research_station")) .register(); - public static final MachineEntry.Singleblock OBJECT_HOLDER = REGISTRATE.machine("object_holder", ObjectHolderMachine::new) + public static final MachineEntry.Singleblock OBJECT_HOLDER = REGISTRATE + .machine("object_holder", ObjectHolderMachine::new) .langValue("Object Holder") .tier(ZPM) .rotationState(RotationState.ALL) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java index 2a90fb6bbc6..01d84f0cee7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.common.data.materials; -import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.properties.ArmorProperty; import com.gregtechceu.gtceu.api.data.chemical.material.properties.BlastProperty.GasTier; import com.gregtechceu.gtceu.api.data.chemical.material.properties.HazardProperty; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/FirstDegreeMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/FirstDegreeMaterials.java index 70d8115aa7c..85e7783056f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/FirstDegreeMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/FirstDegreeMaterials.java @@ -1409,7 +1409,7 @@ public static void register() { .setFormula("URhNq2", true); EnrichedNaquadahTriniumEuropiumDuranide = REGISTRATE.material( - "enriched_naquadah_trinium_europium_duranide") + "enriched_naquadah_trinium_europium_duranide") .ingot() .liquid(new FluidBuilder().temperature(5930)) .color(0xc6b083).secondaryColor(0x45063d).iconSet(METALLIC) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java index 954fd474732..cff046061a7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java @@ -196,7 +196,7 @@ public static void register() { .components(SiliconDioxide, 4, Biotite, 1) .buildAndRegister(); - RedGranite = REGISTRATE.material("granite_red") + RedGranite = REGISTRATE.material("red_granite") .dust() .color(0xFF0080).iconSet(ROUGH) .flags(NO_SMASHING) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBiomeModifiers.java b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTBiomeModifiers.java similarity index 91% rename from src/main/java/com/gregtechceu/gtceu/common/data/GTBiomeModifiers.java rename to src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTBiomeModifiers.java index d7850838f9f..5ec7fe2b9ac 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBiomeModifiers.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTBiomeModifiers.java @@ -1,4 +1,4 @@ -package com.gregtechceu.gtceu.common.data; +package com.gregtechceu.gtceu.common.data.worldgen; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.data.recipe.CustomTags; @@ -35,22 +35,22 @@ public static void bootstrap(BootstrapContext ctx) { ctx.register(RUBBER_TREE, new BiomeModifiers.AddFeaturesBiomeModifier( biomeLookup.getOrThrow(CustomTags.HAS_RUBBER_TREE), - HolderSet.direct(placedFeatureRegistry.getOrThrow(GTPlacements.RUBBER_TREE)), + HolderSet.direct(placedFeatureRegistry.getOrThrow(GTPlacedFeatures.RUBBER_TREE)), GenerationStep.Decoration.VEGETAL_DECORATION)); ctx.register(RUBBER_TREE_SWAMP, new BiomeModifiers.AddFeaturesBiomeModifier( biomeLookup.getOrThrow(Tags.Biomes.IS_SWAMP), - HolderSet.direct(placedFeatureRegistry.getOrThrow(GTPlacements.RUBBER_TREE_SWAMP)), + HolderSet.direct(placedFeatureRegistry.getOrThrow(GTPlacedFeatures.RUBBER_TREE_SWAMP)), GenerationStep.Decoration.VEGETAL_DECORATION)); HolderSet overworld = biomeLookup.getOrThrow(BiomeTags.IS_OVERWORLD); - Holder redGraniteBlob = placedFeatureRegistry.getOrThrow(GTPlacements.RED_GRANITE_BLOB); - Holder marbleBlob = placedFeatureRegistry.getOrThrow(GTPlacements.MARBLE_BLOB); + Holder redGraniteBlob = placedFeatureRegistry.getOrThrow(GTPlacedFeatures.RED_GRANITE_BLOB); + Holder marbleBlob = placedFeatureRegistry.getOrThrow(GTPlacedFeatures.MARBLE_BLOB); ctx.register(STONE_BLOB, new BiomeModifiers.AddFeaturesBiomeModifier( overworld, HolderSet.direct(redGraniteBlob, marbleBlob), GenerationStep.Decoration.UNDERGROUND_ORES)); - Holder rawOilSprout = placedFeatureRegistry.getOrThrow(GTPlacements.RAW_OIL_SPROUT); + Holder rawOilSprout = placedFeatureRegistry.getOrThrow(GTPlacedFeatures.RAW_OIL_SPROUT); ctx.register(RAW_OIL_SPROUT, new BiomeModifiers.AddFeaturesBiomeModifier( overworld, HolderSet.direct(rawOilSprout), diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTConfiguredFeatures.java b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTConfiguredFeatures.java similarity index 63% rename from src/main/java/com/gregtechceu/gtceu/common/data/GTConfiguredFeatures.java rename to src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTConfiguredFeatures.java index ff006f089bd..d7f6971ae8f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTConfiguredFeatures.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTConfiguredFeatures.java @@ -1,6 +1,8 @@ -package com.gregtechceu.gtceu.common.data; +package com.gregtechceu.gtceu.common.data.worldgen; import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.common.data.GTBlocks; +import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.common.worldgen.feature.configurations.FluidSproutConfiguration; import com.gregtechceu.gtceu.common.worldgen.feature.configurations.StoneBlobConfiguration; @@ -23,6 +25,7 @@ public class GTConfiguredFeatures { + // spotless:off public static final ResourceKey> RUBBER_TREE = ResourceKey.create( Registries.CONFIGURED_FEATURE, GTCEu.id("rubber_tree")); public static final ResourceKey> RED_GRANITE_BLOB = ResourceKey @@ -33,23 +36,36 @@ public class GTConfiguredFeatures { .create(Registries.CONFIGURED_FEATURE, GTCEu.id("raw_oil_sprout")); public static void bootstrap(BootstrapContext> ctx) { - FeatureUtils.register(ctx, RUBBER_TREE, Feature.TREE, new TreeConfiguration.TreeConfigurationBuilder( - BlockStateProvider - .simple(GTBlocks.RUBBER_LOG.get().changeNatural(GTBlocks.RUBBER_LOG.getDefaultState(), true)), - new ForkingTrunkPlacer(5, 1, 3), - BlockStateProvider.simple(GTBlocks.RUBBER_LEAVES.get()), - new MegaJungleFoliagePlacer(ConstantInt.of(1), UniformInt.of(0, 1), 1), - new TwoLayersFeatureSize(1, 0, 2)).ignoreVines().build()); + FeatureUtils.register(ctx, RUBBER_TREE, Feature.TREE, + new TreeConfiguration.TreeConfigurationBuilder( + BlockStateProvider.simple(GTBlocks.RUBBER_LOG.get().changeNatural(GTBlocks.RUBBER_LOG.getDefaultState(), true)), + new ForkingTrunkPlacer(5, 1, 3), + BlockStateProvider.simple(GTBlocks.RUBBER_LEAVES.get()), + new MegaJungleFoliagePlacer(ConstantInt.of(1), UniformInt.of(0, 1), 1), + new TwoLayersFeatureSize(1, 0, 2) + ).ignoreVines().build() + ); FeatureUtils.register(ctx, RED_GRANITE_BLOB, GTFeatures.STONE_BLOB.get(), - new StoneBlobConfiguration(OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), - GTBlocks.RED_GRANITE.getDefaultState()), UniformInt.of(20, 30))); + new StoneBlobConfiguration( + OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), + GTBlocks.RED_GRANITE.getDefaultState()), UniformInt.of(20, 30) + ) + ); FeatureUtils.register(ctx, MARBLE_BLOB, GTFeatures.STONE_BLOB.get(), - new StoneBlobConfiguration(OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), - GTBlocks.MARBLE.getDefaultState()), UniformInt.of(20, 30))); + new StoneBlobConfiguration( + OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), + GTBlocks.MARBLE.getDefaultState()), UniformInt.of(20, 30) + ) + ); FeatureUtils.register(ctx, RAW_OIL_SPROUT, GTFeatures.FLUID_SPROUT.get(), - new FluidSproutConfiguration(GTMaterials.RawOil.getFluid(), UniformInt.of(9, 13), UniformInt.of(6, 9), - 0.4f)); + new FluidSproutConfiguration( + GTMaterials.RawOil.getFluid(), + UniformInt.of(9, 13), UniformInt.of(6, 9), + 0.4f + ) + ); } + // spotless:on } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTWorldgen.java b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTDensityFunctions.java similarity index 75% rename from src/main/java/com/gregtechceu/gtceu/common/data/GTWorldgen.java rename to src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTDensityFunctions.java index f079f73b879..eefb0b6907d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTWorldgen.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTDensityFunctions.java @@ -1,4 +1,4 @@ -package com.gregtechceu.gtceu.common.data; +package com.gregtechceu.gtceu.common.data.worldgen; import com.gregtechceu.gtceu.GTCEu; @@ -12,8 +12,9 @@ import net.minecraft.world.level.levelgen.Noises; import net.minecraft.world.level.levelgen.synth.NormalNoise; -public class GTWorldgen { +public class GTDensityFunctions { + // spotless:off public static final ResourceKey NEW_ORE_VEIN_TOGGLE = create("vein_toggle"); public static final ResourceKey NEW_ORE_VEIN_RIDGED = create("vein_ridged"); @@ -23,7 +24,9 @@ public static void bootstrap(BootstrapContext ctx) { Holder oreVeininess = noises.getOrThrow(Noises.ORE_VEININESS); ctx.register(NEW_ORE_VEIN_TOGGLE, DensityFunctions.interpolated( - DensityFunctions.noise(oreVeininess, 1.5f, 1.5f))); + DensityFunctions.noise(oreVeininess, 1.5f, 1.5f) + ) + ); Holder oreVeinA = noises.getOrThrow(Noises.ORE_VEIN_A); Holder oreVeinB = noises.getOrThrow(Noises.ORE_VEIN_B); @@ -31,11 +34,15 @@ public static void bootstrap(BootstrapContext ctx) { DensityFunctions.add( DensityFunctions.constant(-0.08f), DensityFunctions.max( - DensityFunctions.interpolated( - DensityFunctions.noise(oreVeinA, 4.0f, 4.0f)).abs(), - DensityFunctions.interpolated( - DensityFunctions.noise(oreVeinB, 4.0f, 4.0f)).abs()))); + DensityFunctions.interpolated(DensityFunctions.noise(oreVeinA, 4.0f, 4.0f)) + .abs(), + DensityFunctions.interpolated(DensityFunctions.noise(oreVeinB, 4.0f, 4.0f)) + .abs() + ) + ) + ); } + // spotless:on private static ResourceKey create(String path) { return ResourceKey.create(Registries.DENSITY_FUNCTION, GTCEu.id(path)); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTFeatures.java b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTFeatures.java new file mode 100644 index 00000000000..3265a70fb5f --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTFeatures.java @@ -0,0 +1,26 @@ +package com.gregtechceu.gtceu.common.data.worldgen; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.common.worldgen.feature.FluidSproutFeature; +import com.gregtechceu.gtceu.common.worldgen.feature.StoneBlobFeature; + +import net.minecraft.core.registries.Registries; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; + +public class GTFeatures { + // spotless:off + + public static final DeferredRegister> FEATURES = DeferredRegister.create(Registries.FEATURE, GTCEu.MOD_ID); + + public static final DeferredHolder, StoneBlobFeature> STONE_BLOB = FEATURES.register("stone_blob", StoneBlobFeature::new); + public static final DeferredHolder, FluidSproutFeature> FLUID_SPROUT = FEATURES.register("fluid_sprout", FluidSproutFeature::new); + + // spotless:on + + public static void init(IEventBus modBus) { + FEATURES.register(modBus); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTPlacements.java b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTPlacedFeatures.java similarity index 84% rename from src/main/java/com/gregtechceu/gtceu/common/data/GTPlacements.java rename to src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTPlacedFeatures.java index f280220dddd..e0777956de0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTPlacements.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTPlacedFeatures.java @@ -1,6 +1,7 @@ -package com.gregtechceu.gtceu.common.data; +package com.gregtechceu.gtceu.common.data.worldgen; import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.worldgen.modifier.RubberTreeChancePlacement; import net.minecraft.core.Holder; @@ -14,18 +15,15 @@ import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.placement.*; -public class GTPlacements { +public class GTPlacedFeatures { - public static final ResourceKey RUBBER_TREE = ResourceKey.create(Registries.PLACED_FEATURE, - GTCEu.id("rubber_tree")); - public static final ResourceKey RUBBER_TREE_SWAMP = ResourceKey.create(Registries.PLACED_FEATURE, - GTCEu.id("rubber_tree_swamp")); - public static final ResourceKey RED_GRANITE_BLOB = ResourceKey.create(Registries.PLACED_FEATURE, - GTCEu.id("red_granite_blob")); - public static final ResourceKey MARBLE_BLOB = ResourceKey.create(Registries.PLACED_FEATURE, - GTCEu.id("marble_blob")); - public static final ResourceKey RAW_OIL_SPROUT = ResourceKey.create(Registries.PLACED_FEATURE, - GTCEu.id("raw_oil_sprout")); + // spotless:off + public static final ResourceKey RUBBER_TREE = ResourceKey.create(Registries.PLACED_FEATURE, GTCEu.id("rubber_tree")); + public static final ResourceKey RUBBER_TREE_SWAMP = ResourceKey.create(Registries.PLACED_FEATURE, GTCEu.id("rubber_tree_swamp")); + public static final ResourceKey RED_GRANITE_BLOB = ResourceKey.create(Registries.PLACED_FEATURE, GTCEu.id("red_granite_blob")); + public static final ResourceKey MARBLE_BLOB = ResourceKey.create(Registries.PLACED_FEATURE, GTCEu.id("marble_blob")); + public static final ResourceKey RAW_OIL_SPROUT = ResourceKey.create(Registries.PLACED_FEATURE, GTCEu.id("raw_oil_sprout")); + // spotless:on public static void bootstrap(BootstrapContext ctx) { HolderGetter> featureLookup = ctx.lookup(Registries.CONFIGURED_FEATURE); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTPlacementModifiers.java b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTPlacementModifiers.java new file mode 100644 index 00000000000..cad0054272d --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/data/worldgen/GTPlacementModifiers.java @@ -0,0 +1,27 @@ +package com.gregtechceu.gtceu.common.data.worldgen; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.common.worldgen.modifier.BiomeDependentPlacement; +import com.gregtechceu.gtceu.common.worldgen.modifier.RubberTreeChancePlacement; + +import net.minecraft.core.registries.Registries; +import net.minecraft.world.level.levelgen.placement.PlacementModifierType; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; + +public class GTPlacementModifiers { + // spotless:off + + public static final DeferredRegister> PLACEMENT_MODIFIERS = DeferredRegister.create(Registries.PLACEMENT_MODIFIER_TYPE, GTCEu.MOD_ID); + + + public static final DeferredHolder, PlacementModifierType> BIOME_DEPENDENT = PLACEMENT_MODIFIERS.register("biome_dependent", () -> () -> BiomeDependentPlacement.CODEC); + public static final DeferredHolder, PlacementModifierType> RUBBER_TREE_CHANCE = PLACEMENT_MODIFIERS.register("rubber_tree_chance", () -> () -> RubberTreeChancePlacement.CODEC); + + // spotless:on + + public static void init(IEventBus modBus) { + PLACEMENT_MODIFIERS.register(modBus); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/loot/condition/GTConfigValueCondition.java b/src/main/java/com/gregtechceu/gtceu/common/loot/condition/GTConfigValueCondition.java new file mode 100644 index 00000000000..d104ffbb584 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/loot/condition/GTConfigValueCondition.java @@ -0,0 +1,68 @@ +package com.gregtechceu.gtceu.common.loot.condition; + +import com.gregtechceu.gtceu.common.data.loot.GTLootConditions; +import com.gregtechceu.gtceu.config.ConfigHolder; + +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.toma.configuration.config.value.IConfigValue; +import lombok.Getter; +import lombok.experimental.Accessors; + +import java.util.Optional; +import java.util.function.BooleanSupplier; + +@Accessors(fluent = true) +public class GTConfigValueCondition implements LootItemCondition { + + // spotless:off + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group( + Codec.STRING.fieldOf("config_field").forGetter(GTConfigValueCondition::configField) + ).apply(instance, GTConfigValueCondition::new)); + // spotless:on + + @Getter + private final String configField; + private final BooleanSupplier configValueGetter; + + protected GTConfigValueCondition(String configField) { + this.configField = configField; + + Optional> configEntry = ConfigHolder.INTERNAL_INSTANCE + .getConfigValue(configField, boolean.class); + this.configValueGetter = () -> configEntry.map(IConfigValue::get).orElse(false); + } + + @Override + public boolean test(LootContext lootContext) { + return configValueGetter.getAsBoolean(); + } + + @Override + public LootItemConditionType getType() { + return GTLootConditions.CONFIG_VALUE.get(); + } + + public static LootItemCondition.Builder configEnabled(String configField) { + return () -> new GTConfigValueCondition(configField); + } + + /** + * {@return Config value condition that checks the {@code worldgen.addLoot} config} + */ + public static LootItemCondition.Builder addLootConfigEnabled() { + return configEnabled("worldgen.addLoot"); + } + + /** + * {@return Config value condition that checks the {@code worldgen.increaseDungeonLoot} config} + */ + public static LootItemCondition.Builder increaseDungeonLootConfigEnabled() { + return configEnabled("worldgen.increaseDungeonLoot"); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/loot/condition/package-info.java b/src/main/java/com/gregtechceu/gtceu/common/loot/condition/package-info.java new file mode 100644 index 00000000000..aec8cbea134 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/loot/condition/package-info.java @@ -0,0 +1,4 @@ +@NotNullByDefault +package com.gregtechceu.gtceu.common.loot.condition; + +import org.jetbrains.annotations.NotNullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/common/loot/function/SetEUChargeFunction.java b/src/main/java/com/gregtechceu/gtceu/common/loot/function/SetEUChargeFunction.java new file mode 100644 index 00000000000..932e4852975 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/loot/function/SetEUChargeFunction.java @@ -0,0 +1,52 @@ +package com.gregtechceu.gtceu.common.loot.function; + +import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; +import com.gregtechceu.gtceu.api.capability.IElectricItem; +import com.gregtechceu.gtceu.common.data.loot.GTLootFunctions; +import com.gregtechceu.gtceu.utils.codec.GTCodecUtils; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.functions.*; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; + +import com.google.gson.*; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + +import java.util.List; + +public class SetEUChargeFunction extends LootItemConditionalFunction { + + // spotless:off + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(instance -> commonFields(instance).and( + GTCodecUtils.NON_NEGATIVE_LONG.fieldOf("charge").forGetter(fn -> fn.charge) + ).apply(instance, SetEUChargeFunction::new)); + // spotless:on + + protected final long charge; + + protected SetEUChargeFunction(List predicates, long charge) { + super(predicates); + this.charge = charge; + } + + @Override + public LootItemFunctionType getType() { + return GTLootFunctions.SET_EU_CHARGE.get(); + } + + @Override + public ItemStack run(ItemStack stack, LootContext context) { + IElectricItem electricItem = GTCapabilityHelper.getElectricItem(stack); + if (electricItem == null) { + return stack; + } + electricItem.charge(this.charge, Integer.MAX_VALUE, true, false); + return stack; + } + + public static LootItemConditionalFunction.Builder setCharge(long charge) { + return simpleBuilder(conditions -> new SetEUChargeFunction(conditions, charge)); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/loot/function/package-info.java b/src/main/java/com/gregtechceu/gtceu/common/loot/function/package-info.java new file mode 100644 index 00000000000..e82ff307695 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/loot/function/package-info.java @@ -0,0 +1,4 @@ +@NotNullByDefault +package com.gregtechceu.gtceu.common.loot.function; + +import org.jetbrains.annotations.NotNullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/BedrockOreMinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/BedrockOreMinerLogic.java index 5c95eff9449..ec1c0fbc2a5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/BedrockOreMinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/BedrockOreMinerLogic.java @@ -80,7 +80,9 @@ private GTRecipe getOreMinerRecipe() { if (wm == null) return null; Material material = wm.material(); if (material.isNull()) return null; - ItemStack stack = ChemicalHelper.get(GTRegistries.TAG_PREFIXES.get(GTCEu.id(GTCEu.appendIdString(ConfigHolder.INSTANCE.machines.bedrockOreDropTagPrefix))), + ItemStack stack = ChemicalHelper.get( + GTRegistries.TAG_PREFIXES.get( + GTCEu.id(GTCEu.appendIdString(ConfigHolder.INSTANCE.machines.bedrockOreDropTagPrefix))), material, getOreToProduce()); // backup 1: crushed; if raw ore doesn't exist if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.crushed, material, getOreToProduce()); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java index a5bfb535ccd..0ccf4e4688f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java @@ -7,7 +7,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; -import net.minecraft.core.registries.Registries; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantments; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java index 2225b6bd350..64677b5f1de 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java @@ -160,7 +160,8 @@ protected List> validMachineClasses() { @Override public void onMachineLoad() { if (getMachine().getLevel() != null) { - this.pickaxeTool.enchant(getMachine().getLevel().registryAccess().holderOrThrow(Enchantments.FORTUNE), fortune); + this.pickaxeTool.enchant(getMachine().getLevel().registryAccess().holderOrThrow(Enchantments.FORTUNE), + fortune); } this.inputItemHandler = new ItemRecipeHandler(IO.IN, diff --git a/src/main/java/com/gregtechceu/gtceu/common/mui/GTGuiTheme.java b/src/main/java/com/gregtechceu/gtceu/common/mui/GTGuiTheme.java index 00a0cfa1b93..cef4611d2c7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/mui/GTGuiTheme.java +++ b/src/main/java/com/gregtechceu/gtceu/common/mui/GTGuiTheme.java @@ -3,10 +3,6 @@ import com.gregtechceu.gtceu.api.cover.IMuiCover; import com.gregtechceu.gtceu.config.ConfigHolder; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.EventBusSubscriber; -import net.neoforged.fml.event.lifecycle.FMLConstructModEvent; - import brachy.modularui.api.ITheme; import brachy.modularui.api.IThemeApi; import brachy.modularui.drawable.UITexture; @@ -22,7 +18,6 @@ import java.util.function.Consumer; import java.util.function.Supplier; -@EventBusSubscriber public class GTGuiTheme { private static final List THEMES = new ArrayList<>(); @@ -76,7 +71,7 @@ public class GTGuiTheme { private final List> elementBuilder; private final JsonBuilder jsonBuilder; - private Supplier logo; + private @Nullable Supplier logo; private GTGuiTheme(String themeId) { this.themeId = themeId; @@ -111,11 +106,6 @@ public static void registerThemes() { THEMES.forEach(GTGuiTheme::register); } - @SubscribeEvent - public static void onReloadThemes(FMLConstructModEvent event) { - THEMES.forEach(GTGuiTheme::register); - } - public static Builder templateBuilder(String themeId) { Builder builder = new Builder(themeId); builder.openCloseAnimation(0); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/BiomePlacement.java b/src/main/java/com/gregtechceu/gtceu/common/worldgen/modifier/BiomeDependentPlacement.java similarity index 62% rename from src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/BiomePlacement.java rename to src/main/java/com/gregtechceu/gtceu/common/worldgen/modifier/BiomeDependentPlacement.java index 849532521cf..d9fd3822a46 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/BiomePlacement.java +++ b/src/main/java/com/gregtechceu/gtceu/common/worldgen/modifier/BiomeDependentPlacement.java @@ -1,32 +1,28 @@ -package com.gregtechceu.gtceu.api.data.worldgen.modifier; +package com.gregtechceu.gtceu.common.worldgen.modifier; -import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.worldgen.BiomeWeightModifier; +import com.gregtechceu.gtceu.common.data.worldgen.GTPlacementModifiers; import net.minecraft.core.BlockPos; -import net.minecraft.core.registries.Registries; import net.minecraft.util.RandomSource; import net.minecraft.world.level.levelgen.placement.PlacementContext; import net.minecraft.world.level.levelgen.placement.PlacementModifier; import net.minecraft.world.level.levelgen.placement.PlacementModifierType; -import net.neoforged.bus.api.IEventBus; -import net.neoforged.neoforge.registries.DeferredRegister; import com.mojang.serialization.MapCodec; import java.util.List; import java.util.stream.Stream; -public class BiomePlacement extends PlacementModifier { +public class BiomeDependentPlacement extends PlacementModifier { - public static final PlacementModifierType BIOME_PLACEMENT = () -> BiomePlacement.CODEC; - - public static final MapCodec CODEC = BiomeWeightModifier.CODEC.listOf().fieldOf("modifiers") - .xmap(BiomePlacement::new, placement -> placement.modifiers); + public static final MapCodec CODEC = BiomeWeightModifier.CODEC.listOf() + .fieldOf("modifiers") + .xmap(BiomeDependentPlacement::new, placement -> placement.modifiers); public final List modifiers; - public BiomePlacement(List modifiers) { + public BiomeDependentPlacement(List modifiers) { this.modifiers = modifiers; } @@ -45,6 +41,6 @@ public Stream getPositions(PlacementContext context, RandomSource rand @Override public PlacementModifierType type() { - return BIOME_PLACEMENT; + return GTPlacementModifiers.BIOME_DEPENDENT.get(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/worldgen/modifier/RubberTreeChancePlacement.java b/src/main/java/com/gregtechceu/gtceu/common/worldgen/modifier/RubberTreeChancePlacement.java index dcb55f94eb0..e22c6f90740 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/worldgen/modifier/RubberTreeChancePlacement.java +++ b/src/main/java/com/gregtechceu/gtceu/common/worldgen/modifier/RubberTreeChancePlacement.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.common.worldgen.modifier; +import com.gregtechceu.gtceu.common.data.worldgen.GTPlacementModifiers; import com.gregtechceu.gtceu.config.ConfigHolder; import net.minecraft.core.BlockPos; @@ -12,8 +13,6 @@ public class RubberTreeChancePlacement extends RepeatingPlacement { - public static final PlacementModifierType RUBBER_TREE_CHANCE_PLACEMENT = () -> RubberTreeChancePlacement.CODEC; - public static final RubberTreeChancePlacement INSTANCE = new RubberTreeChancePlacement(); public static final MapCodec CODEC = MapCodec.unit(INSTANCE); @@ -24,6 +23,6 @@ protected int count(RandomSource random, @NotNull BlockPos pos) { @Override public PlacementModifierType type() { - return RUBBER_TREE_CHANCE_PLACEMENT; + return GTPlacementModifiers.RUBBER_TREE_CHANCE.get(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/ReloadableServerResourcesMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/ReloadableServerResourcesMixin.java index 6df3a51520e..6e1c32c69e7 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/ReloadableServerResourcesMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/ReloadableServerResourcesMixin.java @@ -4,7 +4,6 @@ import com.gregtechceu.gtceu.api.machine.trait.customlogic.SteamBoilerLogic; import com.gregtechceu.gtceu.common.data.GTRecipes; import com.gregtechceu.gtceu.core.MixinHelpers; -import com.gregtechceu.gtceu.data.loot.DungeonLootLoader; import com.gregtechceu.gtceu.data.pack.GTDynamicDataPack; import com.gregtechceu.gtceu.data.recipe.GTCraftingComponents; @@ -67,8 +66,6 @@ public void accept(@NotNull ResourceLocation id, @NotNull Recipe recipe, } }); MixinHelpers.generateGTDynamicLoot(GTDynamicDataPack::addLootTable, frozen); - // Initialize dungeon loot additions - DungeonLootLoader.init(); GTCEu.LOGGER.info("GregTech Data loading took {}ms", System.currentTimeMillis() - startTime); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/neoforge/GameDataMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/neoforge/GameDataMixin.java index 9df36fb77ed..f0ece274951 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/neoforge/GameDataMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/neoforge/GameDataMixin.java @@ -2,12 +2,14 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.neoforged.neoforge.registries.GameData; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; import java.util.LinkedHashSet; @@ -20,4 +22,17 @@ public class GameDataMixin { ordered.addAll(GTRegistries.getRegistryOrder()); return ordered; } + + /** + * Injection to init the vanilla recipe type registry in place of fake GT one + */ + @ModifyArg(method = "postRegisterEvents", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/core/Registry;get(Lnet/minecraft/resources/ResourceLocation;)Ljava/lang/Object;")) + private static ResourceLocation gtceu$loadVanillaRecipeTypeRegistryInstead(ResourceLocation registryName) { + if (registryName.equals(GTRegistries.Keys.RECIPE_TYPE.location())) { + return Registries.RECIPE_TYPE.location(); + } + return registryName; + } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/DataGenerators.java b/src/main/java/com/gregtechceu/gtceu/data/DataGenerators.java index 043fa7534e2..f02db81e114 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/DataGenerators.java +++ b/src/main/java/com/gregtechceu/gtceu/data/DataGenerators.java @@ -4,6 +4,12 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.api.registry.registrate.builder.SoundEntryBuilder; import com.gregtechceu.gtceu.common.data.*; +import com.gregtechceu.gtceu.common.data.worldgen.GTBiomeModifiers; +import com.gregtechceu.gtceu.common.data.worldgen.GTConfiguredFeatures; +import com.gregtechceu.gtceu.common.data.worldgen.GTDensityFunctions; +import com.gregtechceu.gtceu.common.data.worldgen.GTPlacedFeatures; +import com.gregtechceu.gtceu.data.loot.GTLootModifications; +import com.gregtechceu.gtceu.data.loot.GTLootTables; import com.gregtechceu.gtceu.data.tags.BiomeTagsLoader; import com.gregtechceu.gtceu.data.tags.DamageTypeTagsLoader; @@ -39,8 +45,8 @@ public static void gatherData(GatherDataEvent event) { packOutput, registries, new RegistrySetBuilder() .add(Registries.DAMAGE_TYPE, GTDamageTypes::bootstrap) .add(Registries.CONFIGURED_FEATURE, GTConfiguredFeatures::bootstrap) - .add(Registries.PLACED_FEATURE, GTPlacements::bootstrap) - .add(Registries.DENSITY_FUNCTION, GTWorldgen::bootstrap) + .add(Registries.PLACED_FEATURE, GTPlacedFeatures::bootstrap) + .add(Registries.DENSITY_FUNCTION, GTDensityFunctions::bootstrap) .add(NeoForgeRegistries.Keys.BIOME_MODIFIERS, GTBiomeModifiers::bootstrap) .add(Registries.JUKEBOX_SONG, GTJukeboxSongs::bootstrap) .add(Registries.ENCHANTMENT_PROVIDER, GTEnchantmentProviders::bootstrap) @@ -49,6 +55,8 @@ packOutput, registries, new RegistrySetBuilder() set)); generator.addProvider(true, new DamageTypeTagsLoader(packOutput, provider.getRegistryProvider(), existingFileHelper)); + generator.addProvider(true, new GTLootTables(packOutput, provider.getRegistryProvider())); + generator.addProvider(true, new GTLootModifications(packOutput, provider.getRegistryProvider())); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java index 94e05f10a68..50fda8280a4 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java @@ -610,12 +610,15 @@ public static void init(RegistrateLangProvider provider) { replace(provider, "item.gtceu.bucket", "%s Bucket"); - replace(provider, "block.gtceu.oil_heavy", "Heavy Oil"); - replace(provider, "block.gtceu.oil_light", "Light Oil"); - replace(provider, "block.gtceu.oil_medium", "Raw Oil"); + replace(provider, "block.gtceu.heavy_oil", "Heavy Oil"); + replace(provider, "block.gtceu.light_oil", "Light Oil"); + replace(provider, "block.gtceu.raw_oil", "Raw Oil"); replace(provider, "block.gtceu.oil", "Oil"); replace(provider, "block.gtceu.creosote", "Creosote"); + replace(provider, "material.gtceu.plutonium", "Plutonium 239"); + replace(provider, "material.gtceu.uranium", "Uranium 238"); + replace(provider, GTBlocks.BATTERY_EMPTY_TIER_I.get().getDescriptionId(), "Empty Tier I Capacitor"); replace(provider, GTBlocks.BATTERY_LAPOTRONIC_EV.get().getDescriptionId(), "EV Lapotronic Capacitor"); replace(provider, GTBlocks.BATTERY_LAPOTRONIC_IV.get().getDescriptionId(), "IV Lapotronic Capacitor"); diff --git a/src/main/java/com/gregtechceu/gtceu/data/loader/PostRegistryListener.java b/src/main/java/com/gregtechceu/gtceu/data/loader/PostRegistryListener.java index 547c3440f7b..3ff5fb65712 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/loader/PostRegistryListener.java +++ b/src/main/java/com/gregtechceu/gtceu/data/loader/PostRegistryListener.java @@ -7,9 +7,6 @@ import com.gregtechceu.gtceu.integration.map.cache.server.ServerCache; import net.minecraft.core.HolderLookup; -import net.minecraft.core.Registry; -import net.minecraft.core.RegistryAccess; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.profiling.ProfilerFiller; diff --git a/src/main/java/com/gregtechceu/gtceu/data/loot/ChestGenHooks.java b/src/main/java/com/gregtechceu/gtceu/data/loot/ChestGenHooks.java deleted file mode 100644 index e6f0600cfb1..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/data/loot/ChestGenHooks.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.gregtechceu.gtceu.data.loot; - -import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.config.ConfigHolder; -import com.gregtechceu.gtceu.core.mixins.LootPoolAccessor; -import com.gregtechceu.gtceu.utils.GTMath; -import com.gregtechceu.gtceu.utils.ItemStackHashStrategy; - -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.ExtraCodecs; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.LootPool; -import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.entries.LootItem; -import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; -import net.minecraft.world.level.storage.loot.functions.LootItemConditionalFunction; -import net.minecraft.world.level.storage.loot.functions.LootItemFunction; -import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType; -import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; -import net.minecraft.world.level.storage.loot.providers.number.NumberProvider; -import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; -import net.neoforged.bus.api.IEventBus; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.neoforge.common.NeoForge; -import net.neoforged.neoforge.event.LootTableLoadEvent; -import net.neoforged.neoforge.registries.DeferredRegister; - -import com.google.common.base.Preconditions; -import com.mojang.serialization.MapCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import lombok.Getter; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Consumer; - -public final class ChestGenHooks { - - private static final Map> lootEntryItems = new Object2ObjectOpenHashMap<>(); - private static final Map rollValues = new Object2ObjectOpenHashMap<>(); - - private static final List NO_CONDITIONS = List.of(); - - private ChestGenHooks() {} - - public static void init(IEventBus modBus) { - NeoForge.EVENT_BUS.register(ChestGenHooks.class); - RandomWeightLootFunction.init(modBus); - } - - @SubscribeEvent - public static void onWorldLoad(@NotNull LootTableLoadEvent event) { - LootPool mainPool = event.getTable().getPool("main"); - if (mainPool == null) return; - - ResourceLocation name = event.getName(); - if (lootEntryItems.containsKey(name)) { - List entryItems = lootEntryItems.get(name); - for (GTLootEntryItem entry : entryItems) { - if (ConfigHolder.INSTANCE.dev.debug) { - GTCEu.LOGGER.info("adding {} to lootTable {}", entry, name); - } - - try { - List entries = new ArrayList<>(((LootPoolAccessor) mainPool).getEntries()); - entries.add(entry); - ((LootPoolAccessor) mainPool).setEntries(entries); - } catch (RuntimeException e) { - GTCEu.LOGGER.error("Couldn't add {} to lootTable {}: {}", entry, name, e.getMessage()); - } - } - } - - if (rollValues.containsKey(event.getName())) { - NumberProvider rangeAdd = rollValues.get(event.getName()); - NumberProvider range = mainPool.getRolls(); - // mainPool.setRolls(UniformGenerator.between(range.getMin() + rangeAdd.getMin(), range.getMax() + - // rangeAdd.getMax())); TODO additional rolls - } - } - - public static void addItem(@NotNull ResourceKey lootTable, @NotNull ItemStack stack, int minAmount, - int maxAmount, int weight) { - RandomWeightLootFunction lootFunction = new RandomWeightLootFunction(stack, minAmount, maxAmount); - String modid = Objects.requireNonNull(BuiltInRegistries.ITEM.getKey(stack.getItem())).getNamespace(); - String entryName = createEntryName(stack, modid, weight, lootFunction); - GTLootEntryItem itemEntry = new GTLootEntryItem(stack, weight, lootFunction, entryName); - lootEntryItems.computeIfAbsent(lootTable.location(), $ -> new ArrayList<>()).add(itemEntry); - } - - public static void addRolls(ResourceKey lootTable, int minAdd, int maxAdd) { - rollValues.put(lootTable.location(), UniformGenerator.between(minAdd, maxAdd)); - } - - private static final ItemStackHashStrategy HASH_STRATEGY = ItemStackHashStrategy.comparingAllButCount(); - - private static @NotNull String createEntryName(@NotNull ItemStack stack, @NotNull String modid, int weight, - @NotNull RandomWeightLootFunction function) { - int hashCode = GTMath.hashInts(HASH_STRATEGY.hashCode(stack), modid.hashCode(), weight, function.getMinAmount(), - function.getMaxAmount()); - return String.format("#%s:loot_%s", modid, hashCode); - } - - private static class GTLootEntryItem extends LootItem { - - private final ItemStack stack; - private final String entryName; - - public GTLootEntryItem(@NotNull ItemStack stack, int weight, LootItemFunction lootFunction, - @NotNull String entryName) { - super(stack.getItemHolder(), weight, 1, NO_CONDITIONS, List.of(lootFunction)); - this.stack = stack; - this.entryName = entryName; - } - - public void createItemStack(Consumer stackConsumer, @NotNull LootContext lootContext) { - stackConsumer.accept(this.stack.copy()); - } - - @Override - public @NotNull String toString() { - return "GTLootEntryItem{name=" + entryName + ", stack=" + stack.toString() + '}'; - } - } - - public static class RandomWeightLootFunction extends LootItemConditionalFunction implements LootItemFunction { - - public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(instance -> instance - .group( - ItemStack.CODEC.fieldOf("stack").forGetter(val -> val.stack), - ExtraCodecs.NON_NEGATIVE_INT.fieldOf("min").forGetter(val -> val.minAmount), - ExtraCodecs.NON_NEGATIVE_INT.fieldOf("max").forGetter(val -> val.maxAmount)) - .apply(instance, RandomWeightLootFunction::new)); - - public static final LootItemFunctionType TYPE = new LootItemFunctionType<>(CODEC); - - private final ItemStack stack; - @Getter - private final int minAmount; - @Getter - private final int maxAmount; - - public RandomWeightLootFunction(@NotNull ItemStack stack, int minAmount, int maxAmount) { - super(NO_CONDITIONS); - Preconditions.checkArgument(minAmount <= maxAmount, "minAmount must be <= maxAmount"); - this.stack = stack; - this.minAmount = minAmount; - this.maxAmount = maxAmount; - } - - public static void init(IEventBus modBus) { - var register = DeferredRegister.create(Registries.LOOT_FUNCTION_TYPE, GTCEu.MOD_ID); - register.register(modBus); - register.register("random_weight", () -> TYPE); - } - - @Override - public @NotNull LootItemFunctionType getType() { - return TYPE; - } - - @Override - protected @NotNull ItemStack run(@NotNull ItemStack itemStack, @NotNull LootContext context) { - if (stack.getDamageValue() != 0) { - itemStack.setDamageValue(stack.getDamageValue()); - } - if (!stack.isComponentsPatchEmpty()) { - itemStack.applyComponents(stack.getComponentsPatch()); - } - - if (minAmount == maxAmount) { - itemStack.setCount(minAmount); - return itemStack; - } - - int count = Math.min(minAmount + context.getRandom().nextInt(maxAmount - minAmount + 1), - stack.getMaxStackSize()); - itemStack.setCount(count); - return itemStack; - } - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/data/loot/DungeonLootLoader.java b/src/main/java/com/gregtechceu/gtceu/data/loot/DungeonLootLoader.java deleted file mode 100644 index 099d1929d9f..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/data/loot/DungeonLootLoader.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.gregtechceu.gtceu.data.loot; - -import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; -import com.gregtechceu.gtceu.api.data.tag.TagPrefix; -import com.gregtechceu.gtceu.common.data.GTItems; -import com.gregtechceu.gtceu.common.data.GTMaterials; -import com.gregtechceu.gtceu.config.ConfigHolder; - -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.storage.loot.BuiltInLootTables; - -public class DungeonLootLoader { - - private DungeonLootLoader() {} - - public static void init() { - if (ConfigHolder.INSTANCE.worldgen.addLoot || ConfigHolder.INSTANCE.worldgen.increaseDungeonLoot) { - GTCEu.LOGGER.info("Registering dungeon loot..."); - } - if (ConfigHolder.INSTANCE.worldgen.addLoot) { - ChestGenHooks.addItem(BuiltInLootTables.SPAWN_BONUS_CHEST, GTItems.BOTTLE_PURPLE_DRINK.asStack(), 8, 16, 2); - - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, GTItems.BOTTLE_PURPLE_DRINK.asStack(), 4, 8, 80); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Silver), 1, 6, 120); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Lead), 1, 6, 30); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 1, 6, 60); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 1, 6, 60); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Manganese), 1, 6, 60); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 1, 6, 10); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Emerald), 1, 6, 20); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), - 1, 6, 20); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 1, 6, 20); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 1, 6, 20); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 1, 6, 20); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 1, 6, 40); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 1, 6, 40); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.dust, GTMaterials.Neodymium), 1, 6, 40); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, - ChemicalHelper.get(TagPrefix.dust, GTMaterials.Chromium), 1, 3, 40); - - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Silver), 4, 16, 12); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Platinum), 2, 8, 4); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), - 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 2, 8, 4); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 2, 8, 4); - - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, - GTItems.ZERO_POINT_MODULE.get().getChargedStack(Long.MAX_VALUE), 1, 1, 1); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 4, 16, 12); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), - 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 2, 8, 4); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 2, 8, 4); - - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE_DISPENSER, new ItemStack(Items.FIRE_CHARGE, 1), 2, 8, - 30); - - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Silver), 1, 4, 12); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Lead), 1, 4, 3); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 1, 4, 6); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 1, 4, 6); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 1, 4, 2); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 1, 4, 2); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 1, 4, 2); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 1, 4, 4); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 1, 4, 4); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), 1, 4, 2); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.gem, GTMaterials.Emerald), 1, 4, 2); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 3, 12, 1); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 1, 4, 1); - - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, - ChemicalHelper.get(TagPrefix.dust, GTMaterials.Chromium), 1, 4, 6); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, - ChemicalHelper.get(TagPrefix.dust, GTMaterials.Neodymium), 2, 8, 6); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Manganese), 2, 8, 12); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 4, 12, 12); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 4, 12, 12); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Brass), 4, 12, 12); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 4, 12, 1); - - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 4, 8, 6); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 8, 16, 12); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 8, 16, 12); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Manganese), 4, 8, 12); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, - ChemicalHelper.get(TagPrefix.dust, GTMaterials.Neodymium), 4, 8, 6); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, - ChemicalHelper.get(TagPrefix.dust, GTMaterials.Chromium), 2, 4, 6); - - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CORRIDOR, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 2, 8, 6); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CORRIDOR, - ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 3, 12, 6); - } - if (ConfigHolder.INSTANCE.worldgen.increaseDungeonLoot) { - ChestGenHooks.addRolls(BuiltInLootTables.SPAWN_BONUS_CHEST, 2, 4); - ChestGenHooks.addRolls(BuiltInLootTables.SIMPLE_DUNGEON, 1, 3); - ChestGenHooks.addRolls(BuiltInLootTables.DESERT_PYRAMID, 2, 4); - ChestGenHooks.addRolls(BuiltInLootTables.JUNGLE_TEMPLE, 4, 8); - ChestGenHooks.addRolls(BuiltInLootTables.JUNGLE_TEMPLE_DISPENSER, 0, 2); - ChestGenHooks.addRolls(BuiltInLootTables.ABANDONED_MINESHAFT, 1, 3); - ChestGenHooks.addRolls(BuiltInLootTables.VILLAGE_WEAPONSMITH, 2, 6); - ChestGenHooks.addRolls(BuiltInLootTables.STRONGHOLD_CROSSING, 2, 4); - ChestGenHooks.addRolls(BuiltInLootTables.STRONGHOLD_CORRIDOR, 2, 4); - ChestGenHooks.addRolls(BuiltInLootTables.STRONGHOLD_LIBRARY, 4, 8); - } - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/data/loot/GTLootModifications.java b/src/main/java/com/gregtechceu/gtceu/data/loot/GTLootModifications.java new file mode 100644 index 00000000000..ff298e6b04a --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/loot/GTLootModifications.java @@ -0,0 +1,48 @@ +package com.gregtechceu.gtceu.data.loot; + +import com.gregtechceu.gtceu.GTCEu; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.storage.loot.BuiltInLootTables; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.neoforged.neoforge.common.data.GlobalLootModifierProvider; +import net.neoforged.neoforge.common.loot.AddTableLootModifier; +import net.neoforged.neoforge.common.loot.LootTableIdCondition; + +import org.apache.commons.lang3.ArrayUtils; + +import java.util.concurrent.CompletableFuture; + +import static com.gregtechceu.gtceu.common.loot.condition.GTConfigValueCondition.*; + +public class GTLootModifications extends GlobalLootModifierProvider { + + private static final LootItemCondition[] LOOT_CONFIG_ENABLED_CONDITION = { addLootConfigEnabled().build() }; + + public GTLootModifications(PackOutput output, CompletableFuture registries) { + super(output, registries, GTCEu.MOD_ID); + } + + @Override + protected void start() { + addAddTableModifier(BuiltInLootTables.SPAWN_BONUS_CHEST, GTLootTables.SPAWN_BONUS_CHEST_EXTRA); + addAddTableModifier(BuiltInLootTables.SIMPLE_DUNGEON, GTLootTables.SIMPLE_DUNGEON_EXTRA); + addAddTableModifier(BuiltInLootTables.DESERT_PYRAMID, GTLootTables.DESERT_PYRAMID_EXTRA); + addAddTableModifier(BuiltInLootTables.JUNGLE_TEMPLE, GTLootTables.JUNGLE_TEMPLE_EXTRA); + addAddTableModifier(BuiltInLootTables.JUNGLE_TEMPLE_DISPENSER, GTLootTables.JUNGLE_TEMPLE_DISPENSER_EXTRA); + addAddTableModifier(BuiltInLootTables.ABANDONED_MINESHAFT, GTLootTables.ABANDONED_MINESHAFT_EXTRA); + addAddTableModifier(BuiltInLootTables.VILLAGE_WEAPONSMITH, GTLootTables.VILLAGE_WEAPONSMITH_EXTRA); + addAddTableModifier(BuiltInLootTables.STRONGHOLD_CROSSING, GTLootTables.STRONGHOLD_CROSSING_EXTRA); + addAddTableModifier(BuiltInLootTables.STRONGHOLD_CORRIDOR, GTLootTables.STRONGHOLD_CORRIDOR_EXTRA); + } + + protected void addAddTableModifier(ResourceKey targetLootTableId, + ResourceKey addedLootTableId) { + final LootItemCondition[] conditions = ArrayUtils.add(LOOT_CONFIG_ENABLED_CONDITION, + LootTableIdCondition.builder(targetLootTableId.location()).build()); + add(addedLootTableId.location().getPath(), new AddTableLootModifier(conditions, addedLootTableId)); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/loot/GTLootTables.java b/src/main/java/com/gregtechceu/gtceu/data/loot/GTLootTables.java new file mode 100644 index 00000000000..8a833f0f1ad --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/loot/GTLootTables.java @@ -0,0 +1,372 @@ +package com.gregtechceu.gtceu.data.loot; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; +import com.gregtechceu.gtceu.api.data.tag.TagPrefix; +import com.gregtechceu.gtceu.common.data.GTItems; +import com.gregtechceu.gtceu.common.data.GTMaterials; + +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.data.loot.LootTableProvider; +import net.minecraft.data.loot.LootTableSubProvider; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.storage.loot.LootPool; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; + +import java.util.List; +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import java.util.function.BiConsumer; + +import static com.gregtechceu.gtceu.common.loot.condition.GTConfigValueCondition.*; +import static com.gregtechceu.gtceu.common.loot.function.SetEUChargeFunction.setCharge; +import static com.gregtechceu.gtceu.data.loot.NumberProviderShortcuts.*; +import static net.minecraft.world.level.storage.loot.LootPool.lootPool; +import static net.minecraft.world.level.storage.loot.LootTable.lootTable; +import static net.minecraft.world.level.storage.loot.entries.LootItem.lootTableItem; +import static net.minecraft.world.level.storage.loot.functions.SetItemCountFunction.*; +import static net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition.*; +import static net.minecraft.world.level.storage.loot.providers.number.BinomialDistributionGenerator.*; +import static net.minecraft.world.level.storage.loot.providers.number.ConstantValue.*; +import static net.minecraft.world.level.storage.loot.providers.number.UniformGenerator.*; + +// spotless:off +public class GTLootTables extends LootTableProvider { + + public static final ResourceKey SPAWN_BONUS_CHEST_EXTRA = register("chests/extra/spawn_bonus_chest"); + public static final ResourceKey SIMPLE_DUNGEON_EXTRA = register("chests/extra/simple_dungeon"); + public static final ResourceKey DESERT_PYRAMID_EXTRA = register("chests/extra/desert_pyramid"); + public static final ResourceKey JUNGLE_TEMPLE_EXTRA = register("chests/extra/jungle_temple"); + public static final ResourceKey JUNGLE_TEMPLE_DISPENSER_EXTRA = register("chests/extra/jungle_temple_dispenser"); + public static final ResourceKey ABANDONED_MINESHAFT_EXTRA = register("chests/extra/abandoned_mineshaft"); + public static final ResourceKey VILLAGE_WEAPONSMITH_EXTRA = register("chests/extra/village_weaponsmith"); + public static final ResourceKey STRONGHOLD_CROSSING_EXTRA = register("chests/extra/stronghold_crossing"); + public static final ResourceKey STRONGHOLD_CORRIDOR_EXTRA = register("chests/extra/stronghold_corridor"); + + public GTLootTables(PackOutput output, CompletableFuture registries) { + super(output, Set.of(), List.of( + new SubProviderEntry(ChestLoot::new, LootContextParamSets.CHEST) + ), registries); + } + + private static ResourceKey register(String name) { + return ResourceKey.create(Registries.LOOT_TABLE, GTCEu.id(name)); + } + + /** + *

ALL FORMATTING IS INTENTIONAL! DO NOT CHANGE IT!!

+ * @author screret + */ + public record ChestLoot(HolderLookup.Provider registries) implements LootTableSubProvider { + + // Additional chest loot tables to inject. Note that all roll amounts are lower than in 1.12 because these + // aren't added into the loot tables' existing pools (they're new pools). + // That means we must take some care to avoid overfilling loot chests. + @Override + public void generate(BiConsumer, LootTable.Builder> provider) { + // Negative roll values are skipped, so most rolls' minimums are weighed toward 0. That's intentional and + // is done to limit the amount of items added to chests. + + provider.accept(SPAWN_BONUS_CHEST_EXTRA, lootTable() + .withPool(spawnBonusChestLoot().setRolls(between(0, 1))) + .withPool(spawnBonusChestLoot().setRolls(between(1, 2)) + .when(increaseDungeonLootConfigEnabled()) + ) + ); + + provider.accept(SIMPLE_DUNGEON_EXTRA, lootTable() + // purple drink/sus record loot pool + // usually gives nothing, sometimes purple drink and very rarely the sus record + .withPool(lootPool() + .setRolls(between(-2, 1)) + .add(lootTableItem(GTItems.BOTTLE_PURPLE_DRINK) + .setWeight(15) + .apply(setCount(between(4, 8)))) + .add(lootTableItem(GTItems.SUS_RECORD) + .setWeight(1)) // this should appear in 1/64 dungeon chests on average + ) + // basic loot pool + .withPool(simpleDungeonLoot().setRolls(between(-1, 2))) + // same loot pool again but with the extra rolls condition this time + .withPool(simpleDungeonLoot().setRolls(between(-1, 2)) + .when(increaseDungeonLootConfigEnabled()) + ) + ); + + provider.accept(DESERT_PYRAMID_EXTRA, lootTable() + .withPool(desertPyramidLoot().setRolls(between(-1, 3))) + .withPool(desertPyramidLoot().setRolls(between(-1, 3)) + .when(increaseDungeonLootConfigEnabled()) + ) + ); + + provider.accept(JUNGLE_TEMPLE_EXTRA, lootTable() + .withPool(lootPool() + .setRolls(exactly(1)) + .add(lootTableItem(GTItems.ZERO_POINT_MODULE).apply(setCharge(Long.MAX_VALUE))) + .when(randomChance(0.01f)) + ) + .withPool(jungleTempleLoot().setRolls(between(-1, 4))) + .withPool(jungleTempleLoot().setRolls(between(-1, 4)) + .when(increaseDungeonLootConfigEnabled()) + ) + ); + + provider.accept(JUNGLE_TEMPLE_DISPENSER_EXTRA, lootTable() + .withPool(lootPool() + .setRolls(between(0, 1)) + .add(lootTableItem(Items.FIRE_CHARGE) + .apply(setCount(between(2, 8))) + ) + ) + ); + + provider.accept(ABANDONED_MINESHAFT_EXTRA, lootTable() + .withPool(abandonedMineshaftLoot().setRolls(between(-1, 2))) + .withPool(abandonedMineshaftLoot().setRolls(between(-1, 2)) + .when(increaseDungeonLootConfigEnabled()) + ) + ); + + provider.accept(VILLAGE_WEAPONSMITH_EXTRA, lootTable() + .withPool(villageWeaponsmithLoot().setRolls(between(-1, 4))) + .withPool(villageWeaponsmithLoot().setRolls(between(-1, 4)) + .when(increaseDungeonLootConfigEnabled()) + ) + ); + + provider.accept(STRONGHOLD_CROSSING_EXTRA, lootTable() + .withPool(strongholdCrossingLoot().setRolls(between(-1, 3))) + .withPool(strongholdCrossingLoot().setRolls(between(-1, 3)) + .when(increaseDungeonLootConfigEnabled()) + ) + ); + + provider.accept(STRONGHOLD_CORRIDOR_EXTRA, lootTable() + .withPool(strongholdCorridorLoot().setRolls(between(-2, 2))) + .withPool(strongholdCorridorLoot().setRolls(between(-2, 2)) + .when(increaseDungeonLootConfigEnabled()) + ) + ); + } + + private static LootPool.Builder spawnBonusChestLoot() { + return lootPool() + .add(lootTableItem(GTItems.BOTTLE_PURPLE_DRINK) + .apply(setCount(between(8, 16)))); + } + + private static LootPool.Builder simpleDungeonLoot() { + return lootPool() + .add(lootTableItem(GTItems.BOTTLE_PURPLE_DRINK) + .setWeight(8) + .apply(setCount(between(4, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Silver)) + .setWeight(12) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Lead)) + .setWeight(3) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Steel)) + .setWeight(6) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Bronze)) + .setWeight(6) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Manganese)) + .setWeight(6) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.DamascusSteel)) + .setWeight(1) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Emerald)) + .setWeight(2) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Ruby)) + .setWeight(2) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Sapphire)) + .setWeight(2) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GreenSapphire)) + .setWeight(2) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Olivine)) + .setWeight(2) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GarnetRed)) + .setWeight(2) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GarnetYellow)) + .setWeight(2) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.dust, GTMaterials.Neodymium)) + .setWeight(4) + .apply(setCount(between(1, 6)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.dust, GTMaterials.Chromium)) + .setWeight(4) + .apply(setCount(between(1, 6)))); + } + + private static LootPool.Builder desertPyramidLoot() { + return lootPool() + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Silver)) + .setWeight(12) + .apply(setCount(between(4, 16)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Platinum)) + .setWeight(4) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Ruby)) + .setWeight(2) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Sapphire)) + .setWeight(2) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GreenSapphire)) + .setWeight(2) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Olivine)) + .setWeight(2) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GarnetRed)) + .setWeight(4) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GarnetYellow)) + .setWeight(4) + .apply(setCount(between(2, 8)))); + } + + private static LootPool.Builder jungleTempleLoot() { + return lootPool() + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Bronze)) + .setWeight(12) + .apply(setCount(between(4, 16)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Ruby)) + .setWeight(2) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Sapphire)) + .setWeight(2) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GreenSapphire)) + .setWeight(2) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Olivine)) + .setWeight(2) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GarnetRed)) + .setWeight(4) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GarnetYellow)) + .setWeight(4) + .apply(setCount(between(2, 8)))); + } + + private static LootPool.Builder abandonedMineshaftLoot() { + return lootPool() + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Silver)) + .setWeight(12) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Lead)) + .setWeight(3) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Steel)) + .setWeight(6) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Bronze)) + .setWeight(6) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Manganese)) + .setWeight(6) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Sapphire)) + .setWeight(2) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GreenSapphire)) + .setWeight(2) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Olivine)) + .setWeight(2) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GarnetRed)) + .setWeight(2) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.GarnetYellow)) + .setWeight(2) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Ruby)) + .setWeight(2) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.gem, GTMaterials.Emerald)) + .setWeight(2) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.DamascusSteel)) + .setWeight(1) + .apply(setCount(between(3, 12)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.DamascusSteel)) + .setWeight(1) + .apply(setCount(between(1, 4)))); + } + + private static LootPool.Builder villageWeaponsmithLoot() { + return lootPool() + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.dust, GTMaterials.Chromium)) + .setWeight(6) + .apply(setCount(between(1, 4)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.dust, GTMaterials.Neodymium)) + .setWeight(6) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Manganese)) + .setWeight(12) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Steel)) + .setWeight(12) + .apply(setCount(between(4, 12)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Bronze)) + .setWeight(12) + .apply(setCount(between(4, 12)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Brass)) + .setWeight(12) + .apply(setCount(between(4, 12)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.DamascusSteel)) + .setWeight(1) + .apply(setCount(between(4, 12)))); + } + + private static LootPool.Builder strongholdCrossingLoot() { + return lootPool() + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.DamascusSteel)) + .setWeight(6) + .apply(setCount(between(4, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Steel)) + .setWeight(12) + .apply(setCount(between(8, 16)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Bronze)) + .setWeight(12) + .apply(setCount(between(8, 16)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.Manganese)) + .setWeight(12) + .apply(setCount(between(4, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.dust, GTMaterials.Neodymium)) + .setWeight(6) + .apply(setCount(between(4, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.dust, GTMaterials.Chromium)) + .setWeight(6) + .apply(setCount(between(2, 4)))); + } + + private static LootPool.Builder strongholdCorridorLoot() { + return lootPool() + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.DamascusSteel)) + .setWeight(1) + .apply(setCount(between(2, 8)))) + .add(lootTableItem(ChemicalHelper.getItem(TagPrefix.ingot, GTMaterials.DamascusSteel)) + .setWeight(1) + .apply(setCount(between(3, 12)))); + } + } +} +// spotless:on diff --git a/src/main/java/com/gregtechceu/gtceu/data/loot/NumberProviderShortcuts.java b/src/main/java/com/gregtechceu/gtceu/data/loot/NumberProviderShortcuts.java new file mode 100644 index 00000000000..b3b02a0cb68 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/loot/NumberProviderShortcuts.java @@ -0,0 +1,63 @@ +package com.gregtechceu.gtceu.data.loot; + +import net.minecraft.world.level.storage.loot.providers.number.*; + +import lombok.experimental.UtilityClass; + +/** + * Utility class for working with loot tables and their number providers. To use this class efficiently, add the + * following static imports to your class: + * + *
{@code
+ * import static com.gregtechceu.gtceu.data.loot.NumberProviderShortcuts.*;
+ * import static net.minecraft.world.level.storage.loot.LootTable.lootTable;
+ * import static net.minecraft.world.level.storage.loot.LootPool.lootPool;
+ * import static net.minecraft.world.level.storage.loot.entries.LootItem.lootTableItem;
+ * import static net.minecraft.world.level.storage.loot.functions.SetItemCountFunction.*;
+ * import static net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition.*;
+ * import static net.minecraft.world.level.storage.loot.providers.number.ConstantValue.*;
+ * import static net.minecraft.world.level.storage.loot.providers.number.UniformGenerator.*;
+ * import static net.minecraft.world.level.storage.loot.providers.number.BinomialDistributionGenerator.*;
+ * }
+ */ +@UtilityClass +public class NumberProviderShortcuts { + + // region CONSTANT VALUE + + public static ConstantValue constant(float value) { + return ConstantValue.exactly(value); + } + + // endregion // + // region UNIFORM GENERATOR + + public static UniformGenerator between(NumberProvider min, NumberProvider max) { + return new UniformGenerator(min, max); + } + + public static UniformGenerator between(float min, NumberProvider max) { + return between(constant(min), max); + } + + public static UniformGenerator between(NumberProvider min, float max) { + return between(min, constant(max)); + } + + // endregion // + // region BINOMIAL DISTRIBUTION GENERATOR + + public static BinomialDistributionGenerator binomial(NumberProvider n, NumberProvider p) { + return new BinomialDistributionGenerator(n, p); + } + + public static BinomialDistributionGenerator binomial(int n, NumberProvider p) { + return binomial(constant(n), p); + } + + public static BinomialDistributionGenerator binomial(NumberProvider n, float p) { + return binomial(n, constant(p)); + } + + // endregion // +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/loot/package-info.java b/src/main/java/com/gregtechceu/gtceu/data/loot/package-info.java new file mode 100644 index 00000000000..96e337c59d5 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/loot/package-info.java @@ -0,0 +1,4 @@ +@NotNullByDefault +package com.gregtechceu.gtceu.data.loot; + +import org.jetbrains.annotations.NotNullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java index c5abb8548a4..4a2375faedc 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java @@ -463,8 +463,9 @@ private static void processGemConversion(@NotNull RecipeOutput provider, @NotNul 'h', new MaterialEntry(prefix, material)); CUTTER_RECIPES - .recipeBuilder("cut_" + material.getName() + "_" + FormattingUtil.toLowerCaseUnderscore(prefix.getName()) + - "_to_" + FormattingUtil.toLowerCaseUnderscore(lowerPrefix.getName())) + .recipeBuilder( + "cut_" + material.getName() + "_" + FormattingUtil.toLowerCaseUnderscore(prefix.getName()) + + "_to_" + FormattingUtil.toLowerCaseUnderscore(lowerPrefix.getName())) .inputItems(prefix, material) .outputItems(prevStack) .duration(20) diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java index 21cef016167..29fe27c8cb5 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java @@ -8,7 +8,6 @@ import com.gregtechceu.gtceu.api.cosmetics.CapeRegistry; import com.gregtechceu.gtceu.api.data.RotationState; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; -import com.gregtechceu.gtceu.api.data.chemical.Element; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet; @@ -36,7 +35,6 @@ import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttributes; import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; import com.gregtechceu.gtceu.api.item.tool.GTToolType; -import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.SimpleGeneratorMachine; import com.gregtechceu.gtceu.api.machine.SimpleTieredMachine; import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; @@ -46,7 +44,6 @@ import com.gregtechceu.gtceu.api.multiblock.pattern.MultiblockPatternBuilder; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.OverclockingLogic; -import com.gregtechceu.gtceu.api.recipe.category.GTRecipeCategory; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.ingredient.EnergyStack; import com.gregtechceu.gtceu.api.recipe.modifier.ModifierFunction; @@ -94,11 +91,8 @@ import com.gregtechceu.gtceu.integration.kjs.recipe.KJSHelpers; import com.gregtechceu.gtceu.integration.kjs.recipe.components.*; -import dev.latvian.mods.kubejs.util.RegistryAccessContainer; -import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.levelgen.placement.HeightRangePlacement; @@ -115,7 +109,6 @@ import dev.latvian.mods.kubejs.registry.ServerRegistryRegistry; import dev.latvian.mods.kubejs.script.BindingRegistry; import dev.latvian.mods.kubejs.script.TypeWrapperRegistry; -import dev.latvian.mods.rhino.Wrapper; public class GregTechKubeJSPlugin implements KubeJSPlugin { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/ElementBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/ElementBuilder.java index 9296bce3549..d984543e474 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/ElementBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/ElementBuilder.java @@ -1,7 +1,6 @@ package com.gregtechceu.gtceu.integration.kjs.builders; import com.gregtechceu.gtceu.api.data.chemical.Element; -import com.gregtechceu.gtceu.common.data.GTElements; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/GTRecipeCategoryBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/GTRecipeCategoryBuilder.java index 16ca3fd9a12..f5732e475f8 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/GTRecipeCategoryBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/GTRecipeCategoryBuilder.java @@ -2,7 +2,6 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.category.GTRecipeCategory; -import com.gregtechceu.gtceu.common.data.GTRecipeCategories; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.integration.recipeviewer.CategoryIcon; import com.gregtechceu.gtceu.utils.FormattingUtil; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/KJSMultiblockMachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/KJSMultiblockMachineBuilder.java index 7e005bf2dfe..d55e089ff71 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/KJSMultiblockMachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/KJSMultiblockMachineBuilder.java @@ -44,7 +44,8 @@ import java.util.function.*; @SuppressWarnings("unused") -public class KJSMultiblockMachineBuilder extends MachineBuilderWrapper> { +public class KJSMultiblockMachineBuilder extends + MachineBuilderWrapper> { public KJSMultiblockMachineBuilder(MultiblockMachineBuilder builder) { super(builder); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/MachineBuilderWrapper.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/MachineBuilderWrapper.java index 0f426dcfce1..45f64fad06e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/MachineBuilderWrapper.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/MachineBuilderWrapper.java @@ -7,7 +7,8 @@ import dev.latvian.mods.kubejs.generator.KubeAssetGenerator; import dev.latvian.mods.kubejs.registry.BuilderBase; -public class MachineBuilderWrapper> extends BuilderBase implements IMachineBuilderKJS { +public class MachineBuilderWrapper> + extends BuilderBase implements IMachineBuilderKJS { protected final B builder; @@ -34,8 +35,8 @@ public void generateAssets(KubeAssetGenerator generator) { @Override public void generateLang(LangKubeEvent lang) { D value = get(); - if (value != null && value.getLangValue() != null) { - lang.add(id.getNamespace(), value.getDescriptionId(), value.getLangValue()); + if (value != null && builder.langValue() != null) { + lang.add(id.getNamespace(), value.getDescriptionId(), builder.langValue()); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/material/MaterialIconSetBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/material/MaterialIconSetBuilder.java index 593db9d528d..e8b1f7eca46 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/material/MaterialIconSetBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/material/MaterialIconSetBuilder.java @@ -1,9 +1,11 @@ package com.gregtechceu.gtceu.integration.kjs.builders.material; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet; -import dev.latvian.mods.kubejs.registry.BuilderBase; + import net.minecraft.resources.ResourceLocation; +import dev.latvian.mods.kubejs.registry.BuilderBase; + public class MaterialIconSetBuilder extends BuilderBase { private transient MaterialIconSet parent; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/MaterialIconInfoEventJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/MaterialIconInfoEventJS.java index fb997a6f51e..e1b7cb70374 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/MaterialIconInfoEventJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/MaterialIconInfoEventJS.java @@ -1,10 +1,9 @@ package com.gregtechceu.gtceu.integration.kjs.events; -import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; - import com.gregtechceu.gtceu.integration.kjs.helpers.GTResourceLocation; + import dev.latvian.mods.kubejs.event.KubeStartupEvent; import dev.latvian.mods.kubejs.typings.Info; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/map/cache/WorldCache.java b/src/main/java/com/gregtechceu/gtceu/integration/map/cache/WorldCache.java index 3d6879262a1..1f1d7e74e38 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/map/cache/WorldCache.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/map/cache/WorldCache.java @@ -6,7 +6,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; -import net.minecraft.core.Registry; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.Level; @@ -48,7 +47,8 @@ public void oreVeinDefinitionsChanged(HolderLookup.RegistryLookup { - Optional> def = holderLookup.get(Objects.requireNonNull(vein.definition().getKey())); + Optional> def = holderLookup + .get(Objects.requireNonNull(vein.definition().getKey())); def.ifPresent(vein::definition); return def.isEmpty(); });