Shuffle entities in vicinity of android charger, so all players around it will get charged more or less equally
This commit is contained in:
parent
866776dc74
commit
362c3bd931
@ -17,6 +17,8 @@ import ru.dbotthepony.mc.otm.capability.energy.WorkerEnergyStorage
|
|||||||
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
import ru.dbotthepony.mc.otm.capability.matteryPlayer
|
||||||
import ru.dbotthepony.mc.otm.config.MachinesConfig
|
import ru.dbotthepony.mc.otm.config.MachinesConfig
|
||||||
import ru.dbotthepony.mc.otm.core.getEntitiesInEllipsoid
|
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.menu.tech.AndroidChargerMenu
|
||||||
import ru.dbotthepony.mc.otm.registry.game.MBlockEntities
|
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 }
|
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) {
|
for ((ent) in ents) {
|
||||||
val ply = (ent as Player).matteryPlayer
|
val ply = (ent as Player).matteryPlayer
|
||||||
|
Loading…
Reference in New Issue
Block a user