Fix error when reading world info for old saves with missing dimensions. Closes #3786 #3331

This commit is contained in:
LexManos 2017-03-15 02:51:52 -07:00
parent 4fbc847736
commit c1a38c541a
4 changed files with 109 additions and 11 deletions

View file

@ -242,13 +242,13 @@
} }
}, },
{ {
"name": "com.mojang:realms:1.10.13", "name": "com.mojang:realms:1.10.14",
"downloads": { "downloads": {
"artifact": { "artifact": {
"size": 3163416, "size": 3162566,
"sha1": "bc40a390634d2ece4d89b9904101932a4de98588", "sha1": "f08caf995313992fcfe03bc12234748328471d0a",
"path": "com/mojang/realms/1.10.13/realms-1.10.13.jar", "path": "com/mojang/realms/1.10.14/realms-1.10.14.jar",
"url": "https://libraries.minecraft.net/com/mojang/realms/1.10.13/realms-1.10.13.jar" "url": "https://libraries.minecraft.net/com/mojang/realms/1.10.14/realms-1.10.14.jar"
} }
} }
}, },
@ -558,6 +558,6 @@
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userType ${user_type} --versionType ${version_type}", "minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userType ${user_type} --versionType ${version_type}",
"minimumLauncherVersion": 18, "minimumLauncherVersion": 18,
"releaseTime": "2016-12-21T09:29:12+00:00", "releaseTime": "2016-12-21T09:29:12+00:00",
"time": "2017-02-07T13:18:39+00:00", "time": "2017-02-27T10:13:05+00:00",
"type": "release" "type": "release"
} }

View file

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/world/WorldProviderEnd.java
+++ ../src-work/minecraft/net/minecraft/world/WorldProviderEnd.java
@@ -20,7 +20,7 @@
public void func_76572_b()
{
this.field_76578_c = new BiomeProviderSingle(Biomes.field_76779_k);
- NBTTagCompound nbttagcompound = this.field_76579_a.func_72912_H().func_186347_a(DimensionType.THE_END);
+ NBTTagCompound nbttagcompound = this.field_76579_a.func_72912_H().getDimensionData(this.field_76579_a.field_73011_w.getDimension());
this.field_186064_g = this.field_76579_a instanceof WorldServer ? new DragonFightManager((WorldServer)this.field_76579_a, nbttagcompound.func_74775_l("DragonFight")) : null;
}
@@ -113,7 +113,7 @@
nbttagcompound.func_74782_a("DragonFight", this.field_186064_g.func_186088_a());
}
- this.field_76579_a.func_72912_H().func_186345_a(DimensionType.THE_END, nbttagcompound);
+ this.field_76579_a.func_72912_H().setDimensionData(this.field_76579_a.field_73011_w.getDimension(), nbttagcompound);
}
public void func_186059_r()

View file

@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java
+++ ../src-work/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java
@@ -218,13 +218,25 @@
{
}
+ @Deprecated
public void func_186345_a(DimensionType p_186345_1_, NBTTagCompound p_186345_2_)
{
this.field_76115_a.func_186345_a(p_186345_1_, p_186345_2_);
}
+ @Deprecated
public NBTTagCompound func_186347_a(DimensionType p_186347_1_)
{
return this.field_76115_a.func_186347_a(p_186347_1_);
}
+
+ public void setDimensionData(int dimensionID, NBTTagCompound compound)
+ {
+ this.field_76115_a.setDimensionData(dimensionID, compound);
+ }
+
+ public NBTTagCompound getDimensionData(int dimensionID)
+ {
+ return this.field_76115_a.getDimensionData(dimensionID);
+ }
}

View file

@ -1,13 +1,25 @@
--- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java --- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java
+++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java +++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java
@@ -66,6 +66,7 @@ @@ -64,8 +64,9 @@
private double field_176153_H = 0.2D;
private int field_176154_I = 5;
private int field_176155_J = 15; private int field_176155_J = 15;
private final Map<DimensionType, NBTTagCompound> field_186348_N = Maps.newEnumMap(DimensionType.class); - private final Map<DimensionType, NBTTagCompound> field_186348_N = Maps.newEnumMap(DimensionType.class);
+ private final Map<Integer, NBTTagCompound> field_186348_N = Maps.newHashMap();
private GameRules field_82577_x = new GameRules(); private GameRules field_82577_x = new GameRules();
+ private java.util.Map<String, net.minecraft.nbt.NBTBase> additionalProperties; + private java.util.Map<String, net.minecraft.nbt.NBTBase> additionalProperties;
protected WorldInfo() protected WorldInfo()
{ {
@@ -252,7 +253,7 @@
for (String s : nbttagcompound1.func_150296_c())
{
- this.field_186348_N.put(DimensionType.func_186069_a(Integer.parseInt(s)), nbttagcompound1.func_74775_l(s));
+ this.field_186348_N.put(Integer.parseInt(s), nbttagcompound1.func_74775_l(s));
}
}
}
@@ -335,6 +336,7 @@ @@ -335,6 +336,7 @@
nbttagcompound.func_74757_a("Snapshot", false); nbttagcompound.func_74757_a("Snapshot", false);
p_76064_1_.func_74782_a("Version", nbttagcompound); p_76064_1_.func_74782_a("Version", nbttagcompound);
@ -16,7 +28,20 @@
p_76064_1_.func_74772_a("RandomSeed", this.field_76100_a); p_76064_1_.func_74772_a("RandomSeed", this.field_76100_a);
p_76064_1_.func_74778_a("generatorName", this.field_76098_b.func_77127_a()); p_76064_1_.func_74778_a("generatorName", this.field_76098_b.func_77127_a());
p_76064_1_.func_74768_a("generatorVersion", this.field_76098_b.func_77131_c()); p_76064_1_.func_74768_a("generatorVersion", this.field_76098_b.func_77131_c());
@@ -709,6 +711,7 @@ @@ -377,9 +379,10 @@
p_76064_1_.func_74782_a("GameRules", this.field_82577_x.func_82770_a());
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
- for (Entry<DimensionType, NBTTagCompound> entry : this.field_186348_N.entrySet())
+ for (Entry<Integer, NBTTagCompound> entry : this.field_186348_N.entrySet())
{
- nbttagcompound1.func_74782_a(String.valueOf(((DimensionType)entry.getKey()).func_186068_a()), (NBTBase)entry.getValue());
+ if (entry.getValue() == null || entry.getValue().func_82582_d()) continue;
+ nbttagcompound1.func_74782_a(String.valueOf(entry.getKey()), (NBTBase)entry.getValue());
}
p_76064_1_.func_74782_a("DimensionData", nbttagcompound1);
@@ -709,6 +712,7 @@
public void func_176144_a(EnumDifficulty p_176144_1_) public void func_176144_a(EnumDifficulty p_176144_1_)
{ {
@ -24,7 +49,7 @@
this.field_176158_z = p_176144_1_; this.field_176158_z = p_176144_1_;
} }
@@ -807,6 +810,26 @@ @@ -807,17 +811,49 @@
}); });
} }
@ -48,6 +73,31 @@
+ return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; + return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null;
+ } + }
+ +
+ @Deprecated //Use the int version below, and pass in dimension id NOT TYPE id
public NBTTagCompound func_186347_a(DimensionType p_186347_1_) public NBTTagCompound func_186347_a(DimensionType p_186347_1_)
{ {
NBTTagCompound nbttagcompound = (NBTTagCompound)this.field_186348_N.get(p_186347_1_); - NBTTagCompound nbttagcompound = (NBTTagCompound)this.field_186348_N.get(p_186347_1_);
+ return getDimensionData(p_186347_1_.func_186068_a());
+ }
+ public NBTTagCompound getDimensionData(int dimensionID)
+ {
+ NBTTagCompound nbttagcompound = (NBTTagCompound)this.field_186348_N.get(dimensionID);
return nbttagcompound == null ? new NBTTagCompound() : nbttagcompound;
}
+ @Deprecated //Use the int version below, and pass in dimension id NOT TYPE id
public void func_186345_a(DimensionType p_186345_1_, NBTTagCompound p_186345_2_)
{
- this.field_186348_N.put(p_186345_1_, p_186345_2_);
+ this.setDimensionData(p_186345_1_.func_186068_a(), p_186345_2_);
}
+ //Dimension numerical ID version of setter, as two dimensions could in theory have the same DimensionType. ID should be grabbed from the world NOT the Type
+ public void setDimensionData(int dimensionID, NBTTagCompound compound)
+ {
+ this.field_186348_N.put(dimensionID, compound);
+ }
+
@SideOnly(Side.CLIENT)
public int func_186344_K()
{