Skip to content

Commit

Permalink
Fix: Class Cast Error in Stray Warning (#3108)
Browse files Browse the repository at this point in the history
Co-authored-by: Thunderblade73 <[email protected]>
  • Loading branch information
DavidArthurCole and Thunderblade73 authored Dec 25, 2024
1 parent e5b04fe commit ea9d839
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ object ChocolateFactoryStrayWarning {
else event.strayHighlight()
}

private fun GuiContainerEvent.getEventChest(): ContainerChest? =
gui.inventorySlots as? ContainerChest

private fun GuiContainerEvent.BackgroundDrawnEvent.partyModeHighlight() {
val eventChest = (gui.inventorySlots as ContainerChest)
val eventChest = getEventChest() ?: return
eventChest.getUpperItems().keys.forEach { it highlight CHROMA_COLOR_ALT.toSpecialColor() }
eventChest.inventorySlots.filter {
it.slotNumber != it.slotIndex
Expand All @@ -106,7 +109,8 @@ object ChocolateFactoryStrayWarning {
}

private fun GuiContainerEvent.BackgroundDrawnEvent.strayHighlight() {
(gui.inventorySlots as ContainerChest).getUpperItems().keys.filter {
val eventChest = getEventChest() ?: return
eventChest.getUpperItems().keys.filter {
it.slotNumber in activeStraySlots
}.forEach {
it highlight warningConfig.inventoryHighlightColor.toSpecialColor()
Expand Down

0 comments on commit ea9d839

Please sign in to comment.