mirror of
https://github.com/Minestom/Minestom.git
synced 2025-04-16 09:05:53 +02:00
Optimize EatBlockGoal with fastutil
This commit is contained in:
parent
2cd5a362a4
commit
96d581a49f
@ -1,5 +1,6 @@
|
|||||||
package net.minestom.server.entity.ai.goal;
|
package net.minestom.server.entity.ai.goal;
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.shorts.Short2ShortArrayMap;
|
||||||
import net.minestom.server.entity.EntityCreature;
|
import net.minestom.server.entity.EntityCreature;
|
||||||
import net.minestom.server.entity.ai.GoalSelector;
|
import net.minestom.server.entity.ai.GoalSelector;
|
||||||
import net.minestom.server.instance.Instance;
|
import net.minestom.server.instance.Instance;
|
||||||
@ -11,8 +12,8 @@ import java.util.Random;
|
|||||||
|
|
||||||
public class EatBlockGoal extends GoalSelector {
|
public class EatBlockGoal extends GoalSelector {
|
||||||
private static final Random RANDOM = new Random();
|
private static final Random RANDOM = new Random();
|
||||||
private final Map<Short, Short> eatBelowMap;
|
private final Short2ShortArrayMap eatBelowMap;
|
||||||
private final Map<Short, Short> eatInMap;
|
private final Short2ShortArrayMap eatInMap;
|
||||||
private final int chancePerTick;
|
private final int chancePerTick;
|
||||||
private int eatAnimationTick;
|
private int eatAnimationTick;
|
||||||
|
|
||||||
@ -24,8 +25,8 @@ public class EatBlockGoal extends GoalSelector {
|
|||||||
*/
|
*/
|
||||||
public EatBlockGoal(
|
public EatBlockGoal(
|
||||||
@NotNull EntityCreature entityCreature,
|
@NotNull EntityCreature entityCreature,
|
||||||
@NotNull Map<Short, Short> eatInMap,
|
@NotNull Short2ShortArrayMap eatInMap,
|
||||||
@NotNull Map<Short, Short> eatBelowMap,
|
@NotNull Short2ShortArrayMap eatBelowMap,
|
||||||
int chancePerTick) {
|
int chancePerTick) {
|
||||||
super(entityCreature);
|
super(entityCreature);
|
||||||
this.eatInMap = eatInMap;
|
this.eatInMap = eatInMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user