From 09592c6f410f7fff5df878b57303ff4dcb888aa8 Mon Sep 17 00:00:00 2001 From: Mrbysco Date: Wed, 16 Oct 2024 22:26:33 +0200 Subject: [PATCH] Resolve TODO on Crystal Cluster loottable --- .../59eb3dbb5f86130e09b3c62d89b9525ee01cf52d | 14 +++--- .../blocks/diamatine_crystal_cluster.json | 49 ++++++++++++++++--- .../blocks/emeradic_crystal_cluster.json | 49 ++++++++++++++++--- .../blocks/enori_crystal_cluster.json | 49 ++++++++++++++++--- .../blocks/palis_crystal_cluster.json | 49 ++++++++++++++++--- .../blocks/restonia_crystal_cluster.json | 49 ++++++++++++++++--- .../blocks/void_crystal_cluster.json | 49 ++++++++++++++++--- .../data/LootTableGenerator.java | 36 +++++--------- 8 files changed, 270 insertions(+), 74 deletions(-) diff --git a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d index e3e66b51d..58391b51f 100644 --- a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d +++ b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d @@ -1,4 +1,4 @@ -// 1.21.1 2024-08-11T19:30:01.8143179 Loot Tables +// 1.21.1 2024-10-16T22:24:12.9580535 Loot Tables ef11aa79a2f96a47250f46811f8491fd34d627f9 data/actuallyadditions/loot_table/blocks/atomic_reconstructor.json e15c868b26b669c30365bfb93e7d9274e07df16d data/actuallyadditions/loot_table/blocks/battery_box.json 745d64af3b0203a138f9eca7de21ed4988b35c95 data/actuallyadditions/loot_table/blocks/bio_reactor.json @@ -29,11 +29,11 @@ fa895b25a0816ca506f7031ec3861cfd4de04f28 data/actuallyadditions/loot_table/block 7c7a4028f6fe02446d1557f72ad494ab363a8409 data/actuallyadditions/loot_table/blocks/crusher.json cbd5456165eaf299685aab50dc3bce38d99a1cf8 data/actuallyadditions/loot_table/blocks/crusher_double.json 25b7a44418e2858552dd5150d67bffe1f30269a8 data/actuallyadditions/loot_table/blocks/diamatine_crystal_block.json -e22890b48eaf91862f5dede7b9c1480f41657e7f data/actuallyadditions/loot_table/blocks/diamatine_crystal_cluster.json +ba64f685c7b3c7f998e61d9a3905e627784fb017 data/actuallyadditions/loot_table/blocks/diamatine_crystal_cluster.json 33bc6704cd8545a60049b9f168bc8aa391937e48 data/actuallyadditions/loot_table/blocks/display_stand.json 3f9aa8b99fad7066fd3a6118a499e3237920cc7e data/actuallyadditions/loot_table/blocks/dropper.json a8183cf6b77bbac91f09ea485f5eaadf70aa8fb0 data/actuallyadditions/loot_table/blocks/emeradic_crystal_block.json -39851863a99bf21d48df61350f1ae1e0e25dbeaa data/actuallyadditions/loot_table/blocks/emeradic_crystal_cluster.json +25d55ab81ed1fc53387b4bc3712d4f26b188270f data/actuallyadditions/loot_table/blocks/emeradic_crystal_cluster.json 4811fb48ac8e17ed71d0e42016ccfd7f244026d4 data/actuallyadditions/loot_table/blocks/empowered_diamatine_crystal_block.json e02f5203b700239638e4fafb9915e6873f1b76bc data/actuallyadditions/loot_table/blocks/empowered_emeradic_crystal_block.json 00fa7d2d85a41d1834d016cd232d92a8dad1a81f data/actuallyadditions/loot_table/blocks/empowered_enori_crystal_block.json @@ -45,7 +45,7 @@ bb7c77182bd147e1189d865c5a992fbf19a629f4 data/actuallyadditions/loot_table/block 6990098510a0dcb1961a80f00d5f71d4b2bc3f46 data/actuallyadditions/loot_table/blocks/energizer.json f3c68d58b25c3dbb6d4a65c14dd6d2c28e53814f data/actuallyadditions/loot_table/blocks/enervator.json 47d7dd8175c672b8568b8863c6b65ab26168fd5f data/actuallyadditions/loot_table/blocks/enori_crystal_block.json -03330e1ee2c22c017c3bd55c880e979f1a4bb3d4 data/actuallyadditions/loot_table/blocks/enori_crystal_cluster.json +b133d4e6b05aea63e6d89d696ac03710b88d1d51 data/actuallyadditions/loot_table/blocks/enori_crystal_cluster.json aca50008d47da6a89a41421752329fc108b74caa data/actuallyadditions/loot_table/blocks/ethetic_green_block.json 2898af59e57ae6b6400a02e56baaf5af796fe971 data/actuallyadditions/loot_table/blocks/ethetic_green_slab.json 011939f5b508413a3827de5b12ff58dd1c875ca7 data/actuallyadditions/loot_table/blocks/ethetic_green_stairs.json @@ -95,7 +95,7 @@ f8a03e56a032e858126f1b1861ea0b759a3e517d data/actuallyadditions/loot_table/block 27ba42bb0f2dca72e29393944b61e566d758a2dc data/actuallyadditions/loot_table/blocks/long_range_breaker.json 43113c67b268280ce09b9c90df83f33c15bf2f06 data/actuallyadditions/loot_table/blocks/oil_generator.json f0905fdc46775bb0d7382375b0a1109d125175e7 data/actuallyadditions/loot_table/blocks/palis_crystal_block.json -ec28c8a70911ac7e3cf621d19aa06443a9da3ebf data/actuallyadditions/loot_table/blocks/palis_crystal_cluster.json +5162668136335d22fef342550e3a14f8c0347e92 data/actuallyadditions/loot_table/blocks/palis_crystal_cluster.json dadc9a4648ff9cfa77840405384be4937cea991b data/actuallyadditions/loot_table/blocks/phantom_booster.json 7ca8e4e140407dc71416289d293319748d6074a5 data/actuallyadditions/loot_table/blocks/phantom_breaker.json c020a9e28f95800f7eb064fc557afe3cd78ee77a data/actuallyadditions/loot_table/blocks/phantom_energyface.json @@ -108,7 +108,7 @@ f0a5b8a9ef9e878baa8e1792605ecb6371bf6262 data/actuallyadditions/loot_table/block e030d31981f02c0ed25d08fcaf8d8e7c89016247 data/actuallyadditions/loot_table/blocks/powered_furnace.json 8f51bc016a6797bfdf81973a21509e14bd47f245 data/actuallyadditions/loot_table/blocks/ranged_collector.json 0cff315b834058c90a7f26425565e086fb833305 data/actuallyadditions/loot_table/blocks/restonia_crystal_block.json -0e6bc03f897b89999df775595eae662728617604 data/actuallyadditions/loot_table/blocks/restonia_crystal_cluster.json +d1c8ca548cefbb4f33d4763606a7e0c909319717 data/actuallyadditions/loot_table/blocks/restonia_crystal_cluster.json 247ec0004cfa51a635f305aed06f6a8f2d0cd0c4 data/actuallyadditions/loot_table/blocks/rice.json d9337537495eb5b2d5288c6df81125594522e5b7 data/actuallyadditions/loot_table/blocks/shock_suppressor.json a534077796cbfbcf0c66f986db3abd037c2d14d6 data/actuallyadditions/loot_table/blocks/smooth_black_quartz_block.json @@ -118,7 +118,7 @@ a33803a54b60eb930713929368729dbd01fa77f0 data/actuallyadditions/loot_table/block b457272e382a377d7e55f2b74d49683a14d62825 data/actuallyadditions/loot_table/blocks/tiny_torch.json d43769e7f20448bf87952664a3ddd12db0804627 data/actuallyadditions/loot_table/blocks/vertical_digger.json 16963296de38141657d91d76d0458313529e4033 data/actuallyadditions/loot_table/blocks/void_crystal_block.json -58ebb57d3470800107617d0cc84250750834b675 data/actuallyadditions/loot_table/blocks/void_crystal_cluster.json +3a359dfa76bec7d76fe995787f74ab748a98b0c9 data/actuallyadditions/loot_table/blocks/void_crystal_cluster.json d3498d690b7d9170fecdc2dd9825519b680cfeec data/actuallyadditions/loot_table/blocks/wood_casing.json e1ebdde950a7f730c423a16143ad5598e3b6e3a7 data/actuallyadditions/loot_table/blocks/xp_solidifier.json 860b2c007cf8a1942e3f2934e1385a3a75d3a940 data/actuallyadditions/loot_table/engineer_house.json diff --git a/src/generated/resources/data/actuallyadditions/loot_table/blocks/diamatine_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_table/blocks/diamatine_crystal_cluster.json index 7441ec94a..22acf661a 100644 --- a/src/generated/resources/data/actuallyadditions/loot_table/blocks/diamatine_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_table/blocks/diamatine_crystal_cluster.json @@ -3,15 +3,50 @@ "pools": [ { "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], "entries": [ { - "type": "minecraft:item", - "name": "actuallyadditions:diamatine_crystal_cluster" + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ], + "name": "actuallyadditions:diamatine_crystal_cluster" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "actuallyadditions:diamatine_crystal_shard" + } + ] } ], "rolls": 1.0 diff --git a/src/generated/resources/data/actuallyadditions/loot_table/blocks/emeradic_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_table/blocks/emeradic_crystal_cluster.json index a9ea488c7..f770a69cf 100644 --- a/src/generated/resources/data/actuallyadditions/loot_table/blocks/emeradic_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_table/blocks/emeradic_crystal_cluster.json @@ -3,15 +3,50 @@ "pools": [ { "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], "entries": [ { - "type": "minecraft:item", - "name": "actuallyadditions:emeradic_crystal_cluster" + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ], + "name": "actuallyadditions:emeradic_crystal_cluster" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "actuallyadditions:emeradic_crystal_shard" + } + ] } ], "rolls": 1.0 diff --git a/src/generated/resources/data/actuallyadditions/loot_table/blocks/enori_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_table/blocks/enori_crystal_cluster.json index 1cee71d51..ee2adc93c 100644 --- a/src/generated/resources/data/actuallyadditions/loot_table/blocks/enori_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_table/blocks/enori_crystal_cluster.json @@ -3,15 +3,50 @@ "pools": [ { "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], "entries": [ { - "type": "minecraft:item", - "name": "actuallyadditions:enori_crystal_cluster" + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ], + "name": "actuallyadditions:enori_crystal_cluster" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "actuallyadditions:enori_crystal_shard" + } + ] } ], "rolls": 1.0 diff --git a/src/generated/resources/data/actuallyadditions/loot_table/blocks/palis_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_table/blocks/palis_crystal_cluster.json index 8c2acf0ce..a86b35c03 100644 --- a/src/generated/resources/data/actuallyadditions/loot_table/blocks/palis_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_table/blocks/palis_crystal_cluster.json @@ -3,15 +3,50 @@ "pools": [ { "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], "entries": [ { - "type": "minecraft:item", - "name": "actuallyadditions:palis_crystal_cluster" + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ], + "name": "actuallyadditions:palis_crystal_cluster" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "actuallyadditions:palis_crystal_shard" + } + ] } ], "rolls": 1.0 diff --git a/src/generated/resources/data/actuallyadditions/loot_table/blocks/restonia_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_table/blocks/restonia_crystal_cluster.json index 19d07fd64..a51a617ba 100644 --- a/src/generated/resources/data/actuallyadditions/loot_table/blocks/restonia_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_table/blocks/restonia_crystal_cluster.json @@ -3,15 +3,50 @@ "pools": [ { "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], "entries": [ { - "type": "minecraft:item", - "name": "actuallyadditions:restonia_crystal_cluster" + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ], + "name": "actuallyadditions:restonia_crystal_cluster" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "actuallyadditions:restonia_crystal_shard" + } + ] } ], "rolls": 1.0 diff --git a/src/generated/resources/data/actuallyadditions/loot_table/blocks/void_crystal_cluster.json b/src/generated/resources/data/actuallyadditions/loot_table/blocks/void_crystal_cluster.json index 1e148efe1..41e9f0a8d 100644 --- a/src/generated/resources/data/actuallyadditions/loot_table/blocks/void_crystal_cluster.json +++ b/src/generated/resources/data/actuallyadditions/loot_table/blocks/void_crystal_cluster.json @@ -3,15 +3,50 @@ "pools": [ { "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], "entries": [ { - "type": "minecraft:item", - "name": "actuallyadditions:void_crystal_cluster" + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "predicates": { + "minecraft:enchantments": [ + { + "enchantments": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + } + ], + "name": "actuallyadditions:void_crystal_cluster" + }, + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 8.0, + "min": 2.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "actuallyadditions:void_crystal_shard" + } + ] } ], "rolls": 1.0 diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java index 50753eaa1..2888c90e7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/LootTableGenerator.java @@ -34,6 +34,7 @@ import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePrope import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredItem; import java.util.List; import java.util.Set; @@ -185,20 +186,12 @@ public class LootTableGenerator extends LootTableProvider { this.dropSelf(ActuallyBlocks.EMPOWERED_VOID_CRYSTAL.get()); this.dropSelf(ActuallyBlocks.EMPOWERED_EMERADIC_CRYSTAL.get()); -/* this.registerCrystal(ActuallyBlocks.CRYSTAL_CLUSTER_RESTONIA, ActuallyItems.RED_CRYSTAL_SHARD); - this.registerCrystal(ActuallyBlocks.CRYSTAL_CLUSTER_PALIS, ActuallyItems.BLUE_CRYSTAL_SHARD); - this.registerCrystal(ActuallyBlocks.CRYSTAL_CLUSTER_DIAMATINE, ActuallyItems.LIGHT_BLUE_CRYSTAL_SHARD); - this.registerCrystal(ActuallyBlocks.CRYSTAL_CLUSTER_VOID, ActuallyItems.BLACK_CRYSTAL_SHARD); - this.registerCrystal(ActuallyBlocks.CRYSTAL_CLUSTER_EMERADIC, ActuallyItems.GREEN_CRYSTAL_SHARD); - this.registerCrystal(ActuallyBlocks.CRYSTAL_CLUSTER_ENORI, ActuallyItems.WHITE_CRYSTAL_SHARD);*/ - - //TODO temp - dropSelf(ActuallyBlocks.ENORI_CRYSTAL_CLUSTER.get()); - dropSelf(ActuallyBlocks.RESTONIA_CRYSTAL_CLUSTER.get()); - dropSelf(ActuallyBlocks.PALIS_CRYSTAL_CLUSTER.get()); - dropSelf(ActuallyBlocks.DIAMATINE_CRYSTAL_CLUSTER.get()); - dropSelf(ActuallyBlocks.VOID_CRYSTAL_CLUSTER.get()); - dropSelf(ActuallyBlocks.EMERADIC_CRYSTAL_CLUSTER.get()); + this.registerCrystal(ActuallyBlocks.ENORI_CRYSTAL_CLUSTER, ActuallyItems.ENORI_CRYSTAL_SHARD); + this.registerCrystal(ActuallyBlocks.RESTONIA_CRYSTAL_CLUSTER, ActuallyItems.RESTONIA_CRYSTAL_SHARD); + this.registerCrystal(ActuallyBlocks.PALIS_CRYSTAL_CLUSTER, ActuallyItems.PALIS_CRYSTAL_SHARD); + this.registerCrystal(ActuallyBlocks.DIAMATINE_CRYSTAL_CLUSTER, ActuallyItems.DIAMATINE_CRYSTAL_SHARD); + this.registerCrystal(ActuallyBlocks.VOID_CRYSTAL_CLUSTER, ActuallyItems.VOID_CRYSTAL_SHARD); + this.registerCrystal(ActuallyBlocks.EMERADIC_CRYSTAL_CLUSTER, ActuallyItems.EMERADIC_CRYSTAL_SHARD); add(ActuallyBlocks.BLACK_QUARTZ_ORE.get(), createOreDrop(ActuallyBlocks.BLACK_QUARTZ_ORE.getBlock(), ActuallyItems.BLACK_QUARTZ.get())); @@ -226,17 +219,10 @@ public class LootTableGenerator extends LootTableProvider { .include(ActuallyComponents.ENERGY_STORAGE.get()))); } -/* // This isn't quite right :cry: fortune doesn't change it - private void registerCrystal(RegistryObject crystalCluster, RegistryObject crystalShard) { - this.registerLootTable(crystalCluster.get(), (crystal) -> - droppingWithSilkTouch(crystal, - withExplosionDecay(crystal, ItemLootEntry.builder(crystalShard.get()) - .acceptFunction(ApplyBonus.oreDrops(Enchantments.FORTUNE)) - .acceptFunction(SetCount.builder(RandomValueRange.of(2f, 8f))) - ) - ) - ); - }*/ + private void registerCrystal(Supplier crystalCluster, DeferredItem crystalShard) { + this.add(crystalCluster.get(), block -> + this.createSingleItemTableWithSilkTouch(block, crystalShard.get(), UniformGenerator.between(2.0F, 8.0F))); + } @Override protected Iterable getKnownBlocks() {