yarn
yarn copied to clipboard
Some fields and methods in FireBlock.class are not translated correctly
I noticed a yarn translation was not correctly: In the FireBlock
class, all the words about burn and spread are wrong.
For example, burnChances
is actually spreadChances
, and spreadChances
is actually burnChances
.
we can see what did net.minecraft.block.FireBlock#registerDefaultFlammables
do.
private void registerFlammableBlock(Block block, int burnChance, int spreadChance) {
this.burnChances.put(block, burnChance);
this.spreadChances.put(block, spreadChance);
}
public static void registerDefaultFlammables() {
FireBlock fireBlock = (FireBlock)Blocks.FIRE;
fireBlock.registerFlammableBlock(Blocks.OAK_PLANKS, 5, 20);
fireBlock.registerFlammableBlock(Blocks.SPRUCE_PLANKS, 5, 20);
fireBlock.registerFlammableBlock(Blocks.BIRCH_PLANKS, 5, 20);
fireBlock.registerFlammableBlock(Blocks.JUNGLE_PLANKS, 5, 20);
// ........
}
This data is not the same as that given in the wiki. At first, I thought the wiki was wrong, but later I realized that it may be that yarn translated these fields incorrectly.
How am I sure it must be yarn's fault?
At first, I just wanted to write a small function to prevent the spread of fire and the destruction of block by fire. I quickly found this class and wanted to try using mixin to accomplish this task. But the code is a little complicated, and I don't want to take a risk. So I was a little smart to look at the spigot code and see where they were triggered BlockBurnEvent
and BlockSpreadEvent
.
As a result, I found that they were BlockBurnEvent
called in net.minecraft.block.FireBlock#trySpreadingFire
. This made me feel very strange, and even once doubted whether my English level needed remake.
Finally, I decided to try it by using mixin to disable the trySpreadingFire
method.
@Inject(at = @At("HEAD"), method = "trySpreadingFire", cancellable = true)
public void trySpreadingFireMixin(World world, BlockPos pos, int spreadFactor, Random rand, int currentAge, CallbackInfo info) {
info.cancel();
}
Then I entered the game to observe the effect, and found that the flame was still spreading, but they could not destroy the wooden block.
So in fact, it is obvious that the trySpreadingFire
method has been mistranslated. It should actually be tryBurnBlock
or something.
Then I checked FireBlock carefully and found that not only trySpreadingFire
, but all the translations about burn and spread were wrong.
I think a word "burn" can mean both spread fire and destroy flammable. I suggest renaming (burnChance
, spreadChance
) to (spreadChance
, destroyChance
).
This is impactful since FlammableBlockRegistry
(impl) in Fabric API uses the same names as Yarn.