Jump to content

[1.5.1] Adding new drops to vanilla mobs


Recommended Posts

Hello, I've been trying to put bones to a vanilla mob.

I did some research, and tried this:

        public void playerKilledSheep(LivingDropsEvent event)
        	System.out.println("Killed something");
         if(event.entityLiving instanceof EntitySheep)
          System.out.println("Killed a Sheep");
          event.entityLiving.dropItem(Item.bone.shiftedIndex, 1);


I have an error on the "shiftedIndex" part, but it doesn't even post something in the console, means it doesn't even detect if I killed something or not.

Please help.


Best regards,


Link to comment
Share on other sites

  • 1 month later...

Since I'm nice I'm going to make this the EASY way.


package your.package;

import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.item.Item;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingDropsEvent;

public class Event_LivingDrops {
public static double rand;

public void onEntityDrop(LivingDropsEvent event) {
	if (event.source.getDamageType().equals("player")) { //Checks for Damage Type.
		rand = Math.random(); //Initializes double "rand"
		System.out.println("Killed something.");
		if (event.entityLiving instanceof EntitySheep) { //Checks the entity killed.
			System.out.println("Killed a sheep.");
			if (rand < 1D) { //Makes drop 100% drop chance. Example: (0.25D = 25%, 1D = 100%, etc.);
				event.entityLiving.dropItem(Item.bone.itemID); //Use "itemID" not "shiftedIndex"
				//itemID is used for MCP, shiftedIndex is only used when already converted to .class.


Also, remember to put this in your Proxy class.

You need to register this class for Forge to be able to know it is an event.

Put it in the @Init of your proxy.


MinecraftForge.EVENT_BUS.register(new Event_LivingDrops());


This should work! Read the "//"s for information.


Good Luck!

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.

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.


  • Create New...

Important Information

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