bug修复
支持自然指南针和探索指南针
This commit is contained in:
@@ -168,10 +168,15 @@ dependencies {
|
|||||||
compileOnly fg.deobf("curse.maven:touhou-little-maid-355044:6596061")
|
compileOnly fg.deobf("curse.maven:touhou-little-maid-355044:6596061")
|
||||||
compileOnly fg.deobf("curse.maven:playerrevive-266890:6048921")
|
compileOnly fg.deobf("curse.maven:playerrevive-266890:6048921")
|
||||||
compileOnly fg.deobf("curse.maven:creativecore-257814:6383884")
|
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:touhou-little-maid-355044:6596061")
|
runtimeOnly fg.deobf("curse.maven:touhou-little-maid-355044:6596061")
|
||||||
runtimeOnly fg.deobf("curse.maven:maid-storage-manager-1210244:6455832")
|
runtimeOnly fg.deobf("curse.maven:maid-storage-manager-1210244:6455832")
|
||||||
runtimeOnly fg.deobf("curse.maven:playerrevive-266890:6048921")
|
runtimeOnly fg.deobf("curse.maven:playerrevive-266890:6048921")
|
||||||
runtimeOnly fg.deobf("curse.maven:creativecore-257814:6383884")
|
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"))
|
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.1"))
|
||||||
implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.4.1")) {
|
implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.4.1")) {
|
||||||
jarJar.ranged(it, "[0.4.1,)")
|
jarJar.ranged(it, "[0.4.1,)")
|
||||||
|
|||||||
@@ -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.4
|
mod_version=1.3.5
|
||||||
# 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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,6 +15,8 @@ public class MaidTickEvent {
|
|||||||
if (event.getMaid().getTask() instanceof IMaidVehicleControlTask imvc && event.getMaid().getVehicle() != null) {
|
if (event.getMaid().getTask() instanceof IMaidVehicleControlTask imvc && event.getMaid().getVehicle() != null) {
|
||||||
imvc.tick(sl, event.getMaid());
|
imvc.tick(sl, event.getMaid());
|
||||||
MaidVehicleManager.syncVehicleParameter(event.getMaid());
|
MaidVehicleManager.syncVehicleParameter(event.getMaid());
|
||||||
|
}else if(event.getMaid().getVehicle() != null){
|
||||||
|
MaidVehicleManager.stopControlling(event.getMaid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,13 +19,14 @@ import net.minecraft.world.item.CompassItem;
|
|||||||
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.item.MapItem;
|
||||||
import net.minecraft.world.level.saveddata.maps.MapDecoration;
|
|
||||||
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
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;
|
||||||
import studio.fantasyit.maid_useful_task.behavior.common.FindTargetMoveBehavior;
|
import studio.fantasyit.maid_useful_task.behavior.common.FindTargetMoveBehavior;
|
||||||
import studio.fantasyit.maid_useful_task.behavior.common.FindTargetWaitBehavior;
|
import studio.fantasyit.maid_useful_task.behavior.common.FindTargetWaitBehavior;
|
||||||
|
import studio.fantasyit.maid_useful_task.compat.CompatEntry;
|
||||||
|
import studio.fantasyit.maid_useful_task.compat.ExplorerCompass;
|
||||||
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
import studio.fantasyit.maid_useful_task.util.MemoryUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -73,7 +74,7 @@ public class MaidLocateTask implements IMaidTask, IMaidFindTargetTask {
|
|||||||
BlockPos target = null;
|
BlockPos target = null;
|
||||||
ItemStack itemStack = maid.getMainHandItem();
|
ItemStack itemStack = maid.getMainHandItem();
|
||||||
ItemStack last = MemoryUtil.getLocateItem(maid);
|
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.setLocateItem(maid, itemStack);
|
||||||
MemoryUtil.clearCommonBlockCache(maid);
|
MemoryUtil.clearCommonBlockCache(maid);
|
||||||
}
|
}
|
||||||
@@ -149,6 +150,11 @@ public class MaidLocateTask implements IMaidTask, IMaidFindTargetTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
target = CompatEntry.getLocateTarget(maid, maid.getMainHandItem());
|
||||||
|
if (target != null) {
|
||||||
|
MemoryUtil.setCommonBlockCache(maid, target);
|
||||||
|
return target;
|
||||||
|
}
|
||||||
MemoryUtil.clearCommonBlockCache(maid);
|
MemoryUtil.clearCommonBlockCache(maid);
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
|
|||||||
@@ -41,4 +41,8 @@ public class MaidVehicleManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void stopControlling(EntityMaid maid) {
|
||||||
|
MaidVehicleManager.getControllableVehicle(maid).ifPresent(vehicle -> vehicle.maidStopControlVehicle(maid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user