ForgePatch/patches_old/minecraft/net/minecraft/world/storage/WorldInfo.java.patch

104 lines
4.4 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java
+++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java
@@ -63,8 +63,9 @@
private double field_176153_H = 0.2D;
private int field_176154_I = 5;
private int field_176155_J = 15;
- 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 java.util.Map<String, net.minecraft.nbt.NBTBase> additionalProperties;
protected WorldInfo()
{
@@ -251,7 +252,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));
}
}
}
@@ -366,6 +367,7 @@
p_76064_1_.func_74780_a("BorderSizeLerpTarget", this.field_176148_F);
p_76064_1_.func_74780_a("BorderWarningBlocks", (double)this.field_176154_I);
p_76064_1_.func_74780_a("BorderWarningTime", (double)this.field_176155_J);
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().getDataFixer().writeVersionData(p_76064_1_);
if (this.field_176158_z != null)
{
@@ -376,9 +378,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()), entry.getValue());
+ if (entry.getValue() == null || entry.getValue().func_82582_d()) continue;
+ nbttagcompound1.func_74782_a(String.valueOf(entry.getKey()), entry.getValue());
}
p_76064_1_.func_74782_a("DimensionData", nbttagcompound1);
@@ -708,6 +711,7 @@
public void func_176144_a(EnumDifficulty p_176144_1_)
{
+ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_176144_1_, this.field_176158_z);
this.field_176158_z = p_176144_1_;
}
@@ -805,18 +809,49 @@
}
});
}
+ /**
+ * Allow access to additional mod specific world based properties
+ * Used by FML to store mod list associated with a world, and maybe an id map
+ * Used by Forge to store the dimensions available to a world
+ * @param additionalProperties
+ */
+ public void setAdditionalProperties(java.util.Map<String,net.minecraft.nbt.NBTBase> additionalProperties)
+ {
+ // one time set for this
+ if (this.additionalProperties == null)
+ {
+ this.additionalProperties = additionalProperties;
+ }
+ }
+ public net.minecraft.nbt.NBTBase getAdditionalProperty(String additionalProperty)
+ {
+ 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_)
{
- NBTTagCompound nbttagcompound = this.field_186348_N.get(p_186347_1_);
+ return getDimensionData(p_186347_1_.func_186068_a());
+ }
+ public NBTTagCompound getDimensionData(int dimensionIn)
+ {
+ NBTTagCompound nbttagcompound = this.field_186348_N.get(dimensionIn);
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()
{