pre修改:进一步完善命令
This commit is contained in:
parent
08aae0f1e1
commit
b50e28f280
138
build.gradle
138
build.gradle
|
|
@ -197,33 +197,60 @@ tasks.named('javadoc', Javadoc).configure {
|
|||
options.links("https://docs.oracle.com/en/java/javase/17/docs/api/")
|
||||
options.memberLevel = JavadocMemberLevel.PUBLIC
|
||||
options.addBooleanOption('Xdoclint:none', true)
|
||||
options.addStringOption('doctitle', "${mod_id} ${mod_version} Javadoc")
|
||||
options.addStringOption('doctitle', "${mod_id} ${minecraft_version} ${mod_version} Javadoc")
|
||||
}
|
||||
// =====================(class/ java) =====================
|
||||
tasks.register('deobfJar', Jar) {
|
||||
from(sourceSets.main.output) // class
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_id,
|
||||
'Specification-Vendor' : mod_authors,
|
||||
'Specification-Version' : '1',
|
||||
'Implementation-Title' : project.name,
|
||||
'Implementation-Version' : archiveVersion,
|
||||
'Implementation-Vendor' : mod_authors,
|
||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
])
|
||||
}
|
||||
dependsOn classes
|
||||
}
|
||||
tasks.register('sourceJar', Jar) {
|
||||
from(sourceSets.main.allSource) // java
|
||||
archiveFileName = "${mod_id}-${minecraft_version}-${mod_version}-sources.jar"
|
||||
archiveClassifier.set("sources")
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_id,
|
||||
'Specification-Vendor' : mod_authors,
|
||||
'Specification-Version' : '1',
|
||||
'Implementation-Title' : project.name,
|
||||
'Implementation-Version' : archiveVersion,
|
||||
'Implementation-Vendor' : mod_authors,
|
||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
])
|
||||
}
|
||||
dependsOn classes
|
||||
}
|
||||
|
||||
// ===================== 普通 Javadoc =====================
|
||||
tasks.register('javadocJar', Jar) {
|
||||
archiveClassifier.set('javadoc')
|
||||
archiveFileName = "${mod_id}-${minecraft_version}-${mod_version}-javadoc.jar"
|
||||
archiveClassifier.set("javadoc")
|
||||
from tasks.javadoc
|
||||
dependsOn tasks.javadoc
|
||||
}
|
||||
|
||||
tasks.register('apiJavadocJar', Jar) {
|
||||
archiveClassifier.set('api-javadoc')
|
||||
from tasks.javadoc
|
||||
include "top/r3944realms/superleadrope/api/**/*"
|
||||
dependsOn tasks.javadoc
|
||||
}
|
||||
|
||||
|
||||
// ===================== API Jar(class + java 混杂) =====================
|
||||
// ===================== API Jar(class / java) =====================
|
||||
tasks.register('apiJar', Jar) {
|
||||
archiveClassifier.set('api')
|
||||
archiveFileName = "${mod_id}-${minecraft_version}-${mod_version}-api.jar"
|
||||
archiveClassifier.set("api")
|
||||
manifest {
|
||||
attributes 'FMLModType': 'GAMELIBRARY'
|
||||
}
|
||||
|
||||
// 打包 class 和 java
|
||||
from(sourceSets.main.allSource) // java
|
||||
from(sourceSets.main.output) { // class
|
||||
exclude 'assets/**', 'data/**'
|
||||
}
|
||||
|
|
@ -233,6 +260,31 @@ tasks.register('apiJar', Jar) {
|
|||
|
||||
dependsOn classes
|
||||
}
|
||||
tasks.register('apiSourceJar', Jar) {
|
||||
archiveFileName = "${mod_id}-${minecraft_version}-${mod_version}-api-sources.jar"
|
||||
archiveClassifier.set("api-sources")
|
||||
manifest {
|
||||
attributes 'FMLModType': 'GAMELIBRARY'
|
||||
}
|
||||
|
||||
// 打包 class 和 java
|
||||
from(sourceSets.main.allSource) { // java
|
||||
exclude 'assets/**', 'data/**'
|
||||
}
|
||||
|
||||
include "top/r3944realms/superleadrope/api/**/*"
|
||||
include "top/r3944realms/superleadrope/SuperLeadRopeAPI.*"
|
||||
|
||||
dependsOn classes
|
||||
}
|
||||
|
||||
tasks.register('apiJavadocJar', Jar) {
|
||||
archiveFileName = "${mod_id}-${minecraft_version}-${mod_version}-api-javadoc.jar"
|
||||
archiveClassifier.set("api-javadoc")
|
||||
from tasks.javadoc
|
||||
include "top/r3944realms/superleadrope/api/**/*"
|
||||
dependsOn tasks.javadoc
|
||||
}
|
||||
|
||||
tasks.register('apiJavadoc', Javadoc) {
|
||||
group = 'documentation'
|
||||
|
|
@ -252,31 +304,8 @@ tasks.register('apiJavadoc', Javadoc) {
|
|||
options.addStringOption('doctitle', "${mod_name} API ${mod_version} Javadoc")
|
||||
}
|
||||
|
||||
tasks.register('javadocApiJar', Jar) {
|
||||
archiveClassifier.set('api-javadoc')
|
||||
from tasks.apiJavadoc
|
||||
dependsOn tasks.apiJavadoc
|
||||
}
|
||||
// ===================== 主包完整 Jar(class + java) =====================
|
||||
tasks.register('fullJar', Jar) {
|
||||
archiveClassifier.set('all') // Maven 上会是 -all.jar
|
||||
from(sourceSets.main.allSource) // java
|
||||
from(sourceSets.main.output) // class
|
||||
// === 避免重复打包资源(即使混入其他 jar 时也不会重复) ===
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_id,
|
||||
'Specification-Vendor' : mod_authors,
|
||||
'Specification-Version' : '1',
|
||||
'Implementation-Title' : project.name,
|
||||
'Implementation-Version' : archiveVersion,
|
||||
'Implementation-Vendor' : mod_authors,
|
||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
])
|
||||
}
|
||||
dependsOn classes
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ===================== 主 Jar 与混淆 =====================
|
||||
jar {
|
||||
|
|
@ -291,10 +320,7 @@ jar {
|
|||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
])
|
||||
}
|
||||
archiveFileName = "${mod_id}-${mod_version}-origin.jar"
|
||||
|
||||
// 可选:排除 API 类(如果你不想在主 jar 中包含 API)
|
||||
// exclude "top/r3944realms/superleadrope/api/**/*"
|
||||
archiveFileName = "${mod_id}-${minecraft_version}-${mod_version}-origin.jar"
|
||||
|
||||
finalizedBy 'proguard'
|
||||
}
|
||||
|
|
@ -374,10 +400,11 @@ publishing {
|
|||
mavenJava(MavenPublication) {
|
||||
artifactId = mod_id
|
||||
|
||||
artifact fullJar
|
||||
artifact apiJar
|
||||
// 可选
|
||||
artifact deobfJar
|
||||
artifact sourceJar
|
||||
artifact javadocJar
|
||||
artifact apiJar
|
||||
artifact apiSourceJar
|
||||
artifact apiJavadocJar
|
||||
|
||||
pom {
|
||||
|
|
@ -402,7 +429,8 @@ publishing {
|
|||
|
||||
repositories {
|
||||
maven {
|
||||
url "file://${project.projectDir}/mcmodsrepo"
|
||||
name = "local"
|
||||
url = layout.buildDirectory.dir("repo")
|
||||
}
|
||||
maven {
|
||||
name = 'LTDNexus'
|
||||
|
|
@ -417,7 +445,7 @@ publishing {
|
|||
|
||||
// ===================== 构建任务依赖 =====================
|
||||
tasks.named('build') {
|
||||
dependsOn apiJar, javadocApiJar
|
||||
dependsOn apiJar, apiJavadocJar
|
||||
}
|
||||
|
||||
tasks.named('clean') {
|
||||
|
|
@ -458,3 +486,17 @@ idea {
|
|||
downloadJavadoc = true
|
||||
}
|
||||
}
|
||||
afterEvaluate {
|
||||
tasks.named('deobfJar') {
|
||||
doLast {
|
||||
def jar = file(layout.buildDirectory.dir("repo") + "${mod_id}-${minecraft_version}-${mod_version}.jar")
|
||||
if (jar.exists()) ant.delete(jar)
|
||||
}
|
||||
}
|
||||
tasks.named('apiJar') {
|
||||
doLast {
|
||||
def jar = file(layout.buildDirectory.dir("repo") + "${mod_id}-${minecraft_version}-${mod_version}-api.jar")
|
||||
if (jar.exists()) ant.delete(jar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
mod_license=GPLv3
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=0.0.0.6-pre7
|
||||
mod_version=0.0.0.6-pre10
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ import top.r3944realms.superleadrope.content.capability.CapabilityHandler;
|
|||
import top.r3944realms.superleadrope.content.capability.CapabilityRemainder;
|
||||
import top.r3944realms.superleadrope.content.capability.impi.LeashDataImpl;
|
||||
import top.r3944realms.superleadrope.content.capability.inter.IEternalPotato;
|
||||
import top.r3944realms.superleadrope.content.command.LeashDataCommand;
|
||||
import top.r3944realms.superleadrope.content.command.MotionCommand;
|
||||
import top.r3944realms.superleadrope.content.entity.SuperLeashKnotEntity;
|
||||
import top.r3944realms.superleadrope.content.gamerule.server.TeleportWithLeashedEntities;
|
||||
|
|
@ -477,6 +478,7 @@ public class CommonEventHandler {
|
|||
public static void onRegisterCommand (RegisterCommandsEvent event) {
|
||||
CommandDispatcher<CommandSourceStack> dispatcher = event.getDispatcher();
|
||||
MotionCommand.register(dispatcher);
|
||||
LeashDataCommand.register(dispatcher);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ public class SuperLeadRopeApi {
|
|||
* @param clazz the clazz
|
||||
* @param box the box
|
||||
* @param filter the filter
|
||||
*
|
||||
* @return the list
|
||||
*/
|
||||
public static <T extends Entity> @NotNull List<T> leashableInArea(Entity holder, Class<T> clazz, AABB box, Predicate<T> filter) {
|
||||
|
|
|
|||
|
|
@ -621,6 +621,20 @@ public interface ILeashData extends INBTSerializable<CompoundTag> {
|
|||
*/
|
||||
Collection<LeashInfo> getAllLeashes();
|
||||
|
||||
/**
|
||||
* Gets all leashes.
|
||||
*
|
||||
* @return the all leashes
|
||||
*/
|
||||
Collection<LeashInfo> getAllHolderLeashes();
|
||||
|
||||
/**
|
||||
* Gets all leashes.
|
||||
*
|
||||
* @return the all leashes
|
||||
*/
|
||||
Collection<LeashInfo> getAllKnotLeashes();
|
||||
|
||||
/**
|
||||
* Is leashed by boolean.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -77,26 +77,28 @@ public interface ILeashHelper {
|
|||
default Set<Entity> getAllLeashedEntities() {
|
||||
return getAllLeash().stream().map(ILeashData::self).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该实体持有的指定实体实例
|
||||
*
|
||||
* @param clazz 实体类型
|
||||
* @param box 搜索范围
|
||||
* @param <T> the type parameter
|
||||
* @param clazz 实体类型
|
||||
* @param box 搜索范围
|
||||
* @param filter {@link Predicate<Entity> 实体过滤器}
|
||||
*
|
||||
* @return {@link Set<Entity> 持有的实体集合}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
default <T extends Entity> Set<T> getLeashEntities (Class<T> clazz, AABB box, Predicate<T> filter) {
|
||||
return (Set<T>) getLeash(clazz, box, filter).stream().map(ILeashData::self).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该实体持有的符合条件实体的拴绳数据能力
|
||||
*
|
||||
* @param clazz 实体类型
|
||||
* @param box 搜索范围
|
||||
* @param <T> the type parameter
|
||||
* @param clazz 实体类型
|
||||
* @param box 搜索范围
|
||||
* @param filter {@link Predicate<Entity> 实体过滤器}
|
||||
*
|
||||
* @return {@link Set<ILeashData> 持有的实体的拴绳数据能力集合}
|
||||
*/
|
||||
<T extends Entity> Set<ILeashData> getLeash(Class<T> clazz, AABB box, Predicate<T> filter);
|
||||
|
|
@ -104,10 +106,10 @@ public interface ILeashHelper {
|
|||
/**
|
||||
* 获取该实体持有的符合条件实体实例
|
||||
*
|
||||
* @param clazz 实体类型
|
||||
* @param <T> the type parameter
|
||||
* @param clazz 实体类型
|
||||
* @param fetchDistance 搜索范围(以实体为中心的正方体{@link AABB#ofSize(Vec3, double, double, double) 包围盒})
|
||||
* @param filter {@link Predicate<Entity> 实体过滤器}
|
||||
*
|
||||
* @param filter {@link Predicate<Entity> 实体过滤器}
|
||||
* @return {@link Set<Entity> 持有的实体实例}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
@ -118,21 +120,22 @@ public interface ILeashHelper {
|
|||
/**
|
||||
* 获取该实体持有的符合条件实体的拴绳数据能力
|
||||
*
|
||||
* @param clazz 实体类型
|
||||
* @param <T> the type parameter
|
||||
* @param clazz 实体类型
|
||||
* @param fetchDistance 搜索范围(以实体为中心的正方体{@link AABB#ofSize(Vec3, double, double, double) 包围盒})
|
||||
* @param filter {@link Predicate<Entity> 实体过滤器}
|
||||
*
|
||||
* @param filter {@link Predicate<Entity> 实体过滤器}
|
||||
* @return {@link Set<ILeashData> 持有的实体的拴绳数据能力集合}
|
||||
*/
|
||||
default <T extends Entity> Set<ILeashData> getLeash(Class<T> clazz, double fetchDistance, Predicate<T> filter) {
|
||||
return getLeash(clazz, AABB.ofSize(getHolderEntity().position(), fetchDistance, fetchDistance, fetchDistance), filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该实体持有的符合条件实体实例
|
||||
*
|
||||
* @param clazz 实体类型
|
||||
* @param <T> the type parameter
|
||||
* @param clazz 实体类型
|
||||
* @param filter {@link Predicate<Entity> 实体过滤器}
|
||||
*
|
||||
* @return {@link Set<Entity> 持有的实体实例}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
@ -143,19 +146,20 @@ public interface ILeashHelper {
|
|||
/**
|
||||
* 获取该实体持有的符合条件实体的拴绳数据能力
|
||||
*
|
||||
* @param clazz 实体类型
|
||||
* @param <T> the type parameter
|
||||
* @param clazz 实体类型
|
||||
* @param filter {@link Predicate<Entity> 实体过滤器}
|
||||
*
|
||||
* @return {@link Set<ILeashData> 持有的实体的拴绳数据能力集合}
|
||||
*/
|
||||
default <T extends Entity> Set<ILeashData> getLeash(Class<T> clazz, Predicate<T> filter) {
|
||||
return getLeash(clazz, 1024D, filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该实体持有的符合条件实体实例
|
||||
*
|
||||
* @param <T> the type parameter
|
||||
* @param clazz 实体类型
|
||||
*
|
||||
* @return {@link Set<Entity> 持有的实体实例}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
@ -166,8 +170,8 @@ public interface ILeashHelper {
|
|||
/**
|
||||
* 获取该实体持有的符合条件实体的拴绳数据能力
|
||||
*
|
||||
* @param <T> the type parameter
|
||||
* @param clazz 实体类型
|
||||
*
|
||||
* @return {@link Set<ILeashData> 持有的实体的拴绳数据能力集合}
|
||||
*/
|
||||
default <T extends Entity> Set<ILeashData> getLeash(Class<T> clazz) {
|
||||
|
|
@ -186,6 +190,8 @@ public interface ILeashHelper {
|
|||
|
||||
/**
|
||||
* 检查是否持有任何拴绳
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
default boolean hasLeashes() {
|
||||
return !getAllLeash().isEmpty();
|
||||
|
|
|
|||
|
|
@ -47,12 +47,11 @@ public interface IWorkSpaceHelper {
|
|||
/**
|
||||
* Leashable in area list.
|
||||
*
|
||||
* @param <T> 实体类型
|
||||
* @param pLevel the p level
|
||||
* @param clazz the clazz
|
||||
* @param filter the filter
|
||||
* @param box the box
|
||||
* @param <T> 实体类型
|
||||
*
|
||||
* @return the list
|
||||
*/
|
||||
@NotNull <T extends Entity> List<T> leashableInArea(@NotNull Level pLevel, Class<T> clazz,Predicate<T> filter, AABB box);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class LeashCommonConfig {
|
|||
/**
|
||||
* The Enable slp mod command prefix.
|
||||
*/
|
||||
// Command
|
||||
// Command
|
||||
public final ForgeConfigSpec.BooleanValue enableSLPModCommandPrefix;
|
||||
/**
|
||||
* The Slp mod command prefix.
|
||||
|
|
@ -47,13 +47,13 @@ public class LeashCommonConfig {
|
|||
/**
|
||||
* The Teleport whitelist.
|
||||
*/
|
||||
// Entity
|
||||
// Entity
|
||||
public final ForgeConfigSpec.ConfigValue<List<? extends String>> teleportWhitelist;
|
||||
|
||||
/**
|
||||
* The Max leash length.
|
||||
*/
|
||||
// Leash settings
|
||||
// Leash settings
|
||||
public final ForgeConfigSpec.DoubleValue maxLeashLength;
|
||||
/**
|
||||
* The Elastic distance scale.
|
||||
|
|
@ -79,7 +79,7 @@ public class LeashCommonConfig {
|
|||
/**
|
||||
* The Enable true damping.
|
||||
*/
|
||||
// True damping
|
||||
// True damping
|
||||
public final ForgeConfigSpec.BooleanValue enableTrueDamping;
|
||||
/**
|
||||
* The Damping factor.
|
||||
|
|
@ -101,7 +101,7 @@ public class LeashCommonConfig {
|
|||
/**
|
||||
* The Default apply entity location offset.
|
||||
*/
|
||||
// Leash state offsets
|
||||
// Leash state offsets
|
||||
public final ForgeConfigSpec.ConfigValue<List<? extends String>> defaultApplyEntityLocationOffset;
|
||||
/**
|
||||
* The Default holder location offset.
|
||||
|
|
@ -111,7 +111,7 @@ public class LeashCommonConfig {
|
|||
/**
|
||||
* The constant OFFSET_PATTERN.
|
||||
*/
|
||||
// 正则表达式模式
|
||||
// 正则表达式模式
|
||||
static final Pattern OFFSET_PATTERN = Pattern.compile(
|
||||
"(?i)(?:vec3|vec3d|vector3|offset)\\s*\\(\\s*([-+]?[0-9]*\\.?[0-9]+)\\s*,\\s*([-+]?[0-9]*\\.?[0-9]+)\\s*,\\s*([-+]?[0-9]*\\.?[0-9]+)\\s*\\)\\s*:\\s*\\[\\s*([^]]+?)\\s*]\\s*"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1343,6 +1343,16 @@ public class LeashDataImpl implements ILeashData {
|
|||
).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<LeashInfo> getAllHolderLeashes() {
|
||||
return Collections.unmodifiableCollection(leashHolders.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<LeashInfo> getAllKnotLeashes() {
|
||||
return Collections.unmodifiableCollection(leashKnots.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashedBy(Entity holder) {
|
||||
return holder instanceof SuperLeashKnotEntity superLeashKnotEntity ?
|
||||
|
|
|
|||
|
|
@ -48,9 +48,38 @@ public class Command {
|
|||
* The constant ABBREVIATION.
|
||||
*/
|
||||
public static final String ABBREVIATION = BASE_ + "abbreviation";
|
||||
/**
|
||||
* The constant BLOCK_POS.
|
||||
*/
|
||||
public static final String BLOCK_POS = BASE_ + ".block_pos";
|
||||
/**
|
||||
* The constant SUC.
|
||||
*/
|
||||
public static final String SUC = "suc";
|
||||
/**
|
||||
* The constant FAIL.
|
||||
*/
|
||||
public static final String FAIL = "fail";
|
||||
/**
|
||||
* The constant SUC_FAIL.
|
||||
*/
|
||||
public static final String SUC_FAIL = "suc_fail";
|
||||
/**
|
||||
* The constant COLON.
|
||||
*/
|
||||
public static final String COLON = BASE_ + ".colon";
|
||||
|
||||
/**
|
||||
* The constant MAX_SHOW_NUMBER.
|
||||
*/
|
||||
public static final int MAX_SHOW_NUMBER = 4;
|
||||
|
||||
/**
|
||||
* Gets slp name.
|
||||
*
|
||||
* @param entity the entity
|
||||
* @return the slp name
|
||||
*/
|
||||
public static Component getSLPName(Entity entity) {
|
||||
if (entity instanceof SuperLeashKnotEntity superLeashKnot) {
|
||||
BlockPos pos = superLeashKnot.getPos();
|
||||
|
|
@ -58,6 +87,13 @@ public class Command {
|
|||
}
|
||||
return entity.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets slp name.
|
||||
*
|
||||
* @param pos the pos
|
||||
* @return the slp name
|
||||
*/
|
||||
public static Component getSLPName(BlockPos pos) {
|
||||
return Component.translatable(BLOCK_POS, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -27,7 +27,7 @@ public class LeashStateCommand {
|
|||
*
|
||||
* @param dispatcher the dispatcher
|
||||
*/
|
||||
// 获取State
|
||||
// 获取State
|
||||
// 设置State
|
||||
// <addApplyEntity/setApplyEntity/reset> Holder<BlockPos/Entity<需判断实体类型>> <Holder/Entity> <x> <y> <z>
|
||||
// 设置对应目标的 拴绳偏移
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ import net.minecraft.world.level.gameevent.GameEvent;
|
|||
import net.minecraft.world.phys.AABB;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import top.r3944realms.superleadrope.api.SuperLeadRopeApi;
|
||||
import top.r3944realms.superleadrope.content.capability.impi.LeashDataImpl;
|
||||
import top.r3944realms.superleadrope.content.item.SuperLeadRopeItem;
|
||||
import top.r3944realms.superleadrope.core.register.SLPEntityTypes;
|
||||
import top.r3944realms.superleadrope.util.capability.LeashDataInnerAPI;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ public class EternalPotatoItem extends Item {
|
|||
/**
|
||||
* 获取或生成 ItemStack 的唯一 UUID @param stack the stack
|
||||
*
|
||||
* @param stack the stack
|
||||
* @return the or create item uuid
|
||||
*/
|
||||
public static UUID getOrCreateItemUUID(ItemStack stack) {
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ public record PunishmentDefinition(PunishmentDefinition.Type type, float strengt
|
|||
|
||||
/**
|
||||
* 序列化到网络 @param buf the buf
|
||||
*
|
||||
* @param buf the buf
|
||||
*/
|
||||
public void toNetwork(FriendlyByteBuf buf) {
|
||||
buf.writeEnum(this.type);
|
||||
|
|
@ -68,6 +70,7 @@ public record PunishmentDefinition(PunishmentDefinition.Type type, float strengt
|
|||
/**
|
||||
* 从网络反序列化 @param buf the buf
|
||||
*
|
||||
* @param buf the buf
|
||||
* @return the punishment definition
|
||||
*/
|
||||
public static PunishmentDefinition fromNetwork(FriendlyByteBuf buf) {
|
||||
|
|
|
|||
|
|
@ -348,26 +348,6 @@ public enum SLPLangKeyValue {
|
|||
"§b倍乘成功.§a%s§7:§f[§e加速§7:(§a%.2f§7,§a%.2f§7,§a%.2f§7)§f]§r",
|
||||
"§b倍乘既成.§a%s§7:§f[§e速勢§7:(§a%.2f§7,§a%.2f§7,§a%.2f§7)§f]§r"
|
||||
),
|
||||
/**
|
||||
* The Message leashdata get title.
|
||||
*/
|
||||
MESSAGE_LEASHDATA_GET_TITLE(
|
||||
LeashDataCommand.TITLE, ModPartEnum.COMMAND,
|
||||
"=== Leash Data for %s ===",
|
||||
"=== %s 的拴绳数据 ===",
|
||||
"=== %s 的拴繩數據 ===",
|
||||
"=== %s 之繫繩數據 ==="
|
||||
),
|
||||
/**
|
||||
* The Message leashdata get total.
|
||||
*/
|
||||
MESSAGE_LEASHDATA_GET_TOTAL(
|
||||
LeashDataCommand.TOTAL, ModPartEnum.COMMAND,
|
||||
"Total leashes: %d",
|
||||
"总拴绳数: %d",
|
||||
"總拴繩數: %d",
|
||||
"繫繩總數: %d"
|
||||
),
|
||||
/**
|
||||
* Message leashdata get block slp lang key value.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -91,11 +91,11 @@ public final class LeashDataInnerAPI {
|
|||
/**
|
||||
* Attach boolean.
|
||||
*
|
||||
* @param entity the entity
|
||||
* @param holder the holder
|
||||
* @param maxDistance the max distance
|
||||
* @param entity the entity
|
||||
* @param holder the holder
|
||||
* @param maxDistance the max distance
|
||||
* @param elasticdDistanceScale the elastic distance
|
||||
* @param maxKeepTicks the max keep ticks
|
||||
* @param maxKeepTicks the max keep ticks
|
||||
* @return the boolean
|
||||
*/
|
||||
public static boolean attach(Entity entity, Entity holder, @Nullable Double maxDistance, @Nullable Double elasticdDistanceScale, int maxKeepTicks) {
|
||||
|
|
@ -118,12 +118,12 @@ public final class LeashDataInnerAPI {
|
|||
/**
|
||||
* Attach boolean.
|
||||
*
|
||||
* @param entity the entity
|
||||
* @param holder the holder
|
||||
* @param maxDistance the max distance
|
||||
* @param entity the entity
|
||||
* @param holder the holder
|
||||
* @param maxDistance the max distance
|
||||
* @param elasticDistanceScale the elastic distance
|
||||
* @param maxKeepTicks the max keep ticks
|
||||
* @param reserved the reserved
|
||||
* @param maxKeepTicks the max keep ticks
|
||||
* @param reserved the reserved
|
||||
* @return the boolean
|
||||
*/
|
||||
public static boolean attach(Entity entity, Entity holder, @Nullable Double maxDistance, @Nullable Double elasticDistanceScale, int maxKeepTicks, String reserved) {
|
||||
|
|
@ -240,16 +240,18 @@ public final class LeashDataInnerAPI {
|
|||
* @param distance the distance
|
||||
* @return the max distance
|
||||
*/
|
||||
// ---------------------- 设置最大距离 ----------------------
|
||||
// ---------------------- 设置最大距离 ----------------------
|
||||
public static boolean setMaxDistance(Entity entity, Entity holder, @Nullable Double distance) {
|
||||
return getLeashData(entity).map(data -> data.setMaxDistance(holder, distance)).orElse(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets max distance.
|
||||
*
|
||||
* @param entity the entity
|
||||
* @param holder the holder
|
||||
* @param distance the distance
|
||||
* @param reserved the reserved
|
||||
* @return the max distance
|
||||
*/
|
||||
public static boolean setMaxDistance(Entity entity, Entity holder, @Nullable Double distance, @Nullable String reserved) {
|
||||
|
|
@ -385,9 +387,9 @@ public final class LeashDataInnerAPI {
|
|||
/**
|
||||
* Sets elastic scale.
|
||||
*
|
||||
* @param entity the entity
|
||||
* @param holder the holder
|
||||
* @param scale the scale
|
||||
* @param entity the entity
|
||||
* @param holder the holder
|
||||
* @param scale the scale
|
||||
* @return the elastic scale
|
||||
*/
|
||||
// ---------------------- 设置弹性距离 ----------------------
|
||||
|
|
@ -400,7 +402,7 @@ public final class LeashDataInnerAPI {
|
|||
*
|
||||
* @param entity the entity
|
||||
* @param holder the holder
|
||||
* @param scale the scale
|
||||
* @param scale the scale
|
||||
* @param maxKeepTicks the max keep ticks
|
||||
* @return the elastic scale
|
||||
*/
|
||||
|
|
@ -413,7 +415,7 @@ public final class LeashDataInnerAPI {
|
|||
*
|
||||
* @param entity the entity
|
||||
* @param holder the holder
|
||||
* @param scale the scale
|
||||
* @param scale the scale
|
||||
* @param maxKeepTicks the max keep ticks
|
||||
* @param reserved the reserved
|
||||
* @return the elastic scale
|
||||
|
|
@ -433,7 +435,7 @@ public final class LeashDataInnerAPI {
|
|||
*
|
||||
* @param entity the entity
|
||||
* @param holderUUID the holder uuid
|
||||
* @param scale the scale
|
||||
* @param scale the scale
|
||||
* @return the elastic scale
|
||||
*/
|
||||
public static boolean setElasticDistanceScale(Entity entity, UUID holderUUID, @Nullable Double scale) {
|
||||
|
|
@ -445,7 +447,7 @@ public final class LeashDataInnerAPI {
|
|||
*
|
||||
* @param entity the entity
|
||||
* @param holderUUID the holder uuid
|
||||
* @param scale the scale
|
||||
* @param scale the scale
|
||||
* @param maxKeepTicks the max keep ticks
|
||||
* @return the elastic scale
|
||||
*/
|
||||
|
|
@ -458,7 +460,7 @@ public final class LeashDataInnerAPI {
|
|||
*
|
||||
* @param entity the entity
|
||||
* @param holderUUID the holder uuid
|
||||
* @param scale the scale
|
||||
* @param scale the scale
|
||||
* @param maxKeepTicks the max keep ticks
|
||||
* @param reserved the reserved
|
||||
* @return the elastic scale
|
||||
|
|
@ -476,9 +478,9 @@ public final class LeashDataInnerAPI {
|
|||
/**
|
||||
* Sets elastic scale.
|
||||
*
|
||||
* @param entity the entity
|
||||
* @param knotPos the knot pos
|
||||
* @param scale the scale
|
||||
* @param entity the entity
|
||||
* @param knotPos the knot pos
|
||||
* @param scale the scale
|
||||
* @return the elastic scale
|
||||
*/
|
||||
public static boolean setElasticDistanceScale(Entity entity, BlockPos knotPos, @Nullable Double scale) {
|
||||
|
|
@ -490,7 +492,7 @@ public final class LeashDataInnerAPI {
|
|||
*
|
||||
* @param entity the entity
|
||||
* @param knotPos the knot pos
|
||||
* @param scale the scale
|
||||
* @param scale the scale
|
||||
* @param maxKeepTicks the max keep ticks
|
||||
* @return the elastic scale
|
||||
*/
|
||||
|
|
@ -503,7 +505,7 @@ public final class LeashDataInnerAPI {
|
|||
*
|
||||
* @param entity the entity
|
||||
* @param knotPos the knot pos
|
||||
* @param scale the scale
|
||||
* @param scale the scale
|
||||
* @param maxKeepTicks the max keep ticks
|
||||
* @param reserved the reserved
|
||||
* @return the elastic scale
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user