aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-05 09:46:21 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-05 09:46:21 +0200
commit256a7aebcf47838abccb48f1a275fda9e306e9fd (patch)
tree0b6a050e1dfcd3fdb082c8569920443108436b6e /src/main/java/at/hannibal2
parenta7db8e95d22864c340add384f98150f31cdf35fa (diff)
downloadskyhanni-256a7aebcf47838abccb48f1a275fda9e306e9fd.tar.gz
skyhanni-256a7aebcf47838abccb48f1a275fda9e306e9fd.tar.bz2
skyhanni-256a7aebcf47838abccb48f1a275fda9e306e9fd.zip
Better name editCopy
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
index 3458bd2a3..65ce760aa 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt
@@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.editThreadSave
+import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
@@ -51,7 +51,7 @@ class GriffinBurrowHelper {
@SubscribeEvent
fun onBurrowDetect(event: BurrowDetectEvent) {
EntityMovementData.addToTrack(Minecraft.getMinecraft().thePlayer)
- particleBurrows = particleBurrows.editThreadSave { this[event.burrowLocation] = event.type }
+ particleBurrows = particleBurrows.editCopy { this[event.burrowLocation] = event.type }
if (SkyHanniMod.feature.diana.burrowsNearbyDetection) {
checkRemoveGuess(true)
@@ -73,7 +73,7 @@ class GriffinBurrowHelper {
@SubscribeEvent
fun onBurrowDug(event: BurrowDugEvent) {
val location = event.burrowLocation
- particleBurrows = particleBurrows.editThreadSave { remove(location) }
+ particleBurrows = particleBurrows.editCopy { remove(location) }
if (particleBurrows.isNotEmpty()) {
animationLocation = location
}
@@ -92,7 +92,7 @@ class GriffinBurrowHelper {
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
if (event.message.startsWith("§c ☠ §r§7You were killed by §r")) {
- particleBurrows = particleBurrows.editThreadSave { keys.removeIf { this[it] == BurrowType.MOB } }
+ particleBurrows = particleBurrows.editCopy { keys.removeIf { this[it] == BurrowType.MOB } }
}
}
@@ -101,7 +101,7 @@ class GriffinBurrowHelper {
guessLocation = null
animationLocation = null
lastDug = null
- particleBurrows = particleBurrows.editThreadSave { clear() }
+ particleBurrows = particleBurrows.editCopy { clear() }
}
private fun findBlock(point: LorenzVec): LorenzVec {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 043cfe45f..cdd3af5d9 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -263,6 +263,6 @@ object LorenzUtils {
whenChanged { _, _ -> observer.run() }
}
- fun <K, V> Map<K, V>.editThreadSave(function: MutableMap<K, V>.() -> Unit) =
+ fun <K, V> Map<K, V>.editCopy(function: MutableMap<K, V>.() -> Unit) =
toMutableMap().also { function(it) }.toMap()
} \ No newline at end of file