mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-26 19:18:12 +01:00
Add eating check for instances.
This commit is contained in:
parent
85a84dbea6
commit
2cd5a362a4
@ -39,7 +39,14 @@ public class EatBlockGoal extends GoalSelector {
|
|||||||
if (RANDOM.nextInt(chancePerTick) != 0) {
|
if (RANDOM.nextInt(chancePerTick) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Instance instance = entityCreature.getInstance();
|
final Instance instance = entityCreature.getInstance();
|
||||||
|
|
||||||
|
// An entity shouldn't be eating blocks on null instances.
|
||||||
|
if (instance == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final BlockPosition blockPosition = entityCreature.getPosition().toBlockPosition();
|
final BlockPosition blockPosition = entityCreature.getPosition().toBlockPosition();
|
||||||
final short blockStateIdIn = instance.getBlockStateId(blockPosition.clone().subtract(0, 1, 0));
|
final short blockStateIdIn = instance.getBlockStateId(blockPosition.clone().subtract(0, 1, 0));
|
||||||
final short blockStateIdBelow = instance.getBlockStateId(blockPosition.clone().subtract(0, 2, 0));
|
final short blockStateIdBelow = instance.getBlockStateId(blockPosition.clone().subtract(0, 2, 0));
|
||||||
|
Loading…
Reference in New Issue
Block a user