Shuffle entities in vicinity of android charger, so all players around it will get charged more or less equally

This commit is contained in:
DBotThePony 2025-03-03 18:01:03 +07:00
parent 866776dc74
commit 362c3bd931
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -17,6 +17,8 @@ import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage
import ru.dbotthepony.mc.otm.capability.matteryPlayer
import ru.dbotthepony.mc.otm.config.MachinesConfig
import ru.dbotthepony.mc.otm.core.getEntitiesInEllipsoid
import ru.dbotthepony.mc.otm.core.otmRandom
import ru.dbotthepony.mc.otm.core.shuffle
import ru.dbotthepony.mc.otm.menu.tech.AndroidChargerMenu
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities
@ -42,7 +44,7 @@ class AndroidChargerBlockEntity(blockPos: BlockPos, blockState: BlockState) : Ma
val ents = level.getEntitiesInEllipsoid(blockPos.center, Vec3(MachinesConfig.AndroidCharger.RADIUS_WIDTH, MachinesConfig.AndroidCharger.RADIUS_HEIGHT, MachinesConfig.AndroidCharger.RADIUS_WIDTH)) { it is Player }
ents.sort()
ents.shuffle(level.otmRandom)
for ((ent) in ents) {
val ply = (ent as Player).matteryPlayer