Skip to content

Commit

Permalink
Fix MinecraftForge#3126 - duplicate stat id error - don't use the "un…
Browse files Browse the repository at this point in the history
…iversal iterators" in statbuilding, use the one without the duplicate entries. (The duplicate entry one is for rendering setup)
  • Loading branch information
cpw committed Jul 28, 2016
1 parent 543156a commit bc82f2a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
32 changes: 28 additions & 4 deletions patches/minecraft/net/minecraft/stats/StatList.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/stats/StatList.java
+++ ../src-work/minecraft/net/minecraft/stats/StatList.java
@@ -162,7 +162,7 @@
@@ -162,12 +162,12 @@
}
}

Expand All @@ -9,7 +9,13 @@
}

private static void func_151181_c()
@@ -184,7 +184,7 @@
{
- for (Block block : Block.field_149771_c)
+ for (Block block : net.minecraftforge.fml.common.registry.GameData.getBlockRegistry().typeSafeIterable())
{
Item item = Item.func_150898_a(block);

@@ -184,12 +184,12 @@
}
}

Expand All @@ -18,7 +24,13 @@
}

private static void func_75925_c()
@@ -208,7 +208,7 @@
{
- for (Item item : Item.field_150901_e)
+ for (Item item : net.minecraftforge.fml.common.registry.GameData.getItemRegistry().typeSafeIterable())
{
if (item != null)
{
@@ -208,12 +208,12 @@
}
}

Expand All @@ -27,7 +39,13 @@
}

private static void func_151179_e()
@@ -227,7 +227,7 @@
{
- for (Item item : Item.field_150901_e)
+ for (Item item : net.minecraftforge.fml.common.registry.GameData.getItemRegistry().typeSafeIterable())
{
if (item != null)
{
@@ -227,12 +227,12 @@
}
}

Expand All @@ -36,6 +54,12 @@
}

private static void func_188054_f()
{
- for (Item item : Item.field_150901_e)
+ for (Item item : net.minecraftforge.fml.common.registry.GameData.getItemRegistry().typeSafeIterable())
{
if (item != null)
{
@@ -247,7 +247,7 @@
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.block.BlockDirt;
import net.minecraft.init.Blocks;
import net.minecraft.init.Bootstrap;
import net.minecraft.stats.StatList;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.DummyModContainer;
import net.minecraftforge.fml.common.Loader;
Expand Down Expand Up @@ -45,6 +46,8 @@ public void testSubstitutionInjection() throws Exception
GameRegistry.addSubstitutionAlias("minecraft:dirt", GameRegistry.Type.BLOCK, toSub);
PersistentRegistryManager.freezeData();
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
// This should not throw an exception
StatList.reinit();

final FMLControlledNamespacedRegistry<Block> blockRegistry = (FMLControlledNamespacedRegistry<Block>)PersistentRegistryManager.findRegistryByType(Block.class);

Expand Down

0 comments on commit bc82f2a

Please sign in to comment.