Reinitalize statistics information on Mapping changes.
Fixes mismatched stats to item/block ids. And auto registers stats for modded items. Closes #2454
This commit is contained in:
parent
772e7da3a3
commit
2f5f9968e4
2 changed files with 44 additions and 0 deletions
|
@ -99,3 +99,40 @@
|
|||
|
||||
if (p_151180_0_[i] != null && p_151180_0_[j] == null)
|
||||
{
|
||||
@@ -306,4 +313,36 @@
|
||||
{
|
||||
return (StatBase)field_188093_a.get(p_151177_0_);
|
||||
}
|
||||
+
|
||||
+ @Deprecated //MODDER DO NOT CALL THIS ITS JUST A EVENT CALLBACK FOR FORGE
|
||||
+ public static void reinit()
|
||||
+ {
|
||||
+ field_188093_a.clear();
|
||||
+ field_188094_c.clear();
|
||||
+ field_188095_d.clear();
|
||||
+ field_188096_e.clear();
|
||||
+
|
||||
+ for (StatBase[] sb : new StatBase[][]{field_188065_ae, field_188066_af, field_75929_E, field_75930_F, field_188067_ai, field_188068_aj})
|
||||
+ {
|
||||
+ for (int x = 0; x < sb.length; x++)
|
||||
+ {
|
||||
+ if (sb[x] != null)
|
||||
+ {
|
||||
+ field_75940_b.remove(sb[x]);
|
||||
+ sb[x] = null;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ List<StatBase> unknown = Lists.newArrayList(field_75940_b);
|
||||
+ field_75940_b.clear();
|
||||
+
|
||||
+ for (StatBase b : unknown)
|
||||
+ b.func_75971_g();
|
||||
+
|
||||
+ func_151181_c();
|
||||
+ func_75925_c();
|
||||
+ func_151179_e();
|
||||
+ func_75918_d();
|
||||
+ func_188054_f();
|
||||
+ }
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Map;
|
|||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.world.storage.SaveHandler;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
import net.minecraftforge.classloading.FMLForgePlugin;
|
||||
|
@ -350,6 +351,12 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
|
|||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void mappingChange(FMLModIdMappingEvent evt)
|
||||
{
|
||||
StatList.reinit();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void postInit(FMLPostInitializationEvent evt)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue