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

Hi, im making a mod, as probably most people here... For that i want to add a mob drop to monsters. For now lets say its just a gem.

 

I will not show the class because i have yet to make, but lets say its a totally useless item for now, only exisiting and texture.

 

The problem im having is that i want it to be dropped by monsters that die. If possibile a small chance. But i heared its a bad idea to edit base classes. So how can i do this?

use the LivingDropsEvent ;)

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

  • Author

use the LivingDropsEvent ;)

 

And now more detail please? I found the class, and have been trying things for more than half a hour. How do i add that method? And exactly where?

  • Author

 

Ive did everything there, but i dont understand how to make sure there is also a chance my gem gets dropped by a dead mob, along with their usual stuff. Can i just, and if so where, do something like "drop = Item.diamond"? (diamond just to test first) My event class:

 

package nomar.extramod;

import java.util.ArrayList;

import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.util.DamageSource;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;


public class AddEvents
{

@ForgeSubscribe
public void mobDrops(LivingDropsEvent event)
{

EntityLiving aaEntity = event.entityLiving;
DamageSource aaDamage = event.source;
ArrayList<EntityItem> aaDrops = event.drops; 


if (event.isCancelable())
{
event.setCanceled(true);
}
}
}

 

In my @init:

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

  • 5 months later...

what doesn't work? the event is working alright. if you want example here it is: https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/item/CustomDrop.java#L73, highlighted line is the adding new item to be dropped from currently killed entity.

 

When did you make your mod? O.o it has stuff my mod has. O.o

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.