IEntityDefinition
This sounds scary, so what does it mean? Basically, it is a reference to an entity registered in the game, so it is a reference to, say a mob in the game.
Importing the package
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.
import crafttweaker.entity.IEntityDefinition;
Calling an IEntityDefinition Object
Functions
So, this is where it gets interesting: What can we do with it, now that we created that thing?
id
Returns the ID as string
name
Returns the name as string
create entity
The first method only creates an entity on the given location.
The second one also spawns it.
Both methods return the created IEntity.
world
is an IWorld object.
blockPos
is an IBlockPos object.
Drops
We can even add and/or remove mob drops, isn’t that great?
Add normal Drop
This adds a normal drop, a drop that can occur whenever the mob is killed by whatever means.
item
is the item to be added as drop and an IItemStack or a WeightedItemStack.
min
is the minimum amount that is dropped and an Integer. This is optional.
max
is the maximum amount that is dropped and an Integer. This is optional.
chance
is the drop chance. This is optional. Not needed if you use a weightedItemStack instead as item
Add playeronly drop
Same as normal drops, but only if the entity was killed by a player.
Add drop Function
A drop function is called whenever the associated Entity is killed. You can use this if you need to check requirements for before you drop something, like only dropping in a certain biome and stuff.
You will need an IEntityDropFunction:
Remove
This removes a drop.
item
is the item to be removed from being a drop and an IItemStack.
Clear Drops
This removes all drops.
Get
This returns all drops that were added via CT as list of IEntityDrop Objects.