First Aid

First Aid

15M Downloads

Kick from server because of calling set() on ImmutableList on serverside

DBotThePony opened this issue ยท 1 comments

commented

Happened when i accidently walked into cables under voltage.

This is likely caused This is caused that you call shuffle() https://github.com/ichttt/FirstAid/blob/master/src/main/java/ichttt/mods/firstaid/common/damagesystem/distribution/RandomDamageDistribution.java#L68

On immutable lists introduced in 594726e

594726e#diff-ec20860a1a9de55d72554679f666e5bdR38

Reverted the ImmutableList code block and compiled - everything work again.

I think the best way to fix this is to copy the immutable list and shuffle it from there (since those lists are singletons and they should be immutable)

net.minecraft.util.ReportedException: Colliding entity with block
	at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:459) ~[oq.class:?]
	at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:173) ~[pa.class:?]
	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:209) ~[NetworkDispatcher$1.class:?]
	at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:285) ~[gw.class:?]
	at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:180) [oz.class:?]
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:790) [MinecraftServer.class:?]
	at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:396) [nz.class:?]
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:668) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
Caused by: java.lang.UnsupportedOperationException
	at com.google.common.collect.ImmutableList.set(ImmutableList.java:516) ~[minecraft_server.1.12.2.jar:?]
	at java.util.Collections.swap(Collections.java:497) ~[?:1.8.0_181]
	at java.util.Collections.shuffle(Collections.java:458) ~[?:1.8.0_181]
	at java.util.Collections.shuffle(Collections.java:425) ~[?:1.8.0_181]
	at ichttt.mods.firstaid.common.damagesystem.distribution.RandomDamageDistribution.addAllRandom(RandomDamageDistribution.java:68) ~[RandomDamageDistribution.class:?]
	at ichttt.mods.firstaid.common.damagesystem.distribution.RandomDamageDistribution.getPartList(RandomDamageDistribution.java:44) ~[RandomDamageDistribution.class:?]
	at ichttt.mods.firstaid.common.damagesystem.distribution.DamageDistribution.distributeDamage(DamageDistribution.java:80) ~[DamageDistribution.class:?]
	at ichttt.mods.firstaid.common.damagesystem.distribution.DamageDistribution.handleDamageTaken(DamageDistribution.java:37) ~[DamageDistribution.class:?]
	at ichttt.mods.firstaid.common.EventHandler.onLivingHurt(EventHandler.java:103) ~[EventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_909_EventHandler_onLivingHurt_LivingHurtEvent.invoke(.dynamic) ~[?:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) ~[EventBus.class:?]
	at net.minecraftforge.common.ForgeHooks.onLivingHurt(ForgeHooks.java:590) ~[ForgeHooks.class:?]
	at net.minecraft.entity.player.EntityPlayer.damageEntity(EntityPlayer.java:1120) ~[aed.class:?]
	at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:919) ~[vp.class:?]
	at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1038) ~[aed.class:?]
	at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:645) ~[oq.class:?]
	at blusunrize.immersiveengineering.common.util.IEDamageSources$ElectricDamageSource.apply(IEDamageSources.java:68) ~[IEDamageSources$ElectricDamageSource.class:?]
	at blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.handleMapForDamage(ImmersiveNetHandler.java:654) ~[ImmersiveNetHandler.class:?]
	at blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.handleEntityCollision(ImmersiveNetHandler.java:619) ~[ImmersiveNetHandler.class:?]
	at net.minecraft.entity.Entity.doBlockCollisions(Entity.java:1042) ~[vg.class:?]
	at net.minecraft.entity.Entity.move(Entity.java:963) ~[vg.class:?]
	at net.minecraft.entity.EntityLivingBase.travel(EntityLivingBase.java:1951) ~[vp.class:?]
	at net.minecraft.entity.player.EntityPlayer.travel(EntityPlayer.java:1827) ~[aed.class:?]
	at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2386) ~[vp.class:?]
	at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:513) ~[aed.class:?]
	at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2172) ~[vp.class:?]
	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:234) ~[aed.class:?]
	at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:382) ~[oq.class:?]
	... 9 more
commented

Silly me... that's why it wasn't immutable...