Slime Tweaker
Slime Tweaker 添加了一个游戏规则(gamerule)用于改变自然生成的史莱姆的大小,并提供了配置文件以修改与史莱姆生成相关的更多具体数值。我制作这个模组是为了解决一个非常具体的问题。
maxSlimeSize 游戏规则
运行 gamerule maxSlimeSize (数字) 可修改最大能生成的史莱姆大小,上限为 7。默认的史莱姆最大大小为 2,这可以在配置文件中更改(如果你对这些数值的设定感到困惑,请继续阅读)。
配置文件
配置文件位于 config/slimetweaker-common.toml。你可以在那里更改默认史莱姆大小。
此外,当史莱姆生成时,根据游戏难度等级,它有几率长大一级。这通常仅限制为中等大小的史莱姆,但可以在配置文件中提高此上限。将该值设置为 0 将禁用此功能。
等等,这会 affecting 岩浆怪吗?
计算岩浆怪大小(或任何其他扩展了 Slime 类的生物)的逻辑只是复制了史莱姆的代码,所以,是的。
等等,我以为大小为 2 的史莱姆是不可能生成的吗?
是的,《Minecraft Wiki》指出史莱姆只会以 NBT 标签 Size 为 0、1 和 3(小、中、大)生成。你可能认为它们只是跳过了大小 2,但实际上这与史莱姆大小的逻辑有关。代码中实际上使用了三种不同的史莱姆大小。
首先是我所谓的“基础”(Base)大小,也就是 maxSlimeSize 游戏规则所使用的。普通史莱姆是“基础”大小 0、1 和 2。你可以将游戏规则设置为任意整数,但如果为负数则不会生成史莱姆,在实际操作中会被限制在 7。
然后是我所谓的“实际”(Actual)大小,即 Minecraft 代码正在使用的数值。对于“实际”大小,该数字是将“基础”大小数值向左移动 1 位,这在数学上相当于将该数字作为指数进行 2 的幂运算,从而将 (0, 1, 2) 变为 (1, 2, 4)。“基础”大小为 (3, 4, 5) 的史莱姆将分别变为 (8, 16, 32)。这就是为什么上限是 7,因为“实际”史莱姆大小被限制在 127(2^7 = 128)。比这更大的史莱姆会使游戏非常卡顿,”
最后一个是你们大多数人都熟悉的,我所谓的“NBT”大小,即通过 NBT 读取和显示的大小。这是你在使用 /data 或 /summon 命令时看到的大小。本质上它只是“实际”大小减 1,因此 (1, 2, 4) 变为 (0, 1, 3)。所以当你的“NBT”大小为 2 的史莱姆时,你是在召唤一只无法自然生成的史莱姆。当生成“基础”大小为 7(或更高)的史莱姆时,其“NBT”大小被限制为 126。
为什么要这样设计?
嗯,我真的不知道,我不是 Mojang 的员工,但我怀疑这是因为当你杀死一只史莱姆时,它会分裂成 2-4 只一半大小的史莱姆。即使对于每种“基础”大小的史莱姆,这也仍然有效。
这意味着不使用命令时只有 8 种不同大小的史莱姆可以生成吗?
是的,如果不使用 /summon,将最大大小设置为 7 意味着只有“NBT”大小为 0、1、3、7、15、31、63 和 126 的史莱姆会生成。
所以你遇到的那个问题是什么?
我正在为一个超平坦世界制作生存整合包,在我的测试中,我发现玩家会很快死于中型和大型史莱姆的攻击。我想在不移除史莱姆的情况下解决这个问题,因为史莱姆球是必需的,所以在尝试寻找修改史莱姆大小的模组失败后,我决定自己动手制作。小型史莱姆不会造成伤害,所以如果所有史莱姆都很小,那么就不会有人死亡!好吧,至少在天黑之前,当它们被骷髅射杀之前是这样。
Slime Tweaker
Slime Tweaker adds a gamerule to change the size of natural spawning slimes and config to modify more specific values relating to the spawning of slimes. I made this mod to solve an extremely specific problem I was having.
maxSlimeSize Gamerule
Running gamerule maxSlimeSize (number) modifies the max size of slimes than can spawn, capped at 7. The default max slime size is 2 and this can be changed in the config (if you're confused on why these numbers are like this keep reading).
Config
Config can be found in config/slimetweaker-common.toml. The default slime size can be changed there.
Also, when a slime spawns there is a chance, modified by the level difficulty, for it to grow one size larger. This is normally just capped at medium sized slimes, but it can be raised in the config. Setting the value to 0 disables this.
Wait does this affect magma cubes?
The logic for working out magma cube sizes (or any other mob that would extend the Slime class) just copies the slime code so, yes.
Wait I thought it was impossible for slimes of size 2 to spawn?
Yes, the Minecraft Wiki states that slimes only spawn with NBT tag Size of 0, 1, and 3 (small, medium, and big). You might think they're just skipping size 2 but it's actually down to the logic of sizing slimes. There are really 3 different slime sizes is used the code.
First there's what I'm calling the "Base" size, which is what the maxSlimeSize gamerule uses. The normal slimes are "Base" size 0, 1, and 2. You can set the gamerule to be any integer but slimes will not spawn if they are negative and will be capped at 7 in practice.
Then there's what I'm calling the "Actual" size, which is what the Minecraft code is using. For "Actual" size the number is 1 bit shifted left by a "Base" size number of bits, which due to math is like putting 2 to the power of that number, thus turning (0, 1, 2) into (1, 2, 4). Slimes of "Base" sizes (3, 4, 5) would become (8, 16, 32) respectively. This is why the cap is at 7, as "Actual" slime sizes are capped at 127 (2^7 = 128). Slimes bigger than that make the game very laggy,"
Lastly there's the one most of you are familiar with, what I'm calling the "NBT" size, which is how the size is read and displayed with NBT. This is the size you see when you use /data or /summon. Essentially it is just the "Actual" size minus 1, so (1, 2, 4) becomes (0, 1, 3). So when you summon a slime of "NBT" size 2 you are summoning a slime that would be impossible to spawn naturally. When a slime of "Base" size 7 (or higher) is spawned it's "NBT" size is capped at 126.
Why is it like this?
Well I don't know really, I'm not Mojang, but I suspect it is because when you kill a slime it creates 2-4 slimes of half the size. This still works even with slimes of each "Base" size.
Does that mean only 8 different sizes of slimes can spawn without commands?
Yes, without using /summon, setting the max size to 7 means only slimes of "NBT" size 0, 1, 3, 7, 15, 31, 63, and 126 spawn.
So what was that problem you were having?
So I'm working on making a survival modpack for a superflat world, and in my testing I found that players would simply die quickly to medium and big slimes. I wanted to fix this without removing slimes as slime balls are needed, so after failing to find a mod that modified slime sizes I decided to make it myself. Tiny slimes don't deal damage, so if every slime is tiny then no one dies! Well, at least before it turns night and they get shot by a skeleton.
评论 0
登录后参与评分
还没有评论,来抢沙发吧