Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Remove redundant "seeds" tag #36

Open
wants to merge 2 commits into
base: 1.16_fabric
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
6 changes: 4 additions & 2 deletions src/main/java/info/tehnut/harvest/Harvest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Item> 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);
Expand All @@ -46,7 +47,8 @@ public class Harvest implements ModInitializer {
List<ItemStack> 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;
Expand Down
10 changes: 0 additions & 10 deletions src/main/resources/data/harvest/tags/items/seeds.json

This file was deleted.