Skip to content

Commit

Permalink
fix rare memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Glease committed Jan 10, 2025
1 parent bc3542e commit 1450dd8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/scala/codechicken/multipart/ControlKeyModifier.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ object ControlKeyHandler
) {
import ControlKeyModifer._
var wasPressed = false
var oldPlayer: EntityPlayer = null

@SubscribeEvent
@SideOnly(Side.CLIENT)
Expand All @@ -52,5 +53,13 @@ object ControlKeyHandler
packet.sendToServer()
}
}
if (oldPlayer != null) {
if (oldPlayer != Minecraft.getMinecraft.thePlayer) {
map.remove(oldPlayer)
oldPlayer = Minecraft.getMinecraft.thePlayer
}
} else {
oldPlayer = Minecraft.getMinecraft.thePlayer
}
}
}

0 comments on commit 1450dd8

Please sign in to comment.