Class EatBlockGoal
java.lang.Object
net.minestom.server.entity.ai.GoalSelector
net.minestom.server.entity.ai.goal.EatBlockGoal
public class EatBlockGoal extends GoalSelector
-
Field Summary
-
Constructor Summary
Constructors Constructor Description EatBlockGoal(EntityCreature entityCreature, java.util.Map<java.lang.Short,java.lang.Short> eatInMap, java.util.Map<java.lang.Short,java.lang.Short> eatBelowMap, int chancePerTick)
-
Method Summary
Modifier and Type Method Description void
end()
Ends thisGoalSelector
.boolean
shouldEnd()
Whether or not thisGoalSelector
should end.boolean
shouldStart()
Whether or not thisGoalSelector
should start.void
start()
Starts thisGoalSelector
.void
tick(long time)
Called every tick when thisGoalSelector
is running
-
Constructor Details
-
EatBlockGoal
public EatBlockGoal(@NotNull EntityCreature entityCreature, @NotNull java.util.Map<java.lang.Short,java.lang.Short> eatInMap, @NotNull java.util.Map<java.lang.Short,java.lang.Short> eatBelowMap, int chancePerTick)- Parameters:
entityCreature
- Creature that should eat a block.eatInMap
- Map containing the block IDs that the entity can eat (when inside the block) and the block ID of the replacement block.eatBelowMap
- Map containing block IDs that the entity can eat (when above the block) and the block ID of the replacement block.chancePerTick
- The chance (per tick) that the entity eats. Settings this to N would mean there is a 1 in N chance.
-
-
Method Details
-
shouldStart
public boolean shouldStart()Description copied from class:GoalSelector
Whether or not thisGoalSelector
should start.- Specified by:
shouldStart
in classGoalSelector
- Returns:
- true to start
-
start
public void start()Description copied from class:GoalSelector
Starts thisGoalSelector
.- Specified by:
start
in classGoalSelector
-
tick
public void tick(long time)Description copied from class:GoalSelector
Called every tick when thisGoalSelector
is running- Specified by:
tick
in classGoalSelector
- Parameters:
time
- the time of the update in milliseconds
-
shouldEnd
public boolean shouldEnd()Description copied from class:GoalSelector
Whether or not thisGoalSelector
should end.- Specified by:
shouldEnd
in classGoalSelector
- Returns:
- true to end
-
end
public void end()Description copied from class:GoalSelector
Ends thisGoalSelector
.- Specified by:
end
in classGoalSelector
-