调整雷达扫描逻辑

This commit is contained in:
17146 2024-12-31 14:47:16 +08:00
parent b689332202
commit a24c966b57

View file

@ -21,6 +21,8 @@ public class FuMO25ScreenHelper {
public static BlockPos pos = null; public static BlockPos pos = null;
public static List<Entity> entities = null; public static List<Entity> entities = null;
public static final int TOLERANCE_DISTANCE = 16;
@SubscribeEvent @SubscribeEvent
public static void onClientTick(TickEvent.ClientTickEvent event) { public static void onClientTick(TickEvent.ClientTickEvent event) {
if (event.side != LogicalSide.CLIENT) return; if (event.side != LogicalSide.CLIENT) return;
@ -31,6 +33,10 @@ public class FuMO25ScreenHelper {
if (!(menu instanceof FuMO25Menu fuMO25Menu)) return; if (!(menu instanceof FuMO25Menu fuMO25Menu)) return;
if (pos == null) return; if (pos == null) return;
if (pos.distToCenterSqr(player.getOnPos().getX(), player.getOnPos().getY(), player.getOnPos().getZ()) > TOLERANCE_DISTANCE * TOLERANCE_DISTANCE) {
pos = player.getOnPos();
}
if (fuMO25Menu.getEnergy() <= 0) { if (fuMO25Menu.getEnergy() <= 0) {
resetEntities(); resetEntities();
return; return;