corrected loot table for grass crop drops
Some checks failed
build / build (21) (push) Has been cancelled
Some checks failed
build / build (21) (push) Has been cancelled
This commit is contained in:
parent
4fc53e92d1
commit
c5c4c4d8a6
@ -16,12 +16,11 @@ import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
|
|||||||
import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
|
import net.fabricmc.fabric.api.loot.v3.LootTableEvents;
|
||||||
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
|
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.Blocks;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.loot.LootPool;
|
import net.minecraft.loot.LootPool;
|
||||||
import net.minecraft.loot.condition.SurvivesExplosionLootCondition;
|
import net.minecraft.loot.condition.SurvivesExplosionLootCondition;
|
||||||
import net.minecraft.loot.entry.ItemEntry;
|
import net.minecraft.loot.entry.ItemEntry;
|
||||||
import net.minecraft.loot.entry.LeafEntry.Builder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -40,15 +39,17 @@ public class Quickiemod implements ModInitializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerLootTableChanges() {
|
private void registerLootTableChanges() {
|
||||||
// does not work yet right
|
|
||||||
LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> {
|
LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> {
|
||||||
if (source.isBuiltin()) {
|
if (source.isBuiltin()) {
|
||||||
if (Blocks.SHORT_GRASS.getLootTableKey().get().getRegistry().equals(key.getRegistry())) {
|
if ("minecraft:blocks/short_grass".equals(key.getValue().toString())) {
|
||||||
tableBuilder.pool(LootPool.builder().with(ItemEntry.builder(ModItems.ITEM_COTTONSEED))
|
tableBuilder.pool(LootPool.builder()
|
||||||
|
.with(ItemEntry.builder(ModItems.ITEM_COTTONSEED).weight(1))
|
||||||
|
.with(ItemEntry.builder(Items.AIR).weight(4))
|
||||||
.conditionally(SurvivesExplosionLootCondition.builder()));
|
.conditionally(SurvivesExplosionLootCondition.builder()));
|
||||||
}
|
} else if ("minecraft:blocks/tall_grass".equals(key.getValue().toString())) {
|
||||||
if (Blocks.TALL_GRASS.getLootTableKey().get().getRegistry().equals(key.getRegistry())) {
|
tableBuilder.pool(LootPool.builder()
|
||||||
tableBuilder.pool(LootPool.builder().with(ItemEntry.builder(ModItems.ITEM_CANOLASEED))
|
.with(ItemEntry.builder(ModItems.ITEM_CANOLASEED).weight(1))
|
||||||
|
.with(ItemEntry.builder(Items.AIR).weight(7))
|
||||||
.conditionally(SurvivesExplosionLootCondition.builder()));
|
.conditionally(SurvivesExplosionLootCondition.builder()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "minecraft:chest",
|
|
||||||
"pools": [
|
|
||||||
{
|
|
||||||
"rolls": 1,
|
|
||||||
"entries": [
|
|
||||||
{
|
|
||||||
"type": "minecraft:item",
|
|
||||||
"functions": [
|
|
||||||
{
|
|
||||||
"add": false,
|
|
||||||
"count": {
|
|
||||||
"type": "minecraft:uniform",
|
|
||||||
"max": 9.0,
|
|
||||||
"min": 1.0
|
|
||||||
},
|
|
||||||
"function": "minecraft:set_count"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "quickiemod:canolaseed"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "minecraft:item",
|
|
||||||
"functions": [
|
|
||||||
{
|
|
||||||
"add": false,
|
|
||||||
"count": {
|
|
||||||
"type": "minecraft:uniform",
|
|
||||||
"max": 9.0,
|
|
||||||
"min": 1.0
|
|
||||||
},
|
|
||||||
"function": "minecraft:set_count"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "quickiemod:cottonseed"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user