Jump to content

Trouble getting mobs to drop multiple custom items 1.10.2


cronus3

Recommended Posts

I can get animals to drop as many dollarBills as I want if I copy and paste "event.getEntityLiving().entityDropItem(new ItemStack(ModItems.dollarBill), 1);" but changing the integer at the end does nothing. What am I missing?

 

package yourmod.tutorial.drops;
import java.util.Random;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import yourmod.tutorial.item.ModItems;

public class DropHandler {

@SubscribeEvent
public void onEntityDrop(LivingDropsEvent event) {

if (event.getEntityLiving() instanceof EntityAnimal) {

  //Copying and pasting this line of code is the only way to get EnitityAnimal to drop multiple items, changing the 1 does nothing
event.getEntityLiving().entityDropItem(new ItemStack(ModItems.dollarBill), 1);
event.getEntityLiving().entityDropItem(new ItemStack(ModItems.dollarBill), 1);
event.getEntityLiving().entityDropItem(new ItemStack(ModItems.dollarBill), 1);
}

 

Edited by cronus3
To include Minecraft version in title
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.