Compare commits
14 Commits
alpha-1.2.
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dbeacf777 | ||
|
|
fa72af9bc3 | ||
|
|
01ec9c0b63 | ||
|
|
6a639a4483 | ||
|
|
b2db97e8f6 | ||
|
|
ea3a57d70d | ||
|
|
ee3cb071d7 | ||
|
|
2b6f231efc | ||
|
|
135f495849 | ||
|
|
4d774a875f | ||
|
|
b6af4b2c18 | ||
|
|
d0cf1a2a29 | ||
|
|
d6028ab375 | ||
|
|
ecddd67a18 |
@@ -4,8 +4,6 @@
|
||||
|
||||
An extension mod of TLM(Touhou Little Maid). Add some useful tasks to your Maid.
|
||||
|
||||
> Currently, it's logging only.
|
||||
|
||||
# Features
|
||||
|
||||
## Logging
|
||||
@@ -17,6 +15,12 @@ up the maid's ability to cut down trees and destroy leaves!
|
||||
|
||||
The maid will search for a specified structure or the player's respawn point based on the item in her hand. If the maid is on the same vehicle as the player (currently only brooms are supported), the player can press a designated button (V by default) to give the maid control or partial control of the carrier.
|
||||
|
||||
## Revive
|
||||
|
||||
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
|
||||
|
||||
+ The Mod is currently in early development. Everything may change in the future.
|
||||
|
||||
@@ -4,8 +4,6 @@ For English version, visit [English Version](Readme.md)
|
||||
|
||||
一个车万女仆的拓展模组,添加了一些实用的女仆任务。
|
||||
|
||||
> 然而,目前只有砍树
|
||||
|
||||
# Features
|
||||
|
||||
## Logging
|
||||
@@ -16,6 +14,12 @@ For English version, visit [English Version](Readme.md)
|
||||
|
||||
女仆会根据手上的物品寻找指定的结构或者玩家出生点。如果女仆和玩家在同一载具上(目前只支持扫帚),玩家可以按下指定按键(默认为V)来让女仆控制或部分控制载具。
|
||||
|
||||
## Revive
|
||||
|
||||
需要`玩家救援`模组
|
||||
|
||||
女仆会救援附近倒地的玩家。如果女仆饰品中有不死图腾,则女仆会使用一个。(女仆会消耗一个图腾来跳过你的复活倒计时,而不是像原版一样直接消耗图腾来不死)
|
||||
|
||||
# More
|
||||
|
||||
+ 模组处于早期开发阶段,一切功能在未来都有可能变化。
|
||||
|
||||
37
build.gradle
37
build.gradle
@@ -21,7 +21,7 @@ group = mod_group_id
|
||||
version = mod_version
|
||||
|
||||
base {
|
||||
archivesName = mod_id
|
||||
archivesName = minecraft_version + "-" + mod_id
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -65,7 +65,7 @@ minecraft {
|
||||
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
|
||||
// This default location is a best practice to automatically put the file in the right place in the final jar.
|
||||
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
@@ -133,9 +133,9 @@ repositories {
|
||||
|
||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
|
||||
// flatDir {
|
||||
// dir 'libs'
|
||||
// }
|
||||
flatDir {
|
||||
dir 'libs'
|
||||
}
|
||||
maven {
|
||||
url "https://cursemaven.com"
|
||||
}
|
||||
@@ -165,9 +165,19 @@ dependencies {
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
|
||||
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
||||
compileOnly fg.deobf("curse.maven:touhou-little-maid-355044:6440955")
|
||||
runtimeOnly fg.deobf("curse.maven:touhou-little-maid-355044:6440955")
|
||||
runtimeOnly fg.deobf("curse.maven:maid-storage-manager-1210244:6455832")
|
||||
compileOnly fg.deobf("curse.maven:touhou-little-maid-355044:6911704")
|
||||
runtimeOnly fg.deobf("curse.maven:touhou-little-maid-355044:6911704")
|
||||
// compileOnly fg.deobf("libs:touhoulittlemaid-${minecraft_version}-release:1.3.7")
|
||||
// runtimeOnly fg.deobf("libs:touhoulittlemaid-${minecraft_version}-release:1.3.7")
|
||||
compileOnly fg.deobf("curse.maven:playerrevive-266890:6048921")
|
||||
compileOnly fg.deobf("curse.maven:creativecore-257814:6383884")
|
||||
compileOnly fg.deobf("curse.maven:natures-compass-252848:4712189")
|
||||
compileOnly fg.deobf("curse.maven:explorers-compass-491794:4712194")
|
||||
runtimeOnly fg.deobf("curse.maven:playerrevive-266890:6048921")
|
||||
runtimeOnly fg.deobf("curse.maven:creativecore-257814:6383884")
|
||||
// runtimeOnly fg.deobf("curse.maven:natures-compass-252848:4712189")
|
||||
// runtimeOnly fg.deobf("curse.maven:explorers-compass-491794:4712194")
|
||||
|
||||
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.1"))
|
||||
implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.4.1")) {
|
||||
jarJar.ranged(it, "[0.4.1,)")
|
||||
@@ -180,18 +190,19 @@ dependencies {
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
tasks.named('processResources', ProcessResources).configure {
|
||||
var replaceProperties = [
|
||||
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
forge_version: forge_version, forge_version_range: forge_version_range,
|
||||
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
forge_version : forge_version, forge_version_range: forge_version_range,
|
||||
loader_version_range: loader_version_range,
|
||||
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||
mod_authors: mod_authors, mod_description: mod_description,
|
||||
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||
mod_authors : mod_authors, mod_description: mod_description,
|
||||
]
|
||||
|
||||
inputs.properties replaceProperties
|
||||
|
||||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||
expand replaceProperties + [project: project]
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
// Example for how to get properties into the manifest for reading at runtime.
|
||||
tasks.named('jar', Jar).configure {
|
||||
|
||||
@@ -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.2.0
|
||||
mod_version=1.3.7
|
||||
# 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
|
||||
|
||||
65
src/main/java/studio/fantasyit/maid_useful_task/Config.java
Normal file
65
src/main/java/studio/fantasyit/maid_useful_task/Config.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package studio.fantasyit.maid_useful_task;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
|
||||
// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
|
||||
// Demonstrates how to use Forge's config APIs
|
||||
@Mod.EventBusSubscriber(modid = MaidUsefulTask.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class Config {
|
||||
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
|
||||
|
||||
private static final ForgeConfigSpec.BooleanValue SELF_RESCUE = BUILDER
|
||||
.define("misc.self_rescue", true);
|
||||
|
||||
private static final ForgeConfigSpec.BooleanValue ENABLE_LOGGING = BUILDER
|
||||
.define("functions.logging", true);
|
||||
private static final ForgeConfigSpec.BooleanValue ENABLE_REVIVE = BUILDER
|
||||
.define("functions.revive", true);
|
||||
private static final ForgeConfigSpec.BooleanValue ENABLE_LOCATE = BUILDER
|
||||
.define("functions.locate", true);
|
||||
|
||||
private static final ForgeConfigSpec.BooleanValue ENABLE_REVIVE_AGGRO = BUILDER
|
||||
.define("revive.aggro", false);
|
||||
private static final ForgeConfigSpec.BooleanValue ENABLE_REVIVE_TOTEM = BUILDER
|
||||
.define("revive.totem", true);
|
||||
|
||||
private static final ForgeConfigSpec.BooleanValue LOGGING_DISABLE_BLOCKUP = BUILDER
|
||||
.define("logging.disable_blockup", false);
|
||||
|
||||
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();
|
||||
|
||||
public static boolean enableSelfRescue = false;
|
||||
|
||||
public static boolean enableLoggingTask = false;
|
||||
public static boolean enableReviveTask = false;
|
||||
public static boolean enableLocateTask = false;
|
||||
|
||||
public static boolean enableReviveAggro = false;
|
||||
public static boolean enableReviveTotem = false;
|
||||
|
||||
public static boolean enableVehicleControlFull = false;
|
||||
public static boolean enableVehicleControlRotate = false;
|
||||
|
||||
public static boolean disableLoggingBlockUp = false;
|
||||
|
||||
@SubscribeEvent
|
||||
static void onLoad(final ModConfigEvent event) {
|
||||
enableSelfRescue = SELF_RESCUE.get();
|
||||
enableLoggingTask = ENABLE_LOGGING.get();
|
||||
enableReviveTask = ENABLE_REVIVE.get();
|
||||
enableLocateTask = ENABLE_LOCATE.get();
|
||||
enableReviveAggro = ENABLE_REVIVE_AGGRO.get();
|
||||
enableReviveTotem = ENABLE_REVIVE_TOTEM.get();
|
||||
enableVehicleControlFull = ENABLE_VEHICLE_CONTROL_FULL.get();
|
||||
enableVehicleControlRotate = ENABLE_VEHICLE_CONTROL_ROTATE.get();
|
||||
disableLoggingBlockUp = LOGGING_DISABLE_BLOCKUP.get();
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ public class MaidUsefulTask {
|
||||
@SuppressWarnings("removal")
|
||||
public MaidUsefulTask() {
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC);
|
||||
MemoryModuleRegistry.register(modEventBus);
|
||||
GuiRegistry.init(modEventBus);
|
||||
MaidVehicleManager.register();
|
||||
|
||||
@@ -5,13 +5,18 @@ import com.github.tartaricacid.touhoulittlemaid.api.LittleMaidExtension;
|
||||
import com.github.tartaricacid.touhoulittlemaid.api.entity.ai.IExtraMaidBrain;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.ai.brain.ExtraMaidBrainManager;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.data.TaskDataRegister;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.item.control.BroomControlManager;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.task.TaskManager;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import studio.fantasyit.maid_useful_task.compat.PlayerRevive;
|
||||
import studio.fantasyit.maid_useful_task.data.MaidConfigKeys;
|
||||
import studio.fantasyit.maid_useful_task.data.MaidLoggingConfig;
|
||||
import studio.fantasyit.maid_useful_task.data.MaidReviveConfig;
|
||||
import studio.fantasyit.maid_useful_task.registry.MemoryModuleRegistry;
|
||||
import studio.fantasyit.maid_useful_task.task.MaidLocateTask;
|
||||
import studio.fantasyit.maid_useful_task.task.MaidRevivePlayerTask;
|
||||
import studio.fantasyit.maid_useful_task.task.MaidTreeTask;
|
||||
import studio.fantasyit.maid_useful_task.vehicle.broom.BroomController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,8 +25,13 @@ public class UsefulTaskExtension implements ILittleMaid {
|
||||
@Override
|
||||
public void addMaidTask(TaskManager manager) {
|
||||
ILittleMaid.super.addMaidTask(manager);
|
||||
manager.add(new MaidTreeTask());
|
||||
manager.add(new MaidLocateTask());
|
||||
if (Config.enableLoggingTask)
|
||||
manager.add(new MaidTreeTask());
|
||||
if (Config.enableLocateTask)
|
||||
manager.add(new MaidLocateTask());
|
||||
if (Config.enableReviveTask)
|
||||
if (PlayerRevive.isEnable())
|
||||
manager.add(new MaidRevivePlayerTask());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,5 +58,13 @@ public class UsefulTaskExtension implements ILittleMaid {
|
||||
MaidConfigKeys.addKey(MaidLoggingConfig.LOCATION,
|
||||
MaidLoggingConfig.KEY = register.register(new MaidLoggingConfig()),
|
||||
MaidLoggingConfig.Data::getDefault);
|
||||
MaidConfigKeys.addKey(MaidReviveConfig.LOCATION,
|
||||
MaidReviveConfig.KEY = register.register(new MaidReviveConfig()),
|
||||
MaidReviveConfig.Data::getDefault);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBroomControl(BroomControlManager register) {
|
||||
register.register(BroomController::new);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package studio.fantasyit.maid_useful_task.api;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
@Cancelable
|
||||
public class ItemLocateEvent extends Event {
|
||||
public final ItemStack itemStack;
|
||||
public final EntityMaid maid;
|
||||
public final BlockPos cache;
|
||||
public BlockPos target = null;
|
||||
|
||||
public ItemLocateEvent(ItemStack itemStack, EntityMaid maid, BlockPos cache) {
|
||||
this.itemStack = itemStack;
|
||||
this.maid = maid;
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
public BlockPos getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(BlockPos target) {
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package studio.fantasyit.maid_useful_task.behavior;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.ai.brain.sensor.MaidNearestLivingEntitySensor;
|
||||
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.InteractionHand;
|
||||
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.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 PlayerReviveBehavior extends Behavior<EntityMaid> {
|
||||
protected static class TryAttackMaidGoal extends TargetGoal {
|
||||
private final EntityMaid maid;
|
||||
|
||||
public TryAttackMaidGoal(Mob p_26140_, EntityMaid maid) {
|
||||
super(p_26140_, true);
|
||||
this.maid = maid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
return mob.canAttack(maid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
mob.setTarget(maid);
|
||||
super.start();
|
||||
}
|
||||
|
||||
public boolean isMaid(EntityMaid maid) {
|
||||
return maid.getUUID().equals(this.maid.getUUID());
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerReviveBehavior() {
|
||||
super(Map.of(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryStatus.VALUE_PRESENT), 600);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkExtraStartConditions(ServerLevel p_22538_, EntityMaid maid) {
|
||||
Optional<NearestVisibleLivingEntities> memory = maid.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES);
|
||||
return memory.map(list -> list
|
||||
.find(entity -> entity instanceof Player)
|
||||
.map(ep -> PlayerReviveServer.getBleeding((ServerPlayer) ep))
|
||||
.anyMatch(IBleeding::isBleeding)
|
||||
).orElse(false);
|
||||
}
|
||||
|
||||
ServerPlayer targetPlayer;
|
||||
IBleeding bleeding;
|
||||
boolean startedRevive;
|
||||
Set<UUID> aggroEntities;
|
||||
|
||||
@Override
|
||||
protected void start(ServerLevel level, EntityMaid maid, long p_22542_) {
|
||||
super.start(level, maid, p_22542_);
|
||||
aggroEntities = new HashSet<>();
|
||||
startedRevive = false;
|
||||
boolean ownerOnly = maid.getOrCreateData(MaidReviveConfig.KEY, MaidReviveConfig.Data.getDefault()).ownerOnly();
|
||||
LivingEntity owner = maid.getOwner();
|
||||
Optional<NearestVisibleLivingEntities> memory = maid.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES);
|
||||
targetPlayer = memory.flatMap(list -> list
|
||||
.find(entity -> entity instanceof Player)
|
||||
.map(ep -> (ServerPlayer) ep)
|
||||
.filter(sp -> (owner != null && sp.is(owner)) || !ownerOnly)
|
||||
.filter(ep -> PlayerReviveServer.getBleeding(ep).isBleeding())
|
||||
.findFirst()
|
||||
).orElse(null);
|
||||
if (targetPlayer != null) {
|
||||
bleeding = PlayerReviveServer.getBleeding(targetPlayer);
|
||||
BehaviorUtils.setWalkAndLookTargetMemories(maid, targetPlayer, 0.5f, 2);
|
||||
}
|
||||
useTotemOfUndying(level, maid);
|
||||
}
|
||||
|
||||
private void useTotemOfUndying(ServerLevel level, EntityMaid maid) {
|
||||
if (!Config.enableReviveTotem) return;
|
||||
ItemStack itemstack = InvUtil.tryExtractOneMatches(maid.getMaidBauble(), (stack) -> stack.is(Items.TOTEM_OF_UNDYING));
|
||||
if (!itemstack.isEmpty()) {
|
||||
targetPlayer.awardStat(Stats.ITEM_USED.get(Items.TOTEM_OF_UNDYING), 1);
|
||||
CriteriaTriggers.USED_TOTEM.trigger(targetPlayer, itemstack);
|
||||
|
||||
targetPlayer.setHealth(1.0F);
|
||||
targetPlayer.removeAllEffects();
|
||||
targetPlayer.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 900, 1));
|
||||
targetPlayer.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, 100, 1));
|
||||
targetPlayer.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0));
|
||||
level.broadcastEntityEvent(targetPlayer, (byte) 35);
|
||||
|
||||
PlayerReviveServer.revive(targetPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCanReviveAndStartRevive(ServerLevel level, EntityMaid maid) {
|
||||
if (PlayerRevive.CONFIG.revive.needReviveItem) {
|
||||
if (PlayerRevive.CONFIG.revive.consumeReviveItem && !bleeding.isItemConsumed()) {
|
||||
ItemStack extractedForConsume = InvUtil.tryExtractOneMatches(maid.getAvailableInv(true), PlayerRevive.CONFIG.revive.reviveItem::is);
|
||||
if (!PlayerRevive.CONFIG.revive.reviveItem.is(extractedForConsume)) {
|
||||
targetPlayer = null;
|
||||
return;
|
||||
}
|
||||
|
||||
bleeding.setItemConsumed();
|
||||
}
|
||||
}
|
||||
|
||||
PlayerReviveServer.removePlayerAsHelper(WrappedMaidFakePlayer.get(maid));
|
||||
bleeding.revivingPlayers().add(WrappedMaidFakePlayer.get(maid));
|
||||
aggroEntitiesAround(level, maid);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canStillUse(ServerLevel p_22545_, EntityMaid maid, long p_22547_) {
|
||||
if (targetPlayer == null) return false;
|
||||
if (targetPlayer.distanceTo(maid) > PlayerRevive.CONFIG.revive.maxDistance) return false;
|
||||
return bleeding.isBleeding();
|
||||
}
|
||||
|
||||
protected void aggroEntitiesAround(ServerLevel level, EntityMaid maid) {
|
||||
if (!Config.enableReviveAggro) return;
|
||||
List<Monster> entities = level.getEntities(EntityTypeTest.forClass(Monster.class),
|
||||
AABB.ofSize(maid.position(), 16, 16, 16),
|
||||
entity -> true
|
||||
);
|
||||
for (Monster entity : entities) {
|
||||
if (!aggroEntities.contains(entity.getUUID())) {
|
||||
entity.targetSelector.addGoal(10, new TryAttackMaidGoal(entity, maid));
|
||||
aggroEntities.add(entity.getUUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tick(ServerLevel level, EntityMaid maid, long p_22553_) {
|
||||
super.tick(level, maid, p_22553_);
|
||||
if (p_22553_ % 20 == 0)
|
||||
BehaviorUtils.setWalkAndLookTargetMemories(maid, targetPlayer, 0.5f, 2);
|
||||
if (!startedRevive) {
|
||||
if (maid.distanceTo(targetPlayer) < PlayerRevive.CONFIG.revive.maxDistance) {
|
||||
checkCanReviveAndStartRevive(level, maid);
|
||||
startedRevive = true;
|
||||
}
|
||||
} else {
|
||||
if (p_22553_ % 20 == 0)
|
||||
aggroEntitiesAround(level, maid);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void stop(ServerLevel p_22548_, EntityMaid maid, long p_22550_) {
|
||||
PlayerReviveServer.removePlayerAsHelper(WrappedMaidFakePlayer.get(maid));
|
||||
for (UUID uuid : aggroEntities) {
|
||||
Entity entity = p_22548_.getEntity(uuid);
|
||||
if (entity instanceof Monster monster && entity.isAlive())
|
||||
monster.targetSelector.removeAllGoals(g -> g instanceof TryAttackMaidGoal tg && tg.isMaid(maid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.ai.behavior.Behavior;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import studio.fantasyit.maid_useful_task.memory.BlockUpContext;
|
||||
import studio.fantasyit.maid_useful_task.memory.CurrentWork;
|
||||
import studio.fantasyit.maid_useful_task.task.IMaidBlockUpTask;
|
||||
@@ -29,15 +28,15 @@ public class BlockUpDestroyBehavior extends Behavior<EntityMaid> {
|
||||
}
|
||||
|
||||
public BlockUpDestroyBehavior() {
|
||||
super(Map.of(),500);
|
||||
super(Map.of(), 500);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkExtraStartConditions(ServerLevel p_22538_, EntityMaid p_22539_) {
|
||||
if(!Conditions.isCurrent(p_22539_, CurrentWork.BLOCKUP_DOWN)) return false;
|
||||
if (!Conditions.isCurrent(p_22539_, CurrentWork.BLOCKUP_DOWN)) return false;
|
||||
if (!MemoryUtil.getBlockUpContext(p_22539_).hasTarget()) return false;
|
||||
if (MemoryUtil.getBlockUpContext(p_22539_).getStatus() != BlockUpContext.STATUS.DOWN) return false;
|
||||
return Conditions.hasReachedValidTargetOrReset(p_22539_, 0.8f);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,6 +72,7 @@ public class BlockUpDestroyBehavior extends Behavior<EntityMaid> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void stop(ServerLevel p_22548_, EntityMaid maid, long p_22550_) {
|
||||
super.stop(p_22548_, maid, p_22550_);
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.ai.behavior.Behavior;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import studio.fantasyit.maid_useful_task.memory.BlockUpContext;
|
||||
@@ -45,6 +44,7 @@ public class BlockUpPlaceBehavior extends Behavior<EntityMaid> {
|
||||
protected boolean canStillUse(ServerLevel p_22545_, EntityMaid maid, long p_22547_) {
|
||||
if (MemoryUtil.getBlockUpContext(maid).getStatus() != BlockUpContext.STATUS.UP) return false;
|
||||
if (maid.onGround() && !p_22545_.getBlockState(maid.blockPosition().above().above()).isAir()) return false;
|
||||
if (maid.getY() > context.getTargetPos().getY() + 2) return false;
|
||||
return !(maid.blockPosition().equals(context.getTargetPos()) && maid.onGround());
|
||||
}
|
||||
|
||||
@@ -60,9 +60,7 @@ public class BlockUpPlaceBehavior extends Behavior<EntityMaid> {
|
||||
AABB boundingBox = maid.getBoundingBox();
|
||||
BlockPos startPos = context.getStartPos();
|
||||
Vec3 move = maid.getDeltaMovement();
|
||||
if (boundingBox.maxX <= startPos.getX() + 1 && boundingBox.maxZ <= startPos.getZ() + 1
|
||||
&& boundingBox.minX >= startPos.getX() && boundingBox.minZ >= startPos.getZ()
|
||||
) {
|
||||
if (boundingBox.maxX <= startPos.getX() + 1 && boundingBox.maxZ <= startPos.getZ() + 1 && boundingBox.minX >= startPos.getX() && boundingBox.minZ >= startPos.getZ()) {
|
||||
maid.setDeltaMovement(0, move.y, 0);
|
||||
return true;
|
||||
}
|
||||
@@ -80,9 +78,7 @@ public class BlockUpPlaceBehavior extends Behavior<EntityMaid> {
|
||||
task.swapValidItemToHand(maid);
|
||||
BlockPos pos = maid.blockPosition();
|
||||
BlockPos below = pos.below();
|
||||
if (context.isOnLine(pos))
|
||||
if (below.equals(context.getTargetPos()))
|
||||
return;
|
||||
if (context.isOnLine(pos)) if (below.equals(context.getTargetPos())) return;
|
||||
if (level.getBlockState(below).canBeReplaced() && level.getBlockState(pos).canBeReplaced()) {
|
||||
maid.swing(InteractionHand.MAIN_HAND);
|
||||
MaidUtils.placeBlock(maid, below);
|
||||
|
||||
@@ -45,9 +45,11 @@ public class BlockUpScheduleBehavior extends Behavior<EntityMaid> {
|
||||
if (context.getStatus() == BlockUpContext.STATUS.DOWN) {
|
||||
MemoryUtil.setTarget(maid, context.getTargetPos(), 0.5f);
|
||||
MemoryUtil.setCurrent(maid, CurrentWork.BLOCKUP_DOWN);
|
||||
} else {
|
||||
} else if (maid.canPathReach(context.getStartPos())) {
|
||||
MemoryUtil.setTarget(maid, context.getStartPos(), 0.5f);
|
||||
MemoryUtil.setCurrent(maid, CurrentWork.BLOCKUP_UP);
|
||||
} else {
|
||||
context.clearStartTarget();
|
||||
}
|
||||
} else if (!context.isOnLine(maid.blockPosition()) || context.getStartPos().equals(context.getTargetPos())) {
|
||||
context.clearStartTarget();
|
||||
|
||||
@@ -53,7 +53,7 @@ public class DestoryBlockBehavior extends Behavior<EntityMaid> {
|
||||
BlockTargetMemory blockTargetMemory = MemoryUtil.getDestroyTargetMemory(maid);
|
||||
if (blockTargetMemory != null) {
|
||||
blockPosSet = new ArrayList<>(blockTargetMemory.getBlockPosSet());
|
||||
blockPosSet.sort((o1, o2) -> (int) (o1.distSqr(maid.blockPosition()) - o2.distSqr(maid.blockPosition())));
|
||||
blockPosSet.sort((o1, o2) -> (int) (o1.distSqr(maid.blockPosition().above()) - o2.distSqr(maid.blockPosition().above())));
|
||||
}
|
||||
index = 0;
|
||||
task = (IMaidBlockDestroyTask) maid.getTask();
|
||||
@@ -65,6 +65,8 @@ public class DestoryBlockBehavior extends Behavior<EntityMaid> {
|
||||
|
||||
@Override
|
||||
protected boolean canStillUse(ServerLevel p_22545_, EntityMaid p_22546_, long p_22547_) {
|
||||
if (MemoryUtil.getCurrent(p_22546_) != CurrentWork.DESTROY && MemoryUtil.getCurrent(p_22546_) != CurrentWork.BLOCKUP_DESTROY)
|
||||
return false;
|
||||
return (blockPosSet != null && index < blockPosSet.size()) || targetPos != null;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import studio.fantasyit.maid_useful_task.memory.CurrentWork;
|
||||
import studio.fantasyit.maid_useful_task.task.IMaidBlockDestroyTask;
|
||||
import studio.fantasyit.maid_useful_task.util.Conditions;
|
||||
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||
import studio.fantasyit.maid_useful_task.util.PosUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -52,14 +53,19 @@ public class DestoryBlockMoveBehavior extends MaidCenterMoveToBlockTask {
|
||||
protected boolean shouldMoveTo(@NotNull ServerLevel serverLevel, @NotNull EntityMaid entityMaid, @NotNull BlockPos blockPos) {
|
||||
if (!task.shouldDestroyBlock(entityMaid, blockPos.immutable())) return false;
|
||||
targetPos = blockPos.immutable();
|
||||
BlockPos startPos = entityMaid.blockPosition();
|
||||
if (blockPos instanceof BlockPos.MutableBlockPos mb) {
|
||||
for (int dx = 0; dx < task.reachDistance(); dx = dx <= 0 ? 1 - dx : -dx) {
|
||||
for (int dy = 0; dy < task.reachDistance(); dy = dy <= 0 ? 1 - dy : -dy) {
|
||||
for (int dz = 0; dz < task.reachDistance(); dz = dz <= 0 ? 1 - dz : -dz) {
|
||||
BlockPos pos = mb.offset(dx, dy, dz);
|
||||
if (!PosUtils.isSafePos(serverLevel, pos)) continue;
|
||||
if (!Conditions.isGlobalValidTarget(entityMaid, pos, targetPos)) continue;
|
||||
if (pos.distSqr(targetPos) > task.reachDistance() * task.reachDistance()) continue;
|
||||
if (entityMaid.isWithinRestriction(pos) && pathfindingBFS.canPathReach(pos)) {
|
||||
if (Math.abs(startPos.getY() - pos.getY()) >= task.reachDistance()) continue;
|
||||
if (Math.abs(startPos.getX() - pos.getX()) >= task.reachDistance()) continue;
|
||||
if (Math.abs(startPos.getZ() - pos.getZ()) >= task.reachDistance()) continue;
|
||||
if (pos.equals(entityMaid.blockPosition()) || (entityMaid.isWithinRestriction(pos) && pathfindingBFS.canPathReach(pos))) {
|
||||
blockPosSet = task.toDestroyFromStanding(entityMaid, targetPos, pos);
|
||||
if (blockPosSet != null) {
|
||||
mb.set(pos);
|
||||
@@ -78,10 +84,10 @@ public class DestoryBlockMoveBehavior extends MaidCenterMoveToBlockTask {
|
||||
@Override
|
||||
protected @NotNull MaidPathFindingBFS getOrCreateArrivalMap(@NotNull ServerLevel worldIn, @NotNull EntityMaid maid) {
|
||||
if (this.pathfindingBFS == null)
|
||||
if(maid.hasRestriction())
|
||||
this.pathfindingBFS = new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), worldIn, maid, 14, (int) maid.getRestrictRadius());
|
||||
if (maid.hasRestriction())
|
||||
this.pathfindingBFS = new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), worldIn, maid, (int) maid.getRestrictRadius() + 1, task.reachDistance() + 2);
|
||||
else
|
||||
this.pathfindingBFS = new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), worldIn, maid, 14);
|
||||
this.pathfindingBFS = new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), worldIn, maid, task.reachDistance() + 1, task.reachDistance() + 2);
|
||||
return this.pathfindingBFS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package studio.fantasyit.maid_useful_task.behavior.common;
|
||||
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.ai.brain.task.MaidCheckRateTask;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.MaidPathFindingBFS;
|
||||
import com.github.tartaricacid.touhoulittlemaid.init.InitEntities;
|
||||
@@ -41,9 +40,11 @@ abstract public class MaidCenterMoveToBlockTask extends Behavior<EntityMaid> {
|
||||
this.verticalSearchRange = verticalSearchRange;
|
||||
this.searchRange = defaultSearchRange;
|
||||
}
|
||||
|
||||
public void setSearchRange(int searchRange) {
|
||||
this.searchRange = searchRange;
|
||||
}
|
||||
|
||||
protected final void searchForDestination(ServerLevel worldIn, EntityMaid maid) {
|
||||
MaidPathFindingBFS pathFinding = this.getOrCreateArrivalMap(worldIn, maid);
|
||||
BlockPos centrePos = this.getWorkSearchPos(maid);
|
||||
@@ -73,7 +74,7 @@ abstract public class MaidCenterMoveToBlockTask extends Behavior<EntityMaid> {
|
||||
}
|
||||
|
||||
protected MaidPathFindingBFS getOrCreateArrivalMap(ServerLevel worldIn, EntityMaid maid) {
|
||||
return new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), worldIn, maid);
|
||||
return new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), worldIn, maid, maid.searchRadius(), 9);
|
||||
}
|
||||
|
||||
private BlockPos getWorkSearchPos(EntityMaid maid) {
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package studio.fantasyit.maid_useful_task.behavior.common;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.ai.behavior.Behavior;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import studio.fantasyit.maid_useful_task.Config;
|
||||
import studio.fantasyit.maid_useful_task.memory.CurrentWork;
|
||||
import studio.fantasyit.maid_useful_task.task.IMaidBlockDestroyTask;
|
||||
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MaidSelfRescueBehavior extends Behavior<EntityMaid> {
|
||||
public MaidSelfRescueBehavior() {
|
||||
super(Map.of(), 600);
|
||||
}
|
||||
|
||||
boolean started = false;
|
||||
|
||||
private static boolean isNotSafeAndCanTryToDestroy(ServerLevel level, EntityMaid maid, BlockPos pos, IMaidBlockDestroyTask task) {
|
||||
BlockState bs = level.getBlockState(pos);
|
||||
if (bs.isAir()) return false;
|
||||
VoxelShape collision = bs.getCollisionShape(level, pos);
|
||||
if (collision.isEmpty()) return false;
|
||||
return maid.getBoundingBox().intersects(collision.bounds().move(pos)) && bs.isSuffocating(level, pos) && task.mayDestroy(maid, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkExtraStartConditions(ServerLevel level, EntityMaid maid) {
|
||||
if (!Config.enableSelfRescue) return false;
|
||||
if (!(maid.getTask() instanceof IMaidBlockDestroyTask ibdt)) return false;
|
||||
if (isNotSafeAndCanTryToDestroy(level, maid, maid.blockPosition(), ibdt) || isNotSafeAndCanTryToDestroy(level, maid, maid.blockPosition().above(), ibdt))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canStillUse(ServerLevel p_22545_, EntityMaid p_22546_, long p_22547_) {
|
||||
return started && checkExtraStartConditions(p_22545_, p_22546_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void start(ServerLevel p_22540_, EntityMaid maid, long p_22542_) {
|
||||
started = false;
|
||||
if (MemoryUtil.getCurrent(maid) == CurrentWork.DESTROY) {
|
||||
//如果执行中破坏任务,则立刻停止。用以清空相关状态
|
||||
MemoryUtil.setCurrent(maid, CurrentWork.IDLE);
|
||||
return;
|
||||
}
|
||||
//等待上一个任务结束
|
||||
if (MemoryUtil.getDestroyTargetMemory(maid) != null)
|
||||
return;
|
||||
if (!(maid.getTask() instanceof IMaidBlockDestroyTask task))
|
||||
return;
|
||||
|
||||
started = true;
|
||||
|
||||
List<BlockPos> list = new ArrayList<>();
|
||||
if (isNotSafeAndCanTryToDestroy(p_22540_, maid, maid.blockPosition(), task)) {
|
||||
list.add(maid.blockPosition());
|
||||
}
|
||||
if (isNotSafeAndCanTryToDestroy(p_22540_, maid, maid.blockPosition().above(), task)) {
|
||||
list.add(maid.blockPosition().above());
|
||||
}
|
||||
MemoryUtil.setDestroyTargetMemory(maid, list);
|
||||
MemoryUtil.setTarget(maid, maid.blockPosition(), 0.5f);
|
||||
MemoryUtil.setCurrent(maid, CurrentWork.DESTROY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void stop(ServerLevel p_22548_, EntityMaid p_22549_, long p_22550_) {
|
||||
MemoryUtil.clearTarget(p_22549_);
|
||||
MemoryUtil.setCurrent(p_22549_, CurrentWork.IDLE);
|
||||
}
|
||||
}
|
||||
@@ -89,9 +89,9 @@ public class PlaceBlockMoveBehavior extends MaidCenterMoveToBlockTask {
|
||||
protected @NotNull MaidPathFindingBFS getOrCreateArrivalMap(@NotNull ServerLevel worldIn, @NotNull EntityMaid maid) {
|
||||
if (this.pathfindingBFS == null)
|
||||
if (maid.hasRestriction())
|
||||
this.pathfindingBFS = new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), worldIn, maid, 14, (int) maid.getRestrictRadius());
|
||||
this.pathfindingBFS = new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), worldIn, maid, (int) maid.getRestrictRadius(), 9);
|
||||
else
|
||||
this.pathfindingBFS = new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), worldIn, maid, 14);
|
||||
this.pathfindingBFS = new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), worldIn, maid, 7, 9);
|
||||
return this.pathfindingBFS;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package studio.fantasyit.maid_useful_task.compat;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
||||
public class CompatEntry {
|
||||
public static BlockPos getLocateTarget(EntityMaid maid, ItemStack itemStack) {
|
||||
BlockPos tmp = null;
|
||||
if (tmp == null && ModList.get().isLoaded("naturescompass")) {
|
||||
tmp = NatureCompass.getCompassTarget(maid, itemStack);
|
||||
}
|
||||
if (tmp == null && ModList.get().isLoaded("explorerscompass")) {
|
||||
tmp = ExplorerCompass.getCompassTarget(maid, itemStack);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package studio.fantasyit.maid_useful_task.compat;
|
||||
|
||||
import com.chaosthedude.explorerscompass.ExplorersCompass;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class ExplorerCompass {
|
||||
public static BlockPos getCompassTarget(EntityMaid maid, ItemStack itemStack) {
|
||||
if (itemStack.is(ExplorersCompass.explorersCompass)) {
|
||||
return new BlockPos(
|
||||
ExplorersCompass.explorersCompass.getFoundStructureX(itemStack),
|
||||
maid.level().getSeaLevel(),
|
||||
ExplorersCompass.explorersCompass.getFoundStructureZ(itemStack)
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package studio.fantasyit.maid_useful_task.compat;
|
||||
|
||||
import com.chaosthedude.naturescompass.NaturesCompass;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
||||
public class NatureCompass {
|
||||
public static BlockPos getCompassTarget(EntityMaid maid, ItemStack itemStack) {
|
||||
if (itemStack.is(NaturesCompass.naturesCompass)) {
|
||||
return new BlockPos(
|
||||
NaturesCompass.naturesCompass.getFoundBiomeX(itemStack),
|
||||
maid.level().getSeaLevel(),
|
||||
NaturesCompass.naturesCompass.getFoundBiomeZ(itemStack)
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package studio.fantasyit.maid_useful_task.compat;
|
||||
|
||||
import net.minecraftforge.fml.ModList;
|
||||
|
||||
public class PlayerRevive {
|
||||
public static boolean isEnable(){
|
||||
return ModList.get().isLoaded("playerrevive");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package studio.fantasyit.maid_useful_task.data;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.api.entity.data.TaskDataKey;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||
@@ -8,15 +9,23 @@ import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||
public class MaidLoggingConfig implements TaskDataKey<MaidLoggingConfig.Data> {
|
||||
|
||||
|
||||
public static Data get(EntityMaid maid) {
|
||||
return maid.getOrCreateData(KEY, Data.getDefault());
|
||||
}
|
||||
|
||||
public static final class Data implements IConfigSetter {
|
||||
private boolean plant;
|
||||
private boolean blockUp;
|
||||
private boolean skipNonNature;
|
||||
|
||||
public Data(boolean plant) {
|
||||
public Data(boolean plant, boolean blockUp, boolean skipNonNature) {
|
||||
this.plant = plant;
|
||||
this.blockUp = blockUp;
|
||||
this.skipNonNature = skipNonNature;
|
||||
}
|
||||
|
||||
public static Data getDefault() {
|
||||
return new Data(true);
|
||||
return new Data(true, true, true);
|
||||
}
|
||||
|
||||
public boolean plant() {
|
||||
@@ -27,12 +36,34 @@ public class MaidLoggingConfig implements TaskDataKey<MaidLoggingConfig.Data> {
|
||||
this.plant = plant;
|
||||
}
|
||||
|
||||
public boolean blockUp() {
|
||||
return blockUp;
|
||||
}
|
||||
|
||||
public void blockUp(boolean blockUp) {
|
||||
this.blockUp = blockUp;
|
||||
}
|
||||
|
||||
public boolean skipNonNature() {
|
||||
return skipNonNature;
|
||||
}
|
||||
|
||||
public void skipNonNature(boolean skipNonNature) {
|
||||
this.skipNonNature = skipNonNature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfigValue(String name, String value) {
|
||||
switch (name) {
|
||||
case "plant":
|
||||
plant = Boolean.parseBoolean(value);
|
||||
break;
|
||||
case "blockUp":
|
||||
blockUp = Boolean.parseBoolean(value);
|
||||
break;
|
||||
case "skipNonNature":
|
||||
skipNonNature = Boolean.parseBoolean(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,12 +80,16 @@ public class MaidLoggingConfig implements TaskDataKey<MaidLoggingConfig.Data> {
|
||||
public CompoundTag writeSaveData(Data data) {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
tag.putBoolean("plant", data.plant);
|
||||
tag.putBoolean("blockUp", data.blockUp);
|
||||
tag.putBoolean("skipNonNature", data.skipNonNature);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Data readSaveData(CompoundTag compound) {
|
||||
boolean plant = compound.getBoolean("plant");
|
||||
return new Data(plant);
|
||||
boolean blockUp = compound.getBoolean("blockUp");
|
||||
boolean skipNonNature = compound.getBoolean("skipNonNature");
|
||||
return new Data(plant, blockUp, skipNonNature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package studio.fantasyit.maid_useful_task.data;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.api.entity.data.TaskDataKey;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||
|
||||
public class MaidReviveConfig implements TaskDataKey<MaidReviveConfig.Data> {
|
||||
public static final class Data implements IConfigSetter {
|
||||
private boolean ownerOnly;
|
||||
|
||||
public Data(boolean ownerOnly) {
|
||||
this.ownerOnly = ownerOnly;
|
||||
}
|
||||
|
||||
public static Data getDefault() {
|
||||
return new Data(false);
|
||||
}
|
||||
|
||||
public boolean ownerOnly() {
|
||||
return ownerOnly;
|
||||
}
|
||||
|
||||
public void ownerOnly(boolean ownerOnly) {
|
||||
this.ownerOnly = ownerOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfigValue(String name, String value) {
|
||||
switch (name) {
|
||||
case "ownerOnly":
|
||||
ownerOnly = Boolean.parseBoolean(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static TaskDataKey<Data> KEY = null;
|
||||
public static final ResourceLocation LOCATION = new ResourceLocation(MaidUsefulTask.MODID, "revive");
|
||||
|
||||
@Override
|
||||
public ResourceLocation getKey() {
|
||||
return LOCATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag writeSaveData(Data data) {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
tag.putBoolean("ownerOnly", data.ownerOnly);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Data readSaveData(CompoundTag compound) {
|
||||
boolean plant = compound.getBoolean("ownerOnly");
|
||||
return new Data(plant);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,8 @@ public class MaidTickEvent {
|
||||
if (event.getMaid().getTask() instanceof IMaidVehicleControlTask imvc && event.getMaid().getVehicle() != null) {
|
||||
imvc.tick(sl, event.getMaid());
|
||||
MaidVehicleManager.syncVehicleParameter(event.getMaid());
|
||||
}else if(event.getMaid().getVehicle() != null){
|
||||
MaidVehicleManager.stopControlling(event.getMaid());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,9 @@ import com.github.tartaricacid.touhoulittlemaid.client.gui.widget.button.MaidCon
|
||||
import com.github.tartaricacid.touhoulittlemaid.inventory.container.task.TaskConfigContainer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import studio.fantasyit.maid_useful_task.Config;
|
||||
import studio.fantasyit.maid_useful_task.data.MaidLoggingConfig;
|
||||
import studio.fantasyit.maid_useful_task.network.MaidConfigurePacket;
|
||||
import studio.fantasyit.maid_useful_task.network.Network;
|
||||
import studio.fantasyit.maid_useful_task.registry.GuiRegistry;
|
||||
import studio.fantasyit.maid_useful_task.util.TranslateUtil;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class MaidLoggingConfigGui extends MaidTaskConfigGui<MaidLoggingConfigGui
|
||||
|
||||
int startLeft = leftPos + 87;
|
||||
int startTop = topPos + 36;
|
||||
this.addRenderableWidget(new MaidConfigButton(startLeft, startTop + 0,
|
||||
this.addRenderableWidget(new MaidConfigButton(startLeft, startTop,
|
||||
Component.translatable("gui.maid_useful_task.logging.plant"),
|
||||
TranslateUtil.getBooleanTranslate(this.currentData.plant()),
|
||||
button -> {
|
||||
@@ -49,5 +49,37 @@ public class MaidLoggingConfigGui extends MaidTaskConfigGui<MaidLoggingConfigGui
|
||||
MaidConfigurePacket.send(this.maid, MaidLoggingConfig.LOCATION, "plant", "true");
|
||||
}
|
||||
));
|
||||
if (!Config.disableLoggingBlockUp) {
|
||||
startTop += 13;
|
||||
this.addRenderableWidget(new MaidConfigButton(startLeft, startTop,
|
||||
Component.translatable("gui.maid_useful_task.logging.block_up"),
|
||||
TranslateUtil.getBooleanTranslate(this.currentData.blockUp()),
|
||||
button -> {
|
||||
this.currentData.blockUp(false);
|
||||
button.setValue(TranslateUtil.getBooleanTranslate(false));
|
||||
MaidConfigurePacket.send(this.maid, MaidLoggingConfig.LOCATION, "blockUp", "false");
|
||||
},
|
||||
button -> {
|
||||
this.currentData.blockUp(true);
|
||||
button.setValue(TranslateUtil.getBooleanTranslate(true));
|
||||
MaidConfigurePacket.send(this.maid, MaidLoggingConfig.LOCATION, "blockUp", "true");
|
||||
}
|
||||
));
|
||||
}
|
||||
startTop += 13;
|
||||
this.addRenderableWidget(new MaidConfigButton(startLeft, startTop,
|
||||
Component.translatable("gui.maid_useful_task.logging.skip_non_nature"),
|
||||
TranslateUtil.getBooleanTranslate(this.currentData.skipNonNature()),
|
||||
button -> {
|
||||
this.currentData.skipNonNature(false);
|
||||
button.setValue(TranslateUtil.getBooleanTranslate(false));
|
||||
MaidConfigurePacket.send(this.maid, MaidLoggingConfig.LOCATION, "skipNonNature", "false");
|
||||
},
|
||||
button -> {
|
||||
this.currentData.skipNonNature(true);
|
||||
button.setValue(TranslateUtil.getBooleanTranslate(true));
|
||||
MaidConfigurePacket.send(this.maid, MaidLoggingConfig.LOCATION, "skipNonNature", "true");
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package studio.fantasyit.maid_useful_task.menu;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.client.gui.entity.maid.task.MaidTaskConfigGui;
|
||||
import com.github.tartaricacid.touhoulittlemaid.client.gui.widget.button.MaidConfigButton;
|
||||
import com.github.tartaricacid.touhoulittlemaid.inventory.container.task.TaskConfigContainer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import studio.fantasyit.maid_useful_task.data.MaidLoggingConfig;
|
||||
import studio.fantasyit.maid_useful_task.data.MaidReviveConfig;
|
||||
import studio.fantasyit.maid_useful_task.network.MaidConfigurePacket;
|
||||
import studio.fantasyit.maid_useful_task.registry.GuiRegistry;
|
||||
import studio.fantasyit.maid_useful_task.util.TranslateUtil;
|
||||
|
||||
public class MaidReviveConfigGui extends MaidTaskConfigGui<MaidReviveConfigGui.Container> {
|
||||
private MaidReviveConfig.Data currentData;
|
||||
|
||||
public MaidReviveConfigGui(Container screenContainer, Inventory inv, Component titleIn) {
|
||||
super(screenContainer, inv, titleIn);
|
||||
}
|
||||
|
||||
public static class Container extends TaskConfigContainer {
|
||||
public Container(int id, Inventory inventory, int entityId) {
|
||||
super(GuiRegistry.MAID_REVIVE_CONFIG_GUI.get(), id, inventory, entityId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initAdditionData() {
|
||||
this.currentData = this.maid.getOrCreateData(MaidReviveConfig.KEY, MaidReviveConfig.Data.getDefault());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initAdditionWidgets() {
|
||||
super.initAdditionWidgets();
|
||||
|
||||
int startLeft = leftPos + 87;
|
||||
int startTop = topPos + 36;
|
||||
this.addRenderableWidget(new MaidConfigButton(startLeft, startTop + 0,
|
||||
Component.translatable("gui.maid_useful_task.revive.ownerOnly"),
|
||||
TranslateUtil.getBooleanTranslate(this.currentData.ownerOnly()),
|
||||
button -> {
|
||||
this.currentData.ownerOnly(false);
|
||||
button.setValue(TranslateUtil.getBooleanTranslate(false));
|
||||
MaidConfigurePacket.send(this.maid, MaidReviveConfig.LOCATION, "ownerOnly", "false");
|
||||
},
|
||||
button -> {
|
||||
this.currentData.ownerOnly(true);
|
||||
button.setValue(TranslateUtil.getBooleanTranslate(true));
|
||||
MaidConfigurePacket.send(this.maid, MaidReviveConfig.LOCATION, "ownerOnly", "true");
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import studio.fantasyit.maid_useful_task.task.MaidLocateTask;
|
||||
import studio.fantasyit.maid_useful_task.task.MaidTreeTask;
|
||||
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||
|
||||
@Mixin(MaidMoveControl.class)
|
||||
@@ -18,11 +20,12 @@ abstract public class MaidMoveControlMixin {
|
||||
|
||||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||
public void tick(CallbackInfo ci) {
|
||||
if (switch (MemoryUtil.getCurrent(maid)) {
|
||||
case BLOCKUP_DESTROY, BLOCKUP_DOWN -> true;
|
||||
default -> false;
|
||||
}) {
|
||||
ci.cancel();
|
||||
}
|
||||
if (maid.getTask().getUid().equals(MaidTreeTask.UID))
|
||||
if (switch (MemoryUtil.getCurrent(maid)) {
|
||||
case BLOCKUP_DESTROY, BLOCKUP_DOWN -> true;
|
||||
default -> false;
|
||||
}) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import studio.fantasyit.maid_useful_task.memory.CurrentWork;
|
||||
import studio.fantasyit.maid_useful_task.task.MaidTreeTask;
|
||||
import studio.fantasyit.maid_useful_task.util.Conditions;
|
||||
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||
|
||||
@@ -15,8 +16,9 @@ import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||
abstract public class MaidRunOneMixin {
|
||||
@Inject(method = "tryStart(Lnet/minecraft/server/level/ServerLevel;Lcom/github/tartaricacid/touhoulittlemaid/entity/passive/EntityMaid;J)Z", at = @At("HEAD"), cancellable = true, remap = false)
|
||||
public void runOne(ServerLevel pLevel, EntityMaid maid, long pGameTime, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (!Conditions.isCurrent(maid, CurrentWork.IDLE)) {
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
if (maid.getTask().getUid().equals(MaidTreeTask.UID))
|
||||
if (!Conditions.isCurrent(maid, CurrentWork.IDLE)) {
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
package studio.fantasyit.maid_useful_task.mixin;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.item.AbstractEntityFromItem;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.item.EntityBroom;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import studio.fantasyit.maid_useful_task.vehicle.IVirtualControl;
|
||||
import studio.fantasyit.maid_useful_task.vehicle.MaidVehicleControlType;
|
||||
|
||||
@Mixin(EntityBroom.class)
|
||||
abstract public class VehicleBroomMixin extends AbstractEntityFromItem implements IVirtualControl {
|
||||
public VehicleBroomMixin(EntityType<? extends LivingEntity> type, Level worldIn) {
|
||||
super(type, worldIn);
|
||||
}
|
||||
|
||||
@Unique
|
||||
public MaidVehicleControlType maid_useful_tasks$vc_type = MaidVehicleControlType.NONE;
|
||||
@Unique
|
||||
public float maid_useful_tasks$vc_xRot;
|
||||
@Unique
|
||||
public float maid_useful_tasks$vc_yRot;
|
||||
@Unique
|
||||
public float maid_useful_tasks$vc_speed;
|
||||
|
||||
@Override
|
||||
public void maid_useful_tasks$setControlParam(float xRot, float yRot, float speed, MaidVehicleControlType type) {
|
||||
this.maid_useful_tasks$vc_xRot = xRot;
|
||||
this.maid_useful_tasks$vc_yRot = yRot;
|
||||
this.maid_useful_tasks$vc_speed = speed;
|
||||
this.maid_useful_tasks$vc_type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag maid_useful_tasks$getControlParam() {
|
||||
CompoundTag result = new CompoundTag();
|
||||
result.putFloat("xRot", maid_useful_tasks$vc_xRot);
|
||||
result.putFloat("yRot", maid_useful_tasks$vc_yRot);
|
||||
result.putFloat("speed", maid_useful_tasks$vc_speed);
|
||||
result.putString("type", maid_useful_tasks$vc_type.name());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maid_useful_tasks$setControlParam(CompoundTag target) {
|
||||
if (target.contains("type")) {
|
||||
this.maid_useful_tasks$vc_type = MaidVehicleControlType.valueOf(target.getString("type"));
|
||||
}
|
||||
if (target.contains("xRot")) {
|
||||
this.maid_useful_tasks$vc_xRot = target.getFloat("xRot");
|
||||
}
|
||||
if (target.contains("yRot")) {
|
||||
this.maid_useful_tasks$vc_yRot = target.getFloat("yRot");
|
||||
}
|
||||
if (target.contains("speed")) {
|
||||
this.maid_useful_tasks$vc_speed = target.getFloat("speed");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maid_useful_tasks$stopControl() {
|
||||
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"))
|
||||
public void maid_useful_tasks$tickRidden(CallbackInfo ci) {
|
||||
if (maid_useful_tasks$vc_type == MaidVehicleControlType.NONE) {
|
||||
return;
|
||||
}
|
||||
this.setRot(maid_useful_tasks$vc_yRot, maid_useful_tasks$vc_xRot);
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "travel", at = @At(value = "STORE"), name = "strafe")
|
||||
float maid_useful_tasks$travel_s(float strafe) {
|
||||
if (maid_useful_tasks$vc_type != MaidVehicleControlType.FULL) {
|
||||
return strafe;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "travel", at = @At(value = "STORE"), name = "vertical")
|
||||
float maid_useful_tasks$travel_v(float vertical) {
|
||||
if (maid_useful_tasks$vc_type != MaidVehicleControlType.FULL) {
|
||||
return vertical;
|
||||
}
|
||||
return -(maid_useful_tasks$vc_xRot - 10.0F) / 22.5F;
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "travel", at = @At(value = "STORE"), name = "forward")
|
||||
float maid_useful_tasks$travel_f(float forward) {
|
||||
if (maid_useful_tasks$vc_type != MaidVehicleControlType.FULL) {
|
||||
return forward;
|
||||
}
|
||||
return maid_useful_tasks$vc_speed;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
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.vehicle.MaidVehicleControlType;
|
||||
|
||||
@@ -34,6 +35,10 @@ public class MaidAllowHandleVehicle {
|
||||
if (entity instanceof EntityMaid maid) {
|
||||
MaidVehicleControlType[] values = MaidVehicleControlType.values();
|
||||
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);
|
||||
Component component = switch (allowMode) {
|
||||
case NONE -> Component.translatable("maid_useful_task.allow_handle_vehicle.none");
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||
import studio.fantasyit.maid_useful_task.menu.MaidLoggingConfigGui;
|
||||
import studio.fantasyit.maid_useful_task.menu.MaidReviveConfigGui;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = MaidUsefulTask.MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
public class ClientGuiRegistry {
|
||||
@@ -15,5 +16,8 @@ public class ClientGuiRegistry {
|
||||
event.enqueueWork(() -> {
|
||||
MenuScreens.register(GuiRegistry.MAID_LOGGING_CONFIG_GUI.get(), MaidLoggingConfigGui::new);
|
||||
});
|
||||
event.enqueueWork(() -> {
|
||||
MenuScreens.register(GuiRegistry.MAID_REVIVE_CONFIG_GUI.get(), MaidReviveConfigGui::new);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,14 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||
import studio.fantasyit.maid_useful_task.menu.MaidLoggingConfigGui;
|
||||
import studio.fantasyit.maid_useful_task.menu.MaidReviveConfigGui;
|
||||
|
||||
public class GuiRegistry {
|
||||
public static final DeferredRegister<MenuType<?>> MENU_TYPES = DeferredRegister.create(ForgeRegistries.MENU_TYPES, MaidUsefulTask.MODID);
|
||||
public static final RegistryObject<MenuType<MaidLoggingConfigGui.Container>> MAID_LOGGING_CONFIG_GUI = MENU_TYPES.register("maid_logging_config_gui",
|
||||
() -> IForgeMenuType.create((windowId, inv, data) -> new MaidLoggingConfigGui.Container(windowId, inv, data.readInt())));
|
||||
public static final RegistryObject<MenuType<MaidReviveConfigGui.Container>> MAID_REVIVE_CONFIG_GUI = MENU_TYPES.register("maid_revive_config_gui",
|
||||
() -> IForgeMenuType.create((windowId, inv, data) -> new MaidReviveConfigGui.Container(windowId, inv, data.readInt())));
|
||||
|
||||
public static void init(IEventBus modEventBus) {
|
||||
MENU_TYPES.register(modEventBus);
|
||||
|
||||
@@ -62,8 +62,9 @@ public interface IMaidBlockDestroyTask {
|
||||
for (int dz : dv) {
|
||||
if (dx == 0 && dy == 0 && dz == 0) continue;
|
||||
BlockPos target = pos.offset(dx, dy, dz);
|
||||
if (Math.abs(target.getX() - standPos.getX()) > maxDXZ || Math.abs(target.getZ() - standPos.getZ()) > maxDXZ)
|
||||
continue;
|
||||
// if (Math.abs(target.getX() - standPos.getX()) > maxDXZ || Math.abs(target.getZ() - standPos.getZ()) > maxDXZ)
|
||||
// continue;
|
||||
//上代码不明所以,删除待查
|
||||
if (target.distSqr(standPos) > reachDistance() * reachDistance()) continue;
|
||||
if (marked.contains(target)) continue;
|
||||
if (!shouldDestroyBlock(maid, target)) continue;
|
||||
|
||||
@@ -13,6 +13,8 @@ import oshi.util.tuples.Pair;
|
||||
import studio.fantasyit.maid_useful_task.util.MaidUtils;
|
||||
import studio.fantasyit.maid_useful_task.util.PosUtils;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public interface IMaidBlockUpTask {
|
||||
default boolean isFindingBlock(EntityMaid maid, BlockPos target, BlockPos standPos) {
|
||||
if (target.distSqr(standPos) > touchLimit() * touchLimit())
|
||||
@@ -41,16 +43,28 @@ public interface IMaidBlockUpTask {
|
||||
default Pair<BlockPos, BlockPos> findTargetPosBlockUp(EntityMaid maid, BlockPos center, int maxUp) {
|
||||
ServerLevel level = (ServerLevel) maid.level();
|
||||
int maxHeight = verticalOffset() + verticalDistance();
|
||||
CenterOffsetBlockPosSet notAvailable = new CenterOffsetBlockPosSet(scanRange(maid), scanRange(maid) + maxHeight / 2 + 1, scanRange(maid), center.getX(), center.getY() + maxHeight / 2, center.getZ());
|
||||
MaidPathFindingBFS pathFindingBFS = new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), level, maid, 7, scanRange(maid));
|
||||
for (int dx = 0; dx < scanRange(maid); dx = dx <= 0 ? 1 - dx : -dx) {
|
||||
for (int dz = 0; dz < scanRange(maid); dz = dz <= 0 ? 1 - dz : -dz) {
|
||||
boolean hasRestriction = maid.hasRestriction();
|
||||
BlockPos restrictCenter = maid.getRestrictCenter();
|
||||
float restrictRadius = maid.getRestrictRadius();
|
||||
int scanRange = scanRange(maid);
|
||||
Function<BlockPos, Boolean> withinRestriction = (BlockPos pos) -> {
|
||||
if (hasRestriction) {
|
||||
return restrictCenter.distSqr(pos) < (double) (restrictRadius * restrictRadius);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
CenterOffsetBlockPosSet notAvailable = new CenterOffsetBlockPosSet(scanRange, scanRange + maxHeight / 2 + 1, scanRange, center.getX(), center.getY() + maxHeight / 2, center.getZ());
|
||||
MaidPathFindingBFS pathFindingBFS = new MaidPathFindingBFS(maid.getNavigation().getNodeEvaluator(), level, maid, 7, scanRange+2);
|
||||
for (int dx = 0; dx < scanRange; dx = dx <= 0 ? 1 - dx : -dx) {
|
||||
for (int dz = 0; dz < scanRange; dz = dz <= 0 ? 1 - dz : -dz) {
|
||||
//计算地面的位置
|
||||
BlockPos.MutableBlockPos ground = center.offset(dx, 0, dz).mutable();
|
||||
while (level.getBlockState(ground).canBeReplaced()) ground.move(0, -1, 0);
|
||||
while (!level.getBlockState(ground).canBeReplaced()) ground.move(0, 1, 0);
|
||||
if (notAvailable.isVis(ground)) continue;
|
||||
//地面基本判断
|
||||
if (!PosUtils.isSafePos(level, ground)) continue;
|
||||
if (!PosUtils.isFourSideAir(level, ground.immutable())) continue;
|
||||
if (!pathFindingBFS.canPathReach(ground)) continue;
|
||||
boolean valid = true;
|
||||
@@ -83,7 +97,7 @@ public interface IMaidBlockUpTask {
|
||||
for (int dy = verticalOffset(); dy < verticalDistance() + verticalOffset(); dy++) {
|
||||
BlockPos targetPos = ground.offset(sdx, dy, sdz);
|
||||
if (targetPos.distSqr(standPos) > touchLimit * touchLimit) break;
|
||||
if (maid.hasRestriction() && !maid.isWithinRestriction(standPos)) break;
|
||||
if (hasRestriction && !withinRestriction.apply(standPos)) break;
|
||||
if (isFindingBlock(maid, targetPos, standPos)) {
|
||||
return new Pair<>(ground.immutable(), standPos);
|
||||
}
|
||||
@@ -91,7 +105,7 @@ public interface IMaidBlockUpTask {
|
||||
if (continuous) {
|
||||
if (!level.getBlockState(standPos.above().above()).isAir()) {
|
||||
continuous = false;
|
||||
} else if (maid.hasRestriction() && !maid.isWithinRestriction(standPos.above())) {
|
||||
} else if (hasRestriction && !withinRestriction.apply((standPos.above().above()))) {
|
||||
continuous = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,18 +4,30 @@ import com.github.tartaricacid.touhoulittlemaid.api.task.IMaidTask;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.GlobalPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.StructureTags;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
|
||||
import net.minecraft.world.item.CompassItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.MapItem;
|
||||
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import studio.fantasyit.maid_useful_task.Config;
|
||||
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||
import studio.fantasyit.maid_useful_task.api.ItemLocateEvent;
|
||||
import studio.fantasyit.maid_useful_task.behavior.common.FindTargetMoveBehavior;
|
||||
import studio.fantasyit.maid_useful_task.behavior.common.FindTargetWaitBehavior;
|
||||
import studio.fantasyit.maid_useful_task.compat.CompatEntry;
|
||||
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -53,16 +65,24 @@ public class MaidLocateTask implements IMaidTask, IMaidFindTargetTask {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnable(EntityMaid maid) {
|
||||
return Config.enableLocateTask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable BlockPos findTarget(ServerLevel level, EntityMaid maid) {
|
||||
BlockPos target = null;
|
||||
ItemStack itemStack = maid.getMainHandItem();
|
||||
ItemStack last = MemoryUtil.getLocateItem(maid);
|
||||
if (!last.isEmpty() && !itemStack.isEmpty() && ItemStack.isSameItem(last, itemStack)) {
|
||||
if (!last.isEmpty() && !itemStack.isEmpty() && ItemStack.isSameItemSameTags(last, itemStack)) {
|
||||
MemoryUtil.setLocateItem(maid, itemStack);
|
||||
MemoryUtil.clearCommonBlockCache(maid);
|
||||
}
|
||||
if (maid.getMainHandItem().is(Items.ENDER_EYE)) {
|
||||
ItemLocateEvent event = new ItemLocateEvent(itemStack, maid, MemoryUtil.getCommonBlockCache(maid));
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) {
|
||||
target = event.getTarget();
|
||||
} else if (maid.getMainHandItem().is(Items.ENDER_EYE)) {
|
||||
target = MemoryUtil.getCommonBlockCache(maid);
|
||||
if (target == null) {
|
||||
BlockPos blockpos = level.findNearestMapStructure(StructureTags.EYE_OF_ENDER_LOCATED, maid.blockPosition(), 100, false);
|
||||
@@ -72,14 +92,73 @@ public class MaidLocateTask implements IMaidTask, IMaidFindTargetTask {
|
||||
}
|
||||
}
|
||||
} else if (maid.getMainHandItem().is(Items.COMPASS)) {
|
||||
target = MemoryUtil.getCommonBlockCache(maid);
|
||||
if (target == null) {
|
||||
GlobalPos globalPos;
|
||||
if (CompassItem.isLodestoneCompass(itemStack)) {
|
||||
globalPos = CompassItem.getLodestonePosition(itemStack.getOrCreateTag());
|
||||
} else {
|
||||
globalPos = CompassItem.getSpawnPosition(level);
|
||||
}
|
||||
if (globalPos != null && level.dimension().equals(globalPos.dimension())) {
|
||||
MemoryUtil.setCommonBlockCache(maid, globalPos.pos());
|
||||
target = globalPos.pos();
|
||||
}
|
||||
}
|
||||
} else if (maid.getMainHandItem().is(ItemTags.BEDS)) {
|
||||
target = MemoryUtil.getCommonBlockCache(maid);
|
||||
if (target == null) {
|
||||
LivingEntity owner = maid.getOwner();
|
||||
if (owner != null) {
|
||||
target = owner.getSleepingPos().orElse(maid.level().getSharedSpawnPos());
|
||||
if (owner instanceof ServerPlayer player) {
|
||||
if (player.getRespawnDimension().equals(level.dimension())) {
|
||||
target = player.getRespawnPosition();
|
||||
if (target == null) {
|
||||
GlobalPos globalRespawn = CompassItem.getSpawnPosition(level);
|
||||
if (globalRespawn != null && level.dimension().equals(globalRespawn.dimension())) {
|
||||
target = globalRespawn.pos();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target == null) {
|
||||
MemoryUtil.setCommonBlockCache(maid, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
} 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 {
|
||||
target = CompatEntry.getLocateTarget(maid, maid.getMainHandItem());
|
||||
if (target != null) {
|
||||
MemoryUtil.setCommonBlockCache(maid, target);
|
||||
return target;
|
||||
}
|
||||
MemoryUtil.clearCommonBlockCache(maid);
|
||||
}
|
||||
return target;
|
||||
@@ -90,3 +169,4 @@ public class MaidLocateTask implements IMaidTask, IMaidFindTargetTask {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package studio.fantasyit.maid_useful_task.task;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.api.task.IMaidTask;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.MenuProvider;
|
||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import studio.fantasyit.maid_useful_task.Config;
|
||||
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||
import studio.fantasyit.maid_useful_task.behavior.PlayerReviveBehavior;
|
||||
import studio.fantasyit.maid_useful_task.compat.PlayerRevive;
|
||||
import studio.fantasyit.maid_useful_task.menu.MaidLoggingConfigGui;
|
||||
import studio.fantasyit.maid_useful_task.menu.MaidReviveConfigGui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MaidRevivePlayerTask implements IMaidTask {
|
||||
public static final ResourceLocation UID = new ResourceLocation(MaidUsefulTask.MODID, "revive_player");
|
||||
|
||||
@Override
|
||||
public ResourceLocation getUid() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIcon() {
|
||||
return Items.ENCHANTED_GOLDEN_APPLE.getDefaultInstance();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public SoundEvent getAmbientSound(EntityMaid entityMaid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnable(EntityMaid maid) {
|
||||
return PlayerRevive.isEnable() && Config.enableReviveTask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enableLookAndRandomWalk(EntityMaid maid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enablePanic(EntityMaid maid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, BehaviorControl<? super EntityMaid>>> createBrainTasks(EntityMaid entityMaid) {
|
||||
ArrayList<Pair<Integer, BehaviorControl<? super EntityMaid>>> ret = new ArrayList<>();
|
||||
ret.add(Pair.of(1, new PlayerReviveBehavior()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MenuProvider getTaskConfigGuiProvider(EntityMaid maid) {
|
||||
return new MenuProvider() {
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return Component.literal("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContainerMenu createMenu(int index, Inventory playerInventory, Player player) {
|
||||
return new MaidReviveConfigGui.Container(index, playerInventory, maid.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,12 +23,12 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import studio.fantasyit.maid_useful_task.Config;
|
||||
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||
import studio.fantasyit.maid_useful_task.behavior.common.*;
|
||||
import studio.fantasyit.maid_useful_task.data.MaidLoggingConfig;
|
||||
import studio.fantasyit.maid_useful_task.memory.BlockValidationMemory;
|
||||
import studio.fantasyit.maid_useful_task.menu.MaidLoggingConfigGui;
|
||||
import studio.fantasyit.maid_useful_task.registry.GuiRegistry;
|
||||
import studio.fantasyit.maid_useful_task.util.MaidUtils;
|
||||
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||
import studio.fantasyit.maid_useful_task.util.WrappedMaidFakePlayer;
|
||||
@@ -39,9 +39,11 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockDestroyTask, IMaidBlockUpTask {
|
||||
public static final ResourceLocation UID = new ResourceLocation(MaidUsefulTask.MODID, "maid_tree");
|
||||
|
||||
@Override
|
||||
public ResourceLocation getUid() {
|
||||
return new ResourceLocation(MaidUsefulTask.MODID, "maid_tree");
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,6 +62,11 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnable(EntityMaid maid) {
|
||||
return Config.enableLoggingTask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MenuProvider getTaskConfigGuiProvider(EntityMaid maid) {
|
||||
return new MenuProvider() {
|
||||
@@ -83,7 +90,10 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD
|
||||
}
|
||||
}
|
||||
BlockState blockState = maid.level().getBlockState(pos);
|
||||
return blockState.is(BlockTags.LOGS) && isValidNatureTree(maid, pos);
|
||||
if (blockState.is(BlockTags.LOGS)) {
|
||||
return !MaidLoggingConfig.get(maid).skipNonNature() || isValidNatureTree(maid, pos);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,15 +184,27 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD
|
||||
|
||||
|
||||
protected boolean isValidNatureTree(EntityMaid maid, BlockPos startPos) {
|
||||
return isValidNatureTree(maid, startPos, new HashSet<>());
|
||||
HashSet<BlockPos> vis = new HashSet<>();
|
||||
BlockValidationMemory validationMemory = MemoryUtil.getBlockValidationMemory(maid);
|
||||
boolean validNatureTree = isValidNatureTree(maid, startPos, vis, 0, validationMemory);
|
||||
for (BlockPos pos : vis) {
|
||||
BlockState blockState = maid.level().getBlockState(pos);
|
||||
if (!blockState.is(BlockTags.LEAVES) && !blockState.is(BlockTags.LOGS))
|
||||
continue;
|
||||
if (validNatureTree)
|
||||
validationMemory.setValid(pos);
|
||||
else
|
||||
validationMemory.setInvalid(pos);
|
||||
}
|
||||
return validNatureTree;
|
||||
}
|
||||
|
||||
protected boolean isValidNatureTree(EntityMaid maid, BlockPos startPos, Set<BlockPos> visited) {
|
||||
BlockValidationMemory validationMemory = MemoryUtil.getBlockValidationMemory(maid);
|
||||
protected boolean isValidNatureTree(EntityMaid maid, BlockPos startPos, Set<BlockPos> visited, int depth, BlockValidationMemory validationMemory) {
|
||||
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};
|
||||
@@ -191,10 +213,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, validationMemory)) {
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
@@ -210,6 +232,7 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD
|
||||
@Override
|
||||
public List<Pair<Integer, BehaviorControl<? super EntityMaid>>> createBrainTasks(EntityMaid entityMaid) {
|
||||
ArrayList<Pair<Integer, BehaviorControl<? super EntityMaid>>> list = new ArrayList<>();
|
||||
list.add(Pair.of(0, new MaidSelfRescueBehavior()));
|
||||
|
||||
list.add(Pair.of(1, new DestoryBlockBehavior()));
|
||||
list.add(Pair.of(1, new DestoryBlockMoveBehavior()));
|
||||
@@ -240,7 +263,10 @@ public class MaidTreeTask implements IMaidTask, IMaidBlockPlaceTask, IMaidBlockD
|
||||
public boolean isFindingBlock(EntityMaid maid, BlockPos target, BlockPos standPos) {
|
||||
if (target.distSqr(standPos) > touchLimit() * touchLimit())
|
||||
return false;
|
||||
return maid.level().getBlockState(target).is(BlockTags.LOGS) && isValidNatureTree(maid, target);
|
||||
if (maid.level().getBlockState(target).is(BlockTags.LOGS)) {
|
||||
return !MaidLoggingConfig.get(maid).skipNonNature() || isValidNatureTree(maid, target);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -265,4 +291,19 @@ 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() && MaidLoggingConfig.get(maid).blockUp() && !Config.disableLoggingBlockUp)
|
||||
return IMaidBlockUpTask.super.findTargetPosBlockUp(maid, center, maxUp);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,12 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import net.minecraft.world.entity.ai.memory.WalkTarget;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import studio.fantasyit.maid_useful_task.memory.CurrentWork;
|
||||
import studio.fantasyit.maid_useful_task.registry.MemoryModuleRegistry;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class Conditions {
|
||||
public static boolean hasReachedValidTargetOrReset(EntityMaid maid) {
|
||||
return hasReachedValidTargetOrReset(maid, 2);
|
||||
return hasReachedValidTargetOrReset(maid, 2.5f);
|
||||
}
|
||||
|
||||
public static boolean hasReachedValidTargetOrReset(EntityMaid maid, float closeEnough) {
|
||||
@@ -43,7 +42,7 @@ public class Conditions {
|
||||
|
||||
public static boolean isGlobalValidTarget(EntityMaid maid, BlockPos pos, BlockPos targetPos) {
|
||||
if (MemoryUtil.getBlockUpContext(maid).hasTarget()) {
|
||||
return MemoryUtil.getBlockUpContext(maid).isTarget(pos);
|
||||
return pos.equals(maid.blockPosition());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package studio.fantasyit.maid_useful_task.util;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class InvUtil {
|
||||
public static ItemStack tryExtractOneMatches(IItemHandler inv, Predicate<ItemStack> predicate) {
|
||||
int count = 0;
|
||||
for (int i = 0; i < inv.getSlots(); i++) {
|
||||
ItemStack stackInSlot = inv.getStackInSlot(i);
|
||||
if(stackInSlot.isEmpty()) continue;
|
||||
if (predicate.test(stackInSlot)) {
|
||||
ItemStack get = inv.extractItem(i, 1, false);
|
||||
if (!get.isEmpty()) {
|
||||
return get;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package studio.fantasyit.maid_useful_task.util;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
|
||||
public class PosUtils {
|
||||
public static boolean isFourSideAir(BlockGetter level, BlockPos pos) {
|
||||
@@ -11,4 +13,17 @@ public class PosUtils {
|
||||
level.getBlockState(pos.east()).isAir() &&
|
||||
level.getBlockState(pos.west()).isAir();
|
||||
}
|
||||
static protected boolean isEmptyBlockPos(Level level, BlockPos pos) {
|
||||
return level.getBlockState(pos).isAir() || level.getBlockState(pos).getCollisionShape(
|
||||
level,
|
||||
pos,
|
||||
CollisionContext.empty()
|
||||
).isEmpty();
|
||||
}
|
||||
|
||||
static public boolean isSafePos(Level level, BlockPos pos) {
|
||||
return isEmptyBlockPos(level, pos)
|
||||
&& isEmptyBlockPos(level, pos.above())
|
||||
&& !isEmptyBlockPos(level, pos.below());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,6 +210,24 @@ public class WrappedMaidFakePlayer extends FakePlayer {
|
||||
return maid.position();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float distanceTo(Entity p_20271_) {
|
||||
if (maid == null) return super.distanceTo(p_20271_);
|
||||
return maid.distanceTo(p_20271_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double distanceToSqr(double p_20276_, double p_20277_, double p_20278_) {
|
||||
if (maid == null) return super.distanceToSqr(p_20276_, p_20277_, p_20278_);
|
||||
return maid.distanceToSqr(p_20276_, p_20277_, p_20278_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double distanceToSqr(Vec3 p_20239_) {
|
||||
if (maid == null) return super.distanceToSqr(p_20239_);
|
||||
return maid.distanceToSqr(p_20239_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleportTo(double p_8969_, double p_8970_, double p_8971_) {
|
||||
if (maid == null) return;
|
||||
|
||||
@@ -3,8 +3,11 @@ package studio.fantasyit.maid_useful_task.vehicle;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
public interface IVirtualControl {
|
||||
void maid_useful_tasks$setControlParam(float xRot, float yRot, float speed,MaidVehicleControlType type);
|
||||
void maid_useful_tasks$setControlParam(float xRot, float yRot, float speed, MaidVehicleControlType type);
|
||||
|
||||
void maid_useful_tasks$stopControl();
|
||||
|
||||
CompoundTag maid_useful_tasks$getControlParam();
|
||||
|
||||
void maid_useful_tasks$setControlParam(CompoundTag target);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package studio.fantasyit.maid_useful_task.vehicle;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
import studio.fantasyit.maid_useful_task.network.MaidSyncVehiclePacket;
|
||||
import studio.fantasyit.maid_useful_task.network.Network;
|
||||
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||
import studio.fantasyit.maid_useful_task.vehicle.broom.VehicleBroom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -41,4 +40,8 @@ public class MaidVehicleManager {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void stopControlling(EntityMaid maid) {
|
||||
MaidVehicleManager.getControllableVehicle(maid).ifPresent(vehicle -> vehicle.maidStopControlVehicle(maid));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
package studio.fantasyit.maid_useful_task.vehicle;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.item.EntityBroom;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Rotations;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import studio.fantasyit.maid_useful_task.util.RotUtil;
|
||||
|
||||
public class VehicleBroom extends AbstractMaidControllableVehicle {
|
||||
@Override
|
||||
public boolean isMaidOnThisVehicle(EntityMaid maid) {
|
||||
return maid.getVehicle() instanceof EntityBroom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maidControlVehicle(EntityMaid maid, MaidVehicleControlType type, BlockPos target) {
|
||||
if (maid.level().isClientSide) return;
|
||||
if (maid.getVehicle() instanceof EntityBroom vehicle) {
|
||||
if (type == MaidVehicleControlType.NONE) {
|
||||
((IVirtualControl) vehicle).maid_useful_tasks$setControlParam(0, 0, 0, type);
|
||||
return;
|
||||
}
|
||||
double xzDistance = maid.distanceToSqr(target.getX(), maid.getY(), target.getZ());
|
||||
double finalXRot = vehicle.getXRot();
|
||||
double finalYRot = vehicle.getYRot();
|
||||
double finalSpeed = 0;
|
||||
if (vehicle.isInWater()) {
|
||||
finalXRot = -10;
|
||||
} else if (xzDistance < Math.pow(maid.getY() - maid.level().getSeaLevel(), 2)) {
|
||||
if (maid.getY() - maid.level().getSeaLevel() < 50 || vehicle.onGround())
|
||||
finalXRot = 15;
|
||||
else
|
||||
finalXRot = 60;
|
||||
} else if (maid.getY() < 100) {
|
||||
finalXRot = -50;
|
||||
} else if (maid.getY() > 160) {
|
||||
finalXRot = 15;
|
||||
} else {
|
||||
finalXRot = 0;
|
||||
}
|
||||
|
||||
finalYRot = RotUtil.getYRot(maid.position(), target.getCenter());
|
||||
|
||||
finalSpeed = type == MaidVehicleControlType.FULL ? 3.0 : 0;
|
||||
if (xzDistance < 5 * 5 && (vehicle.onGround() || vehicle.isInWater()))
|
||||
finalSpeed = 0;
|
||||
|
||||
((IVirtualControl) vehicle).maid_useful_tasks$setControlParam((float) finalXRot, (float) finalYRot, (float) finalSpeed, type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maidStopControlVehicle(EntityMaid maid) {
|
||||
EntityBroom vehicle = (EntityBroom) maid.getVehicle();
|
||||
if (vehicle instanceof IVirtualControl ivc)
|
||||
ivc.maid_useful_tasks$stopControl();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package studio.fantasyit.maid_useful_task.vehicle.broom;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import studio.fantasyit.maid_useful_task.vehicle.MaidVehicleControlType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BroomControlParamStore {
|
||||
public record BroomControlParam(float xRot, float yRot, float vertical, float forward,
|
||||
MaidVehicleControlType type) {
|
||||
public static BroomControlParam fromNbt(CompoundTag tag) {
|
||||
return new BroomControlParam(
|
||||
tag.getFloat("xRot"),
|
||||
tag.getFloat("yRot"),
|
||||
tag.getFloat("vertical"),
|
||||
tag.getFloat("forward"),
|
||||
MaidVehicleControlType.valueOf(tag.getString("type"))
|
||||
);
|
||||
}
|
||||
|
||||
public CompoundTag toNbt() {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
tag.putFloat("xRot", xRot);
|
||||
tag.putFloat("yRot", yRot);
|
||||
tag.putFloat("vertical", vertical);
|
||||
tag.putFloat("forward", forward);
|
||||
tag.putString("type", type.name());
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
private static final BroomControlParam NONE = new BroomControlParam(0, 0, 0, 0, MaidVehicleControlType.NONE);
|
||||
|
||||
private static final Map<UUID, BroomControlParam> store = new HashMap<>();
|
||||
|
||||
public static void setControlParam(EntityMaid maid, BroomControlParam param) {
|
||||
store.put(maid.getUUID(), param);
|
||||
}
|
||||
|
||||
public static BroomControlParam getControlParam(EntityMaid maid) {
|
||||
if (!store.containsKey(maid.getUUID()))
|
||||
return NONE;
|
||||
return store.get(maid.getUUID());
|
||||
}
|
||||
|
||||
public static void removeControlParam(EntityMaid maid) {
|
||||
store.remove(maid.getUUID());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package studio.fantasyit.maid_useful_task.vehicle.broom;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.api.entity.IBroomControl;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.item.EntityBroom;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import studio.fantasyit.maid_useful_task.vehicle.MaidVehicleControlType;
|
||||
|
||||
public class BroomController implements IBroomControl {
|
||||
private final EntityBroom broom;
|
||||
|
||||
public BroomController(EntityBroom broom) {
|
||||
this.broom = broom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inControl(Player player, EntityMaid entityMaid) {
|
||||
return BroomControlParamStore.getControlParam(entityMaid).type() != MaidVehicleControlType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void travel(Player player, EntityMaid entityMaid) {
|
||||
BroomControlParamStore.BroomControlParam param = BroomControlParamStore.getControlParam(entityMaid);
|
||||
|
||||
float forward = 0;
|
||||
float strafe = 0;
|
||||
float vertical = param.vertical();
|
||||
if (param.type() == MaidVehicleControlType.FULL) {
|
||||
forward = param.forward() / 15.0f;
|
||||
} else {
|
||||
boolean keyForward = player.zza > 0;
|
||||
boolean keyBack = player.zza < 0;
|
||||
boolean keyLeft = player.xxa > 0;
|
||||
boolean keyRight = player.xxa < 0;
|
||||
|
||||
if (keyForward || keyBack || keyLeft || keyRight) {
|
||||
strafe = keyLeft ? 0.2f : (keyRight ? -0.2f : 0);
|
||||
forward = keyForward ? 0.375f : (keyBack ? -0.2f : 0);
|
||||
} else {
|
||||
vertical = 0;
|
||||
}
|
||||
}
|
||||
//来自PlayerBroomControl
|
||||
double playerSpeed = player.getAttributeValue(Attributes.MOVEMENT_SPEED);
|
||||
double speed = Math.max(playerSpeed - 0.1, 0) * 2.5 + 0.1;
|
||||
Vec3 targetMotion = new Vec3(strafe, vertical, forward).scale(speed * 20);
|
||||
targetMotion = targetMotion.yRot((float) (-broom.getYRot() * Math.PI / 180.0));
|
||||
|
||||
// 插值到目标速度,而不是直接累加
|
||||
Vec3 currentMotion = broom.getDeltaMovement();
|
||||
Vec3 newMotion = currentMotion.lerp(targetMotion, 0.25f);
|
||||
broom.setDeltaMovement(newMotion);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tickRot(Player player, EntityMaid entityMaid) {
|
||||
BroomControlParamStore.BroomControlParam param = BroomControlParamStore.getControlParam(entityMaid);
|
||||
|
||||
broom.yRotO = broom.yBodyRot = broom.yHeadRot = broom.getYRot();
|
||||
broom.setRot(param.yRot(), param.xRot());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package studio.fantasyit.maid_useful_task.vehicle.broom;
|
||||
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.item.EntityBroom;
|
||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import studio.fantasyit.maid_useful_task.util.RotUtil;
|
||||
import studio.fantasyit.maid_useful_task.vehicle.AbstractMaidControllableVehicle;
|
||||
import studio.fantasyit.maid_useful_task.vehicle.MaidVehicleControlType;
|
||||
|
||||
public class VehicleBroom extends AbstractMaidControllableVehicle {
|
||||
@Override
|
||||
public boolean isMaidOnThisVehicle(EntityMaid maid) {
|
||||
return maid.getVehicle() instanceof EntityBroom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maidControlVehicle(EntityMaid maid, MaidVehicleControlType type, BlockPos target) {
|
||||
if (maid.level().isClientSide) return;
|
||||
if (maid.getVehicle() instanceof EntityBroom vehicle) {
|
||||
if (type == MaidVehicleControlType.NONE) {
|
||||
BroomControlParamStore.removeControlParam(maid);
|
||||
return;
|
||||
}
|
||||
double xzDistance = maid.distanceToSqr(target.getX(), maid.getY(), target.getZ());
|
||||
double finalXRot = vehicle.getXRot();
|
||||
double finalYRot = vehicle.getYRot();
|
||||
double finalVertical = 0;
|
||||
double finalForward;
|
||||
if (vehicle.isInWater()) {
|
||||
finalXRot = 0;
|
||||
finalVertical = 0.1;
|
||||
} else if (xzDistance < Math.pow(maid.getY() - maid.level().getSeaLevel(), 2)) {
|
||||
finalXRot = 0;
|
||||
if (maid.getY() - maid.level().getSeaLevel() < 50 || vehicle.onGround()) {
|
||||
finalXRot = 5;
|
||||
finalVertical = -0.2;
|
||||
} else {
|
||||
finalXRot = 50;
|
||||
finalVertical = -0.35;
|
||||
}
|
||||
} else if (maid.getY() < 100) {
|
||||
finalXRot = -50;
|
||||
finalVertical = 0.2;
|
||||
} else if (maid.getY() > 160) {
|
||||
finalXRot = 0;
|
||||
finalVertical = -0.1;
|
||||
} else {
|
||||
finalXRot = 0;
|
||||
finalVertical = 0.05;
|
||||
}
|
||||
|
||||
finalYRot = RotUtil.getYRot(maid.position(), target.getCenter());
|
||||
|
||||
finalForward = type == MaidVehicleControlType.FULL ? 3.0 : 0;
|
||||
if (xzDistance < 5 * 5)
|
||||
finalForward = 0;
|
||||
|
||||
BroomControlParamStore.setControlParam(maid, new BroomControlParamStore.BroomControlParam((float) finalXRot, (float) finalYRot, (float) finalVertical, (float) finalForward, type));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maidStopControlVehicle(EntityMaid maid) {
|
||||
BroomControlParamStore.removeControlParam(maid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncVehicleParameter(EntityMaid maid, CompoundTag tag) {
|
||||
BroomControlParamStore.BroomControlParam broomControlParam = BroomControlParamStore.BroomControlParam.fromNbt(tag);
|
||||
BroomControlParamStore.setControlParam(maid, broomControlParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable CompoundTag getSyncVehicleParameter(EntityMaid maid) {
|
||||
return BroomControlParamStore.getControlParam(maid).toNbt();
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,14 @@ description='''${mod_description}'''
|
||||
[[dependencies."${mod_id}"]]
|
||||
modId="touhou_little_maid"
|
||||
mandatory=true
|
||||
versionRange="[1.2.2,)"
|
||||
versionRange="[1.3.7,)"
|
||||
ordering="AFTER"
|
||||
side="BOTH"
|
||||
[[dependencies."${mod_id}"]]
|
||||
modId="playerrevive"
|
||||
mandatory=false
|
||||
versionRange="[2.0.16,)"
|
||||
ordering="AFTER"
|
||||
side="BOTH"
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"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.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.desc": "The maid will revive nearby bleeding player.",
|
||||
"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.rot_only": "Allow maid control rotation only",
|
||||
@@ -10,5 +12,8 @@
|
||||
"key.maid_useful_tasks.categories.main": "Maid Useful Tasks",
|
||||
"gui.maid_useful_task.logging.plant": "Plant Saplings",
|
||||
"gui.maid_useful_task.no": "No",
|
||||
"gui.maid_useful_task.yes": "Yes"
|
||||
"gui.maid_useful_task.yes": "Yes",
|
||||
"gui.maid_useful_task.revive.ownerOnly": "Only revive owner",
|
||||
"gui.maid_useful_task.logging.block_up": "Block Up",
|
||||
"gui.maid_useful_task.logging.skip_non_nature": "Skip Non-nature Logs"
|
||||
}
|
||||
@@ -1,11 +1,19 @@
|
||||
{
|
||||
"key.maid_useful_tasks.categories.main": "女仆实用任务",
|
||||
"task.maid_useful_task.maid_tree": "伐木",
|
||||
"task.maid_useful_task.maid_tree.desc": "女仆会砍伐身边的原木并种下树苗",
|
||||
"task.maid_useful_task.locate": "定位",
|
||||
"task.maid_useful_task.locate.desc": "女仆会根据手持物品定位指定的结构或你的出生点",
|
||||
"task.maid_useful_task.revive_player": "救援玩家",
|
||||
"task.maid_useful_task.revive_player.desc": "女仆会救援附近倒地的玩家",
|
||||
"key.maid_useful_tasks.switch_vehicle_control": "切换载具控制模式",
|
||||
"maid_useful_task.allow_handle_vehicle.full": "允许女仆控制载具",
|
||||
"maid_useful_task.allow_handle_vehicle.none": "不允许女仆控制载具",
|
||||
"maid_useful_task.allow_handle_vehicle.rot_only": "只允许女仆控制旋转",
|
||||
"task.maid_useful_task.locate": "定位",
|
||||
"task.maid_useful_task.locate.description": "女仆会根据手持物品定位指定的结构或你的出生点",
|
||||
"task.maid_useful_task.maid_tree": "伐木",
|
||||
"task.maid_useful_task.maid_tree.description": "女仆会砍伐身边的原木并种下树苗"
|
||||
"maid_useful_task.allow_handle_vehicle.full": "允许女仆控制载具",
|
||||
"key.maid_useful_tasks.categories.main": "女仆实用任务",
|
||||
"gui.maid_useful_task.logging.plant": "种植树苗",
|
||||
"gui.maid_useful_task.no": "否",
|
||||
"gui.maid_useful_task.yes": "是",
|
||||
"gui.maid_useful_task.revive.ownerOnly": "只救援主人",
|
||||
"gui.maid_useful_task.logging.block_up": "上搭方块",
|
||||
"gui.maid_useful_task.logging.skip_non_nature": "跳过非自然原木"
|
||||
}
|
||||
@@ -8,8 +8,7 @@
|
||||
"FollowMaidMixin",
|
||||
"MaidCheckPickupItem",
|
||||
"MaidMoveControlMixin",
|
||||
"MaidRunOneMixin",
|
||||
"VehicleBroomMixin"
|
||||
"MaidRunOneMixin"
|
||||
],
|
||||
"client": [
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user