getting cotton seed from short grass works
This commit is contained in:
@@ -10,7 +10,6 @@ import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
|
||||
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.storage.loot.LootPool;
|
||||
import net.minecraft.world.level.storage.loot.entries.LootItem;
|
||||
import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition;
|
||||
@@ -33,15 +32,16 @@ public class Quickly implements ModInitializer {
|
||||
private void registerLootTableChanges() {
|
||||
LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> {
|
||||
if (source.isBuiltin()) {
|
||||
Identifier grass = Identifier.fromNamespaceAndPath("minecraft", "blocks/grass");
|
||||
Quickly.LOGGER.info("key {} ?=? grass {}", key.identifier(), grass);
|
||||
if (key.identifier().equals(grass)) {
|
||||
// TODO: maybe, better harvest cotton from dry grass instead?
|
||||
Identifier shortGrass = Identifier.fromNamespaceAndPath("minecraft", "blocks/short_grass");
|
||||
Identifier tallGrass = Identifier.fromNamespaceAndPath("minecraft", "blocks/tall_grass");
|
||||
if (key.identifier().equals(shortGrass)) {
|
||||
LootPool.Builder poolBuilder = LootPool.lootPool()
|
||||
.setRolls(ConstantValue.exactly(1f))
|
||||
.when(LootItemRandomChanceCondition.randomChance(0.1f))
|
||||
.add(LootItem.lootTableItem(QuicklyItems.COTTONSEED));
|
||||
tableBuilder.withPool(poolBuilder);
|
||||
} else if (Blocks.TALL_GRASS.getLootTable().equals(key)) {
|
||||
} else if (key.identifier().equals(tallGrass)) {
|
||||
// for the canola loot table block later
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user