`teleporterDistance` cost is not properly substracted from `energyContainer`
YegorYellow opened this issue ยท 1 comments
Issue description:
teleporterDistance
cost is not properly substracted from energyContainer
. Looks like it happens because energyContainer
is updated when the entity is already teleported and the distance between entity and target teleport is about 1 block.
Steps to reproduce:
- Make sure
usage.teleporter.teleporterDistance
property inmachine-usage.toml
is more than one. Better to set big enough so you can notice it - Link two teleports A and B with notable distance between them (let's say 1000 blocks).
- Charge teleport A with enough energy for teleportation.
- Cut of energy source from teleport A so you will be able to inspect exactly how much energy is spent for the teleportation
- Perform teleportation by entering to teleport A
- Check teleport A energy container
ER: the energy is substracted with taking in account teleporterDistance
parameter and actual distance between teleports
AR: the energy is substracted with taking in account teleporterDistance
but not multiplied by actual distance between teleports
Version (make sure you are on the latest version before reporting):
Forge:
Mekanism: 1.16.4-10.0.17.444
Other relevant version: 1.16.4-35.0.15
If a (crash)log is relevant for this issue, link it here:
no crashes
Additional info:
I think it can be fixed in TileEntityTeleporter.java
to move
row 258 (energyContainer.extract(...)
) to be before row 244 (teleportEntityTo(entity, closestCoords, teleporter);
)
I've tested this fix on my local env with on 0287e5f revision.