Jump to content

Recommended Posts

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?

Posted

 

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

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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