Compare commits
6 Commits
alpha-1.3.
...
feat_suppo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3d6464dc7 | ||
|
|
3e5879471e | ||
|
|
4d774a875f | ||
|
|
b6af4b2c18 | ||
|
|
d0cf1a2a29 | ||
|
|
d6028ab375 |
@@ -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.0
|
mod_version=1.3.3_a_1
|
||||||
# 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
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ public class Config {
|
|||||||
private static final ForgeConfigSpec.BooleanValue ENABLE_REVIVE_TOTEM = BUILDER
|
private static final ForgeConfigSpec.BooleanValue ENABLE_REVIVE_TOTEM = BUILDER
|
||||||
.define("revive.totem", true);
|
.define("revive.totem", true);
|
||||||
|
|
||||||
|
private static final ForgeConfigSpec.BooleanValue ENABLE_VEHICLE_CONTROL_FULL = BUILDER
|
||||||
|
.define("vehicle_control.full", true);
|
||||||
|
private static final ForgeConfigSpec.BooleanValue ENABLE_VEHICLE_CONTROL_ROTATE = BUILDER
|
||||||
|
.define("vehicle_control.rotate", true);
|
||||||
|
|
||||||
static final ForgeConfigSpec SPEC = BUILDER.build();
|
static final ForgeConfigSpec SPEC = BUILDER.build();
|
||||||
|
|
||||||
@@ -35,6 +39,8 @@ public class Config {
|
|||||||
public static boolean enableReviveAggro = false;
|
public static boolean enableReviveAggro = false;
|
||||||
public static boolean enableReviveTotem = false;
|
public static boolean enableReviveTotem = false;
|
||||||
|
|
||||||
|
public static boolean enableVehicleControlFull = false;
|
||||||
|
public static boolean enableVehicleControlRotate = false;
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
static void onLoad(final ModConfigEvent event) {
|
static void onLoad(final ModConfigEvent event) {
|
||||||
enableLoggingTask = ENABLE_LOGGING.get();
|
enableLoggingTask = ENABLE_LOGGING.get();
|
||||||
@@ -42,5 +48,7 @@ public class Config {
|
|||||||
enableLocateTask = ENABLE_LOCATE.get();
|
enableLocateTask = ENABLE_LOCATE.get();
|
||||||
enableReviveAggro = ENABLE_REVIVE_AGGRO.get();
|
enableReviveAggro = ENABLE_REVIVE_AGGRO.get();
|
||||||
enableReviveTotem = ENABLE_REVIVE_TOTEM.get();
|
enableReviveTotem = ENABLE_REVIVE_TOTEM.get();
|
||||||
|
enableVehicleControlFull = ENABLE_VEHICLE_CONTROL_FULL.get();
|
||||||
|
enableVehicleControlRotate = ENABLE_VEHICLE_CONTROL_ROTATE.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,6 +176,8 @@ public class PlayerReviveBehavior extends Behavior<EntityMaid> {
|
|||||||
@Override
|
@Override
|
||||||
protected void stop(ServerLevel p_22548_, EntityMaid maid, long p_22550_) {
|
protected void stop(ServerLevel p_22548_, EntityMaid maid, long p_22550_) {
|
||||||
PlayerReviveServer.removePlayerAsHelper(WrappedMaidFakePlayer.get(maid));
|
PlayerReviveServer.removePlayerAsHelper(WrappedMaidFakePlayer.get(maid));
|
||||||
|
if (!bleeding.isBleeding())
|
||||||
|
targetPlayer.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 200));
|
||||||
for (UUID uuid : aggroEntities) {
|
for (UUID uuid : aggroEntities) {
|
||||||
Entity entity = p_22548_.getEntity(uuid);
|
Entity entity = p_22548_.getEntity(uuid);
|
||||||
if (entity instanceof Monster monster && entity.isAlive())
|
if (entity instanceof Monster monster && entity.isAlive())
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.behavior;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import net.minecraft.advancements.CriteriaTriggers;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.stats.Stats;
|
||||||
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
|
import net.minecraft.world.effect.MobEffects;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.Mob;
|
||||||
|
import net.minecraft.world.entity.TamableAnimal;
|
||||||
|
import net.minecraft.world.entity.ai.behavior.Behavior;
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorUtils;
|
||||||
|
import net.minecraft.world.entity.ai.goal.target.TargetGoal;
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||||
|
import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities;
|
||||||
|
import net.minecraft.world.entity.monster.Monster;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.level.entity.EntityTypeTest;
|
||||||
|
import net.minecraft.world.phys.AABB;
|
||||||
|
import studio.fantasyit.maid_useful_task.Config;
|
||||||
|
import studio.fantasyit.maid_useful_task.data.MaidReviveConfig;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.InvUtil;
|
||||||
|
import studio.fantasyit.maid_useful_task.util.WrappedMaidFakePlayer;
|
||||||
|
import team.creative.playerrevive.PlayerRevive;
|
||||||
|
import team.creative.playerrevive.api.IBleeding;
|
||||||
|
import team.creative.playerrevive.server.PlayerReviveServer;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class SupportEffectBehavior extends Behavior<EntityMaid> {
|
||||||
|
public SupportEffectBehavior() {
|
||||||
|
super(Map.of(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryStatus.VALUE_PRESENT));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean checkExtraStartConditions(ServerLevel p_22538_, EntityMaid maid) {
|
||||||
|
if (maid.getExperience() <= 0) return false;
|
||||||
|
LivingEntity player = maid.getOwner();
|
||||||
|
if (player == null) return false;
|
||||||
|
Optional<NearestVisibleLivingEntities> memory = maid.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES);
|
||||||
|
return memory.map(list -> list
|
||||||
|
.find(entity -> entity instanceof Monster)
|
||||||
|
.map(monster -> (Monster) monster)
|
||||||
|
.map(Mob::getTarget)
|
||||||
|
.anyMatch(target -> {
|
||||||
|
if (target == null)
|
||||||
|
return false;
|
||||||
|
if (target.equals(player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (target instanceof TamableAnimal tamed) {
|
||||||
|
if (tamed.getOwner() != null && tamed.getOwner().equals(player))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
).orElse(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void start(ServerLevel level, EntityMaid maid, long p_22542_) {
|
||||||
|
super.start(level, maid, p_22542_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canStillUse(ServerLevel p_22545_, EntityMaid maid, long p_22547_) {
|
||||||
|
return this.checkExtraStartConditions(p_22545_, maid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tick(ServerLevel level, EntityMaid maid, long p_22553_) {
|
||||||
|
super.tick(level, maid, p_22553_);
|
||||||
|
if (p_22553_ % 20 == 0) {
|
||||||
|
//1 experience per second.
|
||||||
|
maid.setExperience(maid.getExperience() - 1);
|
||||||
|
reApplyEffects(level, maid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void reApplyEffects(ServerLevel level, EntityMaid maid) {
|
||||||
|
LivingEntity player = maid.getOwner();
|
||||||
|
if (player == null) return;
|
||||||
|
List<Entity> entities = level.getEntities(maid, AABB.ofSize(maid.position(), 16, 16, 16));
|
||||||
|
for (Entity entity : entities) {
|
||||||
|
if (entity instanceof Monster monster && entity.isAlive()) {
|
||||||
|
monster.addEffect(new MobEffectInstance(MobEffects.WEAKNESS, 30, 0, false, false));
|
||||||
|
} else if (entity instanceof TamableAnimal animal && animal.isAlive()) {
|
||||||
|
if (animal.getOwner() != null && animal.getOwner().equals(player)) {
|
||||||
|
animal.addEffect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 30, 0, false, false));
|
||||||
|
animal.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, 30, 1, false, false));
|
||||||
|
}
|
||||||
|
} else if (entity.is(player)) {
|
||||||
|
player.addEffect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 30, 0, false, false));
|
||||||
|
player.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, 30, 1, false, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void stop(ServerLevel p_22548_, EntityMaid maid, long p_22550_) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean timedOut(long p_22537_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@ public class MaidReviveConfigGui extends MaidTaskConfigGui<MaidReviveConfigGui.C
|
|||||||
|
|
||||||
public static class Container extends TaskConfigContainer {
|
public static class Container extends TaskConfigContainer {
|
||||||
public Container(int id, Inventory inventory, int entityId) {
|
public Container(int id, Inventory inventory, int entityId) {
|
||||||
super(GuiRegistry.MAID_LOGGING_CONFIG_GUI.get(), id, inventory, entityId);
|
super(GuiRegistry.MAID_REVIVE_CONFIG_GUI.get(), id, inventory, entityId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ abstract public class VehicleBroomMixin extends AbstractEntityFromItem implement
|
|||||||
this.maid_useful_tasks$vc_type = MaidVehicleControlType.NONE;
|
this.maid_useful_tasks$vc_type = MaidVehicleControlType.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "tickRidden", at = @At(value = "INVOKE", target = "Lcom/github/tartaricacid/touhoulittlemaid/entity/item/AbstractEntityFromItem;tickRidden(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/phys/Vec3;)V"))
|
@Inject(method = "tickRidden", at = @At(value = "TAIL"))
|
||||||
public void maid_useful_tasks$tickRidden(CallbackInfo ci) {
|
public void maid_useful_tasks$tickRidden(CallbackInfo ci) {
|
||||||
if (maid_useful_tasks$vc_type == MaidVehicleControlType.NONE) {
|
if (maid_useful_tasks$vc_type == MaidVehicleControlType.NONE) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.minecraft.server.level.ServerPlayer;
|
|||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import studio.fantasyit.maid_useful_task.Config;
|
||||||
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||||
import studio.fantasyit.maid_useful_task.vehicle.MaidVehicleControlType;
|
import studio.fantasyit.maid_useful_task.vehicle.MaidVehicleControlType;
|
||||||
|
|
||||||
@@ -34,6 +35,10 @@ public class MaidAllowHandleVehicle {
|
|||||||
if (entity instanceof EntityMaid maid) {
|
if (entity instanceof EntityMaid maid) {
|
||||||
MaidVehicleControlType[] values = MaidVehicleControlType.values();
|
MaidVehicleControlType[] values = MaidVehicleControlType.values();
|
||||||
MaidVehicleControlType allowMode = values[(MemoryUtil.getAllowHandleVehicle(maid).ordinal() + 1) % values.length];
|
MaidVehicleControlType allowMode = values[(MemoryUtil.getAllowHandleVehicle(maid).ordinal() + 1) % values.length];
|
||||||
|
while ((allowMode == MaidVehicleControlType.FULL && !Config.enableVehicleControlFull)
|
||||||
|
|| (allowMode == MaidVehicleControlType.ROT_ONLY && !Config.enableVehicleControlRotate)) {
|
||||||
|
allowMode = values[(allowMode.ordinal() + 1) % values.length];
|
||||||
|
}
|
||||||
MemoryUtil.setAllowHandleVehicle(maid, allowMode);
|
MemoryUtil.setAllowHandleVehicle(maid, allowMode);
|
||||||
Component component = switch (allowMode) {
|
Component component = switch (allowMode) {
|
||||||
case NONE -> Component.translatable("maid_useful_task.allow_handle_vehicle.none");
|
case NONE -> Component.translatable("maid_useful_task.allow_handle_vehicle.none");
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.github.tartaricacid.touhoulittlemaid.api.task.IMaidTask;
|
|||||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
@@ -12,6 +14,9 @@ import net.minecraft.world.entity.LivingEntity;
|
|||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.item.MapItem;
|
||||||
|
import net.minecraft.world.level.saveddata.maps.MapDecoration;
|
||||||
|
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import studio.fantasyit.maid_useful_task.Config;
|
import studio.fantasyit.maid_useful_task.Config;
|
||||||
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||||
@@ -53,10 +58,12 @@ public class MaidLocateTask implements IMaidTask, IMaidFindTargetTask {
|
|||||||
public boolean enableLookAndRandomWalk(EntityMaid maid) {
|
public boolean enableLookAndRandomWalk(EntityMaid maid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnable(EntityMaid maid) {
|
public boolean isEnable(EntityMaid maid) {
|
||||||
return Config.enableLocateTask;
|
return Config.enableLocateTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable BlockPos findTarget(ServerLevel level, EntityMaid maid) {
|
public @Nullable BlockPos findTarget(ServerLevel level, EntityMaid maid) {
|
||||||
BlockPos target = null;
|
BlockPos target = null;
|
||||||
@@ -83,6 +90,35 @@ public class MaidLocateTask implements IMaidTask, IMaidFindTargetTask {
|
|||||||
target = owner.getSleepingPos().orElse(maid.level().getSharedSpawnPos());
|
target = owner.getSleepingPos().orElse(maid.level().getSharedSpawnPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (maid.getMainHandItem().is(Items.FILLED_MAP)) {
|
||||||
|
target = MemoryUtil.getCommonBlockCache(maid);
|
||||||
|
if (target == null) {
|
||||||
|
MapItemSavedData savedData = MapItem.getSavedData(itemStack, maid.level());
|
||||||
|
if (savedData != null) {
|
||||||
|
BlockPos.MutableBlockPos tmpTarget = new BlockPos.MutableBlockPos(savedData.centerX, level.getSeaLevel(), savedData.centerZ);
|
||||||
|
|
||||||
|
CompoundTag tag = itemStack.getOrCreateTag();
|
||||||
|
savedData.getBanners()
|
||||||
|
.stream()
|
||||||
|
.findFirst()
|
||||||
|
.ifPresent(t -> {
|
||||||
|
tmpTarget.set(t.getPos().immutable());
|
||||||
|
});
|
||||||
|
tag.getList("Decorations", Tag.TAG_COMPOUND)
|
||||||
|
.stream()
|
||||||
|
.filter(t -> ((CompoundTag) t).getByte("type") == 26)
|
||||||
|
.findFirst()
|
||||||
|
.ifPresent(t -> {
|
||||||
|
CompoundTag decoration = (CompoundTag) t;
|
||||||
|
tmpTarget.setX(decoration.getInt("x"));
|
||||||
|
tmpTarget.setZ(decoration.getInt("z"));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
target = tmpTarget.immutable();
|
||||||
|
MemoryUtil.setCommonBlockCache(maid, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MemoryUtil.clearCommonBlockCache(maid);
|
MemoryUtil.clearCommonBlockCache(maid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package studio.fantasyit.maid_useful_task.task;
|
||||||
|
|
||||||
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
|
||||||
|
public class MaidMineTask implements IMaidBlockDestroyTask {
|
||||||
|
@Override
|
||||||
|
public boolean shouldDestroyBlock(EntityMaid maid, BlockPos pos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mayDestroy(EntityMaid maid, BlockPos pos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import studio.fantasyit.maid_useful_task.Config;
|
import studio.fantasyit.maid_useful_task.Config;
|
||||||
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||||
import studio.fantasyit.maid_useful_task.behavior.PlayerReviveBehavior;
|
import studio.fantasyit.maid_useful_task.behavior.PlayerReviveBehavior;
|
||||||
|
import studio.fantasyit.maid_useful_task.behavior.SupportEffectBehavior;
|
||||||
import studio.fantasyit.maid_useful_task.compat.PlayerRevive;
|
import studio.fantasyit.maid_useful_task.compat.PlayerRevive;
|
||||||
import studio.fantasyit.maid_useful_task.menu.MaidLoggingConfigGui;
|
import studio.fantasyit.maid_useful_task.menu.MaidLoggingConfigGui;
|
||||||
import studio.fantasyit.maid_useful_task.menu.MaidReviveConfigGui;
|
import studio.fantasyit.maid_useful_task.menu.MaidReviveConfigGui;
|
||||||
@@ -45,7 +46,7 @@ public class MaidRevivePlayerTask implements IMaidTask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnable(EntityMaid maid) {
|
public boolean isEnable(EntityMaid maid) {
|
||||||
return PlayerRevive.isEnable() && Config.enableReviveAggro;
|
return PlayerRevive.isEnable() && Config.enableReviveTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -62,6 +63,7 @@ public class MaidRevivePlayerTask implements IMaidTask {
|
|||||||
public List<Pair<Integer, BehaviorControl<? super EntityMaid>>> createBrainTasks(EntityMaid entityMaid) {
|
public List<Pair<Integer, BehaviorControl<? super EntityMaid>>> createBrainTasks(EntityMaid entityMaid) {
|
||||||
ArrayList<Pair<Integer, BehaviorControl<? super EntityMaid>>> ret = new ArrayList<>();
|
ArrayList<Pair<Integer, BehaviorControl<? super EntityMaid>>> ret = new ArrayList<>();
|
||||||
ret.add(Pair.of(1, new PlayerReviveBehavior()));
|
ret.add(Pair.of(1, new PlayerReviveBehavior()));
|
||||||
|
ret.add(Pair.of(1, new SupportEffectBehavior()));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,4 +70,11 @@ description='''${mod_description}'''
|
|||||||
versionRange="[1.2.2,)"
|
versionRange="[1.2.2,)"
|
||||||
ordering="AFTER"
|
ordering="AFTER"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
[[dependencies."${mod_id}"]]
|
||||||
|
modId="playerrevive"
|
||||||
|
mandatory=false
|
||||||
|
versionRange="[2.0.16,)"
|
||||||
|
ordering="AFTER"
|
||||||
|
side="BOTH"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"task.maid_useful_task.maid_tree": "Logging",
|
"task.maid_useful_task.maid_tree": "Logging",
|
||||||
"task.maid_useful_task.maid_tree.description": "The maid will cut down the logs around her and plant saplings.",
|
"task.maid_useful_task.maid_tree.desc": "The maid will cut down the logs around her and plant saplings.",
|
||||||
"task.maid_useful_task.locate": "Locate",
|
"task.maid_useful_task.locate": "Locate",
|
||||||
"task.maid_useful_task.locate.description": "The maid can locate the some structure or your home with specific items.",
|
"task.maid_useful_task.locate.desc": "The maid can locate the some structure or your home with specific items.",
|
||||||
"task.maid_useful_task.revive_player": "Revive Player",
|
"task.maid_useful_task.revive_player": "Revive Player",
|
||||||
"task.maid_useful_task.revive_player.description": "The maid will revive nearby bleeding player.",
|
"task.maid_useful_task.revive_player.desc": "The maid will revive nearby bleeding player.",
|
||||||
"key.maid_useful_tasks.switch_vehicle_control": "Switch Vehicle Control Mode",
|
"key.maid_useful_tasks.switch_vehicle_control": "Switch Vehicle Control Mode",
|
||||||
"maid_useful_task.allow_handle_vehicle.none": "Not allowing maid control vehicle",
|
"maid_useful_task.allow_handle_vehicle.none": "Not allowing maid control vehicle",
|
||||||
"maid_useful_task.allow_handle_vehicle.rot_only": "Allow maid control rotation only",
|
"maid_useful_task.allow_handle_vehicle.rot_only": "Allow maid control rotation only",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"gui.maid_useful_task.logging.plant": "种植树苗",
|
"gui.maid_useful_task.logging.plant": "种植树苗",
|
||||||
"gui.maid_useful_task.no": "否",
|
"gui.maid_useful_task.no": "否",
|
||||||
"gui.maid_useful_task.revive.ownerOnly": "Only revive owner",
|
"gui.maid_useful_task.revive.ownerOnly": "只救援主人",
|
||||||
"gui.maid_useful_task.yes": "是",
|
"gui.maid_useful_task.yes": "是",
|
||||||
"key.maid_useful_tasks.categories.main": "女仆实用任务",
|
"key.maid_useful_tasks.categories.main": "女仆实用任务",
|
||||||
"key.maid_useful_tasks.switch_vehicle_control": "切换载具控制模式",
|
"key.maid_useful_tasks.switch_vehicle_control": "切换载具控制模式",
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
"maid_useful_task.allow_handle_vehicle.none": "不允许女仆控制载具",
|
"maid_useful_task.allow_handle_vehicle.none": "不允许女仆控制载具",
|
||||||
"maid_useful_task.allow_handle_vehicle.rot_only": "只允许女仆控制旋转",
|
"maid_useful_task.allow_handle_vehicle.rot_only": "只允许女仆控制旋转",
|
||||||
"task.maid_useful_task.locate": "定位",
|
"task.maid_useful_task.locate": "定位",
|
||||||
"task.maid_useful_task.locate.description": "女仆会根据手持物品定位指定的结构或你的出生点",
|
"task.maid_useful_task.locate.desc": "女仆会根据手持物品定位指定的结构或你的出生点",
|
||||||
"task.maid_useful_task.maid_tree": "伐木",
|
"task.maid_useful_task.maid_tree": "伐木",
|
||||||
"task.maid_useful_task.maid_tree.description": "女仆会砍伐身边的原木并种下树苗",
|
"task.maid_useful_task.maid_tree.desc": "女仆会砍伐身边的原木并种下树苗",
|
||||||
"task.maid_useful_task.revive_player": "救援玩家",
|
"task.maid_useful_task.revive_player": "救援玩家",
|
||||||
"task.maid_useful_task.revive_player.description": "女仆会救援附近倒地的玩家"
|
"task.maid_useful_task.revive_player.desc": "女仆会救援附近倒地的玩家"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user