Botania (Fabric/Quilt)

Botania (Fabric/Quilt)

5M Downloads

Mana Bursts from Manastorms do not fill mana pools

Solonarv opened this issue ยท 5 comments

commented

General information

Forge version: 14.23.0.2501 (newest at the time of writing)
Botania version: r1.10-349 (newest at the time of writing), should affect all versions r1.9-339 and up
Console log

Steps to reproduce:

  1. Set up a mana spreader with an Influence lens
  2. Set off a Manastorm Charge very close by, such that all of its mana bursts will be redirected in the same direction.
  3. Place a mana pool in the path of the manastorm bursts

Imgur album

What I expected to happen:

The mana pool should be filled by the manastorm bursts.

What happened instead:

The bursts disappear upon hitting the mana pool, but the pool remains empty.

Further information

The description of the video in which Vazkii introduces the manastorm charge suggests that its mana bursts could be harnessed for mana generation.

Upon noticing that the mana pool wasn't filling up, I decided to look through the source code for the manastorm charge.

I found the following relevant sections:

https://github.com/Vazkii/Botania/blob/684e8db7d6230492bf7fce822bd2625387948f78/src/main/java/vazkii/botania/common/entity/EntityManaStorm.java#L64-L82

The relevant lines here are:

ItemStack lens = new ItemStack(ModItems.lens, 1, ItemLens.STORM);
burst.setSourceLens(lens);

ItemLens.STORM is defined here:

https://github.com/Vazkii/Botania/blob/684e8db7d6230492bf7fce822bd2625387948f78/src/main/java/vazkii/botania/common/item/lens/ItemLens.java#L77

When a mana burst with a source lens attached to it collides with a block that can receive mana, the following method ends up being called, presumably to determing how much mana the block should receive:

https://github.com/Vazkii/Botania/blob/684e8db7d6230492bf7fce822bd2625387948f78/src/main/java/vazkii/botania/common/item/lens/ItemLens.java#L314-L320

This method was changed in commit 684e8db, in order to fix a crash. However, the added array bounds check will also fire if the lens' metadata is STORM, causing the method to return 0 instead of the amount of mana left in the burst. There should be an added check for the STORM value.

A possible fix would be to rewrite ItemLens::getManaToTransfer() as follows:

@Override
public int getManaToTransfer(IManaBurst burst, EntityThrowable entity, ItemStack stack, IManaReceiver receiver) {
	if(stack.getItemDamage() == STORM)
		return stormLens.getManaToTransfer(burst, entity, stack, receiver);

	if(stack.getItemDamage() >= lenses.length)
		return 0;
	
	return lenses[stack.getItemDamage()].getManaToTransfer(burst, entity, stack, receiver);
}

As per the guidelines, I did not make this a PR, since a) I do not have the energy/will to set up a Botania dev environment and b) it's a two-line change anyway.

Please make manastorm reactors great again. <3

commented

What he expected can be confirmed to at least have been intended behavior here

commented

I did some further testing and managed to make a functional manastorm reactor by passing the storm bursts through a prism with a blank lens, so this bug could also be declared intended behavior.

However, during this testing I found a different issue with the manastorm charge (which I'm posting here since it's related): a manastorm will fire a total of 250 bursts containing 120 mana each, for a total of 30k mana. Summoning a Guardian of Gaia costs 500k mana (for the Terrasteel craft) and drops 12 spirits (on hard mode), which only yields 360k mana if converted to manastorm charges. So, it's not possible to use a manastorm reactor as a primary mana source, despite how awesome that would be.

commented

So I was looking through various bits of related code... the manastorm entity seems to be firing off bursts that say their starting mana was 340 but only ever actually contained 120 mana. Is there a reason for this? If those bursts were 340 mana that would be 85k per manastorm or 1020k all together.

As an alternative, if the mana storm's explosion was absorbable with an entropinium, it would mean that a second flower was necessary to make this an actual 'reactor' style setup.

commented

yeah make another ticket for it

commented

Should a separate issue be made for manastorm reactors not being able to produce net increases in mana after the cost to produce the manastorms or is this working as intended?