修复部分bug
This commit is contained in:
@@ -38,7 +38,7 @@ mod_name=maid useful task
|
|||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=MIT
|
mod_license=MIT
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=1.3.0
|
mod_version=1.3.1
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
# This should match the base package used for the mod sources.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ public class Config {
|
|||||||
private static final ForgeConfigSpec.BooleanValue ENABLE_REVIVE_TOTEM = BUILDER
|
private static final ForgeConfigSpec.BooleanValue ENABLE_REVIVE_TOTEM = BUILDER
|
||||||
.define("revive.totem", true);
|
.define("revive.totem", true);
|
||||||
|
|
||||||
|
private static final ForgeConfigSpec.BooleanValue ENABLE_VEHICLE_CONTROL_FULL = BUILDER
|
||||||
|
.define("vehicle_control.full", true);
|
||||||
|
private static final ForgeConfigSpec.BooleanValue ENABLE_VEHICLE_CONTROL_ROTATE = BUILDER
|
||||||
|
.define("vehicle_control.rotate", true);
|
||||||
|
|
||||||
static final ForgeConfigSpec SPEC = BUILDER.build();
|
static final ForgeConfigSpec SPEC = BUILDER.build();
|
||||||
|
|
||||||
@@ -35,6 +39,8 @@ public class Config {
|
|||||||
public static boolean enableReviveAggro = false;
|
public static boolean enableReviveAggro = false;
|
||||||
public static boolean enableReviveTotem = false;
|
public static boolean enableReviveTotem = false;
|
||||||
|
|
||||||
|
public static boolean enableVehicleControlFull = false;
|
||||||
|
public static boolean enableVehicleControlRotate = false;
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
static void onLoad(final ModConfigEvent event) {
|
static void onLoad(final ModConfigEvent event) {
|
||||||
enableLoggingTask = ENABLE_LOGGING.get();
|
enableLoggingTask = ENABLE_LOGGING.get();
|
||||||
@@ -42,5 +48,7 @@ public class Config {
|
|||||||
enableLocateTask = ENABLE_LOCATE.get();
|
enableLocateTask = ENABLE_LOCATE.get();
|
||||||
enableReviveAggro = ENABLE_REVIVE_AGGRO.get();
|
enableReviveAggro = ENABLE_REVIVE_AGGRO.get();
|
||||||
enableReviveTotem = ENABLE_REVIVE_TOTEM.get();
|
enableReviveTotem = ENABLE_REVIVE_TOTEM.get();
|
||||||
|
enableVehicleControlFull = ENABLE_VEHICLE_CONTROL_FULL.get();
|
||||||
|
enableVehicleControlRotate = ENABLE_VEHICLE_CONTROL_ROTATE.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class MaidReviveConfigGui extends MaidTaskConfigGui<MaidReviveConfigGui.C
|
|||||||
|
|
||||||
public static class Container extends TaskConfigContainer {
|
public static class Container extends TaskConfigContainer {
|
||||||
public Container(int id, Inventory inventory, int entityId) {
|
public Container(int id, Inventory inventory, int entityId) {
|
||||||
super(GuiRegistry.MAID_LOGGING_CONFIG_GUI.get(), id, inventory, entityId);
|
super(GuiRegistry.MAID_REVIVE_CONFIG_GUI.get(), id, inventory, entityId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.minecraft.server.level.ServerPlayer;
|
|||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import studio.fantasyit.maid_useful_task.Config;
|
||||||
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||||
import studio.fantasyit.maid_useful_task.vehicle.MaidVehicleControlType;
|
import studio.fantasyit.maid_useful_task.vehicle.MaidVehicleControlType;
|
||||||
|
|
||||||
@@ -34,6 +35,10 @@ public class MaidAllowHandleVehicle {
|
|||||||
if (entity instanceof EntityMaid maid) {
|
if (entity instanceof EntityMaid maid) {
|
||||||
MaidVehicleControlType[] values = MaidVehicleControlType.values();
|
MaidVehicleControlType[] values = MaidVehicleControlType.values();
|
||||||
MaidVehicleControlType allowMode = values[(MemoryUtil.getAllowHandleVehicle(maid).ordinal() + 1) % values.length];
|
MaidVehicleControlType allowMode = values[(MemoryUtil.getAllowHandleVehicle(maid).ordinal() + 1) % values.length];
|
||||||
|
while ((allowMode == MaidVehicleControlType.FULL && !Config.enableVehicleControlFull)
|
||||||
|
|| (allowMode == MaidVehicleControlType.ROT_ONLY && !Config.enableVehicleControlRotate)) {
|
||||||
|
allowMode = values[(allowMode.ordinal() + 1) % values.length];
|
||||||
|
}
|
||||||
MemoryUtil.setAllowHandleVehicle(maid, allowMode);
|
MemoryUtil.setAllowHandleVehicle(maid, allowMode);
|
||||||
Component component = switch (allowMode) {
|
Component component = switch (allowMode) {
|
||||||
case NONE -> Component.translatable("maid_useful_task.allow_handle_vehicle.none");
|
case NONE -> Component.translatable("maid_useful_task.allow_handle_vehicle.none");
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.github.tartaricacid.touhoulittlemaid.api.task.IMaidTask;
|
|||||||
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
@@ -12,6 +14,9 @@ import net.minecraft.world.entity.LivingEntity;
|
|||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.item.MapItem;
|
||||||
|
import net.minecraft.world.level.saveddata.maps.MapDecoration;
|
||||||
|
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import studio.fantasyit.maid_useful_task.Config;
|
import studio.fantasyit.maid_useful_task.Config;
|
||||||
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
import studio.fantasyit.maid_useful_task.MaidUsefulTask;
|
||||||
@@ -53,10 +58,12 @@ public class MaidLocateTask implements IMaidTask, IMaidFindTargetTask {
|
|||||||
public boolean enableLookAndRandomWalk(EntityMaid maid) {
|
public boolean enableLookAndRandomWalk(EntityMaid maid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnable(EntityMaid maid) {
|
public boolean isEnable(EntityMaid maid) {
|
||||||
return Config.enableLocateTask;
|
return Config.enableLocateTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable BlockPos findTarget(ServerLevel level, EntityMaid maid) {
|
public @Nullable BlockPos findTarget(ServerLevel level, EntityMaid maid) {
|
||||||
BlockPos target = null;
|
BlockPos target = null;
|
||||||
@@ -83,6 +90,35 @@ public class MaidLocateTask implements IMaidTask, IMaidFindTargetTask {
|
|||||||
target = owner.getSleepingPos().orElse(maid.level().getSharedSpawnPos());
|
target = owner.getSleepingPos().orElse(maid.level().getSharedSpawnPos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (maid.getMainHandItem().is(Items.FILLED_MAP)) {
|
||||||
|
target = MemoryUtil.getCommonBlockCache(maid);
|
||||||
|
if (target == null) {
|
||||||
|
MapItemSavedData savedData = MapItem.getSavedData(itemStack, maid.level());
|
||||||
|
if (savedData != null) {
|
||||||
|
BlockPos.MutableBlockPos tmpTarget = new BlockPos.MutableBlockPos(savedData.centerX, level.getSeaLevel(), savedData.centerZ);
|
||||||
|
|
||||||
|
CompoundTag tag = itemStack.getOrCreateTag();
|
||||||
|
savedData.getBanners()
|
||||||
|
.stream()
|
||||||
|
.findFirst()
|
||||||
|
.ifPresent(t -> {
|
||||||
|
tmpTarget.set(t.getPos().immutable());
|
||||||
|
});
|
||||||
|
tag.getList("Decorations", Tag.TAG_COMPOUND)
|
||||||
|
.stream()
|
||||||
|
.filter(t -> ((CompoundTag) t).getByte("type") == 26)
|
||||||
|
.findFirst()
|
||||||
|
.ifPresent(t -> {
|
||||||
|
CompoundTag decoration = (CompoundTag) t;
|
||||||
|
tmpTarget.setX(decoration.getInt("x"));
|
||||||
|
tmpTarget.setZ(decoration.getInt("z"));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
target = tmpTarget.immutable();
|
||||||
|
MemoryUtil.setCommonBlockCache(maid, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
MemoryUtil.clearCommonBlockCache(maid);
|
MemoryUtil.clearCommonBlockCache(maid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"task.maid_useful_task.maid_tree": "Logging",
|
"task.maid_useful_task.maid_tree": "Logging",
|
||||||
"task.maid_useful_task.maid_tree.description": "The maid will cut down the logs around her and plant saplings.",
|
"task.maid_useful_task.maid_tree.desc": "The maid will cut down the logs around her and plant saplings.",
|
||||||
"task.maid_useful_task.locate": "Locate",
|
"task.maid_useful_task.locate": "Locate",
|
||||||
"task.maid_useful_task.locate.description": "The maid can locate the some structure or your home with specific items.",
|
"task.maid_useful_task.locate.desc": "The maid can locate the some structure or your home with specific items.",
|
||||||
"task.maid_useful_task.revive_player": "Revive Player",
|
"task.maid_useful_task.revive_player": "Revive Player",
|
||||||
"task.maid_useful_task.revive_player.description": "The maid will revive nearby bleeding player.",
|
"task.maid_useful_task.revive_player.desc": "The maid will revive nearby bleeding player.",
|
||||||
"key.maid_useful_tasks.switch_vehicle_control": "Switch Vehicle Control Mode",
|
"key.maid_useful_tasks.switch_vehicle_control": "Switch Vehicle Control Mode",
|
||||||
"maid_useful_task.allow_handle_vehicle.none": "Not allowing maid control vehicle",
|
"maid_useful_task.allow_handle_vehicle.none": "Not allowing maid control vehicle",
|
||||||
"maid_useful_task.allow_handle_vehicle.rot_only": "Allow maid control rotation only",
|
"maid_useful_task.allow_handle_vehicle.rot_only": "Allow maid control rotation only",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"gui.maid_useful_task.logging.plant": "种植树苗",
|
"gui.maid_useful_task.logging.plant": "种植树苗",
|
||||||
"gui.maid_useful_task.no": "否",
|
"gui.maid_useful_task.no": "否",
|
||||||
"gui.maid_useful_task.revive.ownerOnly": "Only revive owner",
|
"gui.maid_useful_task.revive.ownerOnly": "只救援主人",
|
||||||
"gui.maid_useful_task.yes": "是",
|
"gui.maid_useful_task.yes": "是",
|
||||||
"key.maid_useful_tasks.categories.main": "女仆实用任务",
|
"key.maid_useful_tasks.categories.main": "女仆实用任务",
|
||||||
"key.maid_useful_tasks.switch_vehicle_control": "切换载具控制模式",
|
"key.maid_useful_tasks.switch_vehicle_control": "切换载具控制模式",
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
"maid_useful_task.allow_handle_vehicle.none": "不允许女仆控制载具",
|
"maid_useful_task.allow_handle_vehicle.none": "不允许女仆控制载具",
|
||||||
"maid_useful_task.allow_handle_vehicle.rot_only": "只允许女仆控制旋转",
|
"maid_useful_task.allow_handle_vehicle.rot_only": "只允许女仆控制旋转",
|
||||||
"task.maid_useful_task.locate": "定位",
|
"task.maid_useful_task.locate": "定位",
|
||||||
"task.maid_useful_task.locate.description": "女仆会根据手持物品定位指定的结构或你的出生点",
|
"task.maid_useful_task.locate.desc": "女仆会根据手持物品定位指定的结构或你的出生点",
|
||||||
"task.maid_useful_task.maid_tree": "伐木",
|
"task.maid_useful_task.maid_tree": "伐木",
|
||||||
"task.maid_useful_task.maid_tree.description": "女仆会砍伐身边的原木并种下树苗",
|
"task.maid_useful_task.maid_tree.desc": "女仆会砍伐身边的原木并种下树苗",
|
||||||
"task.maid_useful_task.revive_player": "救援玩家",
|
"task.maid_useful_task.revive_player": "救援玩家",
|
||||||
"task.maid_useful_task.revive_player.description": "女仆会救援附近倒地的玩家"
|
"task.maid_useful_task.revive_player.desc": "女仆会救援附近倒地的玩家"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user