• 0

    posted a message on Trouble making creatures drop multiple custom item

    I can get animals to drop a 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) {
    
    event.getEntityLiving().entityDropItem(new ItemStack(ModItems.dollarBill), 1);
    event.getEntityLiving().entityDropItem(new ItemStack(ModItems.dollarBill), 1);
    event.getEntityLiving().entityDropItem(new ItemStack(ModItems.dollarBill), 1);
    }

     

     

    Posted in: General Discussion
  • To post a comment, please or register a new account.