Answers for "forge event.getDrop"

0

forge event.getDrop

@SubscribeEvent
public void entityDrops(LivingDropsEvent ev)
{
    if (!ConfigManager.SERVER.dropStringFromSheep.get())
        return;

    Entity entity = ev.getEntity();
    if (!(entity instanceof SheepEntity))
        return;

    Collection<ItemEntity> drops = ev.getDrops();
    if (drops instanceof ImmutableList)
    {
        SurvivalistMod.LOGGER.warn("WARNING: Some mod is returning an ImmutableList, replacing drops will NOT be possible.");
        return;
    }

    if (rnd.nextFloat() < 0.25f)
        drops.add(new ItemEntity(entity.getEntityWorld(), entity.getPosX(), entity.getPosY(), entity.getPosZ(), new ItemStack(Items.STRING)));
}
Posted by: Guest on October-10-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language