Jump to content

Recommended Posts

Posted

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.

}
}

 

Posted

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?

Posted

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);
                }
            }
        }
    }

Posted

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.

Posted

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).

Posted

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 :(

Posted

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.

Posted

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

Posted

You register your event handling class, not an actual Event class:

 

public class MyEventHandler {

@SubscribeEvent
public void onDrop(LivingDropsEvent event) {
// code
}
}

// registration:
MinecraftForge.EVENT_BUS.register(new MyEventHandler());

 

Please see here for more information about events and how to use them.

Posted

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]

Posted

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...

Posted

For the last time bro.

You need to register your event class not the frickin' event itself.

 

You don't know what a handler is - let's just say the class that has the event.

 

Read my last post please.

Posted

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]

Posted

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

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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