From 3e1100a27ca9e4f0da97576a23a975f6f423b53b Mon Sep 17 00:00:00 2001 From: TexTrue <3140846162@qq.com> Date: Thu, 23 May 2024 21:33:37 +0800 Subject: [PATCH] update MaFgLib version --- CHANGELOG.md | 2 +- gradle.properties | 4 +- .../fi/dy/masa/itemscroller/ItemScroller.java | 20 +-- .../dy/masa/itemscroller/gui/GuiConfigs.java | 2 +- .../rocknroller/RocknRoller.java | 27 +++ .../assets/rocknroller/lang/en_us.json | 2 +- .../assets/rocknroller/lang/zh_cn.json | 157 ++++++++++++++++++ 7 files changed, 193 insertions(+), 21 deletions(-) create mode 100644 src/main/java/org/thinkingstudio/rocknroller/RocknRoller.java create mode 100644 src/main/resources/assets/rocknroller/lang/zh_cn.json diff --git a/CHANGELOG.md b/CHANGELOG.md index ba0c57e..7e57227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,2 @@ ## Change -- update NeoForge & MaFgLib version \ No newline at end of file +- update MaFgLib version \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 83e6dc0..1ad6915 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ loom.platform=neoforge yarn_mappings=1.20.4+build.3 # Mod Properties - mod_version=0.1.1 + mod_version=0.1.2 maven_group=org.thinkingstudio.rocknroller archives_base_name=RocknRoller mod_id=rocknroller @@ -19,4 +19,4 @@ loom.platform=neoforge curseforge_id=916852 # Dependencies - malilib_version=0.1.5-mc1.20.4 \ No newline at end of file + malilib_version=0.1.7-mc1.20.4 \ No newline at end of file diff --git a/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java b/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java index 7375397..391702f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java +++ b/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java @@ -1,26 +1,14 @@ package fi.dy.masa.itemscroller; -import fi.dy.masa.itemscroller.gui.GuiConfigs; -import fi.dy.masa.malilib.compat.neoforge.ForgePlatformUtils; -import net.neoforged.fml.common.Mod; -import net.neoforged.fml.loading.FMLLoader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import fi.dy.masa.malilib.event.InitializationHandler; -@Mod(Reference.MOD_ID) public class ItemScroller { public static final Logger logger = LogManager.getLogger(Reference.MOD_ID); - public ItemScroller() { - if (FMLLoader.getDist().isClient()) { - ForgePlatformUtils.getInstance().getClientModIgnoredServerOnly(); - InitializationHandler.getInstance().registerInitializationHandler(new InitHandler()); - ForgePlatformUtils.getInstance().getMod(Reference.MOD_ID).registerModConfigScreen((screen) -> { - GuiConfigs gui = new GuiConfigs(); - gui.setParent(screen); - return gui; - }); - } + public static void onInitialize() + { + InitializationHandler.getInstance().registerInitializationHandler(new InitHandler()); } -} +} \ No newline at end of file diff --git a/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java index 8cdafad..62e2c92 100644 --- a/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java +++ b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java @@ -19,7 +19,7 @@ public class GuiConfigs extends GuiConfigsBase public GuiConfigs() { - super(10, 50, Reference.MOD_ID, null, "itemscroller.gui.title.configs"); + super(10, 50, Reference.MOD_ID, null, "itemscroller.gui.title.configs", Reference.MOD_NAME, Reference.MOD_VERSION); } @Override diff --git a/src/main/java/org/thinkingstudio/rocknroller/RocknRoller.java b/src/main/java/org/thinkingstudio/rocknroller/RocknRoller.java new file mode 100644 index 0000000..eefd0e5 --- /dev/null +++ b/src/main/java/org/thinkingstudio/rocknroller/RocknRoller.java @@ -0,0 +1,27 @@ +package org.thinkingstudio.rocknroller; + +import fi.dy.masa.itemscroller.ItemScroller; +import fi.dy.masa.itemscroller.Reference; +import fi.dy.masa.itemscroller.gui.GuiConfigs; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.loading.FMLLoader; +import org.thinkingstudio.mafglib.util.ForgePlatformUtils; + +@Mod(Reference.MOD_ID) +public class RocknRoller { + public RocknRoller() { + if (FMLLoader.getDist().isClient()) { + // Make sure the mod being absent on the other network side does not cause + // the client to display the server as incompatible + ForgePlatformUtils.getInstance().getClientModIgnoredServerOnly(); + ItemScroller.onInitialize(); + + // Config Screen + ForgePlatformUtils.getInstance().registerModConfigScreen(Reference.MOD_ID, (screen) -> { + GuiConfigs gui = new GuiConfigs(); + gui.setParent(screen); + return gui; + }); + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/rocknroller/lang/en_us.json b/src/main/resources/assets/rocknroller/lang/en_us.json index 7247a15..839ed36 100644 --- a/src/main/resources/assets/rocknroller/lang/en_us.json +++ b/src/main/resources/assets/rocknroller/lang/en_us.json @@ -7,7 +7,7 @@ "itemscroller.gui.label.trades": "Trades", "itemscroller.gui.label.trade_uses": "Trade uses: %d / %d", - "itemscroller.gui.title.configs": "Item Scroller Configs", + "itemscroller.gui.title.configs": "%s Configs - %s", "itemscroller.message.toggled_mod_off": "Toggled all Item Scroller functionality §cOFF", "itemscroller.message.toggled_mod_on": "Toggled all Item Scroller functionality §aON" diff --git a/src/main/resources/assets/rocknroller/lang/zh_cn.json b/src/main/resources/assets/rocknroller/lang/zh_cn.json new file mode 100644 index 0000000..6604148 --- /dev/null +++ b/src/main/resources/assets/rocknroller/lang/zh_cn.json @@ -0,0 +1,157 @@ +{ + + "itemscroller.gui.button.config_gui.generic": "通用", + "itemscroller.gui.button.config_gui.hotkeys": "快捷键", + "itemscroller.gui.button.config_gui.toggles": "开关", + + "itemscroller.gui.label.recipe_page": "页 %d / %d", + "itemscroller.gui.label.trades": "交易", + "itemscroller.gui.label.trade_uses": "交易使用: %d / %", + + "itemscroller.message.toggled_mod_off": "Item Scroller功能调整为: §c关闭", + "itemscroller.message.toggled_mod_on": "tem Scroller功能调整为: §a开启", + + "enableCraftingFeatures":"Crafting | 制作特性", + "Enables scrolling items to and from crafting grids,\nwith a built-in 18 recipe memory.\nHold down the Recipe key to see the stored recipes and\nto change the selection. While holding the Recipe key,\nyou can either scroll or press a number key to change the selection.\nA recipe is stored to the currently selected \"recipe slot\"\n by clicking pick block over a configured crafting output slot.\nThe supported crafting grids must be added to the scrollableCraftingGrids list.":"开启内置共8页每页18种配方的存储,使得物品可以放置到合成表\n按住Recipe(配方)的快捷键查看配方列表,您可以滑动滚轮或使用数字键选择配方\n点击配方可以在工作台完成合成,在放置配方达到待命状态时(不取出合成产物)\n按下设定的storeRecipe(储存配方)快捷键就可以在选定的列表格内进行配方储存(自动覆写)。", + "enableDropkeyDropMatching":"Dropkey | 批量丢弃", + "Enables dropping all matching items from the same\ninventory with the hotkey":"使用快捷键从同一库存内丢弃所有匹配物品", + "enableRightClickCraftingOneStack":"RightClick | 右键制作", + "Enables crafting up to one full stack when right clicking on\na slot that has been configured as a crafting output slot.":"当右键点击储存的配方,可以直接制造一个物品", + "enableScrollingEverything":"Scrolling | 滚动所有", + "Enables scroll moving all items at once while\nholding the modifierMoveEverything keybind":"按住滚动所有快捷键时,允许滑动滑轮移动所有物品", + "enableScrollingMatchingStacks":"Scrolling | 滚动相同物品(全部)", + "Enables scroll moving all matching stacks at once\nwhile holding the modifierMoveMatching keybind":"按住滚动全部物品快捷键时,允许滑动滑轮移动所有相同物品", + "enableScrollingSingle":"Scrolling | 滚动物品", + "Enables moving items one item at a time by scrolling over a stack":"通过在物品上滑动滚轮,单个移动物品", + "enableScrollingStacks":"Scrolling | 滚动相同物品(一组)", + "Enables moving entire stacks at a time by scrolling over a stack":"按住滚动单组物品快捷键时,允许滑动滑轮移动一组相同物品", + "enableScrollingStacksFallback":"enableScrolling | 滚动合成", + "Enables a \"fallback\" mode for scrolling entire stacks\n(for example to a vanilla crafting table,\nwhere shift + click doesn't work).":"在工作台内配方表使用滚动合成\n比如工作台shift+点击不起作用时", + "enableScrollingVillager":"Scrolling | 交易滚动", + "Enables special handling for the Villager GUIs.\n(Normally you can't shift click items in them.)\nHold shift and scroll up/down over the trade output slot.":"为交易GUI进行特殊处理,可以对购买物品进行滚动\n(一滚马云流泪,两滚建林下跪,三滚化腾心碎,懂我意思吧QAQ)", + "enableShiftDropItems":"ShiftDrop | shift丢弃", + "Enables dropping all matching items at once by holding\nshift while clicking to drop a stack":"允许通过按住shift键同时丢出一组物品\n从而一次性丢出所有匹配的物品", + "enableShiftPlaceItems":"Shift | shift移动", + "Enables moving all matching stacks at once by holding\nshift while placing items to an empty slot":"在将物品放置到一个空槽时,通过按住shift,\n可以一次移动所有匹配的物品", + "enableVillagerTradeList":"Villager | 村民交易列表", + "Render a 1.14-style trade list in villager GUIs":"在村民gui中呈现一个1.14风格的交易列表\n(这不是1.16吗??????)", + + "carpetCtrlQCraftingEnabledOnServer":"carpetCtrlQCrafting | 地毯端CtrlQ启用", + "Set to true if the server is running the Carpet mod,\nand has the ctrlQCrafting option enabled.\nThis just changes which method Item Scroller uses\nfor the Drop key + Shift + Right click crafting.":"如果服务器正在运行地毯端则设置为开启,\n这将改变物品滚轮整组丢弃的使用方式\n变为丢弃+Shift+右击丢弃整组", + "clientCraftingFixOn1.12":"clientCrafting | 1.12客户端修复", + "Enable updating the crafting recipe output directly on the client side.\nThis fixes the quick/mass crafting and right-click-to-craft-a-stack\nfeatures othrwise being broken in 1.12.":"在客户端直接更新制作配方输出\n这修正了在1.12中快速/批量制造和右键点击制造所产生的不可使用的问题。", + "craftingRenderRecipeItems":"craftingRenderRecipeItems | 配方显示", + "If enabled, then the recipe items are also rendered\nin the crafting recipe view.":"如果启用,那么配方物品也会呈现在制作配方视图中。", + "craftingRecipesSaveToFile":"craftingRecipes | 配方文件保存", + "If enabled, then the crafting features recipes are saved to a file\ninside minecraft/itemscroller/recipes_worldorservername.nbt.\nThis makes the recipes persistent across game restarts.":"如果启用,那么制作配方将保存到\nminecraft/itemscroller/recipes_worldorservername.nbt\n内的一个文件中。这使得配方在游戏重启时能保持不变", + "craftingRecipesSaveFileIsGlobal":"craftingRecipesSave | 全局配方保存", + "If true, then the recipe file is global, instead\n of being saved per-world or server":"如果为真,则配方文件是全局的,而不是每个世界或每个服务器单独保存的", + "reverseScrollDirectionSingle":"reverseScrollDirection | 反向单个移动", + "Reverse the scrolling direction for single item mode.":"反转滚动方向为单个物品移动模式", + "reverseScrollDirectionStacks":"reverseScrollDirection | 反向单组移动", + "Reverse the scrolling direction for full stacks mode.":"反转滚动方向为单组物品移动模式", + "useSlotPositionAwareScrollDirection":"useSlotPositionAware | 栏位滚动方向", + "When enabled, the item movement direction depends\non the slots' y-position on screen. Might be derpy with more\ncomplex inventories, use with caution!":"当启用时,物品的移动方向取决于屏幕上栏位的y轴位置。使用谨慎!", + "villagerTradeListRememberPage":"villagerTradeList | 交易页面记忆", + "Remember and restore the last looked at page/trade when re-opening the GUI":"当重新打开GUI时,记住并恢复最后看到的页面/交易", + + "openConfigGui":"openConfigGui | 打开配置界面", + "Open the in-game config GUI":"打开游戏内配置界面", + "craftEverything":"craft | 全部制作", + "Craft everything possible once with the currently selected recipe":"用当前选定的配方消耗完所有的材料", + "dropAllMatching":"dropAll | 全部丢弃", + "Drop all stacks identical to the hovered stack":"丢弃所有鼠标指针指向的物品", + "mainToggle":"mainToggle | 主开关", + "Toggle all functionality ON/OFF":"开启/关闭所有功能,\n§4似乎是个摆设——ZMDF§r", + "massCraft":"massCraft | 全部合成抛出", + "Mass craft and throw out the results with the\ncurrently selected recipe as long as this\nkeybind is held down":"批量制作当前选择的配方物品并将它们丢出,\n只要你按住快捷键\n(§6做一个快乐的人体喷泉——ZMDF§r)", + "moveCraftResults":"moveCraft | 工作台放置", + "Move all of the currently selected recipe's\noutput items from the player inventory\nto the other inventory":"将当前选择的物品配方材料全部放置于合成台。", + "moveStackToOffhand":"moveStack | 手持物品", + "Swap the hovered stack with the offhand":"将鼠标指针指向的物品移到副手栏", + "recipeView":"recipeView | 配方视图", + "Show the Item Scroller recipe GUI":"显示配方的GUI", + "slotDebug":"slotDebug | 调试栏", + "Print debug info for the hovered slot or GUI":"打印鼠标悬停栏位或GUI的调试信息\n(§4然而并没有什么卵用——ZMDF§r)", + "storeRecipe":"storeRecipe | 储存配方", + "Store a recipe while hovering over a crafting output item":"将鼠标悬停在制作输出项目上时存储合成配方", + "throwCraftResults":"throwCraft | 全部抛出", + "Throw all of the currently selected recipe's\noutput items to the ground from the player inventory":"批量丢出当前选择的配方物品\n(§6人体喷泉+1——ZMDF§r)", + "villagerTradeFavorites":"villagerTrade | 最优交易", + "Trade everything possible with all the favorited trades\nof the current villager":"用当前村民的所有优惠交易进行所有可能的交易", + "keyDragMoveLeaveOne":"keyDragMove | 就剩一个", + "Key to move all but the last item from\nall the stacks dragged over":"按住快捷键移动物品,被指到的物品仅保留一个", + "keyDragMoveMatching":"keyDragMove | 全部移动", + "Key to move all matching items dragged over":"按住快捷键移动所有相同物品", + "keyDragMoveOne":"keyDrag | 就移一个", + "Key to move one item from each stack dragged over":"按住快捷键移动物品,被指到的物品仅移动一个", + "keyDragMoveStacks":"keyDragMove | 移一份", + "Key to move the entire stacks dragged over":"按住快捷键移动物品,被指到的格子全部移动", + "keyDragDropLeaveOne":"keyDragDrop | 丢到就剩一个", + "Key to drop all but the last item from each stack dragged over":"按住快捷键丢弃物品,被指到的物品仅保留一个", + "keyDragDropSingle":"keyDragDrop | 就扔一个", + "Key to drop one item from each stack dragged over":"按住快捷键丢弃物品,被指到的物品仅丢弃一个", + "keyDragDropStacks":"keyDragDropStacks | 扔一份", + "Key to drop the entire stacks dragged over":"按住快捷键丢弃物品,被指到的格子全部丢弃", + "keyMoveEverything":"keyMove | 移动所有", + "Key to move ALL items to the other\ninventory when clicking a stack":"点击物品时,将所有物品移到另一个容器内", + "wsMoveDownLeaveOne":"wsMoveDown | 就剩一个§4S", + "The key to move all but the last item from each stack\n\"down\" in the inventory":"将库存中除最后一个物品之外的所有物品从每堆物品“向下”移动的键", + "wsMoveDownMatching":"wsMoveDown | 全部下移", + "The key to move all matching items \"down\" in the inventory":"将库存中所有相同物品“向下”移动的键", + "wsMoveDownSingle":"wsMoveDown | 就下移一个", + "The key to move single items \"down\" in the inventory":"在库存中移动单个物品“向下”的键", + "wsMoveDownStacks":"wsMoveDown | 下移一份", + "The key to move stacks \"down\" in the inventory":"在库存中移动一份物品“向下”的键", + "wsMoveUpLeaveOne":"wsMoveUp | 就剩一个§4W", + "The key to move all but the last item from each stack\n\"up\" in the inventory":"将库存中除最后一个物品之外的所有物品从每堆物品“向上”移动的键", + "wsMoveUpMatching":"wsMoveUp | 全部上移", + "The key to move all matching items \"up\" in the inventory":"将库存中所有相同物品“向上”移动的键", + "wsMoveUpSingle":"wsMoveUp | 就上移一个", + "The key to move single items \"up\" in the inventory":"在库存中移动单个物品“向上”的键", + "wsMoveUpStacks":"wsMoveUp | 上移一份", + "The key to move stacks \"up\" in the inventory":"在库存中移动一份物品“向上”的键", + "modifierMoveEverything":"modifierMove | 移动所有", + "Modifier key to move ALL items to the other\ninventory when scrolling over a stack":"当在堆栈上滚动时,修饰键将所有项目移动到另一个库存\n(这个快捷键并没有实际功能,类似前缀)", + "modifierMoveMatching":"modifierMove | 移动相同", + "Modifier key to move all matching items to the other\ninventory when scrolling over a stack":"当在堆栈上滚动时,修饰键将所有匹配的项目移动到另一个库存\n(这个快捷键并没有实际功能,类似前缀)", + "modifierMoveStack":"modifierMove | 移动一份", + "Modifier key to move the entire stack to the other\ninventory when scrolling over it":"当在堆栈上滚动时,修饰键将整个堆栈移动到另一个库存\n(这个快捷键并没有实际功能,类似前缀)", + + "packetRateLimit":"packetRateLimit | 最大数据流", + "The limit of sent emulated slot click packets per game tick,\nif 'rateLimitClickPackets' is enabled":"当§6[连点限制]§f开启后限制每个tick发送的最大模拟操作数据包的数量", + "rateLimitClickPackets":"rateLimitClick | 连点限制", + "This is meant for compatibility with Spigot servers and similar,\nwhich apply rate limits to packets from the client.\nThis queues up the emulated slot click packets and sends\nthem rate limited over time. The limit per game tick can be set in 'packetRateLimit´.":"这是为了与Spigot服务器和类似服务器兼容,\n对来自客户端的数据包发送速率进行限制。\n这将模拟操作的数据包排队,\n并随着时间的推移向它们发送速率受限的数据包。\n每个tick的限制可以在§6[最大数据流]§f中设置", + "villagerTradeUseGlobalFavorites":"villagerTrade | 交易收藏", + "Whether or not global (per-item-type) villager trade\nfavorites should be used.":"该功能开启后,使用§6[交易优化]§f+鼠标中键\n标注的交易项目将会置顶", + "villagerTradeListRememberScrollPosition":"villagerTrade | 交易书签", + "Remember and restore the last scroll position in the\ntrade list when re-opening the GUI":"该功能开启后,退出村民交易GUI时将不会重置滚动条", + + "enableVillagerTradeFeatures":"VillagerTrade | 交易收藏", + "Enable trade favoriting and quick trade features for villagers.\nNote: The Shift + scrolling over the output slot is a separate feature\nand not affected by this option.\nThis option enables middle clicking to mark favorite trades,\nand right clicking on the trade list to fully trade that one trade.":"为村民启用交易收藏和快速交易功能。 \n注意:Shift+在输出槽上滚动是一个单独的功能,不受此选项的影响。 \n此选项允许通过§6[交易优化]§f+单击鼠标中键来标记最喜欢的交易,\n并开启在交易列表上右键单击物品购空物品的功能。", + + "villagerTradeFavorites":"villagerTrade | 交易优化", + "Trade everything possible with all the favorited trades\nof the current villager":"该功能为交易收藏功能的前置按键设置\n测试后发现该功能可以一键买空所有收藏的交易内容", + + "modifierToggleVillagerGlobalFavorite":"VillagerGlobal | 交易收藏", + "Modifier key to hold while middle clicking a trade,\nto toggle the global favorite state for that trade.\nGlobal favorites are used for villagers that don't have any specific favorites set.":"按住该快捷键单击鼠标中键对交易进行收藏\n全局收藏将会作用于没有特殊交易的村民", + + "modMainToggle":"modMain | 主开关", + "Can disable all the functionality of the entire mod":"能否禁用整个mod的所有功能", + "toggleModOnOff":"ModOnOff | 主开关", + "Toggle all mod functionality ON/OFF":"打开/关闭所有mod功能", + "Modifier key to hold while middle clicking a trade,\nto toggle the global favorite state for that trade.\nGlobal favorites are used for villagers that don't\nhave any \"local\"/villager-specific favorites set.":"使用鼠标中键点击交易内容时按住快捷键\n切换该交易为全局最喜欢的状态(§d粉色星§f)\n全局的交易收藏夹只能用于没有任何\n“本地收藏夹(§e黄色星§f)”的村民", + + "massCraftInhibitMidUpdates":"massCraft | 批量合成刷新优化", + "Prevent recipe output slot updates in the middle of moving items\nto the crafting grid. This should reduce CPU usage\nbecause of not constantly querying the recipe after every grid change.":"禁止批量合成时配方输出槽在材料移动到合成GUI的过程中更新。\n这将会减少CPU的占用,因为游戏会在每次合成配方更改后\n不断地查询配方并显示产物。", + "massCraftInterval":"massCraft | 批量合成速度", + "The interval in game ticks the massCraft operation is repeated at":"每tick中批量合成的次数", + "massCraftIterations":"massCraft | 批量合成尝试", + "How many massCraft iterations/attempts to do per execution.\nWith unstackable items or a full inventory and \"small recipe\"\nthis will need to be larger, as a shift + click craft to the inventory\nmight only craft 1 or 2 items per operation.":"设置每次执行多少次批量合成的迭代或者尝试,\n当玩家合成不可堆叠的物品时或背包已经满了的时候这类情况,\n这将需要玩家拥有更大的背包空间,\n因为使用shift单击合成时,\n背包中可能只进行1或2次合成操作。", + "massCraftSwapsOnly":"massCraft | 批量合成新方法", + "Uses a newer method of filling the crafting grid,\nusing only swap slot packets.\n\nNote: Due to only using slot swap packets,\nno partial crafts are possible! And also no\nstack splitting will happen, at all.":"使用新的方法填充配方GUI,\n只使用slot swap packets(槽位交换包)\n注意:由于只使用槽位交换包,不可能有部分的合成!\n而且也不会发生整组物品拆开的现象。", + "useRecipeCaching":"massCraft | 使用配方缓存", + "Enables caching the last used recipe in the crafting\nrecipe output item fetching code. This can help a lot\nwith lowering CPU usage when mass crafting stuff.":"在合成配方操作获取输出项时的参数中,\n传递缓存中最后使用的配方参数。\n当大量制作物品时,这可以大大降低CPU使用率。", + + "itemscroller.gui.title.configs": "%s 配置 - %s" +} \ No newline at end of file