Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I want to Loot in existing Mobs(Zombies, Creeper etc.) but i don't know how it works :(

I have try it:

package mib.item;

import mib.MIB;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.item.Item;
import net.minecraft.world.World;

public class EntityBloodDropLoot extends EntityZombie{

public EntityBloodDropLoot(World par1World) {
	super(par1World);

}
    protected int getDropItemId()
    {
        return MIB.bloodDrop.itemID;
    }

    }

It didn't work :(

Can you help me?

 

This is not the best way to do this but! (Sorry im new to forge)

 

  @ForgeSubscribe

        public void Drops(LivingDropsEvent event)

        {

        if(event.entityLiving instanceof EntityZombie)

        {

          event.entityLiving.dropItem(Item.bone.itemId 1);

        }

        }

 

Note: will drop Every time just add Random to fix this

 

EE3 Uses:

 

  @ForgeSubscribe

    public void onEntityLivingDeath(LivingDeathEvent event) {

 

        if (event.source.getDamageType().equals("player")) {

            ItemHelper.dropMiniumShard((EntityPlayer) event.source.getSourceOfDamage(), event.entityLiving);

        }

        if (event.source.getSourceOfDamage() instanceof EntityArrow) {

            if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity != null) {

                if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity instanceof EntityPlayer) {

                    ItemHelper.dropMiniumShard((EntityPlayer) ((EntityArrow) event.source.getSourceOfDamage()).shootingEntity, event.entityLiving);

                }

- Wurmatron

Use the LivingDropsEvent and remember to register it

 

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

Kain

Make A new class. It should look something like this:

package dudesmods.lozmod2.entity;

import java.util.Random;

import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraft.entity.EntityLiving;

public class ModLivingDropsEvent {

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

          @ForgeSubscribe
          public void onEntityDrop(LivingDropsEvent event) {
        	  if(event.entityLiving instanceof EntityCow) {
        		  event.entityLiving.dropItem(LOZmod.green_tanned_leather.itemID, r.nextInt(3));
        	  }
          }
                  
}

change "EntityCow" to the desired Entity.

"r.nextInt(3)" indicates that it drops anywhere from 1-3 of the item

"LOZmod.green_tanned_leather.itemID" is the item

 

In your main class in the PreInt method:

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

"ModLivingDropsEvent" being the class you made.

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]

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.