diff --git a/README.md b/README.md index ba25d51..02e257e 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,3 @@ This branch depends on [Fabric-Loader](https://fabricmc.net/) and [Fabric](https ] } ``` - -## Compatibility - -If your mod adds basic crops, please consider shipping a `harvest:seeds` tag defining your seed items. This will -allow users to define your crops in the config of this mod and have them function properly. \ No newline at end of file diff --git a/src/main/java/info/tehnut/harvest/Harvest.java b/src/main/java/info/tehnut/harvest/Harvest.java index 9a33c67..3fe80d8 100644 --- a/src/main/java/info/tehnut/harvest/Harvest.java +++ b/src/main/java/info/tehnut/harvest/Harvest.java @@ -9,6 +9,8 @@ import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.CropBlock; +import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.world.ServerWorld; @@ -32,7 +34,6 @@ public class Harvest implements ModInitializer { // Up top against convention so DEFAULT_HANDLER can access it public static HarvestConfig config; - public static final Tag SEED_TAG = TagRegistry.item(new Identifier("harvest", "seeds")); public static final Logger LOGGER = LogManager.getLogger("Harvest"); public static final IReplantHandler DEFAULT_HANDLER = (world, hit, state, player, tileEntity) -> { Crop crop = config.getCrops().stream().filter(c -> c.test(state)).findFirst().orElse(null); @@ -46,7 +47,8 @@ public class Harvest implements ModInitializer { List drops = Block.getDroppedStacks(state, world, pos, tileEntity, player, player.getStackInHand(Hand.MAIN_HAND)); boolean foundSeed = false; for (ItemStack drop : drops) { - if (SEED_TAG.contains(drop.getItem())) { + Item dropItem = drop.getItem(); + if (dropItem instanceof BlockItem && ((BlockItem)dropItem).getBlock() == state.getBlock()) { foundSeed = true; drop.decrement(1); break; diff --git a/src/main/resources/data/harvest/tags/items/seeds.json b/src/main/resources/data/harvest/tags/items/seeds.json deleted file mode 100644 index e02d2d1..0000000 --- a/src/main/resources/data/harvest/tags/items/seeds.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "replace": false, - "values": [ - "minecraft:wheat_seeds", - "minecraft:nether_wart", - "minecraft:carrot", - "minecraft:potato", - "minecraft:beetroot_seeds" - ] -} \ No newline at end of file