LivingDropsEvent

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.neoforge.api.event.entity.living.LivingDropsEvent;

Extends

LivingDropsEvent extends LivingEvent.

Implements

LivingDropsEvent implements the following interfaces:

ICancellableEvent

Listening to the event

This event can be listened to like so:

script.zs
events.register<crafttweaker.neoforge.api.event.entity.living.LivingDropsEvent>(event => {
println("LivingDropsEvent ran!");
});

Members

addDrop(stack as IItemStack)
Adds an item to the drops.
script.zs
// LivingDropsEvent.addDrop(stack as IItemStack);
event.addDrop(myIItemStack);

Parameters:

stack Type: IItemStack
cancel()
Cancels the event. Same as setCanceled(true)
script.zs
// LivingDropsEvent.cancel();
event.cancel();
Getter
script.zs
// LivingDropsEvent.canceled as bool
event.canceled

Return Type: bool

Setter
script.zs
// LivingDropsEvent.canceled = (cancel as bool);
event.canceled = myBool;

Parameters:

cancel Type: bool
canceled() as bool
script.zs
// LivingDropsEvent.canceled() as bool;
event.canceled();

Return Type: bool

canceled(cancel as bool)
script.zs
// LivingDropsEvent.canceled(cancel as bool);
event.canceled(myBool);

Parameters:

cancel Type: bool
Getter
Returns the list of items will be dropped. The list is read-only, modifying this list does not change the drops.


You should use the drops setter, addDrop or removeDrop method to change the drops.

script.zs
// LivingDropsEvent.drops as List<IItemStack>
event.drops

Return Type: List<IItemStack>

Setter
Sets which items will be dropped.
script.zs
// LivingDropsEvent.drops = (drops as List<IItemStack>);
event.drops = myList;

Parameters:

drops Type: List<IItemStack>
Getter
script.zs
// LivingDropsEvent.entity as LivingEntity
event.entity

Return Type: LivingEntity

Getter
script.zs
// LivingDropsEvent.entity as Entity
event.entity

Return Type: Entity

Getter
Whether the Entity doing the drop has recently been damaged.
script.zs
// LivingDropsEvent.isRecentlyHit as bool
event.isRecentlyHit

Return Type: bool

removeDrop(ingredient as IIngredient)
Removes items that match the given ingredient from drops.
script.zs
// LivingDropsEvent.removeDrop(ingredient as IIngredient);
event.removeDrop(myIIngredient);

Parameters:

ingredient Type: IIngredient
Getter
script.zs
// LivingDropsEvent.source as DamageSource
event.source

Return Type: DamageSource