Skip to content

Commit

Permalink
Update to Minecraft 1.20.1
Browse files Browse the repository at this point in the history
Fixed broken persistent state due to updating
  • Loading branch information
viral32111 committed Oct 1, 2023
1 parent 57ce2ee commit c11063a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ org.gradle.warning.mode = all

# Kotlin - https://kotlinlang.org/docs/releases.html#release-details
kotlin.code.style = official
systemProp.kotlin_version = 1.8.22
systemProp.kotlin_version = 1.9.10

# Fabric - https://fabricmc.net/develop/
minecraft_version = 1.20.1
yarn_mappings = 1.20.1+build.10
minecraft_version = 1.20.2
yarn_mappings = 1.20.2+build.2
loader_version = 0.14.22
fabric_version = 0.86.1+1.20.1
loom_version = 1.3-SNAPSHOT
fabric_version = 0.89.2+1.20.2
loom_version = 1.4-SNAPSHOT

# Kotlin support for Fabric - https://github.com/FabricMC/fabric-language-kotlin
fabric_language_kotlin_version = 1.9.6+kotlin.1.8.22
fabric_language_kotlin_version = 1.10.10+kotlin.1.9.10

# Kotlin JSON Seralization - https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-serialization-json
kotlinx_serialization_json_version = 1.5.1
kotlinx_serialization_json_version = 1.6.0

# My callbacks - https://github.com/viral32111/events
events_version = 0.4.3

# Mod properties
mod_version = 1.0.2
mod_version = 1.0.3
maven_group = com.viral32111
archives_base_name = progression
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import net.minecraft.nbt.NbtList
import net.minecraft.nbt.NbtString
import net.minecraft.server.MinecraftServer
import net.minecraft.world.PersistentState
import java.util.UUID
import java.util.*

// https://www.fabricmc.net/wiki/tutorial:persistent_states

Expand All @@ -17,9 +17,11 @@ class ProgressionState : PersistentState() {
private const val KEY_EXPERIENCE_COUNTER = "experienceCounter"
private const val KEY_PLAYERS_HIDING_BOSS_BAR = "playersHidingProgressBar"

private val myType: Type<ProgressionState> = Type<ProgressionState>({ ProgressionState() }, ProgressionState::createFromNbt, null )

fun getProgressionState( server: MinecraftServer ): ProgressionState? {
val persistentStateManager = server.overworld?.persistentStateManager
return persistentStateManager?.getOrCreate( ::createFromNbt, { ProgressionState() }, MOD_ID )
return persistentStateManager?.getOrCreate( myType, MOD_ID )
}

private fun createFromNbt( nbt: NbtCompound ): ProgressionState {
Expand Down

0 comments on commit c11063a

Please # to comment.