March 23, 201312 yr 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); } }
March 23, 201312 yr Author 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.
March 24, 201312 yr 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.^^
March 24, 201312 yr 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 Use examples, i have aspergers. Examples make sense to me.
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.