Jump to content

[1.7.x] How to add custom Drops to vanilla mobs


SuperHB

Recommended Posts

It's much better to only subscribe to the event once and map the entity class to Item drops, or even just chain else-ifs within the one event if you are not comfortable with Maps, Lists, etc.

 

Example of chaining else-ifs:

 

@SubscribeEvent
public void onDrop(LivingDropsEvent event) {
// you can also check the random chance here, rather than every time,
// since you use the exact same probability for all your cases
if (event.source.getDamageType().equals("player") && event.entity.getWorldObj().rand.nextFloat() < 0.1F) {

if (event.entity instanceof EntityHorse) {
// horse drops
} else if (event.entity instanceof EntitySkeleton) {
// skeleton drops
} // etc.

}
}

 

Link to comment
Share on other sites

It's much better to only subscribe to the event once and map the entity class to Item drops, or even just chain else-ifs within the one event if you are not comfortable with Maps, Lists, etc.

 

Example of chaining else-ifs:

 

@SubscribeEvent
public void onDrop(LivingDropsEvent event) {
// you can also check the random chance here, rather than every time,
// since you use the exact same probability for all your cases
if (event.source.getDamageType().equals("player") && event.entity.getWorldObj().rand.nextFloat() < 0.1F) {

if (event.entity instanceof EntityHorse) {
// horse drops
} else if (event.entity instanceof EntitySkeleton) {
// skeleton drops
} // etc.

}
}

 

 

I only use the same probability for passive and different probability for aggressive mobs is there a way to set it for different mob groups?

Link to comment
Share on other sites

It's much better to only subscribe to the event once and map the entity class to Item drops, or even just chain else-ifs within the one event if you are not comfortable with Maps, Lists, etc.

 

Example of chaining else-ifs:

 

@SubscribeEvent
public void onDrop(LivingDropsEvent event) {
// you can also check the random chance here, rather than every time,
// since you use the exact same probability for all your cases
if (event.source.getDamageType().equals("player") && event.entity.getWorldObj().rand.nextFloat() < 0.1F) {

if (event.entity instanceof EntityHorse) {
// horse drops
} else if (event.entity instanceof EntitySkeleton) {
// skeleton drops
} // etc.

}
}

 

 

I'm getting an error at

if (event.source.getDamageType().equals("player") && event.entity.getWorldObj().rand.nextFloat() < 0.1F) {

 

where it is at event.entity.getWorldObj

 

Where is your @SubscribeEvent?

 

I added one. Doesn't do much ._.

@SubscribeEvent
    public void onEntityDropCow(LivingDropsEvent event)
    {
        if (event.source.getDamageType().equals("player"))
        {
            rand = Math.random();

            if (event.entityLiving instanceof EntityCow)
            {
                //The 0.25d bit is the drop rate. at 0.25 it has a 25% chance of dropping. 1.00d is 100%
                if (rand < 0.17d)
                {
                    event.entityLiving.dropItem(Items.bone, 12);
                    event.entityLiving.dropItem(MobDrops.cowHorn, 2);
                    event.entityLiving.dropItem(MobDrops.ribCage, 1);
                }
            }
        }
    }

Link to comment
Share on other sites

I'm getting an error at

if (event.source.getDamageType().equals("player") && event.entity.getWorldObj().rand.nextFloat() < 0.1F) {

 

where it is at event.entity.getWorldObj

Change it to 'event.entity.worldObj' then - I was responding without Eclipse open, and some classes in 1.7.2 no longer provide public access to their World object (Tile Entities, I believe, for one).

 

Where is your @SubscribeEvent?

 

I added one. Doesn't do much ._.

While one could argue that, it is absolutely necessary for your Event to be called, just as proper syntax "doesn't do much", but your code certainly won't work without it.

 

I only use the same probability for passive and different probability for aggressive mobs is there a way to set it for different mob groups?

Java can do pretty much anything, yes. An easy way to filter mob types is "event.entity instanceof IMob", which returns true if the entity is any type of aggressive mob (for vanilla at least, and 99.9% of modded entities will follow this rule as well).

Link to comment
Share on other sites

Did you register that event in your main class?

Remember you need to test it on a cow because you are doing it that way.

 

I suggest you do exactly what coolAlias suggested as it will make your class less messy and easier to read.

 

How do i do that? I never had to do that before

 

And here is the code I'm using now and it still doesn't work

package net.net46.thesuperhb.MobDrops;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;

public class LivingDropEvent
{
    public static double rand;
    
    @SubscribeEvent
    public void onDrop(LivingDropsEvent event) 
    {
    // you can also check the random chance here, rather than every time,
    // since you use the exact same probability for all your cases
    	if (event.source.getDamageType().equals("player") && event.entity.worldObj.rand.nextFloat() < 1.00F)
    		{
    		if (event.entity instanceof EntityCow) 
    		{
    			event.entityLiving.dropItem(Items.bone, 12);
                        event.entityLiving.dropItem(MobDrops.cowHorn, 2);
                        event.entityLiving.dropItem(MobDrops.ribCage, 1);
    		} 
    		else if (event.entity instanceof EntityMooshroom) 
    		{
    			event.entityLiving.dropItem(Items.bone, 12);
                        event.entityLiving.dropItem(MobDrops.cowHorn, 2);
                        event.entityLiving.dropItem(MobDrops.ribCage, 1);
                        event.entityLiving.dropItem(MobDrops.redLeather, 3);
    		}

    	}
    }
}

 

I commented out the rest of the code so I could just try it out with the Cow and Mooshroom. Still doesn't work :(

Link to comment
Share on other sites

You need to "register" that class in your main class.

 

Don't know how?

Okay. Let me show you.

 

Do you have a main class? (with the PreInit stuff)

If you do, then in that place use the MinecraftForge eventbus.

 

Example:

//Note that this is an example and that you should only use the registration method I put in preInit.
public void preInit(FMLPreInitializationEvent event) {
     MinecraftForge.EVENT_BUS.register(new YourEventClass()); //in your case would be LivingDropsEvent
}

 

Hey, btw. Aren't you from PMC? lol. I think I may know you.

Link to comment
Share on other sites

You need to "register" that class in your main class.

 

Don't know how?

Okay. Let me show you.

 

Do you have a main class? (with the PreInit stuff)

If you do, then in that place use the MinecraftForge eventbus.

 

Example:

//Note that this is an example and that you should only use the registration method I put in preInit.
public void preInit(FMLPreInitializationEvent event) {
     MinecraftForge.EVENT_BUS.register(new YourEventClass()); //in your case would be LivingDropsEvent
}

 

Hey, btw. Aren't you from PMC? lol. I think I may know you.

 

I tried the code and it gave me an error saying you have to put stuff in the () and it auto added it for me and it still doesn't work.

 

And yes I am from PMC. JustKilling is my username on it

 

Here is the code:

//PreInitialize
    public void preInit(FMLPreInitializationEvent event)
    {
    	MinecraftForge.EVENT_BUS.register(new LivingDropsEvent(null, null, null, 0, false, 0));
    	proxy.initCapes();
    }

 

That's what it add for it to not have an error

Link to comment
Share on other sites

hey, if you still need help, Here's the code i use. works 100%.

 

In the main class:

@EventHandler
public void PreInitialization(FMLPreInitializationEvent event) {
//blah blah blah	
	/*Vanilla Mob Drops*/
	MinecraftForge.EVENT_BUS.register(new ModLivingDropsEvent());
//blah blah blah
}

My "ModLivingDropsEvent" class

package dudesmods.lozmod.lozmod3.proxy;

import java.util.Random;

import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityCaveSpider;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntitySilverfish;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntitySnowman;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import dudesmods.lozmod.lozmod3.LOZmod;

public class ModLivingDropsEvent {

          public static double rand;
          public Random r = new Random();

          @SubscribeEvent
          public void onEntityDrop(LivingDropsEvent event) {
        	  if(event.entityLiving instanceof EntityCow) {
        		  event.entityLiving.dropItem(LOZmod.green_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.red_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.blue_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityPig) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySheep) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityHorse) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 10);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityChicken) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySnowman) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 1);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityIronGolem) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 20);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityZombie) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityPigZombie) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySpider) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityCaveSpider) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(50));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityBlaze) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(60));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityCreeper) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(100));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityEnderman) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(120));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityGhast) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(200));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySilverfish) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(200));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySkeleton) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySlime) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityMagmaCube) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityWitch) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityWither) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 500);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityDragon) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 700);
        	  }
          }
                  
}

Legend of Zelda Mod[updated September 20th to 3.1.1]

Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0]

Fancy Cheeses[updated May 8th to 0.5.0]

Link to comment
Share on other sites

hey, if you still need help, Here's the code i use. works 100%.

 

In the main class:

@EventHandler
public void PreInitialization(FMLPreInitializationEvent event) {
//blah blah blah	
	/*Vanilla Mob Drops*/
	MinecraftForge.EVENT_BUS.register(new ModLivingDropsEvent());
//blah blah blah
}

My "ModLivingDropsEvent" class

package dudesmods.lozmod.lozmod3.proxy;

import java.util.Random;

import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityCaveSpider;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntitySilverfish;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntitySnowman;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import dudesmods.lozmod.lozmod3.LOZmod;

public class ModLivingDropsEvent {

          public static double rand;
          public Random r = new Random();

          @SubscribeEvent
          public void onEntityDrop(LivingDropsEvent event) {
        	  if(event.entityLiving instanceof EntityCow) {
        		  event.entityLiving.dropItem(LOZmod.green_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.red_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.blue_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityPig) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySheep) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityHorse) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 10);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityChicken) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySnowman) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 1);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityIronGolem) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 20);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityZombie) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityPigZombie) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySpider) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityCaveSpider) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(50));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityBlaze) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(60));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityCreeper) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(100));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityEnderman) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(120));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityGhast) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(200));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySilverfish) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(200));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySkeleton) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySlime) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityMagmaCube) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityWitch) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityWither) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 500);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityDragon) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 700);
        	  }
          }
                  
}

 

copied it exactly I keep on getting an error at the MinecraftForge.EVENT_BUS.register(new LivingDropsEvent()); Part I now the other person who posted trying to help that I had to use the Handler but you dont have one from the looks of it and it...

Link to comment
Share on other sites

hey, if you still need help, Here's the code i use. works 100%.

 

In the main class:

@EventHandler
public void PreInitialization(FMLPreInitializationEvent event) {
//blah blah blah	
	/*Vanilla Mob Drops*/
	MinecraftForge.EVENT_BUS.register(new ModLivingDropsEvent());
//blah blah blah
}

My "ModLivingDropsEvent" class

package dudesmods.lozmod.lozmod3.proxy;

import java.util.Random;

import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityCaveSpider;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntitySilverfish;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntitySnowman;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import dudesmods.lozmod.lozmod3.LOZmod;

public class ModLivingDropsEvent {

          public static double rand;
          public Random r = new Random();

          @SubscribeEvent
          public void onEntityDrop(LivingDropsEvent event) {
        	  if(event.entityLiving instanceof EntityCow) {
        		  event.entityLiving.dropItem(LOZmod.green_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.red_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.blue_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityPig) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySheep) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityHorse) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 10);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityChicken) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySnowman) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 1);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityIronGolem) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 20);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityZombie) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityPigZombie) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySpider) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityCaveSpider) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(50));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityBlaze) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(60));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityCreeper) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(100));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityEnderman) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(120));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityGhast) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(200));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySilverfish) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(200));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySkeleton) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySlime) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityMagmaCube) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityWitch) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityWither) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 500);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityDragon) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 700);
        	  }
          }
                  
}

 

copied it exactly I keep on getting an error at the MinecraftForge.EVENT_BUS.register(new LivingDropsEvent()); Part I now the other person who posted trying to help that I had to use the Handler but you dont have one from the looks of it and it...

If you look at my code its "ModLivingDropsEvent" not "LivingDropsEvent".

Legend of Zelda Mod[updated September 20th to 3.1.1]

Extra Achievements(Minecraft 1.8!)[updated April 3rd to 2.3.0]

Fancy Cheeses[updated May 8th to 0.5.0]

Link to comment
Share on other sites

hey, if you still need help, Here's the code i use. works 100%.

 

In the main class:

@EventHandler
public void PreInitialization(FMLPreInitializationEvent event) {
//blah blah blah	
	/*Vanilla Mob Drops*/
	MinecraftForge.EVENT_BUS.register(new ModLivingDropsEvent());
//blah blah blah
}

My "ModLivingDropsEvent" class

package dudesmods.lozmod.lozmod3.proxy;

import java.util.Random;

import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityCaveSpider;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntitySilverfish;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntitySnowman;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import dudesmods.lozmod.lozmod3.LOZmod;

public class ModLivingDropsEvent {

          public static double rand;
          public Random r = new Random();

          @SubscribeEvent
          public void onEntityDrop(LivingDropsEvent event) {
        	  if(event.entityLiving instanceof EntityCow) {
        		  event.entityLiving.dropItem(LOZmod.green_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.red_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.blue_tanned_leather, r.nextInt(1));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityPig) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySheep) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityHorse) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 10);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityChicken) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 5);
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySnowman) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 1);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityIronGolem) {
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 20);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityZombie) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityPigZombie) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySpider) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityCaveSpider) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(50));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityBlaze) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(60));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityCreeper) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(100));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityEnderman) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(120));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityGhast) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(200));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySilverfish) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(200));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySkeleton) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntitySlime) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityMagmaCube) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityWitch) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40));
        	  }
        	  
        	  if(event.entityLiving instanceof EntityWither) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 500);
        	  }
        	  
        	  if(event.entityLiving instanceof EntityDragon) {
        		  event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5));
        		  event.entityLiving.dropItem(LOZmod.rupee_green, 700);
        	  }
          }
                  
}

 

copied it exactly I keep on getting an error at the MinecraftForge.EVENT_BUS.register(new LivingDropsEvent()); Part I now the other person who posted trying to help that I had to use the Handler but you dont have one from the looks of it and it...

If you look at my code its "ModLivingDropsEvent" not "LivingDropsEvent".

 

OMGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG FINALLY!

 

HOLY CRAP

 

THANK YOU EVERYONE! I'M JUST RETARDED SORRY

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • " BLACK MAGIC INSTANT DEATH SPELL CASTER IN UGANDA, NETHERLANDS, SPAIN, KENYA, RWANDA POWERFUL WITCHCRAFT REVENGE SPELLS CASTER IN GHANA, BENIN. STRONG LOVE SPELLS CASTER IN MAURITIUS, MALTA. VOODOO DOLL SPELLS IN USA, UK,spell casters spell to make someone sick and die without delay. Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece , Voodoo revenge spell casters spell to make someone sick and die without delay. Drmama Bonne +256751735278
    • SPELL CASTER, DEATH SPELL, SPELL CASTER REVIEW, WITCHCRAFT, PSYCHIC, MAGIC FORUM,spell casters spell to make someone sick and die without delay. Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece , Voodoo revenge spell casters spell to make someone sick and die without delay. Drmama Bonne +256751735278
    • BLACK MAGIC INSTANT DEATH SPELL CASTER AND POWERFUL+256751735278 BLACK MAGIC INSTANT DEATH SPELL CASTER AND POWERFUL REVENGE SPELLS THAT WORK FAST IN AUSTRALIA, CANADA, UK GERMANY FRANCE DENMARK. +256751735278 Drmama Bonnei , black magic Revenge spells that work overnight or by accident i? Cast these strongest black magic revenge death spells that work fast overnight to kill ex lover, husband, wife girlfriend Enemies overnight without delay. It doesn’t matter whether he or she is in a far location, I guarantee you to have your results you are looking for immediately. Just make sure before you contact me you are committed and you want what you are looking for (Victim Death) because my Revenge spell work fast overnight after casting the spells. Immediately working black magic death spells that work fast will be cast on the person and result is 48hours,24 Hours . How To Cast A Revenge Spell On Someone, Call/ Whats App  Drmama Bonne Revenge Spells That Work Overnight to kill wicked Step-dad/ Step mom Death Revenge Spell on wicked friends, Voodoo Revenge Spells to kill Enemies Black Magic Spells To Harm Someone, Black magic Revenge spells on ex lover Revenge instant Revenge spells on uncle , powerful instant Revenge spells caster, online instant spell that work fast in USA, UK, Kuwait, Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece , Voodoo revenge spell casters spell to make someone sick and die without delay. Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece , Voodoo revenge spell casters spell to make someone sick and die without delay. Drmama Bonne +256751735278
    • Voodoo Spells Caster /SANGOMA / Death & Revenge Spells  +256751735278 Drmama Bonnei , black magic Revenge spells that work overnight or by accident i? Cast these strongest black magic revenge death spells that work fast overnight to kill ex lover, husband, wife girlfriend Enemies overnight without delay. It doesn’t matter whether he or she is in a far location, I guarantee you to have your results you are looking for immediately. Just make sure before you contact me you are committed and you want what you are looking for (Victim Death) because my Revenge spell work fast overnight after casting the spells. Immediately working black magic death spells that work fast will be cast on the person and result is 48hours,24 Hours . How To Cast A Revenge Spell On Someone, Call/ Whats App  Drmama Bonne Revenge Spells That Work Overnight to kill wicked Step-dad/ Step mom Death Revenge Spell on wicked friends, Voodoo Revenge Spells to kill Enemies Black Magic Spells To Harm Someone, Black magic Revenge spells on ex lover Revenge instant Revenge spells on uncle , powerful instant Revenge spells caster, online instant spell that work fast in USA, UK, Kuwait, Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece , Voodoo revenge spell casters spell to make someone sick and die without delay. Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece , Voodoo revenge spell casters spell to make someone sick and die without delay. Drmama Bonne +256751735278
  • Topics

×
×
  • Create New...

Important Information

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