fix building

This commit is contained in:
creeper123123321 2021-05-26 20:56:13 -03:00
parent 087778ff2b
commit 8d086c4c3f
2 changed files with 7 additions and 6 deletions

View File

@ -46,12 +46,12 @@ version = "0.4.0-SNAPSHOT+" + try {
extra.set("archivesBaseName", "VIAaaS") extra.set("archivesBaseName", "VIAaaS")
repositories { repositories {
mavenLocal()
mavenCentral() mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots") maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://repo.viaversion.com/") maven("https://repo.viaversion.com/")
maven("https://repo.aikar.co/content/groups/aikar/") maven("https://repo.aikar.co/content/groups/aikar/")
maven("https://jitpack.io") maven("https://jitpack.io")
mavenLocal()
} }
dependencies { dependencies {

View File

@ -9,20 +9,21 @@ import de.gerrygames.viarewind.protocol.protocol1_8to1_7_6_10.metadata.MetaIndex
object MetadataRewriter { object MetadataRewriter {
fun transform(type: Entity1_10Types.EntityType?, list: MutableList<Metadata>) { fun transform(type: Entity1_10Types.EntityType?, list: MutableList<Metadata>) {
for (entry in ArrayList(list)) { for (entry in ArrayList(list)) {
val metaIndex = MetaIndex1_8to1_7_6_10.searchIndex(type, entry.id) val metaIndex = MetaIndex1_8to1_7_6_10.searchIndex(type, entry.id())
try { try {
if (metaIndex == null) throw Exception("Could not find valid metadata") if (metaIndex == null) throw Exception("Could not find valid metadata")
if (metaIndex.newType == MetaType1_8.NonExistent) { if (metaIndex.newType == MetaType1_8.NonExistent || metaIndex.newType == null) {
list.remove(entry) list.remove(entry)
return return
} }
val value = entry.value val value = entry.value
if (!value.javaClass.isAssignableFrom(metaIndex.oldType.type.outputClass)) { if (value == null
|| !value.javaClass.isAssignableFrom(metaIndex.oldType.type().outputClass)) {
list.remove(entry) list.remove(entry)
return return
} }
entry.metaType = metaIndex.newType entry.setMetaType(metaIndex.newType)
entry.id = metaIndex.newIndex entry.setId(metaIndex.newIndex)
when (metaIndex.newType) { when (metaIndex.newType) {
MetaType1_8.Int -> entry.value = (value as Number).toInt() MetaType1_8.Int -> entry.value = (value as Number).toInt()
MetaType1_8.Byte -> { MetaType1_8.Byte -> {