修复部分bug

更新Readme
This commit is contained in:
xypp
2025-05-16 15:09:11 +08:00
parent b6af4b2c18
commit 4d774a875f
4 changed files with 26 additions and 7 deletions

View File

@@ -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

View File

@@ -16,7 +16,9 @@ For English version, visit [English Version](Readme.md)
## Revive
女仆会救援附近倒地的玩家。如果女仆饰品中有不死图腾,则女仆会使用一个。
需要`玩家救援`模组
女仆会救援附近倒地的玩家。如果女仆饰品中有不死图腾,则女仆会使用一个。(女仆会消耗一个图腾来跳过你的复活倒计时,而不是像原版一样直接消耗图腾来不死)
# More

View File

@@ -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

View File

@@ -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<BlockPos> visited) {
protected boolean isValidNatureTree(EntityMaid maid, BlockPos startPos, Set<BlockPos> 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<BlockPos, BlockPos> findTargetPosBlockUp(EntityMaid maid, BlockPos center, int maxUp) {
if (maid.isHomeModeEnable())
return IMaidBlockUpTask.super.findTargetPosBlockUp(maid, center, maxUp);
return null;
}
}