Skip to content

Commit

Permalink
Update CrabDig.java
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Oct 16, 2023
1 parent 96aa179 commit 9577f31
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ protected void start(ServerLevel level, @NotNull E crab, long gameTime) {

@Override
protected void stop(ServerLevel level, @NotNull E crab, long gameTime) {
crab.getBrain().setMemory(RegisterMemoryModuleTypes.IS_UNDERGROUND, true);
crab.getBrain().setMemoryWithExpiry(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE, CrabAi.getRandomEmergeCooldown(crab));
if (crab.hasPose(Pose.DIGGING)) {
crab.getBrain().setMemory(RegisterMemoryModuleTypes.IS_UNDERGROUND, true);
crab.getBrain().setMemoryWithExpiry(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE, CrabAi.getRandomEmergeCooldown(crab));
} else {
crab.getBrain().eraseMemory(RegisterMemoryModuleTypes.IS_UNDERGROUND);
crab.getBrain().setMemoryWithExpiry(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE, 40L);
}
}
}

0 comments on commit 9577f31

Please sign in to comment.