Skip to content

Commit

Permalink
Fix amaranth-FD compat for real this time
Browse files Browse the repository at this point in the history
  • Loading branch information
f-raZ0R committed Oct 6, 2024
1 parent 819b6b9 commit eee01ac
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -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),
Expand All @@ -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);
}

Expand Down
67 changes: 0 additions & 67 deletions src/main/resources/data/spectrum/loot_tables/blocks/amaranth.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": [
Expand Down
112 changes: 112 additions & 0 deletions src/main/resources/data/spectrum/loot_tables/blocks/amaranth_fd.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}

0 comments on commit eee01ac

Please sign in to comment.