use of net.minecraft.block.BlockTallGrass in project AgriCraft by AgriCraft.
the class GrassDropHandler method interceptGrassDrop.
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void interceptGrassDrop(BlockEvent.HarvestDropsEvent event) {
// Skip silk touch.
if (event.isSilkTouching()) {
return;
}
// Fetch the blockstate.
final IBlockState state = event.getState();
// Skip Air or Error
if (state == null || state.getBlock() == null) {
return;
}
// Fetch the world random.
final Random rand = event.getWorld().rand;
// Add grass drops if grass block.
if (state.getBlock() instanceof BlockTallGrass) {
// Wipe other drops, if needed.
if (AgriCraftConfig.wipeGrassDrops) {
event.getDrops().clear();
}
// Log
// Commenented out to prevent spam.
// AgriCore.getLogger("agricraft").debug("Inserting Drops!");
// Add the drops.
addGrassDrops(event.getDrops(), rand);
}
}
Aggregations