Skip to content

Commit

Permalink
no digging in peaceful
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Oct 19, 2023
1 parent d633c14 commit 7f09c4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/net/frozenblock/wilderwild/entity/Crab.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
import net.minecraft.world.Difficulty;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
Expand Down Expand Up @@ -423,6 +424,11 @@ protected void doPush(Entity entity) {
super.doPush(entity);
}

@Override
public boolean isPushedByFluid() {
return false;
}

@Override
public boolean ignoreExplosion() {
return this.isDiggingOrEmerging();
Expand All @@ -440,6 +446,7 @@ public boolean isInvisibleWhileUnderground() {
public boolean canTargetEntity(@Nullable Entity entity) {
return entity instanceof LivingEntity livingEntity
&& this.level() == livingEntity.level()
&& !this.level().getDifficulty().equals(Difficulty.PEACEFUL)
&& EntitySelector.NO_CREATIVE_OR_SPECTATOR.test(livingEntity)
&& !this.isAlliedTo(livingEntity)
&& livingEntity.getType() != EntityType.ARMOR_STAND
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ private static void onTargetInvalid(@NotNull Crab crab, @NotNull LivingEntity ta
if (crab.getTarget() == target) {
crab.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
}
crab.endNavigation();
}

@NotNull
Expand Down

0 comments on commit 7f09c4e

Please sign in to comment.