Skip to content

Commit

Permalink
Merge pull request DaFuqs#511 from f-raZ0R/loot-modifier
Browse files Browse the repository at this point in the history
Fix Amaranth-FD Compat but actually
  • Loading branch information
DaFuqs authored Oct 7, 2024
2 parents b367ea1 + 2f3a155 commit c7a815c
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -39,7 +40,7 @@ protected static void registerIntegrationPack(String modId, Supplier<ModIntegrat
public static final String BOTANIA_ID = "botania";
public static final String MODONOMICON_ID = "modonomicon";
public static final String CREATE_ID = "create";

public static final String FARMERSDELIGHT_ID = "farmersdelight";
public static final String NEEPMEAT_ID = "neepmeat";

@SuppressWarnings("Convert2MethodRef")
Expand All @@ -51,6 +52,7 @@ public static void register() {
registerIntegrationPack(BOTANIA_ID, () -> 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());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,5 @@
{
"function": "minecraft:explosion_decay"
}
],
"fabric:load_conditions": [
{
"condition": "fabric:not",
"value": {
"condition": "fabric:all_mods_loaded",
"values": [
"farmersdelight"
]
}
}
]
}
}
Original file line number Diff line number Diff line change
@@ -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"
]
}
]
}

0 comments on commit c7a815c

Please sign in to comment.