From 058ea84cfd14f7f74fb54b709c1fe4277fcd18a9 Mon Sep 17 00:00:00 2001 From: TexTrue <3140846162@qq.com> Date: Thu, 23 May 2024 18:06:22 +0800 Subject: [PATCH] update MaFgLib version --- gradle.properties | 4 +- .../fi/dy/masa/itemscroller/ItemScroller.java | 18 +-- .../dy/masa/itemscroller/gui/GuiConfigs.java | 2 +- .../mixin/MixinForgeHooksClient.java | 20 --- .../rocknroller/RocknRoller.java | 34 ++++ .../assets/rocknroller/lang/en_us.json | 2 +- .../assets/rocknroller/lang/zh_cn.json | 146 ++++++++++++++++++ src/main/resources/rocknroller.mixins.json | 1 - 8 files changed, 187 insertions(+), 40 deletions(-) delete mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/MixinForgeHooksClient.java 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/gradle.properties b/gradle.properties index 9575ccb..42b65df 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ loom.platform=forge yarn_mappings=1.16.5+build.10 # Mod Properties - mod_version=0.1.3 + mod_version=0.1.4 maven_group=org.thinkingstudio.rocknroller archives_base_name=RocknRoller mod_id=rocknroller @@ -21,4 +21,4 @@ loom.platform=forge curseforge_id=916852 # Dependencies - malilib_version=0.1.10-mc1.16.5 + malilib_version=0.1.12-mc1.16.5 diff --git a/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java b/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java index c9193ee..fae816d 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.forge.ForgePlatformUtils; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.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()); } } 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 e4a9efe..8190f09 100644 --- a/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java +++ b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java @@ -18,7 +18,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/fi/dy/masa/itemscroller/mixin/MixinForgeHooksClient.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinForgeHooksClient.java deleted file mode 100644 index e05e58e..0000000 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinForgeHooksClient.java +++ /dev/null @@ -1,20 +0,0 @@ -package fi.dy.masa.itemscroller.mixin; - -import fi.dy.masa.itemscroller.event.RenderEventHandler; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraftforge.client.ForgeHooksClient; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(value = ForgeHooksClient.class, remap = false) -public abstract class MixinForgeHooksClient { - @Inject(method = "drawScreen", at = @At("RETURN")) - private static void onDrawScreenPost(Screen screen, MatrixStack poseStack, int mouseX, int mouseY, float partialTick, CallbackInfo ci) - { - RenderEventHandler.instance().onDrawScreenPost(MinecraftClient.getInstance()); - } -} 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..a947cc5 --- /dev/null +++ b/src/main/java/org/thinkingstudio/rocknroller/RocknRoller.java @@ -0,0 +1,34 @@ +package org.thinkingstudio.rocknroller; + +import fi.dy.masa.itemscroller.ItemScroller; +import fi.dy.masa.itemscroller.Reference; +import fi.dy.masa.itemscroller.event.RenderEventHandler; +import fi.dy.masa.itemscroller.gui.GuiConfigs; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.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; + }); + + MinecraftForge.EVENT_BUS.addListener(event -> { + RenderEventHandler.instance().onDrawScreenPost(event.getGui().getMinecraft()); + }); + } + } +} diff --git a/src/main/resources/assets/rocknroller/lang/en_us.json b/src/main/resources/assets/rocknroller/lang/en_us.json index 0d1ef07..59d5f6d 100644 --- a/src/main/resources/assets/rocknroller/lang/en_us.json +++ b/src/main/resources/assets/rocknroller/lang/en_us.json @@ -8,5 +8,5 @@ "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" } \ No newline at end of file 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..66ed85a --- /dev/null +++ b/src/main/resources/assets/rocknroller/lang/zh_cn.json @@ -0,0 +1,146 @@ +{ + "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)”的村民", + + + "itemscroller.gui.title.configs": "%s 配置 - %s" +} \ No newline at end of file diff --git a/src/main/resources/rocknroller.mixins.json b/src/main/resources/rocknroller.mixins.json index c0ff9ce..93fb95a 100644 --- a/src/main/resources/rocknroller.mixins.json +++ b/src/main/resources/rocknroller.mixins.json @@ -10,7 +10,6 @@ "MixinAbstractInventoryScreen", "MixinClientPlayerInteractionManager", "MixinCraftingScreenHandler", - "MixinForgeHooksClient", "MixinMerchantScreen", "MixinMerchantScreenHandler", "MixinScreen"