From eee01ac4d190bcee1ed6074b01c91b08d158ae1e Mon Sep 17 00:00:00 2001 From: f-raZ0R Date: Sun, 6 Oct 2024 13:14:43 -0400 Subject: [PATCH] Fix amaranth-FD compat for real this time --- .../amaranth/AmaranthCropBlock.java | 7 +- .../spectrum/loot_tables/blocks/amaranth.json | 67 ----------- .../loot_tables/blocks/amaranth_fd.json | 112 ++++++++++++++++++ 3 files changed, 118 insertions(+), 68 deletions(-) create mode 100644 src/main/resources/data/spectrum/loot_tables/blocks/amaranth_fd.json diff --git a/src/main/java/de/dafuqs/spectrum/blocks/conditional/amaranth/AmaranthCropBlock.java b/src/main/java/de/dafuqs/spectrum/blocks/conditional/amaranth/AmaranthCropBlock.java index 30bc102d72..826280d331 100644 --- a/src/main/java/de/dafuqs/spectrum/blocks/conditional/amaranth/AmaranthCropBlock.java +++ b/src/main/java/de/dafuqs/spectrum/blocks/conditional/amaranth/AmaranthCropBlock.java @@ -5,6 +5,7 @@ import de.dafuqs.spectrum.registries.*; import de.dafuqs.spectrum.registries.client.*; import de.dafuqs.spectrum.blocks.*; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.*; import net.minecraft.block.enums.*; import net.minecraft.item.*; @@ -21,7 +22,7 @@ public class AmaranthCropBlock extends TallCropBlock implements RevelationAware public static final Identifier ADVANCEMENT_IDENTIFIER = SpectrumCommon.locate("milestones/reveal_amaranth"); protected static final int LAST_SINGLE_BLOCK_AGE = 2; protected static final int MAX_AGE = 7; - + private static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[]{ Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D), Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 10.0D, 16.0D), @@ -35,6 +36,10 @@ public class AmaranthCropBlock extends TallCropBlock implements RevelationAware public AmaranthCropBlock(Settings settings) { super(settings, LAST_SINGLE_BLOCK_AGE); + if(FabricLoader.getInstance().isModLoaded("farmersdelight")) + { + this.lootTableId = SpectrumCommon.locate("blocks/amaranth_fd"); + } RevelationAware.register(this); } diff --git a/src/main/resources/data/spectrum/loot_tables/blocks/amaranth.json b/src/main/resources/data/spectrum/loot_tables/blocks/amaranth.json index 61731bf757..68c137a5ff 100644 --- a/src/main/resources/data/spectrum/loot_tables/blocks/amaranth.json +++ b/src/main/resources/data/spectrum/loot_tables/blocks/amaranth.json @@ -8,49 +8,6 @@ { "type": "minecraft:alternatives", "children": [ - { - "type": "minecraft:item", - "name": "spectrum:amaranth_grains", - "functions": [ - { - "function": "minecraft:set_count", - "count": { - "min": 2, - "max": 4 - } - }, - { - "function": "minecraft:apply_bonus", - "enchantment": "minecraft:fortune", - "formula": "minecraft:binomial_with_bonus_count", - "parameters": { - "extra": 1, - "probability": 0.5714286 - } - } - ], - "conditions": [ - { - "condition": "minecraft:match_tool", - "predicate": { - "tag": "farmersdelight:tools/knives" - } - }, - { - "condition": "minecraft:block_state_property", - "block": "spectrum:amaranth", - "properties": { - "age": "7" - } - }, - { - "condition": "fabric:all_mods_loaded", - "values": [ - "farmersdelight" - ] - } - ] - }, { "type": "minecraft:item", "name": "spectrum:amaranth_bushel", @@ -90,30 +47,6 @@ ] } ] - }, - { - "rolls": 1, - "bonus_rolls": 0, - "entries": [ - { - "type": "minecraft:item", - "name": "farmersdelight:straw", - "conditions": [ - { - "condition": "minecraft:match_tool", - "predicate": { - "tag": "farmersdelight:tools/knives" - } - }, - { - "condition": "fabric:all_mods_loaded", - "values": [ - "farmersdelight" - ] - } - ] - } - ] } ], "functions": [ diff --git a/src/main/resources/data/spectrum/loot_tables/blocks/amaranth_fd.json b/src/main/resources/data/spectrum/loot_tables/blocks/amaranth_fd.json new file mode 100644 index 0000000000..87af015d59 --- /dev/null +++ b/src/main/resources/data/spectrum/loot_tables/blocks/amaranth_fd.json @@ -0,0 +1,112 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "bonus_rolls": 0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "name": "spectrum:amaranth_grains", + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 2, + "max": 4 + } + }, + { + "function": "minecraft:apply_bonus", + "enchantment": "minecraft:fortune", + "formula": "minecraft:binomial_with_bonus_count", + "parameters": { + "extra": 1, + "probability": 0.5714286 + } + } + ], + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "tag": "farmersdelight:tools/knives" + } + }, + { + "condition": "minecraft:block_state_property", + "block": "spectrum:amaranth", + "properties": { + "age": "7" + } + } + ] + }, + { + "type": "minecraft:item", + "name": "spectrum:amaranth_bushel", + "conditions": [ + { + "condition": "minecraft:block_state_property", + "block": "spectrum:amaranth", + "properties": { + "age": "7" + } + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1, + "max": 2 + } + }, + { + "function": "minecraft:apply_bonus", + "enchantment": "minecraft:fortune", + "formula": "minecraft:binomial_with_bonus_count", + "parameters": { + "extra": 1, + "probability": 0.5714286 + } + } + ] + }, + { + "type": "minecraft:item", + "name": "spectrum:amaranth_grains", + "count": 1 + } + ] + } + ] + }, + { + "rolls": 1, + "bonus_rolls": 0, + "entries": [ + { + "type": "minecraft:item", + "name": "farmersdelight:straw", + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "tag": "farmersdelight:tools/knives" + } + } + ] + } + ] + } + ], + "functions": [ + { + "function": "minecraft:explosion_decay" + } + ] +} \ No newline at end of file