diff --git a/src/generated/resources/.cache/186a7e45361a88b552c7912073ed518df362271c b/src/generated/resources/.cache/186a7e45361a88b552c7912073ed518df362271c deleted file mode 100644 index 1cf5b31..0000000 --- a/src/generated/resources/.cache/186a7e45361a88b552c7912073ed518df362271c +++ /dev/null @@ -1,2 +0,0 @@ -// 1.20.4 2023-12-27T20:36:09.3152162 Tags for minecraft:item mod id examplemod -946b29706b966e8e4920bb8de01d2369a7c0bb04 data/minecraft/tags/items/beacon_payment_items.json diff --git a/src/generated/resources/.cache/1dc58ffe3d367c3c4cd8e636dc9c1e808cb57d48 b/src/generated/resources/.cache/1dc58ffe3d367c3c4cd8e636dc9c1e808cb57d48 deleted file mode 100644 index b381445..0000000 --- a/src/generated/resources/.cache/1dc58ffe3d367c3c4cd8e636dc9c1e808cb57d48 +++ /dev/null @@ -1,2 +0,0 @@ -// 1.20.4 2023-12-27T20:36:09.3162181 Tags for minecraft:block mod id examplemod -fe6518e13f10a9145b0d6094a33f90787be0f46d data/minecraft/tags/blocks/beacon_base_blocks.json diff --git a/src/generated/resources/.cache/7c45e3a26743e6bc23a95e57dd2dfc0d535855dd b/src/generated/resources/.cache/7c45e3a26743e6bc23a95e57dd2dfc0d535855dd deleted file mode 100644 index 2c864bf..0000000 --- a/src/generated/resources/.cache/7c45e3a26743e6bc23a95e57dd2dfc0d535855dd +++ /dev/null @@ -1,2 +0,0 @@ -// 1.20.4 2023-12-27T20:36:09.3142169 Languages: en_us for mod: examplemod -02296fe4e0f378d52c4af93f5b0644da23a34775 assets/examplemod/lang/en_us.json diff --git a/src/generated/resources/.cache/dd7a2de88d5e2bc9952141ad41dd64dd256819dd b/src/generated/resources/.cache/dd7a2de88d5e2bc9952141ad41dd64dd256819dd deleted file mode 100644 index 8efee01..0000000 --- a/src/generated/resources/.cache/dd7a2de88d5e2bc9952141ad41dd64dd256819dd +++ /dev/null @@ -1,2 +0,0 @@ -// 1.20.4 2023-12-27T20:36:09.3162181 Item Models: examplemod -af0d8df01e38c368aa227d28d9f4050fedcf032a assets/examplemod/models/item/example_item.json diff --git a/src/generated/resources/.cache/f7a5848ef36663c31e497ab9c2542cab6060a2e2 b/src/generated/resources/.cache/f7a5848ef36663c31e497ab9c2542cab6060a2e2 deleted file mode 100644 index c25ee65..0000000 --- a/src/generated/resources/.cache/f7a5848ef36663c31e497ab9c2542cab6060a2e2 +++ /dev/null @@ -1,4 +0,0 @@ -// 1.20.4 2023-12-27T20:58:52.4384507 Block States: examplemod -c1179f903b7e75f188bc87b191d646264a7c1c10 assets/examplemod/blockstates/example_block.json -b94bf7c289775bcceb040d513373e37f35daf237 assets/examplemod/models/block/example_block.json -b3379e282d4a356e9dc8e8007b71d0eac6948db4 assets/examplemod/models/item/example_block.json diff --git a/src/generated/resources/assets/examplemod/blockstates/example_block.json b/src/generated/resources/assets/examplemod/blockstates/example_block.json deleted file mode 100644 index a94cb7b..0000000 --- a/src/generated/resources/assets/examplemod/blockstates/example_block.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "examplemod:block/example_block" - } - } -} \ No newline at end of file diff --git a/src/generated/resources/assets/examplemod/lang/en_us.json b/src/generated/resources/assets/examplemod/lang/en_us.json deleted file mode 100644 index 9ac3dc3..0000000 --- a/src/generated/resources/assets/examplemod/lang/en_us.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "block.examplemod.example_block": "Example Block", - "item.examplemod.example_item": "Example Item", - "itemGroup.examplemod.example": "Example Mod" -} \ No newline at end of file diff --git a/src/generated/resources/assets/examplemod/models/item/example_block.json b/src/generated/resources/assets/examplemod/models/item/example_block.json deleted file mode 100644 index 0f8540d..0000000 --- a/src/generated/resources/assets/examplemod/models/item/example_block.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "examplemod:block/example_block" -} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/blockstates/coal_generator.json b/src/generated/resources/assets/usefulmachinery/blockstates/coal_generator.json new file mode 100644 index 0000000..7fde98d --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/blockstates/coal_generator.json @@ -0,0 +1,34 @@ +{ + "variants": { + "facing=east,lit=false": { + "model": "usefulmachinery:block/coal_generator", + "y": 90 + }, + "facing=east,lit=true": { + "model": "usefulmachinery:block/coal_generator_on", + "y": 90 + }, + "facing=north,lit=false": { + "model": "usefulmachinery:block/coal_generator" + }, + "facing=north,lit=true": { + "model": "usefulmachinery:block/coal_generator_on" + }, + "facing=south,lit=false": { + "model": "usefulmachinery:block/coal_generator", + "y": 180 + }, + "facing=south,lit=true": { + "model": "usefulmachinery:block/coal_generator_on", + "y": 180 + }, + "facing=west,lit=false": { + "model": "usefulmachinery:block/coal_generator", + "y": 270 + }, + "facing=west,lit=true": { + "model": "usefulmachinery:block/coal_generator_on", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/blockstates/compactor.json b/src/generated/resources/assets/usefulmachinery/blockstates/compactor.json new file mode 100644 index 0000000..c5b1a6d --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/blockstates/compactor.json @@ -0,0 +1,34 @@ +{ + "variants": { + "facing=east,lit=false": { + "model": "usefulmachinery:block/compactor", + "y": 90 + }, + "facing=east,lit=true": { + "model": "usefulmachinery:block/compactor_on", + "y": 90 + }, + "facing=north,lit=false": { + "model": "usefulmachinery:block/compactor" + }, + "facing=north,lit=true": { + "model": "usefulmachinery:block/compactor_on" + }, + "facing=south,lit=false": { + "model": "usefulmachinery:block/compactor", + "y": 180 + }, + "facing=south,lit=true": { + "model": "usefulmachinery:block/compactor_on", + "y": 180 + }, + "facing=west,lit=false": { + "model": "usefulmachinery:block/compactor", + "y": 270 + }, + "facing=west,lit=true": { + "model": "usefulmachinery:block/compactor_on", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/blockstates/creative_power_cell.json b/src/generated/resources/assets/usefulmachinery/blockstates/creative_power_cell.json new file mode 100644 index 0000000..af23928 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/blockstates/creative_power_cell.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "usefulmachinery:block/redstone_block" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/blockstates/crusher.json b/src/generated/resources/assets/usefulmachinery/blockstates/crusher.json new file mode 100644 index 0000000..b68e00b --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/blockstates/crusher.json @@ -0,0 +1,34 @@ +{ + "variants": { + "facing=east,lit=false": { + "model": "usefulmachinery:block/crusher", + "y": 90 + }, + "facing=east,lit=true": { + "model": "usefulmachinery:block/crusher_on", + "y": 90 + }, + "facing=north,lit=false": { + "model": "usefulmachinery:block/crusher" + }, + "facing=north,lit=true": { + "model": "usefulmachinery:block/crusher_on" + }, + "facing=south,lit=false": { + "model": "usefulmachinery:block/crusher", + "y": 180 + }, + "facing=south,lit=true": { + "model": "usefulmachinery:block/crusher_on", + "y": 180 + }, + "facing=west,lit=false": { + "model": "usefulmachinery:block/crusher", + "y": 270 + }, + "facing=west,lit=true": { + "model": "usefulmachinery:block/crusher_on", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/blockstates/electric_smelter.json b/src/generated/resources/assets/usefulmachinery/blockstates/electric_smelter.json new file mode 100644 index 0000000..74f839b --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/blockstates/electric_smelter.json @@ -0,0 +1,34 @@ +{ + "variants": { + "facing=east,lit=false": { + "model": "usefulmachinery:block/electric_smelter", + "y": 90 + }, + "facing=east,lit=true": { + "model": "usefulmachinery:block/electric_smelter_on", + "y": 90 + }, + "facing=north,lit=false": { + "model": "usefulmachinery:block/electric_smelter" + }, + "facing=north,lit=true": { + "model": "usefulmachinery:block/electric_smelter_on" + }, + "facing=south,lit=false": { + "model": "usefulmachinery:block/electric_smelter", + "y": 180 + }, + "facing=south,lit=true": { + "model": "usefulmachinery:block/electric_smelter_on", + "y": 180 + }, + "facing=west,lit=false": { + "model": "usefulmachinery:block/electric_smelter", + "y": 270 + }, + "facing=west,lit=true": { + "model": "usefulmachinery:block/electric_smelter_on", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/blockstates/lava_generator.json b/src/generated/resources/assets/usefulmachinery/blockstates/lava_generator.json new file mode 100644 index 0000000..898ca25 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/blockstates/lava_generator.json @@ -0,0 +1,34 @@ +{ + "variants": { + "facing=east,lit=false": { + "model": "usefulmachinery:block/lava_generator", + "y": 90 + }, + "facing=east,lit=true": { + "model": "usefulmachinery:block/lava_generator_on", + "y": 90 + }, + "facing=north,lit=false": { + "model": "usefulmachinery:block/lava_generator" + }, + "facing=north,lit=true": { + "model": "usefulmachinery:block/lava_generator_on" + }, + "facing=south,lit=false": { + "model": "usefulmachinery:block/lava_generator", + "y": 180 + }, + "facing=south,lit=true": { + "model": "usefulmachinery:block/lava_generator_on", + "y": 180 + }, + "facing=west,lit=false": { + "model": "usefulmachinery:block/lava_generator", + "y": 270 + }, + "facing=west,lit=true": { + "model": "usefulmachinery:block/lava_generator_on", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/lang/en_us.json b/src/generated/resources/assets/usefulmachinery/lang/en_us.json new file mode 100644 index 0000000..fa2665b --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/lang/en_us.json @@ -0,0 +1,42 @@ +{ + "block.usefulmachinery.coal_generator": "Coal Generator", + "block.usefulmachinery.compactor": "Compactor", + "block.usefulmachinery.creative_power_cell": "Creative Power Cell", + "block.usefulmachinery.crusher": "Crusher", + "block.usefulmachinery.electric_smelter": "Electric Smelter", + "block.usefulmachinery.lava_generator": "Lava Generator", + "container.usefulmachinery.coal_generator": "Coal Generator", + "container.usefulmachinery.compactor": "Compactor", + "container.usefulmachinery.crusher": "Crusher", + "container.usefulmachinery.electric_smelter": "Electric Smelter", + "container.usefulmachinery.lava_generator": "Lava Generator", + "item.usefulmachinery.battery": "Battery", + "item.usefulmachinery.compactor_kit": "Compactor Kit", + "item.usefulmachinery.efficiency_upgrade": "Efficiency Upgrade", + "item.usefulmachinery.machine_frame": "Machine Frame", + "item.usefulmachinery.precision_upgrade": "Precision Upgrade", + "item.usefulmachinery.sustained_upgrade": "Sustained Upgrade", + "item.usefulmachinery.tier_upgrade_basic": "Basic Upgrade", + "item.usefulmachinery.tier_upgrade_factory": "Factory Upgrade", + "item.usefulmachinery.tier_upgrade_overkill": "Overkill Upgrade", + "item.usefulmachinery.tier_upgrade_reinforced": "Reinforced Upgrade", + "itemGroup.usefulmachinery.base": "Useful Machinery", + "jei.usefulmachinery.compacting": "Compacting", + "jei.usefulmachinery.crushing": "Crushing", + "jei.usefulmachinery.electric_smelting": "Electric Smelting", + "jei.usefulmachinery.fuel": "Fuel for RF", + "misc.usefulmachinery.compact_block": "Block Former", + "misc.usefulmachinery.compact_gear": "Gear Manufacturing", + "misc.usefulmachinery.compact_plate": "Plate Press", + "misc.usefulmachinery.empty": "Empty", + "misc.usefulmachinery.energy": "%s FE", + "misc.usefulmachinery.energyWithMax": "%s / %s FE", + "misc.usefulmachinery.fluidWithMax": "%s / %s mB", + "misc.usefulmachinery.fluidWithMaxName": "%s, %s / %s mB", + "misc.usefulmachinery.redstoneMode": "Redstone Mode, %s", + "stat.usefulmachinery.interact_with_coal_generator": "Interactions with Coal Generator", + "stat.usefulmachinery.interact_with_compactor": "Interactions with Compactor", + "stat.usefulmachinery.interact_with_crusher": "Interactions with Crusher", + "stat.usefulmachinery.interact_with_electric_smelter": "Interactions with Electric Smelter", + "stat.usefulmachinery.interact_with_lava_generator": "Interactions with Lava Generator" +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/block/coal_generator.json b/src/generated/resources/assets/usefulmachinery/models/block/coal_generator.json new file mode 100644 index 0000000..f720824 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/block/coal_generator.json @@ -0,0 +1,7 @@ +{ + "parent": "usefulmachinery:block/machine_block", + "render_type": "minecraft:cutout", + "textures": { + "front": "usefulmachinery:block/coal_generator_front" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/block/coal_generator_on.json b/src/generated/resources/assets/usefulmachinery/models/block/coal_generator_on.json new file mode 100644 index 0000000..97a456a --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/block/coal_generator_on.json @@ -0,0 +1,7 @@ +{ + "parent": "usefulmachinery:block/machine_block", + "render_type": "minecraft:cutout", + "textures": { + "front": "usefulmachinery:block/coal_generator_front_on" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/block/compactor.json b/src/generated/resources/assets/usefulmachinery/models/block/compactor.json new file mode 100644 index 0000000..c46a530 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/block/compactor.json @@ -0,0 +1,7 @@ +{ + "parent": "usefulmachinery:block/machine_block", + "render_type": "minecraft:cutout", + "textures": { + "front": "usefulmachinery:block/compactor_front" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/block/compactor_on.json b/src/generated/resources/assets/usefulmachinery/models/block/compactor_on.json new file mode 100644 index 0000000..079613b --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/block/compactor_on.json @@ -0,0 +1,7 @@ +{ + "parent": "usefulmachinery:block/machine_block", + "render_type": "minecraft:cutout", + "textures": { + "front": "usefulmachinery:block/compactor_front_on" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/block/crusher.json b/src/generated/resources/assets/usefulmachinery/models/block/crusher.json new file mode 100644 index 0000000..06b9b8d --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/block/crusher.json @@ -0,0 +1,7 @@ +{ + "parent": "usefulmachinery:block/machine_block", + "render_type": "minecraft:cutout", + "textures": { + "front": "usefulmachinery:block/crusher_front" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/block/crusher_on.json b/src/generated/resources/assets/usefulmachinery/models/block/crusher_on.json new file mode 100644 index 0000000..83f7b25 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/block/crusher_on.json @@ -0,0 +1,7 @@ +{ + "parent": "usefulmachinery:block/machine_block", + "render_type": "minecraft:cutout", + "textures": { + "front": "usefulmachinery:block/crusher_front_on" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/block/electric_smelter.json b/src/generated/resources/assets/usefulmachinery/models/block/electric_smelter.json new file mode 100644 index 0000000..b6d7edf --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/block/electric_smelter.json @@ -0,0 +1,7 @@ +{ + "parent": "usefulmachinery:block/machine_block", + "render_type": "minecraft:cutout", + "textures": { + "front": "usefulmachinery:block/electric_smelter_front" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/block/electric_smelter_on.json b/src/generated/resources/assets/usefulmachinery/models/block/electric_smelter_on.json new file mode 100644 index 0000000..ab5e99b --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/block/electric_smelter_on.json @@ -0,0 +1,7 @@ +{ + "parent": "usefulmachinery:block/machine_block", + "render_type": "minecraft:cutout", + "textures": { + "front": "usefulmachinery:block/electric_smelter_front_on" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/block/lava_generator.json b/src/generated/resources/assets/usefulmachinery/models/block/lava_generator.json new file mode 100644 index 0000000..f65b748 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/block/lava_generator.json @@ -0,0 +1,7 @@ +{ + "parent": "usefulmachinery:block/machine_block", + "render_type": "minecraft:cutout", + "textures": { + "front": "usefulmachinery:block/lava_generator_front" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/block/lava_generator_on.json b/src/generated/resources/assets/usefulmachinery/models/block/lava_generator_on.json new file mode 100644 index 0000000..57d8791 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/block/lava_generator_on.json @@ -0,0 +1,7 @@ +{ + "parent": "usefulmachinery:block/machine_block", + "render_type": "minecraft:cutout", + "textures": { + "front": "usefulmachinery:block/lava_generator_front_on" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/examplemod/models/block/example_block.json b/src/generated/resources/assets/usefulmachinery/models/block/redstone_block.json similarity index 58% rename from src/generated/resources/assets/examplemod/models/block/example_block.json rename to src/generated/resources/assets/usefulmachinery/models/block/redstone_block.json index 37eab76..b3942b3 100644 --- a/src/generated/resources/assets/examplemod/models/block/example_block.json +++ b/src/generated/resources/assets/usefulmachinery/models/block/redstone_block.json @@ -1,6 +1,6 @@ { "parent": "minecraft:block/cube_all", "textures": { - "all": "minecraft:block/cauldron_inner" + "all": "minecraft:block/redstone_block" } } \ No newline at end of file diff --git a/src/generated/resources/assets/examplemod/models/item/example_item.json b/src/generated/resources/assets/usefulmachinery/models/item/battery.json similarity index 58% rename from src/generated/resources/assets/examplemod/models/item/example_item.json rename to src/generated/resources/assets/usefulmachinery/models/item/battery.json index 94849ea..4c01e1f 100644 --- a/src/generated/resources/assets/examplemod/models/item/example_item.json +++ b/src/generated/resources/assets/usefulmachinery/models/item/battery.json @@ -1,6 +1,6 @@ { "parent": "minecraft:item/generated", "textures": { - "layer0": "examplemod:item/example_item" + "layer0": "usefulmachinery:item/battery" } } \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/coal_generator.json b/src/generated/resources/assets/usefulmachinery/models/item/coal_generator.json new file mode 100644 index 0000000..4f52b4c --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/coal_generator.json @@ -0,0 +1,3 @@ +{ + "parent": "usefulmachinery:block/coal_generator" +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/compactor.json b/src/generated/resources/assets/usefulmachinery/models/item/compactor.json new file mode 100644 index 0000000..6344c19 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/compactor.json @@ -0,0 +1,3 @@ +{ + "parent": "usefulmachinery:block/compactor" +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/compactor_kit.json b/src/generated/resources/assets/usefulmachinery/models/item/compactor_kit.json new file mode 100644 index 0000000..f7bc20f --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/compactor_kit.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "usefulfoundation:item/lead_plate", + "layer1": "usefulfoundation:item/gold_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/creative_power_cell.json b/src/generated/resources/assets/usefulmachinery/models/item/creative_power_cell.json new file mode 100644 index 0000000..11fce49 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/creative_power_cell.json @@ -0,0 +1,3 @@ +{ + "parent": "usefulmachinery:block/redstone_block" +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/crusher.json b/src/generated/resources/assets/usefulmachinery/models/item/crusher.json new file mode 100644 index 0000000..aa7817c --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/crusher.json @@ -0,0 +1,3 @@ +{ + "parent": "usefulmachinery:block/crusher" +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/efficiency_upgrade.json b/src/generated/resources/assets/usefulmachinery/models/item/efficiency_upgrade.json new file mode 100644 index 0000000..2ff2d1f --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/efficiency_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "usefulmachinery:item/efficiency_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/electric_smelter.json b/src/generated/resources/assets/usefulmachinery/models/item/electric_smelter.json new file mode 100644 index 0000000..ebf6b15 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/electric_smelter.json @@ -0,0 +1,3 @@ +{ + "parent": "usefulmachinery:block/electric_smelter" +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/lava_generator.json b/src/generated/resources/assets/usefulmachinery/models/item/lava_generator.json new file mode 100644 index 0000000..39a4f38 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/lava_generator.json @@ -0,0 +1,3 @@ +{ + "parent": "usefulmachinery:block/lava_generator" +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/machine_frame.json b/src/generated/resources/assets/usefulmachinery/models/item/machine_frame.json new file mode 100644 index 0000000..8ad413b --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/machine_frame.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "usefulmachinery:block/machine_frame" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/precision_upgrade.json b/src/generated/resources/assets/usefulmachinery/models/item/precision_upgrade.json new file mode 100644 index 0000000..3c57655 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/precision_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "usefulmachinery:item/precision_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/sustained_upgrade.json b/src/generated/resources/assets/usefulmachinery/models/item/sustained_upgrade.json new file mode 100644 index 0000000..f7dd9b6 --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/sustained_upgrade.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "usefulmachinery:item/sustained_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/usefulmachinery/models/item/tier_upgrade.json b/src/generated/resources/assets/usefulmachinery/models/item/tier_upgrade.json new file mode 100644 index 0000000..78beafe --- /dev/null +++ b/src/generated/resources/assets/usefulmachinery/models/item/tier_upgrade.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "usefulmachinery:item/tier_upgrade_0", + "layer1": "usefulmachinery:item/tier_upgrade_1" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/batteries.json b/src/generated/resources/data/forge/tags/items/batteries.json new file mode 100644 index 0000000..068bff6 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/batteries.json @@ -0,0 +1,5 @@ +{ + "values": [ + "usefulmachinery:battery" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/beacon_base_blocks.json b/src/generated/resources/data/minecraft/tags/blocks/beacon_base_blocks.json deleted file mode 100644 index 35dcc65..0000000 --- a/src/generated/resources/data/minecraft/tags/blocks/beacon_base_blocks.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "examplemod:example_block" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json new file mode 100644 index 0000000..50acdfd --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -0,0 +1,9 @@ +{ + "values": [ + "usefulmachinery:coal_generator", + "usefulmachinery:compactor", + "usefulmachinery:crusher", + "usefulmachinery:electric_smelter", + "usefulmachinery:lava_generator" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/items/beacon_payment_items.json b/src/generated/resources/data/minecraft/tags/items/beacon_payment_items.json deleted file mode 100644 index 59740bc..0000000 --- a/src/generated/resources/data/minecraft/tags/items/beacon_payment_items.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "examplemod:example_item" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_block_from_compacting.json new file mode 100644 index 0000000..c56d6fa --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_aluminum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/aluminum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:aluminum_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_aluminum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:aluminum_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_dust_from_crushing.json new file mode 100644 index 0000000..98cd9a0 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_aluminum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/aluminum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:aluminum_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_aluminum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:aluminum_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_gear_from_compacting.json new file mode 100644 index 0000000..8ea4e55 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_aluminum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/aluminum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:aluminum_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_aluminum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:aluminum_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_plate_from_compacting.json new file mode 100644 index 0000000..84ae49f --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/aluminum_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_aluminum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/aluminum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:aluminum_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_aluminum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:aluminum_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_block_from_compacting.json new file mode 100644 index 0000000..4256cd4 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_bronze": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/bronze" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:bronze_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_bronze" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:bronze_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_dust_from_crushing.json new file mode 100644 index 0000000..8220df2 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_bronze": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/bronze" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:bronze_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_bronze" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:bronze_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_gear_from_compacting.json new file mode 100644 index 0000000..bda8ff9 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_bronze": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/bronze" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:bronze_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_bronze" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:bronze_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_plate_from_compacting.json new file mode 100644 index 0000000..f41945c --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/bronze_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_bronze": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/bronze" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:bronze_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_bronze" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:bronze_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_block_from_compacting.json new file mode 100644 index 0000000..37462a9 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_copper": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/copper" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:copper_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_copper" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:copper_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_dust_from_crushing.json new file mode 100644 index 0000000..d38d23c --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_copper": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/copper" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:copper_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_copper" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:copper_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_gear_from_compacting.json new file mode 100644 index 0000000..e41aee1 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_copper": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/copper" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:copper_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_copper" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:copper_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_plate_from_compacting.json new file mode 100644 index 0000000..1ddc2ce --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/copper_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_copper": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/copper" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:copper_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_copper" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:copper_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/diamond_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/diamond_dust_from_crushing.json new file mode 100644 index 0000000..ab98c21 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/diamond_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_diamond": { + "conditions": { + "items": [ + { + "tag": "forge:gems/diamond" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:diamond_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_diamond" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:diamond_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/diamond_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/diamond_gear_from_compacting.json new file mode 100644 index 0000000..b9f9e7d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/diamond_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_diamond": { + "conditions": { + "items": [ + { + "tag": "forge:gems/diamond" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:diamond_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_diamond" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:diamond_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/diamond_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/diamond_plate_from_compacting.json new file mode 100644 index 0000000..d91a782 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/diamond_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_diamond": { + "conditions": { + "items": [ + { + "tag": "forge:gems/diamond" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:diamond_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_diamond" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:diamond_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_block_from_compacting.json new file mode 100644 index 0000000..047b79a --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_electrum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/electrum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:electrum_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_electrum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:electrum_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_dust_from_crushing.json new file mode 100644 index 0000000..57f83e8 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_electrum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/electrum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:electrum_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_electrum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:electrum_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_gear_from_compacting.json new file mode 100644 index 0000000..ab97e7f --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_electrum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/electrum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:electrum_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_electrum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:electrum_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_plate_from_compacting.json new file mode 100644 index 0000000..668171f --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/electrum_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_electrum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/electrum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:electrum_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_electrum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:electrum_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_block_from_compacting.json new file mode 100644 index 0000000..c55482f --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_enderium": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/enderium" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:enderium_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_enderium" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:enderium_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_dust_from_crushing.json new file mode 100644 index 0000000..4dc0f5b --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_enderium": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/enderium" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:enderium_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_enderium" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:enderium_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_gear_from_compacting.json new file mode 100644 index 0000000..92bd275 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_enderium": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/enderium" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:enderium_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_enderium" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:enderium_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_plate_from_compacting.json new file mode 100644 index 0000000..0acffc9 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/enderium_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_enderium": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/enderium" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:enderium_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_enderium" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:enderium_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_block_from_compacting.json new file mode 100644 index 0000000..1a1ed83 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_gold": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/gold" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:gold_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gold" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:gold_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_dust_from_crushing.json new file mode 100644 index 0000000..a9168f9 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_gold": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/gold" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:gold_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gold" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:gold_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_gear_from_compacting.json new file mode 100644 index 0000000..c83142b --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_gold": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/gold" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:gold_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gold" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:gold_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_plate_from_compacting.json new file mode 100644 index 0000000..32fd68d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/gold_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_gold": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/gold" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:gold_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gold" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:gold_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_block_from_compacting.json new file mode 100644 index 0000000..98b80d2 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_invar": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/invar" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:invar_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_invar" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:invar_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_dust_from_crushing.json new file mode 100644 index 0000000..eb451bd --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_invar": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/invar" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:invar_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_invar" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:invar_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_gear_from_compacting.json new file mode 100644 index 0000000..0e5ddad --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_invar": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/invar" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:invar_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_invar" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:invar_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_plate_from_compacting.json new file mode 100644 index 0000000..e8066d4 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/invar_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_invar": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/invar" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:invar_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_invar" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:invar_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_block_from_compacting.json new file mode 100644 index 0000000..85e73cb --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_iron": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/iron" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:iron_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_iron" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:iron_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_dust_from_crushing.json new file mode 100644 index 0000000..2dbd064 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_iron": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/iron" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:iron_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_iron" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:iron_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_gear_from_compacting.json new file mode 100644 index 0000000..a282e8d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_iron": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/iron" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:iron_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_iron" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:iron_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_plate_from_compacting.json new file mode 100644 index 0000000..96ec0d9 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/iron_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_iron": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/iron" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:iron_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_iron" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:iron_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_block_from_compacting.json new file mode 100644 index 0000000..02af67d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_lead": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/lead" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:lead_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_lead" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:lead_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_dust_from_crushing.json new file mode 100644 index 0000000..4bff12e --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_lead": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/lead" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:lead_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_lead" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:lead_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_gear_from_compacting.json new file mode 100644 index 0000000..cfb7743 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_lead": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/lead" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:lead_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_lead" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:lead_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_plate_from_compacting.json new file mode 100644 index 0000000..b47828b --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/lead_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_lead": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/lead" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:lead_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_lead" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:lead_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/battery.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/battery.json new file mode 100644 index 0000000..321efb5 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/battery.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:battery" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_tin_ingot": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/tin" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_tin_ingot" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:battery" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/coal_generator.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/coal_generator.json new file mode 100644 index 0000000..4532bc4 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/coal_generator.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_machine_frame": { + "conditions": { + "items": [ + { + "items": [ + "usefulmachinery:machine_frame" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:coal_generator" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_machine_frame" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:coal_generator" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/compactor.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/compactor.json new file mode 100644 index 0000000..889db46 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/compactor.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_machine_frame": { + "conditions": { + "items": [ + { + "items": [ + "usefulmachinery:machine_frame" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:compactor" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_machine_frame" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:compactor" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/compactor_kit.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/compactor_kit.json new file mode 100644 index 0000000..9b2f220 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/compactor_kit.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_hammer": { + "conditions": { + "items": [ + { + "items": [ + "usefulfoundation:hammer" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:compactor_kit" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_hammer" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:compactor_kit" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/crusher.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/crusher.json new file mode 100644 index 0000000..5ffbfd3 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/crusher.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_machine_frame": { + "conditions": { + "items": [ + { + "items": [ + "usefulmachinery:machine_frame" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:crusher" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_machine_frame" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:crusher" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/efficiency_upgrade.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/efficiency_upgrade.json new file mode 100644 index 0000000..f01b8e6 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/efficiency_upgrade.json @@ -0,0 +1,45 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_flint": { + "conditions": { + "items": [ + { + "items": [ + "minecraft:flint" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_redstone_dust": { + "conditions": { + "items": [ + { + "tag": "forge:dusts/redstone" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:efficiency_upgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_flint", + "has_redstone_dust" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:efficiency_upgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/electric_smelter.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/electric_smelter.json new file mode 100644 index 0000000..9d1ba6f --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/electric_smelter.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_furnace": { + "conditions": { + "items": [ + { + "items": [ + "minecraft:furnace" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:electric_smelter" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_furnace" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:electric_smelter" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/lava_generator.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/lava_generator.json new file mode 100644 index 0000000..b25bf86 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/lava_generator.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_machine_frame": { + "conditions": { + "items": [ + { + "items": [ + "usefulmachinery:machine_frame" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:lava_generator" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_machine_frame" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:lava_generator" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/machine_frame.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/machine_frame.json new file mode 100644 index 0000000..473af78 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/machine_frame.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:machine_frame" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_tin_ingot": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/tin" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_tin_ingot" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:machine_frame" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/precision_upgrade.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/precision_upgrade.json new file mode 100644 index 0000000..0d979c1 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/misc/precision_upgrade.json @@ -0,0 +1,43 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_amethyst_shard": { + "conditions": { + "items": [ + { + "tag": "forge:gems/amethyst" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_glowstone_dust": { + "conditions": { + "items": [ + { + "tag": "forge:dusts/glowstone" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:precision_upgrade" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_amethyst_shard", + "has_glowstone_dust" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:precision_upgrade" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_block_from_compacting.json new file mode 100644 index 0000000..8b61781 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_nickel": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/nickel" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:nickel_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_nickel" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:nickel_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_dust_from_crushing.json new file mode 100644 index 0000000..5597a6a --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_nickel": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/nickel" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:nickel_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_nickel" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:nickel_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_gear_from_compacting.json new file mode 100644 index 0000000..4d655e1 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_nickel": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/nickel" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:nickel_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_nickel" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:nickel_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_plate_from_compacting.json new file mode 100644 index 0000000..9ec8af1 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/nickel_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_nickel": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/nickel" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:nickel_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_nickel" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:nickel_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_block_from_compacting.json new file mode 100644 index 0000000..69f8fba --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_platinum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/platinum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:platinum_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_platinum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:platinum_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_dust_from_crushing.json new file mode 100644 index 0000000..3dcb0a2 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_platinum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/platinum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:platinum_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_platinum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:platinum_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_gear_from_compacting.json new file mode 100644 index 0000000..c471184 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_platinum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/platinum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:platinum_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_platinum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:platinum_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_plate_from_compacting.json new file mode 100644 index 0000000..24cbd3d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/platinum_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_platinum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/platinum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:platinum_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_platinum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:platinum_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_aluminum_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_aluminum_from_ore.json new file mode 100644 index 0000000..814bfee --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_aluminum_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_aluminum_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/aluminum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_aluminum_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_aluminum_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_aluminum_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_copper_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_copper_from_ore.json new file mode 100644 index 0000000..32b215a --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_copper_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_copper_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/copper" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_copper_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_copper_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_copper_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_diamond_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_diamond_from_ore.json new file mode 100644 index 0000000..99c10ae --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_diamond_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_diamond_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/diamond" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_diamond_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_diamond_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_diamond_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_gold_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_gold_from_ore.json new file mode 100644 index 0000000..b467c02 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_gold_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_gold_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/gold" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_gold_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gold_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_gold_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_iron_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_iron_from_ore.json new file mode 100644 index 0000000..a3c2ff7 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_iron_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_iron_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/iron" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_iron_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_iron_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_iron_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_lead_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_lead_from_ore.json new file mode 100644 index 0000000..faed539 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_lead_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_lead_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/lead" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_lead_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_lead_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_lead_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_nickel_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_nickel_from_ore.json new file mode 100644 index 0000000..0087b22 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_nickel_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_nickel_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/nickel" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_nickel_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_nickel_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_nickel_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_platinum_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_platinum_from_ore.json new file mode 100644 index 0000000..3dfc1ae --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_platinum_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_platinum_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/platinum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_platinum_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_platinum_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_platinum_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_silver_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_silver_from_ore.json new file mode 100644 index 0000000..c4e38bb --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_silver_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_silver_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/silver" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_silver_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_silver_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_silver_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_tin_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_tin_from_ore.json new file mode 100644 index 0000000..29d7650 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_tin_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_tin_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_tin_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/tin" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_tin_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_tin_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_uranium_from_ore.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_uranium_from_ore.json new file mode 100644 index 0000000..e80fca2 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/raw_uranium_from_ore.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:raw_uranium_from_ore" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_uranium_ore": { + "conditions": { + "items": [ + { + "tag": "forge:ores/uranium" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_uranium_ore" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:raw_uranium_from_ore" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_block_from_compacting.json new file mode 100644 index 0000000..46ae402 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_signalum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/signalum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:signalum_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_signalum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:signalum_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_dust_from_crushing.json new file mode 100644 index 0000000..f895b08 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_signalum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/signalum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:signalum_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_signalum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:signalum_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_gear_from_compacting.json new file mode 100644 index 0000000..16e159d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_signalum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/signalum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:signalum_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_signalum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:signalum_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_plate_from_compacting.json new file mode 100644 index 0000000..9fd51ab --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/signalum_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_signalum": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/signalum" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:signalum_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_signalum" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:signalum_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_block_from_compacting.json new file mode 100644 index 0000000..c5e777a --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_silver": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/silver" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:silver_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_silver" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:silver_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_dust_from_crushing.json new file mode 100644 index 0000000..449a5f5 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_silver": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/silver" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:silver_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_silver" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:silver_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_gear_from_compacting.json new file mode 100644 index 0000000..5644a1d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_silver": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/silver" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:silver_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_silver" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:silver_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_plate_from_compacting.json new file mode 100644 index 0000000..73ca6fd --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/silver_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_silver": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/silver" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:silver_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_silver" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:silver_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_block_from_compacting.json new file mode 100644 index 0000000..f3f41b4 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_steel": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/steel" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:steel_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_steel" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:steel_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_dust_from_crushing.json new file mode 100644 index 0000000..b2909a8 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_steel": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/steel" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:steel_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_steel" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:steel_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_gear_from_compacting.json new file mode 100644 index 0000000..492fefc --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_steel": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/steel" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:steel_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_steel" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:steel_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_plate_from_compacting.json new file mode 100644 index 0000000..bbc7aa1 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/steel_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_steel": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/steel" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:steel_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_steel" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:steel_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_block_from_compacting.json new file mode 100644 index 0000000..0265d43 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:tin_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_tin": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/tin" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_tin" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:tin_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_dust_from_crushing.json new file mode 100644 index 0000000..badc03e --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:tin_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_tin": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/tin" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_tin" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:tin_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_gear_from_compacting.json new file mode 100644 index 0000000..50cf483 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:tin_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_tin": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/tin" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_tin" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:tin_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_plate_from_compacting.json new file mode 100644 index 0000000..1b83a10 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/tin_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:tin_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_tin": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/tin" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_tin" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:tin_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_block_from_compacting.json new file mode 100644 index 0000000..baf7441 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_block_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:uranium_block_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_uranium": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/uranium" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_uranium" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:uranium_block_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_dust_from_crushing.json new file mode 100644 index 0000000..7b2d5bc --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_dust_from_crushing.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:uranium_dust_from_crushing" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_uranium": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/uranium" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_uranium" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:uranium_dust_from_crushing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_gear_from_compacting.json new file mode 100644 index 0000000..026749e --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_gear_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:uranium_gear_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_uranium": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/uranium" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_uranium" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:uranium_gear_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_plate_from_compacting.json new file mode 100644 index 0000000..4b633ce --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/advancements/recipes/uranium_plate_from_compacting.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "usefulmachinery:uranium_plate_from_compacting" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_uranium": { + "conditions": { + "items": [ + { + "tag": "forge:ingots/uranium" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_uranium" + ] + ], + "rewards": { + "recipes": [ + "usefulmachinery:uranium_plate_from_compacting" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/loot_tables/blocks/coal_generator.json b/src/generated/resources/data/usefulmachinery/loot_tables/blocks/coal_generator.json new file mode 100644 index 0000000..adcc801 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/loot_tables/blocks/coal_generator.json @@ -0,0 +1,102 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + }, + { + "type": "usefulmachinery:coal_generator", + "entries": [ + { + "type": "minecraft:dynamic", + "name": "minecraft:contents" + } + ], + "function": "minecraft:set_contents" + }, + { + "function": "minecraft:copy_nbt", + "ops": [ + { + "op": "replace", + "source": "Items", + "target": "BlockEntityTag.Items" + }, + { + "op": "replace", + "source": "Upgrades", + "target": "BlockEntityTag.Upgrades" + }, + { + "op": "replace", + "source": "EnergyStored", + "target": "BlockEntityTag.EnergyStored" + }, + { + "op": "replace", + "source": "RedstoneMode", + "target": "BlockEntityTag.RedstoneMode" + }, + { + "op": "replace", + "source": "ProcessTime", + "target": "BlockEntityTag.ProcessTime" + }, + { + "op": "replace", + "source": "ProcessTimeTotal", + "target": "BlockEntityTag.ProcessTimeTotal" + }, + { + "op": "replace", + "source": "BurnTime", + "target": "BlockEntityTag.BurnTime" + }, + { + "op": "replace", + "source": "BurnTimeTotal", + "target": "BlockEntityTag.BurnTimeTotal" + } + ], + "source": "block_entity" + }, + { + "block": "usefulmachinery:coal_generator", + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "block": "usefulmachinery:coal_generator", + "condition": "minecraft:block_state_property", + "properties": { + "tier": "simple" + } + } + } + ], + "function": "minecraft:copy_state", + "properties": [ + "tier" + ] + } + ], + "name": "usefulmachinery:coal_generator" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "usefulmachinery:blocks/coal_generator" +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/loot_tables/blocks/compactor.json b/src/generated/resources/data/usefulmachinery/loot_tables/blocks/compactor.json new file mode 100644 index 0000000..37d8682 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/loot_tables/blocks/compactor.json @@ -0,0 +1,92 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + }, + { + "type": "usefulmachinery:compactor", + "entries": [ + { + "type": "minecraft:dynamic", + "name": "minecraft:contents" + } + ], + "function": "minecraft:set_contents" + }, + { + "function": "minecraft:copy_nbt", + "ops": [ + { + "op": "replace", + "source": "Items", + "target": "BlockEntityTag.Items" + }, + { + "op": "replace", + "source": "Upgrades", + "target": "BlockEntityTag.Upgrades" + }, + { + "op": "replace", + "source": "EnergyStored", + "target": "BlockEntityTag.EnergyStored" + }, + { + "op": "replace", + "source": "RedstoneMode", + "target": "BlockEntityTag.RedstoneMode" + }, + { + "op": "replace", + "source": "ProcessTime", + "target": "BlockEntityTag.ProcessTime" + }, + { + "op": "replace", + "source": "ProcessTimeTotal", + "target": "BlockEntityTag.ProcessTimeTotal" + } + ], + "source": "block_entity" + }, + { + "block": "usefulmachinery:compactor", + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "block": "usefulmachinery:compactor", + "condition": "minecraft:block_state_property", + "properties": { + "tier": "simple" + } + } + } + ], + "function": "minecraft:copy_state", + "properties": [ + "tier" + ] + } + ], + "name": "usefulmachinery:compactor" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "usefulmachinery:blocks/compactor" +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/loot_tables/blocks/crusher.json b/src/generated/resources/data/usefulmachinery/loot_tables/blocks/crusher.json new file mode 100644 index 0000000..b6567ec --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/loot_tables/blocks/crusher.json @@ -0,0 +1,92 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + }, + { + "type": "usefulmachinery:crusher", + "entries": [ + { + "type": "minecraft:dynamic", + "name": "minecraft:contents" + } + ], + "function": "minecraft:set_contents" + }, + { + "function": "minecraft:copy_nbt", + "ops": [ + { + "op": "replace", + "source": "Items", + "target": "BlockEntityTag.Items" + }, + { + "op": "replace", + "source": "Upgrades", + "target": "BlockEntityTag.Upgrades" + }, + { + "op": "replace", + "source": "EnergyStored", + "target": "BlockEntityTag.EnergyStored" + }, + { + "op": "replace", + "source": "RedstoneMode", + "target": "BlockEntityTag.RedstoneMode" + }, + { + "op": "replace", + "source": "ProcessTime", + "target": "BlockEntityTag.ProcessTime" + }, + { + "op": "replace", + "source": "ProcessTimeTotal", + "target": "BlockEntityTag.ProcessTimeTotal" + } + ], + "source": "block_entity" + }, + { + "block": "usefulmachinery:crusher", + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "block": "usefulmachinery:crusher", + "condition": "minecraft:block_state_property", + "properties": { + "tier": "simple" + } + } + } + ], + "function": "minecraft:copy_state", + "properties": [ + "tier" + ] + } + ], + "name": "usefulmachinery:crusher" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "usefulmachinery:blocks/crusher" +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/loot_tables/blocks/electric_smelter.json b/src/generated/resources/data/usefulmachinery/loot_tables/blocks/electric_smelter.json new file mode 100644 index 0000000..413fad4 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/loot_tables/blocks/electric_smelter.json @@ -0,0 +1,92 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + }, + { + "type": "usefulmachinery:electric_smelter", + "entries": [ + { + "type": "minecraft:dynamic", + "name": "minecraft:contents" + } + ], + "function": "minecraft:set_contents" + }, + { + "function": "minecraft:copy_nbt", + "ops": [ + { + "op": "replace", + "source": "Items", + "target": "BlockEntityTag.Items" + }, + { + "op": "replace", + "source": "Upgrades", + "target": "BlockEntityTag.Upgrades" + }, + { + "op": "replace", + "source": "EnergyStored", + "target": "BlockEntityTag.EnergyStored" + }, + { + "op": "replace", + "source": "RedstoneMode", + "target": "BlockEntityTag.RedstoneMode" + }, + { + "op": "replace", + "source": "ProcessTime", + "target": "BlockEntityTag.ProcessTime" + }, + { + "op": "replace", + "source": "ProcessTimeTotal", + "target": "BlockEntityTag.ProcessTimeTotal" + } + ], + "source": "block_entity" + }, + { + "block": "usefulmachinery:electric_smelter", + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "block": "usefulmachinery:electric_smelter", + "condition": "minecraft:block_state_property", + "properties": { + "tier": "simple" + } + } + } + ], + "function": "minecraft:copy_state", + "properties": [ + "tier" + ] + } + ], + "name": "usefulmachinery:electric_smelter" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "usefulmachinery:blocks/electric_smelter" +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/loot_tables/blocks/lava_generator.json b/src/generated/resources/data/usefulmachinery/loot_tables/blocks/lava_generator.json new file mode 100644 index 0000000..f8977db --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/loot_tables/blocks/lava_generator.json @@ -0,0 +1,107 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "minecraft:copy_name", + "source": "block_entity" + }, + { + "type": "usefulmachinery:lava_generator", + "entries": [ + { + "type": "minecraft:dynamic", + "name": "minecraft:contents" + } + ], + "function": "minecraft:set_contents" + }, + { + "function": "minecraft:copy_nbt", + "ops": [ + { + "op": "replace", + "source": "Items", + "target": "BlockEntityTag.Items" + }, + { + "op": "replace", + "source": "Upgrades", + "target": "BlockEntityTag.Upgrades" + }, + { + "op": "replace", + "source": "EnergyStored", + "target": "BlockEntityTag.EnergyStored" + }, + { + "op": "replace", + "source": "RedstoneMode", + "target": "BlockEntityTag.RedstoneMode" + }, + { + "op": "replace", + "source": "ProcessTime", + "target": "BlockEntityTag.ProcessTime" + }, + { + "op": "replace", + "source": "ProcessTimeTotal", + "target": "BlockEntityTag.ProcessTimeTotal" + }, + { + "op": "replace", + "source": "BurnTime", + "target": "BlockEntityTag.BurnTime" + }, + { + "op": "replace", + "source": "BurnTimeTotal", + "target": "BlockEntityTag.BurnTimeTotal" + }, + { + "op": "replace", + "source": "Tank", + "target": "BlockEntityTag.Tank" + } + ], + "source": "block_entity" + }, + { + "block": "usefulmachinery:lava_generator", + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "block": "usefulmachinery:lava_generator", + "condition": "minecraft:block_state_property", + "properties": { + "tier": "simple" + } + } + } + ], + "function": "minecraft:copy_state", + "properties": [ + "tier" + ] + } + ], + "name": "usefulmachinery:lava_generator" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "usefulmachinery:blocks/lava_generator" +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/aluminum_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/aluminum_block_from_compacting.json new file mode 100644 index 0000000..ac19b4c --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/aluminum_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/aluminum" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:aluminum_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/aluminum_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/aluminum_dust_from_crushing.json new file mode 100644 index 0000000..e37a839 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/aluminum_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/aluminum" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:aluminum_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/aluminum_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/aluminum_gear_from_compacting.json new file mode 100644 index 0000000..29d4467 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/aluminum_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/aluminum" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:aluminum_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/aluminum_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/aluminum_plate_from_compacting.json new file mode 100644 index 0000000..bc7f054 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/aluminum_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/aluminum" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:aluminum_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/battery.json b/src/generated/resources/data/usefulmachinery/recipes/battery.json new file mode 100644 index 0000000..462b448 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/battery.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:ingots/tin" + }, + "R": { + "tag": "forge:dusts/redstone" + }, + "X": { + "tag": "forge:nuggets/gold" + } + }, + "pattern": [ + " X ", + "#R#", + "#R#" + ], + "result": { + "item": "usefulmachinery:battery" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/bronze_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/bronze_block_from_compacting.json new file mode 100644 index 0000000..69ff3c7 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/bronze_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/bronze" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:bronze_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/bronze_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/bronze_dust_from_crushing.json new file mode 100644 index 0000000..66f8610 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/bronze_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/bronze" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:bronze_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/bronze_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/bronze_gear_from_compacting.json new file mode 100644 index 0000000..a39480a --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/bronze_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/bronze" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:bronze_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/bronze_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/bronze_plate_from_compacting.json new file mode 100644 index 0000000..5ff8dd2 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/bronze_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/bronze" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:bronze_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/coal_generator.json b/src/generated/resources/data/usefulmachinery/recipes/coal_generator.json new file mode 100644 index 0000000..31f6567 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/coal_generator.json @@ -0,0 +1,29 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "minecraft:coals" + }, + "B": { + "tag": "forge:batteries" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "R": { + "item": "usefulmachinery:machine_frame" + }, + "X": { + "tag": "forge:dusts/redstone" + } + }, + "pattern": [ + " X ", + "#R#", + "IBI" + ], + "result": { + "item": "usefulmachinery:coal_generator" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/compactor.json b/src/generated/resources/data/usefulmachinery/recipes/compactor.json new file mode 100644 index 0000000..f437a85 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/compactor.json @@ -0,0 +1,29 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:dusts/redstone" + }, + "B": { + "tag": "forge:batteries" + }, + "I": { + "tag": "forge:ingots/electrum" + }, + "R": { + "item": "usefulmachinery:machine_frame" + }, + "X": { + "item": "usefulmachinery:compactor_kit" + } + }, + "pattern": [ + " X ", + "#R#", + "IBI" + ], + "result": { + "item": "usefulmachinery:compactor" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/compactor_kit.json b/src/generated/resources/data/usefulmachinery/recipes/compactor_kit.json new file mode 100644 index 0000000..646187c --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/compactor_kit.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "forge:gears/gold" + }, + { + "tag": "forge:plates/lead" + }, + { + "item": "usefulfoundation:hammer" + } + ], + "result": { + "item": "usefulmachinery:compactor_kit" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/copper_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/copper_block_from_compacting.json new file mode 100644 index 0000000..cca3d0e --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/copper_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/copper" + }, + "mode": "block", + "result": { + "count": 1, + "result": "minecraft:copper_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/copper_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/copper_dust_from_crushing.json new file mode 100644 index 0000000..d4aeb72 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/copper_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/copper" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:copper_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/copper_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/copper_gear_from_compacting.json new file mode 100644 index 0000000..14e1c3b --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/copper_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/copper" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:copper_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/copper_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/copper_plate_from_compacting.json new file mode 100644 index 0000000..8c4ba4e --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/copper_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/copper" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:copper_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/crusher.json b/src/generated/resources/data/usefulmachinery/recipes/crusher.json new file mode 100644 index 0000000..f81f017 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/crusher.json @@ -0,0 +1,29 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "item": "minecraft:flint" + }, + "B": { + "tag": "forge:batteries" + }, + "I": { + "tag": "forge:ingots/copper" + }, + "R": { + "item": "usefulmachinery:machine_frame" + }, + "X": { + "tag": "forge:dusts/redstone" + } + }, + "pattern": [ + " X ", + "#R#", + "IBI" + ], + "result": { + "item": "usefulmachinery:crusher" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/diamond_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/diamond_dust_from_crushing.json new file mode 100644 index 0000000..5368005 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/diamond_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:gems/diamond" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:diamond_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/diamond_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/diamond_gear_from_compacting.json new file mode 100644 index 0000000..f03b5b8 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/diamond_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:gems/diamond" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:diamond_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/diamond_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/diamond_plate_from_compacting.json new file mode 100644 index 0000000..79efba4 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/diamond_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:gems/diamond" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:diamond_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/efficiency_upgrade.json b/src/generated/resources/data/usefulmachinery/recipes/efficiency_upgrade.json new file mode 100644 index 0000000..9780721 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/efficiency_upgrade.json @@ -0,0 +1,27 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:dusts/redstone" + }, + "O": { + "tag": "forge:plates/steel" + }, + "R": { + "item": "minecraft:flint" + }, + "X": { + "tag": "forge:ingots/bronze" + } + }, + "pattern": [ + "X#X", + "ROR", + "X#X" + ], + "result": { + "count": 2, + "item": "usefulmachinery:efficiency_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/electric_smelter.json b/src/generated/resources/data/usefulmachinery/recipes/electric_smelter.json new file mode 100644 index 0000000..8c2c93a --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/electric_smelter.json @@ -0,0 +1,29 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gears/copper" + }, + "B": { + "tag": "forge:batteries" + }, + "I": { + "tag": "forge:ingots/iron" + }, + "R": { + "item": "minecraft:furnace" + }, + "X": { + "tag": "forge:dusts/redstone" + } + }, + "pattern": [ + " X ", + "#R#", + "IBI" + ], + "result": { + "item": "usefulmachinery:electric_smelter" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/electrum_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/electrum_block_from_compacting.json new file mode 100644 index 0000000..105137d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/electrum_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/electrum" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:electrum_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/electrum_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/electrum_dust_from_crushing.json new file mode 100644 index 0000000..464d56a --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/electrum_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/electrum" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:electrum_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/electrum_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/electrum_gear_from_compacting.json new file mode 100644 index 0000000..ac79a5c --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/electrum_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/electrum" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:electrum_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/electrum_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/electrum_plate_from_compacting.json new file mode 100644 index 0000000..a22cc7b --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/electrum_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/electrum" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:electrum_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/enderium_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/enderium_block_from_compacting.json new file mode 100644 index 0000000..d4848b2 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/enderium_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/enderium" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:enderium_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/enderium_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/enderium_dust_from_crushing.json new file mode 100644 index 0000000..669b301 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/enderium_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/enderium" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:enderium_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/enderium_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/enderium_gear_from_compacting.json new file mode 100644 index 0000000..eeae91a --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/enderium_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/enderium" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:enderium_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/enderium_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/enderium_plate_from_compacting.json new file mode 100644 index 0000000..51baba5 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/enderium_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/enderium" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:enderium_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/gold_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/gold_block_from_compacting.json new file mode 100644 index 0000000..9271b35 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/gold_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/gold" + }, + "mode": "block", + "result": { + "count": 1, + "result": "minecraft:gold_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/gold_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/gold_dust_from_crushing.json new file mode 100644 index 0000000..7eb2b0e --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/gold_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/gold" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:gold_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/gold_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/gold_gear_from_compacting.json new file mode 100644 index 0000000..9520830 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/gold_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/gold" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:gold_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/gold_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/gold_plate_from_compacting.json new file mode 100644 index 0000000..af7ffce --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/gold_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/gold" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:gold_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/invar_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/invar_block_from_compacting.json new file mode 100644 index 0000000..0f1ffe2 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/invar_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/invar" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:invar_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/invar_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/invar_dust_from_crushing.json new file mode 100644 index 0000000..45bfe4c --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/invar_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/invar" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:invar_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/invar_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/invar_gear_from_compacting.json new file mode 100644 index 0000000..e22486f --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/invar_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/invar" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:invar_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/invar_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/invar_plate_from_compacting.json new file mode 100644 index 0000000..2925c72 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/invar_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/invar" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:invar_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/iron_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/iron_block_from_compacting.json new file mode 100644 index 0000000..b8f1eb9 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/iron_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/iron" + }, + "mode": "block", + "result": { + "count": 1, + "result": "minecraft:iron_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/iron_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/iron_dust_from_crushing.json new file mode 100644 index 0000000..b6165ac --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/iron_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/iron" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:iron_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/iron_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/iron_gear_from_compacting.json new file mode 100644 index 0000000..67eb359 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/iron_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/iron" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:iron_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/iron_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/iron_plate_from_compacting.json new file mode 100644 index 0000000..fc0c3d6 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/iron_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/iron" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:iron_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/lava_generator.json b/src/generated/resources/data/usefulmachinery/recipes/lava_generator.json new file mode 100644 index 0000000..2176b0d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/lava_generator.json @@ -0,0 +1,29 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:dusts/redstone" + }, + "B": { + "tag": "forge:batteries" + }, + "I": { + "tag": "forge:ingots/nether_brick" + }, + "R": { + "item": "usefulmachinery:machine_frame" + }, + "X": { + "item": "minecraft:bucket" + } + }, + "pattern": [ + " X ", + "#R#", + "IBI" + ], + "result": { + "item": "usefulmachinery:lava_generator" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/lead_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/lead_block_from_compacting.json new file mode 100644 index 0000000..4073deb --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/lead_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/lead" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:lead_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/lead_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/lead_dust_from_crushing.json new file mode 100644 index 0000000..ad6f731 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/lead_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/lead" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:lead_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/lead_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/lead_gear_from_compacting.json new file mode 100644 index 0000000..c9f6de2 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/lead_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/lead" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:lead_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/lead_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/lead_plate_from_compacting.json new file mode 100644 index 0000000..2ccf3c3 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/lead_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/lead" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:lead_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/machine_frame.json b/src/generated/resources/data/usefulmachinery/recipes/machine_frame.json new file mode 100644 index 0000000..1dba0e2 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/machine_frame.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:glass" + }, + "R": { + "tag": "forge:gears/iron" + }, + "X": { + "tag": "forge:ingots/tin" + } + }, + "pattern": [ + "X#X", + "#R#", + "X#X" + ], + "result": { + "item": "usefulmachinery:machine_frame" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/nickel_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/nickel_block_from_compacting.json new file mode 100644 index 0000000..7cdccaf --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/nickel_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/nickel" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:nickel_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/nickel_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/nickel_dust_from_crushing.json new file mode 100644 index 0000000..7f63052 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/nickel_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/nickel" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:nickel_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/nickel_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/nickel_gear_from_compacting.json new file mode 100644 index 0000000..5289da1 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/nickel_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/nickel" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:nickel_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/nickel_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/nickel_plate_from_compacting.json new file mode 100644 index 0000000..2e441ff --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/nickel_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/nickel" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:nickel_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/platinum_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/platinum_block_from_compacting.json new file mode 100644 index 0000000..1396b10 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/platinum_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/platinum" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:platinum_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/platinum_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/platinum_dust_from_crushing.json new file mode 100644 index 0000000..6d6b04c --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/platinum_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/platinum" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:platinum_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/platinum_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/platinum_gear_from_compacting.json new file mode 100644 index 0000000..0c714d5 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/platinum_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/platinum" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:platinum_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/platinum_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/platinum_plate_from_compacting.json new file mode 100644 index 0000000..3a39da7 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/platinum_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/platinum" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:platinum_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/precision_upgrade.json b/src/generated/resources/data/usefulmachinery/recipes/precision_upgrade.json new file mode 100644 index 0000000..5dd1e7f --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/precision_upgrade.json @@ -0,0 +1,27 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:dusts/glowstone" + }, + "O": { + "tag": "forge:plates/steel" + }, + "R": { + "tag": "forge:gems/amethyst" + }, + "X": { + "tag": "forge:ingots/nickel" + } + }, + "pattern": [ + "X#X", + "ROR", + "X#X" + ], + "result": { + "count": 2, + "item": "usefulmachinery:precision_upgrade" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_aluminum_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_aluminum_from_ore.json new file mode 100644 index 0000000..e0e42af --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_aluminum_from_ore.json @@ -0,0 +1,19 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/aluminum" + }, + "primary": { + "count": 2, + "result": "usefulfoundation:raw_aluminum" + }, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_copper_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_copper_from_ore.json new file mode 100644 index 0000000..be471be --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_copper_from_ore.json @@ -0,0 +1,24 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/copper" + }, + "primary": { + "count": 2, + "result": "minecraft:raw_copper" + }, + "secondary": { + "count": 1, + "result": "minecraft:raw_gold" + }, + "secondaryChance": 0.05, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_diamond_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_diamond_from_ore.json new file mode 100644 index 0000000..f0c229e --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_diamond_from_ore.json @@ -0,0 +1,19 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/diamond" + }, + "primary": { + "count": 2, + "result": "minecraft:diamond" + }, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_gold_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_gold_from_ore.json new file mode 100644 index 0000000..925ea6d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_gold_from_ore.json @@ -0,0 +1,24 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/gold" + }, + "primary": { + "count": 2, + "result": "minecraft:raw_gold" + }, + "secondary": { + "count": 1, + "result": "minecraft:raw_copper" + }, + "secondaryChance": 0.4, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_iron_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_iron_from_ore.json new file mode 100644 index 0000000..0b03818 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_iron_from_ore.json @@ -0,0 +1,24 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/iron" + }, + "primary": { + "count": 2, + "result": "minecraft:raw_iron" + }, + "secondary": { + "count": 1, + "result": "usefulfoundation:raw_nickel" + }, + "secondaryChance": 0.1, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_lead_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_lead_from_ore.json new file mode 100644 index 0000000..a400eaf --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_lead_from_ore.json @@ -0,0 +1,24 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/lead" + }, + "primary": { + "count": 2, + "result": "usefulfoundation:raw_lead" + }, + "secondary": { + "count": 1, + "result": "usefulfoundation:raw_silver" + }, + "secondaryChance": 0.08, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_nickel_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_nickel_from_ore.json new file mode 100644 index 0000000..a11b8fc --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_nickel_from_ore.json @@ -0,0 +1,19 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/nickel" + }, + "primary": { + "count": 2, + "result": "usefulfoundation:raw_nickel" + }, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_platinum_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_platinum_from_ore.json new file mode 100644 index 0000000..83b7b8b --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_platinum_from_ore.json @@ -0,0 +1,19 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/platinum" + }, + "primary": { + "count": 2, + "result": "usefulfoundation:raw_platinum" + }, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_silver_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_silver_from_ore.json new file mode 100644 index 0000000..824754e --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_silver_from_ore.json @@ -0,0 +1,24 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/silver" + }, + "primary": { + "count": 2, + "result": "usefulfoundation:raw_silver" + }, + "secondary": { + "count": 1, + "result": "usefulfoundation:raw_lead" + }, + "secondaryChance": 0.09, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_tin_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_tin_from_ore.json new file mode 100644 index 0000000..2b895cc --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_tin_from_ore.json @@ -0,0 +1,19 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/tin" + }, + "primary": { + "count": 2, + "result": "usefulfoundation:raw_tin" + }, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/raw_uranium_from_ore.json b/src/generated/resources/data/usefulmachinery/recipes/raw_uranium_from_ore.json new file mode 100644 index 0000000..1b8896d --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/raw_uranium_from_ore.json @@ -0,0 +1,19 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ores/uranium" + }, + "primary": { + "count": 2, + "result": "usefulfoundation:raw_uranium" + }, + "supportedUpgrades": [ + { + "item": "usefulmachinery:efficiency_upgrade" + }, + { + "item": "usefulmachinery:precision_upgrade" + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/signalum_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/signalum_block_from_compacting.json new file mode 100644 index 0000000..962486b --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/signalum_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/signalum" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:signalum_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/signalum_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/signalum_dust_from_crushing.json new file mode 100644 index 0000000..ce914af --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/signalum_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/signalum" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:signalum_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/signalum_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/signalum_gear_from_compacting.json new file mode 100644 index 0000000..d4ee3bc --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/signalum_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/signalum" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:signalum_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/signalum_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/signalum_plate_from_compacting.json new file mode 100644 index 0000000..3ff22f0 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/signalum_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/signalum" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:signalum_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/silver_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/silver_block_from_compacting.json new file mode 100644 index 0000000..594fa62 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/silver_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/silver" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:silver_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/silver_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/silver_dust_from_crushing.json new file mode 100644 index 0000000..1d72e01 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/silver_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/silver" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:silver_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/silver_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/silver_gear_from_compacting.json new file mode 100644 index 0000000..5bc2a20 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/silver_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/silver" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:silver_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/silver_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/silver_plate_from_compacting.json new file mode 100644 index 0000000..a15a3ad --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/silver_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/silver" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:silver_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/steel_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/steel_block_from_compacting.json new file mode 100644 index 0000000..2df81b9 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/steel_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/steel" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:steel_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/steel_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/steel_dust_from_crushing.json new file mode 100644 index 0000000..ac1a477 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/steel_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/steel" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:steel_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/steel_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/steel_gear_from_compacting.json new file mode 100644 index 0000000..2e3a0b8 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/steel_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/steel" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:steel_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/steel_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/steel_plate_from_compacting.json new file mode 100644 index 0000000..a84e3eb --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/steel_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/steel" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:steel_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/tin_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/tin_block_from_compacting.json new file mode 100644 index 0000000..f307703 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/tin_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/tin" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:tin_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/tin_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/tin_dust_from_crushing.json new file mode 100644 index 0000000..8216779 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/tin_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/tin" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:tin_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/tin_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/tin_gear_from_compacting.json new file mode 100644 index 0000000..dbace50 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/tin_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/tin" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:tin_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/tin_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/tin_plate_from_compacting.json new file mode 100644 index 0000000..686688a --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/tin_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/tin" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:tin_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/uranium_block_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/uranium_block_from_compacting.json new file mode 100644 index 0000000..3f2b13f --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/uranium_block_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 250, + "ingredient": { + "type": "usefulmachinery:count", + "count": 9, + "tag": "forge:ingots/uranium" + }, + "mode": "block", + "result": { + "count": 1, + "result": "usefulfoundation:uranium_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/uranium_dust_from_crushing.json b/src/generated/resources/data/usefulmachinery/recipes/uranium_dust_from_crushing.json new file mode 100644 index 0000000..c440ad1 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/uranium_dust_from_crushing.json @@ -0,0 +1,11 @@ +{ + "type": "usefulmachinery:crushing", + "crushTime": 200, + "ingredient": { + "tag": "forge:ingots/uranium" + }, + "primary": { + "count": 1, + "result": "usefulfoundation:uranium_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/uranium_gear_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/uranium_gear_from_compacting.json new file mode 100644 index 0000000..a150884 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/uranium_gear_from_compacting.json @@ -0,0 +1,14 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "count": 4, + "tag": "forge:ingots/uranium" + }, + "mode": "gear", + "result": { + "count": 1, + "result": "usefulfoundation:uranium_gear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/recipes/uranium_plate_from_compacting.json b/src/generated/resources/data/usefulmachinery/recipes/uranium_plate_from_compacting.json new file mode 100644 index 0000000..fd3ac08 --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/recipes/uranium_plate_from_compacting.json @@ -0,0 +1,13 @@ +{ + "type": "usefulmachinery:compacting", + "compactTime": 200, + "ingredient": { + "type": "usefulmachinery:count", + "tag": "forge:ingots/uranium" + }, + "mode": "plate", + "result": { + "count": 1, + "result": "usefulfoundation:uranium_plate" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/usefulmachinery/tags/items/machinery_upgrades.json b/src/generated/resources/data/usefulmachinery/tags/items/machinery_upgrades.json new file mode 100644 index 0000000..32cf5ee --- /dev/null +++ b/src/generated/resources/data/usefulmachinery/tags/items/machinery_upgrades.json @@ -0,0 +1,7 @@ +{ + "values": [ + "usefulmachinery:efficiency_upgrade", + "usefulmachinery:precision_upgrade", + "usefulmachinery:sustained_upgrade" + ] +} \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/examplemod/ExampleMod.java b/src/main/java/net/themcbrothers/examplemod/ExampleMod.java deleted file mode 100644 index db87ec1..0000000 --- a/src/main/java/net/themcbrothers/examplemod/ExampleMod.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.themcbrothers.examplemod; - -import com.mojang.logging.LogUtils; -import net.neoforged.bus.api.IEventBus; -import net.neoforged.fml.common.Mod; -import net.themcbrothers.examplemod.core.Registration; -import org.slf4j.Logger; - -@Mod(ExampleMod.MOD_ID) -public class ExampleMod { - public static final String MOD_ID = "examplemod"; - - private static final Logger LOGGER = LogUtils.getLogger(); - - public ExampleMod(IEventBus modEventBus) { - // Register stuff - Registration.register(modEventBus); - } -} diff --git a/src/main/java/net/themcbrothers/examplemod/block/ExampleDirectionBlock.java b/src/main/java/net/themcbrothers/examplemod/block/ExampleDirectionBlock.java deleted file mode 100644 index 4c6e054..0000000 --- a/src/main/java/net/themcbrothers/examplemod/block/ExampleDirectionBlock.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.themcbrothers.examplemod.block; - -import net.minecraft.core.Direction; -import net.minecraft.world.item.context.BlockPlaceContext; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.SimpleWaterloggedBlock; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; -import org.jetbrains.annotations.Nullable; - -public class ExampleDirectionBlock extends Block implements SimpleWaterloggedBlock { - public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; - public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - - public ExampleDirectionBlock(Properties properties) { - super(properties); - this.registerDefaultState(this.stateDefinition.any() - .setValue(FACING, Direction.NORTH) - .setValue(WATERLOGGED, Boolean.FALSE)); - } - - @Override - protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(FACING, WATERLOGGED); - } - - @Nullable - @Override - public BlockState getStateForPlacement(BlockPlaceContext context) { - return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); - } -} diff --git a/src/main/java/net/themcbrothers/examplemod/core/ExampleBlocks.java b/src/main/java/net/themcbrothers/examplemod/core/ExampleBlocks.java deleted file mode 100644 index a2276ce..0000000 --- a/src/main/java/net/themcbrothers/examplemod/core/ExampleBlocks.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.themcbrothers.examplemod.core; - -import net.minecraft.world.item.DyeColor; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.material.MapColor; -import net.neoforged.neoforge.registries.DeferredBlock; -import net.themcbrothers.examplemod.block.ExampleDirectionBlock; - -import java.util.function.Function; - -import static net.themcbrothers.examplemod.core.Registration.BLOCKS; -import static net.themcbrothers.examplemod.core.Registration.ITEMS; - -public final class ExampleBlocks { - static void init() { - } - - public static final DeferredBlock EXAMPLE_BLOCK = registerBlock("example_block", BlockBehaviour.Properties.of().mapColor(MapColor.STONE)); - - public static final DeferredBlock SECONDARY_EXAMPLE_BLOCK = registerBlock("secondary_example_block", ExampleDirectionBlock::new, BlockBehaviour.Properties.of().mapColor(DyeColor.WHITE)); - - private static DeferredBlock registerBlock(String name, BlockBehaviour.Properties props) { - return registerBlock(name, Block::new, props); - } - - private static DeferredBlock registerBlock(String name, Function func, BlockBehaviour.Properties props) { - DeferredBlock deferredBlock = BLOCKS.registerBlock(name, func, props); - ITEMS.registerSimpleBlockItem(deferredBlock); - return deferredBlock; - } -} diff --git a/src/main/java/net/themcbrothers/examplemod/core/ExampleItems.java b/src/main/java/net/themcbrothers/examplemod/core/ExampleItems.java deleted file mode 100644 index 96530b1..0000000 --- a/src/main/java/net/themcbrothers/examplemod/core/ExampleItems.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.themcbrothers.examplemod.core; - -import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.Item; -import net.neoforged.neoforge.registries.DeferredItem; - -import static net.themcbrothers.examplemod.core.Registration.ITEMS; - -public final class ExampleItems { - static void init() { - } - - public static final DeferredItem EXAMPLE_ITEM = ITEMS.registerSimpleItem("example_item", new Item.Properties().food(new FoodProperties.Builder().alwaysEat().nutrition(1).saturationMod(2f).build())); -} diff --git a/src/main/java/net/themcbrothers/examplemod/core/ExampleTabs.java b/src/main/java/net/themcbrothers/examplemod/core/ExampleTabs.java deleted file mode 100644 index fb896e5..0000000 --- a/src/main/java/net/themcbrothers/examplemod/core/ExampleTabs.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.themcbrothers.examplemod.core; - -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.CreativeModeTabs; -import net.neoforged.neoforge.registries.DeferredHolder; - -import static net.themcbrothers.examplemod.core.ExampleBlocks.EXAMPLE_BLOCK; -import static net.themcbrothers.examplemod.core.ExampleItems.EXAMPLE_ITEM; -import static net.themcbrothers.examplemod.core.Registration.CREATIVE_MODE_TABS; - -public final class ExampleTabs { - static void init() { - } - - public static final DeferredHolder EXAMPLE = CREATIVE_MODE_TABS.register("example", () -> CreativeModeTab.builder() - .withTabsBefore(CreativeModeTabs.COMBAT) - .icon(() -> EXAMPLE_ITEM.get().getDefaultInstance()) - .title(Component.translatable("itemGroup.examplemod.example")) - .displayItems((parameters, output) -> { - output.accept(EXAMPLE_ITEM); - output.accept(EXAMPLE_BLOCK); - }).build()); -} diff --git a/src/main/java/net/themcbrothers/examplemod/core/Registration.java b/src/main/java/net/themcbrothers/examplemod/core/Registration.java deleted file mode 100644 index 0e6eaeb..0000000 --- a/src/main/java/net/themcbrothers/examplemod/core/Registration.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.themcbrothers.examplemod.core; - -import net.minecraft.core.registries.Registries; -import net.minecraft.world.item.CreativeModeTab; -import net.neoforged.bus.api.IEventBus; -import net.neoforged.neoforge.registries.DeferredRegister; -import net.themcbrothers.examplemod.ExampleMod; - -public final class Registration { - public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(ExampleMod.MOD_ID); - public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(ExampleMod.MOD_ID); - public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, ExampleMod.MOD_ID); - - public static void register(IEventBus modEventBus) { - ExampleBlocks.init(); - ExampleItems.init(); - ExampleTabs.init(); - - BLOCKS.register(modEventBus); - ITEMS.register(modEventBus); - CREATIVE_MODE_TABS.register(modEventBus); - } -} diff --git a/src/main/java/net/themcbrothers/examplemod/datagen/DataGenEvents.java b/src/main/java/net/themcbrothers/examplemod/datagen/DataGenEvents.java deleted file mode 100644 index 180c835..0000000 --- a/src/main/java/net/themcbrothers/examplemod/datagen/DataGenEvents.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.themcbrothers.examplemod.datagen; - -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.data.event.GatherDataEvent; -import net.themcbrothers.examplemod.ExampleMod; - -@Mod.EventBusSubscriber(modid = ExampleMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) -public final class DataGenEvents { - @SubscribeEvent - static void onDataGen(final GatherDataEvent event) { - final var generator = event.getGenerator(); - final var packOutput = generator.getPackOutput(); - final var existingFileHelper = event.getExistingFileHelper(); - final var lookupProvider = event.getLookupProvider(); - - // Server resources - var blockTags = new ExampleBlockTagsProvider(packOutput, lookupProvider, existingFileHelper); - generator.addProvider(event.includeServer(), blockTags); - generator.addProvider(event.includeServer(), new ExampleItemTagsProvider(packOutput, lookupProvider, blockTags.contentsGetter(), existingFileHelper)); - - // Client resources - generator.addProvider(event.includeClient(), new ExampleBlockStateProvider(packOutput, existingFileHelper)); - generator.addProvider(event.includeClient(), new ExampleItemModelProvider(packOutput, existingFileHelper)); - generator.addProvider(event.includeClient(), new ExampleLanguageProvider(packOutput)); - } -} diff --git a/src/main/java/net/themcbrothers/examplemod/datagen/ExampleBlockStateProvider.java b/src/main/java/net/themcbrothers/examplemod/datagen/ExampleBlockStateProvider.java deleted file mode 100644 index 9981007..0000000 --- a/src/main/java/net/themcbrothers/examplemod/datagen/ExampleBlockStateProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.themcbrothers.examplemod.datagen; - -import net.minecraft.data.PackOutput; -import net.minecraft.world.level.block.Block; -import net.neoforged.neoforge.client.model.generators.BlockStateProvider; -import net.neoforged.neoforge.common.data.ExistingFileHelper; -import net.themcbrothers.examplemod.ExampleMod; -import net.themcbrothers.examplemod.core.ExampleBlocks; - -public class ExampleBlockStateProvider extends BlockStateProvider { - public ExampleBlockStateProvider(PackOutput output, ExistingFileHelper exFileHelper) { - super(output, ExampleMod.MOD_ID, exFileHelper); - } - - @Override - protected void registerStatesAndModels() { - simpleBlock(ExampleBlocks.EXAMPLE_BLOCK.get(), models().cubeAll("example_block", mcLoc("block/cauldron_inner"))); - - // Item Models - simpleBlockItem(ExampleBlocks.EXAMPLE_BLOCK.get()); - } - - private void simpleBlockItem(Block block) { - simpleBlockItem(block, models().getExistingFile(blockTexture(block))); - } -} diff --git a/src/main/java/net/themcbrothers/examplemod/datagen/ExampleBlockTagsProvider.java b/src/main/java/net/themcbrothers/examplemod/datagen/ExampleBlockTagsProvider.java deleted file mode 100644 index ae40bf4..0000000 --- a/src/main/java/net/themcbrothers/examplemod/datagen/ExampleBlockTagsProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.themcbrothers.examplemod.datagen; - -import net.minecraft.core.HolderLookup; -import net.minecraft.data.PackOutput; -import net.minecraft.tags.BlockTags; -import net.neoforged.neoforge.common.data.BlockTagsProvider; -import net.neoforged.neoforge.common.data.ExistingFileHelper; -import net.themcbrothers.examplemod.ExampleMod; -import net.themcbrothers.examplemod.core.ExampleBlocks; -import org.jetbrains.annotations.Nullable; - -import java.util.concurrent.CompletableFuture; - -public class ExampleBlockTagsProvider extends BlockTagsProvider { - public ExampleBlockTagsProvider(PackOutput output, CompletableFuture lookupProvider, @Nullable ExistingFileHelper existingFileHelper) { - super(output, lookupProvider, ExampleMod.MOD_ID, existingFileHelper); - } - - @Override - protected void addTags(HolderLookup.Provider provider) { - this.tag(BlockTags.BEACON_BASE_BLOCKS).add(ExampleBlocks.EXAMPLE_BLOCK.get()); - } -} \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/examplemod/datagen/ExampleItemModelProvider.java b/src/main/java/net/themcbrothers/examplemod/datagen/ExampleItemModelProvider.java deleted file mode 100644 index d4ccc8c..0000000 --- a/src/main/java/net/themcbrothers/examplemod/datagen/ExampleItemModelProvider.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.themcbrothers.examplemod.datagen; - -import net.minecraft.data.PackOutput; -import net.neoforged.neoforge.client.model.generators.ItemModelProvider; -import net.neoforged.neoforge.common.data.ExistingFileHelper; -import net.themcbrothers.examplemod.ExampleMod; -import net.themcbrothers.examplemod.core.ExampleItems; - -public class ExampleItemModelProvider extends ItemModelProvider { - public ExampleItemModelProvider(PackOutput output, ExistingFileHelper existingFileHelper) { - super(output, ExampleMod.MOD_ID, existingFileHelper); - } - - @Override - protected void registerModels() { - basicItem(ExampleItems.EXAMPLE_ITEM.value()); - } -} diff --git a/src/main/java/net/themcbrothers/examplemod/datagen/ExampleItemTagsProvider.java b/src/main/java/net/themcbrothers/examplemod/datagen/ExampleItemTagsProvider.java deleted file mode 100644 index 454c0a7..0000000 --- a/src/main/java/net/themcbrothers/examplemod/datagen/ExampleItemTagsProvider.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.themcbrothers.examplemod.datagen; - -import net.minecraft.core.HolderLookup; -import net.minecraft.data.PackOutput; -import net.minecraft.data.tags.ItemTagsProvider; -import net.minecraft.tags.ItemTags; -import net.minecraft.world.level.block.Block; -import net.neoforged.neoforge.common.data.ExistingFileHelper; -import net.themcbrothers.examplemod.ExampleMod; -import net.themcbrothers.examplemod.core.ExampleItems; -import org.jetbrains.annotations.Nullable; - -import java.util.concurrent.CompletableFuture; - -public class ExampleItemTagsProvider extends ItemTagsProvider { - public ExampleItemTagsProvider(PackOutput packOutput, CompletableFuture lookupProvider, CompletableFuture> blockTags, @Nullable ExistingFileHelper existingFileHelper) { - super(packOutput, lookupProvider, blockTags, ExampleMod.MOD_ID, existingFileHelper); - } - - @Override - protected void addTags(HolderLookup.Provider provider) { - this.tag(ItemTags.BEACON_PAYMENT_ITEMS).add(ExampleItems.EXAMPLE_ITEM.get()); - } -} diff --git a/src/main/java/net/themcbrothers/examplemod/datagen/ExampleLanguageProvider.java b/src/main/java/net/themcbrothers/examplemod/datagen/ExampleLanguageProvider.java deleted file mode 100644 index b77fa64..0000000 --- a/src/main/java/net/themcbrothers/examplemod/datagen/ExampleLanguageProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.themcbrothers.examplemod.datagen; - -import net.minecraft.data.PackOutput; -import net.neoforged.neoforge.common.data.LanguageProvider; -import net.themcbrothers.examplemod.ExampleMod; -import net.themcbrothers.examplemod.core.ExampleBlocks; -import net.themcbrothers.examplemod.core.ExampleItems; - -public class ExampleLanguageProvider extends LanguageProvider { - public ExampleLanguageProvider(PackOutput output) { - super(output, ExampleMod.MOD_ID, "en_us"); - } - - @Override - protected void addTranslations() { - // Blocks - addBlock(ExampleBlocks.EXAMPLE_BLOCK, "Example Block"); - - // Items - addItem(ExampleItems.EXAMPLE_ITEM, "Example Item"); - - // Tab - add("itemGroup.examplemod.example", "Example Mod"); - } -} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/UsefulMachinery.java b/src/main/java/net/themcbrothers/usefulmachinery/UsefulMachinery.java new file mode 100644 index 0000000..8cdb0f0 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/UsefulMachinery.java @@ -0,0 +1,34 @@ +package net.themcbrothers.usefulmachinery; + +import net.minecraft.resources.ResourceLocation; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.loading.FMLEnvironment; +import net.themcbrothers.lib.util.ComponentFormatter; +import net.themcbrothers.usefulmachinery.setup.ClientSetup; +import net.themcbrothers.usefulmachinery.setup.CommonSetup; +import net.themcbrothers.usefulmachinery.setup.ServerSetup; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@Mod(UsefulMachinery.MOD_ID) +public class UsefulMachinery { + public static final String MOD_ID = "usefulmachinery"; + public static final Logger LOGGER = LogManager.getLogger(); + public static final ComponentFormatter TEXT_UTILS = new ComponentFormatter(MOD_ID); + public static CommonSetup setup; + + public UsefulMachinery(IEventBus modEventBus, ModContainer modContainer) { + if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) { + setup = new ServerSetup(modEventBus, modContainer); + } else { + setup = new ClientSetup(modEventBus, modContainer); + } + } + + public static ResourceLocation rl(String path) { + return new ResourceLocation(MOD_ID, path); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/AbstractMachineBlock.java b/src/main/java/net/themcbrothers/usefulmachinery/block/AbstractMachineBlock.java new file mode 100644 index 0000000..f087c95 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/AbstractMachineBlock.java @@ -0,0 +1,108 @@ +package net.themcbrothers.usefulmachinery.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.themcbrothers.lib.wrench.WrenchableBlock; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; +import net.themcbrothers.usefulmachinery.item.UpgradeItem; +import net.themcbrothers.usefulmachinery.machine.MachineTier; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Supplier; + +// TODO: pick item copy state! +public abstract class AbstractMachineBlock extends BaseEntityBlock implements WrenchableBlock { + public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final EnumProperty TIER = EnumProperty.create("tier", MachineTier.class); + public static final BooleanProperty LIT = BlockStateProperties.LIT; + @Nullable + private final Supplier interactStat; + + protected AbstractMachineBlock(Properties props, @Nullable Supplier interactStat) { + super(props); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(TIER, MachineTier.SIMPLE).setValue(LIT, Boolean.FALSE)); + this.interactStat = interactStat; + } + + @Nullable + @Override + public abstract BlockEntity newBlockEntity(BlockPos pos, BlockState state); + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(FACING, TIER, LIT); + } + + @Override + public RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { + return level.isClientSide ? null : createTickerHelper(type, type, ((l, p, s, be) -> ((AbstractMachineBlockEntity) be).tick())); + } + + @Nullable + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); + } + + @Override + public BlockState rotate(BlockState state, LevelAccessor level, BlockPos pos, Rotation direction) { + return state.setValue(FACING, direction.rotate(state.getValue(FACING))); + } + + @Override + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(FACING))); + } + + @Override + public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand inHand, BlockHitResult hit) { + if (this.tryWrench(state, level, pos, player, inHand, hit)) { + return InteractionResult.sidedSuccess(level.isClientSide); + } + + if (player.getItemInHand(inHand).getItem() instanceof UpgradeItem) { + InteractionResult interactionResult = player.getItemInHand(inHand).useOn(new UseOnContext(player, inHand, hit)); + return interactionResult; + } + + if (level.getBlockEntity(pos) instanceof AbstractMachineBlockEntity blockEntity && player instanceof ServerPlayer serverPlayer) { + serverPlayer.openMenu(blockEntity, data -> { + data.writeBlockPos(pos); + data.writeInt(blockEntity.getUpgradeSlotSize()); + data.writeInt(blockEntity.getContainerData().getCount()); + }); + + if (this.interactStat != null) { + player.awardStat(this.interactStat.get()); + } + } + + return InteractionResult.sidedSuccess(level.isClientSide); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/CoalGeneratorBlock.java b/src/main/java/net/themcbrothers/usefulmachinery/block/CoalGeneratorBlock.java new file mode 100644 index 0000000..173700f --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/CoalGeneratorBlock.java @@ -0,0 +1,27 @@ +package net.themcbrothers.usefulmachinery.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import net.themcbrothers.usefulmachinery.core.MachineryStats; + +public class CoalGeneratorBlock extends AbstractMachineBlock { + public static final MapCodec CODEC = simpleCodec(CoalGeneratorBlock::new); + + public CoalGeneratorBlock(Properties props) { + super(props, MachineryStats.INTERACTION_WITH_COAL_GENERATOR); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return MachineryBlockEntities.COAL_GENERATOR.get().create(pos, state); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/CompactorBlock.java b/src/main/java/net/themcbrothers/usefulmachinery/block/CompactorBlock.java new file mode 100644 index 0000000..998cc83 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/CompactorBlock.java @@ -0,0 +1,28 @@ +package net.themcbrothers.usefulmachinery.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import net.themcbrothers.usefulmachinery.core.MachineryStats; +import org.jetbrains.annotations.Nullable; + +public class CompactorBlock extends AbstractMachineBlock { + private static final MapCodec CODEC = simpleCodec(CompactorBlock::new); + + public CompactorBlock(Properties props) { + super(props, MachineryStats.INTERACTION_WITH_COMPACTOR); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return MachineryBlockEntities.COMPACTOR.get().create(pos, state); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/CreativePowerCellBlock.java b/src/main/java/net/themcbrothers/usefulmachinery/block/CreativePowerCellBlock.java new file mode 100644 index 0000000..555b8e2 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/CreativePowerCellBlock.java @@ -0,0 +1,44 @@ +package net.themcbrothers.usefulmachinery.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.block.entity.CreativePowerCellBlockEntity; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import org.jetbrains.annotations.Nullable; + +public class CreativePowerCellBlock extends BaseEntityBlock { + public static final MapCodec CODEC = simpleCodec(CreativePowerCellBlock::new); + + public CreativePowerCellBlock(Properties properties) { + super(properties); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + public RenderShape getRenderShape(BlockState pState) { + return RenderShape.MODEL; + } + + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return MachineryBlockEntities.CREATIVE_POWER_CELL.get().create(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType type) { + return createTickerHelper(type, MachineryBlockEntities.CREATIVE_POWER_CELL.get(), CreativePowerCellBlockEntity::serverTick); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/CrusherBlock.java b/src/main/java/net/themcbrothers/usefulmachinery/block/CrusherBlock.java new file mode 100644 index 0000000..43f231d --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/CrusherBlock.java @@ -0,0 +1,28 @@ +package net.themcbrothers.usefulmachinery.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import net.themcbrothers.usefulmachinery.core.MachineryStats; +import org.jetbrains.annotations.Nullable; + +public class CrusherBlock extends AbstractMachineBlock { + private static final MapCodec CODEC = simpleCodec(CrusherBlock::new); + + public CrusherBlock(Properties props) { + super(props, MachineryStats.INTERACTION_WITH_CRUSHER); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return MachineryBlockEntities.CRUSHER.get().create(pos, state); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/ElectricSmelterBlock.java b/src/main/java/net/themcbrothers/usefulmachinery/block/ElectricSmelterBlock.java new file mode 100644 index 0000000..852df9e --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/ElectricSmelterBlock.java @@ -0,0 +1,28 @@ +package net.themcbrothers.usefulmachinery.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import net.themcbrothers.usefulmachinery.core.MachineryStats; +import org.jetbrains.annotations.Nullable; + +public class ElectricSmelterBlock extends AbstractMachineBlock { + private static final MapCodec CODEC = simpleCodec(ElectricSmelterBlock::new); + + public ElectricSmelterBlock(Properties props) { + super(props, MachineryStats.INTERACTION_WITH_ELECTRIC_SMELTER); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return MachineryBlockEntities.ELECTRIC_SMELTER.get().create(pos, state); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/LavaGeneratorBlock.java b/src/main/java/net/themcbrothers/usefulmachinery/block/LavaGeneratorBlock.java new file mode 100644 index 0000000..f060e1f --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/LavaGeneratorBlock.java @@ -0,0 +1,28 @@ +package net.themcbrothers.usefulmachinery.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import net.themcbrothers.usefulmachinery.core.MachineryStats; +import org.jetbrains.annotations.Nullable; + +public class LavaGeneratorBlock extends AbstractMachineBlock { + public static final MapCodec CODEC = simpleCodec(LavaGeneratorBlock::new); + + public LavaGeneratorBlock(Properties props) { + super(props, MachineryStats.INTERACTION_WITH_LAVA_GENERATOR); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { + return MachineryBlockEntities.LAVA_GENERATOR.get().create(pos, state); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/AbstractMachineBlockEntity.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/AbstractMachineBlockEntity.java new file mode 100644 index 0000000..e1c3b51 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/AbstractMachineBlockEntity.java @@ -0,0 +1,357 @@ +package net.themcbrothers.usefulmachinery.block.entity; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.world.Container; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.WorldlyContainer; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.energy.IEnergyStorage; +import net.neoforged.neoforge.registries.DeferredItem; +import net.themcbrothers.lib.energy.ExtendedEnergyStorage; +import net.themcbrothers.lib.util.EnergyUtils; +import net.themcbrothers.usefulmachinery.block.AbstractMachineBlock; +import net.themcbrothers.usefulmachinery.block.entity.extension.UpgradeContainer; +import net.themcbrothers.usefulmachinery.item.UpgradeItem; +import net.themcbrothers.usefulmachinery.machine.MachineTier; +import net.themcbrothers.usefulmachinery.machine.RedstoneMode; +import org.apache.commons.lang3.ArrayUtils; + +import javax.annotation.Nullable; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; + +// TODO: capabilities via event +public abstract class AbstractMachineBlockEntity extends BlockEntity implements WorldlyContainer, MenuProvider { + protected static final int ENERGY_CAPACITY = 20_000; + protected static final int MAX_TRANSFER = 100; + private final boolean isGenerator; + private int cooldown = -1; + protected final NonNullList stacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); + protected UpgradeContainer upgradeContainer; + protected int processTime; + protected int processTimeTotal; + protected ExtendedEnergyStorage energyStorage; + protected RedstoneMode redstoneMode = RedstoneMode.IGNORED; + + public AbstractMachineBlockEntity(BlockEntityType type, BlockPos pos, BlockState state, boolean isGenerator) { + super(type, pos, state); + this.isGenerator = isGenerator; + this.upgradeContainer = new UpgradeContainer(this.getUpgradeSlotSize()); + this.initEnergyStorage(0); + } + + @Override + public abstract int getContainerSize(); + + @Override + public void saveAdditional(CompoundTag compound) { + if (this.processTime > 0) { + compound.putInt("ProcessTime", this.processTime); + } + if (this.processTimeTotal > 0) { + compound.putInt("ProcessTimeTotal", this.processTimeTotal); + } + if (this.redstoneMode != RedstoneMode.IGNORED) { + compound.putInt("RedstoneMode", this.redstoneMode.ordinal()); + } + if (!this.upgradeContainer.isEmpty()) { + compound.put("Upgrades", this.upgradeContainer.createTag()); + } + if (this.energyStorage.getEnergyStored() > 0) { + compound.putInt("EnergyStored", this.energyStorage.getEnergyStored()); + } + + ContainerHelper.saveAllItems(compound, this.stacks, false); + } + + @Override + public void load(CompoundTag compound) { + this.processTime = compound.getInt("ProcessTime"); + this.processTimeTotal = compound.getInt("ProcessTimeTotal"); + this.redstoneMode = RedstoneMode.byOrdinal(compound.getInt("RedstoneMode")); + this.upgradeContainer = new UpgradeContainer(this.getUpgradeSlotSize()); + this.upgradeContainer.fromTag(compound.getList("Upgrades", Tag.TAG_COMPOUND)); + + this.initEnergyStorage(compound.getInt("EnergyStored")); + + ContainerHelper.loadAllItems(compound, this.stacks); + + super.load(compound); + } + + @Override + public int[] getSlotsForFace(@Nullable Direction side) { + if (side == null) { + return ArrayUtils.addAll(this.getInputSlots(), this.getOutputSlots()); + } + + return side == Direction.DOWN ? this.getOutputSlots() : this.getInputSlots(); + } + + @Override + public CompoundTag getUpdateTag() { + return this.saveWithoutMetadata(); + } + + @Override + public ClientboundBlockEntityDataPacket getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); + } + + @Override + public boolean canPlaceItemThroughFace(int index, ItemStack itemStackIn, @Nullable Direction direction) { + return true; + } + + @Override + public boolean canTakeItemThroughFace(int index, ItemStack stack, Direction direction) { + return true; + } + + @Override + public boolean isEmpty() { + return this.stacks.stream().allMatch(ItemStack::isEmpty); + } + + @Override + public ItemStack getItem(int index) { + return this.stacks.get(index); + } + + @Override + public ItemStack removeItem(int index, int count) { + return ContainerHelper.removeItem(this.stacks, index, count); + } + + @Override + public ItemStack removeItemNoUpdate(int index) { + return ContainerHelper.takeItem(this.stacks, index); + } + + @Override + public void setItem(int index, ItemStack stack) { + this.stacks.set(index, stack); + } + + @Override + public boolean stillValid(Player player) { + return Container.stillValidBlockEntity(this, player); + } + + @Override + public void clearContent() { + this.stacks.clear(); + } + + protected abstract int[] getInputSlots(); + + protected abstract int[] getOutputSlots(); + + protected abstract boolean canRun(); + + public abstract ContainerData getContainerData(); + + protected int getRecipeProcessTime() { + return 200; + } + + protected void initEnergyStorage(int energyStored) { + int capacity = ENERGY_CAPACITY * (this.getUpgradeSlotSize() + 1); + int maxExtract = this.isGenerator ? MAX_TRANSFER : 0; + int maxReceive = this.isGenerator ? 0 : MAX_TRANSFER; + + this.energyStorage = new ExtendedEnergyStorage(capacity, maxReceive, maxExtract, energyStored); + } + + protected int calcProcessTime(int processTime) { + return switch (this.getMachineTier(this.getBlockState())) { + case SIMPLE -> processTime; + case BASIC -> processTime / 2; + case REINFORCED -> processTime / 4; + case FACTORY -> processTime / 8; + case OVERKILL -> processTime / 16; + }; + } + + protected int calcBurnTime(int burnTime) { + return (int) switch (this.getMachineTier(this.getBlockState())) { + case SIMPLE -> burnTime; + case BASIC -> burnTime * 1.2; + case REINFORCED -> burnTime * 1.4; + case FACTORY -> burnTime * 1.6; + case OVERKILL -> burnTime * 1.8; + }; + } + + protected void sendEnergyToSlot() { + final ItemStack energyStack = this.stacks.get(this.getContainerSize() - 1); + + if (!energyStack.isEmpty()) { + IEnergyStorage energy = energyStack.getCapability(Capabilities.EnergyStorage.ITEM); + + if (energy != null && energy.canReceive()) { + int maxReceive = this.energyStorage.extractEnergy(Integer.MAX_VALUE, true); + int accepted = energy.receiveEnergy(maxReceive, false); + + this.energyStorage.consumeEnergy(accepted); + } + } + } + + protected void receiveEnergyFromSlot(int slotIndex) { + final ItemStack energyStack = this.stacks.get(slotIndex); + + if (!energyStack.isEmpty()) { + IEnergyStorage energy = energyStack.getCapability(Capabilities.EnergyStorage.ITEM); + + if (energy != null && energy.canExtract()) { + int maxExtract = this.energyStorage.receiveEnergy(Integer.MAX_VALUE, true); + int accepted = energy.receiveEnergy(maxExtract, false); + + this.energyStorage.growEnergy(accepted); + } + } + } + + protected int getUpgradeCount(DeferredItem upgrade) { + return this.getUpgradeCount(upgrade, (stack) -> true); + } + + protected int getUpgradeCount(DeferredItem upgrade, Function supportsUpgrade) { + int upgradeCount = 0; + + for (int i = 0; i < this.upgradeContainer.getContainerSize(); i++) { + ItemStack stack = this.upgradeContainer.getItem(i); + + if (stack.is(upgrade.asItem()) && supportsUpgrade.apply(stack)) { + upgradeCount += stack.getCount(); + } + } + + return upgradeCount; + } + + protected boolean isActive(int RFPerTick) { + return this.processTime > 0 && this.energyStorage.getEnergyStored() >= RFPerTick; + } + + public int getUpgradeSlotSize() { + return this.getMachineTier(this.getBlockState()).ordinal(); + } + + public void tick() { + if (this.cooldown >= 0) { + this.cooldown--; + } + if (this.cooldown < 0) { + this.sendUpdate(false); + } + if (!this.canRun() && this.redstoneMode.canRun(this) && this.processTime > 0) { + this.processTime = 0; + + this.setChanged(); + } + } + + public void sendUpdate(boolean lit) { + if (lit) { + this.cooldown = 15; + } + + if (lit || this.cooldown < 0) { + boolean notSameState = this.getBlockState().getValue(AbstractMachineBlock.LIT) != lit; + + if (this.level != null && notSameState) { + this.level.setBlock(this.worldPosition, this.getBlockState().setValue(AbstractMachineBlock.LIT, lit), 3); + } + } + } + + public int getEnergyStored() { + return this.energyStorage.getEnergyStored(); + } + + public ExtendedEnergyStorage getEnergyStorage() { + return this.energyStorage; + } + + public int getMaxEnergyStored() { + return this.energyStorage.getMaxEnergyStored(); + } + + public void sendEnergy() { + if (this.level != null) { + for (Direction facing : Direction.values()) { + if (this.getEnergyStored() <= 0) { + break; + } + + EnergyUtils.getEnergy(this.level, this.worldPosition.relative(facing), facing.getOpposite()) + .ifPresent(energy -> { + if (energy.canReceive()) { + int maxReceive = Math.min(MAX_TRANSFER, this.getEnergyStored()); + int accepted = energy.receiveEnergy(maxReceive, false); + + this.energyStorage.consumeEnergy(accepted); + } + }); + } + } + } + + public int getProcessTime() { + return this.processTime; + } + + public int getProcessTimeTotal() { + return this.processTimeTotal; + } + + public MachineTier getMachineTier(BlockState state) { + return state.hasProperty(AbstractMachineBlock.TIER) ? state.getValue(AbstractMachineBlock.TIER) : MachineTier.SIMPLE; + } + + public void setMachineTier(MachineTier machineTier) { + if (this.level != null) { + this.level.setBlock(this.worldPosition, this.getBlockState().setValue(AbstractMachineBlock.TIER, machineTier), Block.UPDATE_ALL); + } + + ListTag previousItems = this.upgradeContainer.createTag(); + this.upgradeContainer = new UpgradeContainer(this.getUpgradeSlotSize()); + this.upgradeContainer.fromTag(previousItems); + + this.initEnergyStorage(this.getEnergyStored()); + + this.setChanged(); + + this.level.invalidateCapabilities(this.worldPosition); + } + + public RedstoneMode getRedstoneMode() { + return this.redstoneMode; + } + + public void setRedstoneMode(RedstoneMode redstoneMode) { + this.redstoneMode = redstoneMode; + this.setChanged(); + } + + public Container getUpgradeContainer() { + return this.upgradeContainer; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CoalGeneratorBlockEntity.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CoalGeneratorBlockEntity.java new file mode 100644 index 0000000..5704aac --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CoalGeneratorBlockEntity.java @@ -0,0 +1,174 @@ +package net.themcbrothers.usefulmachinery.block.entity; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.common.CommonHooks; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import net.themcbrothers.usefulmachinery.core.MachineryItems; +import net.themcbrothers.usefulmachinery.machine.RedstoneMode; +import net.themcbrothers.usefulmachinery.menu.CoalGeneratorMenu; +import org.jetbrains.annotations.Nullable; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public class CoalGeneratorBlockEntity extends AbstractMachineBlockEntity { + private int burnTime; + private int burnTimeTotal; + private final ContainerData fields = new ContainerData() { + @Override + public int getCount() { + return 6; + } + + @Override + public void set(int index, int value) { + switch (index) { + case 2 -> CoalGeneratorBlockEntity.this.redstoneMode = RedstoneMode.byOrdinal(value); + case 4 -> CoalGeneratorBlockEntity.this.burnTime = value; + case 5 -> CoalGeneratorBlockEntity.this.burnTimeTotal = value; + default -> { + } + } + } + + @Override + public int get(int index) { + return switch (index) { + case 0 -> CoalGeneratorBlockEntity.this.getEnergyStored(); + case 1 -> CoalGeneratorBlockEntity.this.getMaxEnergyStored(); + case 2 -> CoalGeneratorBlockEntity.this.redstoneMode.ordinal(); + case 3 -> CoalGeneratorBlockEntity.this.getUpgradeSlotSize(); + case 4 -> CoalGeneratorBlockEntity.this.burnTime; + case 5 -> CoalGeneratorBlockEntity.this.burnTimeTotal; + default -> 0; + }; + } + }; + + public CoalGeneratorBlockEntity(BlockPos pos, BlockState state) { + super(MachineryBlockEntities.COAL_GENERATOR.get(), pos, state, true); + } + + @Override + protected int[] getInputSlots() { + return new int[]{0}; + } + + @Override + protected int[] getOutputSlots() { + return new int[0]; + } + + @Override + protected boolean canRun() { + boolean canRun = this.redstoneMode.canRun(this); + boolean canGenerate = this.energyStorage.getEnergyStored() <= this.energyStorage.getMaxEnergyStored(); + + return this.level != null && canRun && canGenerate; + } + + @Override + public int getContainerSize() { + return 2; + } + + @Override + public ContainerData getContainerData() { + return this.fields; + } + + @Override + public Component getDisplayName() { + return TEXT_UTILS.translate("container", "coal_generator"); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int id, Inventory playerInventory, Player player) { + return new CoalGeneratorMenu(id, playerInventory, this, this.getUpgradeContainer(), this.getContainerData()); + } + + @Override + public void saveAdditional(CompoundTag compound) { + super.saveAdditional(compound); + + compound.putInt("BurnTime", this.burnTime); + compound.putInt("BurnTimeTotal", this.burnTimeTotal); + } + + @Override + public void load(CompoundTag compound) { + super.load(compound); + + this.burnTime = compound.getInt("BurnTime"); + this.burnTimeTotal = compound.getInt("BurnTimeTotal"); + } + + @Override + public boolean canTakeItemThroughFace(int index, ItemStack stack, Direction direction) { + return false; + } + + @Override + public void tick() { + super.tick(); + + //TODO evaluate if should be in config + final int BASE_TICKING_ENERGY = 3; + boolean shouldLit = false; + boolean shouldSave = false; + + if (this.canRun() && this.burnTime <= 0) { + shouldLit = this.consumeFuel(); + } + + if (this.burnTime > 0) { + --this.burnTime; + + int upgradeCount = this.getUpgradeCount(MachineryItems.SUSTAINED_UPGRADE); + + // Calc the multiplier for the generation + double multiplier = upgradeCount * BASE_TICKING_ENERGY / (double) this.upgradeContainer.getMaxStackSize(); + + // Generate the energy + this.energyStorage.growEnergy((int) (BASE_TICKING_ENERGY + multiplier)); + + shouldLit = true; + shouldSave = true; + } + + this.sendEnergyToSlot(); + this.sendUpdate(shouldLit); + this.sendEnergy(); + + if (shouldSave) { + this.setChanged(); + } + } + + private boolean consumeFuel() { + ItemStack generatorStack = this.stacks.get(0); + int burnTime = CommonHooks.getBurnTime(generatorStack, null); + + if (burnTime == 1600) { + int time = this.calcBurnTime(burnTime); + + this.burnTime = time; + this.burnTimeTotal = time; + + generatorStack.shrink(1); + + return true; + } + + return false; + } +} \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CompactorBlockEntity.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CompactorBlockEntity.java new file mode 100644 index 0000000..e7964b2 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CompactorBlockEntity.java @@ -0,0 +1,260 @@ +package net.themcbrothers.usefulmachinery.block.entity; + +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.block.entity.extension.Compactor; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import net.themcbrothers.usefulmachinery.core.MachineryRecipeTypes; +import net.themcbrothers.usefulmachinery.machine.CompactorMode; +import net.themcbrothers.usefulmachinery.machine.RedstoneMode; +import net.themcbrothers.usefulmachinery.menu.CompactorMenu; +import net.themcbrothers.usefulmachinery.recipe.CompactingRecipe; +import net.themcbrothers.usefulmachinery.recipe.ingredient.CountIngredient; +import org.jetbrains.annotations.Nullable; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public class CompactorBlockEntity extends AbstractMachineBlockEntity implements Compactor { + private static final int RF_PER_TICK = 15; + private final ContainerData fields = new ContainerData() { + @Override + public int getCount() { + return 7; + } + + @Override + public void set(int index, int value) { + switch (index) { + case 2 -> CompactorBlockEntity.this.redstoneMode = RedstoneMode.byOrdinal(value); + case 4 -> CompactorBlockEntity.this.processTime = value; + case 5 -> CompactorBlockEntity.this.processTimeTotal = value; + case 6 -> CompactorBlockEntity.this.compactorMode = CompactorMode.byOrdinal(value); + default -> { + } + } + } + + @Override + public int get(int index) { + return switch (index) { + case 0 -> CompactorBlockEntity.this.getEnergyStored(); + case 1 -> CompactorBlockEntity.this.getMaxEnergyStored(); + case 2 -> CompactorBlockEntity.this.redstoneMode.ordinal(); + case 3 -> CompactorBlockEntity.this.getUpgradeSlotSize(); + case 4 -> CompactorBlockEntity.this.processTime; + case 5 -> CompactorBlockEntity.this.processTimeTotal; + case 6 -> CompactorBlockEntity.this.compactorMode.ordinal(); + default -> 0; + }; + } + }; + public CompactorMode compactorMode = CompactorMode.PLATE; + + public CompactorBlockEntity(BlockPos pos, BlockState state) { + super(MachineryBlockEntities.COMPACTOR.get(), pos, state, false); + } + + @Override + protected int[] getInputSlots() { + return new int[]{0}; + } + + @Override + protected int[] getOutputSlots() { + return new int[]{1}; + } + + @Override + protected boolean canRun() { + boolean canRun = this.redstoneMode.canRun(this); + boolean hasItem = !this.stacks.get(0).isEmpty(); + boolean hasEnergy = this.getEnergyStored() >= RF_PER_TICK; + + return this.level != null && canRun && hasEnergy && hasItem; + } + + @Override + protected int getRecipeProcessTime() { + if (this.level == null) { + return 200; + } + + return this.calcProcessTime(this.level.getRecipeManager() + .getRecipeFor(MachineryRecipeTypes.COMPACTING.get(), this, this.level) + .map(RecipeHolder::value) + .map(CompactingRecipe::compactTime) + .orElse(200)); + } + + + @Override + public void saveAdditional(CompoundTag compound) { + super.saveAdditional(compound); + + if (this.compactorMode != CompactorMode.PLATE) { + compound.putInt("Mode", this.compactorMode.ordinal()); + } + } + + @Override + public void load(CompoundTag compound) { + super.load(compound); + + if (compound.contains("Mode")) { + this.compactorMode = CompactorMode.byOrdinal(compound.getInt("Mode")); + } + } + + @Override + public CompactorMode getMode() { + return this.compactorMode; + } + + @Override + public void setMode(CompactorMode mode) { + this.compactorMode = mode; + + this.setChanged(); + } + + @Override + public int getContainerSize() { + return 3; + } + + @Override + public ContainerData getContainerData() { + return this.fields; + } + + @Override + public Component getDisplayName() { + return TEXT_UTILS.translate("container", "compactor"); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int id, Inventory playerInventory, Player player) { + return new CompactorMenu(id, playerInventory, this, this.upgradeContainer, this.fields); + } + + @Override + public void tick() { + super.tick(); + + boolean shouldLit = this.isActive(RF_PER_TICK); + boolean shouldSave = false; + + this.receiveEnergyFromSlot(2); + + if (this.canRun() && this.level != null) { + RecipeHolder recipe = this.level.getRecipeManager() + .getRecipeFor(MachineryRecipeTypes.COMPACTING.get(), this, this.level) + .orElse(null); + + // Machine kickoff + if (!this.isActive(RF_PER_TICK) && this.canProcess(recipe)) { + this.energyStorage.consumeEnergy(RF_PER_TICK); + this.processTime++; + + shouldSave = true; + } + // Machine is already running + else if (this.isActive(RF_PER_TICK) && this.canProcess(recipe)) { + this.energyStorage.consumeEnergy(RF_PER_TICK); + this.processTime++; + + if (this.processTime == this.processTimeTotal) { + this.processTime = 0; + this.processTimeTotal = this.getRecipeProcessTime(); + + this.processItem(recipe); + + shouldSave = true; + } + } + // Machine is active but invalid recipe + else { + this.processTime = 0; + } + } + + this.sendUpdate(shouldLit); + + if (shouldSave) { + this.setChanged(); + } + } + + @Override + public void setItem(int index, ItemStack givenStack) { + ItemStack stack = this.stacks.get(index); + boolean sameItem = ItemStack.isSameItemSameTags(givenStack, stack); + + this.stacks.set(index, givenStack); + + if (givenStack.getCount() > this.getMaxStackSize()) { + givenStack.setCount(this.getMaxStackSize()); + } + + if (index == 0 && !sameItem) { + this.processTimeTotal = this.getRecipeProcessTime(); + this.processTime = 0; + + this.setChanged(); + } + } + + private boolean canProcess(@Nullable RecipeHolder recipe) { + if (recipe != null && recipe.value().mode().equals(this.compactorMode) && this.level != null) { + ItemStack recipeOutputStack = recipe.value().getResultItem(this.level.registryAccess()); + + if (recipeOutputStack.isEmpty()) { + return false; + } else { + ItemStack machineOutputStack = this.stacks.get(1); + + if (machineOutputStack.isEmpty()) { + return true; + } else if (!ItemStack.isSameItem(machineOutputStack, recipeOutputStack)) { + return false; + } else { + boolean isMachineOutputSlotCountPossible = machineOutputStack.getCount() + recipeOutputStack.getCount() <= this.getMaxStackSize(); + boolean isMachineOutputStackCountPossible = machineOutputStack.getCount() + recipeOutputStack.getCount() <= machineOutputStack.getMaxStackSize(); + boolean isRecipeOutputStackCountPossible = machineOutputStack.getCount() + recipeOutputStack.getCount() <= recipeOutputStack.getMaxStackSize(); + + return (isMachineOutputSlotCountPossible && isMachineOutputStackCountPossible) || isRecipeOutputStackCountPossible; + } + } + } else { + return false; + } + } + + private void processItem(@Nullable RecipeHolder recipe) { + if (recipe != null && this.level != null) { + ItemStack machineInputStack = this.stacks.get(0); + ItemStack machineOutputStack = this.stacks.get(1); + ItemStack recipeResultStack = recipe.value().getResultItem(this.level.registryAccess()); + + if (machineOutputStack.isEmpty()) { + this.stacks.set(1, recipeResultStack.copy()); + } else if (ItemStack.isSameItem(machineOutputStack, recipeResultStack)) { + machineOutputStack.grow(recipeResultStack.getCount()); + } + if (recipe.value().ingredient() instanceof CountIngredient countIngredient) { + machineInputStack.shrink(countIngredient.getCount()); + } else { + machineInputStack.shrink(1); + } + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CreativePowerCellBlockEntity.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CreativePowerCellBlockEntity.java new file mode 100644 index 0000000..61b23ec --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CreativePowerCellBlockEntity.java @@ -0,0 +1,63 @@ +package net.themcbrothers.usefulmachinery.block.entity; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.energy.IEnergyStorage; +import net.themcbrothers.lib.util.EnergyUtils; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; + +public class CreativePowerCellBlockEntity extends BlockEntity implements IEnergyStorage { + public CreativePowerCellBlockEntity(BlockPos pos, BlockState state) { + super(MachineryBlockEntities.CREATIVE_POWER_CELL.get(), pos, state); + } + + @Override + public int receiveEnergy(int maxReceive, boolean simulate) { + return maxReceive; + } + + @Override + public int extractEnergy(int maxExtract, boolean simulate) { + return maxExtract; + } + + @Override + public int getEnergyStored() { + return getMaxEnergyStored(); + } + + @Override + public int getMaxEnergyStored() { + return Integer.MAX_VALUE; + } + + @Override + public boolean canExtract() { + return true; + } + + @Override + public boolean canReceive() { + return false; + } + + public static void serverTick(Level level, BlockPos pos, BlockState state, CreativePowerCellBlockEntity blockEntity) { + if (!level.isClientSide) { + blockEntity.sendEnergy(level, pos); + } + } + + private void sendEnergy(Level level, BlockPos pos) { + for (Direction facing : Direction.values()) { + EnergyUtils.getEnergy(level, pos.relative(facing), facing.getOpposite()) + .ifPresent((energy) -> { + if (energy.canReceive()) { + energy.receiveEnergy(CreativePowerCellBlockEntity.this.getEnergyStored(), false); + } + }); + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CrusherBlockEntity.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CrusherBlockEntity.java new file mode 100644 index 0000000..41de171 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/CrusherBlockEntity.java @@ -0,0 +1,335 @@ +package net.themcbrothers.usefulmachinery.block.entity; + +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import net.themcbrothers.usefulmachinery.core.MachineryItems; +import net.themcbrothers.usefulmachinery.core.MachineryRecipeTypes; +import net.themcbrothers.usefulmachinery.machine.RedstoneMode; +import net.themcbrothers.usefulmachinery.menu.CrusherMenu; +import net.themcbrothers.usefulmachinery.recipe.CrushingRecipe; +import org.jetbrains.annotations.Nullable; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public class CrusherBlockEntity extends AbstractMachineBlockEntity { + private static final int RF_PER_TICK = 10; //TODO evaluate if should be in config + private double efficiencyAdditionalChance; + private double precisionAdditionalChance; + private final ContainerData fields = new ContainerData() { + @Override + public int getCount() { + return 6; + } + + @Override + public void set(int index, int value) { + switch (index) { + case 2 -> CrusherBlockEntity.this.redstoneMode = RedstoneMode.byOrdinal(value); + case 4 -> CrusherBlockEntity.this.processTime = value; + case 5 -> CrusherBlockEntity.this.processTimeTotal = value; + default -> { + } + } + } + + @Override + public int get(int index) { + return switch (index) { + case 0 -> CrusherBlockEntity.this.getEnergyStored(); + case 1 -> CrusherBlockEntity.this.getMaxEnergyStored(); + case 2 -> CrusherBlockEntity.this.redstoneMode.ordinal(); + case 3 -> CrusherBlockEntity.this.getUpgradeSlotSize(); + case 4 -> CrusherBlockEntity.this.processTime; + case 5 -> CrusherBlockEntity.this.processTimeTotal; + default -> 0; + }; + } + }; + + public CrusherBlockEntity(BlockPos pos, BlockState state) { + super(MachineryBlockEntities.CRUSHER.get(), pos, state, false); + } + + @Override + protected int[] getInputSlots() { + return new int[]{0}; + } + + @Override + protected int[] getOutputSlots() { + return new int[]{1, 2}; + } + + @Override + protected boolean canRun() { + boolean canRun = this.redstoneMode.canRun(this); + boolean hasItem = !this.stacks.get(0).isEmpty(); + boolean hasEnergy = this.getEnergyStored() >= RF_PER_TICK; + + return this.level != null && canRun && hasEnergy && hasItem; + } + + @Override + protected int getRecipeProcessTime() { + if (this.level == null) { + return 200; + } + + return this.calcProcessTime(this.level.getRecipeManager() + .getRecipeFor(MachineryRecipeTypes.CRUSHING.get(), this, this.level) + .map(RecipeHolder::value) + .map(CrushingRecipe::crushTime) + .orElse(200) + ); + } + + @Override + public int getContainerSize() { + return 4; + } + + @Override + public ContainerData getContainerData() { + return this.fields; + } + + @Override + public Component getDisplayName() { + return TEXT_UTILS.translate("container", "crusher"); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int id, Inventory playerInventory, Player player) { + return new CrusherMenu(id, playerInventory, this, this.getUpgradeContainer(), this.getContainerData()); + } + + @Override + public void tick() { + boolean shouldLit = this.isActive(RF_PER_TICK); + boolean shouldSave = false; + + this.receiveEnergyFromSlot(3); + + if (this.canRun() && this.level != null) { + RecipeHolder recipe = this.level.getRecipeManager() + .getRecipeFor(MachineryRecipeTypes.CRUSHING.get(), this, this.level) + .orElse(null); + + if (recipe != null) { + int efficiencyUpgradeCount = this.getUpgradeCount(MachineryItems.EFFICIENCY_UPGRADE, stack -> recipe.value().supportUpgrade(stack)); + int precisionUpgradeCount = this.getUpgradeCount(MachineryItems.PRECISION_UPGRADE, stack -> recipe.value().supportUpgrade(stack)); + + this.efficiencyAdditionalChance = 0.0625 * efficiencyUpgradeCount; + this.precisionAdditionalChance = 0.0625 * precisionUpgradeCount; + } + + // Machine kickoff + if (!this.isActive(RF_PER_TICK) && this.canProcess(recipe)) { + this.energyStorage.consumeEnergy(RF_PER_TICK); + this.processTime++; + + shouldSave = true; + } + // Machine is already running + else if (this.isActive(RF_PER_TICK) && this.canProcess(recipe)) { + this.energyStorage.consumeEnergy(RF_PER_TICK); + this.processTime++; + + if (this.processTime == this.processTimeTotal) { + this.processTime = 0; + this.processTimeTotal = this.getRecipeProcessTime(); + + this.processItem(recipe); + + shouldSave = true; + } + } + // Machine is active but invalid recipe + else { + this.processTime = 0; + } + } + + this.sendUpdate(shouldLit); + + if (shouldSave) { + this.setChanged(); + } + + super.tick(); + } + + @Override + public void setItem(int index, ItemStack givenStack) { + ItemStack stack = this.stacks.get(index); + boolean sameItem = ItemStack.isSameItemSameTags(givenStack, stack); + + this.stacks.set(index, givenStack); + + if (givenStack.getCount() > this.getMaxStackSize()) { + givenStack.setCount(this.getMaxStackSize()); + } + + if (index == 0 && !sameItem) { + this.processTimeTotal = this.getRecipeProcessTime(); + this.processTime = 0; + + this.setChanged(); + } + } + + private boolean canProcess(@Nullable RecipeHolder recipe) { + if (recipe != null && this.level != null) { + ItemStack recipePrimaryOutputStack = recipe.value().getResultItem(this.level.registryAccess()); + ItemStack recipeSecondOutputStack = recipe.value().secondaryResult(); + + int efficiencyAdditionalCount = 0; + int precisionAdditionalCount = 0; + + if (this.efficiencyAdditionalChance > 0.5) { + efficiencyAdditionalCount += 2; + } else if (this.efficiencyAdditionalChance <= 0.5 && this.efficiencyAdditionalChance != 0) { + efficiencyAdditionalCount += 1; + } + + if (this.precisionAdditionalChance > 0) { + precisionAdditionalCount += 1; + } + + if (!recipeSecondOutputStack.isEmpty()) { + if (recipePrimaryOutputStack.isEmpty()) { + return false; + } else { + ItemStack machinePrimaryOutputStack = this.stacks.get(1); + ItemStack machineSecondOutputStack = this.stacks.get(2); + + if (this.precisionAdditionalChance == 1) { + recipePrimaryOutputStack = ItemStack.EMPTY; + } + + boolean areMachineOutputStacksEmpty = machinePrimaryOutputStack.isEmpty() && machineSecondOutputStack.isEmpty(); + + if (areMachineOutputStacksEmpty) { + return true; + } else { + boolean isRecipePrimaryOutputStackCountPossible = machinePrimaryOutputStack.getCount() + recipePrimaryOutputStack.getCount() + efficiencyAdditionalCount <= recipePrimaryOutputStack.getMaxStackSize(); + boolean isRecipeSecondaryOutputStackCountPossible = machineSecondOutputStack.getCount() + recipeSecondOutputStack.getCount() + precisionAdditionalCount <= recipeSecondOutputStack.getMaxStackSize(); + + if (ItemStack.isSameItem(machinePrimaryOutputStack, recipePrimaryOutputStack) && isRecipePrimaryOutputStackCountPossible && machineSecondOutputStack.isEmpty()) { + return true; + } else if (ItemStack.isSameItem(machineSecondOutputStack, recipeSecondOutputStack) && isRecipeSecondaryOutputStackCountPossible && machinePrimaryOutputStack.isEmpty()) { + return true; + } else if (!machinePrimaryOutputStack.is(recipePrimaryOutputStack.getItem()) || !machineSecondOutputStack.is(recipeSecondOutputStack.getItem())) { + return false; + } else { + boolean isMachinePrimaryOutputSlotCountPossible = machinePrimaryOutputStack.getCount() + recipePrimaryOutputStack.getCount() + efficiencyAdditionalCount <= this.getMaxStackSize(); + boolean isMachinePrimaryOutputStackCountPossible = machinePrimaryOutputStack.getCount() < machinePrimaryOutputStack.getMaxStackSize(); + boolean isMachineSecondaryOutputSlotCountPossible = machineSecondOutputStack.getCount() + recipeSecondOutputStack.getCount() + precisionAdditionalCount <= this.getMaxStackSize(); + boolean isMachineSecondaryOutputStackCountPossible = machineSecondOutputStack.getCount() < machineSecondOutputStack.getMaxStackSize(); + + boolean areMachineSlotsAndStacksCountPossible = isMachinePrimaryOutputSlotCountPossible && isMachinePrimaryOutputStackCountPossible && isMachineSecondaryOutputSlotCountPossible && isMachineSecondaryOutputStackCountPossible; + boolean areRecipeOutputsCountPossible = isRecipePrimaryOutputStackCountPossible && isRecipeSecondaryOutputStackCountPossible; + + return areMachineSlotsAndStacksCountPossible || areRecipeOutputsCountPossible; + } + } + } + } else { + if (recipePrimaryOutputStack.isEmpty()) { + return false; + } else { + ItemStack machinePrimaryOutputStack = this.stacks.get(1); + + if (machinePrimaryOutputStack.isEmpty()) { + return true; + } else if (!ItemStack.isSameItem(machinePrimaryOutputStack, recipePrimaryOutputStack)) { + return false; + } else { + boolean isMachinePrimaryOutputSlotCountPossible = machinePrimaryOutputStack.getCount() + recipePrimaryOutputStack.getCount() + efficiencyAdditionalCount <= this.getMaxStackSize(); + boolean isMachinePrimaryOutputStackCountPossible = machinePrimaryOutputStack.getCount() < machinePrimaryOutputStack.getMaxStackSize(); + boolean isRecipePrimaryOutputStackCountPossible = machinePrimaryOutputStack.getCount() + recipePrimaryOutputStack.getCount() <= recipePrimaryOutputStack.getMaxStackSize(); + + return (isMachinePrimaryOutputSlotCountPossible && isMachinePrimaryOutputStackCountPossible) || isRecipePrimaryOutputStackCountPossible; + } + } + } + } else { + return false; + } + } + + private void processItem(@Nullable RecipeHolder recipe) { + if (recipe != null && this.level != null) { + ItemStack primaryResultStack = recipe.value().getResultItem(this.level.registryAccess()); + ItemStack secondaryResultStack = recipe.value().secondaryResult(); + ItemStack inputSlot = this.stacks.get(0); + ItemStack primaryOutputSlot = this.stacks.get(1); + ItemStack secondaryOutputSlot = this.stacks.get(2); + float secondaryChance = recipe.value().secondaryChance(); + + // Checking if machine not in precision mode + if (this.precisionAdditionalChance != 1) { + if (primaryOutputSlot.isEmpty()) { + this.stacks.set(1, primaryResultStack.copy()); + + primaryOutputSlot = this.stacks.get(1); + } else if (ItemStack.isSameItem(primaryOutputSlot, primaryResultStack)) { + primaryOutputSlot.grow(primaryResultStack.getCount()); + } + + if (this.efficiencyAdditionalChance == 1) { + primaryOutputSlot.grow(primaryResultStack.getCount()); + } else if (this.efficiencyAdditionalChance < 0.5) { + if (Math.random() <= this.efficiencyAdditionalChance) { + primaryOutputSlot.grow(1); + } + } else if (this.efficiencyAdditionalChance == 0.5) { + primaryOutputSlot.grow(1); + } else { + primaryOutputSlot.grow(1); + + if (Math.random() <= (this.efficiencyAdditionalChance - 0.5)) { + primaryOutputSlot.grow(1); + } + } + } + + boolean isSecondaryOutputPossible = (Math.random() <= secondaryChance || this.precisionAdditionalChance == 1); + + // Checking if machine not in efficiency mode + if (this.efficiencyAdditionalChance != 1 && !secondaryResultStack.isEmpty() && isSecondaryOutputPossible) { + if (secondaryOutputSlot.isEmpty()) { + this.stacks.set(2, secondaryResultStack.copy()); + + secondaryOutputSlot = this.stacks.get(2); + } else if (ItemStack.isSameItem(secondaryOutputSlot, secondaryResultStack)) { + secondaryOutputSlot.grow(secondaryResultStack.getCount()); + } + + if (this.precisionAdditionalChance == 1) { + secondaryOutputSlot.grow(secondaryResultStack.getCount()); + } else if (this.precisionAdditionalChance < 0.5) { + if (Math.random() <= this.precisionAdditionalChance) { + secondaryOutputSlot.grow(secondaryResultStack.getCount()); + } + } else if (this.precisionAdditionalChance == 0.5) { + secondaryOutputSlot.grow(secondaryResultStack.getCount()); + if (Math.random() <= (this.precisionAdditionalChance - 0.5)) { + secondaryOutputSlot.grow(secondaryResultStack.getCount()); + } + } + } + + inputSlot.shrink(1); + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/ElectricSmelterBlockEntity.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/ElectricSmelterBlockEntity.java new file mode 100644 index 0000000..414e9e3 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/ElectricSmelterBlockEntity.java @@ -0,0 +1,229 @@ +package net.themcbrothers.usefulmachinery.block.entity; + +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import net.themcbrothers.usefulmachinery.machine.RedstoneMode; +import net.themcbrothers.usefulmachinery.menu.ElectricSmelterMenu; +import org.jetbrains.annotations.Nullable; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public class ElectricSmelterBlockEntity extends AbstractMachineBlockEntity { + private static final int RF_PER_TICK = 10; //TODO evaluate if should be in config + private final ContainerData fields = new ContainerData() { + @Override + public int getCount() { + return 6; + } + + @Override + public void set(int index, int value) { + switch (index) { + case 2 -> ElectricSmelterBlockEntity.this.redstoneMode = RedstoneMode.byOrdinal(value); + case 4 -> ElectricSmelterBlockEntity.this.processTime = value; + case 5 -> ElectricSmelterBlockEntity.this.processTimeTotal = value; + default -> { + } + } + } + + @Override + public int get(int index) { + return switch (index) { + case 0 -> ElectricSmelterBlockEntity.this.getEnergyStored(); + case 1 -> ElectricSmelterBlockEntity.this.getMaxEnergyStored(); + case 2 -> ElectricSmelterBlockEntity.this.redstoneMode.ordinal(); + case 3 -> ElectricSmelterBlockEntity.this.getUpgradeSlotSize(); + case 4 -> ElectricSmelterBlockEntity.this.processTime; + case 5 -> ElectricSmelterBlockEntity.this.processTimeTotal; + default -> 0; + }; + } + }; + + public ElectricSmelterBlockEntity(BlockPos pos, BlockState state) { + super(MachineryBlockEntities.ELECTRIC_SMELTER.get(), pos, state, false); + } + + @Override + protected int[] getInputSlots() { + return new int[]{0}; + } + + @Override + protected int[] getOutputSlots() { + return new int[]{1}; + } + + @Override + protected boolean canRun() { + boolean canRun = this.redstoneMode.canRun(this); + boolean hasItem = !this.stacks.get(0).isEmpty(); + boolean hasEnergy = this.getEnergyStored() >= RF_PER_TICK; + + return this.level != null && canRun && hasEnergy && hasItem; + } + + @Override + protected int getRecipeProcessTime() { + if (this.level == null) { + return 200; + } + + return this.calcProcessTime(this.level.getRecipeManager() + .getRecipeFor(RecipeType.BLASTING, this, this.level) + .map(RecipeHolder::value) + .map(AbstractCookingRecipe::getCookingTime) + .orElse(this.level.getRecipeManager() + .getRecipeFor(RecipeType.SMELTING, this, this.level) + .map(RecipeHolder::value) + .map(AbstractCookingRecipe::getCookingTime) + .orElse(200))); + } + + @Override + public int getContainerSize() { + return 3; + } + + @Override + public ContainerData getContainerData() { + return this.fields; + } + + @Override + public Component getDisplayName() { + return TEXT_UTILS.translate("container", "electric_smelter"); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int id, Inventory playerInventory, Player player) { + return new ElectricSmelterMenu(id, playerInventory, this, this.getUpgradeContainer(), this.getContainerData()); + } + + @Override + public void setItem(int index, ItemStack givenStack) { + ItemStack stack = this.stacks.get(index); + boolean sameItem = ItemStack.isSameItemSameTags(givenStack, stack); + + this.stacks.set(index, givenStack); + + if (givenStack.getCount() > this.getMaxStackSize()) { + givenStack.setCount(this.getMaxStackSize()); + } + + if (index == 0 && !sameItem) { + this.processTimeTotal = this.getRecipeProcessTime(); + this.processTime = 0; + + this.setChanged(); + } + } + + @Override + public void tick() { + super.tick(); + + boolean shouldLit = this.isActive(RF_PER_TICK); + boolean shouldSave = false; + + this.receiveEnergyFromSlot(2); + + if (this.canRun() && this.level != null) { + RecipeHolder recipe = this.level.getRecipeManager() + .getRecipeFor(RecipeType.BLASTING, this, this.level) + .orElse(null); + + if (recipe == null) { + recipe = this.level.getRecipeManager() + .getRecipeFor(RecipeType.SMELTING, this, this.level) + .orElse(null); + } + + // Machine kickoff + if (!this.isActive(RF_PER_TICK) && this.canProcess(recipe)) { + this.energyStorage.consumeEnergy(RF_PER_TICK); + this.processTime++; + + shouldSave = true; + } + // Machine is already running + else if (this.isActive(RF_PER_TICK) && this.canProcess(recipe)) { + this.energyStorage.consumeEnergy(RF_PER_TICK); + this.processTime++; + + if (this.processTime == this.processTimeTotal) { + this.processTime = 0; + this.processTimeTotal = this.getRecipeProcessTime(); + + this.processItem(recipe); + + shouldSave = true; + } + } + // Machine is active but invalid recipe + else { + this.processTime = 0; + } + } + + this.sendUpdate(shouldLit); + + if (shouldSave) { + this.setChanged(); + } + } + + private boolean canProcess(@Nullable RecipeHolder recipe) { + if (recipe != null && this.level != null) { + ItemStack recipeOutputStack = recipe.value().getResultItem(this.level.registryAccess()); + + if (recipeOutputStack.isEmpty()) { + return false; + } else { + ItemStack machineOutputStack = this.stacks.get(1); + + if (machineOutputStack.isEmpty()) { + return true; + } else if (!ItemStack.isSameItem(machineOutputStack, recipeOutputStack)) { + return false; + } else { + boolean isMachineOutputSlotCountPossible = machineOutputStack.getCount() + recipeOutputStack.getCount() <= this.getMaxStackSize(); + boolean isMachineOutputStackCountPossible = machineOutputStack.getCount() + recipeOutputStack.getCount() <= machineOutputStack.getMaxStackSize(); + boolean isRecipeOutputStackCountPossible = machineOutputStack.getCount() + recipeOutputStack.getCount() <= recipeOutputStack.getMaxStackSize(); + + return (isMachineOutputSlotCountPossible && isMachineOutputStackCountPossible) || isRecipeOutputStackCountPossible; + } + } + } else { + return false; + } + } + + private void processItem(@Nullable RecipeHolder recipe) { + if (recipe != null && this.level != null) { + ItemStack resultStack = recipe.value().getResultItem(this.level.registryAccess()); + ItemStack inputSlot = this.stacks.get(0); + ItemStack outputSlot = this.stacks.get(1); + + if (outputSlot.isEmpty()) { + this.stacks.set(1, resultStack.copy()); + } else if (ItemStack.isSameItem(outputSlot, resultStack)) { + outputSlot.grow(resultStack.getCount()); + } + + inputSlot.shrink(1); + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/LavaGeneratorBlockEntity.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/LavaGeneratorBlockEntity.java new file mode 100644 index 0000000..145c637 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/LavaGeneratorBlockEntity.java @@ -0,0 +1,227 @@ +package net.themcbrothers.usefulmachinery.block.entity; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Fluids; +import net.neoforged.neoforge.fluids.FluidActionResult; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.FluidType; +import net.neoforged.neoforge.fluids.FluidUtil; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.fluids.capability.templates.FluidTank; +import net.themcbrothers.usefulmachinery.block.AbstractMachineBlock; +import net.themcbrothers.usefulmachinery.core.MachineryBlockEntities; +import net.themcbrothers.usefulmachinery.core.MachineryItems; +import net.themcbrothers.usefulmachinery.machine.RedstoneMode; +import net.themcbrothers.usefulmachinery.menu.LavaGeneratorMenu; +import org.jetbrains.annotations.Nullable; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public class LavaGeneratorBlockEntity extends AbstractMachineBlockEntity { + public static final int TANK_CAPACITY = 4000; // TODO config + public static final int TICKS_PER_MB = 5; // TODO config + public static final int MB_PER_USE = 20; // TODO config + public static final int BASE_TICKING_ENERGY = 150; // TODO evaluate if should be in config + private int burnTime; + private int burnTimeTotal; + private final FluidTank lavaTank; + private final ContainerData fields = new ContainerData() { + @Override + public int getCount() { + return 9; + } + + @Override + public void set(int index, int value) { + switch (index) { + case 2 -> LavaGeneratorBlockEntity.this.redstoneMode = RedstoneMode.byOrdinal(value); + case 4 -> LavaGeneratorBlockEntity.this.burnTime = value; + case 5 -> LavaGeneratorBlockEntity.this.burnTimeTotal = value; + default -> { + } + } + } + + @Override + public int get(int index) { + return switch (index) { + case 0 -> LavaGeneratorBlockEntity.this.getEnergyStored(); + case 1 -> LavaGeneratorBlockEntity.this.getMaxEnergyStored(); + case 2 -> LavaGeneratorBlockEntity.this.redstoneMode.ordinal(); + case 3 -> LavaGeneratorBlockEntity.this.getUpgradeSlotSize(); + case 4 -> LavaGeneratorBlockEntity.this.burnTime; + case 5 -> LavaGeneratorBlockEntity.this.burnTimeTotal; + case 6 -> LavaGeneratorBlockEntity.this.lavaTank.getFluidAmount(); + case 7 -> LavaGeneratorBlockEntity.this.lavaTank.getCapacity(); + case 8 -> BuiltInRegistries.FLUID.getId(LavaGeneratorBlockEntity.this.lavaTank.getFluid().getFluid()); + default -> 0; + }; + } + }; + + public LavaGeneratorBlockEntity(BlockPos pos, BlockState state) { + super(MachineryBlockEntities.LAVA_GENERATOR.get(), pos, state, true); + + this.lavaTank = new FluidTank(TANK_CAPACITY, fluidStack -> fluidStack.getFluid().isSame(Fluids.LAVA)); + } + + @Override + protected int[] getInputSlots() { + return new int[]{0}; + } + + @Override + protected int[] getOutputSlots() { + return new int[0]; + } + + @Override + protected boolean canRun() { + boolean canRun = this.redstoneMode.canRun(this); + boolean canGenerate = this.energyStorage.getEnergyStored() <= this.energyStorage.getMaxEnergyStored() - BASE_TICKING_ENERGY; + + return this.level != null && canRun && canGenerate; + } + + @Override + public ContainerData getContainerData() { + return this.fields; + } + + @Override + public int getContainerSize() { + return 3; + } + + @Override + public Component getDisplayName() { + return TEXT_UTILS.translate("container", "lava_generator"); + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(int id, Inventory playerInventory, Player pPlayer) { + return new LavaGeneratorMenu(id, playerInventory, this, this.getUpgradeContainer(), this.getContainerData()); + } + + @Override + public void saveAdditional(CompoundTag compound) { + super.saveAdditional(compound); + + compound.putInt("BurnTime", this.burnTime); + compound.putInt("BurnTimeTotal", this.burnTimeTotal); + + if (!this.lavaTank.getFluid().isEmpty()) { + compound.put("Tank", this.lavaTank.writeToNBT(new CompoundTag())); + } + } + + @Override + public void load(CompoundTag compound) { + this.burnTime = compound.getInt("BurnTime"); + this.burnTimeTotal = compound.getInt("BurnTimeTotal"); + + if (compound.contains("Tank", CompoundTag.TAG_COMPOUND)) { + this.lavaTank.readFromNBT(compound.getCompound("Tank")); + } + + super.load(compound); + } + + @Override + public boolean canPlaceItemThroughFace(int index, ItemStack stack, @Nullable Direction direction) { + return index == 0 && FluidUtil.getFluidHandler(stack) + .map(handler -> handler.getFluidInTank(0).getFluid().isSame(Fluids.LAVA)).orElse(false); + } + + @Override + public boolean canTakeItemThroughFace(int index, ItemStack stack, Direction direction) { + return index == 1; + } + + @Override + public void tick() { + super.tick(); + + boolean shouldLit = false; + boolean shouldSave = false; + + this.transferFluid(); + + if (this.canRun() && this.hasFuel() && this.burnTime <= 0) { + shouldLit = this.consumeFuel(); + } + + if (this.burnTime > 0) { + --this.burnTime; + + int upgradeCount = this.getUpgradeCount(MachineryItems.SUSTAINED_UPGRADE); + + // Calc the multiplier for the generation + double multiplier = upgradeCount * BASE_TICKING_ENERGY / (double) this.upgradeContainer.getMaxStackSize(); + + // Generate the energy + this.energyStorage.growEnergy((int) (BASE_TICKING_ENERGY + multiplier)); + + shouldLit = true; + shouldSave = true; + } + + this.sendEnergyToSlot(); + this.sendUpdate(shouldLit); + this.sendEnergy(); + + if (shouldSave) { + this.setChanged(); + } + } + + private void transferFluid() { + final ItemStack bucketStack = this.stacks.get(0); + + if (!bucketStack.isEmpty()) { + FluidActionResult result = FluidUtil.tryEmptyContainer(bucketStack, this.lavaTank, FluidType.BUCKET_VOLUME, null, true); + + if (result.isSuccess()) { + ItemStack outputSlotStack = this.stacks.get(1); + ItemStack resultStack = result.getResult(); + + if (ItemStack.isSameItem(resultStack, outputSlotStack) && resultStack.getMaxStackSize() > 1 && outputSlotStack.getCount() <= outputSlotStack.getMaxStackSize() - resultStack.getCount()) { + outputSlotStack.grow(resultStack.getCount()); + bucketStack.shrink(1); + } else if (outputSlotStack.isEmpty()) { + this.stacks.set(1, resultStack); + + bucketStack.shrink(1); + } + } + } + } + + private boolean hasFuel() { + return this.lavaTank.getFluidAmount() >= MB_PER_USE; + } + + private boolean consumeFuel() { + FluidStack fluid = this.lavaTank.drain(MB_PER_USE, IFluidHandler.FluidAction.EXECUTE); + + this.burnTime = this.calcBurnTime(TICKS_PER_MB * fluid.getAmount()); + this.burnTimeTotal = LavaGeneratorBlockEntity.TICKS_PER_MB * LavaGeneratorBlockEntity.MB_PER_USE; + + return true; + } + + public FluidTank getLavaTank() { + return this.lavaTank; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/extension/Compactor.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/extension/Compactor.java new file mode 100644 index 0000000..745dca2 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/extension/Compactor.java @@ -0,0 +1,10 @@ +package net.themcbrothers.usefulmachinery.block.entity.extension; + +import net.minecraft.world.Container; +import net.themcbrothers.usefulmachinery.machine.CompactorMode; + +public interface Compactor extends Container { + CompactorMode getMode(); + + void setMode(CompactorMode mode); +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/extension/SimpleCompactor.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/extension/SimpleCompactor.java new file mode 100644 index 0000000..28d8f15 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/extension/SimpleCompactor.java @@ -0,0 +1,25 @@ +package net.themcbrothers.usefulmachinery.block.entity.extension; + +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.item.ItemStack; +import net.themcbrothers.usefulmachinery.machine.CompactorMode; + +public class SimpleCompactor extends SimpleContainer implements Compactor { + private CompactorMode mode; + + public SimpleCompactor(CompactorMode mode, ItemStack... stacks) { + super(stacks); + + this.mode = mode; + } + + @Override + public CompactorMode getMode() { + return this.mode; + } + + @Override + public void setMode(CompactorMode mode) { + this.mode = mode; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/extension/UpgradeContainer.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/extension/UpgradeContainer.java new file mode 100644 index 0000000..64999ee --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/extension/UpgradeContainer.java @@ -0,0 +1,14 @@ +package net.themcbrothers.usefulmachinery.block.entity.extension; + +import net.minecraft.world.SimpleContainer; + +public class UpgradeContainer extends SimpleContainer { + public UpgradeContainer(int size) { + super(size); + } + + @Override + public int getMaxStackSize() { + return 4; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/entity/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/package-info.java new file mode 100644 index 0000000..a580dca --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/entity/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.block.entity; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/block/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/block/package-info.java new file mode 100644 index 0000000..5fa7fae --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/block/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.block; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/client/screen/AbstractMachineScreen.java b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/AbstractMachineScreen.java new file mode 100644 index 0000000..a587ec5 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/AbstractMachineScreen.java @@ -0,0 +1,84 @@ +package net.themcbrothers.usefulmachinery.client.screen; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Renderable; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.themcbrothers.lib.client.screen.widgets.EnergyBar; +import net.themcbrothers.lib.network.PacketUtils; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.client.screen.widget.RedstoneModeButton; +import net.themcbrothers.usefulmachinery.machine.RedstoneMode; +import net.themcbrothers.usefulmachinery.menu.AbstractMachineMenu; +import net.themcbrothers.usefulmachinery.network.SetRedstoneModePacket; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public abstract class AbstractMachineScreen extends AbstractContainerScreen { + private static final ResourceLocation UPGRADE_SLOTS_TEXTURE = UsefulMachinery.rl("textures/gui/container/upgrade_slots.png"); + + public AbstractMachineScreen(T menu, Inventory playerInventory, Component title) { + super(menu, playerInventory, title); + } + + @Override + public void render(GuiGraphics guiGraphics, int x, int y, float partialTick) { + super.render(guiGraphics, x, y, partialTick); + + this.renderTooltip(guiGraphics, x, y); + } + + @Override + protected void init() { + super.init(); + + RedstoneModeButton redstoneModeButton = new RedstoneModeButton(this.menu, this.leftPos - 16, this.topPos, button -> { + RedstoneMode mode = ((RedstoneModeButton) button).getMode(); + + PacketUtils.sendToServer(new SetRedstoneModePacket(mode)); + }); + + this.addRenderableWidget(redstoneModeButton); + this.addRenderableWidget(new EnergyBar(this.leftPos + 155, this.topPos + 17, EnergyBar.Size._10x50, this.menu, this)); + + this.titleLabelX = (this.imageWidth - this.font.width(this.title)) / 2; + } + + @Override + protected void renderTooltip(GuiGraphics guiGraphics, int x, int y) { + super.renderTooltip(guiGraphics, x, y); + + for (Renderable renderable : this.renderables) { + if (renderable instanceof RedstoneModeButton button && button.isHoveredOrFocused()) { + RedstoneMode mode = button.getMode(); + + guiGraphics.renderTooltip(this.font, TEXT_UTILS.translate("misc", "redstoneMode", mode.name()), x, y); + } + + if (renderable instanceof EnergyBar energyBar && energyBar.isHoveredOrFocused()) { + energyBar.renderToolTip(guiGraphics, x, y); + } + } + } + + protected void renderUpgradeSlots(GuiGraphics guiGraphics) { + int x = this.leftPos + 179; + int y = this.topPos; + int yOffset = 8; + int upgradeSlotSize = this.menu.getUpgradeSlotSize(); + + if (upgradeSlotSize != 0) { + guiGraphics.blit(UPGRADE_SLOTS_TEXTURE, x, y, 0, 0, 34, 8); + + for (int i = 0; i < upgradeSlotSize; i++) { + guiGraphics.blit(UPGRADE_SLOTS_TEXTURE, x, y + yOffset, 0, 8, 34, 18); + + yOffset += 18; + } + + guiGraphics.blit(UPGRADE_SLOTS_TEXTURE, x, y + yOffset, 0, 26, 34, 8); + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/client/screen/CoalGeneratorScreen.java b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/CoalGeneratorScreen.java new file mode 100644 index 0000000..6ec2320 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/CoalGeneratorScreen.java @@ -0,0 +1,33 @@ +package net.themcbrothers.usefulmachinery.client.screen; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.menu.CoalGeneratorMenu; + +public class CoalGeneratorScreen extends AbstractMachineScreen { + private static final ResourceLocation TEXTURES = UsefulMachinery.rl("textures/gui/container/coal_generator.png"); + + public CoalGeneratorScreen(CoalGeneratorMenu menu, Inventory playerInventory, Component title) { + super(menu, playerInventory, title); + } + + @Override + protected void renderBg(GuiGraphics guiGraphics, float partialTick, int x, int y) { + int i = this.leftPos; + int j = this.topPos; + + guiGraphics.blit(TEXTURES, i, j, 0, 0, this.imageWidth, this.imageHeight); + + // Render burning flame + if (this.menu.isBurning()) { + int l = this.menu.getBurnTimeScaled(); + + guiGraphics.blit(TEXTURES, 54 + i, 34 + j + 12 - l, 176, 12 - l, 14, l + 1); + } + + this.renderUpgradeSlots(guiGraphics); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/client/screen/CompactorScreen.java b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/CompactorScreen.java new file mode 100644 index 0000000..12d786c --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/CompactorScreen.java @@ -0,0 +1,64 @@ +package net.themcbrothers.usefulmachinery.client.screen; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Renderable; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.themcbrothers.lib.network.PacketUtils; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.client.screen.widget.CompactorModeButton; +import net.themcbrothers.usefulmachinery.machine.CompactorMode; +import net.themcbrothers.usefulmachinery.menu.CompactorMenu; +import net.themcbrothers.usefulmachinery.network.SetCompactorModePacket; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public class CompactorScreen extends AbstractMachineScreen { + private static final ResourceLocation TEXTURES = UsefulMachinery.rl("textures/gui/container/compactor.png"); + + public CompactorScreen(CompactorMenu menu, Inventory playerInventory, Component title) { + super(menu, playerInventory, title); + } + + @Override + protected void init() { + super.init(); + + CompactorModeButton compactorModeButton = new CompactorModeButton(this.menu, this.leftPos + 9, this.topPos + 31, 20, 20, button -> { + CompactorMode mode = ((CompactorModeButton) button).getMode(); + + PacketUtils.sendToServer(new SetCompactorModePacket(mode)); + }); + + this.addRenderableWidget(compactorModeButton); + } + + @Override + protected void renderBg(GuiGraphics guiGraphics, float partialTick, int x, int y) { + int i = this.leftPos; + int j = this.topPos; + + guiGraphics.blit(TEXTURES, i, j, 0, 0, this.imageWidth, this.imageHeight); + + // Render arrow + int l = this.menu.getProgressScaled(24); + + guiGraphics.blit(TEXTURES, 58 + i, 32 + j, 176, 14, l, 17); + + this.renderUpgradeSlots(guiGraphics); + } + + @Override + protected void renderTooltip(GuiGraphics guiGraphics, int x, int y) { + super.renderTooltip(guiGraphics, x, y); + + for (Renderable renderable : this.renderables) { + if (renderable instanceof CompactorModeButton button && button.isHoveredOrFocused()) { + CompactorMode mode = button.getMode(); + + guiGraphics.renderTooltip(this.font, TEXT_UTILS.translate("misc", "compact_" + mode.getSerializedName()), x, y); + } + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/client/screen/CrusherScreen.java b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/CrusherScreen.java new file mode 100644 index 0000000..375e3dd --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/CrusherScreen.java @@ -0,0 +1,31 @@ +package net.themcbrothers.usefulmachinery.client.screen; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.menu.CrusherMenu; + +public class CrusherScreen extends AbstractMachineScreen { + private static final ResourceLocation TEXTURES = UsefulMachinery.rl("textures/gui/container/crusher.png"); + + public CrusherScreen(CrusherMenu menu, Inventory playerInventory, Component title) { + super(menu, playerInventory, title); + } + + @Override + protected void renderBg(GuiGraphics guiGraphics, float partialTick, int x, int y) { + int i = this.leftPos; + int j = this.topPos; + + guiGraphics.blit(TEXTURES, i, j, 0, 0, this.imageWidth, this.imageHeight); + + // Render arrow + int l = this.menu.getProgressScaled(24); + + guiGraphics.blit(TEXTURES, 58 + i, 34 + j, 176, 14, l, 17); + + this.renderUpgradeSlots(guiGraphics); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/client/screen/ElectricSmelterScreen.java b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/ElectricSmelterScreen.java new file mode 100644 index 0000000..c32c3e2 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/ElectricSmelterScreen.java @@ -0,0 +1,31 @@ +package net.themcbrothers.usefulmachinery.client.screen; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.menu.ElectricSmelterMenu; + +public class ElectricSmelterScreen extends AbstractMachineScreen { + private static final ResourceLocation TEXTURES = UsefulMachinery.rl("textures/gui/container/electric_smelter.png"); + + public ElectricSmelterScreen(ElectricSmelterMenu menu, Inventory playerInventory, Component title) { + super(menu, playerInventory, title); + } + + @Override + protected void renderBg(GuiGraphics guiGraphics, float partialTick, int x, int y) { + int i = this.leftPos; + int j = this.topPos; + + guiGraphics.blit(TEXTURES, i, j, 0, 0, this.imageWidth, this.imageHeight); + + // Render arrow + int l = this.menu.getProgressScaled(24); + + guiGraphics.blit(TEXTURES, 58 + i, 32 + j, 176, 14, l, 17); + + this.renderUpgradeSlots(guiGraphics); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/client/screen/LavaGeneratorScreen.java b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/LavaGeneratorScreen.java new file mode 100644 index 0000000..f755bea --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/LavaGeneratorScreen.java @@ -0,0 +1,53 @@ +package net.themcbrothers.usefulmachinery.client.screen; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Renderable; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.themcbrothers.lib.client.screen.widgets.FluidTank; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.menu.LavaGeneratorMenu; + +public class LavaGeneratorScreen extends AbstractMachineScreen { + private static final ResourceLocation TEXTURES = UsefulMachinery.rl("textures/gui/container/lava_generator.png"); + + public LavaGeneratorScreen(LavaGeneratorMenu menu, Inventory playerInventory, Component title) { + super(menu, playerInventory, title); + } + + @Override + protected void init() { + super.init(); + + this.addRenderableOnly(new FluidTank(this.leftPos + 11, this.topPos + 17, 10, 50, this.menu.getFluidTankHandler(), this)); + } + + @Override + protected void renderBg(GuiGraphics guiGraphics, float partialTick, int x, int y) { + int i = this.leftPos; + int j = this.topPos; + + guiGraphics.blit(TEXTURES, i, j, 0, 0, this.imageWidth, this.imageHeight); + + // Render burning flame + if (this.menu.isBurning()) { + int l = this.menu.getBurnTimeScaled(); + + guiGraphics.blit(TEXTURES, 81 + i, 34 + j + 12 - l, 176, 12 - l, 14, l + 1); + } + + this.renderUpgradeSlots(guiGraphics); + } + + @Override + protected void renderTooltip(GuiGraphics guiGraphics, int x, int y) { + super.renderTooltip(guiGraphics, x, y); + + for (Renderable renderable : this.renderables) { + if (renderable instanceof FluidTank fluidTank && fluidTank.isHoveredOrFocused()) { + fluidTank.renderToolTip(guiGraphics, x, y); + } + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/client/screen/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/package-info.java new file mode 100644 index 0000000..a78dea3 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.client.screen; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/client/screen/widget/CompactorModeButton.java b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/widget/CompactorModeButton.java new file mode 100644 index 0000000..598730c --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/widget/CompactorModeButton.java @@ -0,0 +1,56 @@ +package net.themcbrothers.usefulmachinery.client.screen.widget; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.client.gui.widget.ExtendedButton; +import net.themcbrothers.usefulmachinery.machine.CompactorMode; +import net.themcbrothers.usefulmachinery.menu.CompactorMenu; + + +public class CompactorModeButton extends ExtendedButton { + private final CompactorMenu menu; + + + public CompactorModeButton(CompactorMenu menu, int x, int y, int width, int height, OnPress onPress) { + super(x, y, width, height, Component.empty(), button -> { + ((CompactorModeButton) button).cycleMode(); + + onPress.onPress(button); + }); + + this.menu = menu; + } + + @Override + public void setFocused(boolean focused) { + super.setFocused(false); + } + + @Override + public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + super.renderWidget(guiGraphics, mouseX, mouseY, partialTick); + + Font font = Minecraft.getInstance().font; + ItemStack renderStack = this.getMode().getItemProvider().asItem().getDefaultInstance(); + + guiGraphics.renderItemDecorations(font, renderStack, this.getX() + 2, this.getY() + 2); + guiGraphics.renderItem(renderStack, this.getX() + 2, this.getY() + 2); + } + + private void cycleMode() { + int ordinal = this.menu.getCompactorMode().ordinal() + 1; + + if (ordinal >= CompactorMode.values().length) { + ordinal = 0; + } + + this.menu.setCompactorMode(CompactorMode.byOrdinal(ordinal)); + } + + public CompactorMode getMode() { + return this.menu.getCompactorMode(); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/client/screen/widget/RedstoneModeButton.java b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/widget/RedstoneModeButton.java new file mode 100644 index 0000000..6bffc97 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/widget/RedstoneModeButton.java @@ -0,0 +1,53 @@ +package net.themcbrothers.usefulmachinery.client.screen.widget; + +import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.client.gui.widget.ExtendedButton; +import net.themcbrothers.usefulmachinery.machine.RedstoneMode; +import net.themcbrothers.usefulmachinery.menu.AbstractMachineMenu; + +public class RedstoneModeButton extends ExtendedButton { + private final AbstractMachineMenu menu; + + public RedstoneModeButton(AbstractMachineMenu menu, int x, int y, OnPress handler) { + super(x, y, 16, 16, Component.empty(), button -> { + ((RedstoneModeButton) button).cycleMode(); + handler.onPress(button); + }); + + this.menu = menu; + } + + @Override + public void setFocused(boolean pFocused) { + super.setFocused(false); + } + + @Override + public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { + super.renderWidget(guiGraphics, mouseX, mouseY, partialTick); + + RedstoneMode mode = this.getMode(); + ResourceLocation icon = mode.getIcon(); + + RenderSystem.disableDepthTest(); + + guiGraphics.blit(icon, this.getX(), this.getY(), 0, mode.ordinal() == 0 ? 0 : 2, this.width, this.height, 16, 16); + } + + private void cycleMode() { + int ordinal = this.menu.getRedstoneMode().ordinal() + 1; + + if (ordinal >= RedstoneMode.values().length) { + ordinal = 0; + } + + this.menu.setRedstoneMode(RedstoneMode.byOrdinal(ordinal)); + } + + public RedstoneMode getMode() { + return this.menu.getRedstoneMode(); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/client/screen/widget/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/widget/package-info.java new file mode 100644 index 0000000..bcaab8e --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/client/screen/widget/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.client.screen.widget; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jade/MachineryJadePlugin.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jade/MachineryJadePlugin.java new file mode 100644 index 0000000..bdb6063 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jade/MachineryJadePlugin.java @@ -0,0 +1,20 @@ +package net.themcbrothers.usefulmachinery.compat.jade; + +import snownee.jade.api.IWailaClientRegistration; +import snownee.jade.api.IWailaCommonRegistration; +import snownee.jade.api.IWailaPlugin; +import snownee.jade.api.WailaPlugin; + +/** + * Jade compatibility + */ +@WailaPlugin +public class MachineryJadePlugin implements IWailaPlugin { + @Override + public void register(IWailaCommonRegistration registration) { + } + + @Override + public void registerClient(IWailaClientRegistration registration) { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jade/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jade/package-info.java new file mode 100644 index 0000000..97f20ee --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jade/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.compat.jade; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/JEICompat.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/JEICompat.java new file mode 100644 index 0000000..0b9211e --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/JEICompat.java @@ -0,0 +1,87 @@ +package net.themcbrothers.usefulmachinery.compat.jei; + +import mezz.jei.api.IModPlugin; +import mezz.jei.api.JeiPlugin; +import mezz.jei.api.constants.RecipeTypes; +import mezz.jei.api.helpers.IJeiHelpers; +import mezz.jei.api.registration.*; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.client.screen.*; +import net.themcbrothers.usefulmachinery.compat.jei.categories.CoalGeneratingCategory; +import net.themcbrothers.usefulmachinery.compat.jei.categories.CompactingCategory; +import net.themcbrothers.usefulmachinery.compat.jei.categories.CrushingCategory; +import net.themcbrothers.usefulmachinery.compat.jei.categories.LavaGeneratingCategory; +import net.themcbrothers.usefulmachinery.compat.jei.recipes.CoalGeneratingRecipeMaker; +import net.themcbrothers.usefulmachinery.compat.jei.recipes.LavaGeneratingRecipeMaker; +import net.themcbrothers.usefulmachinery.core.MachineryMenus; +import net.themcbrothers.usefulmachinery.core.MachineryRecipeTypes; +import net.themcbrothers.usefulmachinery.menu.*; +import net.themcbrothers.usefulmachinery.recipe.CompactingRecipe; +import net.themcbrothers.usefulmachinery.recipe.CrushingRecipe; + +import static net.themcbrothers.usefulmachinery.core.MachineryBlocks.*; +import static net.themcbrothers.usefulmachinery.core.MachineryItems.TIER_UPGRADE; + +/** + * JEI compatibility + */ +@JeiPlugin +public class JEICompat implements IModPlugin { + @Override + public ResourceLocation getPluginUid() { + return UsefulMachinery.rl("jeicompat"); + } + + @Override + public void registerItemSubtypes(ISubtypeRegistration registration) { + registration.useNbtForSubtypes(TIER_UPGRADE.get()); + } + + @Override + public void registerCategories(IRecipeCategoryRegistration registration) { + IJeiHelpers helpers = registration.getJeiHelpers(); + + registration.addRecipeCategories(new CrushingCategory(helpers.getGuiHelper())); + registration.addRecipeCategories(new CompactingCategory(helpers.getGuiHelper())); + registration.addRecipeCategories(new LavaGeneratingCategory(helpers.getGuiHelper())); + registration.addRecipeCategories(new CoalGeneratingCategory(helpers.getGuiHelper())); + } + + @Override + public void registerRecipes(IRecipeRegistration registration) { + registration.addRecipes(MachineryJeiRecipeTypes.CRUSHING, UsefulMachineryRecipeValidator.getRecipes(MachineryRecipeTypes.CRUSHING.get(), CrushingRecipe.class)); + registration.addRecipes(MachineryJeiRecipeTypes.COMPACTING, UsefulMachineryRecipeValidator.getRecipes(MachineryRecipeTypes.COMPACTING.get(), CompactingRecipe.class)); + registration.addRecipes(MachineryJeiRecipeTypes.LAVA_GENERATING, LavaGeneratingRecipeMaker.getLavaGeneratingRecipes(registration.getIngredientManager())); + registration.addRecipes(MachineryJeiRecipeTypes.COAL_GENERATING, CoalGeneratingRecipeMaker.getCoalGeneratingRecipes(registration.getIngredientManager())); + } + + @Override + public void registerRecipeTransferHandlers(IRecipeTransferRegistration registration) { + registration.addRecipeTransferHandler(CoalGeneratorMenu.class, MachineryMenus.COAL_GENERATOR.get(), MachineryJeiRecipeTypes.COAL_GENERATING, 0, 1, 2, 36); + registration.addRecipeTransferHandler(CrusherMenu.class, MachineryMenus.CRUSHER.get(), MachineryJeiRecipeTypes.CRUSHING, 0, 1, 4, 36); + registration.addRecipeTransferHandler(ElectricSmelterMenu.class, MachineryMenus.ELECTRIC_SMELTER.get(), RecipeTypes.SMELTING, 0, 1, 3, 36); + registration.addRecipeTransferHandler(ElectricSmelterMenu.class, MachineryMenus.ELECTRIC_SMELTER.get(), RecipeTypes.BLASTING, 0, 1, 3, 36); + registration.addRecipeTransferHandler(CompactorMenu.class, MachineryMenus.COMPACTOR.get(), MachineryJeiRecipeTypes.COMPACTING, 0, 1, 3, 36); + registration.addRecipeTransferHandler(LavaGeneratorMenu.class, MachineryMenus.LAVA_GENERATOR.get(), MachineryJeiRecipeTypes.LAVA_GENERATING, 0, 1, 2, 36); + } + + @Override + public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) { + registration.addRecipeCatalyst(new ItemStack(COAL_GENERATOR.get()), MachineryJeiRecipeTypes.COAL_GENERATING); + registration.addRecipeCatalyst(new ItemStack(CRUSHER.get()), MachineryJeiRecipeTypes.CRUSHING); + registration.addRecipeCatalyst(new ItemStack(ELECTRIC_SMELTER.get()), RecipeTypes.SMELTING, RecipeTypes.BLASTING); + registration.addRecipeCatalyst(new ItemStack(COMPACTOR.get()), MachineryJeiRecipeTypes.COMPACTING); + registration.addRecipeCatalyst(new ItemStack(LAVA_GENERATOR.get()), MachineryJeiRecipeTypes.LAVA_GENERATING); + } + + @Override + public void registerGuiHandlers(IGuiHandlerRegistration registration) { + registration.addGuiContainerHandler(CoalGeneratorScreen.class, new MachineGuiHandler(54, 34, 14, 14, MachineryJeiRecipeTypes.COAL_GENERATING)); + registration.addGuiContainerHandler(CrusherScreen.class, new MachineGuiHandler(58, 34, 28, 23, MachineryJeiRecipeTypes.CRUSHING)); + registration.addGuiContainerHandler(ElectricSmelterScreen.class, new MachineGuiHandler(58, 32, 24, 17, RecipeTypes.SMELTING, RecipeTypes.BLASTING)); + registration.addGuiContainerHandler(CompactorScreen.class, new MachineGuiHandler(58, 32, 24, 17, MachineryJeiRecipeTypes.COMPACTING)); + registration.addGuiContainerHandler(LavaGeneratorScreen.class, new MachineGuiHandler(81, 34, 14, 14, MachineryJeiRecipeTypes.LAVA_GENERATING)); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/MachineGuiHandler.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/MachineGuiHandler.java new file mode 100644 index 0000000..409a404 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/MachineGuiHandler.java @@ -0,0 +1,50 @@ +package net.themcbrothers.usefulmachinery.compat.jei; + +import mezz.jei.api.gui.handlers.IGuiClickableArea; +import mezz.jei.api.gui.handlers.IGuiContainerHandler; +import mezz.jei.api.recipe.RecipeType; +import net.minecraft.client.renderer.Rect2i; +import net.themcbrothers.usefulmachinery.client.screen.AbstractMachineScreen; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +public class MachineGuiHandler implements IGuiContainerHandler> { + private final int xPos; + private final int yPos; + private final int width; + private final int height; + private final RecipeType[] recipeTypes; + + public MachineGuiHandler(int xPos, int yPos, int width, int height, RecipeType... recipeTypes) { + this.xPos = xPos; + this.yPos = yPos; + this.width = width; + this.height = height; + this.recipeTypes = Objects.requireNonNull(recipeTypes); + } + + @Override + public List getGuiExtraAreas(AbstractMachineScreen menuScreen) { + int slots = Objects.requireNonNull(menuScreen).getMenu().getUpgradeSlotSize(); + + if (slots > 0) { + int height = 16 + slots * 18; + int width = 34; + + return List.of(new Rect2i(menuScreen.getGuiLeft() + 179, menuScreen.getGuiTop(), width, height)); + + } + + return Collections.emptyList(); + } + + @Override + public Collection getGuiClickableAreas(AbstractMachineScreen menuScreen, double guiMouseX, double guiMouseY) { + IGuiClickableArea clickableArea = IGuiClickableArea.createBasic(this.xPos, this.yPos, this.width, this.height, this.recipeTypes); + + return List.of(clickableArea); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/MachineryJeiRecipeTypes.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/MachineryJeiRecipeTypes.java new file mode 100644 index 0000000..58fe9bf --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/MachineryJeiRecipeTypes.java @@ -0,0 +1,18 @@ +package net.themcbrothers.usefulmachinery.compat.jei; + +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.vanilla.IJeiFuelingRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.compat.jei.recipes.CoalGeneratingRecipe; +import net.themcbrothers.usefulmachinery.compat.jei.recipes.LavaGeneratingRecipe; +import net.themcbrothers.usefulmachinery.core.MachineryRecipeTypes; +import net.themcbrothers.usefulmachinery.recipe.CompactingRecipe; +import net.themcbrothers.usefulmachinery.recipe.CrushingRecipe; + +public class MachineryJeiRecipeTypes { + public static final RecipeType> CRUSHING = RecipeType.createFromVanilla(MachineryRecipeTypes.CRUSHING.get()); + public static final RecipeType> COMPACTING = RecipeType.createFromVanilla(MachineryRecipeTypes.COMPACTING.get()); + public static final RecipeType LAVA_GENERATING = RecipeType.create(UsefulMachinery.MOD_ID, "lava_generating", LavaGeneratingRecipe.class); + public static final RecipeType COAL_GENERATING = RecipeType.create(UsefulMachinery.MOD_ID, "coal_generating", CoalGeneratingRecipe.class); +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/UsefulMachineryRecipeValidator.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/UsefulMachineryRecipeValidator.java new file mode 100644 index 0000000..7ac4005 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/UsefulMachineryRecipeValidator.java @@ -0,0 +1,30 @@ +package net.themcbrothers.usefulmachinery.compat.jei; + +import com.google.common.collect.Lists; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.RecipeType; + +import java.util.List; + +public class UsefulMachineryRecipeValidator { + public static > List> getRecipes(RecipeType type, Class clazz) { + List> results = Lists.newArrayList(); + ClientLevel world = Minecraft.getInstance().level; + + if (world != null) { + RecipeManager recipeManager = world.getRecipeManager(); + + for (RecipeHolder recipe : recipeManager.getRecipes()) { + if (recipe.value().getType() == type) { + results.add(new RecipeHolder<>(recipe.id(), clazz.cast(recipe.value()))); + } + } + } + + return results; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/CoalGeneratingCategory.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/CoalGeneratingCategory.java new file mode 100644 index 0000000..efe9a59 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/CoalGeneratingCategory.java @@ -0,0 +1,70 @@ +package net.themcbrothers.usefulmachinery.compat.jei.categories; + +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import mezz.jei.api.recipe.vanilla.IJeiFuelingRecipe; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.compat.jei.MachineryJeiRecipeTypes; +import net.themcbrothers.usefulmachinery.core.MachineryBlocks; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public class CoalGeneratingCategory implements IRecipeCategory { + private static final ResourceLocation TEXTURES = UsefulMachinery.rl("textures/gui/container/coal_generator.png"); + private final IDrawable background; + private final IDrawable icon; + private final IDrawableAnimated energyBar; + private final IDrawableAnimated fire; + + public CoalGeneratingCategory(IGuiHelper helper) { + this.icon = helper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(MachineryBlocks.COAL_GENERATOR.get())); + this.background = helper.createDrawable(TEXTURES, 34, 16, 132, 52); + this.energyBar = helper.drawableBuilder(TEXTURES, 246, 0, 10, 50) + .buildAnimated(200, IDrawableAnimated.StartDirection.BOTTOM, false); + this.fire = helper.drawableBuilder(TEXTURES, 176, 0, 14, 14) + .buildAnimated(400, IDrawableAnimated.StartDirection.TOP, true); + } + + @Override + public void draw(IJeiFuelingRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) { + this.energyBar.draw(graphics, 121, 1); + this.fire.draw(graphics, 20, 18); + } + + @Override + public RecipeType getRecipeType() { + return MachineryJeiRecipeTypes.COAL_GENERATING; + } + + @Override + public Component getTitle() { + return TEXT_UTILS.translate("jei", "fuel"); + } + + @Override + public IDrawable getBackground() { + return background; + } + + @Override + public IDrawable getIcon() { + return icon; + } + + @Override + public void setRecipe(IRecipeLayoutBuilder builder, IJeiFuelingRecipe recipe, IFocusGroup focuses) { + builder.addSlot(RecipeIngredientRole.INPUT, 46, 17).addItemStacks(recipe.getInputs()); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/CompactingCategory.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/CompactingCategory.java new file mode 100644 index 0000000..100ea30 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/CompactingCategory.java @@ -0,0 +1,75 @@ +package net.themcbrothers.usefulmachinery.compat.jei.categories; + + +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.compat.jei.MachineryJeiRecipeTypes; +import net.themcbrothers.usefulmachinery.core.MachineryBlocks; +import net.themcbrothers.usefulmachinery.recipe.CompactingRecipe; + +import java.util.Arrays; +import java.util.Objects; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public class CompactingCategory implements IRecipeCategory> { + private static final ResourceLocation TEXTURES = UsefulMachinery.rl("textures/gui/container/compactor.png"); + + private final IDrawable icon, background; + private final IDrawableAnimated arrow, energyBar; + + public CompactingCategory(IGuiHelper helper) { + this.icon = helper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(MachineryBlocks.COMPACTOR.get())); + this.background = helper.createDrawable(TEXTURES, 34, 16, 132, 52); + + this.arrow = helper.drawableBuilder(TEXTURES, 176, 14, 24, 17).buildAnimated(200, IDrawableAnimated.StartDirection.LEFT, false); + this.energyBar = helper.drawableBuilder(TEXTURES, 246, 0, 10, 50).buildAnimated(200, IDrawableAnimated.StartDirection.TOP, true); + } + + @Override + public void draw(RecipeHolder recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) { + this.arrow.draw(graphics, 24, 16); + this.energyBar.draw(graphics, 121, 1); + } + + @Override + public RecipeType> getRecipeType() { + return MachineryJeiRecipeTypes.COMPACTING; + } + + @Override + public Component getTitle() { + return TEXT_UTILS.translate("jei", "compacting"); + } + + @Override + public IDrawable getBackground() { + return this.background; + } + + @Override + public IDrawable getIcon() { + return this.icon; + } + + @Override + public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder recipe, IFocusGroup focusGroup) { + builder.addSlot(RecipeIngredientRole.INPUT, 1, 17).addItemStacks(Arrays.asList(recipe.value().getIngredients().get(0).getItems())); + builder.addSlot(RecipeIngredientRole.OUTPUT, 61, 17).addItemStack(recipe.value().getResultItem(Objects.requireNonNull(Minecraft.getInstance().level).registryAccess())); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/CrushingCategory.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/CrushingCategory.java new file mode 100644 index 0000000..4e05f6c --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/CrushingCategory.java @@ -0,0 +1,88 @@ +package net.themcbrothers.usefulmachinery.compat.jei.categories; + +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.compat.jei.MachineryJeiRecipeTypes; +import net.themcbrothers.usefulmachinery.core.MachineryBlocks; +import net.themcbrothers.usefulmachinery.recipe.CrushingRecipe; + +import java.util.Objects; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public class CrushingCategory implements IRecipeCategory> { + private static final ResourceLocation TEXTURES = UsefulMachinery.rl("textures/gui/container/crusher.png"); + + private final IDrawable icon, background; + private final IDrawableAnimated arrow, energyBar; + + public CrushingCategory(IGuiHelper helper) { + this.icon = helper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(MachineryBlocks.CRUSHER.get())); + this.background = helper.createDrawable(TEXTURES, 34, 16, 132, 52); + this.arrow = helper.drawableBuilder(TEXTURES, 176, 14, 24, 17).buildAnimated(200, IDrawableAnimated.StartDirection.LEFT, false); + this.energyBar = helper.drawableBuilder(TEXTURES, 246, 0, 10, 50).buildAnimated(200, IDrawableAnimated.StartDirection.TOP, true); + } + + @Override + public void draw(RecipeHolder recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) { + this.arrow.draw(graphics, 24, 18); + this.energyBar.draw(graphics, 121, 1); + + drawChance(recipe, graphics); + } + + @Override + public RecipeType> getRecipeType() { + return MachineryJeiRecipeTypes.CRUSHING; + } + + protected void drawChance(RecipeHolder recipe, GuiGraphics graphics) { + float secondaryChance = recipe.value().secondaryChance(); + + if (secondaryChance > 0) { + float secondaryChanceInPercent = secondaryChance * 100; + + Component text = Component.translatable(secondaryChanceInPercent + "%"); + Minecraft minecraft = Minecraft.getInstance(); + + graphics.drawString(minecraft.font, text, 79, 39, 0xFF808080); + } + } + + @Override + public Component getTitle() { + return TEXT_UTILS.translate("jei", "crushing"); + } + + @Override + public IDrawable getBackground() { + return this.background; + } + + @Override + public IDrawable getIcon() { + return this.icon; + } + + @Override + public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder recipe, IFocusGroup focusGroup) { + builder.addSlot(RecipeIngredientRole.INPUT, 1, 19).addIngredients(recipe.value().getIngredients().get(0)); + builder.addSlot(RecipeIngredientRole.OUTPUT, 61, 8).addItemStack(recipe.value().getResultItem(Objects.requireNonNull(Minecraft.getInstance().level).registryAccess())); + builder.addSlot(RecipeIngredientRole.OUTPUT, 61, 32).addItemStack(recipe.value().secondaryResult()); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/LavaGeneratingCategory.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/LavaGeneratingCategory.java new file mode 100644 index 0000000..2f0e1a5 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/LavaGeneratingCategory.java @@ -0,0 +1,70 @@ +package net.themcbrothers.usefulmachinery.compat.jei.categories; + +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import mezz.jei.api.recipe.vanilla.IJeiFuelingRecipe; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.compat.jei.MachineryJeiRecipeTypes; +import net.themcbrothers.usefulmachinery.core.MachineryBlocks; + +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; + +public class LavaGeneratingCategory implements IRecipeCategory { + private static final ResourceLocation TEXTURES = UsefulMachinery.rl("textures/gui/container/lava_generator.png"); + private final IDrawable background; + private final IDrawable icon; + private final IDrawableAnimated energyBar; + private final IDrawableAnimated fire; + + public LavaGeneratingCategory(IGuiHelper helper) { + this.icon = helper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(MachineryBlocks.LAVA_GENERATOR.get())); + this.background = helper.createDrawable(TEXTURES, 24, 16, 145, 52); + this.energyBar = helper.drawableBuilder(TEXTURES, 246, 0, 10, 50) + .buildAnimated(120, IDrawableAnimated.StartDirection.BOTTOM, false); + this.fire = helper.drawableBuilder(TEXTURES, 176, 0, 14, 14) + .buildAnimated(400, IDrawableAnimated.StartDirection.TOP, true); + } + + @Override + public void draw(IJeiFuelingRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) { + this.energyBar.draw(graphics, 131, 1); + this.fire.draw(graphics, 57, 18); + } + + @Override + public RecipeType getRecipeType() { + return MachineryJeiRecipeTypes.LAVA_GENERATING; + } + + @Override + public Component getTitle() { + return TEXT_UTILS.translate("jei", "fuel"); + } + + @Override + public IDrawable getBackground() { + return background; + } + + @Override + public IDrawable getIcon() { + return icon; + } + + @Override + public void setRecipe(IRecipeLayoutBuilder builder, IJeiFuelingRecipe recipe, IFocusGroup focuses) { + builder.addSlot(RecipeIngredientRole.INPUT, 2, 1).addItemStacks(recipe.getInputs()); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/package-info.java new file mode 100644 index 0000000..2c01141 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/categories/package-info.java @@ -0,0 +1,7 @@ +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package themcbros.usefulmachinery.compat.jei.categories; + +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/package-info.java new file mode 100644 index 0000000..2eb769e --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.compat.jei; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/CoalGeneratingRecipe.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/CoalGeneratingRecipe.java new file mode 100644 index 0000000..4481381 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/CoalGeneratingRecipe.java @@ -0,0 +1,32 @@ +package net.themcbrothers.usefulmachinery.compat.jei.recipes; + +import com.google.common.base.Preconditions; +import mezz.jei.api.recipe.vanilla.IJeiFuelingRecipe; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Unmodifiable; + +import javax.annotation.Nonnull; +import java.util.List; +import java.util.Objects; + +public class CoalGeneratingRecipe implements IJeiFuelingRecipe { + private final List inputs; + private final int burnTime; + + public CoalGeneratingRecipe(List inputs, int burnTime) { + Preconditions.checkArgument(burnTime == 1600); + + this.inputs = Objects.requireNonNull(inputs); + this.burnTime = burnTime; + } + + @Override + public @Unmodifiable List getInputs() { + return inputs; + } + + @Override + public int getBurnTime() { + return burnTime; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/CoalGeneratingRecipeMaker.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/CoalGeneratingRecipeMaker.java new file mode 100644 index 0000000..734d525 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/CoalGeneratingRecipeMaker.java @@ -0,0 +1,24 @@ +package net.themcbrothers.usefulmachinery.compat.jei.recipes; + +import mezz.jei.api.recipe.vanilla.IJeiFuelingRecipe; +import mezz.jei.api.runtime.IIngredientManager; +import net.neoforged.neoforge.common.CommonHooks; + +import java.util.Comparator; +import java.util.List; +import java.util.Objects; + +public class CoalGeneratingRecipeMaker { + public static List getCoalGeneratingRecipes(IIngredientManager ingredientManager) { + return Objects.requireNonNull(ingredientManager).getAllItemStacks().stream() + .mapMulti((stack, consumer) -> { + int burnTime = CommonHooks.getBurnTime(stack, null); + + if (burnTime == 1600) { + consumer.accept(new CoalGeneratingRecipe(List.of(stack), burnTime)); + } + }) + .sorted(Comparator.comparingInt(IJeiFuelingRecipe::getBurnTime)) + .toList(); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/LavaGeneratingRecipe.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/LavaGeneratingRecipe.java new file mode 100644 index 0000000..0fd2891 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/LavaGeneratingRecipe.java @@ -0,0 +1,31 @@ +package net.themcbrothers.usefulmachinery.compat.jei.recipes; + +import com.google.common.base.Preconditions; +import mezz.jei.api.recipe.vanilla.IJeiFuelingRecipe; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Unmodifiable; + +import java.util.List; +import java.util.Objects; + +public class LavaGeneratingRecipe implements IJeiFuelingRecipe { + private final List inputs; + private final int burnTime; + + public LavaGeneratingRecipe(List inputs, int burnTime) { + Preconditions.checkArgument(burnTime == 20000); + + this.inputs = Objects.requireNonNull(inputs); + this.burnTime = burnTime; + } + + @Override + public @Unmodifiable List getInputs() { + return inputs; + } + + @Override + public int getBurnTime() { + return burnTime; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/LavaGeneratingRecipeMaker.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/LavaGeneratingRecipeMaker.java new file mode 100644 index 0000000..8042e57 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/LavaGeneratingRecipeMaker.java @@ -0,0 +1,24 @@ +package net.themcbrothers.usefulmachinery.compat.jei.recipes; + +import mezz.jei.api.recipe.vanilla.IJeiFuelingRecipe; +import mezz.jei.api.runtime.IIngredientManager; +import net.neoforged.neoforge.common.CommonHooks; + +import java.util.Comparator; +import java.util.List; +import java.util.Objects; + +public class LavaGeneratingRecipeMaker { + public static List getLavaGeneratingRecipes(IIngredientManager ingredientManager) { + return Objects.requireNonNull(ingredientManager).getAllItemStacks().stream() + .mapMulti((stack, consumer) -> { + int burnTime = CommonHooks.getBurnTime(stack, null); + + if (burnTime == 20000) { + consumer.accept(new LavaGeneratingRecipe(List.of(stack), burnTime)); + } + }) + .sorted(Comparator.comparingInt(IJeiFuelingRecipe::getBurnTime)) + .toList(); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/package-info.java new file mode 100644 index 0000000..28bd697 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/jei/recipes/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNullableByDefault +package net.themcbrothers.usefulmachinery.compat.jei.recipes; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNullableByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/top/MachineProbeProvider.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/top/MachineProbeProvider.java new file mode 100644 index 0000000..2c976fc --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/top/MachineProbeProvider.java @@ -0,0 +1,48 @@ +package net.themcbrothers.usefulmachinery.compat.top; + +import mcjty.theoneprobe.api.*; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; + +public enum MachineProbeProvider implements IProbeInfoProvider { + INSTANCE; + + private static final ResourceLocation ID = UsefulMachinery.rl("machine_info"); + + @Override + public ResourceLocation getID() { + return ID; + } + + @Override + public void addProbeInfo(ProbeMode probeMode, IProbeInfo probeInfo, Player player, Level level, BlockState state, IProbeHitData hitData) { + if (level.getBlockEntity(hitData.getPos()) instanceof AbstractMachineBlockEntity machine) { + // Progress bar + int i = machine.getProcessTime(); + int j = machine.getProcessTimeTotal(); + + if (i != 0 && j != 0) { + float progress = (float) i * 100 / (float) j; + IProgressStyle style = probeInfo.defaultProgressStyle() + .prefix("Progress ") + .suffix("%") + .backgroundColor(0x00000000) + .borderColor(0xff7A7A7A) + .filledColor(0xff808080); + + probeInfo.progress((long) progress, 100, style); + } + + // display tier on upgraded machines + if (machine.getMachineTier(state).ordinal() > 0) { + ITextStyle style = probeInfo.defaultTextStyle(); + + probeInfo.text("Tier: " + machine.getMachineTier(state).getSerializedName(), style); + } + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/compat/top/TheOneProbeSupport.java b/src/main/java/net/themcbrothers/usefulmachinery/compat/top/TheOneProbeSupport.java new file mode 100644 index 0000000..edfa807 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/compat/top/TheOneProbeSupport.java @@ -0,0 +1,21 @@ +package net.themcbrothers.usefulmachinery.compat.top; + +import mcjty.theoneprobe.api.ITheOneProbe; +import net.themcbrothers.usefulmachinery.UsefulMachinery; + +import java.util.function.Function; + +/** + * The One Probe Compatibility + */ +public class TheOneProbeSupport implements Function { + public TheOneProbeSupport() { + } + + @Override + public Void apply(ITheOneProbe theOneProbe) { + UsefulMachinery.LOGGER.info("Enabling support for TheOneProbe"); + theOneProbe.registerProvider(MachineProbeProvider.INSTANCE); + return null; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryBlockEntities.java b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryBlockEntities.java new file mode 100644 index 0000000..d7537cb --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryBlockEntities.java @@ -0,0 +1,20 @@ +package net.themcbrothers.usefulmachinery.core; + +import com.google.gson.JsonArray; +import net.themcbrothers.lib.registries.DeferredBlockEntityType; +import net.themcbrothers.usefulmachinery.block.entity.*; + +import static net.themcbrothers.usefulmachinery.core.Registration.BLOCK_ENTITY_TYPES; + + +public class MachineryBlockEntities { + public static final DeferredBlockEntityType COAL_GENERATOR = BLOCK_ENTITY_TYPES.register("coal_generator", CoalGeneratorBlockEntity::new, MachineryBlocks.COAL_GENERATOR); + public static final DeferredBlockEntityType LAVA_GENERATOR = BLOCK_ENTITY_TYPES.register("lava_generator", LavaGeneratorBlockEntity::new, MachineryBlocks.LAVA_GENERATOR); + public static final DeferredBlockEntityType CREATIVE_POWER_CELL = BLOCK_ENTITY_TYPES.register("creative_power_cell", CreativePowerCellBlockEntity::new, MachineryBlocks.CREATIVE_POWER_CELL); + public static final DeferredBlockEntityType ELECTRIC_SMELTER = BLOCK_ENTITY_TYPES.register("electric_smelter", ElectricSmelterBlockEntity::new, MachineryBlocks.ELECTRIC_SMELTER); + public static final DeferredBlockEntityType CRUSHER = BLOCK_ENTITY_TYPES.register("crusher", CrusherBlockEntity::new, MachineryBlocks.CRUSHER); + public static final DeferredBlockEntityType COMPACTOR = BLOCK_ENTITY_TYPES.register("compactor", CompactorBlockEntity::new, MachineryBlocks.COMPACTOR); + + static void init() { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryBlocks.java b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryBlocks.java new file mode 100644 index 0000000..dbecc6f --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryBlocks.java @@ -0,0 +1,23 @@ +package net.themcbrothers.usefulmachinery.core; + +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.neoforged.neoforge.registries.DeferredBlock; +import net.themcbrothers.usefulmachinery.block.*; +import net.themcbrothers.usefulmachinery.item.CreativePowerCellItem; + +import static net.themcbrothers.usefulmachinery.core.Registration.BLOCKS; + +public final class MachineryBlocks { + public static final DeferredBlock COAL_GENERATOR = BLOCKS.registerBlock("coal_generator", CoalGeneratorBlock::new, BlockBehaviour.Properties.of().strength(2f).sound(SoundType.METAL).requiresCorrectToolForDrops()); + public static final DeferredBlock COMPACTOR = BLOCKS.registerBlock("compactor", CompactorBlock::new, BlockBehaviour.Properties.of().strength(2f).sound(SoundType.METAL).requiresCorrectToolForDrops()); + public static final DeferredBlock CRUSHER = BLOCKS.registerBlock("crusher", CrusherBlock::new, BlockBehaviour.Properties.of().strength(2f).sound(SoundType.METAL).requiresCorrectToolForDrops()); + public static final DeferredBlock ELECTRIC_SMELTER = BLOCKS.registerBlock("electric_smelter", ElectricSmelterBlock::new, BlockBehaviour.Properties.of().strength(2f).sound(SoundType.METAL).requiresCorrectToolForDrops()); + public static final DeferredBlock LAVA_GENERATOR = BLOCKS.registerBlock("lava_generator", LavaGeneratorBlock::new, BlockBehaviour.Properties.of().strength(2f).sound(SoundType.METAL).requiresCorrectToolForDrops()); + public static final DeferredBlock CREATIVE_POWER_CELL = BLOCKS.register("creative_power_cell", () -> new CreativePowerCellBlock(BlockBehaviour.Properties.of().strength(0.5F).sound(SoundType.METAL).noLootTable()), block -> new CreativePowerCellItem(block, new Item.Properties().stacksTo(1))); + + static void init() { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryIngredientTypes.java b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryIngredientTypes.java new file mode 100644 index 0000000..27e104b --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryIngredientTypes.java @@ -0,0 +1,17 @@ +package net.themcbrothers.usefulmachinery.core; + +import net.neoforged.neoforge.common.crafting.IngredientType; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.themcbrothers.usefulmachinery.recipe.ingredient.CountIngredient; + +import static net.themcbrothers.usefulmachinery.core.Registration.INGREDIENT_TYPES; + +/** + * @deprecated Please use the themcbroslib version + */ +public class MachineryIngredientTypes { + public static final DeferredHolder, IngredientType> COUNT_INGREDIENT = INGREDIENT_TYPES.register("count", () -> new IngredientType<>(CountIngredient.CODEC)); + + static void init() { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryItems.java b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryItems.java new file mode 100644 index 0000000..b172250 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryItems.java @@ -0,0 +1,26 @@ +package net.themcbrothers.usefulmachinery.core; + +import net.minecraft.world.item.Item; +import net.neoforged.neoforge.registries.DeferredItem; +import net.themcbrothers.usefulmachinery.item.BatteryItem; +import net.themcbrothers.usefulmachinery.item.CreativePowerCellItem; +import net.themcbrothers.usefulmachinery.item.TierUpgradeItem; +import net.themcbrothers.usefulmachinery.item.UpgradeItem; + +import static net.themcbrothers.usefulmachinery.core.Registration.ITEMS; + +public final class MachineryItems { + public static final DeferredItem MACHINE_FRAME = ITEMS.registerSimpleItem("machine_frame"); + public static final DeferredItem COMPACTOR_KIT = ITEMS.registerSimpleItem("compactor_kit"); + + // Special items + public static final DeferredItem BATTERY = ITEMS.registerItem("battery", BatteryItem::new, new Item.Properties().stacksTo(1)); + public static final DeferredItem TIER_UPGRADE = ITEMS.registerItem("tier_upgrade", TierUpgradeItem::new); + public static final DeferredItem EFFICIENCY_UPGRADE = ITEMS.registerItem("efficiency_upgrade", UpgradeItem::new); + public static final DeferredItem PRECISION_UPGRADE = ITEMS.registerItem("precision_upgrade", UpgradeItem::new); + public static final DeferredItem SUSTAINED_UPGRADE = ITEMS.registerItem("sustained_upgrade", UpgradeItem::new); + + + static void init() { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryMenus.java b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryMenus.java new file mode 100644 index 0000000..c208972 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryMenus.java @@ -0,0 +1,19 @@ +package net.themcbrothers.usefulmachinery.core; + +import com.google.gson.JsonArray; +import net.minecraft.world.inventory.MenuType; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.themcbrothers.usefulmachinery.menu.*; + +import static net.themcbrothers.usefulmachinery.core.Registration.MENUS; + +public class MachineryMenus { + public static final DeferredHolder, MenuType> COAL_GENERATOR = MENUS.register("coal_generator", CoalGeneratorMenu::new); + public static final DeferredHolder, MenuType> LAVA_GENERATOR = MENUS.register("lava_generator", LavaGeneratorMenu::new); + public static final DeferredHolder, MenuType> ELECTRIC_SMELTER = MENUS.register("electric_smelter", ElectricSmelterMenu::new); + public static final DeferredHolder, MenuType> CRUSHER = MENUS.register("crusher", CrusherMenu::new); + public static final DeferredHolder, MenuType> COMPACTOR = MENUS.register("compactor", CompactorMenu::new); + + static void init() { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryRecipeSerializers.java b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryRecipeSerializers.java new file mode 100644 index 0000000..a409c7d --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryRecipeSerializers.java @@ -0,0 +1,18 @@ +package net.themcbrothers.usefulmachinery.core; + +import com.google.gson.JsonArray; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.themcbrothers.usefulmachinery.recipe.CompactingRecipe; +import net.themcbrothers.usefulmachinery.recipe.CrushingRecipe; + +import static net.themcbrothers.usefulmachinery.core.Registration.RECIPE_SERIALIZERS; + + +public class MachineryRecipeSerializers { + public static final DeferredHolder, RecipeSerializer> CRUSHING = RECIPE_SERIALIZERS.register("crushing", CrushingRecipe.Serializer::new); + public static final DeferredHolder, RecipeSerializer> COMPACTING = RECIPE_SERIALIZERS.register("compacting", CompactingRecipe.Serializer::new); + + static void init() { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryRecipeTypes.java b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryRecipeTypes.java new file mode 100644 index 0000000..07d45f6 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryRecipeTypes.java @@ -0,0 +1,18 @@ +package net.themcbrothers.usefulmachinery.core; + +import net.minecraft.world.item.crafting.RecipeType; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.themcbrothers.usefulmachinery.recipe.CompactingRecipe; +import net.themcbrothers.usefulmachinery.recipe.CrushingRecipe; + +import static net.themcbrothers.usefulmachinery.core.Registration.RECIPE_TYPES; + +public class MachineryRecipeTypes { + public static final DeferredHolder, RecipeType> CRUSHING = RECIPE_TYPES.register("crushing", () -> new RecipeType<>() { + }); + public static final DeferredHolder, RecipeType> COMPACTING = RECIPE_TYPES.register("compacting", () -> new RecipeType<>() { + }); + + static void init() { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryStats.java b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryStats.java new file mode 100644 index 0000000..105d4ec --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryStats.java @@ -0,0 +1,17 @@ +package net.themcbrothers.usefulmachinery.core; + +import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.registries.DeferredHolder; + +import static net.themcbrothers.usefulmachinery.core.Registration.CUSTOM_STATS; + +public class MachineryStats { + public static final DeferredHolder INTERACTION_WITH_CRUSHER = CUSTOM_STATS.register("interact_with_crusher", location -> location); + public static final DeferredHolder INTERACTION_WITH_ELECTRIC_SMELTER = CUSTOM_STATS.register("interact_with_electric_smelter", location -> location); + public static final DeferredHolder INTERACTION_WITH_COMPACTOR = CUSTOM_STATS.register("interact_with_compactor", location -> location); + public static final DeferredHolder INTERACTION_WITH_COAL_GENERATOR = CUSTOM_STATS.register("interact_with_coal_generator", location -> location); + public static final DeferredHolder INTERACTION_WITH_LAVA_GENERATOR = CUSTOM_STATS.register("interact_with_lava_generator", location -> location); + + static void init() { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryTabs.java b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryTabs.java new file mode 100644 index 0000000..46f6e03 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryTabs.java @@ -0,0 +1,76 @@ +package net.themcbrothers.usefulmachinery.core; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.ItemLike; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.themcbrothers.lib.energy.EnergyContainerItem; +import net.themcbrothers.usefulfoundation.core.FoundationTabs; +import net.themcbrothers.usefulmachinery.item.TierUpgradeItem; +import net.themcbrothers.usefulmachinery.machine.MachineTier; + +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashSet; + +import static net.themcbrothers.lib.energy.EnergyContainerItem.TAG_ENERGY; +import static net.themcbrothers.usefulmachinery.UsefulMachinery.TEXT_UTILS; +import static net.themcbrothers.usefulmachinery.core.Registration.CREATIVE_MODE_TABS; + +public final class MachineryTabs { + public static final DeferredHolder BASE = CREATIVE_MODE_TABS.register("base", () -> CreativeModeTab.builder() + .withTabsBefore(FoundationTabs.BASE.getId()) + .icon(() -> new ItemStack(MachineryItems.BATTERY.get())) + .title(TEXT_UTILS.translate("itemGroup", "base")) + .displayItems((params, output) -> { + Registration.BLOCKS.getEntries().forEach(block -> output.accept(block.get())); + Registration.ITEMS.getEntries().stream() + .map(DeferredHolder::get) + .map(MachineryTabs::considerSpecialNeeds) + .forEach(output::acceptAll); + }) + .build()); + + private static Collection considerSpecialNeeds(ItemLike itemLike) { + if (itemLike.asItem() instanceof EnergyContainerItem energyContainerItem) { + ItemStack stack = new ItemStack(itemLike); + CompoundTag tag = new CompoundTag(); + + tag.putInt(TAG_ENERGY, energyContainerItem.getMaxEnergyStored(stack)); + stack.setTag(tag); + + return Collections.singleton(stack); + } else if (itemLike.asItem() instanceof TierUpgradeItem) { + Collection stacks = new HashSet<>(); + + for (MachineTier tier : MachineTier.values()) { + if (tier != MachineTier.SIMPLE) { + ItemStack stack = new ItemStack(itemLike); + CompoundTag tag = new CompoundTag(); + + tag.putInt("Tier", tier.ordinal()); + stack.setTag(tag); + + stacks.add(stack); + } + } + + return stacks.stream() + .sorted(Comparator.comparingInt(value -> { + CompoundTag tag = value.getTag(); + if (tag != null) { + return tag.getInt("Tier"); + } + return 0; + })) + .toList(); + } + + return Collections.singleton(new ItemStack(itemLike)); + } + + static void init() { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryTags.java b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryTags.java new file mode 100644 index 0000000..bc550a1 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/MachineryTags.java @@ -0,0 +1,17 @@ +package net.themcbrothers.usefulmachinery.core; + +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.themcbrothers.lib.util.TagUtils; +import net.themcbrothers.usefulmachinery.UsefulMachinery; + +public class MachineryTags { + public static class Blocks { + + } + + public static class Items { + public static final TagKey BATTERIES = TagUtils.forgeItemTag("batteries"); + public static final TagKey MACHINERY_UPGRADES = TagUtils.modItemTag(UsefulMachinery.MOD_ID, "machinery_upgrades"); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/core/Registration.java b/src/main/java/net/themcbrothers/usefulmachinery/core/Registration.java new file mode 100644 index 0000000..8a18666 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/core/Registration.java @@ -0,0 +1,53 @@ +package net.themcbrothers.usefulmachinery.core; + +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.common.crafting.IngredientType; +import net.neoforged.neoforge.registries.DeferredRegister; +import net.neoforged.neoforge.registries.NeoForgeRegistries; +import net.themcbrothers.lib.registries.BlockDeferredRegister; +import net.themcbrothers.lib.registries.BlockEntityTypeDeferredRegister; +import net.themcbrothers.lib.registries.ItemDeferredRegister; +import net.themcbrothers.lib.registries.MenuTypeDeferredRegister; +import net.themcbrothers.usefulmachinery.UsefulMachinery; + +public final class Registration { + public static final BlockEntityTypeDeferredRegister BLOCK_ENTITY_TYPES = BlockEntityTypeDeferredRegister.create(UsefulMachinery.MOD_ID); + public static final MenuTypeDeferredRegister MENUS = MenuTypeDeferredRegister.create(UsefulMachinery.MOD_ID); + public static final ItemDeferredRegister ITEMS = ItemDeferredRegister.create(UsefulMachinery.MOD_ID); + public static final BlockDeferredRegister BLOCKS = BlockDeferredRegister.create(UsefulMachinery.MOD_ID, ITEMS); + public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, UsefulMachinery.MOD_ID); + public static final DeferredRegister CUSTOM_STATS = DeferredRegister.create(Registries.CUSTOM_STAT, UsefulMachinery.MOD_ID); + public static final DeferredRegister> RECIPE_TYPES = DeferredRegister.create(Registries.RECIPE_TYPE, UsefulMachinery.MOD_ID); + public static final DeferredRegister> RECIPE_SERIALIZERS = DeferredRegister.create(Registries.RECIPE_SERIALIZER, UsefulMachinery.MOD_ID); + /** + * @deprecated Please remove me soon! ;-) + */ + public static final DeferredRegister> INGREDIENT_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.INGREDIENT_TYPES, UsefulMachinery.MOD_ID); + + public static void register(IEventBus modEventBus) { + MachineryBlockEntities.init(); + MachineryMenus.init(); + MachineryItems.init(); + MachineryBlocks.init(); + MachineryTabs.init(); + MachineryStats.init(); + MachineryRecipeTypes.init(); + MachineryRecipeSerializers.init(); + MachineryIngredientTypes.init(); + + BLOCK_ENTITY_TYPES.register(modEventBus); + MENUS.register(modEventBus); + ITEMS.register(modEventBus); + BLOCKS.register(modEventBus); + CREATIVE_MODE_TABS.register(modEventBus); + CUSTOM_STATS.register(modEventBus); + RECIPE_TYPES.register(modEventBus); + RECIPE_SERIALIZERS.register(modEventBus); + INGREDIENT_TYPES.register(modEventBus); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/DataGenEvents.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/DataGenEvents.java new file mode 100644 index 0000000..a1df18f --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/DataGenEvents.java @@ -0,0 +1,29 @@ +package net.themcbrothers.usefulmachinery.datagen; + +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.data.event.GatherDataEvent; +import net.themcbrothers.usefulmachinery.UsefulMachinery; + +@Mod.EventBusSubscriber(modid = UsefulMachinery.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) +public final class DataGenEvents { + @SubscribeEvent + static void onDataGen(final GatherDataEvent event) { + final var generator = event.getGenerator(); + final var output = generator.getPackOutput(); + final var existingFileHelper = event.getExistingFileHelper(); + final var lookupProvider = event.getLookupProvider(); + + // Server resources + MachineryBlockTagsProvider blockTagsProvider = new MachineryBlockTagsProvider(output, lookupProvider, existingFileHelper); + generator.addProvider(event.includeServer(), blockTagsProvider); + generator.addProvider(event.includeServer(), new MachineryItemTagsProvider(output, lookupProvider, blockTagsProvider.contentsGetter(), existingFileHelper)); + generator.addProvider(event.includeServer(), new MachineryLootTableProvider(output)); + generator.addProvider(event.includeServer(), new MachineryRecipeProvider(output)); + + // Client resources + generator.addProvider(event.includeClient(), new MachineryBlockStateProvider(output, existingFileHelper)); + generator.addProvider(event.includeClient(), new MachineryItemModelProvider(output, existingFileHelper)); + generator.addProvider(event.includeClient(), new MachineryLanguageProvider(output)); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryBlockLootSubProvider.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryBlockLootSubProvider.java new file mode 100644 index 0000000..c0a4630 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryBlockLootSubProvider.java @@ -0,0 +1,92 @@ +package net.themcbrothers.usefulmachinery.datagen; + +import net.minecraft.advancements.critereon.StatePropertiesPredicate; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.loot.BlockLootSubProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.storage.loot.LootPool; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.entries.DynamicLoot; +import net.minecraft.world.level.storage.loot.entries.LootItem; +import net.minecraft.world.level.storage.loot.functions.*; +import net.minecraft.world.level.storage.loot.predicates.InvertedLootItemCondition; +import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition; +import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider; +import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.themcbrothers.usefulmachinery.block.AbstractMachineBlock; +import net.themcbrothers.usefulmachinery.core.Registration; +import net.themcbrothers.usefulmachinery.machine.MachineTier; + +import java.util.Collections; +import java.util.Objects; +import java.util.stream.Collectors; + +import static net.themcbrothers.usefulmachinery.core.MachineryBlocks.*; + +public class MachineryBlockLootSubProvider extends BlockLootSubProvider { + protected MachineryBlockLootSubProvider() { + super(Collections.emptySet(), FeatureFlags.REGISTRY.allFlags()); + } + + @Override + protected Iterable getKnownBlocks() { + return Registration.BLOCKS.getEntries().stream().map(DeferredHolder::value).collect(Collectors.toList()); + } + + @Override + protected void generate() { + this.add(COAL_GENERATOR.get(), block -> simpleMachineBlock(block, copyMachineNbtWithBurnTime())); + this.add(COMPACTOR.get(), block -> simpleMachineBlock(block, copyMachineNbt())); + this.add(CRUSHER.get(), block -> simpleMachineBlock(block, copyMachineNbt())); + this.add(ELECTRIC_SMELTER.get(), block -> simpleMachineBlock(block, copyMachineNbt())); + this.add(LAVA_GENERATOR.get(), block -> simpleMachineBlock(block, copyMachineNbtWithBurnTimeAndTank())); + } + + private LootTable.Builder simpleMachineBlock(Block block, LootItemFunction.Builder copyNbtFunction) { + BlockEntityType blockEntityType = Objects.requireNonNull(BuiltInRegistries.BLOCK_ENTITY_TYPE.get(BuiltInRegistries.BLOCK.getKey(block))); + + return LootTable.lootTable() + .withPool(applyExplosionCondition(block, LootPool.lootPool()) + .setRolls(ConstantValue.exactly(1)) + .add(LootItem.lootTableItem(block) + .apply(CopyNameFunction.copyName(CopyNameFunction.NameSource.BLOCK_ENTITY)) + .apply(SetContainerContents.setContents(blockEntityType) + .withEntry(DynamicLoot.dynamicEntry(new ResourceLocation("contents")))) + .apply(copyNbtFunction) + .apply(copyBlockState(block)) + )); + } + + private CopyBlockState.Builder copyBlockState(Block block) { + return CopyBlockState.copyState(block) + .copy(AbstractMachineBlock.TIER) + .when(InvertedLootItemCondition.invert(LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) + .setProperties(StatePropertiesPredicate.Builder.properties() + .hasProperty(AbstractMachineBlock.TIER, MachineTier.SIMPLE)))); + } + + private CopyNbtFunction.Builder copyMachineNbt() { + return CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY) + .copy("Items", "BlockEntityTag.Items") + .copy("Upgrades", "BlockEntityTag.Upgrades") + .copy("EnergyStored", "BlockEntityTag.EnergyStored") + .copy("RedstoneMode", "BlockEntityTag.RedstoneMode") + .copy("ProcessTime", "BlockEntityTag.ProcessTime") + .copy("ProcessTimeTotal", "BlockEntityTag.ProcessTimeTotal"); + } + + private CopyNbtFunction.Builder copyMachineNbtWithBurnTime() { + return copyMachineNbt() + .copy("BurnTime", "BlockEntityTag.BurnTime") + .copy("BurnTimeTotal", "BlockEntityTag.BurnTimeTotal"); + } + + private CopyNbtFunction.Builder copyMachineNbtWithBurnTimeAndTank() { + return copyMachineNbtWithBurnTime() + .copy("Tank", "BlockEntityTag.Tank"); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryBlockStateProvider.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryBlockStateProvider.java new file mode 100644 index 0000000..e508891 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryBlockStateProvider.java @@ -0,0 +1,69 @@ +package net.themcbrothers.usefulmachinery.datagen; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.PackOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.neoforged.neoforge.client.model.generators.BlockStateProvider; +import net.neoforged.neoforge.client.model.generators.ConfiguredModel; +import net.neoforged.neoforge.client.model.generators.ModelFile; +import net.neoforged.neoforge.common.data.ExistingFileHelper; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.block.AbstractMachineBlock; + +import static net.themcbrothers.usefulmachinery.core.MachineryBlocks.*; + +public class MachineryBlockStateProvider extends BlockStateProvider { + public MachineryBlockStateProvider(PackOutput output, ExistingFileHelper exFileHelper) { + super(output, UsefulMachinery.MOD_ID, exFileHelper); + } + + @Override + protected void registerStatesAndModels() { + // Machine blocks + horizontalMachineBlock(COAL_GENERATOR.get()); + horizontalMachineBlock(COMPACTOR.get()); + horizontalMachineBlock(CRUSHER.get()); + horizontalMachineBlock(ELECTRIC_SMELTER.get()); + horizontalMachineBlock(LAVA_GENERATOR.get()); + + simpleBlockItem(COAL_GENERATOR.get()); + simpleBlockItem(COMPACTOR.get()); + simpleBlockItem(CRUSHER.get()); + simpleBlockItem(ELECTRIC_SMELTER.get()); + simpleBlockItem(LAVA_GENERATOR.get()); + + // Common blocks + simpleBlock(CREATIVE_POWER_CELL.get(), cubeAll(Blocks.REDSTONE_BLOCK)); + + simpleBlockItem(CREATIVE_POWER_CELL.get(), cubeAll(Blocks.REDSTONE_BLOCK)); + } + + private void simpleBlockItem(Block block) { + simpleBlockItem(block, models().getExistingFile(blockTexture(block))); + } + + private void horizontalMachineBlock(Block block) { + String blockName = BuiltInRegistries.BLOCK.getKey(block).getPath(); + String blockPath = modLoc("block/" + blockName).getPath(); + ResourceLocation machineBlockModel = modLoc("block/machine_block"); + + ModelFile model = models().withExistingParent(blockName, machineBlockModel) + .texture("front", blockPath + "_front") + .renderType("cutout"); + + ModelFile modelOn = models().withExistingParent(blockName + "_on", machineBlockModel) + .texture("front", blockPath + "_front_on") + .renderType("cutout"); + + getVariantBuilder(block) + .forAllStatesExcept(state -> ConfiguredModel.builder() + .modelFile(state.getValue(BlockStateProperties.LIT) ? modelOn : model) + .rotationY(((int) state.getValue(BlockStateProperties.HORIZONTAL_FACING).toYRot() + 180) % 360) + .build(), + AbstractMachineBlock.TIER + ); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryBlockTagsProvider.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryBlockTagsProvider.java new file mode 100644 index 0000000..7344b15 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryBlockTagsProvider.java @@ -0,0 +1,24 @@ +package net.themcbrothers.usefulmachinery.datagen; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.BlockTagsProvider; +import net.neoforged.neoforge.common.data.ExistingFileHelper; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import org.jetbrains.annotations.Nullable; + +import java.util.concurrent.CompletableFuture; + +import static net.minecraft.tags.BlockTags.MINEABLE_WITH_PICKAXE; +import static net.themcbrothers.usefulmachinery.core.MachineryBlocks.*; + +public class MachineryBlockTagsProvider extends BlockTagsProvider { + public MachineryBlockTagsProvider(PackOutput output, CompletableFuture lookupProvider, @Nullable ExistingFileHelper existingFileHelper) { + super(output, lookupProvider, UsefulMachinery.MOD_ID, existingFileHelper); + } + + @Override + protected void addTags(HolderLookup.Provider provider) { + this.tag(MINEABLE_WITH_PICKAXE).add(COAL_GENERATOR.get(), COMPACTOR.get(), CRUSHER.get(), ELECTRIC_SMELTER.get(), LAVA_GENERATOR.get()); + } +} \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryItemModelProvider.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryItemModelProvider.java new file mode 100644 index 0000000..0b27aaf --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryItemModelProvider.java @@ -0,0 +1,39 @@ +package net.themcbrothers.usefulmachinery.datagen; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.client.model.generators.ItemModelProvider; +import net.neoforged.neoforge.common.data.ExistingFileHelper; +import net.themcbrothers.usefulmachinery.UsefulMachinery; + +import static net.themcbrothers.usefulmachinery.core.MachineryItems.*; + +public class MachineryItemModelProvider extends ItemModelProvider { + public MachineryItemModelProvider(PackOutput output, ExistingFileHelper existingFileHelper) { + super(output, UsefulMachinery.MOD_ID, existingFileHelper); + } + + + @Override + protected void registerModels() { + // Machinery Items + basicItem(BATTERY.get()); + basicItem(EFFICIENCY_UPGRADE.get()); + basicItem(PRECISION_UPGRADE.get()); + basicItem(SUSTAINED_UPGRADE.get()); + + String tierUpgrade = BuiltInRegistries.ITEM.getKey(TIER_UPGRADE.get()).getPath(); + withExistingParent(tierUpgrade, "item/generated") + .texture("layer0", modLoc("item/tier_upgrade_0")) + .texture("layer1", modLoc("item/tier_upgrade_1")); + + String machineFrame = BuiltInRegistries.ITEM.getKey(MACHINE_FRAME.get()).getPath(); + withExistingParent(machineFrame, "block/cube_all") + .texture("all", modLoc("block/" + machineFrame)); + + String compactorKit = BuiltInRegistries.ITEM.getKey(COMPACTOR_KIT.get()).getPath(); + withExistingParent(compactorKit, "item/generated") + .texture("layer0", "usefulfoundation:item/lead_plate") + .texture("layer1", "usefulfoundation:item/gold_gear"); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryItemTagsProvider.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryItemTagsProvider.java new file mode 100644 index 0000000..38c2612 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryItemTagsProvider.java @@ -0,0 +1,27 @@ +package net.themcbrothers.usefulmachinery.datagen; + +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.ItemTagsProvider; +import net.minecraft.world.level.block.Block; +import net.neoforged.neoforge.common.data.ExistingFileHelper; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import org.jetbrains.annotations.Nullable; + +import java.util.concurrent.CompletableFuture; + +import static net.themcbrothers.usefulmachinery.core.MachineryItems.*; +import static net.themcbrothers.usefulmachinery.core.MachineryTags.Items.BATTERIES; +import static net.themcbrothers.usefulmachinery.core.MachineryTags.Items.MACHINERY_UPGRADES; + +public class MachineryItemTagsProvider extends ItemTagsProvider { + public MachineryItemTagsProvider(PackOutput output, CompletableFuture lookupProvider, CompletableFuture> blockTags, @Nullable ExistingFileHelper existingFileHelper) { + super(output, lookupProvider, blockTags, UsefulMachinery.MOD_ID, existingFileHelper); + } + + @Override + protected void addTags(HolderLookup.Provider pProvider) { + this.tag(BATTERIES).add(BATTERY.get()); + this.tag(MACHINERY_UPGRADES).add(EFFICIENCY_UPGRADE.get(), PRECISION_UPGRADE.get(), SUSTAINED_UPGRADE.get()); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryLanguageProvider.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryLanguageProvider.java new file mode 100644 index 0000000..263cbbd --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryLanguageProvider.java @@ -0,0 +1,73 @@ +package net.themcbrothers.usefulmachinery.datagen; + +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.LanguageProvider; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.core.MachineryItems; + +import static net.themcbrothers.usefulmachinery.core.MachineryBlocks.*; + +public class MachineryLanguageProvider extends LanguageProvider { + + public MachineryLanguageProvider(PackOutput output) { + super(output, UsefulMachinery.MOD_ID, "en_us"); + } + + @Override + protected void addTranslations() { + // Creative Tab + this.add("itemGroup.usefulmachinery.base", "Useful Machinery"); + + // Machines + this.add(COAL_GENERATOR.get(), "Coal Generator"); + this.add(COMPACTOR.get(), "Compactor"); + this.add(CREATIVE_POWER_CELL.get(), "Creative Power Cell"); + this.add(CRUSHER.get(), "Crusher"); + this.add(ELECTRIC_SMELTER.get(), "Electric Smelter"); + this.add(LAVA_GENERATOR.get(), "Lava Generator"); + + // Items + this.add(MachineryItems.BATTERY.get(), "Battery"); + this.add(MachineryItems.COMPACTOR_KIT.get(), "Compactor Kit"); + this.add(MachineryItems.MACHINE_FRAME.get(), "Machine Frame"); + this.add(MachineryItems.TIER_UPGRADE.get().getDescriptionId() + "_basic", "Basic Upgrade"); + this.add(MachineryItems.TIER_UPGRADE.get().getDescriptionId() + "_reinforced", "Reinforced Upgrade"); + this.add(MachineryItems.TIER_UPGRADE.get().getDescriptionId() + "_factory", "Factory Upgrade"); + this.add(MachineryItems.TIER_UPGRADE.get().getDescriptionId() + "_overkill", "Overkill Upgrade"); + this.add(MachineryItems.EFFICIENCY_UPGRADE.get(), "Efficiency Upgrade"); + this.add(MachineryItems.PRECISION_UPGRADE.get(), "Precision Upgrade"); + this.add(MachineryItems.SUSTAINED_UPGRADE.get(), "Sustained Upgrade"); + + // Container Titles + this.add("container.usefulmachinery.coal_generator", "Coal Generator"); + this.add("container.usefulmachinery.compactor", "Compactor"); + this.add("container.usefulmachinery.crusher", "Crusher"); + this.add("container.usefulmachinery.electric_smelter", "Electric Smelter"); + this.add("container.usefulmachinery.lava_generator", "Lava Generator"); + + // JEI + this.add("jei.usefulmachinery.crushing", "Crushing"); + this.add("jei.usefulmachinery.electric_smelting", "Electric Smelting"); + this.add("jei.usefulmachinery.compacting", "Compacting"); + this.add("jei.usefulmachinery.fuel", "Fuel for RF"); + + // Misc + this.add("misc.usefulmachinery.energy", "%s FE"); + this.add("misc.usefulmachinery.energyWithMax", "%s / %s FE"); + this.add("misc.usefulmachinery.empty", "Empty"); + this.add("misc.usefulmachinery.fluidWithMax", "%s / %s mB"); + this.add("misc.usefulmachinery.fluidWithMaxName", "%s, %s / %s mB"); + this.add("misc.usefulmachinery.redstoneMode", "Redstone Mode, %s"); + this.add("misc.usefulmachinery.compact_plate", "Plate Press"); + this.add("misc.usefulmachinery.compact_gear", "Gear Manufacturing"); + this.add("misc.usefulmachinery.compact_block", "Block Former"); + + // Stats + this.add("stat.usefulmachinery.interact_with_crusher", "Interactions with Crusher"); + this.add("stat.usefulmachinery.interact_with_electric_smelter", "Interactions with Electric Smelter"); + this.add("stat.usefulmachinery.interact_with_compactor", "Interactions with Compactor"); + this.add("stat.usefulmachinery.interact_with_coal_generator", "Interactions with Coal Generator"); + this.add("stat.usefulmachinery.interact_with_lava_generator", "Interactions with Lava Generator"); + } + +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryLootTableProvider.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryLootTableProvider.java new file mode 100644 index 0000000..d132c23 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryLootTableProvider.java @@ -0,0 +1,35 @@ +package net.themcbrothers.usefulmachinery.datagen; + +import net.minecraft.data.PackOutput; +import net.minecraft.data.loot.LootTableProvider; +import net.minecraft.data.loot.packs.VanillaLootTableProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.storage.loot.LootDataId; +import net.minecraft.world.level.storage.loot.LootDataType; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.ValidationContext; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class MachineryLootTableProvider extends LootTableProvider { + public MachineryLootTableProvider(PackOutput output) { + super(output, Set.of(), VanillaLootTableProvider.create(output).getTables()); + } + + @Override + public List getTables() { + return List.of(new LootTableProvider.SubProviderEntry(MachineryBlockLootSubProvider::new, LootContextParamSets.BLOCK)); + } + + @Override + protected void validate(Map map, ValidationContext context) { + map.forEach((location, lootTable) -> { + LootDataId id = new LootDataId<>(LootDataType.TABLE, location); + + lootTable.validate(context.setParams(lootTable.getParamSet()).enterElement("{" + location + "}", id)); + }); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryRecipeProvider.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryRecipeProvider.java new file mode 100644 index 0000000..6d76b6b --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/MachineryRecipeProvider.java @@ -0,0 +1,176 @@ +package net.themcbrothers.usefulmachinery.datagen; + +import net.minecraft.data.PackOutput; +import net.minecraft.data.recipes.*; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.neoforged.neoforge.common.Tags; +import net.themcbrothers.usefulmachinery.datagen.recipe.CompactingRecipeBuilder; +import net.themcbrothers.usefulmachinery.datagen.recipe.CrushingRecipeBuilder; +import net.themcbrothers.usefulmachinery.machine.CompactorMode; +import net.themcbrothers.usefulmachinery.recipe.ingredient.CountIngredient; + +import static net.themcbrothers.usefulfoundation.core.FoundationBlocks.*; +import static net.themcbrothers.usefulfoundation.core.FoundationItems.*; +import static net.themcbrothers.usefulfoundation.core.FoundationTags.Items.*; +import static net.themcbrothers.usefulmachinery.UsefulMachinery.rl; +import static net.themcbrothers.usefulmachinery.core.MachineryBlocks.*; +import static net.themcbrothers.usefulmachinery.core.MachineryItems.*; +import static net.themcbrothers.usefulmachinery.core.MachineryTags.Items.BATTERIES; + +public class MachineryRecipeProvider extends RecipeProvider { + public MachineryRecipeProvider(PackOutput output) { + super(output); + } + + @Override + protected void buildRecipes(RecipeOutput recipeOutput) { + // Gears + CompactingRecipeBuilder.compacting(ALUMINUM_GEAR, CountIngredient.of(4, INGOTS_ALUMINUM), 200, CompactorMode.GEAR).unlockedBy("has_aluminum", has(INGOTS_ALUMINUM)).save(recipeOutput, rl("aluminum_gear_from_compacting")); + CompactingRecipeBuilder.compacting(BRONZE_GEAR, CountIngredient.of(4, INGOTS_BRONZE), 200, CompactorMode.GEAR).unlockedBy("has_bronze", has(INGOTS_BRONZE)).save(recipeOutput, rl("bronze_gear_from_compacting")); + CompactingRecipeBuilder.compacting(COPPER_GEAR, CountIngredient.of(4, Tags.Items.INGOTS_COPPER), 200, CompactorMode.GEAR).unlockedBy("has_copper", has(Tags.Items.INGOTS_COPPER)).save(recipeOutput, rl("copper_gear_from_compacting")); + CompactingRecipeBuilder.compacting(DIAMOND_GEAR, CountIngredient.of(4, Tags.Items.GEMS_DIAMOND), 200, CompactorMode.GEAR).unlockedBy("has_diamond", has(Tags.Items.GEMS_DIAMOND)).save(recipeOutput, rl("diamond_gear_from_compacting")); + CompactingRecipeBuilder.compacting(ELECTRUM_GEAR, CountIngredient.of(4, INGOTS_ELECTRUM), 200, CompactorMode.GEAR).unlockedBy("has_electrum", has(INGOTS_ELECTRUM)).save(recipeOutput, rl("electrum_gear_from_compacting")); + CompactingRecipeBuilder.compacting(ENDERIUM_GEAR, CountIngredient.of(4, INGOTS_ENDERIUM), 200, CompactorMode.GEAR).unlockedBy("has_enderium", has(INGOTS_ENDERIUM)).save(recipeOutput, rl("enderium_gear_from_compacting")); + CompactingRecipeBuilder.compacting(GOLD_GEAR, CountIngredient.of(4, Tags.Items.INGOTS_GOLD), 200, CompactorMode.GEAR).unlockedBy("has_gold", has(Tags.Items.INGOTS_GOLD)).save(recipeOutput, rl("gold_gear_from_compacting")); + CompactingRecipeBuilder.compacting(INVAR_GEAR, CountIngredient.of(4, INGOTS_INVAR), 200, CompactorMode.GEAR).unlockedBy("has_invar", has(INGOTS_INVAR)).save(recipeOutput, rl("invar_gear_from_compacting")); + CompactingRecipeBuilder.compacting(IRON_GEAR, CountIngredient.of(4, Tags.Items.INGOTS_IRON), 200, CompactorMode.GEAR).unlockedBy("has_iron", has(Tags.Items.INGOTS_IRON)).save(recipeOutput, rl("iron_gear_from_compacting")); + CompactingRecipeBuilder.compacting(LEAD_GEAR, CountIngredient.of(4, INGOTS_LEAD), 200, CompactorMode.GEAR).unlockedBy("has_lead", has(INGOTS_LEAD)).save(recipeOutput, rl("lead_gear_from_compacting")); + CompactingRecipeBuilder.compacting(NICKEL_GEAR, CountIngredient.of(4, INGOTS_NICKEL), 200, CompactorMode.GEAR).unlockedBy("has_nickel", has(INGOTS_NICKEL)).save(recipeOutput, rl("nickel_gear_from_compacting")); + CompactingRecipeBuilder.compacting(PLATINUM_GEAR, CountIngredient.of(4, INGOTS_PLATINUM), 200, CompactorMode.GEAR).unlockedBy("has_platinum", has(INGOTS_PLATINUM)).save(recipeOutput, rl("platinum_gear_from_compacting")); + CompactingRecipeBuilder.compacting(SIGNALUM_GEAR, CountIngredient.of(4, INGOTS_SIGNALUM), 200, CompactorMode.GEAR).unlockedBy("has_signalum", has(INGOTS_SIGNALUM)).save(recipeOutput, rl("signalum_gear_from_compacting")); + CompactingRecipeBuilder.compacting(SILVER_GEAR, CountIngredient.of(4, INGOTS_SILVER), 200, CompactorMode.GEAR).unlockedBy("has_silver", has(INGOTS_SILVER)).save(recipeOutput, rl("silver_gear_from_compacting")); + CompactingRecipeBuilder.compacting(STEEL_GEAR, CountIngredient.of(4, INGOTS_STEEL), 200, CompactorMode.GEAR).unlockedBy("has_steel", has(INGOTS_STEEL)).save(recipeOutput, rl("steel_gear_from_compacting")); + CompactingRecipeBuilder.compacting(TIN_GEAR, CountIngredient.of(4, INGOTS_TIN), 200, CompactorMode.GEAR).unlockedBy("has_tin", has(INGOTS_TIN)).save(recipeOutput, rl("tin_gear_from_compacting")); + CompactingRecipeBuilder.compacting(URANIUM_GEAR, CountIngredient.of(4, INGOTS_URANIUM), 200, CompactorMode.GEAR).unlockedBy("has_uranium", has(INGOTS_URANIUM)).save(recipeOutput, rl("uranium_gear_from_compacting")); + + // Storage Blocks + CompactingRecipeBuilder.compacting(ALUMINUM_BLOCK, CountIngredient.of(9, INGOTS_ALUMINUM), 250, CompactorMode.BLOCK).unlockedBy("has_aluminum", has(INGOTS_ALUMINUM)).save(recipeOutput, rl("aluminum_block_from_compacting")); + CompactingRecipeBuilder.compacting(BRONZE_BLOCK, CountIngredient.of(9, INGOTS_BRONZE), 250, CompactorMode.BLOCK).unlockedBy("has_bronze", has(INGOTS_BRONZE)).save(recipeOutput, rl("bronze_block_from_compacting")); + CompactingRecipeBuilder.compacting(Items.COPPER_BLOCK, CountIngredient.of(9, Tags.Items.INGOTS_COPPER), 250, CompactorMode.BLOCK).unlockedBy("has_copper", has(Tags.Items.INGOTS_COPPER)).save(recipeOutput, rl("copper_block_from_compacting")); + CompactingRecipeBuilder.compacting(ELECTRUM_BLOCK, CountIngredient.of(9, INGOTS_ELECTRUM), 250, CompactorMode.BLOCK).unlockedBy("has_electrum", has(INGOTS_ELECTRUM)).save(recipeOutput, rl("electrum_block_from_compacting")); + CompactingRecipeBuilder.compacting(ENDERIUM_BLOCK, CountIngredient.of(9, INGOTS_ENDERIUM), 250, CompactorMode.BLOCK).unlockedBy("has_enderium", has(INGOTS_ENDERIUM)).save(recipeOutput, rl("enderium_block_from_compacting")); + CompactingRecipeBuilder.compacting(Items.GOLD_BLOCK, CountIngredient.of(9, Tags.Items.INGOTS_GOLD), 250, CompactorMode.BLOCK).unlockedBy("has_gold", has(Tags.Items.INGOTS_GOLD)).save(recipeOutput, rl("gold_block_from_compacting")); + CompactingRecipeBuilder.compacting(INVAR_BLOCK, CountIngredient.of(9, INGOTS_INVAR), 250, CompactorMode.BLOCK).unlockedBy("has_invar", has(INGOTS_INVAR)).save(recipeOutput, rl("invar_block_from_compacting")); + CompactingRecipeBuilder.compacting(Items.IRON_BLOCK, CountIngredient.of(9, Tags.Items.INGOTS_IRON), 250, CompactorMode.BLOCK).unlockedBy("has_iron", has(Tags.Items.INGOTS_IRON)).save(recipeOutput, rl("iron_block_from_compacting")); + CompactingRecipeBuilder.compacting(LEAD_BLOCK, CountIngredient.of(9, INGOTS_LEAD), 250, CompactorMode.BLOCK).unlockedBy("has_lead", has(INGOTS_LEAD)).save(recipeOutput, rl("lead_block_from_compacting")); + CompactingRecipeBuilder.compacting(NICKEL_BLOCK, CountIngredient.of(9, INGOTS_NICKEL), 250, CompactorMode.BLOCK).unlockedBy("has_nickel", has(INGOTS_NICKEL)).save(recipeOutput, rl("nickel_block_from_compacting")); + CompactingRecipeBuilder.compacting(PLATINUM_BLOCK, CountIngredient.of(9, INGOTS_PLATINUM), 250, CompactorMode.BLOCK).unlockedBy("has_platinum", has(INGOTS_PLATINUM)).save(recipeOutput, rl("platinum_block_from_compacting")); + CompactingRecipeBuilder.compacting(SIGNALUM_BLOCK, CountIngredient.of(9, INGOTS_SIGNALUM), 250, CompactorMode.BLOCK).unlockedBy("has_signalum", has(INGOTS_SIGNALUM)).save(recipeOutput, rl("signalum_block_from_compacting")); + CompactingRecipeBuilder.compacting(SILVER_BLOCK, CountIngredient.of(9, INGOTS_SILVER), 250, CompactorMode.BLOCK).unlockedBy("has_silver", has(INGOTS_SILVER)).save(recipeOutput, rl("silver_block_from_compacting")); + CompactingRecipeBuilder.compacting(STEEL_BLOCK, CountIngredient.of(9, INGOTS_STEEL), 250, CompactorMode.BLOCK).unlockedBy("has_steel", has(INGOTS_STEEL)).save(recipeOutput, rl("steel_block_from_compacting")); + CompactingRecipeBuilder.compacting(TIN_BLOCK, CountIngredient.of(9, INGOTS_TIN), 250, CompactorMode.BLOCK).unlockedBy("has_tin", has(INGOTS_TIN)).save(recipeOutput, rl("tin_block_from_compacting")); + CompactingRecipeBuilder.compacting(URANIUM_BLOCK, CountIngredient.of(9, INGOTS_URANIUM), 250, CompactorMode.BLOCK).unlockedBy("has_uranium", has(INGOTS_URANIUM)).save(recipeOutput, rl("uranium_block_from_compacting")); + + // Plates + CompactingRecipeBuilder.compacting(ALUMINUM_PLATE, CountIngredient.of(1, INGOTS_ALUMINUM), 200, CompactorMode.PLATE).unlockedBy("has_aluminum", has(INGOTS_ALUMINUM)).save(recipeOutput, rl("aluminum_plate_from_compacting")); + CompactingRecipeBuilder.compacting(BRONZE_PLATE, CountIngredient.of(1, INGOTS_BRONZE), 200, CompactorMode.PLATE).unlockedBy("has_bronze", has(INGOTS_BRONZE)).save(recipeOutput, rl("bronze_plate_from_compacting")); + CompactingRecipeBuilder.compacting(COPPER_PLATE, CountIngredient.of(1, Tags.Items.INGOTS_COPPER), 200, CompactorMode.PLATE).unlockedBy("has_copper", has(Tags.Items.INGOTS_COPPER)).save(recipeOutput, rl("copper_plate_from_compacting")); + CompactingRecipeBuilder.compacting(DIAMOND_PLATE, CountIngredient.of(1, Tags.Items.GEMS_DIAMOND), 200, CompactorMode.PLATE).unlockedBy("has_diamond", has(Tags.Items.GEMS_DIAMOND)).save(recipeOutput, rl("diamond_plate_from_compacting")); + CompactingRecipeBuilder.compacting(ELECTRUM_PLATE, CountIngredient.of(1, INGOTS_ELECTRUM), 200, CompactorMode.PLATE).unlockedBy("has_electrum", has(INGOTS_ELECTRUM)).save(recipeOutput, rl("electrum_plate_from_compacting")); + CompactingRecipeBuilder.compacting(ENDERIUM_PLATE, CountIngredient.of(1, INGOTS_ENDERIUM), 200, CompactorMode.PLATE).unlockedBy("has_enderium", has(INGOTS_ENDERIUM)).save(recipeOutput, rl("enderium_plate_from_compacting")); + CompactingRecipeBuilder.compacting(GOLD_PLATE, CountIngredient.of(1, Tags.Items.INGOTS_GOLD), 200, CompactorMode.PLATE).unlockedBy("has_gold", has(Tags.Items.INGOTS_GOLD)).save(recipeOutput, rl("gold_plate_from_compacting")); + CompactingRecipeBuilder.compacting(INVAR_PLATE, CountIngredient.of(1, INGOTS_INVAR), 200, CompactorMode.PLATE).unlockedBy("has_invar", has(INGOTS_INVAR)).save(recipeOutput, rl("invar_plate_from_compacting")); + CompactingRecipeBuilder.compacting(IRON_PLATE, CountIngredient.of(1, Tags.Items.INGOTS_IRON), 200, CompactorMode.PLATE).unlockedBy("has_iron", has(Tags.Items.INGOTS_IRON)).save(recipeOutput, rl("iron_plate_from_compacting")); + CompactingRecipeBuilder.compacting(LEAD_PLATE, CountIngredient.of(1, INGOTS_LEAD), 200, CompactorMode.PLATE).unlockedBy("has_lead", has(INGOTS_LEAD)).save(recipeOutput, rl("lead_plate_from_compacting")); + CompactingRecipeBuilder.compacting(NICKEL_PLATE, CountIngredient.of(1, INGOTS_NICKEL), 200, CompactorMode.PLATE).unlockedBy("has_nickel", has(INGOTS_NICKEL)).save(recipeOutput, rl("nickel_plate_from_compacting")); + CompactingRecipeBuilder.compacting(PLATINUM_PLATE, CountIngredient.of(1, INGOTS_PLATINUM), 200, CompactorMode.PLATE).unlockedBy("has_platinum", has(INGOTS_PLATINUM)).save(recipeOutput, rl("platinum_plate_from_compacting")); + CompactingRecipeBuilder.compacting(SIGNALUM_PLATE, CountIngredient.of(1, INGOTS_SIGNALUM), 200, CompactorMode.PLATE).unlockedBy("has_signalum", has(INGOTS_SIGNALUM)).save(recipeOutput, rl("signalum_plate_from_compacting")); + CompactingRecipeBuilder.compacting(SILVER_PLATE, CountIngredient.of(1, INGOTS_SILVER), 200, CompactorMode.PLATE).unlockedBy("has_silver", has(INGOTS_SILVER)).save(recipeOutput, rl("silver_plate_from_compacting")); + CompactingRecipeBuilder.compacting(STEEL_PLATE, CountIngredient.of(1, INGOTS_STEEL), 200, CompactorMode.PLATE).unlockedBy("has_steel", has(INGOTS_STEEL)).save(recipeOutput, rl("steel_plate_from_compacting")); + CompactingRecipeBuilder.compacting(TIN_PLATE, CountIngredient.of(1, INGOTS_TIN), 200, CompactorMode.PLATE).unlockedBy("has_tin", has(INGOTS_TIN)).save(recipeOutput, rl("tin_plate_from_compacting")); + CompactingRecipeBuilder.compacting(URANIUM_PLATE, CountIngredient.of(1, INGOTS_URANIUM), 200, CompactorMode.PLATE).unlockedBy("has_uranium", has(INGOTS_URANIUM)).save(recipeOutput, rl("uranium_plate_from_compacting")); + + // Raw Materials + Ingredient upgrades = Ingredient.of(EFFICIENCY_UPGRADE, PRECISION_UPGRADE); + CrushingRecipeBuilder.crushing(RAW_ALUMINUM, 2, Ingredient.of(ORES_ALUMINUM), 200).supportedUpgrades(upgrades).unlockedBy("has_aluminum_ore", has(ORES_ALUMINUM)).save(recipeOutput, rl("raw_aluminum_from_ore")); + CrushingRecipeBuilder.crushing(Items.RAW_COPPER, 2, Ingredient.of(Tags.Items.ORES_COPPER), 200).supportedUpgrades(upgrades).secondary(Items.RAW_GOLD, 0.05F).unlockedBy("has_copper_ore", has(Tags.Items.ORES_COPPER)).save(recipeOutput, rl("raw_copper_from_ore")); + CrushingRecipeBuilder.crushing(Items.DIAMOND, 2, Ingredient.of(Tags.Items.ORES_DIAMOND), 200).supportedUpgrades(upgrades).unlockedBy("has_diamond_ore", has(Tags.Items.ORES_DIAMOND)).save(recipeOutput, rl("raw_diamond_from_ore")); + CrushingRecipeBuilder.crushing(Items.RAW_GOLD, 2, Ingredient.of(Tags.Items.ORES_GOLD), 200).supportedUpgrades(upgrades).secondary(Items.RAW_COPPER, 0.4F).unlockedBy("has_gold_ore", has(Tags.Items.ORES_GOLD)).save(recipeOutput, rl("raw_gold_from_ore")); + CrushingRecipeBuilder.crushing(Items.RAW_IRON, 2, Ingredient.of(Tags.Items.ORES_IRON), 200).supportedUpgrades(upgrades).secondary(RAW_NICKEL, 0.1F).unlockedBy("has_iron_ore", has(Tags.Items.ORES_IRON)).save(recipeOutput, rl("raw_iron_from_ore")); + CrushingRecipeBuilder.crushing(RAW_LEAD, 2, Ingredient.of(ORES_LEAD), 200).supportedUpgrades(upgrades).secondary(RAW_SILVER, 0.08F).unlockedBy("has_lead_ore", has(ORES_LEAD)).save(recipeOutput, rl("raw_lead_from_ore")); + CrushingRecipeBuilder.crushing(RAW_NICKEL, 2, Ingredient.of(ORES_NICKEL), 200).supportedUpgrades(upgrades).unlockedBy("has_nickel_ore", has(ORES_NICKEL)).save(recipeOutput, rl("raw_nickel_from_ore")); + CrushingRecipeBuilder.crushing(RAW_PLATINUM, 2, Ingredient.of(ORES_PLATINUM), 200).supportedUpgrades(upgrades).unlockedBy("has_platinum_ore", has(ORES_PLATINUM)).save(recipeOutput, rl("raw_platinum_from_ore")); + CrushingRecipeBuilder.crushing(RAW_SILVER, 2, Ingredient.of(ORES_SILVER), 200).supportedUpgrades(upgrades).secondary(RAW_LEAD, 0.09F).unlockedBy("has_silver_ore", has(ORES_SILVER)).save(recipeOutput, rl("raw_silver_from_ore")); + CrushingRecipeBuilder.crushing(RAW_TIN, 2, Ingredient.of(ORES_TIN), 200).supportedUpgrades(upgrades).unlockedBy("has_tin_ore", has(ORES_TIN)).save(recipeOutput, rl("raw_tin_from_ore")); + CrushingRecipeBuilder.crushing(RAW_URANIUM, 2, Ingredient.of(ORES_URANIUM), 200).supportedUpgrades(upgrades).unlockedBy("has_uranium_ore", has(ORES_URANIUM)).save(recipeOutput, rl("raw_uranium_from_ore")); + + // Dusts + CrushingRecipeBuilder.crushing(ALUMINUM_DUST, 1, Ingredient.of(INGOTS_ALUMINUM), 200).unlockedBy("has_aluminum", has(INGOTS_ALUMINUM)).save(recipeOutput, rl("aluminum_dust_from_crushing")); + CrushingRecipeBuilder.crushing(BRONZE_DUST, 1, Ingredient.of(INGOTS_BRONZE), 200).unlockedBy("has_bronze", has(INGOTS_BRONZE)).save(recipeOutput, rl("bronze_dust_from_crushing")); + CrushingRecipeBuilder.crushing(COPPER_DUST, 1, Ingredient.of(Tags.Items.INGOTS_COPPER), 200).unlockedBy("has_copper", has(Tags.Items.INGOTS_COPPER)).save(recipeOutput, rl("copper_dust_from_crushing")); + CrushingRecipeBuilder.crushing(DIAMOND_DUST, 1, Ingredient.of(Tags.Items.GEMS_DIAMOND), 200).unlockedBy("has_diamond", has(Tags.Items.GEMS_DIAMOND)).save(recipeOutput, rl("diamond_dust_from_crushing")); + CrushingRecipeBuilder.crushing(ELECTRUM_DUST, 1, Ingredient.of(INGOTS_ELECTRUM), 200).unlockedBy("has_electrum", has(INGOTS_ELECTRUM)).save(recipeOutput, rl("electrum_dust_from_crushing")); + CrushingRecipeBuilder.crushing(ENDERIUM_DUST, 1, Ingredient.of(INGOTS_ENDERIUM), 200).unlockedBy("has_enderium", has(INGOTS_ENDERIUM)).save(recipeOutput, rl("enderium_dust_from_crushing")); + CrushingRecipeBuilder.crushing(GOLD_DUST, 1, Ingredient.of(Tags.Items.INGOTS_GOLD), 200).unlockedBy("has_gold", has(Tags.Items.INGOTS_GOLD)).save(recipeOutput, rl("gold_dust_from_crushing")); + CrushingRecipeBuilder.crushing(INVAR_DUST, 1, Ingredient.of(INGOTS_INVAR), 200).unlockedBy("has_invar", has(INGOTS_INVAR)).save(recipeOutput, rl("invar_dust_from_crushing")); + CrushingRecipeBuilder.crushing(IRON_DUST, 1, Ingredient.of(Tags.Items.INGOTS_IRON), 200).unlockedBy("has_iron", has(Tags.Items.INGOTS_IRON)).save(recipeOutput, rl("iron_dust_from_crushing")); + CrushingRecipeBuilder.crushing(LEAD_DUST, 1, Ingredient.of(INGOTS_LEAD), 200).unlockedBy("has_lead", has(INGOTS_LEAD)).save(recipeOutput, rl("lead_dust_from_crushing")); + CrushingRecipeBuilder.crushing(NICKEL_DUST, 1, Ingredient.of(INGOTS_NICKEL), 200).unlockedBy("has_nickel", has(INGOTS_NICKEL)).save(recipeOutput, rl("nickel_dust_from_crushing")); + CrushingRecipeBuilder.crushing(PLATINUM_DUST, 1, Ingredient.of(INGOTS_PLATINUM), 200).unlockedBy("has_platinum", has(INGOTS_PLATINUM)).save(recipeOutput, rl("platinum_dust_from_crushing")); + CrushingRecipeBuilder.crushing(SIGNALUM_DUST, 1, Ingredient.of(INGOTS_SIGNALUM), 200).unlockedBy("has_signalum", has(INGOTS_SIGNALUM)).save(recipeOutput, rl("signalum_dust_from_crushing")); + CrushingRecipeBuilder.crushing(SILVER_DUST, 1, Ingredient.of(INGOTS_SILVER), 200).unlockedBy("has_silver", has(INGOTS_SILVER)).save(recipeOutput, rl("silver_dust_from_crushing")); + CrushingRecipeBuilder.crushing(STEEL_DUST, 1, Ingredient.of(INGOTS_STEEL), 200).unlockedBy("has_steel", has(INGOTS_STEEL)).save(recipeOutput, rl("steel_dust_from_crushing")); + CrushingRecipeBuilder.crushing(TIN_DUST, 1, Ingredient.of(INGOTS_TIN), 200).unlockedBy("has_tin", has(INGOTS_TIN)).save(recipeOutput, rl("tin_dust_from_crushing")); + CrushingRecipeBuilder.crushing(URANIUM_DUST, 1, Ingredient.of(INGOTS_URANIUM), 200).unlockedBy("has_uranium", has(INGOTS_URANIUM)).save(recipeOutput, rl("uranium_dust_from_crushing")); + + // Machines + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, COAL_GENERATOR, 1).pattern(" X ").pattern("#R#").pattern("IBI").define('X', Tags.Items.DUSTS_REDSTONE).define('#', ItemTags.COALS).define('R', MACHINE_FRAME.get()).define('I', Tags.Items.INGOTS_IRON).define('B', BATTERIES).unlockedBy("has_machine_frame", has(MACHINE_FRAME.get())).save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, COMPACTOR, 1).pattern(" X ").pattern("#R#").pattern("IBI").define('X', COMPACTOR_KIT.get()).define('#', Tags.Items.DUSTS_REDSTONE).define('R', MACHINE_FRAME.get()).define('I', INGOTS_ELECTRUM).define('B', BATTERIES).unlockedBy("has_machine_frame", has(MACHINE_FRAME.get())).save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, CRUSHER, 1).pattern(" X ").pattern("#R#").pattern("IBI").define('X', Tags.Items.DUSTS_REDSTONE).define('#', Items.FLINT).define('R', MACHINE_FRAME.get()).define('I', Tags.Items.INGOTS_COPPER).define('B', BATTERIES).unlockedBy("has_machine_frame", has(MACHINE_FRAME.get())).save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ELECTRIC_SMELTER, 1).pattern(" X ").pattern("#R#").pattern("IBI").define('X', Tags.Items.DUSTS_REDSTONE).define('#', GEARS_COPPER).define('R', Items.FURNACE).define('I', Tags.Items.INGOTS_IRON).define('B', BATTERIES).unlockedBy("has_furnace", has(Items.FURNACE)).save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, LAVA_GENERATOR, 1).pattern(" X ").pattern("#R#").pattern("IBI").define('X', Items.BUCKET).define('#', Tags.Items.DUSTS_REDSTONE).define('R', MACHINE_FRAME.get()).define('I', Tags.Items.INGOTS_NETHER_BRICK).define('B', BATTERIES).unlockedBy("has_machine_frame", has(MACHINE_FRAME.get())).save(recipeOutput); + + // Items + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MACHINE_FRAME, 1) + .pattern("X#X") + .pattern("#R#") + .pattern("X#X") + .define('X', INGOTS_TIN) + .define('#', Tags.Items.GLASS) + .define('R', GEARS_IRON) + .unlockedBy("has_tin_ingot", has(INGOTS_TIN)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, BATTERY, 1) + .pattern(" X ") + .pattern("#R#") + .pattern("#R#") + .define('X', Tags.Items.NUGGETS_GOLD) + .define('#', INGOTS_TIN) + .define('R', Tags.Items.DUSTS_REDSTONE) + .unlockedBy("has_tin_ingot", has(INGOTS_TIN)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, COMPACTOR_KIT, 1) + .requires(GEARS_GOLD) + .requires(PLATES_LEAD) + .requires(HAMMER.get()) + .unlockedBy("has_hammer", has(HAMMER.get())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, PRECISION_UPGRADE, 2) + .pattern("X#X") + .pattern("ROR") + .pattern("X#X") + .define('X', INGOTS_NICKEL) + .define('#', Tags.Items.DUSTS_GLOWSTONE) + .define('R', Tags.Items.GEMS_AMETHYST) + .define('O', PLATES_STEEL) + .unlockedBy("has_amethyst_shard", has(Tags.Items.GEMS_AMETHYST)) + .unlockedBy("has_glowstone_dust", has(Tags.Items.DUSTS_GLOWSTONE)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, EFFICIENCY_UPGRADE, 2) + .pattern("X#X") + .pattern("ROR") + .pattern("X#X") + .define('X', INGOTS_BRONZE) + .define('#', Tags.Items.DUSTS_REDSTONE) + .define('R', Items.FLINT) + .define('O', PLATES_STEEL) + .unlockedBy("has_flint", has(Items.FLINT)) + .unlockedBy("has_redstone_dust", has(Tags.Items.DUSTS_REDSTONE)) + .save(recipeOutput); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/package-info.java new file mode 100644 index 0000000..6b2bd45 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.datagen; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/recipe/CompactingRecipeBuilder.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/recipe/CompactingRecipeBuilder.java new file mode 100644 index 0000000..ed6cb03 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/recipe/CompactingRecipeBuilder.java @@ -0,0 +1,82 @@ +package net.themcbrothers.usefulmachinery.datagen.recipe; + +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementRequirements; +import net.minecraft.advancements.AdvancementRewards; +import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; +import net.neoforged.neoforge.common.crafting.NBTIngredient; +import net.themcbrothers.usefulmachinery.machine.CompactorMode; +import net.themcbrothers.usefulmachinery.recipe.CompactingRecipe; +import org.jetbrains.annotations.Nullable; + +import java.util.LinkedHashMap; +import java.util.Map; + +public class CompactingRecipeBuilder implements RecipeBuilder { + private final ItemStack result; + private final Ingredient ingredient; + private final int processTime; + private final CompactorMode mode; + private final Map> criteria = new LinkedHashMap<>(); + private String group = ""; + + private CompactingRecipeBuilder(ItemStack result, Ingredient ingredient, int processTime, CompactorMode mode) { + this.result = result; + this.ingredient = ingredient; + this.processTime = processTime; + this.mode = mode; + } + + public static CompactingRecipeBuilder compacting(ItemLike item, Ingredient ingredient, int processTime, CompactorMode mode) { + return new CompactingRecipeBuilder(item.asItem().getDefaultInstance(), ingredient, processTime, mode); + } + + @Override + public RecipeBuilder unlockedBy(String key, Criterion criterion) { + this.criteria.put(key, criterion); + + return this; + } + + @Override + public RecipeBuilder group(@Nullable String name) { + this.group = name != null ? name : ""; + + return this; + } + + @Override + public Item getResult() { + return this.result.getItem(); + } + + @Override + public void save(RecipeOutput recipeOutput, ResourceLocation id) { + this.validate(id); + + Advancement.Builder advancement = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)) + .rewards(AdvancementRewards.Builder.recipe(id)) + .requirements(AdvancementRequirements.Strategy.OR); + + this.criteria.forEach(advancement::addCriterion); + + recipeOutput.accept(id, new CompactingRecipe(this.group, this.ingredient, this.result,this.processTime, this.mode), + advancement.build(id.withPrefix("recipes/"))); + } + + private void validate(ResourceLocation id) { + if (this.criteria.isEmpty()) { + throw new IllegalStateException("No way of obtaining recipe: " + id); + } + } +} + diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/recipe/CrushingRecipeBuilder.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/recipe/CrushingRecipeBuilder.java new file mode 100644 index 0000000..dca05c7 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/recipe/CrushingRecipeBuilder.java @@ -0,0 +1,98 @@ +package net.themcbrothers.usefulmachinery.datagen.recipe; + +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementRequirements; +import net.minecraft.advancements.AdvancementRewards; +import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; +import net.themcbrothers.usefulmachinery.recipe.CrushingRecipe; +import org.jetbrains.annotations.Nullable; + +import java.util.LinkedHashMap; +import java.util.Map; + +public class CrushingRecipeBuilder implements RecipeBuilder { + private final ItemStack primaryResult; + private final Ingredient ingredient; + private final int processTime; + private final Map> criteria = new LinkedHashMap<>(); + private ItemStack secondaryResult = ItemStack.EMPTY; + private float secondaryChance = 0F; + private Ingredient supportedUpgrades = Ingredient.EMPTY; + private String group = ""; + + private CrushingRecipeBuilder(ItemStack primaryResult, Ingredient ingredient, int processTime) { + this.primaryResult = primaryResult; + this.ingredient = ingredient; + this.processTime = processTime; + } + + public static CrushingRecipeBuilder crushing(ItemLike item, int count, Ingredient ingredient, int processTime) { + ItemStack stack = item.asItem().getDefaultInstance(); + stack.setCount(count); + + return new CrushingRecipeBuilder(stack, ingredient, processTime); + } + + public CrushingRecipeBuilder secondary(ItemLike item, float chance) { + this.secondaryResult = item.asItem().getDefaultInstance(); + this.secondaryChance = chance; + + return this; + } + + public CrushingRecipeBuilder supportedUpgrades(Ingredient upgrades) { + this.supportedUpgrades = upgrades; + + return this; + } + + @Override + public RecipeBuilder unlockedBy(String key, Criterion criterion) { + this.criteria.put(key, criterion); + + return this; + } + + @Override + public RecipeBuilder group(@Nullable String name) { + this.group = name != null ? name : ""; + + return this; + } + + @Override + public Item getResult() { + return this.primaryResult.getItem(); + } + + @Override + public void save(RecipeOutput recipeOutput, ResourceLocation id) { + this.validate(id); + + Advancement.Builder advancement = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)) + .rewards(AdvancementRewards.Builder.recipe(id)) + .requirements(AdvancementRequirements.Strategy.OR); + + this.criteria.forEach(advancement::addCriterion); + + recipeOutput.accept(id, new CrushingRecipe(this.group, this.ingredient, this.supportedUpgrades, + this.primaryResult, this.secondaryResult, + this.secondaryChance, this.processTime), + advancement.build(id.withPrefix("recipes/"))); + } + + private void validate(ResourceLocation id) { + if (this.criteria.isEmpty()) { + throw new IllegalStateException("No way of obtaining recipe: " + id); + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/datagen/recipe/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/datagen/recipe/package-info.java new file mode 100644 index 0000000..303d277 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/datagen/recipe/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.datagen.recipe; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/item/BatteryItem.java b/src/main/java/net/themcbrothers/usefulmachinery/item/BatteryItem.java new file mode 100644 index 0000000..0fe5f8c --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/item/BatteryItem.java @@ -0,0 +1,48 @@ +package net.themcbrothers.usefulmachinery.item; + +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import net.themcbrothers.lib.config.Config; +import net.themcbrothers.lib.energy.BasicEnergyContainerItem; +import net.themcbrothers.lib.energy.EnergyUnit; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +import static net.themcbrothers.lib.TheMCBrosLib.TEXT_UTILS; + +public class BatteryItem extends BasicEnergyContainerItem { + public BatteryItem(Properties properties) { + super(10_000, 100, 100, properties); + } + + @Override + public boolean isBarVisible(ItemStack stack) { + return this.getEnergyStored(stack) > 0; + } + + @Override + public int getBarColor(ItemStack stack) { + return 0xFF0000; + } + + @Override + public int getBarWidth(ItemStack stack) { + int stored = this.getMaxEnergyStored(stack) - this.getEnergyStored(stack) + 1; + int max = this.getMaxEnergyStored(stack) + 1; + + return (int) Math.round(13.0 - stored * 13.0 / max); + } + + @Override + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + EnergyUnit energyUnit = Config.CLIENT_CONFIG.getEnergyUnit(); + + MutableComponent component = TEXT_UTILS.energyWithMax(this.getEnergyStored(stack), this.getMaxEnergyStored(stack), energyUnit); + tooltipComponents.add(component.withStyle(ChatFormatting.GRAY)); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/item/CreativePowerCellItem.java b/src/main/java/net/themcbrothers/usefulmachinery/item/CreativePowerCellItem.java new file mode 100644 index 0000000..e74cb6e --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/item/CreativePowerCellItem.java @@ -0,0 +1,47 @@ +package net.themcbrothers.usefulmachinery.item; + +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.themcbrothers.lib.energy.EnergyContainerItem; + +public class CreativePowerCellItem extends BlockItem implements EnergyContainerItem { + public CreativePowerCellItem(Block block, Properties properties) { + super(block, properties); + } + + @Override + public boolean isBarVisible(ItemStack stack) { + return true; + } + + @Override + public int getBarColor(ItemStack stack) { + return 0xFF0000; + } + + @Override + public int getBarWidth(ItemStack stack) { + return 13; + } + + @Override + public int receiveEnergy(ItemStack stack, int maxReceive, boolean simulate) { + return 0; + } + + @Override + public int extractEnergy(ItemStack stack, int maxExtract, boolean simulate) { + return maxExtract; + } + + @Override + public int getEnergyStored(ItemStack stack) { + return this.getMaxEnergyStored(stack); + } + + @Override + public int getMaxEnergyStored(ItemStack stack) { + return Integer.MAX_VALUE; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/item/TierUpgradeItem.java b/src/main/java/net/themcbrothers/usefulmachinery/item/TierUpgradeItem.java new file mode 100644 index 0000000..5090e0f --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/item/TierUpgradeItem.java @@ -0,0 +1,83 @@ +package net.themcbrothers.usefulmachinery.item; + +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; +import net.themcbrothers.usefulmachinery.machine.MachineTier; +import org.jetbrains.annotations.Nullable; + +public class TierUpgradeItem extends UpgradeItem { + public TierUpgradeItem(Properties props) { + super(props); + } + + @Override + public InteractionResult useOn(@Nullable Player player, InteractionHand hand, ItemStack stack, Level level, BlockPos pos) { + BlockEntity blockEntity = level.getBlockEntity(pos); + BlockState state = level.getBlockState(pos); + + if (blockEntity instanceof AbstractMachineBlockEntity abstractMachineBlockEntity) { + MachineTier machineTier = abstractMachineBlockEntity.getMachineTier(state); + + if (stack.getTag() != null && stack.getTag().contains("Tier", Tag.TAG_ANY_NUMERIC)) { + MachineTier itemTier = MachineTier.byOrdinal(stack.getTag().getInt("Tier")); + + if (itemTier.ordinal() == machineTier.ordinal() + 1) { + abstractMachineBlockEntity.setMachineTier(itemTier); + + level.sendBlockUpdated(pos, state, state, 4); + + if (player != null) { + if (!player.getAbilities().instabuild) { + stack.shrink(1); + } + + //TODO Übersetzig + player.displayClientMessage(Component.literal("Successfully upgraded machine to " + itemTier.getSerializedName()).withStyle(ChatFormatting.GREEN), true); + } + + return InteractionResult.SUCCESS; + } + } else if (player != null) { + //TODO Übersetzig + player.displayClientMessage(Component.literal("This is not a valid upgrade item").withStyle(ChatFormatting.RED), true); + } + } + + return InteractionResult.PASS; + } + + @Override + public ItemStack getDefaultInstance() { + ItemStack stack = new ItemStack(this); + CompoundTag tag = new CompoundTag(); + + tag.putInt("Tier", 0); + stack.setTag(tag); + + return stack; + } + + @Override + public String getDescriptionId(ItemStack stack) { + if (stack.hasTag() && stack.getTag() != null) { + if (stack.getTag().contains("Tier", Tag.TAG_INT)) { + MachineTier tier = MachineTier.byOrdinal(stack.getTag().getInt("Tier")); + + return String.format("%s_%s", this.getDescriptionId(), tier.getSerializedName()); + } + } + + return this.getDescriptionId(); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/item/UpgradeItem.java b/src/main/java/net/themcbrothers/usefulmachinery/item/UpgradeItem.java new file mode 100644 index 0000000..e97d9b0 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/item/UpgradeItem.java @@ -0,0 +1,28 @@ +package net.themcbrothers.usefulmachinery.item; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; + +import javax.annotation.Nullable; + + +public class UpgradeItem extends Item { + public UpgradeItem(Properties props) { + super(props); + } + + @Override + public final InteractionResult useOn(UseOnContext context) { + return this.useOn(context.getPlayer(), context.getHand(), context.getItemInHand(), context.getLevel(), context.getClickedPos()); + } + + public InteractionResult useOn(@Nullable Player player, InteractionHand hand, ItemStack stack, Level level, BlockPos pos) { + return InteractionResult.PASS; + } +} diff --git a/src/main/java/net/themcbrothers/examplemod/block/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/item/package-info.java similarity index 83% rename from src/main/java/net/themcbrothers/examplemod/block/package-info.java rename to src/main/java/net/themcbrothers/usefulmachinery/item/package-info.java index 34c2e51..d1d48bf 100644 --- a/src/main/java/net/themcbrothers/examplemod/block/package-info.java +++ b/src/main/java/net/themcbrothers/usefulmachinery/item/package-info.java @@ -1,7 +1,7 @@ @FieldsAreNonnullByDefault @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -package net.themcbrothers.examplemod.block; +package net.themcbrothers.usefulmachinery.item; import net.minecraft.FieldsAreNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/src/main/java/net/themcbrothers/usefulmachinery/machine/CompactorMode.java b/src/main/java/net/themcbrothers/usefulmachinery/machine/CompactorMode.java new file mode 100644 index 0000000..773d175 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/machine/CompactorMode.java @@ -0,0 +1,47 @@ +package net.themcbrothers.usefulmachinery.machine; + +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.level.ItemLike; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.Locale; + +import static net.themcbrothers.usefulfoundation.core.FoundationBlocks.BRONZE_BLOCK; +import static net.themcbrothers.usefulfoundation.core.FoundationItems.GOLD_GEAR; +import static net.themcbrothers.usefulfoundation.core.FoundationItems.LEAD_PLATE; + +public enum CompactorMode implements StringRepresentable { + PLATE(LEAD_PLATE), + GEAR(GOLD_GEAR), + BLOCK(BRONZE_BLOCK); + + public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(CompactorMode::values); + private static final CompactorMode[] VALUES = values(); + private static final CompactorMode[] BY_ORDINAL = Arrays.stream(VALUES).sorted(Comparator.comparingInt(Enum::ordinal)).toArray(CompactorMode[]::new); + + private final ItemLike displayItem; + + CompactorMode(ItemLike itemProvider) { + this.displayItem = itemProvider; + } + + @Override + public String getSerializedName() { + return this.name().toLowerCase(Locale.ROOT); + } + + /** + * Gets the CompactorMode corresponding to the given index (0-2). Out of bounds values are wrapped around. The order is + * PLATE-GEAR-BLOCK + * + * @param ordinal Ordinal index + */ + public static CompactorMode byOrdinal(int ordinal) { + return BY_ORDINAL[Math.abs(ordinal % BY_ORDINAL.length)]; + } + + public ItemLike getItemProvider() { + return this.displayItem; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/machine/MachineTier.java b/src/main/java/net/themcbrothers/usefulmachinery/machine/MachineTier.java new file mode 100644 index 0000000..a6c20cc --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/machine/MachineTier.java @@ -0,0 +1,43 @@ +package net.themcbrothers.usefulmachinery.machine; + +import net.minecraft.util.StringRepresentable; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.Locale; + +public enum MachineTier implements StringRepresentable { + SIMPLE(0x39516d), + BASIC(0xa6a6a6), + REINFORCED(0x908928), + FACTORY(0xe53600), + OVERKILL(0x005554); + + public static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(MachineTier::values); + private static final MachineTier[] VALUES = values(); + private static final MachineTier[] BY_ORDINAL = Arrays.stream(VALUES).sorted(Comparator.comparingInt(Enum::ordinal)).toArray(MachineTier[]::new); + private final int color; + + MachineTier(int color) { + this.color = color; + } + + @Override + public String getSerializedName() { + return this.name().toLowerCase(Locale.ROOT); + } + + /** + * Gets the Machine Tier corresponding to the given ordinal (0-4). Out of bounds values are wrapped around. + * The order is SIMPLE-BASIC-REINFORCED-FACTORY-OVERKILL + * + * @param ordinal Ordinal index + */ + public static MachineTier byOrdinal(int ordinal) { + return BY_ORDINAL[Math.abs(ordinal % BY_ORDINAL.length)]; + } + + public int getColor() { + return this.color; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/machine/RedstoneMode.java b/src/main/java/net/themcbrothers/usefulmachinery/machine/RedstoneMode.java new file mode 100644 index 0000000..545d6ac --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/machine/RedstoneMode.java @@ -0,0 +1,66 @@ +package net.themcbrothers.usefulmachinery.machine; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.level.block.entity.BlockEntity; + +import javax.annotation.Nullable; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Locale; + +public enum RedstoneMode implements StringRepresentable { + IGNORED(new ResourceLocation("textures/item/gunpowder.png")), + + HIGH(new ResourceLocation("textures/block/redstone_torch.png")), + + LOW(new ResourceLocation("textures/block/redstone_torch_off.png")); + + private static final RedstoneMode[] VALUES = values(); + private static final StringRepresentable.EnumCodec CODEC = StringRepresentable.fromEnum(RedstoneMode::values); + private static final RedstoneMode[] BY_ORDINAL = Arrays.stream(VALUES).sorted(Comparator.comparingInt(Enum::ordinal)).toArray(RedstoneMode[]::new); + private final ResourceLocation icon; + + RedstoneMode(ResourceLocation icon) { + this.icon = icon; + } + + @Override + public String getSerializedName() { + return this.name().toLowerCase(Locale.ROOT); + } + + /** + * Gets the Redstone Mode corresponding to the given index (0-2). Out of bounds values are wrapped around. + * The order is IGNORED-ON-OFF + * + * @param ordinal Ordinal index + */ + public static RedstoneMode byOrdinal(int ordinal) { + return BY_ORDINAL[Math.abs(ordinal % BY_ORDINAL.length)]; + } + + public ResourceLocation getIcon() { + return icon; + } + + public boolean canRun(BlockEntity blockEntity) { + if (blockEntity.getLevel() == null) { + return false; + } + + boolean isPowered = blockEntity.getLevel().hasNeighborSignal(blockEntity.getBlockPos()); + + return this.canRun(isPowered); + } + + public boolean canRun(boolean isPowered) { + if (this == HIGH) { + return isPowered; + } else if (this == LOW) { + return !isPowered; + } + + return true; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/machine/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/machine/package-info.java new file mode 100644 index 0000000..46cd12d --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/machine/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.machine; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/menu/AbstractMachineMenu.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/AbstractMachineMenu.java new file mode 100644 index 0000000..cf86939 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/AbstractMachineMenu.java @@ -0,0 +1,101 @@ +package net.themcbrothers.usefulmachinery.menu; + +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.themcbrothers.lib.energy.EnergyProvider; +import net.themcbrothers.lib.inventory.EnergySlot; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; +import net.themcbrothers.usefulmachinery.core.MachineryTags; +import net.themcbrothers.usefulmachinery.machine.RedstoneMode; +import net.themcbrothers.usefulmachinery.menu.slot.UpgradeSlot; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public abstract class AbstractMachineMenu extends AbstractContainerMenu implements EnergyProvider { + protected final AbstractMachineBlockEntity blockEntity; + protected final ContainerData fields; + protected final int upgradeSlotCount; + protected final List>> recipes; + + protected AbstractMachineMenu(@Nullable MenuType type, int id, AbstractMachineBlockEntity blockEntity, ContainerData fields, int upgradeSlotCount) { + super(type, id); + + this.blockEntity = blockEntity; + this.fields = fields; + this.upgradeSlotCount = upgradeSlotCount; + this.recipes = new ArrayList<>(); + + this.addDataSlots(fields); + } + + @Override + public boolean stillValid(Player player) { + return this.getBlockEntity().stillValid(player); + } + + @Override + public long getEnergyStored() { + return this.fields.get(0); + } + + @Override + public long getMaxEnergyStored() { + return this.fields.get(1); + } + + public RedstoneMode getRedstoneMode() { + return RedstoneMode.byOrdinal(this.fields.get(2)); + } + + public void setRedstoneMode(RedstoneMode mode) { + this.fields.set(2, mode.ordinal()); + } + + public int getUpgradeSlotSize() { + return this.fields.get(3); + } + + public AbstractMachineBlockEntity getBlockEntity() { + return this.blockEntity; + } + + protected void addPlayerSlots(Inventory playerInventory) { + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 9; ++j) { + this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for (int k = 0; k < 9; ++k) { + this.addSlot(new Slot(playerInventory, k, 8 + k * 18, 142)); + } + } + + protected void addUpgradeSlots(Container upgradeContainer) { + for (int i = 0; i < upgradeContainer.getContainerSize(); i++) { + this.addSlot(new UpgradeSlot(upgradeContainer, i, 188, 9 + i * 18)); + } + } + + protected boolean isEnergyItem(ItemStack stack, EnergySlot.ItemMode mode) { + return EnergySlot.isValid(stack, mode); + } + + protected boolean isUpgradeItem(ItemStack stack) { + return this.upgradeSlotCount > 0 && stack.is(MachineryTags.Items.MACHINERY_UPGRADES); + } + + protected ContainerData getFields() { + return this.fields; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/menu/CoalGeneratorMenu.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/CoalGeneratorMenu.java new file mode 100644 index 0000000..ab5e7b3 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/CoalGeneratorMenu.java @@ -0,0 +1,125 @@ +package net.themcbrothers.usefulmachinery.menu; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.SimpleContainerData; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; +import net.themcbrothers.lib.inventory.EnergySlot; +import net.themcbrothers.lib.util.ContainerHelper; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; +import net.themcbrothers.usefulmachinery.block.entity.extension.UpgradeContainer; +import net.themcbrothers.usefulmachinery.core.MachineryMenus; + +import static net.themcbrothers.usefulmachinery.core.MachineryItems.SUSTAINED_UPGRADE; + +public class CoalGeneratorMenu extends AbstractMachineMenu { + + public CoalGeneratorMenu(int id, Inventory playerInventory, FriendlyByteBuf buffer) { + this(id, playerInventory, ContainerHelper.getBlockEntity(AbstractMachineBlockEntity.class, playerInventory, buffer), + new UpgradeContainer(buffer.readInt()), new SimpleContainerData(buffer.readInt())); + } + + public CoalGeneratorMenu(int id, Inventory playerInventory, AbstractMachineBlockEntity blockEntity, Container upgradeContainer, ContainerData fields) { + super(MachineryMenus.COAL_GENERATOR.get(), id, blockEntity, fields, upgradeContainer.getContainerSize()); + + this.addSlot(new Slot(blockEntity, 0, 80, 33)); + this.addSlot(new EnergySlot(blockEntity, 1, 134, 33)); + + this.addUpgradeSlots(upgradeContainer); + this.addPlayerSlots(playerInventory); + } + + @Override + protected boolean isUpgradeItem(ItemStack stack) { + return stack.is(SUSTAINED_UPGRADE.get()); + } + + @Override + public ItemStack quickMoveStack(Player player, int index) { + // Information about slot indexes + final int containerSize = this.blockEntity.getContainerSize(); + final int invSlotStart = containerSize + this.upgradeSlotCount; + final int invSlotEnd = invSlotStart + 27; + final int hotbarSlotStart = invSlotEnd; + final int hotbarSlotEnd = hotbarSlotStart + 9; + + ItemStack stack = ItemStack.EMPTY; + Slot slot = this.slots.get(index); + + if (slot.hasItem()) { + ItemStack slotStack = slot.getItem(); + stack = slotStack.copy(); + + // Checking if shift clicking stack out of inventory into the machine + if (index >= invSlotStart) { + if (AbstractFurnaceBlockEntity.isFuel(slotStack)) { + // Checking if stack has not been moved into fuel slot + if (!this.moveItemStackTo(slotStack, 0, 1, false)) { + return ItemStack.EMPTY; + } + } else if (this.isEnergyItem(slotStack, EnergySlot.ItemMode.RECEIVE)) { + // Checking if stack has not been moved into energy slot + if (!this.moveItemStackTo(slotStack, containerSize - 1, containerSize, false)) { + return ItemStack.EMPTY; + } + } else if (this.isUpgradeItem(slotStack)) { + // Checking if stack has not been moved into the upgrade container + if (!this.moveItemStackTo(slotStack, containerSize, invSlotStart, false)) { + return ItemStack.EMPTY; + } + } + // Checking if shift clicking stack from the inventory into the hotbar + else if (index < invSlotEnd) { + // Checking if stack has not been moved into the hotbar + if (!this.moveItemStackTo(slotStack, hotbarSlotStart, hotbarSlotEnd, false)) { + return ItemStack.EMPTY; + } + } + // Checking if shift clicking stack from the hotbar into the inventory + else if (index < hotbarSlotEnd) { + // Checking if stack has not been moved into the inventory + if (!this.moveItemStackTo(slotStack, invSlotStart, invSlotEnd, false)) { + return ItemStack.EMPTY; + } + } + } + // Checking if shift clicking stack from the hotbar into the inventory + else if (!this.moveItemStackTo(slotStack, invSlotStart, hotbarSlotEnd, false)) { + return ItemStack.EMPTY; + } + + // If here then logic successful + if (slotStack.isEmpty()) { + slot.set(ItemStack.EMPTY); + } else { + slot.setChanged(); + } + + if (slotStack.getCount() == stack.getCount()) { + return ItemStack.EMPTY; + } + + slot.onTake(player, slotStack); + } + + return stack; + } + + public int getBurnTimeScaled() { + // Burn time + int i = this.fields.get(4); + // Total burn time + int j = this.fields.get(5); + + return j != 0 ? i * 13 / j : 0; + } + + public boolean isBurning() { + return this.fields.get(4) > 0; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/menu/CompactorMenu.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/CompactorMenu.java new file mode 100644 index 0000000..b8ebb7d --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/CompactorMenu.java @@ -0,0 +1,151 @@ +package net.themcbrothers.usefulmachinery.menu; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.SimpleContainerData; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.themcbrothers.lib.inventory.EnergySlot; +import net.themcbrothers.lib.util.ContainerHelper; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; +import net.themcbrothers.usefulmachinery.block.entity.extension.SimpleCompactor; +import net.themcbrothers.usefulmachinery.block.entity.extension.UpgradeContainer; +import net.themcbrothers.usefulmachinery.core.MachineryMenus; +import net.themcbrothers.usefulmachinery.core.MachineryRecipeTypes; +import net.themcbrothers.usefulmachinery.machine.CompactorMode; +import net.themcbrothers.usefulmachinery.menu.slot.OutputSlot; +import net.themcbrothers.usefulmachinery.recipe.CompactingRecipe; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class CompactorMenu extends AbstractMachineMenu { + private final List> recipes = new ArrayList<>(); + + public CompactorMenu(int id, Inventory playerInventory, FriendlyByteBuf buffer) { + this(id, playerInventory, ContainerHelper.getBlockEntity(AbstractMachineBlockEntity.class, playerInventory, buffer), + new UpgradeContainer(buffer.readInt()), new SimpleContainerData(buffer.readInt())); + } + + public CompactorMenu(int id, Inventory playerInventory, AbstractMachineBlockEntity blockEntity, Container upgradeContainer, ContainerData fields) { + super(MachineryMenus.COMPACTOR.get(), id, blockEntity, fields, upgradeContainer.getContainerSize()); + + this.recipes.addAll(Objects.requireNonNull(blockEntity.getLevel()) + .getRecipeManager() + .getAllRecipesFor(MachineryRecipeTypes.COMPACTING.get())); + + this.addSlot(new Slot(blockEntity, 0, 35, 33)); + this.addSlot(new OutputSlot(blockEntity, 1, 95, 33)); + this.addSlot(new EnergySlot(blockEntity, 2, 134, 33)); + + this.addUpgradeSlots(upgradeContainer); + this.addPlayerSlots(playerInventory); + } + + @Override + public ItemStack quickMoveStack(Player player, int index) { + // information about slot indexes + final int containerSize = this.blockEntity.getContainerSize(); + final int invSlotStart = containerSize + this.upgradeSlotCount; + final int invSlotEnd = invSlotStart + 27; + final int hotbarSlotStart = invSlotEnd; + final int hotbarSlotEnd = hotbarSlotStart + 9; + + ItemStack stack = ItemStack.EMPTY; + Slot slot = this.slots.get(index); + + if (slot.hasItem()) { + ItemStack slotStack = slot.getItem(); + stack = slotStack.copy(); + + // Checking if shift clicking stack from the output into the inventory + if (index == 1) { + if (!this.moveItemStackTo(slotStack, invSlotStart, hotbarSlotEnd, true)) { + return ItemStack.EMPTY; + } + + slot.onQuickCraft(slotStack, stack); + } + // Checking if shift clicking stack out of inventory into the machine + else if (index >= invSlotStart) { + if (this.canCompact(slotStack)) { + // Checking if stack has not been moved into fuel slot + if (!this.moveItemStackTo(slotStack, 0, 1, false)) { + return ItemStack.EMPTY; + } + } else if (this.isEnergyItem(slotStack, EnergySlot.ItemMode.EXTRACT)) { + // Checking if stack has not been moved into energy slot + if (!this.moveItemStackTo(slotStack, containerSize - 1, containerSize, false)) { + return ItemStack.EMPTY; + } + } else if (this.isUpgradeItem(slotStack)) { + // Checking if stack has not been moved into the upgrade container + if (!this.moveItemStackTo(slotStack, containerSize, invSlotStart, false)) { + return ItemStack.EMPTY; + } + } + // Checking if shift clicking stack from the inventory into the hotbar + else if (index < invSlotEnd) { + // Checking if stack has not been moved into the hotbar + if (!this.moveItemStackTo(slotStack, hotbarSlotStart, hotbarSlotEnd, false)) { + return ItemStack.EMPTY; + } + } + // Checking if shift clicking stack from the hotbar into the inventory + else if (index < hotbarSlotEnd) { + // Checking if stack has not been moved into the inventory + if (!this.moveItemStackTo(slotStack, invSlotStart, invSlotEnd, false)) { + return ItemStack.EMPTY; + } + } + } + // Checking if shift clicking stack from the hotbar into the inventory + else if (!this.moveItemStackTo(slotStack, invSlotStart, hotbarSlotEnd, false)) { + return ItemStack.EMPTY; + } + + // If here then logic successful + if (slotStack.isEmpty()) { + slot.set(ItemStack.EMPTY); + } else { + slot.setChanged(); + } + + if (slotStack.getCount() == stack.getCount()) { + return ItemStack.EMPTY; + } + + slot.onTake(player, slotStack); + } + + return stack; + } + + protected boolean canCompact(ItemStack stack) { + return this.recipes.stream() + .map(RecipeHolder::value) + .anyMatch(recipe -> recipe.matches(new SimpleCompactor(this.getCompactorMode(), stack), Objects.requireNonNull(this.blockEntity.getLevel()))); + } + + public CompactorMode getCompactorMode() { + return CompactorMode.byOrdinal(this.fields.get(6)); + } + + public void setCompactorMode(CompactorMode mode) { + this.fields.set(6, mode.ordinal()); + } + + public int getProgressScaled(int width) { + // Compact time + int i = this.fields.get(4); + // Total compact time + int j = this.fields.get(5); + + return i != 0 && j != 0 ? i * width / j : 0; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/menu/CrusherMenu.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/CrusherMenu.java new file mode 100644 index 0000000..da72ac6 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/CrusherMenu.java @@ -0,0 +1,138 @@ +package net.themcbrothers.usefulmachinery.menu; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.SimpleContainerData; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.themcbrothers.lib.inventory.EnergySlot; +import net.themcbrothers.lib.util.ContainerHelper; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; +import net.themcbrothers.usefulmachinery.block.entity.extension.UpgradeContainer; +import net.themcbrothers.usefulmachinery.core.MachineryMenus; +import net.themcbrothers.usefulmachinery.core.MachineryRecipeTypes; +import net.themcbrothers.usefulmachinery.menu.slot.OutputSlot; + +import java.util.Objects; + +public class CrusherMenu extends AbstractMachineMenu { + public CrusherMenu(int id, Inventory playerInventory, FriendlyByteBuf buffer) { + this(id, playerInventory, ContainerHelper.getBlockEntity(AbstractMachineBlockEntity.class, playerInventory, buffer), + new UpgradeContainer(buffer.readInt()), new SimpleContainerData(buffer.readInt())); + } + + public CrusherMenu(int id, Inventory playerInventory, AbstractMachineBlockEntity blockEntity, Container upgradeContainer, ContainerData fields) { + super(MachineryMenus.CRUSHER.get(), id, blockEntity, fields, upgradeContainer.getContainerSize()); + + this.recipes.addAll(Objects.requireNonNull(blockEntity.getLevel()) + .getRecipeManager() + .getAllRecipesFor(MachineryRecipeTypes.CRUSHING.get())); + + this.addSlot(new Slot(blockEntity, 0, 35, 35)); + this.addSlot(new OutputSlot(blockEntity, 1, 95, 24)); + this.addSlot(new OutputSlot(blockEntity, 2, 95, 48)); + this.addSlot(new EnergySlot(blockEntity, 3, 134, 33)); + + this.addUpgradeSlots(upgradeContainer); + this.addPlayerSlots(playerInventory); + } + + @Override + public ItemStack quickMoveStack(Player player, int index) { + // information about slot indexes + final int containerSize = this.blockEntity.getContainerSize(); + final int invSlotStart = containerSize + this.upgradeSlotCount; + final int invSlotEnd = invSlotStart + 27; + final int hotbarSlotStart = invSlotEnd; + final int hotbarSlotEnd = hotbarSlotStart + 9; + + ItemStack stack = ItemStack.EMPTY; + Slot slot = this.slots.get(index); + + if (slot.hasItem()) { + ItemStack slotStack = slot.getItem(); + stack = slotStack.copy(); + + // Checking if shift clicking stack from the output into the inventory + if (index == 1 || index == 2) { + if (!this.moveItemStackTo(slotStack, invSlotStart, hotbarSlotEnd, true)) { + return ItemStack.EMPTY; + } + + slot.onQuickCraft(slotStack, stack); + } + // Checking if shift clicking stack out of inventory into the machine + else if (index >= invSlotStart) { + if (this.canCrush(slotStack)) { + // Checking if stack has not been moved into fuel slot + if (!this.moveItemStackTo(slotStack, 0, 1, false)) { + return ItemStack.EMPTY; + } + } else if (this.isEnergyItem(slotStack, EnergySlot.ItemMode.EXTRACT)) { + // Checking if stack has not been moved into energy slot + if (!this.moveItemStackTo(slotStack, containerSize - 1, containerSize, false)) { + return ItemStack.EMPTY; + } + } else if (this.isUpgradeItem(slotStack)) { + // Checking if stack has not been moved into the upgrade container + if (!this.moveItemStackTo(slotStack, containerSize, invSlotStart, false)) { + return ItemStack.EMPTY; + } + } + // Checking if shift clicking stack from the inventory into the hotbar + else if (index < invSlotEnd) { + // Checking if stack has not been moved into the hotbar + if (!this.moveItemStackTo(slotStack, hotbarSlotStart, hotbarSlotEnd, false)) { + return ItemStack.EMPTY; + } + } + // Checking if shift clicking stack from the hotbar into the inventory + else if (index < hotbarSlotEnd) { + // Checking if stack has not been moved into the inventory + if (!this.moveItemStackTo(slotStack, invSlotStart, invSlotEnd, false)) { + return ItemStack.EMPTY; + } + } + } + // Checking if shift clicking stack from the hotbar into the inventory + else if (!this.moveItemStackTo(slotStack, invSlotStart, hotbarSlotEnd, false)) { + return ItemStack.EMPTY; + } + + // If here then logic successful + if (slotStack.isEmpty()) { + slot.set(ItemStack.EMPTY); + } else { + slot.setChanged(); + } + + if (slotStack.getCount() == stack.getCount()) { + return ItemStack.EMPTY; + } + + slot.onTake(player, slotStack); + } + + return stack; + } + + protected boolean canCrush(ItemStack stack) { + return this.recipes.stream() + .map(RecipeHolder::value) + .anyMatch(recipe -> recipe.matches(new SimpleContainer(stack), Objects.requireNonNull(this.blockEntity.getLevel()))); + } + + public int getProgressScaled(int width) { + // Crush time + int i = this.fields.get(4); + // Total crush time + int j = this.fields.get(5); + + return i != 0 && j != 0 ? i * width / j : 0; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/menu/ElectricSmelterMenu.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/ElectricSmelterMenu.java new file mode 100644 index 0000000..f99fcb8 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/ElectricSmelterMenu.java @@ -0,0 +1,136 @@ +package net.themcbrothers.usefulmachinery.menu; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.SimpleContainerData; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeType; +import net.themcbrothers.lib.inventory.EnergySlot; +import net.themcbrothers.lib.util.ContainerHelper; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; +import net.themcbrothers.usefulmachinery.block.entity.extension.UpgradeContainer; +import net.themcbrothers.usefulmachinery.core.MachineryMenus; +import net.themcbrothers.usefulmachinery.menu.slot.OutputSlot; + +import java.util.Objects; + +public class ElectricSmelterMenu extends AbstractMachineMenu { + public ElectricSmelterMenu(int id, Inventory playerInventory, FriendlyByteBuf byteBuf) { + this(id, playerInventory, ContainerHelper.getBlockEntity(AbstractMachineBlockEntity.class, playerInventory, byteBuf), + new UpgradeContainer(byteBuf.readInt()), new SimpleContainerData(byteBuf.readInt())); + } + + public ElectricSmelterMenu(int id, Inventory playerInventory, AbstractMachineBlockEntity blockEntity, Container upgradeContainer, ContainerData fields) { + super(MachineryMenus.ELECTRIC_SMELTER.get(), id, blockEntity, fields, upgradeContainer.getContainerSize()); + + this.recipes.addAll(Objects.requireNonNull(blockEntity.getLevel()).getRecipeManager().getAllRecipesFor(RecipeType.BLASTING)); + this.recipes.addAll(Objects.requireNonNull(blockEntity.getLevel()).getRecipeManager().getAllRecipesFor(RecipeType.SMELTING)); + + this.addSlot(new Slot(blockEntity, 0, 35, 33)); + this.addSlot(new OutputSlot(blockEntity, 1, 95, 33)); + this.addSlot(new EnergySlot(blockEntity, 2, 134, 33)); + + this.addUpgradeSlots(upgradeContainer); + this.addPlayerSlots(playerInventory); + } + + @Override + public ItemStack quickMoveStack(Player player, int index) { + // information about slot indexes + final int containerSize = this.blockEntity.getContainerSize(); + final int invSlotStart = containerSize + this.upgradeSlotCount; + final int invSlotEnd = invSlotStart + 27; + final int hotbarSlotStart = invSlotEnd; + final int hotbarSlotEnd = hotbarSlotStart + 9; + + ItemStack stack = ItemStack.EMPTY; + Slot slot = this.slots.get(index); + + if (slot.hasItem()) { + ItemStack slotStack = slot.getItem(); + stack = slotStack.copy(); + + // Checking if shift clicking stack from the output into the inventory + if (index == 1) { + if (!this.moveItemStackTo(slotStack, invSlotStart, hotbarSlotEnd, true)) { + return ItemStack.EMPTY; + } + + slot.onQuickCraft(slotStack, stack); + } + // Checking if shift clicking stack out of inventory into the machine + else if (index >= invSlotStart) { + if (this.canCook(slotStack)) { + // Checking if stack has not been moved into fuel slot + if (!this.moveItemStackTo(slotStack, 0, 1, false)) { + return ItemStack.EMPTY; + } + } else if (this.isEnergyItem(slotStack, EnergySlot.ItemMode.EXTRACT)) { + // Checking if stack has not been moved into energy slot + if (!this.moveItemStackTo(slotStack, containerSize - 1, containerSize, false)) { + return ItemStack.EMPTY; + } + } else if (this.isUpgradeItem(slotStack)) { + // Checking if stack has not been moved into the upgrade container + if (!this.moveItemStackTo(slotStack, containerSize, invSlotStart, false)) { + return ItemStack.EMPTY; + } + } + // Checking if shift clicking stack from the inventory into the hotbar + else if (index < invSlotEnd) { + // Checking if stack has not been moved into the hotbar + if (!this.moveItemStackTo(slotStack, hotbarSlotStart, hotbarSlotEnd, false)) { + return ItemStack.EMPTY; + } + } + // Checking if shift clicking stack from the hotbar into the inventory + else if (index < hotbarSlotEnd) { + // Checking if stack has not been moved into the inventory + if (!this.moveItemStackTo(slotStack, invSlotStart, invSlotEnd, false)) { + return ItemStack.EMPTY; + } + } + } + // Checking if shift clicking stack from the hotbar into the inventory + else if (!this.moveItemStackTo(slotStack, invSlotStart, hotbarSlotEnd, false)) { + return ItemStack.EMPTY; + } + + // If here then logic successful + if (slotStack.isEmpty()) { + slot.set(ItemStack.EMPTY); + } else { + slot.setChanged(); + } + + if (slotStack.getCount() == stack.getCount()) { + return ItemStack.EMPTY; + } + + slot.onTake(player, slotStack); + } + + return stack; + } + + protected boolean canCook(ItemStack stack) { + return this.recipes.stream() + .map(RecipeHolder::value) + .anyMatch(recipe -> recipe.matches(new SimpleContainer(stack), Objects.requireNonNull(this.blockEntity.getLevel()))); + } + + public int getProgressScaled(int width) { + // Cook time + int i = this.fields.get(4); + // Total cook time + int j = this.fields.get(5); + + return i != 0 && j != 0 ? i * width / j : 0; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/menu/LavaGeneratorMenu.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/LavaGeneratorMenu.java new file mode 100644 index 0000000..7187b4f --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/LavaGeneratorMenu.java @@ -0,0 +1,193 @@ +package net.themcbrothers.usefulmachinery.menu; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.SimpleContainerData; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.Fluids; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.FluidUtil; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.fluids.capability.templates.FluidTank; +import net.themcbrothers.lib.inventory.EnergySlot; +import net.themcbrothers.lib.util.ContainerHelper; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; +import net.themcbrothers.usefulmachinery.block.entity.LavaGeneratorBlockEntity; +import net.themcbrothers.usefulmachinery.block.entity.extension.UpgradeContainer; +import net.themcbrothers.usefulmachinery.core.MachineryMenus; +import net.themcbrothers.usefulmachinery.menu.slot.FluidItemSlot; +import net.themcbrothers.usefulmachinery.menu.slot.OutputSlot; + +import static net.themcbrothers.usefulmachinery.core.MachineryItems.SUSTAINED_UPGRADE; + +public class LavaGeneratorMenu extends AbstractMachineMenu { + public LavaGeneratorMenu(int id, Inventory playerInventory, FriendlyByteBuf byteBuf) { + this(id, playerInventory, ContainerHelper.getBlockEntity(AbstractMachineBlockEntity.class, playerInventory, byteBuf), + new UpgradeContainer(byteBuf.readInt()), new SimpleContainerData(byteBuf.readInt())); + } + + + public LavaGeneratorMenu(int id, Inventory playerInventory, AbstractMachineBlockEntity blockEntity, Container upgradeContainer, ContainerData fields) { + super(MachineryMenus.LAVA_GENERATOR.get(), id, blockEntity, fields, upgradeContainer.getContainerSize()); + + this.addSlot(new FluidItemSlot(blockEntity, 0, 26, 17, stack -> stack.getFluid().isSame(Fluids.LAVA))); + this.addSlot(new OutputSlot(blockEntity, 1, 26, 51)); + this.addSlot(new EnergySlot(blockEntity, 2, 134, 33)); + + this.addUpgradeSlots(upgradeContainer); + this.addPlayerSlots(playerInventory); + } + + @Override + protected boolean isUpgradeItem(ItemStack stack) { + return stack.is(SUSTAINED_UPGRADE.get()); + } + + @Override + public ItemStack quickMoveStack(Player player, int index) { + // information about slot indexes + final int containerSize = this.blockEntity.getContainerSize(); + final int invSlotStart = containerSize + this.upgradeSlotCount; + final int invSlotEnd = invSlotStart + 27; + final int hotbarSlotStart = invSlotEnd; + final int hotbarSlotEnd = hotbarSlotStart + 9; + + ItemStack stack = ItemStack.EMPTY; + Slot slot = this.slots.get(index); + + if (slot.hasItem()) { + ItemStack slotStack = slot.getItem(); + stack = slotStack.copy(); + + // Checking if shift clicking stack out of inventory into the machine + if (index >= invSlotStart) { + FluidTank lavaTank = ((LavaGeneratorBlockEntity) this.blockEntity).getLavaTank(); + boolean isLava = FluidUtil.tryEmptyContainer(slotStack, lavaTank, Integer.MAX_VALUE, null, false).isSuccess(); + + if (isLava) { + // Checking if stack has not been moved into fuel slot + if (!this.moveItemStackTo(slotStack, 0, 1, false)) { + return ItemStack.EMPTY; + } + } else if (this.isEnergyItem(slotStack, EnergySlot.ItemMode.RECEIVE)) { + // Checking if stack has not been moved into energy slot + if (!this.moveItemStackTo(slotStack, containerSize - 1, containerSize, false)) { + return ItemStack.EMPTY; + } + } else if (this.isUpgradeItem(slotStack)) { + // Checking if stack has not been moved into the upgrade container + if (!this.moveItemStackTo(slotStack, containerSize, invSlotStart, false)) { + return ItemStack.EMPTY; + } + } + // Checking if shift clicking stack from the inventory into the hotbar + else if (index < invSlotEnd) { + // Checking if stack has not been moved into the hotbar + if (!this.moveItemStackTo(slotStack, invSlotEnd, hotbarSlotEnd, false)) { + return ItemStack.EMPTY; + } + } + // Checking if shift clicking stack from the hotbar into the inventory + else if (index < hotbarSlotEnd) { + // Checking if stack has not been moved into the inventory + if (!this.moveItemStackTo(slotStack, invSlotStart, invSlotEnd, false)) { + return ItemStack.EMPTY; + } + } + } + // Checking if shift clicking stack from the hotbar into the inventory + else if (!this.moveItemStackTo(slotStack, invSlotStart, hotbarSlotEnd, false)) { + return ItemStack.EMPTY; + } + + // If here then logic successful + if (slotStack.isEmpty()) { + slot.set(ItemStack.EMPTY); + } else { + slot.setChanged(); + } + + if (slotStack.getCount() == stack.getCount()) { + return ItemStack.EMPTY; + } + + slot.onTake(player, slotStack); + } + + return stack; + } + + public int getBurnTimeScaled() { + // Burn time + int i = this.fields.get(4); + // Total burn time + int j = this.fields.get(5); + + return j != 0 ? i * 13 / j : 0; + } + + public boolean isBurning() { + return this.fields.get(4) > 0; + } + + public FluidStack getTank() { + return new FluidStack(this.getTankFluid(), this.getFluidAmount()); + } + + public int getFluidAmount() { + return this.fields.get(6); + } + + public int getTankCapacity() { + return this.fields.get(7) > 0 ? this.fields.get(7) : LavaGeneratorBlockEntity.TANK_CAPACITY; + } + + public Fluid getTankFluid() { + return BuiltInRegistries.FLUID.byId(this.fields.get(8)); + } + + public IFluidHandler getFluidTankHandler() { + return new IFluidHandler() { + @Override + public int getTanks() { + return 1; + } + + @Override + public FluidStack getFluidInTank(int tank) { + return LavaGeneratorMenu.this.getTank(); + } + + @Override + public int getTankCapacity(int tank) { + return LavaGeneratorMenu.this.getTankCapacity(); + } + + @Override + public boolean isFluidValid(int tank, FluidStack stack) { + return true; + } + + @Override + public int fill(FluidStack resource, FluidAction action) { + return 0; + } + + @Override + public FluidStack drain(FluidStack resource, FluidAction action) { + return resource; + } + + @Override + public FluidStack drain(int maxDrain, FluidAction action) { + return FluidStack.EMPTY; + } + }; + } +} diff --git a/src/main/java/net/themcbrothers/examplemod/datagen/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/package-info.java similarity index 83% rename from src/main/java/net/themcbrothers/examplemod/datagen/package-info.java rename to src/main/java/net/themcbrothers/usefulmachinery/menu/package-info.java index d920e75..4d61ab6 100644 --- a/src/main/java/net/themcbrothers/examplemod/datagen/package-info.java +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/package-info.java @@ -1,7 +1,7 @@ @FieldsAreNonnullByDefault @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -package net.themcbrothers.examplemod.datagen; +package net.themcbrothers.usefulmachinery.menu; import net.minecraft.FieldsAreNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/FluidItemSlot.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/FluidItemSlot.java new file mode 100644 index 0000000..79ae1c9 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/FluidItemSlot.java @@ -0,0 +1,26 @@ +package net.themcbrothers.usefulmachinery.menu.slot; + +import net.minecraft.world.Container; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.FluidUtil; + +import java.util.function.Predicate; + +public class FluidItemSlot extends Slot { + private final Predicate validator; + + public FluidItemSlot(Container container, int slot, int x, int y, Predicate validator) { + super(container, slot, x, y); + + this.validator = validator; + } + + @Override + public boolean mayPlace(ItemStack stack) { + return FluidUtil.getFluidHandler(stack) + .map(fluidHandler -> FluidItemSlot.this.validator.test(fluidHandler.getFluidInTank(0))) + .orElse(false); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/OutputSlot.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/OutputSlot.java new file mode 100644 index 0000000..de5c450 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/OutputSlot.java @@ -0,0 +1,16 @@ +package net.themcbrothers.usefulmachinery.menu.slot; + +import net.minecraft.world.Container; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; + +public class OutputSlot extends Slot { + public OutputSlot(Container container, int slot, int x, int y) { + super(container, slot, x, y); + } + + @Override + public boolean mayPlace(ItemStack pStack) { + return false; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/UpgradeSlot.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/UpgradeSlot.java new file mode 100644 index 0000000..49723e4 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/UpgradeSlot.java @@ -0,0 +1,18 @@ +package net.themcbrothers.usefulmachinery.menu.slot; + +import net.minecraft.world.Container; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.themcbrothers.usefulmachinery.core.MachineryTags; + +public class UpgradeSlot extends Slot { + + public UpgradeSlot(Container container, int slot, int x, int y) { + super(container, slot, x, y); + } + + @Override + public boolean mayPlace(ItemStack stack) { + return stack.is(MachineryTags.Items.MACHINERY_UPGRADES); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/package-info.java new file mode 100644 index 0000000..66f7156 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/menu/slot/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.menu.slot; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/network/MachineryPacketHandler.java b/src/main/java/net/themcbrothers/usefulmachinery/network/MachineryPacketHandler.java new file mode 100644 index 0000000..4b796e9 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/network/MachineryPacketHandler.java @@ -0,0 +1,22 @@ +package net.themcbrothers.usefulmachinery.network; + +import net.neoforged.bus.api.IEventBus; +import net.themcbrothers.lib.network.BasePacketHandler; +import net.themcbrothers.lib.util.Version; +import net.themcbrothers.usefulmachinery.UsefulMachinery; + +public class MachineryPacketHandler extends BasePacketHandler { + public MachineryPacketHandler(IEventBus modEventBus, Version version) { + super(modEventBus, UsefulMachinery.MOD_ID, version); + } + + @Override + protected void registerClientToServer(PacketRegistrar registrar) { + registrar.play(SetRedstoneModePacket.ID, SetRedstoneModePacket::new); + registrar.play(SetCompactorModePacket.ID, SetCompactorModePacket::new); + } + + @Override + protected void registerServerToClient(PacketRegistrar registrar) { + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/network/SetCompactorModePacket.java b/src/main/java/net/themcbrothers/usefulmachinery/network/SetCompactorModePacket.java new file mode 100644 index 0000000..97b66f3 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/network/SetCompactorModePacket.java @@ -0,0 +1,42 @@ +package net.themcbrothers.usefulmachinery.network; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.network.handling.PlayPayloadContext; +import net.themcbrothers.lib.network.PacketMessage; +import net.themcbrothers.lib.network.PacketUtils; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; +import net.themcbrothers.usefulmachinery.block.entity.CompactorBlockEntity; +import net.themcbrothers.usefulmachinery.machine.CompactorMode; +import net.themcbrothers.usefulmachinery.menu.CompactorMenu; + +public record SetCompactorModePacket(CompactorMode mode) implements PacketMessage { + + public static final ResourceLocation ID = UsefulMachinery.rl("set_compactor_mode"); + + public SetCompactorModePacket(FriendlyByteBuf buffer) { + this(CompactorMode.byOrdinal(buffer.readByte())); + } + + @Override + public void handle(PlayPayloadContext context) { + PacketUtils.container(context, CompactorMenu.class) + .ifPresent(menu -> { + AbstractMachineBlockEntity blockEntity = menu.getBlockEntity(); + if (blockEntity instanceof CompactorBlockEntity compactorBlockEntity) { + compactorBlockEntity.setMode(this.mode); + } + }); + } + + @Override + public void write(FriendlyByteBuf buffer) { + buffer.writeByte(this.mode.ordinal()); + } + + @Override + public ResourceLocation id() { + return ID; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/network/SetRedstoneModePacket.java b/src/main/java/net/themcbrothers/usefulmachinery/network/SetRedstoneModePacket.java new file mode 100644 index 0000000..84962a6 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/network/SetRedstoneModePacket.java @@ -0,0 +1,39 @@ +package net.themcbrothers.usefulmachinery.network; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.network.handling.PlayPayloadContext; +import net.themcbrothers.lib.network.PacketMessage; +import net.themcbrothers.lib.network.PacketUtils; +import net.themcbrothers.usefulmachinery.UsefulMachinery; +import net.themcbrothers.usefulmachinery.block.entity.AbstractMachineBlockEntity; +import net.themcbrothers.usefulmachinery.machine.RedstoneMode; +import net.themcbrothers.usefulmachinery.menu.AbstractMachineMenu; + +public record SetRedstoneModePacket(RedstoneMode mode) implements PacketMessage { + + public static final ResourceLocation ID = UsefulMachinery.rl("set_redstone_mode"); + + public SetRedstoneModePacket(FriendlyByteBuf buffer) { + this(RedstoneMode.byOrdinal(buffer.readByte())); + } + + @Override + public void handle(PlayPayloadContext context) { + PacketUtils.container(context, AbstractMachineMenu.class) + .ifPresent(menu -> { + AbstractMachineBlockEntity blockEntity = menu.getBlockEntity(); + blockEntity.setRedstoneMode(this.mode); + }); + } + + @Override + public void write(FriendlyByteBuf buffer) { + buffer.writeByte(this.mode.ordinal()); + } + + @Override + public ResourceLocation id() { + return ID; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/network/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/network/package-info.java new file mode 100644 index 0000000..9f95915 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/network/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.network; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/recipe/CompactingRecipe.java b/src/main/java/net/themcbrothers/usefulmachinery/recipe/CompactingRecipe.java new file mode 100644 index 0000000..9c38ca4 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/recipe/CompactingRecipe.java @@ -0,0 +1,100 @@ +package net.themcbrothers.usefulmachinery.recipe; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.NonNullList; +import net.minecraft.core.RegistryAccess; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; +import net.themcbrothers.lib.crafting.CommonRecipe; +import net.themcbrothers.usefulmachinery.block.entity.extension.Compactor; +import net.themcbrothers.usefulmachinery.core.MachineryBlocks; +import net.themcbrothers.usefulmachinery.core.MachineryRecipeSerializers; +import net.themcbrothers.usefulmachinery.core.MachineryRecipeTypes; +import net.themcbrothers.usefulmachinery.machine.CompactorMode; + +public record CompactingRecipe(String group, Ingredient ingredient, ItemStack result, int compactTime, + CompactorMode mode) implements CommonRecipe { + + @Override + public boolean matches(Compactor compactor, Level level) { + boolean isSameMode = this.mode == compactor.getMode(); + + return this.ingredient.test(compactor.getItem(0)) && isSameMode; + } + + @Override + public ItemStack getResultItem(RegistryAccess registryAccess) { + return this.result; + } + + @Override + public RecipeType getType() { + return MachineryRecipeTypes.COMPACTING.get(); + } + + @Override + public ItemStack getToastSymbol() { + return new ItemStack(MachineryBlocks.COMPACTOR.get()); + } + + @Override + public NonNullList getIngredients() { + return NonNullList.of(this.ingredient); + } + + @Override + public RecipeSerializer getSerializer() { + return MachineryRecipeSerializers.COMPACTING.get(); + } + + public static class Serializer implements RecipeSerializer { + private static final Codec CODEC = RecordCodecBuilder.create(instance -> + instance.group( + ExtraCodecs.strictOptionalField(Codec.STRING, "group", "").forGetter(CompactingRecipe::group), + Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(CompactingRecipe::ingredient), + ItemStack.RESULT_CODEC.fieldOf("result").forGetter(CompactingRecipe::result), + Codec.INT.fieldOf("compactTime").forGetter(CompactingRecipe::compactTime), + CompactorMode.CODEC.fieldOf("mode").forGetter(CompactingRecipe::mode) + ).apply(instance, CompactingRecipe::new) + ); + + @Override + public Codec codec() { + return CODEC; + } + + @Override + public CompactingRecipe fromNetwork(FriendlyByteBuf buffer) { + String group = buffer.readUtf(32767); + + Ingredient ingredient = Ingredient.fromNetwork(buffer); + + ItemStack result = buffer.readItem(); + + int processTime = buffer.readVarInt(); + + CompactorMode mode = CompactorMode.byOrdinal(buffer.readVarInt()); + + return new CompactingRecipe(group, ingredient, result, processTime, mode); + } + + @Override + public void toNetwork(FriendlyByteBuf buffer, CompactingRecipe recipe) { + buffer.writeUtf(recipe.group); + + recipe.ingredient.toNetwork(buffer); + + buffer.writeItem(recipe.result); + + buffer.writeVarInt(recipe.compactTime); + + buffer.writeVarInt(recipe.mode.ordinal()); + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/recipe/CrushingRecipe.java b/src/main/java/net/themcbrothers/usefulmachinery/recipe/CrushingRecipe.java new file mode 100644 index 0000000..1282cb1 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/recipe/CrushingRecipe.java @@ -0,0 +1,105 @@ +package net.themcbrothers.usefulmachinery.recipe; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.NonNullList; +import net.minecraft.core.RegistryAccess; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; +import net.themcbrothers.lib.crafting.CommonRecipe; +import net.themcbrothers.usefulmachinery.core.MachineryBlocks; +import net.themcbrothers.usefulmachinery.core.MachineryRecipeSerializers; +import net.themcbrothers.usefulmachinery.core.MachineryRecipeTypes; + +public record CrushingRecipe(String group, Ingredient ingredient, Ingredient supportedUpgrades, ItemStack primaryResult, + ItemStack secondaryResult, float secondaryChance, + int crushTime) implements CommonRecipe { + + @Override + public boolean matches(Container container, Level level) { + return this.ingredient.test(container.getItem(0)); + } + + @Override + public ItemStack getResultItem(RegistryAccess registryAccess) { + return this.primaryResult; + } + + @Override + public RecipeType getType() { + return MachineryRecipeTypes.CRUSHING.get(); + } + + @Override + public ItemStack getToastSymbol() { + return MachineryBlocks.CRUSHER.toStack(); + } + + @Override + public NonNullList getIngredients() { + return NonNullList.of(this.ingredient); + } + + @Override + public RecipeSerializer getSerializer() { + return MachineryRecipeSerializers.CRUSHING.get(); + } + + public boolean supportUpgrade(ItemStack upgrade) { + return this.supportedUpgrades.test(upgrade); + } + + public static class Serializer implements RecipeSerializer { + private static final Codec CODEC = RecordCodecBuilder.create(instance -> + instance.group( + ExtraCodecs.strictOptionalField(Codec.STRING, "group", "").forGetter(CrushingRecipe::group), + Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(CrushingRecipe::ingredient), + ExtraCodecs.strictOptionalField(Ingredient.CODEC, "supportedUpgrades", Ingredient.EMPTY).forGetter(CrushingRecipe::supportedUpgrades), + ItemStack.RESULT_CODEC.fieldOf("primary").forGetter(CrushingRecipe::primaryResult), + ExtraCodecs.strictOptionalField(ItemStack.RESULT_CODEC.codec(), "secondary", ItemStack.EMPTY).forGetter(CrushingRecipe::secondaryResult), + ExtraCodecs.strictOptionalField(Codec.FLOAT, "secondaryChance", 0F).forGetter(CrushingRecipe::secondaryChance), + Codec.INT.fieldOf("crushTime").forGetter(CrushingRecipe::crushTime) + ).apply(instance, CrushingRecipe::new)); + + @Override + public Codec codec() { + return CODEC; + } + + @Override + public CrushingRecipe fromNetwork(FriendlyByteBuf buffer) { + String group = buffer.readUtf(32767); + + Ingredient ingredient = Ingredient.fromNetwork(buffer); + Ingredient supportedUpgrades = Ingredient.fromNetwork(buffer); + + ItemStack primaryResult = buffer.readItem(); + ItemStack secondaryResult = buffer.readItem(); + + float secondaryChance = buffer.readFloat(); + int crushTime = buffer.readVarInt(); + + return new CrushingRecipe(group, ingredient, supportedUpgrades, primaryResult, secondaryResult, secondaryChance, crushTime); + } + + @Override + public void toNetwork(FriendlyByteBuf buffer, CrushingRecipe recipe) { + buffer.writeUtf(recipe.group); + + recipe.ingredient.toNetwork(buffer); + recipe.supportedUpgrades.toNetwork(buffer); + + buffer.writeItem(recipe.primaryResult); + buffer.writeItem(recipe.secondaryResult); + + buffer.writeFloat(recipe.secondaryChance); + buffer.writeVarInt(recipe.crushTime); + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/recipe/ingredient/CountIngredient.java b/src/main/java/net/themcbrothers/usefulmachinery/recipe/ingredient/CountIngredient.java new file mode 100644 index 0000000..59fc91a --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/recipe/ingredient/CountIngredient.java @@ -0,0 +1,80 @@ +package net.themcbrothers.usefulmachinery.recipe.ingredient; + +import com.google.common.collect.Lists; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.chat.Component; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.block.Blocks; +import net.themcbrothers.usefulmachinery.core.MachineryIngredientTypes; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Stream; + +public class CountIngredient extends Ingredient { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> + instance.group( + TagKey.codec(Registries.ITEM).fieldOf("tag").forGetter(o -> ((TagValue) o.values[0]).tag), + Codec.INT.optionalFieldOf("count", 1).forGetter(CountIngredient::getCount) + ).apply(instance, CountIngredient::new)); + + private CountIngredient(TagKey tag, int count) { + super(Stream.of(new TagValue(tag, count)), MachineryIngredientTypes.COUNT_INGREDIENT); + } + + @Override + public boolean isSimple() { + return false; + } + + @Override + protected boolean areStacksEqual(ItemStack left, ItemStack right) { + return compareStacksWithCount(left, right); + } + + @Override + public boolean synchronizeWithContents() { + return false; + } + + public int getCount() { + return ((TagValue) this.values[0]).count; + } + + private static boolean compareStacksWithCount(ItemStack left, ItemStack right) { + return left.is(right.getItem()) && right.getCount() >= left.getCount(); + } + + public static CountIngredient of(int count, TagKey tag) { + return new CountIngredient(tag, count); + } + + public record TagValue(TagKey tag, int count) implements Ingredient.Value { + @Override + public boolean equals(Object obj) { + return obj instanceof TagValue value && value.tag.location().equals(this.tag.location()); + } + + @Override + public Collection getItems() { + List list = Lists.newArrayList(); + + for (Holder holder : BuiltInRegistries.ITEM.getTagOrEmpty(this.tag)) { + list.add(new ItemStack(holder, this.count)); + } + + if (list.isEmpty()) { + list.add(new ItemStack(Blocks.BARRIER).setHoverName(Component.literal("Empty Tag: " + this.tag.location()))); + } + + return list; + } + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/recipe/ingredient/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/recipe/ingredient/package-info.java new file mode 100644 index 0000000..b858b1f --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/recipe/ingredient/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.recipe.ingredient; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/recipe/package-info.java b/src/main/java/net/themcbrothers/usefulmachinery/recipe/package-info.java new file mode 100644 index 0000000..62df407 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/recipe/package-info.java @@ -0,0 +1,9 @@ +@FieldsAreNonnullByDefault +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault +package net.themcbrothers.usefulmachinery.recipe; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/net/themcbrothers/usefulmachinery/setup/ClientSetup.java b/src/main/java/net/themcbrothers/usefulmachinery/setup/ClientSetup.java new file mode 100644 index 0000000..0bd9c74 --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/setup/ClientSetup.java @@ -0,0 +1,69 @@ +package net.themcbrothers.usefulmachinery.setup; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; +import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent; +import net.themcbrothers.usefulmachinery.block.AbstractMachineBlock; +import net.themcbrothers.usefulmachinery.client.screen.*; +import net.themcbrothers.usefulmachinery.core.MachineryItems; +import net.themcbrothers.usefulmachinery.core.MachineryMenus; +import net.themcbrothers.usefulmachinery.machine.MachineTier; + +import static net.themcbrothers.usefulmachinery.core.MachineryBlocks.*; + +public class ClientSetup extends CommonSetup { + public ClientSetup(IEventBus modEventBus, ModContainer modContainer) { + super(modEventBus, modContainer); + + modEventBus.addListener(this::menuScreens); + modEventBus.addListener(this::itemColors); + modEventBus.addListener(this::blockColors); + } + + private void menuScreens(final RegisterMenuScreensEvent event) { + event.register(MachineryMenus.COAL_GENERATOR.get(), CoalGeneratorScreen::new); + event.register(MachineryMenus.COMPACTOR.get(), CompactorScreen::new); + event.register(MachineryMenus.CRUSHER.get(), CrusherScreen::new); + event.register(MachineryMenus.ELECTRIC_SMELTER.get(), ElectricSmelterScreen::new); + event.register(MachineryMenus.LAVA_GENERATOR.get(), LavaGeneratorScreen::new); + } + + private void itemColors(final RegisterColorHandlersEvent.Item event) { + event.register((stack, tintIndex) -> { + if (stack.hasTag() && stack.getTag() != null) { + MachineTier tier = MachineTier.byOrdinal(stack.getTag().getInt("Tier")); + return tintIndex == 1 ? tier.getColor() : -1; + } + + return -1; + }, MachineryItems.TIER_UPGRADE.get()); + + event.register((stack, tintIndex) -> { + MachineTier tier = MachineTier.SIMPLE; + CompoundTag tag = stack.getTagElement(BlockItem.BLOCK_STATE_TAG); + + if (!stack.isEmpty() && tag != null) { + MachineTier tierFromItem = MachineTier.CODEC.byName(tag.getString("tier")); + tier = tierFromItem != null ? tierFromItem : tier; + } + + return tier.getColor(); + }, COAL_GENERATOR, COMPACTOR, CRUSHER, ELECTRIC_SMELTER, LAVA_GENERATOR); + } + + private void blockColors(final RegisterColorHandlersEvent.Block event) { + event.register((state, level, pos, tintIndex) -> { + EnumProperty tier = AbstractMachineBlock.TIER; + + if (state.hasProperty(tier)) { + return state.getValue(tier).getColor(); + } + + return -1; + }, COAL_GENERATOR.get(), COMPACTOR.get(), CRUSHER.get(), ELECTRIC_SMELTER.get(), LAVA_GENERATOR.get()); + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/setup/CommonSetup.java b/src/main/java/net/themcbrothers/usefulmachinery/setup/CommonSetup.java new file mode 100644 index 0000000..4a4424d --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/setup/CommonSetup.java @@ -0,0 +1,113 @@ +package net.themcbrothers.usefulmachinery.setup; + +import net.minecraft.core.Holder; +import net.minecraft.stats.Stats; +import net.minecraft.world.item.ItemStack; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.InterModComms; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.ModList; +import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; +import net.neoforged.fml.event.lifecycle.InterModEnqueueEvent; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; +import net.neoforged.neoforge.energy.IEnergyStorage; +import net.neoforged.neoforge.items.wrapper.SidedInvWrapper; +import net.themcbrothers.lib.energy.EnergyContainerItem; +import net.themcbrothers.lib.util.Version; +import net.themcbrothers.usefulmachinery.core.MachineryBlocks; +import net.themcbrothers.usefulmachinery.core.MachineryItems; +import net.themcbrothers.usefulmachinery.core.Registration; +import net.themcbrothers.usefulmachinery.network.MachineryPacketHandler; + +import static net.themcbrothers.usefulmachinery.core.MachineryBlockEntities.*; + +public class CommonSetup { + protected CommonSetup(IEventBus modEventBus, ModContainer modContainer) { + // Register stuff + Registration.register(modEventBus); + + modEventBus.addListener(this::setup); + modEventBus.addListener(this::enqueueIMC); + modEventBus.addListener(this::capabilities); + + // Networking + new MachineryPacketHandler(modEventBus, new Version(modContainer)); + } + + private void setup(final FMLCommonSetupEvent event) { + // Make sure the stats appear in the menu + event.enqueueWork(() -> Registration.CUSTOM_STATS.getEntries().stream() + .map(Holder::value) + .forEach(Stats.CUSTOM::get)); + } + + private void enqueueIMC(final InterModEnqueueEvent event) { + if (ModList.get().isLoaded("theoneprobe")) { + InterModComms.sendTo( + "theoneprobe", "getTheOneProbe", + net.themcbrothers.usefulmachinery.compat.top.TheOneProbeSupport::new); + } + } + + private void capabilities(final RegisterCapabilitiesEvent event) { + // Items + event.registerBlockEntity(Capabilities.ItemHandler.BLOCK, COAL_GENERATOR.get(), SidedInvWrapper::new); + event.registerBlockEntity(Capabilities.ItemHandler.BLOCK, COMPACTOR.get(), SidedInvWrapper::new); + event.registerBlockEntity(Capabilities.ItemHandler.BLOCK, CRUSHER.get(), SidedInvWrapper::new); + event.registerBlockEntity(Capabilities.ItemHandler.BLOCK, ELECTRIC_SMELTER.get(), SidedInvWrapper::new); + event.registerBlockEntity(Capabilities.ItemHandler.BLOCK, LAVA_GENERATOR.get(), SidedInvWrapper::new); + + // Energy + event.registerBlockEntity(Capabilities.EnergyStorage.BLOCK, COAL_GENERATOR.get(), (machine, context) -> machine.getEnergyStorage()); + event.registerBlockEntity(Capabilities.EnergyStorage.BLOCK, COMPACTOR.get(), (machine, context) -> machine.getEnergyStorage()); + event.registerBlockEntity(Capabilities.EnergyStorage.BLOCK, CRUSHER.get(), (machine, context) -> machine.getEnergyStorage()); + event.registerBlockEntity(Capabilities.EnergyStorage.BLOCK, ELECTRIC_SMELTER.get(), (machine, context) -> machine.getEnergyStorage()); + event.registerBlockEntity(Capabilities.EnergyStorage.BLOCK, LAVA_GENERATOR.get(), (machine, context) -> machine.getEnergyStorage()); + event.registerBlockEntity(Capabilities.EnergyStorage.BLOCK, CREATIVE_POWER_CELL.get(), (machine, context) -> machine); + + // Fluid + event.registerBlockEntity(Capabilities.FluidHandler.BLOCK, LAVA_GENERATOR.get(), (machine, context) -> machine.getLavaTank()); + + // Item Energy + event.registerItem(Capabilities.EnergyStorage.ITEM, this::energyItem, MachineryBlocks.CREATIVE_POWER_CELL, MachineryItems.BATTERY); + } + + private IEnergyStorage energyItem(ItemStack stack, Void context) { + if (stack.getItem() instanceof EnergyContainerItem energyItem) { + return new IEnergyStorage() { + @Override + public int receiveEnergy(int maxReceive, boolean simulate) { + return energyItem.receiveEnergy(stack, maxReceive, simulate); + } + + @Override + public int extractEnergy(int maxExtract, boolean simulate) { + return energyItem.extractEnergy(stack, maxExtract, simulate); + } + + @Override + public int getEnergyStored() { + return energyItem.getEnergyStored(stack); + } + + @Override + public int getMaxEnergyStored() { + return energyItem.getMaxEnergyStored(stack); + } + + @Override + public boolean canExtract() { + return extractEnergy(1, true) > 0; + } + + @Override + public boolean canReceive() { + return receiveEnergy(1, true) > 0; + } + }; + } + + return null; + } +} diff --git a/src/main/java/net/themcbrothers/usefulmachinery/setup/ServerSetup.java b/src/main/java/net/themcbrothers/usefulmachinery/setup/ServerSetup.java new file mode 100644 index 0000000..852f5bb --- /dev/null +++ b/src/main/java/net/themcbrothers/usefulmachinery/setup/ServerSetup.java @@ -0,0 +1,10 @@ +package net.themcbrothers.usefulmachinery.setup; + +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; + +public class ServerSetup extends CommonSetup { + public ServerSetup(IEventBus modEventBus, ModContainer modContainer) { + super(modEventBus, modContainer); + } +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 83a625e..c92a591 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -33,3 +33,31 @@ issueTrackerURL = "https://github.com/${github_repo}/issues" versionRange = "${lib_version_range}" ordering = "NONE" side = "BOTH" + +[[dependencies.${mod_id}]] + modId = "usefulfoundation" + type = "required" + versionRange = "${foundation_version_range}" + ordering = "NONE" + side = "BOTH" + +[[dependencies.${mod_id}]] + modId = "jei" + type = "optional" + versionRange = "${jei_version_range}" + ordering = "NONE" + side = "BOTH" + +[[dependencies.${mod_id}]] + modId = "theoneprobe" + type = "optional" + versionRange = "${top_version_range}" + ordering = "NONE" + side = "BOTH" + +[[dependencies.${mod_id}]] + modId = "jade" + type = "optional" + versionRange = "${jade_version_range}" + ordering = "NONE" + side = "BOTH" diff --git a/src/main/resources/assets/examplemod/textures/item/example_item.png b/src/main/resources/assets/examplemod/textures/item/example_item.png deleted file mode 100644 index d7254c2..0000000 Binary files a/src/main/resources/assets/examplemod/textures/item/example_item.png and /dev/null differ diff --git a/src/main/resources/assets/usefulmachinery/lang/zh_cn.json b/src/main/resources/assets/usefulmachinery/lang/zh_cn.json new file mode 100644 index 0000000..155ed90 --- /dev/null +++ b/src/main/resources/assets/usefulmachinery/lang/zh_cn.json @@ -0,0 +1,39 @@ +{ + "block.usefulmachinery.coal_generator": "燃煤发电机", + "block.usefulmachinery.lava_generator": "岩浆发电机", + "block.usefulmachinery.crusher": "粉碎机", + "block.usefulmachinery.electric_smelter": "电力熔炉", + "block.usefulmachinery.compactor": "压缩机", + "block.usefulmachinery.creative_power_cell": "创造能量单元", + "container.usefulmachinery.coal_generator": "燃煤发电机", + "container.usefulmachinery.lava_generator": "岩浆发电机", + "container.usefulmachinery.crusher": "粉碎机", + "container.usefulmachinery.electric_smelter": "电力熔炉", + "container.usefulmachinery.compactor": "压缩机", + + "item.usefulmachinery.battery": "电池", + "item.usefulmachinery.machine_frame": "机器框架", + "item.usefulmachinery.compactor_kit": "压缩组件", + + "jei.usefulmachinery.crushing": "粉碎", + "jei.usefulmachinery.electric_smelting": "电力冶炼", + "jei.usefulmachinery.compacting": "压缩", + + "misc.usefulmachinery.energy": "%s FE", + "misc.usefulmachinery.energyWithMax": "%s / %s FE", + "misc.usefulmachinery.empty": "空", + "misc.usefulmachinery.fluidWithMax": "%s / %s mB", + "misc.usefulmachinery.fluidWithMaxName": "%s: %s / %s mB", + "misc.usefulmachinery.redstoneMode": "红石控制: %s", + "misc.usefulmachinery.compact_plate": "压制板材", + "misc.usefulmachinery.compact_gear": "制作齿轮", + "misc.usefulmachinery.compact_block": "方块成型", + + "stat.usefulmachinery.interact_with_crusher": "与粉碎机交互", + "stat.usefulmachinery.interact_with_electric_smelter": "与电力熔炉交互", + "stat.usefulmachinery.interact_with_compactor": "与压缩机交互", + "stat.usefulmachinery.interact_with_coal_generator": "与燃煤发电机交互", + "stat.usefulmachinery.interact_with_lava_generator": "与岩浆发电机交互", + + "itemGroup.usefulmachinery": "实用机械" +} \ No newline at end of file diff --git a/src/main/resources/assets/usefulmachinery/models/block/machine_block.json b/src/main/resources/assets/usefulmachinery/models/block/machine_block.json new file mode 100644 index 0000000..c1bda42 --- /dev/null +++ b/src/main/resources/assets/usefulmachinery/models/block/machine_block.json @@ -0,0 +1,153 @@ +{ + "parent": "minecraft:block/orientable", + "textures": { + "particle": "usefulmachinery:block/machine_side", + "side": "usefulmachinery:block/machine_side", + "overlay": "usefulmachinery:block/machine_side_tier_overlay", + "top": "usefulmachinery:block/machine_top" + }, + "elements": [ + { + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 16 + ], + "faces": { + "north": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#front" + }, + "east": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#side" + }, + "south": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#side" + }, + "west": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#side" + }, + "up": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#top" + }, + "down": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#top" + } + } + }, + { + "from": [ + -0.001, + -0.001, + -0.001 + ], + "to": [ + 16.001, + 16.001, + 16.001 + ], + "faces": { + "north": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#overlay", + "tintindex": 0 + }, + "east": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#overlay", + "tintindex": 0 + }, + "south": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#overlay", + "tintindex": 0 + }, + "west": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#overlay", + "tintindex": 0 + }, + "up": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#overlay", + "tintindex": 0 + }, + "down": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#overlay", + "tintindex": 0 + } + } + } + ] +} diff --git a/src/main/resources/assets/usefulmachinery/textures/block/coal_generator_front.png b/src/main/resources/assets/usefulmachinery/textures/block/coal_generator_front.png new file mode 100644 index 0000000..9146780 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/coal_generator_front.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/coal_generator_front_on.png b/src/main/resources/assets/usefulmachinery/textures/block/coal_generator_front_on.png new file mode 100644 index 0000000..e95e1e2 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/coal_generator_front_on.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/coal_generator_front_on.png.mcmeta b/src/main/resources/assets/usefulmachinery/textures/block/coal_generator_front_on.png.mcmeta new file mode 100644 index 0000000..5169aab --- /dev/null +++ b/src/main/resources/assets/usefulmachinery/textures/block/coal_generator_front_on.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 8 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/usefulmachinery/textures/block/compactor_front.png b/src/main/resources/assets/usefulmachinery/textures/block/compactor_front.png new file mode 100644 index 0000000..45df4f9 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/compactor_front.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/compactor_front_on.png b/src/main/resources/assets/usefulmachinery/textures/block/compactor_front_on.png new file mode 100644 index 0000000..f7bdfd5 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/compactor_front_on.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/crusher_front.png b/src/main/resources/assets/usefulmachinery/textures/block/crusher_front.png new file mode 100644 index 0000000..ad46504 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/crusher_front.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/crusher_front_on.png b/src/main/resources/assets/usefulmachinery/textures/block/crusher_front_on.png new file mode 100644 index 0000000..7190b41 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/crusher_front_on.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/crusher_front_on.png.mcmeta b/src/main/resources/assets/usefulmachinery/textures/block/crusher_front_on.png.mcmeta new file mode 100644 index 0000000..195dc94 --- /dev/null +++ b/src/main/resources/assets/usefulmachinery/textures/block/crusher_front_on.png.mcmeta @@ -0,0 +1,8 @@ +{ + "animation": { + "frames": [ + {"index":8,"time":6}, 7, 6, 5, 4, 3, 2, 1, {"index":0,"time":6}, 1, 2, 3, 4, 5, 6, 7 + ], + "frametime": 2 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/usefulmachinery/textures/block/electric_smelter_front.png b/src/main/resources/assets/usefulmachinery/textures/block/electric_smelter_front.png new file mode 100644 index 0000000..5ffa343 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/electric_smelter_front.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/electric_smelter_front_on.png b/src/main/resources/assets/usefulmachinery/textures/block/electric_smelter_front_on.png new file mode 100644 index 0000000..f5b1d93 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/electric_smelter_front_on.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/lava_generator_front.png b/src/main/resources/assets/usefulmachinery/textures/block/lava_generator_front.png new file mode 100644 index 0000000..ae33272 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/lava_generator_front.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/lava_generator_front_on.png b/src/main/resources/assets/usefulmachinery/textures/block/lava_generator_front_on.png new file mode 100644 index 0000000..d2433af Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/lava_generator_front_on.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/lava_generator_front_on.png.mcmeta b/src/main/resources/assets/usefulmachinery/textures/block/lava_generator_front_on.png.mcmeta new file mode 100644 index 0000000..5169aab --- /dev/null +++ b/src/main/resources/assets/usefulmachinery/textures/block/lava_generator_front_on.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 8 + } +} \ No newline at end of file diff --git a/src/main/resources/assets/usefulmachinery/textures/block/machine_frame.png b/src/main/resources/assets/usefulmachinery/textures/block/machine_frame.png new file mode 100644 index 0000000..f8af5c0 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/machine_frame.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/machine_side.png b/src/main/resources/assets/usefulmachinery/textures/block/machine_side.png new file mode 100644 index 0000000..81c3c20 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/machine_side.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/machine_side_tier_overlay.png b/src/main/resources/assets/usefulmachinery/textures/block/machine_side_tier_overlay.png new file mode 100644 index 0000000..dca28d2 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/machine_side_tier_overlay.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/block/machine_top.png b/src/main/resources/assets/usefulmachinery/textures/block/machine_top.png new file mode 100644 index 0000000..7bc46ee Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/block/machine_top.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/gui/container/coal_generator.png b/src/main/resources/assets/usefulmachinery/textures/gui/container/coal_generator.png new file mode 100644 index 0000000..c113c82 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/gui/container/coal_generator.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/gui/container/compactor.png b/src/main/resources/assets/usefulmachinery/textures/gui/container/compactor.png new file mode 100644 index 0000000..85b617f Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/gui/container/compactor.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/gui/container/crusher.png b/src/main/resources/assets/usefulmachinery/textures/gui/container/crusher.png new file mode 100644 index 0000000..98f37a6 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/gui/container/crusher.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/gui/container/electric_smelter.png b/src/main/resources/assets/usefulmachinery/textures/gui/container/electric_smelter.png new file mode 100644 index 0000000..85b617f Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/gui/container/electric_smelter.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/gui/container/lava_generator.png b/src/main/resources/assets/usefulmachinery/textures/gui/container/lava_generator.png new file mode 100644 index 0000000..24a5b0a Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/gui/container/lava_generator.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/gui/container/upgrade_slots.png b/src/main/resources/assets/usefulmachinery/textures/gui/container/upgrade_slots.png new file mode 100644 index 0000000..5680c97 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/gui/container/upgrade_slots.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/item/battery.png b/src/main/resources/assets/usefulmachinery/textures/item/battery.png new file mode 100644 index 0000000..6ed934a Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/item/battery.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/item/efficiency_upgrade.png b/src/main/resources/assets/usefulmachinery/textures/item/efficiency_upgrade.png new file mode 100644 index 0000000..05f5677 Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/item/efficiency_upgrade.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/item/precision_upgrade.png b/src/main/resources/assets/usefulmachinery/textures/item/precision_upgrade.png new file mode 100644 index 0000000..b9d30ea Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/item/precision_upgrade.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/item/sustained_upgrade.png b/src/main/resources/assets/usefulmachinery/textures/item/sustained_upgrade.png new file mode 100644 index 0000000..9bebefd Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/item/sustained_upgrade.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/item/tier_upgrade_0.png b/src/main/resources/assets/usefulmachinery/textures/item/tier_upgrade_0.png new file mode 100644 index 0000000..0ed463e Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/item/tier_upgrade_0.png differ diff --git a/src/main/resources/assets/usefulmachinery/textures/item/tier_upgrade_1.png b/src/main/resources/assets/usefulmachinery/textures/item/tier_upgrade_1.png new file mode 100644 index 0000000..4e30d5c Binary files /dev/null and b/src/main/resources/assets/usefulmachinery/textures/item/tier_upgrade_1.png differ diff --git a/src/main/resources/data/usefulmachinery/patchouli_books/manual/book.json b/src/main/resources/data/usefulmachinery/patchouli_books/manual/book.json new file mode 100644 index 0000000..39ddc74 --- /dev/null +++ b/src/main/resources/data/usefulmachinery/patchouli_books/manual/book.json @@ -0,0 +1,5 @@ +{ + "name": "Machinery Manual", + "landing_text": "Welcome to this useful manual for this machine mod", + "version": 1 +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/categories/items.json b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/categories/items.json new file mode 100644 index 0000000..f477b9f --- /dev/null +++ b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/categories/items.json @@ -0,0 +1,5 @@ +{ + "name": "Items", + "description": "Here you can find everything about the items this mod adds", + "icon": "usefulmachinery:battery" +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/categories/machines.json b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/categories/machines.json new file mode 100644 index 0000000..a579657 --- /dev/null +++ b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/categories/machines.json @@ -0,0 +1,5 @@ +{ + "name": "Machines", + "description": "Here you can find everything about our machines.$(br2)There are currently these machines in the mod:$(li)$(thing)Crusher$(li)Electric Smelter$(li)Compactor$(br2)$()Useful generator are the $(thing)Coal Generator$() and the $(thing)Lava Generator", + "icon": "usefulmachinery:crusher" +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/items/battery.json b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/items/battery.json new file mode 100644 index 0000000..cc7fff1 --- /dev/null +++ b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/items/battery.json @@ -0,0 +1,16 @@ +{ + "name": "Battery", + "icon": "usefulmachinery:battery", + "category": "items", + "pages": [ + { + "title": "Battery", + "type": "text", + "text": "The $(thing)Battery$() has two usages. It is a crafting item for machines and it can hold Forge Energy" + }, + { + "type": "crafting", + "recipe": "usefulmachinery:shaped/battery" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/machines/compactor.json b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/machines/compactor.json new file mode 100644 index 0000000..8637e09 --- /dev/null +++ b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/machines/compactor.json @@ -0,0 +1,16 @@ +{ + "name": "Compactor", + "icon": "usefulmachinery:compactor", + "category": "machines", + "pages": [ + { + "type": "text", + "text": "The $(thing)Compactor$() can compress materials into plates, gears and blocks." + }, + { + "type": "crafting", + "recipe": "usefulmachinery:shaped/compactor", + "recipe2": "usefulmachinery:compactor_kit" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/machines/crusher.json b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/machines/crusher.json new file mode 100644 index 0000000..15b5fc5 --- /dev/null +++ b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/machines/crusher.json @@ -0,0 +1,15 @@ +{ + "name": "Crusher", + "icon": "usefulmachinery:crusher", + "category": "machines", + "pages": [ + { + "type": "text", + "text": "The $(thing)Crusher$() can crush things like ores. This is useful for ore processing because it doubles the amount of material." + }, + { + "type": "crafting", + "recipe": "usefulmachinery:shaped/crusher" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/machines/electric_smelter.json b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/machines/electric_smelter.json new file mode 100644 index 0000000..8bcf36b --- /dev/null +++ b/src/main/resources/data/usefulmachinery/patchouli_books/manual/en_us/entries/machines/electric_smelter.json @@ -0,0 +1,15 @@ +{ + "name": "Electric Smelter", + "icon": "usefulmachinery:electric_smelter", + "category": "machines", + "pages": [ + { + "type": "text", + "text": "The $(thing)Electric Smelter$() is an electric variant of the vanilla $(thing)Furnace$()." + }, + { + "type": "crafting", + "recipe": "usefulmachinery:shaped/electric_smelter" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/recipes/manual.json b/src/main/resources/data/usefulmachinery/recipes/manual.json new file mode 100644 index 0000000..3fc5334 --- /dev/null +++ b/src/main/resources/data/usefulmachinery/recipes/manual.json @@ -0,0 +1,23 @@ +{ + "conditions": [ + { + "type": "forge:mod_loaded", + "modid": "patchouli" + } + ], + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:book" + }, + { + "tag": "forge:gears/copper" + } + ], + "result": { + "item": "patchouli:guide_book", + "nbt": { + "patchouli:book": "usefulmachinery:manual" + } + } +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_basic.json b/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_basic.json new file mode 100644 index 0000000..8794d81 --- /dev/null +++ b/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_basic.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " I ", + "IGI", + "RIR" + ], + "key": { + "I": { + "tag": "forge:ingots/invar" + }, + "G": { + "tag": "forge:gears/bronze" + }, + "R": { + "tag": "forge:dusts/redstone" + } + }, + "result": { + "item": "usefulmachinery:tier_upgrade", + "nbt": { + "Tier": 1 + }, + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_factory.json b/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_factory.json new file mode 100644 index 0000000..1fe0a1a --- /dev/null +++ b/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_factory.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " I ", + "IGI", + "RIR" + ], + "key": { + "I": { + "tag": "forge:ingots/signalum" + }, + "G": { + "tag": "forge:gears/electrum" + }, + "R": { + "tag": "forge:dusts/redstone" + } + }, + "result": { + "item": "usefulmachinery:tier_upgrade", + "nbt": { + "Tier": 3 + }, + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_overkill.json b/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_overkill.json new file mode 100644 index 0000000..a562264 --- /dev/null +++ b/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_overkill.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " I ", + "IGI", + "RIR" + ], + "key": { + "I": { + "tag": "forge:ingots/enderium" + }, + "G": { + "tag": "forge:gears/signalum" + }, + "R": { + "tag": "forge:dusts/redstone" + } + }, + "result": { + "item": "usefulmachinery:tier_upgrade", + "nbt": { + "Tier": 4 + }, + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_reinforced.json b/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_reinforced.json new file mode 100644 index 0000000..78474fa --- /dev/null +++ b/src/main/resources/data/usefulmachinery/recipes/tier_upgrade_reinforced.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " I ", + "IGI", + "RIR" + ], + "key": { + "I": { + "tag": "forge:ingots/electrum" + }, + "G": { + "tag": "forge:gears/silver" + }, + "R": { + "tag": "forge:dusts/redstone" + } + }, + "result": { + "item": "usefulmachinery:tier_upgrade", + "nbt": { + "Tier": 2 + }, + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png new file mode 100644 index 0000000..04961c3 Binary files /dev/null and b/src/main/resources/logo.png differ