跳到正文

Anon’s Enchantment Banner

作者:datanon

Very jankily removes enchantments from natural loot pools.

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

Since nothing like this seems to exist for Forge 1.20.1, I decided to hack something together quickly for personal use, then upload it in case others needed it.

Basically, this mod will make it so that if a piece of naturally generated loot uses the enchant_randomly or enchant_with_levels functions, it will reroll any enchanted items that hit an enchant from the list in the config. The list in the config is made of _description_ ids, since those are easiest to get, so things like “enchantment.minecraft.sharpness”. If you want to know what a given enchantment’s ID is, check the lang files for the mod that contains it.

So, for example, if your config looks like this:

bannedEnchantIds = ["enchantment.spartanweaponry.propel", "enchantment.spartanweaponry.razors_edge", "enchantment.spartanweaponry.incendiary", "enchantment.spartanweaponry.lucky_throw", "enchantment.spartanweaponry.hydrodynamic", "enchantment.spartanweaponry.supercharge", "enchantment.spartanweaponry.expanse", "enchantment.spartanweaponry.sharpshooter", "enchantment.spartanweaponry.collectorang"]

and you roll a loot table that drops enchanted gear using enchant_randomly or enchant_with_levels, if anything in that table rolls one of those enchantments it will _reroll_ itself continually with the same settings until it no longer has one of those enchantments. In my case, I have essentially removed the extra enchantments from Spartan Weaponry using the config above.

This mod does not affect the enchanting table, to do that you’ll need something like Enchantato, which you can find over on Curseforge. It might in the future if I want to add that feature but right now it’s just for loot.

NOTICE: This mod uses mixins, in fact it’s basically just two mixins and two mixin interfaces. Specifically, I am mixing in to EnchantRandomlyFunction and EnchantWithLevelsFunction at TAIL on both to adjust the return values, and with some accessors and invokers to get at their non-public code. If, for some reason, you have another mod that also mixes in to those areas there may be weirdness or broken behavior.

WARNING: Hypothetically, if you try to ban every enchant, you will cause some lag. There is a hardcoded reroll limit of 100 times per item (after which it just gives you what it rolls, banned or not) to prevent infinite loops but this isn’t exactly “free” computation. Still, for normal use you probably won’t notice any hitching or anything. If you enter a bad value in the config (or remove a mod but forget to update the config), it simply won’t do anything since it won’t match an ID, near-zero cost or negative end-user effect besides a few string checks.

Other than that, I tested it and it works for me. You’ll see some INFO log emits whenever it rerolls something, which will tell you it’s working.

As for the license, _this mod is provided with essentially zero support or guarantees of bugfixing/features, but also zero restrictions with what you do with it_. I’m not uploading it to github but feel free to decompile, copy, put it on your own work, whatever. No credits necessary, but I can’t stop you if you want to give them. I filed it under MIT since that’s the most permissive license available.

常见问题

Anon’s Enchantment Banner 支持哪些 Minecraft 版本?

Anon’s Enchantment Banner 支持 Minecraft Java 版 1.20.1,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。

Anon’s Enchantment Banner 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:仅服务端。

评论

登录后评论和评分