更新内容
1. 初始化部分JavaDoc
This commit is contained in:
parent
f062be7f51
commit
c0a25f9172
|
|
@ -66,15 +66,29 @@ public class Lib39 {
|
|||
return new ResourceLocation(MOD_ID, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rl resource location.
|
||||
*
|
||||
* @param modId the mod id
|
||||
* @param path the path
|
||||
* @return the resource location
|
||||
*/
|
||||
@Contract("_, _ -> new")
|
||||
public static @NotNull ResourceLocation rl(String modId, String path) {
|
||||
return new ResourceLocation(modId, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mrl resource location.
|
||||
*
|
||||
* @param path the path
|
||||
* @return the resource location
|
||||
*/
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull ResourceLocation mrl(String path) {
|
||||
return new ResourceLocation(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Mod info.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,9 +5,25 @@ import net.minecraftforge.eventbus.api.Event;
|
|||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* The type Minecraft set up service event.
|
||||
*/
|
||||
public class MinecraftSetUpServiceEvent extends Event {
|
||||
/**
|
||||
* The Services.
|
||||
*/
|
||||
public final Services services;
|
||||
/**
|
||||
* The Main thread executor.
|
||||
*/
|
||||
public final Executor mainThreadExecutor;
|
||||
|
||||
/**
|
||||
* Instantiates a new Minecraft set up service event.
|
||||
*
|
||||
* @param services the services
|
||||
* @param mainThreadExecutor the main thread executor
|
||||
*/
|
||||
public MinecraftSetUpServiceEvent(Services services, Executor mainThreadExecutor) {
|
||||
this.services = services;
|
||||
this.mainThreadExecutor = mainThreadExecutor;
|
||||
|
|
|
|||
|
|
@ -11,34 +11,66 @@ import top.r3944realms.lib39.core.command.model.CommandNode;
|
|||
import top.r3944realms.lib39.core.command.model.CommandPath;
|
||||
import top.r3944realms.lib39.core.command.model.Parameter;
|
||||
|
||||
/**
|
||||
* The type Register command help event.
|
||||
*/
|
||||
public class RegisterCommandHelpEvent extends Event {
|
||||
private final LiteralArgumentBuilder<CommandSourceStack> builder;
|
||||
private final ICommandHelpManager helpManager;
|
||||
private final CommandBuildContext context;
|
||||
|
||||
/**
|
||||
* Instantiates a new Register command help event.
|
||||
*
|
||||
* @param builder the builder
|
||||
* @param helpManager the help manager
|
||||
* @param source the source
|
||||
*/
|
||||
public RegisterCommandHelpEvent(LiteralArgumentBuilder<CommandSourceStack> builder, ICommandHelpManager helpManager, CommandBuildContext source) {
|
||||
this.builder = builder;
|
||||
this.helpManager = helpManager;
|
||||
this.context = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets id.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
public ResourceLocation getID() {
|
||||
return helpManager.getID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add child.
|
||||
*
|
||||
* @param child the child
|
||||
*/
|
||||
public void addChild(LiteralArgumentBuilder<CommandSourceStack> child) {
|
||||
this.builder.then(child);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get context command build context.
|
||||
*
|
||||
* @return the command build context
|
||||
*/
|
||||
public CommandBuildContext getContext(){
|
||||
return this.context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tree literal argument builder.
|
||||
*
|
||||
* @return the literal argument builder
|
||||
*/
|
||||
public LiteralArgumentBuilder<CommandSourceStack> getTree(){
|
||||
return this.builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册命令帮助信息
|
||||
*
|
||||
* @param CommandNode 命令节点
|
||||
* @param description 命令描述
|
||||
*/
|
||||
|
|
@ -48,7 +80,8 @@ public class RegisterCommandHelpEvent extends Event {
|
|||
|
||||
/**
|
||||
* 注册命令帮助信息
|
||||
* @param CommandNode 命令节点
|
||||
*
|
||||
* @param CommandNode 命令节点
|
||||
* @param descriptionKey 命令描述的语言键
|
||||
*/
|
||||
public void registerHelp(CommandNode CommandNode, String descriptionKey) {
|
||||
|
|
@ -57,7 +90,8 @@ public class RegisterCommandHelpEvent extends Event {
|
|||
|
||||
/**
|
||||
* 注册命令参数
|
||||
* @param commandPath 命令节点
|
||||
*
|
||||
* @param commandPath 命令节点
|
||||
* @param parametersBuilder 参数列表构造器
|
||||
*/
|
||||
public void registerParameters(CommandPath commandPath, Parameter.Builder parametersBuilder) {
|
||||
|
|
|
|||
|
|
@ -4,10 +4,22 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import top.r3944realms.lib39.Lib39;
|
||||
import top.r3944realms.lib39.core.command.SimpleCommandHelpManager;
|
||||
|
||||
/**
|
||||
* The type Lib 39 command help manager.
|
||||
*/
|
||||
public class Lib39CommandHelpManager extends SimpleCommandHelpManager {
|
||||
/**
|
||||
* The constant INSTANCE.
|
||||
*/
|
||||
public static volatile Lib39CommandHelpManager INSTANCE = new Lib39CommandHelpManager();
|
||||
/**
|
||||
* The Id.
|
||||
*/
|
||||
ResourceLocation ID = Lib39.rl("command_helper");
|
||||
|
||||
/**
|
||||
* Instantiates a new Lib 39 command help manager.
|
||||
*/
|
||||
public Lib39CommandHelpManager() {
|
||||
initialize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,16 @@ import top.r3944realms.lib39.core.command.SimpleHelpCommand;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The type Lib 39 help command.
|
||||
*/
|
||||
public class Lib39HelpCommand extends SimpleHelpCommand {
|
||||
|
||||
/**
|
||||
* Instantiates a new Lib 39 help command.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
public Lib39HelpCommand(@NotNull RegisterCommandsEvent event) {
|
||||
super(event);
|
||||
if(Lib39.shouldRegisterExamples()) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ import top.r3944realms.lib39.base.datagen.value.Lib39LangKey;
|
|||
import top.r3944realms.lib39.datagen.provider.SimpleLanguageProvider;
|
||||
import top.r3944realms.lib39.datagen.value.McLocale;
|
||||
|
||||
/**
|
||||
* The type Lib 39 base data gen event.
|
||||
*/
|
||||
public class Lib39BaseDataGenEvent {
|
||||
/**
|
||||
* The Logger.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,16 @@ import net.minecraftforge.common.data.ExistingFileHelper;
|
|||
import top.r3944realms.lib39.Lib39;
|
||||
import top.r3944realms.lib39.util.PlantHelper;
|
||||
|
||||
/**
|
||||
* The type Lib 39 block model provider.
|
||||
*/
|
||||
public class Lib39BlockModelProvider extends BlockModelProvider {
|
||||
/**
|
||||
* Instantiates a new Lib 39 block model provider.
|
||||
*
|
||||
* @param output the output
|
||||
* @param existingFileHelper the existing file helper
|
||||
*/
|
||||
public Lib39BlockModelProvider(PackOutput output, ExistingFileHelper existingFileHelper) {
|
||||
super(output, Lib39.MOD_ID, existingFileHelper);
|
||||
}
|
||||
|
|
@ -16,6 +25,10 @@ public class Lib39BlockModelProvider extends BlockModelProvider {
|
|||
protected void registerModels() {
|
||||
// registerPlants();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register plants.
|
||||
*/
|
||||
protected void registerPlants() {
|
||||
for (PlantHelper.Plant plant: PlantHelper.Plant.values()) {
|
||||
createCuffBedHeadModel(plant);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,16 @@ import org.jetbrains.annotations.NotNull;
|
|||
import top.r3944realms.lib39.Lib39;
|
||||
import top.r3944realms.lib39.content.register.Lib39Blocks;
|
||||
|
||||
/**
|
||||
* The type Lib 39 block states provider.
|
||||
*/
|
||||
public class Lib39BlockStatesProvider extends BlockStateProvider {
|
||||
/**
|
||||
* Instantiates a new Lib 39 block states provider.
|
||||
*
|
||||
* @param output the output
|
||||
* @param exFileHelper the ex file helper
|
||||
*/
|
||||
public Lib39BlockStatesProvider(PackOutput output, ExistingFileHelper exFileHelper) {
|
||||
super(output, Lib39.MOD_ID, exFileHelper);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ public class Lib39ItemModelProvider extends net.minecraftforge.client.model.gene
|
|||
withExistingParent(itemName(item), HANDHELD).texture("layer0", location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate doll item model.
|
||||
*/
|
||||
protected void generateDollItemModel() {
|
||||
getBuilder("doll")
|
||||
.parent(getExistingFile(Lib39.rl("block/base_doll")));
|
||||
|
|
|
|||
|
|
@ -13,13 +13,26 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The enum Lib 39 lang key.
|
||||
*/
|
||||
public enum Lib39LangKey implements ILangKeyValueCollection {
|
||||
/**
|
||||
* Instance lib 39 lang key.
|
||||
*/
|
||||
INSTANCE;
|
||||
Lib39LangKey() {
|
||||
initLangKeyValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Message.
|
||||
*/
|
||||
public static final class Message {
|
||||
private static final Set<LangKeyValue> items = new HashSet<>();
|
||||
/**
|
||||
* The constant HELP_HEADER.
|
||||
*/
|
||||
public static final LangKeyValue HELP_HEADER = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.header", ModPartEnum.MESSAGE,
|
||||
|
|
@ -31,6 +44,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant HELP_CLICK_EXPAND.
|
||||
*/
|
||||
public static final LangKeyValue HELP_CLICK_EXPAND = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.click_expand", ModPartEnum.MESSAGE,
|
||||
|
|
@ -42,6 +58,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant HELP_PAGE_INFO.
|
||||
*/
|
||||
public static final LangKeyValue HELP_PAGE_INFO = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.page_info", ModPartEnum.MESSAGE,
|
||||
|
|
@ -53,6 +72,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant HELP_NO_ENTRIES.
|
||||
*/
|
||||
public static final LangKeyValue HELP_NO_ENTRIES = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.no_entries", ModPartEnum.MESSAGE,
|
||||
|
|
@ -64,6 +86,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant HELP_TOGGLE_FAILED.
|
||||
*/
|
||||
public static final LangKeyValue HELP_TOGGLE_FAILED = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.toggle_failed", ModPartEnum.MESSAGE,
|
||||
|
|
@ -75,6 +100,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant HELP_COMMAND_NOT_FOUND.
|
||||
*/
|
||||
public static final LangKeyValue HELP_COMMAND_NOT_FOUND = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.command_not_found", ModPartEnum.MESSAGE,
|
||||
|
|
@ -86,6 +114,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant HELP_SUBCOMMANDS_TITLE.
|
||||
*/
|
||||
public static final LangKeyValue HELP_SUBCOMMANDS_TITLE = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.subcommands_title", ModPartEnum.MESSAGE,
|
||||
|
|
@ -97,6 +128,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant HELP_NODE_EXPAND.
|
||||
*/
|
||||
public static final LangKeyValue HELP_NODE_EXPAND = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.node.expand", ModPartEnum.MESSAGE,
|
||||
|
|
@ -108,6 +142,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant HELP_NODE_TOGGLE_EXPAND.
|
||||
*/
|
||||
public static final LangKeyValue HELP_NODE_TOGGLE_EXPAND = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.node.toggle.expand", ModPartEnum.MESSAGE,
|
||||
|
|
@ -119,6 +156,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant HELP_NODE_TOGGLE_COLLAPSE.
|
||||
*/
|
||||
public static final LangKeyValue HELP_NODE_TOGGLE_COLLAPSE = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.node.toggle.collapse", ModPartEnum.MESSAGE,
|
||||
|
|
@ -130,6 +170,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant BASIC_HELP.
|
||||
*/
|
||||
public static final LangKeyValue BASIC_HELP = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.basic.help", ModPartEnum.MESSAGE,
|
||||
|
|
@ -141,6 +184,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant HELP_HOVER_COPY_TIP.
|
||||
*/
|
||||
public static final LangKeyValue HELP_HOVER_COPY_TIP = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.help.hover.copy", ModPartEnum.MESSAGE,
|
||||
|
|
@ -155,10 +201,17 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
items.add(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets items.
|
||||
*
|
||||
* @return the items
|
||||
*/
|
||||
public static Set<LangKeyValue> getItems() {
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Lang key values.
|
||||
*/
|
||||
|
|
@ -210,13 +263,20 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
public @Unmodifiable List<LangKeyValue> getValues() {
|
||||
return List.copyOf(langKeyValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Test message.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static final class TestMessage {
|
||||
private static final Set<LangKeyValue> items = new HashSet<>();
|
||||
|
||||
// ===== lib39 測試命令翻譯 =====
|
||||
|
||||
// 根命令
|
||||
/**
|
||||
* The constant LIB39_ROOT.
|
||||
*/
|
||||
// 根命令
|
||||
public static final LangKeyValue LIB39_ROOT = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.root", ModPartEnum.MESSAGE,
|
||||
|
|
@ -228,7 +288,10 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
// 測試命令
|
||||
/**
|
||||
* The constant LIB39_TEST.
|
||||
*/
|
||||
// 測試命令
|
||||
public static final LangKeyValue LIB39_TEST = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.test", ModPartEnum.MESSAGE,
|
||||
|
|
@ -240,6 +303,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_TEST_SUCCESS.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_TEST_SUCCESS = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.test.success", ModPartEnum.MESSAGE,
|
||||
|
|
@ -251,6 +317,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_TEST_WITH_PARAM.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_TEST_WITH_PARAM = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.test.with_param", ModPartEnum.MESSAGE,
|
||||
|
|
@ -262,6 +331,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_DEMO.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_DEMO = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.demo", ModPartEnum.MESSAGE,
|
||||
|
|
@ -273,6 +345,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_DEMO_MESSAGE.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_DEMO_MESSAGE = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.demo.message", ModPartEnum.MESSAGE,
|
||||
|
|
@ -284,7 +359,10 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
// 問候命令
|
||||
/**
|
||||
* The constant LIB39_GREET_BASIC.
|
||||
*/
|
||||
// 問候命令
|
||||
public static final LangKeyValue LIB39_GREET_BASIC = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.greet.basic", ModPartEnum.MESSAGE,
|
||||
|
|
@ -296,6 +374,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GREET_DEFAULT.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GREET_DEFAULT = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.greet.default", ModPartEnum.MESSAGE,
|
||||
|
|
@ -307,6 +388,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GREET_PLAYER.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GREET_PLAYER = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.greet.player", ModPartEnum.MESSAGE,
|
||||
|
|
@ -318,6 +402,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GREET_RECEIVED.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GREET_RECEIVED = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.greet.received", ModPartEnum.MESSAGE,
|
||||
|
|
@ -329,7 +416,10 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
// 計算命令
|
||||
/**
|
||||
* The constant LIB39_CALCULATE.
|
||||
*/
|
||||
// 計算命令
|
||||
public static final LangKeyValue LIB39_CALCULATE = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.calculate", ModPartEnum.MESSAGE,
|
||||
|
|
@ -341,6 +431,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_CALCULATE_RESULT.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_CALCULATE_RESULT = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.calculate.result", ModPartEnum.MESSAGE,
|
||||
|
|
@ -352,7 +445,10 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
// 傳送命令
|
||||
/**
|
||||
* The constant LIB39_TELEPORT.
|
||||
*/
|
||||
// 傳送命令
|
||||
public static final LangKeyValue LIB39_TELEPORT = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.teleport", ModPartEnum.MESSAGE,
|
||||
|
|
@ -364,6 +460,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_TELEPORT_SUCCESS.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_TELEPORT_SUCCESS = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.teleport.success", ModPartEnum.MESSAGE,
|
||||
|
|
@ -375,7 +474,10 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
// 信息命令
|
||||
/**
|
||||
* The constant LIB39_INFO.
|
||||
*/
|
||||
// 信息命令
|
||||
public static final LangKeyValue LIB39_INFO = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.info", ModPartEnum.MESSAGE,
|
||||
|
|
@ -387,6 +489,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_INFO_MESSAGE.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_INFO_MESSAGE = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.info.message", ModPartEnum.MESSAGE,
|
||||
|
|
@ -398,6 +503,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_INFO_DIMENSION.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_INFO_DIMENSION = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.info.dimension", ModPartEnum.MESSAGE,
|
||||
|
|
@ -409,6 +517,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_INFO_POSITION.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_INFO_POSITION = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.info.position", ModPartEnum.MESSAGE,
|
||||
|
|
@ -420,7 +531,10 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
// 隊伍系統
|
||||
/**
|
||||
* The constant LIB39_TEAM.
|
||||
*/
|
||||
// 隊伍系統
|
||||
public static final LangKeyValue LIB39_TEAM = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.team", ModPartEnum.MESSAGE,
|
||||
|
|
@ -432,6 +546,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_TEAM_CREATE.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_TEAM_CREATE = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.team.create", ModPartEnum.MESSAGE,
|
||||
|
|
@ -443,6 +560,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_TEAM_CREATE_SUCCESS.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_TEAM_CREATE_SUCCESS = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.team.create.success", ModPartEnum.MESSAGE,
|
||||
|
|
@ -454,6 +574,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_TEAM_JOIN.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_TEAM_JOIN = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.team.join", ModPartEnum.MESSAGE,
|
||||
|
|
@ -465,6 +588,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_TEAM_JOIN_SUCCESS.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_TEAM_JOIN_SUCCESS = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.team.join.success", ModPartEnum.MESSAGE,
|
||||
|
|
@ -476,6 +602,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_TEAM_LEAVE.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_TEAM_LEAVE = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.team.leave", ModPartEnum.MESSAGE,
|
||||
|
|
@ -487,6 +616,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_TEAM_LEAVE_SUCCESS.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_TEAM_LEAVE_SUCCESS = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.team.leave.success", ModPartEnum.MESSAGE,
|
||||
|
|
@ -498,7 +630,10 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
// 遊戲系統
|
||||
/**
|
||||
* The constant LIB39_GAME.
|
||||
*/
|
||||
// 遊戲系統
|
||||
public static final LangKeyValue LIB39_GAME = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.game", ModPartEnum.MESSAGE,
|
||||
|
|
@ -510,6 +645,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GAME_START.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GAME_START = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.game.start", ModPartEnum.MESSAGE,
|
||||
|
|
@ -521,6 +659,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GAME_START_SUCCESS.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GAME_START_SUCCESS = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.game.start.success", ModPartEnum.MESSAGE,
|
||||
|
|
@ -532,6 +673,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GAME_STOP.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GAME_STOP = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.game.stop", ModPartEnum.MESSAGE,
|
||||
|
|
@ -543,6 +687,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GAME_STOP_SUCCESS.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GAME_STOP_SUCCESS = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.game.stop.success", ModPartEnum.MESSAGE,
|
||||
|
|
@ -554,6 +701,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GAME_PAUSE.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GAME_PAUSE = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.game.pause", ModPartEnum.MESSAGE,
|
||||
|
|
@ -565,6 +715,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GAME_PAUSE_SUCCESS.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GAME_PAUSE_SUCCESS = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.game.pause.success", ModPartEnum.MESSAGE,
|
||||
|
|
@ -576,6 +729,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GAME_RESUME.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GAME_RESUME = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.game.resume", ModPartEnum.MESSAGE,
|
||||
|
|
@ -587,6 +743,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_GAME_RESUME_SUCCESS.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_GAME_RESUME_SUCCESS = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.game.resume.success", ModPartEnum.MESSAGE,
|
||||
|
|
@ -598,7 +757,10 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
// 設置命令
|
||||
/**
|
||||
* The constant LIB39_SETTINGS.
|
||||
*/
|
||||
// 設置命令
|
||||
public static final LangKeyValue LIB39_SETTINGS = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.settings", ModPartEnum.MESSAGE,
|
||||
|
|
@ -610,6 +772,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_CONFIG.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_CONFIG = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.config", ModPartEnum.MESSAGE,
|
||||
|
|
@ -621,6 +786,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_RELOAD.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_RELOAD = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.reload", ModPartEnum.MESSAGE,
|
||||
|
|
@ -632,6 +800,9 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The constant LIB39_DEBUG.
|
||||
*/
|
||||
public static final LangKeyValue LIB39_DEBUG = addAndRet(
|
||||
LangKeyValue.ofKey(
|
||||
"commands.lib39.debug", ModPartEnum.MESSAGE,
|
||||
|
|
@ -651,6 +822,11 @@ public enum Lib39LangKey implements ILangKeyValueCollection {
|
|||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets items.
|
||||
*
|
||||
* @return the items
|
||||
*/
|
||||
public static Set<LangKeyValue> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,21 @@ import top.r3944realms.lib39.util.SkinHelper;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The type Doll block entity renderer.
|
||||
*/
|
||||
public class DollBlockEntityRenderer implements BlockEntityRenderer<DollBlockEntity> {
|
||||
/**
|
||||
* The Doll without item model.
|
||||
*/
|
||||
public BakedModel dollWithoutItemModel;
|
||||
/**
|
||||
* The Doll need item model.
|
||||
*/
|
||||
public BakedModel dollNeedItemModel;
|
||||
/**
|
||||
* The Item models.
|
||||
*/
|
||||
public final Map<PlantHelper.Plant, BakedModel> itemModels = new HashMap<>();
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -37,9 +37,15 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* The type Doll item renderer.
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
||||
private static final DollItemRenderer INSTANCE = new DollItemRenderer();
|
||||
/**
|
||||
* The constant BETag.
|
||||
*/
|
||||
public static final String BETag = "BlockEntityTag";
|
||||
// 模型缓存系统
|
||||
private static class ModelCacheEntry {
|
||||
|
|
@ -48,12 +54,22 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
private long lastAccessTime;
|
||||
private boolean isMissingModel;
|
||||
|
||||
/**
|
||||
* Instantiates a new Model cache entry.
|
||||
*
|
||||
* @param modelLocation the model location
|
||||
*/
|
||||
ModelCacheEntry(ResourceLocation modelLocation) {
|
||||
this.modelLocation = modelLocation;
|
||||
this.lastAccessTime = System.currentTimeMillis();
|
||||
this.isMissingModel = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets model.
|
||||
*
|
||||
* @return the model
|
||||
*/
|
||||
BakedModel getModel() {
|
||||
if (model == null && !isMissingModel) {
|
||||
loadModel();
|
||||
|
|
@ -76,6 +92,11 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Should refresh boolean.
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
boolean shouldRefresh() {
|
||||
return model == null || (!isMissingModel && System.currentTimeMillis() - lastAccessTime > CACHE_DURATION);
|
||||
}
|
||||
|
|
@ -88,6 +109,12 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
private static final long CLEANUP_INTERVAL = 30000; // 30秒清理一次
|
||||
private long lastCleanupTime = 0;
|
||||
|
||||
/**
|
||||
* Gets model.
|
||||
*
|
||||
* @param location the location
|
||||
* @return the model
|
||||
*/
|
||||
BakedModel getModel(ResourceLocation location) {
|
||||
ModelCacheEntry entry = cache.computeIfAbsent(location, ModelCacheEntry::new);
|
||||
|
||||
|
|
@ -115,11 +142,17 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
}, Util.backgroundExecutor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear.
|
||||
*/
|
||||
void clear() {
|
||||
cache.clear();
|
||||
pendingReloads.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup.
|
||||
*/
|
||||
void cleanup() {
|
||||
long now = System.currentTimeMillis();
|
||||
if (now - lastCleanupTime > CLEANUP_INTERVAL) {
|
||||
|
|
@ -139,11 +172,21 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
private ResourceLocation registeredLocation;
|
||||
private long lastAccessTime;
|
||||
|
||||
/**
|
||||
* Instantiates a new Texture cache entry.
|
||||
*
|
||||
* @param textureLocation the texture location
|
||||
*/
|
||||
TextureCacheEntry(ResourceLocation textureLocation) {
|
||||
this.textureLocation = textureLocation;
|
||||
this.lastAccessTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets texture.
|
||||
*
|
||||
* @return the texture
|
||||
*/
|
||||
ResourceLocation getTexture() {
|
||||
if (registeredLocation == null) {
|
||||
registerTexture();
|
||||
|
|
@ -177,6 +220,11 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Should refresh boolean.
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
boolean shouldRefresh() {
|
||||
return registeredLocation == null ||
|
||||
System.currentTimeMillis() - lastAccessTime > CACHE_DURATION;
|
||||
|
|
@ -186,13 +234,29 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
// 常量定义
|
||||
private static final long CACHE_DURATION = 5000; // 5秒
|
||||
private static final long ITEM_TEXTURE_CACHE_DURATION = 30000; // 30秒(材质不常变)
|
||||
/**
|
||||
* The constant DOLL_NEED_ITEM_MODEL.
|
||||
*/
|
||||
public static final ResourceLocation DOLL_NEED_ITEM_MODEL = Lib39.rl("block/doll_default");
|
||||
/**
|
||||
* The constant DOLL_WITHOUT_ITEM_MODEL.
|
||||
*/
|
||||
public static final ResourceLocation DOLL_WITHOUT_ITEM_MODEL = Lib39.rl("block/doll_without_item");
|
||||
/**
|
||||
* The constant DOLL_ITEM_MODEL.
|
||||
*/
|
||||
public static final ResourceLocation DOLL_ITEM_MODEL = Lib39.rl("block/base_doll_item");
|
||||
/**
|
||||
* The constant ITEM_MODELS.
|
||||
*/
|
||||
public static final Map<PlantHelper.Plant, ResourceLocation> ITEM_MODELS = new HashMap<>();
|
||||
static {
|
||||
initItemModels();
|
||||
}
|
||||
|
||||
/**
|
||||
* Init item models.
|
||||
*/
|
||||
public static void initItemModels() {
|
||||
for (PlantHelper.Plant plant : PlantHelper.Plant.values()) {
|
||||
ITEM_MODELS.put(plant, Lib39.rl("block/doll_item/" + plant));
|
||||
|
|
@ -225,6 +289,11 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets instance.
|
||||
*
|
||||
* @return the instance
|
||||
*/
|
||||
public static DollItemRenderer getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
|
@ -318,7 +387,13 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
return modelCache.getModel(modelLoc);
|
||||
}
|
||||
|
||||
// 获取皮肤纹理(带缓存)
|
||||
/**
|
||||
* Gets skin texture.
|
||||
*
|
||||
* @param gameProfile the game profile
|
||||
* @return the skin texture
|
||||
*/
|
||||
// 获取皮肤纹理(带缓存)
|
||||
public ResourceLocation getSkinTexture(@Nullable GameProfile gameProfile) {
|
||||
if (gameProfile == null) {
|
||||
return defaultSkinTexture.getTexture();
|
||||
|
|
@ -400,7 +475,10 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
);
|
||||
}
|
||||
|
||||
// 清除所有缓存(用于资源包重载)
|
||||
/**
|
||||
* Clear all caches.
|
||||
*/
|
||||
// 清除所有缓存(用于资源包重载)
|
||||
public void clearAllCaches() {
|
||||
modelCache.clear();
|
||||
skinTextureCache.clear();
|
||||
|
|
@ -409,6 +487,11 @@ public class DollItemRenderer extends BlockEntityWithoutLevelRenderer {
|
|||
|
||||
// 渲染数据持有类
|
||||
private record DollRenderData(String itemType, GameProfile gameProfile) {
|
||||
/**
|
||||
* Has item boolean.
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
public boolean hasItem() {
|
||||
return itemType != null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,9 +32,15 @@ import org.jetbrains.annotations.Nullable;
|
|||
import top.r3944realms.lib39.content.block.property.DollPose;
|
||||
import top.r3944realms.lib39.content.register.Lib39BlockEntities;
|
||||
|
||||
/**
|
||||
* The type Doll block.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class DollBlock extends HorizontalDirectionalBlock implements SimpleWaterloggedBlock, EntityBlock {
|
||||
private static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
/**
|
||||
* The constant POSE.
|
||||
*/
|
||||
public static final EnumProperty<DollPose> POSE = EnumProperty.create("pose", DollPose.class);
|
||||
|
||||
private static final VoxelShape DOLL_SHAPE = Block.box(2.0d, 0.0d, 2.0d, 14.0d, 12.0d, 14.0d);
|
||||
|
|
@ -54,6 +60,9 @@ public class DollBlock extends HorizontalDirectionalBlock implements SimpleWater
|
|||
private static final float PITCH_VARIANCE = 0.5f;
|
||||
private static final float BASE_PITCH = 0.75f;
|
||||
|
||||
/**
|
||||
* Instantiates a new Doll block.
|
||||
*/
|
||||
public DollBlock() {
|
||||
super(properties);
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.SOUTH)
|
||||
|
|
|
|||
|
|
@ -16,8 +16,17 @@ import top.r3944realms.lib39.util.nbt.NBTWriter;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* The type Doll block entity.
|
||||
*/
|
||||
public class DollBlockEntity extends BlockEntity {
|
||||
/**
|
||||
* The constant TAG_OWNER.
|
||||
*/
|
||||
public static final String TAG_OWNER = "ProfileOwner";
|
||||
/**
|
||||
* The constant TAG_HOLD_ITEM.
|
||||
*/
|
||||
public static final String TAG_HOLD_ITEM = "ItemType";
|
||||
|
||||
@Nullable
|
||||
|
|
@ -25,6 +34,12 @@ public class DollBlockEntity extends BlockEntity {
|
|||
@Nullable
|
||||
private PlantHelper.Plant holdItem;
|
||||
|
||||
/**
|
||||
* Instantiates a new Doll block entity.
|
||||
*
|
||||
* @param pos the pos
|
||||
* @param blockState the block state
|
||||
*/
|
||||
public DollBlockEntity(BlockPos pos, BlockState blockState) {
|
||||
super(Lib39BlockEntities.DOLL_BLOCK_ENTITY.get(), pos, blockState);
|
||||
}
|
||||
|
|
@ -44,11 +59,21 @@ public class DollBlockEntity extends BlockEntity {
|
|||
.string(TAG_HOLD_ITEM, holdItem -> setHoldItem(PlantHelper.Plant.valueOf(holdItem)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets owner profile.
|
||||
*
|
||||
* @return the owner profile
|
||||
*/
|
||||
@Nullable
|
||||
public GameProfile getOwnerProfile() {
|
||||
return this.owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets hold item.
|
||||
*
|
||||
* @return the hold item
|
||||
*/
|
||||
@Nullable
|
||||
public PlantHelper.Plant getHoldItem() {
|
||||
return this.holdItem;
|
||||
|
|
@ -62,6 +87,11 @@ public class DollBlockEntity extends BlockEntity {
|
|||
return this.saveWithoutMetadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets owner.
|
||||
*
|
||||
* @param owner the owner
|
||||
*/
|
||||
public void setOwner(@Nullable GameProfile owner) {
|
||||
synchronized(this) {
|
||||
this.owner = owner;
|
||||
|
|
@ -70,6 +100,11 @@ public class DollBlockEntity extends BlockEntity {
|
|||
this.updateOwnerProfile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets hold item.
|
||||
*
|
||||
* @param holdItem the hold item
|
||||
*/
|
||||
public void setHoldItem(@Nullable PlantHelper.Plant holdItem) {
|
||||
this.holdItem = holdItem;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,17 @@ package top.r3944realms.lib39.content.block.property;
|
|||
import net.minecraft.util.StringRepresentable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* The enum Doll pose.
|
||||
*/
|
||||
public enum DollPose implements StringRepresentable {
|
||||
/**
|
||||
* Default doll pose.
|
||||
*/
|
||||
DEFAULT("default"),
|
||||
/**
|
||||
* Without item doll pose.
|
||||
*/
|
||||
WITHOUT_ITEM("without_item"),
|
||||
;
|
||||
private final String name;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,15 @@ import top.r3944realms.lib39.content.register.Lib39Blocks;
|
|||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* The type Doll item.
|
||||
*/
|
||||
public class DollItem extends BlockItem {
|
||||
/**
|
||||
* Instantiates a new Doll item.
|
||||
*
|
||||
* @param properties the properties
|
||||
*/
|
||||
public DollItem(Properties properties) {
|
||||
super(Lib39Blocks.DOLL.get(), properties);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,17 +8,24 @@ import net.minecraftforge.registries.RegistryObject;
|
|||
import top.r3944realms.lib39.Lib39;
|
||||
import top.r3944realms.lib39.content.block.blockentity.DollBlockEntity;
|
||||
|
||||
/**
|
||||
* The type Lib 39 block entities.
|
||||
*/
|
||||
public class Lib39BlockEntities {
|
||||
/**
|
||||
* The constant BLOCK_ENTITY_TYPES.
|
||||
*/
|
||||
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, Lib39.MOD_ID);
|
||||
/**
|
||||
* The constant DOLL_BLOCK_ENTITY.
|
||||
*/
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
public static final RegistryObject<BlockEntityType<DollBlockEntity>> DOLL_BLOCK_ENTITY = BLOCK_ENTITY_TYPES.register("doll",
|
||||
() -> BlockEntityType.Builder
|
||||
.of(DollBlockEntity::new, Lib39Blocks.DOLL.get())
|
||||
.build(null)
|
||||
);
|
||||
|
||||
/**
|
||||
* Register.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -9,17 +9,24 @@ import top.r3944realms.lib39.Lib39;
|
|||
import top.r3944realms.lib39.content.block.DollBlock;
|
||||
import top.r3944realms.lib39.util.block.BlockRegistryBuilder;
|
||||
|
||||
/**
|
||||
* The type Lib 39 blocks.
|
||||
*/
|
||||
public class Lib39Blocks {
|
||||
/**
|
||||
* The constant BLOCKS.
|
||||
*/
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Lib39.MOD_ID);
|
||||
|
||||
/**
|
||||
* The constant DOLL.
|
||||
*/
|
||||
public static final RegistryObject<Block> DOLL = BlockRegistryBuilder
|
||||
.create()
|
||||
.withName("doll")
|
||||
.registerBlock(BLOCKS, DollBlock::new)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* Register.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ public class Lib39Items {
|
|||
*/
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Lib39.MOD_ID);
|
||||
|
||||
/**
|
||||
* The constant DOLL.
|
||||
*/
|
||||
public static final RegistryObject<Item> DOLL = ITEMS.register("doll", () -> new DollItem(new Item.Properties()));
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,17 +16,43 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* The interface Command help manager.
|
||||
*/
|
||||
public interface ICommandHelpManager {
|
||||
/**
|
||||
* The constant NEWLINE.
|
||||
*/
|
||||
String NEWLINE = "\n";
|
||||
|
||||
/**
|
||||
* Gets id.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
ResourceLocation getID();
|
||||
|
||||
/**
|
||||
* Gets head key.
|
||||
*
|
||||
* @return the head key
|
||||
*/
|
||||
String getHeadKey();
|
||||
|
||||
/**
|
||||
* Gets command head.
|
||||
*
|
||||
* @return the command head
|
||||
*/
|
||||
default String getCommandHead() {
|
||||
return getID().getNamespace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Init command node.
|
||||
*
|
||||
* @return the command node
|
||||
*/
|
||||
default CommandNode init() {
|
||||
CommandNode root;
|
||||
root = new CommandNode(this, getCommandHead(), Component.translatable(Lib39LangKey.Message.HELP_HEADER.getKey(), Component.translatable(getHeadKey())), true);
|
||||
|
|
@ -34,22 +60,55 @@ public interface ICommandHelpManager {
|
|||
return root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets cache.
|
||||
*
|
||||
* @return the cache
|
||||
*/
|
||||
Map<Integer, CommandNode> getCache();
|
||||
|
||||
/**
|
||||
* Gets root node.
|
||||
*
|
||||
* @return the root node
|
||||
*/
|
||||
CommandNode getRootNode();
|
||||
|
||||
/**
|
||||
* Register command help.
|
||||
*
|
||||
* @param commandNode the command node
|
||||
* @param description the description
|
||||
*/
|
||||
default void registerCommandHelp(@NotNull CommandNode commandNode, MutableComponent description) {
|
||||
registerCommandHelp(commandNode.getFullPath(), description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command help.
|
||||
*
|
||||
* @param commandNode the command node
|
||||
* @param descriptionKey the description key
|
||||
*/
|
||||
default void registerCommandHelp(@NotNull CommandNode commandNode, String descriptionKey) {
|
||||
registerCommandHelp(commandNode.getFullPath(), Component.translatable(descriptionKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command help.
|
||||
*
|
||||
* @param commandPath the command path
|
||||
*/
|
||||
default void registerCommandHelp(@NotNull CommandPath commandPath) {
|
||||
registerCommandHelp(commandPath.fullPath(), Component.literal(""));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command parameters.
|
||||
*
|
||||
* @param commandPath the command path
|
||||
* @param parameters the parameters
|
||||
*/
|
||||
default void registerCommandParameters(@NotNull CommandPath commandPath, @NotNull Parameter.Builder parameters) {
|
||||
registerCommandParameters(commandPath.fullPath(), parameters.build());
|
||||
}
|
||||
|
|
@ -76,16 +135,26 @@ public interface ICommandHelpManager {
|
|||
|
||||
/**
|
||||
* 註冊命令幫助節點
|
||||
*
|
||||
* @param builder the builder
|
||||
*/
|
||||
default void registerCommand(@NotNull CommandNode.Builder builder) {
|
||||
CommandNode newRoot = builder.build();
|
||||
mergeTree(getRootNode(), newRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge tree.
|
||||
*
|
||||
* @param target the target
|
||||
* @param source the source
|
||||
*/
|
||||
void mergeTree(@NotNull CommandNode target, @NotNull CommandNode source);
|
||||
|
||||
/**
|
||||
* 使用Builder模式註冊命令樹
|
||||
*
|
||||
* @param builder the builder
|
||||
*/
|
||||
default void registerCommandTree(@NotNull CommandNode.Builder builder) {
|
||||
registerCommand(builder);
|
||||
|
|
@ -93,6 +162,8 @@ public interface ICommandHelpManager {
|
|||
|
||||
/**
|
||||
* 使用Builder模式快速註冊命令
|
||||
*
|
||||
* @param configurator the configurator
|
||||
*/
|
||||
default void registerCommands(@NotNull Consumer<CommandNode.Builder> configurator) {
|
||||
CommandNode.Builder builder = CommandNode.Builder.of(this);
|
||||
|
|
@ -102,6 +173,9 @@ public interface ICommandHelpManager {
|
|||
|
||||
/**
|
||||
* 根据路径查找节点
|
||||
*
|
||||
* @param path the path
|
||||
* @return the optional
|
||||
*/
|
||||
default Optional<CommandNode> findNode(CommandPath path) {
|
||||
CommandNode currentNode = getRootNode();
|
||||
|
|
@ -122,6 +196,9 @@ public interface ICommandHelpManager {
|
|||
|
||||
/**
|
||||
* 检查命令是否存在
|
||||
*
|
||||
* @param path the path
|
||||
* @return the boolean
|
||||
*/
|
||||
default boolean hasCommand(CommandPath path) {
|
||||
return findNode(path).isPresent();
|
||||
|
|
@ -173,7 +250,7 @@ public interface ICommandHelpManager {
|
|||
* @param commandPath 命令路径,如 "fpsm map modify"
|
||||
* @param childName 子指令名称
|
||||
* @param description 子指令描述
|
||||
* @return 是否添加成功
|
||||
* @return 是否添加成功 boolean
|
||||
*/
|
||||
default boolean addChildCommand(@NotNull String commandPath, String childName, MutableComponent description) {
|
||||
String[] pathParts = commandPath.split(" ");
|
||||
|
|
@ -402,7 +479,7 @@ public interface ICommandHelpManager {
|
|||
/**
|
||||
* 获取命令树的字符串表示
|
||||
*
|
||||
* @return 命令树列表
|
||||
* @return 命令树列表 command tree
|
||||
*/
|
||||
default List<MutableComponent> getCommandTree() {
|
||||
List<MutableComponent> result = new ArrayList<>();
|
||||
|
|
@ -414,7 +491,7 @@ public interface ICommandHelpManager {
|
|||
* 切换指定节点的展开/闭合状态
|
||||
*
|
||||
* @param hashCode 节点哈希值
|
||||
* @return 是否成功切换
|
||||
* @return 是否成功切换 boolean
|
||||
*/
|
||||
default boolean toggleNodeExpanded(int hashCode) {
|
||||
CommandNode currentNode = getCache().getOrDefault(hashCode, null);
|
||||
|
|
@ -435,6 +512,7 @@ public interface ICommandHelpManager {
|
|||
*
|
||||
* @param header 帮助头部
|
||||
* @param entries 帮助条目列表
|
||||
* @return the mutable component
|
||||
*/
|
||||
default MutableComponent buildHelpMessage(@NotNull Component header, @NotNull List<MutableComponent> entries) {
|
||||
MutableComponent helpMessage = Component.empty();
|
||||
|
|
@ -457,6 +535,11 @@ public interface ICommandHelpManager {
|
|||
return helpMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build command tree help mutable component.
|
||||
*
|
||||
* @return the mutable component
|
||||
*/
|
||||
default MutableComponent buildCommandTreeHelp() {
|
||||
List<MutableComponent> commandTree = getCommandTree();
|
||||
return buildHelpMessage(Component.translatable(Lib39LangKey.Message.HELP_HEADER.getKey(), Component.translatable(getHeadKey())), commandTree);
|
||||
|
|
|
|||
|
|
@ -16,17 +16,43 @@ import top.r3944realms.lib39.base.datagen.value.Lib39LangKey;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* The interface Help command.
|
||||
*/
|
||||
public interface IHelpCommand {
|
||||
/**
|
||||
* Should show toggle failed boolean.
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
default boolean shouldShowToggleFailed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets help head.
|
||||
*
|
||||
* @return the help head
|
||||
*/
|
||||
@Nullable
|
||||
default LiteralArgumentBuilder<CommandSourceStack> getHelpHead() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets command help manager.
|
||||
*
|
||||
* @return the command help manager
|
||||
*/
|
||||
ICommandHelpManager getCommandHelpManager();
|
||||
|
||||
/**
|
||||
* Build command literal argument builder.
|
||||
*
|
||||
* @param dispatcher the dispatcher
|
||||
* @param context the context
|
||||
* @return the literal argument builder
|
||||
*/
|
||||
default LiteralArgumentBuilder<CommandSourceStack> buildCommand(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext context) {
|
||||
LiteralArgumentBuilder<CommandSourceStack> head = getHelpHead();
|
||||
if (head == null) {
|
||||
|
|
@ -43,10 +69,22 @@ public interface IHelpCommand {
|
|||
return head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request permission boolean.
|
||||
*
|
||||
* @param context the context
|
||||
* @return the boolean
|
||||
*/
|
||||
default boolean requestPermission(CommandSourceStack context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle help int.
|
||||
*
|
||||
* @param context the context
|
||||
* @return the int
|
||||
*/
|
||||
default int handleHelp(@NotNull CommandContext<CommandSourceStack> context) {
|
||||
ICommandHelpManager commandHelpManager = getCommandHelpManager();
|
||||
MutableComponent helpMessage = commandHelpManager.buildCommandTreeHelp();
|
||||
|
|
@ -54,6 +92,12 @@ public interface IHelpCommand {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle help toggle int.
|
||||
*
|
||||
* @param context the context
|
||||
* @return the int
|
||||
*/
|
||||
default int handleHelpToggle(@NotNull CommandContext<CommandSourceStack> context) {
|
||||
int hash = IntegerArgumentType.getInteger(context, "hash");
|
||||
ICommandHelpManager commandHelpManager = getCommandHelpManager();
|
||||
|
|
@ -67,10 +111,22 @@ public interface IHelpCommand {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send success.
|
||||
*
|
||||
* @param source the source
|
||||
* @param key the key
|
||||
*/
|
||||
static void sendSuccess(@NotNull CommandSourceStack source, Component key) {
|
||||
source.sendSuccess(() -> key, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send failure.
|
||||
*
|
||||
* @param source the source
|
||||
* @param key the key
|
||||
*/
|
||||
static void sendFailure(@NotNull CommandSourceStack source, Component key) {
|
||||
source.sendFailure(key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,20 @@ import top.r3944realms.lib39.core.command.model.Parameter;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The type Simple command help manager.
|
||||
*/
|
||||
public abstract class SimpleCommandHelpManager implements ICommandHelpManager {
|
||||
private CommandNode root;
|
||||
private final Map<Integer, CommandNode> nodeCache = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Instantiates a new Simple command help manager.
|
||||
*/
|
||||
public SimpleCommandHelpManager() {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 延遲初始化根節點
|
||||
*/
|
||||
|
|
@ -71,6 +78,8 @@ public abstract class SimpleCommandHelpManager implements ICommandHelpManager {
|
|||
|
||||
/**
|
||||
* 檢查是否已初始化
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
public boolean isInitialized() {
|
||||
return root != null;
|
||||
|
|
|
|||
|
|
@ -7,15 +7,40 @@ import net.minecraft.commands.CommandSourceStack;
|
|||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* The type Simple help command.
|
||||
*/
|
||||
public abstract class SimpleHelpCommand implements IHelpCommand {
|
||||
/**
|
||||
* The Root.
|
||||
*/
|
||||
protected final LiteralArgumentBuilder<CommandSourceStack> root;
|
||||
|
||||
/**
|
||||
* Instantiates a new Simple help command.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
public SimpleHelpCommand(@NotNull RegisterCommandsEvent event) {
|
||||
root = buildCommand(event.getDispatcher(), event.getBuildContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Simple help command.
|
||||
*
|
||||
* @param dispatcher the dispatcher
|
||||
* @param context the context
|
||||
*/
|
||||
public SimpleHelpCommand(CommandDispatcher<CommandSourceStack> dispatcher,
|
||||
CommandBuildContext context) {
|
||||
root = buildCommand(dispatcher, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets root.
|
||||
*
|
||||
* @return the root
|
||||
*/
|
||||
public LiteralArgumentBuilder<CommandSourceStack> getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ import top.r3944realms.lib39.core.command.ICommandHelpManager;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The type Command node.
|
||||
*/
|
||||
public class CommandNode {
|
||||
private boolean isRoot = false;
|
||||
private int hashCache = 0;
|
||||
|
|
@ -28,6 +31,14 @@ public class CommandNode {
|
|||
// 展开/闭合状态
|
||||
private boolean expanded = true;
|
||||
|
||||
/**
|
||||
* Instantiates a new Command node.
|
||||
*
|
||||
* @param helpManager the help manager
|
||||
* @param name the name
|
||||
* @param description the description
|
||||
* @param isRoot the is root
|
||||
*/
|
||||
public CommandNode(ICommandHelpManager helpManager, String name, MutableComponent description, boolean isRoot) {
|
||||
this.name = name;
|
||||
this.helpManager = helpManager;
|
||||
|
|
@ -37,6 +48,13 @@ public class CommandNode {
|
|||
invalidateHash();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Command node.
|
||||
*
|
||||
* @param helpManager the help manager
|
||||
* @param name the name
|
||||
* @param description the description
|
||||
*/
|
||||
public CommandNode(ICommandHelpManager helpManager, String name, MutableComponent description) {
|
||||
this.name = name;
|
||||
this.helpManager = helpManager;
|
||||
|
|
@ -45,6 +63,11 @@ public class CommandNode {
|
|||
invalidateHash();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add child.
|
||||
*
|
||||
* @param child the child
|
||||
*/
|
||||
public void addChild(CommandNode child) {
|
||||
children.put(child.name, child);
|
||||
child.parent = this; // 設置父節點引用
|
||||
|
|
@ -57,54 +80,109 @@ public class CommandNode {
|
|||
invalidateHash();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets child.
|
||||
*
|
||||
* @param name the name
|
||||
* @return the child
|
||||
*/
|
||||
public CommandNode getChild(String name) {
|
||||
return children.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets parent.
|
||||
*
|
||||
* @return the parent
|
||||
*/
|
||||
@Nullable
|
||||
public CommandNode getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Has parent boolean.
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
public boolean hasParent() {
|
||||
return parent != null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets description.
|
||||
*
|
||||
* @return the description
|
||||
*/
|
||||
public MutableComponent getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets children.
|
||||
*
|
||||
* @return the children
|
||||
*/
|
||||
public Collection<CommandNode> getChildren() {
|
||||
return children.values();
|
||||
}
|
||||
|
||||
// 添加参数
|
||||
/**
|
||||
* Add parameter.
|
||||
*
|
||||
* @param parameter the parameter
|
||||
* @param required the required
|
||||
*/
|
||||
// 添加参数
|
||||
public void addParameter(String parameter, boolean required) {
|
||||
parameters.add(new Parameter(parameter, required));
|
||||
invalidateHash();
|
||||
}
|
||||
|
||||
// 获取参数列表
|
||||
/**
|
||||
* Gets parameters.
|
||||
*
|
||||
* @return the parameters
|
||||
*/
|
||||
// 获取参数列表
|
||||
public List<Parameter> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
// 获取展开状态
|
||||
/**
|
||||
* Is expanded boolean.
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
// 获取展开状态
|
||||
public boolean isExpanded() {
|
||||
return expanded;
|
||||
}
|
||||
|
||||
// 设置展开状态
|
||||
/**
|
||||
* Sets expanded.
|
||||
*
|
||||
* @param expanded the expanded
|
||||
*/
|
||||
// 设置展开状态
|
||||
public void setExpanded(boolean expanded) {
|
||||
this.expanded = expanded;
|
||||
}
|
||||
|
||||
// 切换展开状态
|
||||
/**
|
||||
* Toggle expanded.
|
||||
*/
|
||||
// 切换展开状态
|
||||
public void toggleExpanded() {
|
||||
this.expanded = !this.expanded;
|
||||
}
|
||||
|
|
@ -114,7 +192,12 @@ public class CommandNode {
|
|||
return computeHash();
|
||||
}
|
||||
|
||||
// 计算节点的Hash值
|
||||
/**
|
||||
* Compute hash int.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
// 计算节点的Hash值
|
||||
public int computeHash() {
|
||||
if (!hashValid) {
|
||||
if (hashCache != 0) {
|
||||
|
|
@ -154,6 +237,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 递归构建完整路径
|
||||
*
|
||||
* @return the full path
|
||||
*/
|
||||
public String getFullPath() {
|
||||
if (parent == null) {
|
||||
|
|
@ -164,6 +249,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 獲取完整的命令(以 / 開頭)
|
||||
*
|
||||
* @return the full command
|
||||
*/
|
||||
public String getFullCommand() {
|
||||
if (isRoot) {
|
||||
|
|
@ -171,8 +258,11 @@ public class CommandNode {
|
|||
}
|
||||
return "/" + getFullPath();
|
||||
}
|
||||
|
||||
/**
|
||||
* 檢查是否為葉子節點(沒有子節點)
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
public boolean isLeaf() {
|
||||
return children.isEmpty();
|
||||
|
|
@ -180,6 +270,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 獲取所有葉子節點(可執行的命令)
|
||||
*
|
||||
* @return the all leaf nodes
|
||||
*/
|
||||
public List<CommandNode> getAllLeafNodes() {
|
||||
List<CommandNode> leaves = new ArrayList<>();
|
||||
|
|
@ -199,6 +291,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 獲取節點路徑(從根節點到當前節點的路徑列表)
|
||||
*
|
||||
* @return the path segments
|
||||
*/
|
||||
public List<String> getPathSegments() {
|
||||
List<String> segments = new ArrayList<>();
|
||||
|
|
@ -216,6 +310,9 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 比較兩個節點是否在同一路徑上
|
||||
*
|
||||
* @param other the other
|
||||
* @return the boolean
|
||||
*/
|
||||
public boolean isAncestorOf(CommandNode other) {
|
||||
CommandNode current = other;
|
||||
|
|
@ -230,6 +327,9 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 獲取最近的共同祖先
|
||||
*
|
||||
* @param other the other
|
||||
* @return the common ancestor
|
||||
*/
|
||||
@Nullable
|
||||
public CommandNode getCommonAncestor(CommandNode other) {
|
||||
|
|
@ -256,6 +356,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 複製節點(不包括子節點)
|
||||
*
|
||||
* @return the command node
|
||||
*/
|
||||
public CommandNode shallowCopy() {
|
||||
CommandNode copy = new CommandNode(helpManager, name, description.copy(), isRoot);
|
||||
|
|
@ -265,8 +367,11 @@ public class CommandNode {
|
|||
copy.expanded = expanded;
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 深複製節點(包括所有子節點)
|
||||
*
|
||||
* @return the command node
|
||||
*/
|
||||
public CommandNode deepCopy() {
|
||||
return deepCopy(this, null);
|
||||
|
|
@ -311,6 +416,9 @@ public class CommandNode {
|
|||
name, getFullPath(), children.size(), parameters.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Builder.
|
||||
*/
|
||||
public static class Builder {
|
||||
private final ICommandHelpManager helpManager;
|
||||
private final Deque<CommandNode> nodeStack = new ArrayDeque<>();
|
||||
|
|
@ -321,6 +429,12 @@ public class CommandNode {
|
|||
this.helpManager = helpManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Of builder.
|
||||
*
|
||||
* @param helpManager the help manager
|
||||
* @return the builder
|
||||
*/
|
||||
@Contract(value = "_ -> new", pure = true)
|
||||
public static @NotNull Builder of(@NotNull final ICommandHelpManager helpManager) {
|
||||
return new Builder(helpManager);
|
||||
|
|
@ -328,6 +442,10 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 添加根節點
|
||||
*
|
||||
* @param name the name
|
||||
* @param description the description
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder root(@NotNull String name, @NotNull MutableComponent description) {
|
||||
if (root != null) {
|
||||
|
|
@ -340,6 +458,10 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 添加根節點(使用翻譯鍵)
|
||||
*
|
||||
* @param name the name
|
||||
* @param translationKey the translation key
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder root(@NotNull String name, @NotNull String translationKey) {
|
||||
return root(name, Component.translatable(translationKey));
|
||||
|
|
@ -347,6 +469,10 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 進入子節點(向下移動)
|
||||
*
|
||||
* @param name the name
|
||||
* @param description the description
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder push(@NotNull String name, @NotNull MutableComponent description) {
|
||||
checkBuilt();
|
||||
|
|
@ -368,6 +494,10 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 進入子節點(使用翻譯鍵)
|
||||
*
|
||||
* @param name the name
|
||||
* @param translationKey the translation key
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder push(@NotNull String name, @NotNull String translationKey) {
|
||||
return push(name, Component.translatable(translationKey));
|
||||
|
|
@ -375,6 +505,11 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 進入子節點並添加參數
|
||||
*
|
||||
* @param name the name
|
||||
* @param description the description
|
||||
* @param parameters the parameters
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder pushWithParams(@NotNull String name, @NotNull MutableComponent description,
|
||||
@NotNull Parameter... parameters) {
|
||||
|
|
@ -385,6 +520,11 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 進入子節點並添加必填參數
|
||||
*
|
||||
* @param name the name
|
||||
* @param description the description
|
||||
* @param paramNames the param names
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder pushWithRequiredParams(@NotNull String name, @NotNull MutableComponent description,
|
||||
@NotNull String @NotNull ... paramNames) {
|
||||
|
|
@ -397,6 +537,11 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 進入子節點並添加可選參數
|
||||
*
|
||||
* @param name the name
|
||||
* @param description the description
|
||||
* @param paramNames the param names
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder pushWithOptionalParams(@NotNull String name, @NotNull MutableComponent description,
|
||||
@NotNull String @NotNull ... paramNames) {
|
||||
|
|
@ -409,6 +554,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 返回上一級節點(向上移動)
|
||||
*
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder pop() {
|
||||
checkBuilt();
|
||||
|
|
@ -421,6 +568,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 返回到根節點
|
||||
*
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder popToRoot() {
|
||||
checkBuilt();
|
||||
|
|
@ -432,6 +581,9 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 返回到指定深度的節點
|
||||
*
|
||||
* @param depth the depth
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder popToDepth(int depth) {
|
||||
checkBuilt();
|
||||
|
|
@ -446,6 +598,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 獲取當前節點
|
||||
*
|
||||
* @return the command node
|
||||
*/
|
||||
public @NotNull CommandNode current() {
|
||||
checkBuilt();
|
||||
|
|
@ -457,6 +611,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 獲取當前深度
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
public int depth() {
|
||||
return nodeStack.size() - 1;
|
||||
|
|
@ -464,6 +620,10 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 為當前節點添加參數
|
||||
*
|
||||
* @param name the name
|
||||
* @param required the required
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder param(@NotNull String name, boolean required) {
|
||||
checkBuilt();
|
||||
|
|
@ -473,6 +633,9 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 為當前節點添加必填參數
|
||||
*
|
||||
* @param name the name
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder required(@NotNull String name) {
|
||||
return param(name, true);
|
||||
|
|
@ -480,6 +643,9 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 為當前節點添加可選參數
|
||||
*
|
||||
* @param name the name
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder optional(@NotNull String name) {
|
||||
return param(name, false);
|
||||
|
|
@ -487,6 +653,9 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 為當前節點添加多個參數
|
||||
*
|
||||
* @param parameters the parameters
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder params(@NotNull Parameter... parameters) {
|
||||
checkBuilt();
|
||||
|
|
@ -496,6 +665,9 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 設置當前節點的展開狀態
|
||||
*
|
||||
* @param expanded the expanded
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder expanded(boolean expanded) {
|
||||
checkBuilt();
|
||||
|
|
@ -512,6 +684,11 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 添加一個完整的命令分支(鏈式調用)
|
||||
*
|
||||
* @param name the name
|
||||
* @param description the description
|
||||
* @param configurator the configurator
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder branch(@NotNull String name, @NotNull MutableComponent description,
|
||||
@NotNull BranchConfigurator configurator) {
|
||||
|
|
@ -523,6 +700,11 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 添加一個完整的命令分支(使用翻譯鍵)
|
||||
*
|
||||
* @param name the name
|
||||
* @param translationKey the translation key
|
||||
* @param configurator the configurator
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder branch(@NotNull String name, @NotNull String translationKey,
|
||||
@NotNull BranchConfigurator configurator) {
|
||||
|
|
@ -531,6 +713,11 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 快速添加葉子節點(沒有子節點的節點)
|
||||
*
|
||||
* @param name the name
|
||||
* @param description the description
|
||||
* @param parameters the parameters
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder leaf(@NotNull String name, @NotNull MutableComponent description,
|
||||
@NotNull Parameter @NotNull ... parameters) {
|
||||
|
|
@ -544,6 +731,11 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 快速添加葉子節點(使用翻譯鍵)
|
||||
*
|
||||
* @param name the name
|
||||
* @param translationKey the translation key
|
||||
* @param parameters the parameters
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder leaf(@NotNull String name, @NotNull String translationKey,
|
||||
@NotNull Parameter... parameters) {
|
||||
|
|
@ -552,6 +744,9 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 批量添加多個葉子節點
|
||||
*
|
||||
* @param commands the commands
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder leaves(@NotNull Map<String, MutableComponent> commands) {
|
||||
for (Map.Entry<String, MutableComponent> entry : commands.entrySet()) {
|
||||
|
|
@ -559,8 +754,12 @@ public class CommandNode {
|
|||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加多個葉子節點
|
||||
*
|
||||
* @param commands the commands
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder leavesT(@NotNull Map<String, String> commands) {
|
||||
for (Map.Entry<String, String> entry : commands.entrySet()) {
|
||||
|
|
@ -571,6 +770,9 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 批量添加多個帶參數的葉子節點
|
||||
*
|
||||
* @param commands the commands
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder leavesWithParams(@NotNull Map<String, LeafConfig> commands) {
|
||||
for (Map.Entry<String, LeafConfig> entry : commands.entrySet()) {
|
||||
|
|
@ -588,6 +790,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 構建命令樹
|
||||
*
|
||||
* @return the command node
|
||||
*/
|
||||
public @NotNull CommandNode build() {
|
||||
checkBuilt();
|
||||
|
|
@ -600,6 +804,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 重置構建器(重用)
|
||||
*
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder reset() {
|
||||
nodeStack.clear();
|
||||
|
|
@ -619,6 +825,11 @@ public class CommandNode {
|
|||
*/
|
||||
@FunctionalInterface
|
||||
public interface BranchConfigurator {
|
||||
/**
|
||||
* Configure.
|
||||
*
|
||||
* @param builder the builder
|
||||
*/
|
||||
void configure(@NotNull Builder builder);
|
||||
}
|
||||
|
||||
|
|
@ -628,22 +839,48 @@ public class CommandNode {
|
|||
public record LeafConfig(@NotNull MutableComponent description,
|
||||
@Nullable List<Parameter> parameters) {
|
||||
|
||||
/**
|
||||
* Of leaf config.
|
||||
*
|
||||
* @param description the description
|
||||
* @return the leaf config
|
||||
*/
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull LeafConfig of(@NotNull MutableComponent description) {
|
||||
return new LeafConfig(description, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Of leaf config.
|
||||
*
|
||||
* @param description the description
|
||||
* @param parameters the parameters
|
||||
* @return the leaf config
|
||||
*/
|
||||
@Contract("_, _ -> new")
|
||||
public static @NotNull LeafConfig of(@NotNull MutableComponent description,
|
||||
@NotNull Parameter... parameters) {
|
||||
return new LeafConfig(description, Arrays.asList(parameters));
|
||||
}
|
||||
|
||||
/**
|
||||
* Of leaf config.
|
||||
*
|
||||
* @param translationKey the translation key
|
||||
* @return the leaf config
|
||||
*/
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull LeafConfig of(@NotNull String translationKey) {
|
||||
return new LeafConfig(Component.translatable(translationKey), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Of leaf config.
|
||||
*
|
||||
* @param translationKey the translation key
|
||||
* @param parameters the parameters
|
||||
* @return the leaf config
|
||||
*/
|
||||
@Contract("_, _ -> new")
|
||||
public static @NotNull LeafConfig of(@NotNull String translationKey,
|
||||
@NotNull Parameter... parameters) {
|
||||
|
|
@ -656,6 +893,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 添加多個參數
|
||||
*
|
||||
* @param parameters the parameters
|
||||
*/
|
||||
public void addParameters(@NotNull Parameter @NotNull ... parameters) {
|
||||
for (Parameter param : parameters) {
|
||||
|
|
@ -665,6 +904,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 檢查是否有子節點
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
public boolean hasChildren() {
|
||||
return !children.isEmpty();
|
||||
|
|
@ -672,6 +913,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 檢查是否有參數
|
||||
*
|
||||
* @return the boolean
|
||||
*/
|
||||
public boolean hasParameters() {
|
||||
return !parameters.isEmpty();
|
||||
|
|
@ -679,6 +922,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 獲取節點深度(根節點為0)
|
||||
*
|
||||
* @return the depth
|
||||
*/
|
||||
public int getDepth() {
|
||||
if (isRoot || parent == null) {
|
||||
|
|
@ -689,6 +934,9 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 查找子節點(支持遞歸查找)
|
||||
*
|
||||
* @param path the path
|
||||
* @return the command node
|
||||
*/
|
||||
@Nullable
|
||||
public CommandNode findChild(@NotNull String @NotNull ... path) {
|
||||
|
|
@ -709,6 +957,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 獲取完整的命令(用於點擊建議)
|
||||
*
|
||||
* @return the suggested command
|
||||
*/
|
||||
public String getSuggestedCommand() {
|
||||
StringBuilder sb = new StringBuilder(getFullCommand());
|
||||
|
|
@ -733,6 +983,8 @@ public class CommandNode {
|
|||
|
||||
/**
|
||||
* 獲取根節點
|
||||
*
|
||||
* @return the root
|
||||
*/
|
||||
public CommandNode getRoot() {
|
||||
if (isRoot) {
|
||||
|
|
|
|||
|
|
@ -20,12 +20,24 @@ public final class CommandPath {
|
|||
this.fullPath = String.join(" ", segments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Of command path.
|
||||
*
|
||||
* @param segments the segments
|
||||
* @return the command path
|
||||
*/
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull CommandPath of(String... segments) {
|
||||
validateSegments(segments);
|
||||
return new CommandPath(List.of(segments));
|
||||
}
|
||||
|
||||
/**
|
||||
* From string command path.
|
||||
*
|
||||
* @param path the path
|
||||
* @return the command path
|
||||
*/
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull CommandPath fromString(@NotNull String path) {
|
||||
if (path.charAt(0) == '/') {
|
||||
|
|
@ -34,6 +46,12 @@ public final class CommandPath {
|
|||
return of(path.split(" "));
|
||||
}
|
||||
|
||||
/**
|
||||
* Then command path.
|
||||
*
|
||||
* @param subSegments the sub segments
|
||||
* @return the command path
|
||||
*/
|
||||
@Contract("_ -> new")
|
||||
public @NotNull CommandPath then(String... subSegments) {
|
||||
validateSegments(subSegments);
|
||||
|
|
@ -42,6 +60,11 @@ public final class CommandPath {
|
|||
return new CommandPath(newSegments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parent optional.
|
||||
*
|
||||
* @return the optional
|
||||
*/
|
||||
public Optional<CommandPath> parent() {
|
||||
if (segments.size() <= 1) {
|
||||
return Optional.empty();
|
||||
|
|
@ -49,14 +72,29 @@ public final class CommandPath {
|
|||
return Optional.of(new CommandPath(segments.subList(0, segments.size() - 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Last segment string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String lastSegment() {
|
||||
return segments.isEmpty() ? "" : segments.get(segments.size() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Segments string @ not null [ ].
|
||||
*
|
||||
* @return the string @ not null [ ]
|
||||
*/
|
||||
public String @NotNull [] segments() {
|
||||
return segments.toArray(new String[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Full path string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String fullPath() {
|
||||
return fullPath;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,15 @@ import org.jetbrains.annotations.NotNull;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Parameter.
|
||||
*/
|
||||
public record Parameter(String name, boolean required) {
|
||||
|
||||
/**
|
||||
* 獲取參數類型標識
|
||||
*
|
||||
* @return the type indicator
|
||||
*/
|
||||
@Contract(pure = true)
|
||||
public @NotNull String getTypeIndicator() {
|
||||
|
|
@ -21,25 +26,50 @@ public record Parameter(String name, boolean required) {
|
|||
return String.format("Parameter{name='%s', required=%s}", name, required);
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Builder.
|
||||
*/
|
||||
public static class Builder {
|
||||
private final List<Parameter> parameters = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Required builder.
|
||||
*
|
||||
* @param name the name
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder required(String name) {
|
||||
parameters.add(new Parameter(name, true));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional builder.
|
||||
*
|
||||
* @param name the name
|
||||
* @return the builder
|
||||
*/
|
||||
public Builder optional(String name) {
|
||||
parameters.add(new Parameter(name, false));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build parameter [ ].
|
||||
*
|
||||
* @return the parameter [ ]
|
||||
*/
|
||||
public Parameter[] build() {
|
||||
return parameters.toArray(new Parameter[0]);
|
||||
}
|
||||
|
||||
// 链式调用的便利方法
|
||||
/**
|
||||
* Builder parameter . builder.
|
||||
*
|
||||
* @return the parameter . builder
|
||||
*/
|
||||
// 链式调用的便利方法
|
||||
@Contract(" -> new")
|
||||
public static @NotNull Parameter.Builder builder() {
|
||||
return new Builder();
|
||||
|
|
|
|||
|
|
@ -32,10 +32,22 @@ public class ClientEventHandler {
|
|||
public static void onRegisterShaders(RegisterShadersEvent event) {
|
||||
Lib39Shaders.register(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* On register renderer.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public static void onRegisterRenderer (EntityRenderersEvent.RegisterRenderers event) {
|
||||
// event.registerBlockEntityRenderer(Lib39BlockEntities.DOLL_BLOCK_ENTITY.get(), context -> new DollBlockEntityRenderer());
|
||||
}
|
||||
|
||||
/**
|
||||
* On model baking.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public static void onModelBaking(ModelEvent.RegisterAdditional event) {
|
||||
// event.register(DollItemRenderer.DOLL_ITEM_MODEL);
|
||||
|
|
@ -43,6 +55,12 @@ public class ClientEventHandler {
|
|||
// event.register(DollItemRenderer.DOLL_WITHOUT_ITEM_MODEL);
|
||||
// event.register(DollItemRenderer.DOLL_NEED_ITEM_MODEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* On model baking.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public static void onModelBaking(ModelEvent.ModifyBakingResult event) {
|
||||
// Map<ResourceLocation, BakedModel> modelRegistry = event.getModels();
|
||||
|
|
|
|||
|
|
@ -153,6 +153,12 @@ public class CommonEventHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On register command.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public static void onRegisterCommand (RegisterCommandsEvent event) {
|
||||
Lib39HelpCommand lib39HelpCommand = new Lib39HelpCommand(event);
|
||||
|
|
|
|||
|
|
@ -6,16 +6,48 @@ import java.nio.file.Path;
|
|||
import java.nio.file.Paths;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* The type Class encryptor.
|
||||
*/
|
||||
public class ClassEncryptor {
|
||||
static {
|
||||
System.loadLibrary("ClassEncrypt");
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypt class byte [ ].
|
||||
*
|
||||
* @param classData the class data
|
||||
* @param key the key
|
||||
* @return the byte [ ]
|
||||
*/
|
||||
public native byte[] encryptClass(byte[] classData, String key);
|
||||
|
||||
/**
|
||||
* Decrypt class byte [ ].
|
||||
*
|
||||
* @param encryptedData the encrypted data
|
||||
* @param key the key
|
||||
* @return the byte [ ]
|
||||
*/
|
||||
public native byte[] decryptClass(byte[] encryptedData, String key);
|
||||
|
||||
/**
|
||||
* Is encrypted file boolean.
|
||||
*
|
||||
* @param fileData the file data
|
||||
* @return the boolean
|
||||
*/
|
||||
public native boolean isEncryptedFile(byte[] fileData);
|
||||
|
||||
/**
|
||||
* Encrypt class file.
|
||||
*
|
||||
* @param inputPath the input path
|
||||
* @param outputPath the output path
|
||||
* @param key the key
|
||||
* @throws IOException the io exception
|
||||
*/
|
||||
public void encryptClassFile(String inputPath, String outputPath, String key)
|
||||
throws IOException {
|
||||
byte[] classData = Files.readAllBytes(Paths.get(inputPath));
|
||||
|
|
@ -25,6 +57,14 @@ public class ClassEncryptor {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encrypt directory.
|
||||
*
|
||||
* @param inputDir the input dir
|
||||
* @param outputDir the output dir
|
||||
* @param key the key
|
||||
* @throws IOException the io exception
|
||||
*/
|
||||
public void encryptDirectory(String inputDir, String outputDir, String key)
|
||||
throws IOException {
|
||||
try (Stream<Path> walk = Files.walk(Paths.get(inputDir))) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ import java.nio.file.Paths;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The type Encrypted class loader.
|
||||
*/
|
||||
public class EncryptedClassLoader extends ClassLoader {
|
||||
static {
|
||||
System.loadLibrary("ClassEncrypt");
|
||||
|
|
@ -21,11 +24,24 @@ public class EncryptedClassLoader extends ClassLoader {
|
|||
// 缓存已加载的类字节码,避免重复加载
|
||||
private final Map<String, byte[]> classBytesCache = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Instantiates a new Encrypted class loader.
|
||||
*
|
||||
* @param encryptedClassPath the encrypted class path
|
||||
* @param key the key
|
||||
*/
|
||||
public EncryptedClassLoader(String encryptedClassPath, String key) {
|
||||
this.encryptedClassPath = encryptedClassPath;
|
||||
this.decryptionKey = key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Encrypted class loader.
|
||||
*
|
||||
* @param encryptedClassPath the encrypted class path
|
||||
* @param key the key
|
||||
* @param parent the parent
|
||||
*/
|
||||
public EncryptedClassLoader(String encryptedClassPath, String key, ClassLoader parent) {
|
||||
super(parent);
|
||||
this.encryptedClassPath = encryptedClassPath;
|
||||
|
|
@ -129,7 +145,14 @@ public class EncryptedClassLoader extends ClassLoader {
|
|||
return clazz;
|
||||
}
|
||||
|
||||
// 添加获取类字节码的方法
|
||||
/**
|
||||
* Get class bytes byte [ ].
|
||||
*
|
||||
* @param className the class name
|
||||
* @return the byte [ ]
|
||||
* @throws ClassNotFoundException the class not found exception
|
||||
*/
|
||||
// 添加获取类字节码的方法
|
||||
public byte[] getClassBytes(String className) throws ClassNotFoundException {
|
||||
synchronized (classBytesCache) {
|
||||
byte[] bytes = classBytesCache.get(className);
|
||||
|
|
@ -182,12 +205,20 @@ public class EncryptedClassLoader extends ClassLoader {
|
|||
return super.getResource(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear cache.
|
||||
*/
|
||||
public void clearCache() {
|
||||
synchronized (classBytesCache) {
|
||||
classBytesCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear cache.
|
||||
*
|
||||
* @param className the class name
|
||||
*/
|
||||
public void clearCache(String className) {
|
||||
synchronized (classBytesCache) {
|
||||
classBytesCache.remove(className);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public class SimpleLanguageProvider extends LanguageProvider {
|
|||
this.orderedKeys = new ArrayList<>();
|
||||
initializeTranslations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Simple language provider.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -261,11 +261,11 @@ public class LangKeyValue implements ILangKeyValue {
|
|||
/**
|
||||
* Of supplier lang key value.
|
||||
*
|
||||
* @param supplier the supplier
|
||||
* @param MPE the mpe
|
||||
* @param US_EN the us en
|
||||
* @param SIM_CN the sim cn
|
||||
* @param TRA_CN the tra cn
|
||||
* @param supplier the supplier
|
||||
* @param MPE the mpe
|
||||
* @param US_EN the us en
|
||||
* @param SIM_CN the sim cn
|
||||
* @param TRA_CN the tra cn
|
||||
* @param isDefault the is default
|
||||
* @return the lang key value
|
||||
*/
|
||||
|
|
@ -405,12 +405,12 @@ public class LangKeyValue implements ILangKeyValue {
|
|||
/**
|
||||
* Of key lang key value.
|
||||
*
|
||||
* @param key the key
|
||||
* @param MPE the mpe
|
||||
* @param US_EN the us en
|
||||
* @param SIM_CN the sim cn
|
||||
* @param TRA_CN the tra cn
|
||||
* @param LZH the lzh
|
||||
* @param key the key
|
||||
* @param MPE the mpe
|
||||
* @param US_EN the us en
|
||||
* @param SIM_CN the sim cn
|
||||
* @param TRA_CN the tra cn
|
||||
* @param LZH the lzh
|
||||
* @param isDefault the is default
|
||||
* @return the lang key value
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The type Lib 39 mixin plugin.
|
||||
*/
|
||||
public class Lib39MixinPlugin implements IMixinConfigPlugin {
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,23 @@ import top.r3944realms.lib39.api.event.MinecraftSetUpServiceEvent;
|
|||
|
||||
import java.net.Proxy;
|
||||
|
||||
/**
|
||||
* The type Mixin dedicate server.
|
||||
*/
|
||||
@Mixin(DedicatedServer.class)
|
||||
public abstract class MixinDedicateServer extends MinecraftServer implements ServerInterface {
|
||||
/**
|
||||
* Instantiates a new Mixin dedicate server.
|
||||
*
|
||||
* @param serverThread the server thread
|
||||
* @param storageSource the storage source
|
||||
* @param packRepository the pack repository
|
||||
* @param worldStem the world stem
|
||||
* @param proxy the proxy
|
||||
* @param fixerUpper the fixer upper
|
||||
* @param services the services
|
||||
* @param progressListenerFactory the progress listener factory
|
||||
*/
|
||||
public MixinDedicateServer(Thread serverThread, LevelStorageSource.LevelStorageAccess storageSource, PackRepository packRepository, WorldStem worldStem, Proxy proxy, DataFixer fixerUpper, Services services, ChunkProgressListenerFactory progressListenerFactory) {
|
||||
super(serverThread, storageSource, packRepository, worldStem, proxy, fixerUpper, services, progressListenerFactory);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,27 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import top.r3944realms.lib39.api.event.MinecraftSetUpServiceEvent;
|
||||
|
||||
/**
|
||||
* The type Mixin minecraft.
|
||||
*/
|
||||
@Mixin(Minecraft.class)
|
||||
public abstract class MixinMinecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft {
|
||||
/**
|
||||
* Instantiates a new Mixin minecraft.
|
||||
*
|
||||
* @param name the name
|
||||
*/
|
||||
public MixinMinecraft(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set level setup.
|
||||
*
|
||||
* @param levelClient the level client
|
||||
* @param ci the ci
|
||||
* @param services the services
|
||||
*/
|
||||
@Inject(
|
||||
method = "setLevel",
|
||||
at = @At(
|
||||
|
|
@ -34,6 +50,17 @@ public abstract class MixinMinecraft extends ReentrantBlockableEventLoop<Runnabl
|
|||
MinecraftForge.EVENT_BUS.post(new MinecraftSetUpServiceEvent(services,this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Do world load setup.
|
||||
*
|
||||
* @param levelId the level id
|
||||
* @param level the level
|
||||
* @param packRepository the pack repository
|
||||
* @param worldStem the world stem
|
||||
* @param newWorld the new world
|
||||
* @param ci the ci
|
||||
* @param services the services
|
||||
*/
|
||||
@Inject(
|
||||
method = "doWorldLoad",
|
||||
at = @At(
|
||||
|
|
|
|||
|
|
@ -8,78 +8,243 @@ import org.jetbrains.annotations.Contract;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
import top.r3944realms.lib39.Lib39;
|
||||
|
||||
/**
|
||||
* The type Plant helper.
|
||||
*/
|
||||
public class PlantHelper {
|
||||
/**
|
||||
* The enum Plant.
|
||||
*/
|
||||
public enum Plant implements StringRepresentable {
|
||||
// 树苗
|
||||
/**
|
||||
* Acacia sapling plant.
|
||||
*/
|
||||
// 树苗
|
||||
ACACIA_SAPLING("acacia_sapling", Items.ACACIA_SAPLING),
|
||||
/**
|
||||
* Bamboo plant.
|
||||
*/
|
||||
BAMBOO("bamboo_stage0", Items.BAMBOO),
|
||||
/**
|
||||
* Birch sapling plant.
|
||||
*/
|
||||
BIRCH_SAPLING("birch_sapling", Items.BIRCH_SAPLING),
|
||||
/**
|
||||
* Cherry sapling plant.
|
||||
*/
|
||||
CHERRY_SAPLING("cherry_sapling", Items.CHERRY_SAPLING),
|
||||
/**
|
||||
* Dark oak sapling plant.
|
||||
*/
|
||||
DARK_OAK_SAPLING("dark_oak_sapling", Items.DARK_OAK_SAPLING),
|
||||
/**
|
||||
* Dead bush plant.
|
||||
*/
|
||||
DEAD_BUSH("dead_bush", Items.DEAD_BUSH),
|
||||
/**
|
||||
* Jungle sapling plant.
|
||||
*/
|
||||
JUNGLE_SAPLING("jungle_sapling", Items.JUNGLE_SAPLING),
|
||||
/**
|
||||
* Oak sapling plant.
|
||||
*/
|
||||
OAK_SAPLING("oak_sapling", Items.OAK_SAPLING),
|
||||
/**
|
||||
* Spruce sapling plant.
|
||||
*/
|
||||
SPRUCE_SAPLING("spruce_sapling", Items.SPRUCE_SAPLING),
|
||||
|
||||
// 花
|
||||
/**
|
||||
* Allium plant.
|
||||
*/
|
||||
// 花
|
||||
ALLIUM("allium", Items.ALLIUM),
|
||||
/**
|
||||
* Azure bluet plant.
|
||||
*/
|
||||
AZURE_BLUET("azure_bluet", Items.AZURE_BLUET),
|
||||
/**
|
||||
* Cornflower plant.
|
||||
*/
|
||||
CORNFLOWER("cornflower", Items.CORNFLOWER),
|
||||
/**
|
||||
* Dandelion plant.
|
||||
*/
|
||||
DANDELION("dandelion", Items.DANDELION),
|
||||
/**
|
||||
* Lily of the valley plant.
|
||||
*/
|
||||
LILY_OF_THE_VALLEY("lily_of_the_valley", Items.LILY_OF_THE_VALLEY),
|
||||
/**
|
||||
* Oxeye daisy plant.
|
||||
*/
|
||||
OXEYE_DAISY("oxeye_daisy", Items.OXEYE_DAISY),
|
||||
/**
|
||||
* Orange tulip plant.
|
||||
*/
|
||||
ORANGE_TULIP("orange_tulip", Items.ORANGE_TULIP),
|
||||
/**
|
||||
* Pink tulip plant.
|
||||
*/
|
||||
PINK_TULIP("pink_tulip", Items.PINK_TULIP),
|
||||
/**
|
||||
* Red tulip plant.
|
||||
*/
|
||||
RED_TULIP("red_tulip", Items.RED_TULIP),
|
||||
/**
|
||||
* White tulip plant.
|
||||
*/
|
||||
WHITE_TULIP("white_tulip", Items.WHITE_TULIP),
|
||||
/**
|
||||
* Wither rose plant.
|
||||
*/
|
||||
WITHER_ROSE("wither_rose", Items.WITHER_ROSE),
|
||||
/**
|
||||
* Poppy plant.
|
||||
*/
|
||||
POPPY("poppy", Items.POPPY),
|
||||
|
||||
|
||||
// 晶体
|
||||
/**
|
||||
* Amethyst cluster plant.
|
||||
*/
|
||||
// 晶体
|
||||
AMETHYST_CLUSTER("amethyst_cluster", Items.AMETHYST_CLUSTER),
|
||||
|
||||
// 珊瑚
|
||||
/**
|
||||
* Brain coral plant.
|
||||
*/
|
||||
// 珊瑚
|
||||
BRAIN_CORAL("brain_coral", Items.BRAIN_CORAL),
|
||||
/**
|
||||
* Brain coral fan plant.
|
||||
*/
|
||||
BRAIN_CORAL_FAN("brain_coral_fan", Items.BRAIN_CORAL_FAN),
|
||||
/**
|
||||
* Bubble coral plant.
|
||||
*/
|
||||
BUBBLE_CORAL("bubble_coral", Items.BUBBLE_CORAL),
|
||||
/**
|
||||
* Bubble coral fan plant.
|
||||
*/
|
||||
BUBBLE_CORAL_FAN("bubble_coral_fan", Items.BUBBLE_CORAL_FAN),
|
||||
/**
|
||||
* Fire coral plant.
|
||||
*/
|
||||
FIRE_CORAL("fire_coral", Items.FIRE_CORAL),
|
||||
/**
|
||||
* Fire coral fan plant.
|
||||
*/
|
||||
FIRE_CORAL_FAN("fire_coral_fan", Items.FIRE_CORAL_FAN),
|
||||
/**
|
||||
* Horn coral plant.
|
||||
*/
|
||||
HORN_CORAL("horn_coral", Items.HORN_CORAL),
|
||||
/**
|
||||
* Horn coral fan plant.
|
||||
*/
|
||||
HORN_CORAL_FAN("horn_coral_fan", Items.HORN_CORAL_FAN),
|
||||
/**
|
||||
* Tube coral plant.
|
||||
*/
|
||||
TUBE_CORAL("tube_coral", Items.TUBE_CORAL),
|
||||
/**
|
||||
* Tube coral fan plant.
|
||||
*/
|
||||
TUBE_CORAL_FAN("tube_coral_fan", Items.TUBE_CORAL_FAN),
|
||||
/**
|
||||
* Dead fire coral plant.
|
||||
*/
|
||||
DEAD_FIRE_CORAL("dead_fire_coral", Items.DEAD_FIRE_CORAL),
|
||||
/**
|
||||
* Dead fire coral fan plant.
|
||||
*/
|
||||
DEAD_FIRE_CORAL_FAN("dead_fire_coral_fan", Items.DEAD_FIRE_CORAL_FAN),
|
||||
/**
|
||||
* Dead horn coral plant.
|
||||
*/
|
||||
DEAD_HORN_CORAL("dead_horn_coral", Items.DEAD_HORN_CORAL),
|
||||
/**
|
||||
* Dead horn coral fan plant.
|
||||
*/
|
||||
DEAD_HORN_CORAL_FAN("dead_horn_coral_fan", Items.DEAD_HORN_CORAL_FAN),
|
||||
/**
|
||||
* Dead tube coral plant.
|
||||
*/
|
||||
DEAD_TUBE_CORAL("dead_tube_coral", Items.DEAD_TUBE_CORAL),
|
||||
/**
|
||||
* Dead tube coral fan plant.
|
||||
*/
|
||||
DEAD_TUBE_CORAL_FAN("dead_tube_coral_fan", Items.DEAD_TUBE_CORAL_FAN),
|
||||
/**
|
||||
* Dead brain coral plant.
|
||||
*/
|
||||
DEAD_BRAIN_CORAL("dead_brain_coral", Items.DEAD_BRAIN_CORAL),
|
||||
/**
|
||||
* Dead brain coral fan plant.
|
||||
*/
|
||||
DEAD_BRAIN_CORAL_FAN("dead_brain_coral_fan", Items.DEAD_BRAIN_CORAL_FAN),
|
||||
/**
|
||||
* Dead bubble coral plant.
|
||||
*/
|
||||
DEAD_BUBBLE_CORAL("dead_bubble_coral", Items.DEAD_BUBBLE_CORAL),
|
||||
/**
|
||||
* Dead bubble coral fan plant.
|
||||
*/
|
||||
DEAD_BUBBLE_CORAL_FAN("dead_bubble_coral_fan", Items.DEAD_BUBBLE_CORAL_FAN),
|
||||
|
||||
// 蘑菇
|
||||
/**
|
||||
* Crimson fungus plant.
|
||||
*/
|
||||
// 蘑菇
|
||||
CRIMSON_FUNGUS("crimson_fungus", Items.CRIMSON_FUNGUS),
|
||||
/**
|
||||
* Red mushroom plant.
|
||||
*/
|
||||
RED_MUSHROOM("red_mushroom", Items.RED_MUSHROOM),
|
||||
/**
|
||||
* Brown mushroom plant.
|
||||
*/
|
||||
BROWN_MUSHROOM("brown_mushroom", Items.BROWN_MUSHROOM),
|
||||
/**
|
||||
* Warped fungus plant.
|
||||
*/
|
||||
WARPED_FUNGUS("warped_fungus", Items.WARPED_FUNGUS),
|
||||
|
||||
|
||||
// Grass
|
||||
/**
|
||||
* Crimson roots pot plant.
|
||||
*/
|
||||
// Grass
|
||||
// CRIMSON_ROOTS("crimson_roots"),
|
||||
CRIMSON_ROOTS_POT("crimson_roots_pot", Items.CRIMSON_ROOTS),
|
||||
/**
|
||||
* Warped roots pot plant.
|
||||
*/
|
||||
// WARPED_ROOTS("warped_roots"),
|
||||
WARPED_ROOTS_POT("warped_roots_pot", Items.WARPED_ROOTS),
|
||||
|
||||
// Other
|
||||
/**
|
||||
* Cobweb plant.
|
||||
*/
|
||||
// Other
|
||||
COBWEB("cobweb", Items.COBWEB),
|
||||
/**
|
||||
* Redstone torch plant.
|
||||
*/
|
||||
REDSTONE_TORCH("redstone_torch", Items.REDSTONE_TORCH),
|
||||
/**
|
||||
* Torch plant.
|
||||
*/
|
||||
TORCH("torch", Items.TORCH),
|
||||
;
|
||||
/**
|
||||
* The Name.
|
||||
*/
|
||||
public final String name;
|
||||
/**
|
||||
* The Item.
|
||||
*/
|
||||
public final Item item;
|
||||
Plant(String name, Item item) {
|
||||
this.name = name;
|
||||
|
|
@ -95,10 +260,24 @@ public class PlantHelper {
|
|||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets texture rl.
|
||||
*
|
||||
* @param plant the plant
|
||||
* @return the texture rl
|
||||
*/
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull ResourceLocation getTextureRL(@NotNull Plant plant) {
|
||||
return Lib39.mrl("block/" + plant.name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets directly texture rl.
|
||||
*
|
||||
* @param plant the plant
|
||||
* @return the directly texture rl
|
||||
*/
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull ResourceLocation getDirectlyTextureRL(@NotNull Plant plant) {
|
||||
return Lib39.mrl("textures/block/" + plant.name + ".png");
|
||||
|
|
|
|||
|
|
@ -7,14 +7,34 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* The type Skin helper.
|
||||
*/
|
||||
public class SkinHelper {
|
||||
/**
|
||||
* The constant DEFAULT.
|
||||
*/
|
||||
public static ResourceLocation DEFAULT = DefaultPlayerSkin.getDefaultSkin();
|
||||
|
||||
/**
|
||||
* Gets skin texture.
|
||||
*
|
||||
* @param gameProfile the game profile
|
||||
* @return the skin texture
|
||||
*/
|
||||
public static ResourceLocation getSkinTexture(@Nullable GameProfile gameProfile) {
|
||||
if (gameProfile == null) {
|
||||
return DEFAULT;
|
||||
}
|
||||
return resolveSkinTexture(gameProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve skin texture resource location.
|
||||
*
|
||||
* @param gameProfile the game profile
|
||||
* @return the resource location
|
||||
*/
|
||||
public static @NotNull ResourceLocation resolveSkinTexture(@NotNull GameProfile gameProfile) {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
return minecraft.getSkinManager()
|
||||
|
|
|
|||
|
|
@ -479,9 +479,9 @@ public class NBTWriter {
|
|||
/**
|
||||
* Compound if nbt writer.
|
||||
*
|
||||
* @param key the key
|
||||
* @param condition the condition
|
||||
* @param compoundTag the compoundTag
|
||||
* @param key the key
|
||||
* @param condition the condition
|
||||
* @param compoundTag the compoundTag
|
||||
* @return the nbt writer
|
||||
*/
|
||||
public NBTWriter compoundIf(String key, boolean condition, Supplier<CompoundTag> compoundTag) {
|
||||
|
|
@ -545,7 +545,7 @@ public class NBTWriter {
|
|||
*
|
||||
* @param key the key
|
||||
* @param condition the condition
|
||||
* @param listTag the listTag
|
||||
* @param listTag the listTag
|
||||
* @return the nbt writer
|
||||
*/
|
||||
public NBTWriter listIf(String key, boolean condition, Supplier<ListTag> listTag) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user