diff --git a/docs/document-zh_cn.md b/docs/document-zh_cn.md index 94c0b70e..4ca58225 100644 --- a/docs/document-zh_cn.md +++ b/docs/document-zh_cn.md @@ -24,7 +24,7 @@ TweakerPlus提供的新功能 - 分类: `功能` - 配置类型: `工具` -### 自动交易-总开关 (tweakpAutoTrade) +### 自动交易总开关 (tweakpAutoTrade) 自动交易相关功能的总开关,影响: @@ -56,7 +56,7 @@ TweakerPlus提供的新功能 - 依赖模组: - Item Scroller (`itemscroller`) -### 自动交易-储存配方 (tweakpAutoTradeStoreRecipe) +### 自动交易储存配方 (tweakpAutoTradeStoreRecipe) 将鼠标悬停在交易输出槽位上时存储交易配方 @@ -70,7 +70,7 @@ TweakerPlus提供的新功能 - 依赖模组: - Item Scroller (`itemscroller`) -### 自动交易-扔出输出 (tweakpAutoTradeThrowOutput) +### 自动交易扔出输出 (tweakpAutoTradeThrowOutput) 强制将自动交易得到的输出扔出背包,而不是放入背包 @@ -165,6 +165,35 @@ TweakerPlus提供的新功能 - 分类: `MC修改` - 配置类型: `热键` +### 禁用地狱门传送音效 (disablePortalTeleportSound) + +禁用在使用玩家站在传送门里与玩家被地狱门传送后时的音效 + + - 类型: `可开关型热键` + - 默认值: *无快捷键*, `false` + - 分类: `MC修改` + - 配置类型: `禁用` + +### 禁用末影人生气音效 (disableEndermanAngrySound) + +禁用末影人被激怒后的音效 + + - 类型: `可开关型热键` + - 默认值: *无快捷键*, `false` + - 分类: `MC修改` + - 配置类型: `禁用` + +### 附魔书附魔提示 (enchantedBookHint) + +在附魔书物品上渲染它的所有附魔 + +在附魔较多时文字可能会阻挡 + + - 类型: `可开关型热键` + - 默认值: *无快捷键*, `false` + - 分类: `MC修改` + - 配置类型: `通用` + ## 模组修改 对模组已有内容修改 diff --git a/docs/document.md b/docs/document.md index 29aa7784..dc7b879d 100644 --- a/docs/document.md +++ b/docs/document.md @@ -167,6 +167,35 @@ Reload options.txt - Category: `MC Tweaks` - Config Type: `Hotkey` +### disablePortalTeleportSound + +Disable the sound played when standing in the nether portal and being teleported through the portal + + - Type: `togglable hotkey` + - Default value: *no hotkey*, `false` + - Category: `MC Tweaks` + - Config Type: `Disable` + +### disableEndermanAngrySound + +Disable the enderman angry sound + + - Type: `togglable hotkey` + - Default value: *no hotkey*, `false` + - Category: `MC Tweaks` + - Config Type: `Disable` + +### enchantedBookHint + +Render all its enchantments on the enchantment book item + +Texts may be blocked if there are too many enchantments + + - Type: `togglable hotkey` + - Default value: *no hotkey*, `false` + - Category: `MC Tweaks` + - Config Type: `Generic` + ## Mods Tweaks Tweaks on mods diff --git a/docs/readme-zh_cn.md b/docs/readme-zh_cn.md index e9cc42a7..8373aafe 100644 --- a/docs/readme-zh_cn.md +++ b/docs/readme-zh_cn.md @@ -6,10 +6,10 @@ - [限制世界修改](document-zh_cn.md#限制世界修改-limitWorldModification) - [立即重生](document-zh_cn.md#立即重生-immediatelyRespawn) - - [自动交易-总开关](document-zh_cn.md#自动交易-总开关-tweakpAutoTrade) + - [自动交易总开关](document-zh_cn.md#自动交易总开关-tweakpAutoTrade) - [交易全部物品](document-zh_cn.md#交易全部物品-tweakpTradeEverything) - - [自动交易-储存配方](document-zh_cn.md#自动交易-储存配方-tweakpAutoTradeStoreRecipe) - - [自动交易-扔出输出](document-zh_cn.md#自动交易-扔出输出-tweakpAutoTradeThrowOutput) + - [自动交易储存配方](document-zh_cn.md#自动交易储存配方-tweakpAutoTradeStoreRecipe) + - [自动交易扔出输出](document-zh_cn.md#自动交易扔出输出-tweakpAutoTradeThrowOutput) - [自动交易全部物品](document-zh_cn.md#自动交易全部物品-tweakpAutoTradeEverything) ## [MC修改](document-zh_cn.md#mc修改) @@ -21,6 +21,9 @@ - [禁用气泡柱渲染](document-zh_cn.md#禁用气泡柱渲染-disableBubbleColumnRendering) - [忽略资源包不兼容](document-zh_cn.md#忽略资源包不兼容-resourcePackIncompatibleIgnored) - [重新加载游戏选项](document-zh_cn.md#重新加载游戏选项-reloadGameOptions) + - [禁用地狱门传送音效](document-zh_cn.md#禁用地狱门传送音效-disablePortalTeleportSound) + - [禁用末影人生气音效](document-zh_cn.md#禁用末影人生气音效-disableEndermanAngrySound) + - [附魔书附魔提示](document-zh_cn.md#附魔书附魔提示-enchantedBookHint) ## [模组修改](document-zh_cn.md#模组修改) diff --git a/docs/readme.md b/docs/readme.md index 47f96276..3eeb4764 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -21,6 +21,9 @@ - [disableBubbleColumnRendering](document.md#disableBubbleColumnRendering) - [resourcePackIncompatibleIgnored](document.md#resourcePackIncompatibleIgnored) - [reloadGameOptions](document.md#reloadGameOptions) + - [disablePortalTeleportSound](document.md#disablePortalTeleportSound) + - [disableEndermanAngrySound](document.md#disableEndermanAngrySound) + - [enchantedBookHint](document.md#enchantedBookHint) ## [Mods Tweaks](document.md#mods-tweaks) diff --git a/src/main/java/me/ivan1f/tweakerplus/config/TweakerPlusConfigs.java b/src/main/java/me/ivan1f/tweakerplus/config/TweakerPlusConfigs.java index 6f238cb0..74867d94 100644 --- a/src/main/java/me/ivan1f/tweakerplus/config/TweakerPlusConfigs.java +++ b/src/main/java/me/ivan1f/tweakerplus/config/TweakerPlusConfigs.java @@ -88,6 +88,9 @@ public class TweakerPlusConfigs { @Config(type = Config.Type.DISABLE, category = Config.Category.MC_TWEAKS) public static final TweakerPlusConfigBooleanHotkeyed DISABLE_ENDERMAN_ANGRY_SOUND = ConfigFactory.newConfigBooleanHotkeyed("disableEndermanAngrySound", false, ""); + @Config(type = Config.Type.GENERIC, category = Config.Category.MC_TWEAKS) + public static final TweakerPlusConfigBooleanHotkeyed ENCHANTED_BOOK_HINT = ConfigFactory.newConfigBooleanHotkeyed("enchantedBookHint", false, ""); + //////////////////// // Mod Tweaks // //////////////////// diff --git a/src/main/java/me/ivan1f/tweakerplus/mixins/tweaks/enchantmentBookHint/ItemRendererMixin.java b/src/main/java/me/ivan1f/tweakerplus/mixins/tweaks/enchantmentBookHint/ItemRendererMixin.java new file mode 100644 index 00000000..0386d0cc --- /dev/null +++ b/src/main/java/me/ivan1f/tweakerplus/mixins/tweaks/enchantmentBookHint/ItemRendererMixin.java @@ -0,0 +1,63 @@ +package me.ivan1f.tweakerplus.mixins.tweaks.enchantmentBookHint; + +import me.ivan1f.tweakerplus.config.TweakerPlusConfigs; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.render.Tessellator; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.item.EnchantedBookItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.Map; +import java.util.Set; + +@Mixin(ItemRenderer.class) +public class ItemRendererMixin { + @Shadow + public float zOffset; + + @Inject( + method = "renderGuiItemOverlay(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V", + at = @At(value = "RETURN") + ) + private void onRenderItem(TextRenderer fontRenderer, ItemStack stack, int x, int y, String amountText, CallbackInfo ci) { + if (!TweakerPlusConfigs.ENCHANTED_BOOK_HINT.getBooleanValue()) return; + + Item item = stack.getItem(); + if (!(item instanceof EnchantedBookItem)) return; + MatrixStack matrixStack = new MatrixStack(); + matrixStack.translate(x / 2.0, y / 2.0, (this.zOffset + 200.0F)); + matrixStack.scale(0.5F, 0.5F, 0.5F); + VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer()); + + Set> entries = EnchantmentHelper.getEnchantments(stack).entrySet(); + int currentY = y + 17 - entries.size() * 9 / 2; + + for (Map.Entry entry : entries) { + String string = entry.getKey().getName(entry.getValue()).getString(); + fontRenderer.draw( + string, + (float) (x + 17 - fontRenderer.getStringWidth(string) / 2), + (float) (currentY), + 16777215, + true, + matrixStack.peek().getModel(), + immediate, + false, + 0, + 15728880 + ); + currentY += 9; + } + immediate.draw(); + } +} diff --git a/src/main/resources/assets/tweakerplus/lang/en_us.json b/src/main/resources/assets/tweakerplus/lang/en_us.json index 635830a5..a96753e7 100644 --- a/src/main/resources/assets/tweakerplus/lang/en_us.json +++ b/src/main/resources/assets/tweakerplus/lang/en_us.json @@ -69,6 +69,10 @@ "tweakerplus.config.disableEndermanAngrySound.comment": "Disable the enderman angry sound", "tweakerplus.config.disableEndermanAngrySound.pretty_name": "Disable Enderman Angry Sound", + "tweakerplus.config.enchantedBookHint": "enchantedBookHint", + "tweakerplus.config.enchantedBookHint.comment": "Render all its enchantments on the enchantment book item\nTexts may be blocked if there are too many enchantments", + "tweakerplus.config.enchantedBookHint.pretty_name": "Enchanted Book Hint", + "// Mod Tweaks": "================================================", "tweakerplus.config.leftAlignTitleGlobally": "leftAlignTitleGlobally", diff --git a/src/main/resources/assets/tweakerplus/lang/zh_cn.json b/src/main/resources/assets/tweakerplus/lang/zh_cn.json index d278630b..aeda2a6e 100644 --- a/src/main/resources/assets/tweakerplus/lang/zh_cn.json +++ b/src/main/resources/assets/tweakerplus/lang/zh_cn.json @@ -69,6 +69,10 @@ "tweakerplus.config.disableEndermanAngrySound.comment": "禁用末影人被激怒后的音效", "tweakerplus.config.disableEndermanAngrySound.pretty_name": "禁用末影人生气音效", + "tweakerplus.config.enchantedBookHint": "附魔书附魔提示", + "tweakerplus.config.enchantedBookHint.comment": "在附魔书物品上渲染它的所有附魔\n在附魔较多时文字可能会阻挡", + "tweakerplus.config.enchantedBookHint.pretty_name": "附魔书附魔提示", + "// Mod Tweaks": "================================================", "tweakerplus.config.leftAlignTitleGlobally": "全局左对齐标题", diff --git a/src/main/resources/tweakerplus.mixins.json b/src/main/resources/tweakerplus.mixins.json index 8c272720..961a2501 100644 --- a/src/main/resources/tweakerplus.mixins.json +++ b/src/main/resources/tweakerplus.mixins.json @@ -31,6 +31,7 @@ "tweaks.disablePortalTeleportSound.WorldRendererMixin", "tweaks.disablePumpkinOverlay.InGameHudMixin", "tweaks.disableWitherSpawnSound.WorldRendererMixin", + "tweaks.enchantmentBookHint.ItemRendererMixin", "tweaks.immediatelyRespawn.ClientPlayNetworkHandlerMixin", "tweaks.limitWorldModification.ClientPlayerInteractionManagerMixin", "tweaks.playerListScale.PlayerListHudMixin",