Buggy code:
protected void init ( ) { } public void placeBuilding ( BuildingType type , int posX , int posY ) { } public void requestEntity ( EntityType type , Vector3f position ) { } public void moveEntity ( CoreEntity entity , Vector3f position ) { } public void setEntityTarget ( CoreEntity sourceEntity , CoreEntity targetEntity ) { } public void setEntityTarget ( CoreEntity sourceEntity , CoreBuilding targetBuilding ) { } public void update ( float timeDelta ) { if ( isConnected ( ) ) { List < Packet > packets = connection . get ( INIT ) ; for ( Packet packet : packets ) { if ( packet instanceof PacketPlayerInfo ) { PacketPlayerInfo packetInfo = ( ( PacketPlayerInfo ) ( packet ) ) ; faction = packetInfo . faction ; } else if ( packet instanceof PacketMap ) { PacketMap packetMap = ( ( PacketMap ) ( packet ) ) ; world . setMap ( packetMap . map ) ; } } class LightningLine { long a ; long b ; public LightningLine ( long a , long b , int amount ) { } @ Override public boolean equals ( Object obj ) { if ( ! ( obj instanceof LightningLine ) ) { return false ; } LightningLine l = ( ( LightningLine ) ( obj ) ) ; return ( ( ( l . a ) == ( a ) ) && ( ( l . b ) == ( b ) ) ) || ( ( ( l . a ) == ( b ) ) && ( ( l . b ) == ( a ) ) ) ; } @ Override public int hashCode ( ) { return ( ( int ) ( ( a ) + ( b ) ) ) ; } } HashMap < LightningLine , Integer > lightnings = new HashMap < > ( ) ; packets = connection . get ( BUILDINGS ) ; for ( Packet packet : packets ) { if ( packet instanceof PacketPlaceBuilding ) { PacketPlaceBuilding packetBuilding = ( ( PacketPlaceBuilding ) ( packet ) ) ; CoreBuilding building = packetBuilding . building . getClientBuilding ( packetBuilding . id ) ; building . setFaction ( packetBuilding . faction ) ; world . addBuilding ( packetBuilding . posX , packetBuilding . posY , building ) ; } else if ( packet instanceof PacketPowerSupply ) { PacketPowerSupply packetPS = ( ( PacketPowerSupply ) ( packet ) ) ; long [ ] waypoints = packetPS . waypoints ; if ( ( waypoints . length ) == 0 ) { System . err . println ( "Got<seq2seq4repair_space>PacketPowerSupply<seq2seq4repair_space>with<seq2seq4repair_space>empty<seq2seq4repair_space>waypoints<seq2seq4repair_space>array!" ) ; } else { for ( int i = 1 ; i < ( waypoints . length ) ; i ++ ) { LightningLine line = new LightningLine ( waypoints [ ( i - 1 ) ] , waypoints [ i ] , packetPS . amount ) ; if ( lightnings . containsKey ( line ) ) { lightnings . put ( line , ( ( lightnings . get ( line ) ) + ( packetPS . amount ) ) ) ; } else { lightnings . put ( line , packetPS . amount ) ; } } } } else if ( packet instanceof PacketBuildingUpdate ) { PacketBuildingUpdate pbu = ( ( PacketBuildingUpdate ) ( packet ) ) ; getWorld ( ) . getBuilding ( pbu . id ) . setEnergy ( pbu . energy ) ; } else if ( packet instanceof PacketEnabledBuildingsList ) { PacketEnabledBuildingsList pebl = ( ( PacketEnabledBuildingsList ) ( packet ) ) ; for ( BuildingType building : pebl . buildings ) { System . out . println ( building ) ; } } } for ( Map . Entry < LightningLine , Integer > entry : lightnings . entrySet ( ) ) { CoreBuilding building1 = getWorld ( ) . getBuilding ( entry . getKey ( ) . a ) ; CoreBuilding building2 = getWorld ( ) . getBuilding ( entry . getKey ( ) . b ) ; effects . addEffect ( new Lightning ( building1 . getCenter ( ) , building2 . getCenter ( ) ) ) ; } packets = connection . get ( ENTITIES ) ; for ( Packet packet : packets ) { if ( packet instanceof PacketSpawnEntity ) { PacketSpawnEntity packetEntity = ( ( PacketSpawnEntity ) ( packet ) ) ; CoreEntity entity = packetEntity . entity . getClientEntity ( packetEntity . id ) ; entity . setFaction ( packetEntity . faction ) ; world . spawnEntity ( entity , packetEntity . position ) ; } else if ( packet instanceof PacketEntityMoved ) { PacketEntityMoved packetEntity = ( ( PacketEntityMoved ) ( packet ) ) ; CoreEntity entity = ( ( CoreEntity ) ( world . getEntityList ( ) . getEntity ( packetEntity . id ) ) ) ; entity . teleport ( packetEntity . position ) ; entity . setRotation ( packetEntity . rotation ) ; } else if ( packet instanceof PacketEntityGoalChanged ) { PacketEntityGoalChanged packetEntity = ( ( PacketEntityGoalChanged ) ( packet ) ) ; ( ( CoreEntity ) ( world . getEntityList ( ) . getEntity ( packetEntity . id ) ) ) . setGoal ( packetEntity . goal ) ; } else if ( packet instanceof PacketAttackEffect ) { PacketAttackEffect packetEntity = ( ( PacketAttackEffect ) ( packet ) ) ; effects . addEffect ( new LaserBullet ( packetEntity . sourcePos , packetEntity . targetPos ) ) ; } else if ( packet instanceof PacketRemoveEntity ) { PacketRemoveEntity pre = ( ( PacketRemoveEntity ) ( packet ) ) ; CoreEntity entity = ( ( CoreEntity ) ( getWorld ( ) . getEntityList ( ) . getEntity ( pre . id ) ) ) ; if ( pre . killed ) { <START_BUG> effects . addEffect ( new Explosion ( entity . getPosition ( ) ) ) ; <END_BUG> } entity . removeFromWorld ( ) ; } } } } }

Fix:
effects . addEffect ( new Explosion ( entity . getPosition ( ) . clone ( ) ) ) ;