更新版本 v1.1.0 -> v1.2.0
修复API方法
This commit is contained in:
parent
3a519afad2
commit
47ec1af5c1
|
|
@ -59,7 +59,7 @@ mod_name=Super Lead Rope
|
||||||
# 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=GPLv3
|
mod_license=GPLv3
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=1.1.0
|
mod_version=1.2.0
|
||||||
# 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
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import top.r3944realms.superleadrope.api.SuperLeadRopeApi;
|
||||||
import top.r3944realms.superleadrope.api.type.capabilty.ILeashData;
|
import top.r3944realms.superleadrope.api.type.capabilty.ILeashData;
|
||||||
import top.r3944realms.superleadrope.api.type.capabilty.LeashInfo;
|
import top.r3944realms.superleadrope.api.type.capabilty.LeashInfo;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
@ -211,7 +212,7 @@ public interface ILeashHelper {
|
||||||
* @return the boolean
|
* @return the boolean
|
||||||
*/
|
*/
|
||||||
default boolean isHoldingLeash(Entity entity) {
|
default boolean isHoldingLeash(Entity entity) {
|
||||||
return getAllLeash().stream().anyMatch(i -> i.isLeashedBy(entity));
|
return getAllLeash().stream().anyMatch(i -> Objects.equals(i.self(), entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -221,17 +222,7 @@ public interface ILeashHelper {
|
||||||
* @return the boolean
|
* @return the boolean
|
||||||
*/
|
*/
|
||||||
default boolean isHoldingLeash(UUID uuid) {
|
default boolean isHoldingLeash(UUID uuid) {
|
||||||
return getAllLeash().stream().anyMatch(i -> i.isLeashedBy(uuid));
|
return getAllLeash().stream().anyMatch(i -> Objects.equals(i.self().getUUID(), uuid));
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查是否持有特定实体的拴绳
|
|
||||||
*
|
|
||||||
* @param blockPos the block pos
|
|
||||||
* @return the boolean
|
|
||||||
*/
|
|
||||||
default boolean isHoldingLeash(BlockPos blockPos) {
|
|
||||||
return getAllLeash().stream().anyMatch(i -> i.isLeashedBy(blockPos));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -267,7 +258,7 @@ public interface ILeashHelper {
|
||||||
if (SuperLeadRopeApi.isLeashable(target)) {
|
if (SuperLeadRopeApi.isLeashable(target)) {
|
||||||
if (!isHoldingLeash(target)) {
|
if (!isHoldingLeash(target)) {
|
||||||
return false;
|
return false;
|
||||||
} else return unleashEntity(target.getUUID());
|
} else return unleashEntity(getHolderEntity().getUUID());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,11 @@ import top.r3944realms.superleadrope.SuperLeadRope;
|
||||||
public class JEIPlugin implements IModPlugin {
|
public class JEIPlugin implements IModPlugin {
|
||||||
private static final ResourceLocation UID = new ResourceLocation(SuperLeadRope.MOD_ID, "jei_plugin");
|
private static final ResourceLocation UID = new ResourceLocation(SuperLeadRope.MOD_ID, "jei_plugin");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets plugin uid.
|
||||||
|
*
|
||||||
|
* @return the plugin uid
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ResourceLocation getPluginUid() {
|
public @NotNull ResourceLocation getPluginUid() {
|
||||||
return UID;
|
return UID;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import top.r3944realms.superleadrope.network.NetworkHandler;
|
||||||
import top.r3944realms.superleadrope.network.toClient.CommonConfigHashInformPacket;
|
import top.r3944realms.superleadrope.network.toClient.CommonConfigHashInformPacket;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
|
|
@ -75,13 +74,13 @@ public class LeashConfigManager {
|
||||||
*/
|
*/
|
||||||
public volatile static int cacheHash = -1;
|
public volatile static int cacheHash = -1;
|
||||||
// ========== 偏移映射 ==========
|
// ========== 偏移映射 ==========
|
||||||
private final Map<String, double[]> entityHolderMap = new ConcurrentHashMap<>();
|
private final Map<String, double[]> entityHolderMap = new TreeMap<>();
|
||||||
private final Map<String, double[]> tagHolderMap = new ConcurrentHashMap<>();
|
private final Map<String, double[]> tagHolderMap = new TreeMap<>();
|
||||||
private final Map<String, double[]> modHolderMap = new ConcurrentHashMap<>();
|
private final Map<String, double[]> modHolderMap = new TreeMap<>();
|
||||||
|
|
||||||
private final Map<String, double[]> entityLeashMap = new ConcurrentHashMap<>();
|
private final Map<String, double[]> entityLeashMap = new TreeMap<>();
|
||||||
private final Map<String, double[]> tagLeashMap = new ConcurrentHashMap<>();
|
private final Map<String, double[]> tagLeashMap = new TreeMap<>();
|
||||||
private final Map<String, double[]> modLeashMap = new ConcurrentHashMap<>();
|
private final Map<String, double[]> modLeashMap = new TreeMap<>();
|
||||||
|
|
||||||
// ========== 缓存配置 ==========
|
// ========== 缓存配置 ==========
|
||||||
private volatile List<String> teleportWhitelistCache = Collections.emptyList();
|
private volatile List<String> teleportWhitelistCache = Collections.emptyList();
|
||||||
|
|
@ -110,9 +109,9 @@ public class LeashConfigManager {
|
||||||
|
|
||||||
// ================== 偏移解析 ==================
|
// ================== 偏移解析 ==================
|
||||||
private @NotNull @Unmodifiable Map<String, Map<String, double[]>> parseOffsetList(@NotNull List<? extends String> offsetConfigs) {
|
private @NotNull @Unmodifiable Map<String, Map<String, double[]>> parseOffsetList(@NotNull List<? extends String> offsetConfigs) {
|
||||||
Map<String, double[]> entityMap = new HashMap<>();
|
Map<String, double[]> entityMap = new TreeMap<>();
|
||||||
Map<String, double[]> tagMap = new HashMap<>();
|
Map<String, double[]> tagMap = new TreeMap<>();
|
||||||
Map<String, double[]> modMap = new HashMap<>();
|
Map<String, double[]> modMap = new TreeMap<>();
|
||||||
|
|
||||||
for (String config : offsetConfigs) {
|
for (String config : offsetConfigs) {
|
||||||
Matcher matcher = OFFSET_PATTERN.matcher(config);
|
Matcher matcher = OFFSET_PATTERN.matcher(config);
|
||||||
|
|
@ -566,7 +565,7 @@ public class LeashConfigManager {
|
||||||
Map<String, double[]> tagMap,
|
Map<String, double[]> tagMap,
|
||||||
Map<String, double[]> modMap) {
|
Map<String, double[]> modMap) {
|
||||||
|
|
||||||
Map<double[], Set<String>> offsetToTargets = new HashMap<>();
|
Map<double[], Set<String>> offsetToTargets = new LinkedHashMap<>();
|
||||||
|
|
||||||
// 收集entity映射
|
// 收集entity映射
|
||||||
for (Map.Entry<String, double[]> entry : entityMap.entrySet()) {
|
for (Map.Entry<String, double[]> entry : entityMap.entrySet()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user