Jump to content

LivingDeathEvent DropItem creates Phantom Item :/


Collin1971

Recommended Posts

OK, so I've been trying to add custom drops to vanilla mobs, and my slightly edited code of someone Else's works fine, except that it drops a phantom item along with the real item (one can be picked up and other cannot). This class is inside my main package, (not inside the one with the .client suffix), I'm at a complete loss of why this is happening, the code compiles without a single error and Minecraft doesn't warn/error/info anything. :/

 

EntityDropEvent class:

import net.minecraft.entity.passive.EntitySheep;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.ForgeSubscribe;


public class LivingDropsEvent{

@ForgeSubscribe
    public void onEntityDrop(LivingDeathEvent event) {

        if (event.entityLiving instanceof EntitySheep) {
        	EntitySheep entity = (EntitySheep)event.entityLiving;
           //The integer at the end relates to how many potato will be dropped.
            entity.dropItem(MoarFoods.rawLamb.itemID, 1);
        }
}
}

 

Main Forge Class:

        	
// Custom Events
        	MinecraftForge.EVENT_BUS.register(new LivingDropsEvent());

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

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