40 lines
2.3 KiB
Diff
40 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|||
|
|
From: NanaChiyo0721 <nanachiyo0721@163.com>
|
||
|
|
Date: Sat, 25 Jul 2026 21:33:58 +0800
|
||
|
|
Subject: [PATCH] Lithium Optimize remove block goal
|
||
|
|
|
||
|
|
|
||
|
|
diff --git a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||
|
|
index ff0f99d4b560a1c0721885b0eba5bd5ab2087bd7..90beeee7b74324f81690776546713b4f04887f75 100644
|
||
|
|
--- a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||
|
|
+++ b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||
|
|
@@ -25,6 +25,19 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
|
||
|
|
private final Mob removerMob;
|
||
|
|
private int ticksSinceReachedGoal;
|
||
|
|
private static final int WAIT_AFTER_BLOCK_FOUND = 20;
|
||
|
|
+ // Shiroha start - Lithium Optimize remove block goal
|
||
|
|
+ private static final java.util.function.BiPredicate<ChunkAccess, BlockPos.MutableBlockPos> IS_VALID_TARGET_ABOVE_BIPREDICATE =
|
||
|
|
+ RemoveBlockGoal::lithium$isValidTargetAbove;
|
||
|
|
+ //Split check condition in order to use maybeHas
|
||
|
|
+ private boolean lithium$isValidTargetBlock(net.minecraft.world.level.block.state.BlockState blockState){
|
||
|
|
+ return blockState.is(this.blockToRemove);
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
+ private static boolean lithium$isValidTargetAbove(ChunkAccess chunkAccess, BlockPos.MutableBlockPos mutable) {
|
||
|
|
+ return chunkAccess.getBlockState(mutable.move(0, 1, 0)).isAir()
|
||
|
|
+ && chunkAccess.getBlockState(mutable.move(0, 1, 0)).isAir();
|
||
|
|
+ }
|
||
|
|
+ // Shiroha end - Lithium Optimize remove block goal
|
||
|
|
|
||
|
|
public RemoveBlockGoal(final Block blockToRemove, final PathfinderMob mob, final double speedModifier, final int verticalSearchRange) {
|
||
|
|
super(mob, speedModifier, 24, verticalSearchRange);
|
||
|
|
@@ -39,7 +52,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
|
||
|
|
} else if (this.nextStartTick > 0) {
|
||
|
|
this.nextStartTick--;
|
||
|
|
return false;
|
||
|
|
- } else if (this.findNearestBlock()) {
|
||
|
|
+ } else if (((net.caffeinemc.mods.lithium.common.ai.non_poi_block_search.LithiumMoveToBlockGoal) this).lithium$findNearestBlock(this::lithium$isValidTargetBlock, IS_VALID_TARGET_ABOVE_BIPREDICATE, false)) { // Shiroha - Lithium Optimize remove block goal
|
||
|
|
this.nextStartTick = reducedTickDelay(20);
|
||
|
|
return true;
|
||
|
|
} else {
|