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..ca331fb9a7 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 @@ -21,7 +21,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), diff --git a/src/main/java/de/dafuqs/spectrum/compat/SpectrumIntegrationPacks.java b/src/main/java/de/dafuqs/spectrum/compat/SpectrumIntegrationPacks.java index ddcee6e876..3d79b37266 100644 --- a/src/main/java/de/dafuqs/spectrum/compat/SpectrumIntegrationPacks.java +++ b/src/main/java/de/dafuqs/spectrum/compat/SpectrumIntegrationPacks.java @@ -5,6 +5,7 @@ import de.dafuqs.spectrum.compat.alloy_forgery.*; import de.dafuqs.spectrum.compat.botania.*; import de.dafuqs.spectrum.compat.create.*; +import de.dafuqs.spectrum.compat.farmersdelight.FDCompat; import de.dafuqs.spectrum.compat.gobber.*; import de.dafuqs.spectrum.compat.modonomicon.*; import de.dafuqs.spectrum.compat.neepmeat.NEEPMeatCompat; @@ -39,7 +40,7 @@ protected static void registerIntegrationPack(String modId, Supplier new BotaniaCompat()); registerIntegrationPack(MODONOMICON_ID, () -> new ModonomiconCompat()); registerIntegrationPack(NEEPMEAT_ID, () -> new NEEPMeatCompat()); + registerIntegrationPack(FARMERSDELIGHT_ID, () -> new FDCompat()); if (!FabricLoader.getInstance().isModLoaded("forgified-fabric-api")) { registerIntegrationPack(CREATE_ID, () -> new CreateCompat()); } diff --git a/src/main/java/de/dafuqs/spectrum/compat/farmersdelight/FDCompat.java b/src/main/java/de/dafuqs/spectrum/compat/farmersdelight/FDCompat.java new file mode 100644 index 0000000000..36154e3335 --- /dev/null +++ b/src/main/java/de/dafuqs/spectrum/compat/farmersdelight/FDCompat.java @@ -0,0 +1,28 @@ +package de.dafuqs.spectrum.compat.farmersdelight; + +import de.dafuqs.spectrum.*; +import de.dafuqs.spectrum.compat.*; +import net.fabricmc.api.*; +import net.fabricmc.fabric.api.loot.v2.*; +import net.minecraft.util.*; + +public class FDCompat extends SpectrumIntegrationPacks.ModIntegrationPack { + + private static final Identifier AMARANTH_LOOT_TABLE_ID = SpectrumCommon.locate("blocks/amaranth"); + + public void register() { + LootTableEvents.REPLACE.register((resourceManager, lootManager, id, original, source) -> { + if (AMARANTH_LOOT_TABLE_ID.equals(id)) { + return lootManager.getLootTable(SpectrumCommon.locate("mod_integration/farmers_delight/amaranth")); + } + return original; + }); + } + + @Environment(EnvType.CLIENT) + @Override + public void registerClient() { + + } + +} 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 d3e8b8aa6a..68c137a5ff 100644 --- a/src/main/resources/data/spectrum/loot_tables/blocks/amaranth.json +++ b/src/main/resources/data/spectrum/loot_tables/blocks/amaranth.json @@ -53,16 +53,5 @@ { "function": "minecraft:explosion_decay" } - ], - "fabric:load_conditions": [ - { - "condition": "fabric:not", - "value": { - "condition": "fabric:all_mods_loaded", - "values": [ - "farmersdelight" - ] - } - } ] -} +} \ No newline at end of file diff --git a/src/main/resources/data/spectrum/loot_tables/mod_integration/farmers_delight/amaranth.json b/src/main/resources/data/spectrum/loot_tables/mod_integration/farmers_delight/amaranth.json new file mode 100644 index 0000000000..4ea0849ed1 --- /dev/null +++ b/src/main/resources/data/spectrum/loot_tables/mod_integration/farmers_delight/amaranth.json @@ -0,0 +1,120 @@ +{ + "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" + } + ], + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": [ + "farmersdelight" + ] + } + ] +} \ No newline at end of file