coldblade2000 Posted March 23, 2013 Share Posted March 23, 2013 I'm in 1.5 and I want to make my mod compatible with the mods folder. Quote Link to comment Share on other sites More sharing options...
Curtis_McCann Posted March 23, 2013 Share Posted March 23, 2013 try extending a class and loading it in your main class i.e. import net.minecraft.entity.passive.EntityPig; import net.minecraft.item.Item; import net.minecraft.world.World; public class New_drop extends EntityPig { public New_drop(World par1World) { super(par1World); this.dropItem(Item.appleRed.itemID, 6); } } Quote Link to comment Share on other sites More sharing options...
coldblade2000 Posted March 23, 2013 Author Share Posted March 23, 2013 Thanks Quote Link to comment Share on other sites More sharing options...
jordan30001 Posted March 23, 2013 Share Posted March 23, 2013 http://www.minecraftforge.net/wiki/Event_Reference#LivingDeathEvent Quote Link to comment Share on other sites More sharing options...
coldblade2000 Posted March 23, 2013 Author Share Posted March 23, 2013 It's not working either, I tried this: package tutorial.coldblademod; import net.minecraft.entity.passive.EntityPig; import net.minecraft.item.Item; import net.minecraft.world.World; import tutorial.coldblademod.ColdbladeMod; public class EntityDropCBMod extends EntityPig { public EntityDropCBMod(World par1World) { super(par1World); } protected void LivingDeathEvent(){ this.dropItem(ColdbladeMod.baconRawID, 2); } } But it doesn't drop anything. I've tried the LivingDeathEvent, LivingDropEvent and about other 5. Quote Link to comment Share on other sites More sharing options...
Beonadryt Posted March 24, 2013 Share Posted March 24, 2013 Create a new class: import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.item.Item; import net.minecraftforge.event.*; public class yourclass{ @ForgeSubscribe public void playerKilledSheep(LivingDeathEvent event) { if(event.entityLiving instanceof EntitySheep) { event.entityLiving.dropItem( yourmod.youritem.itemId Amount); } } } Then write in your main class in the public void load: MinecraftForge.EVENT_BUS.register(new yourclass()); I hope i could help you.^^ Quote Link to comment Share on other sites More sharing options...
ashtonr12 Posted March 24, 2013 Share Posted March 24, 2013 here is an example i know works because i use it for your main class before you init, @PreInit public void registerMyEvents(FMLPreInitializationEvent e){ MinecraftForge.EVENT_BUS.register(new BatDrops());{ } } the seperate class package ashtonsmod.common; import net.minecraft.block.Block; import net.minecraft.block.BlockBreakable; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityBat; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntitySquid; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; public class BatDrops { public static double rand; @ForgeSubscribe public void onEntityDrop(LivingDropsEvent event) { if (event.source.getDamageType().equals("player")) { rand = Math.random(); if (event.entityLiving instanceof EntityBat) { //The integer at the end relates to how many Items will be dropped(percentage). if (rand < 0.75d){ //The integer at the end relates to how many Items will be dropped(amount). event.entityLiving.dropItem(Item.potatoe.itemID, 1); } }}} this makes a bat on death have a 75% chance of dropping one potatoe Quote Use examples, i have aspergers. Examples make sense to me. Link to comment Share on other sites More sharing options...
Recommended Posts
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.