修复部分bug
更新Readme
This commit is contained in:
@@ -17,7 +17,9 @@ The maid will search for a specified structure or the player's respawn point bas
|
|||||||
|
|
||||||
## Revive
|
## 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
|
# More
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ For English version, visit [English Version](Readme.md)
|
|||||||
|
|
||||||
## Revive
|
## Revive
|
||||||
|
|
||||||
女仆会救援附近倒地的玩家。如果女仆饰品中有不死图腾,则女仆会使用一个。
|
需要`玩家救援`模组
|
||||||
|
|
||||||
|
女仆会救援附近倒地的玩家。如果女仆饰品中有不死图腾,则女仆会使用一个。(女仆会消耗一个图腾来跳过你的复活倒计时,而不是像原版一样直接消耗图腾来不死)
|
||||||
|
|
||||||
# More
|
# More
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=MIT
|
mod_license=MIT
|
||||||
# The mod version. See https://semver.org/
|
# 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.
|
# 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.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|||||||
@@ -180,15 +180,16 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD
|
|||||||
|
|
||||||
|
|
||||||
protected boolean isValidNatureTree(EntityMaid maid, BlockPos startPos) {
|
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);
|
BlockValidationMemory validationMemory = MemoryUtil.getBlockValidationMemory(maid);
|
||||||
if (validationMemory.hasRecord(startPos))
|
if (validationMemory.hasRecord(startPos))
|
||||||
return validationMemory.isValid(startPos, false);
|
return validationMemory.isValid(startPos, false);
|
||||||
if (visited.contains(startPos))
|
if (visited.contains(startPos))
|
||||||
return false;
|
return false;
|
||||||
|
if (depth > 100) return false;
|
||||||
visited.add(startPos);
|
visited.add(startPos);
|
||||||
boolean valid = false;
|
boolean valid = false;
|
||||||
final int[] dv = {0, 1, -1};
|
final int[] dv = {0, 1, -1};
|
||||||
@@ -197,10 +198,10 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD
|
|||||||
for (int dy : dv) {
|
for (int dy : dv) {
|
||||||
BlockPos offset = startPos.offset(dx, dy, dz);
|
BlockPos offset = startPos.offset(dx, dy, dz);
|
||||||
BlockState blockState = maid.level().getBlockState(offset);
|
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;
|
valid = true;
|
||||||
}
|
}
|
||||||
if (blockState.is(BlockTags.LOGS) && isValidNatureTree(maid, offset, visited)) {
|
if (blockState.is(BlockTags.LOGS) && isValidNatureTree(maid, offset, visited, depth + 1)) {
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -271,4 +272,18 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD
|
|||||||
}
|
}
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user