From 4d774a875f4080295ac410b2afdb5c1881ce9af9 Mon Sep 17 00:00:00 2001 From: xypp <2952795729@qq.com> Date: Fri, 16 May 2025 15:09:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86bug=20?= =?UTF-8?q?=E6=9B=B4=E6=96=B0Readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme.md | 4 +++- Readme_zh.md | 4 +++- gradle.properties | 2 +- .../maid_useful_task/task/MaidTreeTask.java | 23 +++++++++++++++---- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Readme.md b/Readme.md index 1181a42..5628ec9 100644 --- a/Readme.md +++ b/Readme.md @@ -17,7 +17,9 @@ The maid will search for a specified structure or the player's respawn point bas ## Revive -The Maid will revive nearby fallen players. If there is an undead totem in the Maid's bauble, the Maid will use one. +Requires "Player Revive" mod. + +The Maid will revive nearby fallen players. If there is an undead totem in the Maid's bauble, the Maid will use one (The maid consumes a totem to skip your revive countdown, instead of just consuming the totem to not die like that in vanilla). # More diff --git a/Readme_zh.md b/Readme_zh.md index 911108d..9ccbdaa 100644 --- a/Readme_zh.md +++ b/Readme_zh.md @@ -16,7 +16,9 @@ For English version, visit [English Version](Readme.md) ## Revive -女仆会救援附近倒地的玩家。如果女仆饰品中有不死图腾,则女仆会使用一个。 +需要`玩家救援`模组 + +女仆会救援附近倒地的玩家。如果女仆饰品中有不死图腾,则女仆会使用一个。(女仆会消耗一个图腾来跳过你的复活倒计时,而不是像原版一样直接消耗图腾来不死) # More diff --git a/gradle.properties b/gradle.properties index d697db5..ea7bd37 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,7 +38,7 @@ mod_name=maid useful task # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=MIT # The mod version. See https://semver.org/ -mod_version=1.3.2 +mod_version=1.3.3 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/studio/fantasyit/maid_useful_task/task/MaidTreeTask.java b/src/main/java/studio/fantasyit/maid_useful_task/task/MaidTreeTask.java index d5fbe30..7a3fb1c 100644 --- a/src/main/java/studio/fantasyit/maid_useful_task/task/MaidTreeTask.java +++ b/src/main/java/studio/fantasyit/maid_useful_task/task/MaidTreeTask.java @@ -180,15 +180,16 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD protected boolean isValidNatureTree(EntityMaid maid, BlockPos startPos) { - return isValidNatureTree(maid, startPos, new HashSet<>()); + return isValidNatureTree(maid, startPos, new HashSet<>(), 0); } - protected boolean isValidNatureTree(EntityMaid maid, BlockPos startPos, Set visited) { + protected boolean isValidNatureTree(EntityMaid maid, BlockPos startPos, Set visited, int depth) { BlockValidationMemory validationMemory = MemoryUtil.getBlockValidationMemory(maid); if (validationMemory.hasRecord(startPos)) return validationMemory.isValid(startPos, false); if (visited.contains(startPos)) return false; + if (depth > 100) return false; visited.add(startPos); boolean valid = false; final int[] dv = {0, 1, -1}; @@ -197,10 +198,10 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD for (int dy : dv) { BlockPos offset = startPos.offset(dx, dy, dz); BlockState blockState = maid.level().getBlockState(offset); - if (blockState.is(BlockTags.LEAVES) && !blockState.getValue(LeavesBlock.PERSISTENT)) { + if (blockState.is(BlockTags.LEAVES) && blockState.hasProperty(LeavesBlock.PERSISTENT) && !blockState.getValue(LeavesBlock.PERSISTENT)) { valid = true; } - if (blockState.is(BlockTags.LOGS) && isValidNatureTree(maid, offset, visited)) { + if (blockState.is(BlockTags.LOGS) && isValidNatureTree(maid, offset, visited, depth + 1)) { valid = true; } } @@ -271,4 +272,18 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD } return false; } + + /** + * 此处判断当home模式未开启时,不允许上搭。 + * @param maid + * @param center + * @param maxUp + * @return + */ + @Override + public oshi.util.tuples.Pair findTargetPosBlockUp(EntityMaid maid, BlockPos center, int maxUp) { + if (maid.isHomeModeEnable()) + return IMaidBlockUpTask.super.findTargetPosBlockUp(maid, center, maxUp); + return null; + } }