LB-- / MCModify

WIP Java/C++ library for dealing with Minecraft files.
The Unlicense
21 stars 10 forks source link

Problem reading 1.7.4 region mca file #3

Open JoeDaddyZZZ opened 10 years ago

JoeDaddyZZZ commented 10 years ago

I got your test to work with the given r.0.0.mca file. However, my 1.7.4 data file r.1.-2.mca errored while reading the chuck. Have you tested with this version of minecraft?

com.LB_Stuff.NBT.FormatException: Exception while deserializing Compound tag at com.LB_Stuff.NBT.Tag$Compound.(Tag.java:1226) at com.LB_Stuff.NBT.IO.ReadUncompressed(IO.java:66) at com.LB_Stuff.NBT.Minecraft.Region.ReadChunk(Region.java:185) at com.jgorski.mc.map.FirstTest.main(FirstTest.java:32) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.LB_Stuff.NBT.Tag$Compound.(Tag.java:1217) ... 3 more Caused by: com.LB_Stuff.NBT.FormatException: Exception while deserializing Compound tag at com.LB_Stuff.NBT.Tag$Compound.(Tag.java:1226) ... 8 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.LB_Stuff.NBT.Tag$Compound.(Tag.java:1217) ... 8 more Caused by: com.LB_Stuff.NBT.FormatException: Found a list of TAG_End at com.LB_Stuff.NBT.Tag$List.(Tag.java:934) ... 13 more

LB-- commented 10 years ago

I have not yet updated the library to work with the latest version of Minecraft, however this particular issue seems to be because at Mojang they decided for whatever reason to represent empty lists as lists of TAG_End. I think I can fix this in-browser...

LB-- commented 10 years ago

Can you let me know if https://github.com/LB--/MCModify/commit/2d46601d0870e1ffacbc2f71cb29f6700d955b79 works for you?

JoeDaddyZZZ commented 10 years ago

I tried the new code with the same result. Do you want me upload my data file?

JoeDaddyZZZ commented 10 years ago

Sorry forgot the trace;

com.LB_Stuff.NBT.FormatException: Exception while deserializing Compound tag at com.LB_Stuff.NBT.Tag$Compound.(Tag.java:1220) at com.LB_Stuff.NBT.IO.ReadUncompressed(IO.java:66) at com.LB_Stuff.NBT.IO.Read(IO.java:52) at com.jgorski.mc.map.FirstTest.main(FirstTest.java:31) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.LB_Stuff.NBT.Tag$Compound.(Tag.java:1211) ... 3 more Caused by: com.LB_Stuff.NBT.FormatException: Exception while deserializing Compound tag at com.LB_Stuff.NBT.Tag$Compound.(Tag.java:1220) ... 8 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.LB_Stuff.NBT.Tag$Compound.(Tag.java:1211) ... 8 more Caused by: com.LB_Stuff.NBT.FormatException: Exception while deserializing Compound tag at com.LB_Stuff.NBT.Tag$Compound.(Tag.java:1220) ... 13 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.LB_Stuff.NBT.Tag$Compound.(Tag.java:1211) ... 13 more Caused by: com.LB_Stuff.NBT.FormatException: java.lang.NoSuchMethodException: com.LB_Stuff.NBT.Tag$End.(java.lang.String, java.io.InputStream) at com.LB_Stuff.NBT.Tag$List.(Tag.java:946) ... 18 more Caused by: java.lang.NoSuchMethodException: com.LB_Stuff.NBT.Tag$End.(java.lang.String, java.io.InputStream) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getConstructor(Unknown Source) at com.LB_Stuff.NBT.Tag$List.(Tag.java:938) ... 18 more

LB-- commented 10 years ago

Hm, I don't know why it is trying to actually construct the end tags - the lists should be empty. I don't have time to debug this now (doing college work) - I will be free on friday to work on this.

JoeDaddyZZZ commented 10 years ago

I have found Mojang code from the anvil converter and it is also having issues with an End Tag.

https://mojang.com/2012/02/new-minecraft-map-format-anvil/

LB-- commented 10 years ago

Yeah, that code was released ages ago and it hasn't been updated since. I have no idea why the made the change - their implementation previously forced list of Byte tags if it was empty, even if you specified a specific type. No idea why it worked the way it used or why it works the way it does now, it makes literally no sense.

codyphobe commented 10 years ago

I take it there's still no solution to this?

LB-- commented 10 years ago

Sorry, I haven't had the time to work on this. I'll try and fix it later today.

JoeDaddyZZZ commented 10 years ago

I ended up using mojang's anvil conversion code as a base to my project.

Sent from Yahoo Mail on Android

codyphobe commented 10 years ago

I managed to fix it (although I'm sure it's not the best solution) by adding a public constructor to Tag.End that accepts a java String and InputStream, the constructor simply calls this();. However, now I am faced with another problem in NBT.Minecraft.Mob. The Mob class assumes that every mob will have an entry called "AttackTime", but this is not the case for passive mobs such as a Pig. The specific line that calls the FormatException is here.

LB-- commented 10 years ago

The Mob class assumes that every mob will have an entry called "AttackTime", but this is not the case for passive mobs such as a Pig.

Darn, Mojang keeps throwing curveballs that didn't exist when I first wrote the library. :\