Posted April 27, 20205 yr I tried to add a drop item to the Spider but I just couldn't overwrite anything. Help is appreciated and sorry if I'm just stupid. The class: package de.theyoungseth.randomutils.utilities; import net.minecraft.entity.EntityType; import net.minecraft.item.Items; import net.minecraft.world.storage.loot.*; import net.minecraft.world.storage.loot.conditions.KilledByPlayer; import net.minecraft.world.storage.loot.functions.LootingEnchantBonus; import net.minecraft.world.storage.loot.functions.SetCount; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import java.util.function.Consumer; @Mod.EventBusSubscriber(modid = References.MODID) public class EntityLootTables extends net.minecraft.data.loot.EntityLootTables { @Override @SubscribeEvent protected void addTables() { super.addTables(); this.registerLootTable(EntityType.SPIDER, LootTable.builder().addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(ItemLootEntry.builder(ItemRegistryHandler.spider).acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 1.0F))).acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F))))).addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(ItemLootEntry.builder(Items.STRING).acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 2.0F))).acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F))))).addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(ItemLootEntry.builder(Items.SPIDER_EYE).acceptFunction(SetCount.builder(RandomValueRange.of(-1.0F, 1.0F))).acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F)))).acceptCondition(KilledByPlayer.builder()))); } /*@SubscribeEvent public void addTables() { this.registerLootTable(EntityType.SPIDER, LootTable.builder().addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(ItemLootEntry.builder(ItemRegistryHandler.spider).acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 1.0F))).acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F))))).addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(ItemLootEntry.builder(Items.STRING).acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 2.0F))).acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F))))).addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(ItemLootEntry.builder(Items.SPIDER_EYE).acceptFunction(SetCount.builder(RandomValueRange.of(-1.0F, 1.0F))).acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F)))).acceptCondition(KilledByPlayer.builder()))); }*/ }
April 27, 20205 yr Wait, I didn't read properly. I'm also new and have not fiddled with loot tables but why are subscribing to an event without a parameter.
April 27, 20205 yr and for adding drops you need to use https://github.com/MinecraftForge/Documentation/pull/274
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.