Improved EventHookContainer

Made some changes to EventHookContainer.onWorldLoad() to remove
redundant code that encouraged bugs. Unfortunately, a lot of
link-related code needs to be rewritten to get rid of bugs, so that'll
come after dungeon packs are completed.
This commit is contained in:
SenseiKiwi
2013-08-17 20:32:30 -04:00
parent dc7289a048
commit caf33bd866

View File

@@ -46,32 +46,26 @@ public class EventHookContainer
dimHelper.instance.interDimLinkList.clear(); dimHelper.instance.interDimLinkList.clear();
dimHelper.instance.initPockets(); dimHelper.instance.initPockets();
} }
for (Integer ids : dimHelper.getIDs())
//TODO: In the future, we should iterate over DimHelper's dimension list. We ignore other dimensions anyway.
for (int dimensionID : dimHelper.getIDs())
{ {
World world = dimHelper.getWorld(ids); World world = dimHelper.getWorld(dimensionID);
int linkCount = 0; int linkCount = 0;
if (dimHelper.dimList.containsKey(world.provider.dimensionId)) if (dimHelper.dimList.containsKey(dimensionID))
{ {
//TODO added temporary Try/catch block to prevent a crash here, getLinksInDim needs to be looked at for (LinkData link : dimHelper.instance.getDimData(dimensionID).getLinksInDim())
try
{ {
for (LinkData link:dimHelper.instance.getDimData(world.provider.dimensionId).getLinksInDim()) if (!mod_pocketDim.blockRift.isBlockImmune(world, link.locXCoord, link.locYCoord, link.locZCoord))
{ {
if (!mod_pocketDim.blockRift.isBlockImmune(world, link.locXCoord, link.locYCoord, link.locZCoord)) world.setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
{ }
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID); linkCount++;
} if (linkCount >= 100)
linkCount++; {
if (linkCount >= 100) break;
{ }
break;
}
}
}
catch(Exception e)
{
e.printStackTrace();
} }
} }
} }