@diesieben07 Thanks, that's one step down and thank you for the suggestion @jeffryfisher, optimization of the code will eventually happen. This works almost perfectly for what I am trying to do. I think the plan here is going to be get the list of current TE's by using event#world#tickableTicleEntites, store them in a hashmap and then remove all the tile entities from the event#world#tickableTicleEntites list. The problem I'm running into now is trying to figure out a way to clear the hashmap of TE's that have been removed from the world. Here is what I have so far.
private static HashMap<Integer, TileEntity> storageTEs = new HashMap<Integer, TileEntity>();
@SubscribeEvent
public void calendarTime(WorldTickEvent event)
{
if(event.phase == TickEvent.Phase.START && event.world.provider.getDimension() == 0)
{
List<TileEntity> allTEs = event.world.tickableTileEntities;
for (int i = 0; i < allTEs.size(); i++)
{
TileEntity tile = allTEs.get(i);
storageTEs.put(i, tile);
allTEs.remove(i);
}
for(int i = 0; i < storageTEs.size(); i++)
{
TileEntity tile = storageTEs.get(i);
if(rand.nextDouble() < 0.9)
{
System.out.println("DENY");
}
else
{
((ITickable) tile).update();
System.out.println("ALLOW");
}
}
}
}