From 13458029b4289c950f2547493790f5325eefa86f Mon Sep 17 00:00:00 2001 From: SenseiKiwi Date: Fri, 20 Dec 2013 01:10:55 -0400 Subject: [PATCH] Fixed ClassCastException in DungeonPack Fixed a bug in DungeonPack that would trigger a rare ClassCastException during dungeon selection. We were comparing instances of DungeonType against WeightedContainer. This wouldn't break dungeon generation because DD falls back on selecting a random dungeon if rule-based selection fails. It would allow duplicate dungeons to appear in the same chain, though. --- .../mod_pocketDim/dungeon/pack/DungeonPack.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/StevenDimDoors/mod_pocketDim/dungeon/pack/DungeonPack.java b/StevenDimDoors/mod_pocketDim/dungeon/pack/DungeonPack.java index 61f182c..19c5854 100644 --- a/StevenDimDoors/mod_pocketDim/dungeon/pack/DungeonPack.java +++ b/StevenDimDoors/mod_pocketDim/dungeon/pack/DungeonPack.java @@ -191,7 +191,14 @@ public class DungeonPack return getRandomDungeon(random, candidates); } //If we've reached this point, then a dungeon was not selected. Discard the type and try again. - products.remove(nextType); + for (index = 0; index < products.size(); index++) + { + if (products.get(index).getData().equals(nextType)) + { + products.remove(index); + break; + } + } } } while (nextType != null);