@@ -23,37 +23,18 @@ package com.demonwav.mcdev.creator.custom.derivation
2323import com.demonwav.mcdev.creator.custom.PropertyDerivation
2424import com.demonwav.mcdev.creator.custom.TemplateValidationReporter
2525import com.demonwav.mcdev.creator.custom.types.CreatorProperty
26+ import com.demonwav.mcdev.util.MinecraftVersions
2627import com.demonwav.mcdev.util.SemanticVersion
2728
2829class ExtractPaperApiVersionPropertyDerivation : ExtractVersionMajorMinorPropertyDerivation () {
2930
30- override fun derive (parentValues : List <Any ?>): Any {
31+ override fun derive (parentValues : List <Any ?>): Any? {
3132 val from = parentValues[0 ] as SemanticVersion
32- if (from.parts.size < 2 ) {
33- return SemanticVersion (emptyList())
33+ if (from >= MinecraftVersions . MC1_20_5 ) {
34+ return from
3435 }
3536
36- if (from.parts.size == 3 ) {
37- val (part1, part2, part3) = from.parts
38- if (part1 is SemanticVersion .Companion .VersionPart .ReleasePart &&
39- part2 is SemanticVersion .Companion .VersionPart .ReleasePart &&
40- part3 is SemanticVersion .Companion .VersionPart .ReleasePart
41- ) {
42- // From Minecraft version 1.20.5 onwards, the Paper API version also contains the 'minor' number.
43- if (part1.version >= 26 || (part2.version >= 21 ) || (part2.version == 20 && part3.version >= 5 )) {
44- return SemanticVersion (listOf (part1, part2, part3))
45- }
46- }
47- }
48-
49- val (part1, part2) = from.parts
50- if (part1 is SemanticVersion .Companion .VersionPart .ReleasePart &&
51- part2 is SemanticVersion .Companion .VersionPart .ReleasePart
52- ) {
53- return SemanticVersion (listOf (part1, part2))
54- }
55-
56- return SemanticVersion (emptyList())
37+ return super .derive(parentValues);
5738 }
5839
5940 companion object : PropertyDerivationFactory {
0 commit comments