Skip to content

Commit

Permalink
- Sometimes, in combination with some mods, it fails to correctly sto…
Browse files Browse the repository at this point in the history
…p using Iterator when accessing the list after ticking.
  • Loading branch information
wildex999 committed Feb 20, 2016
1 parent 94ac938 commit 85edf62
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {

apply plugin: 'forge'

version = "0.2.0-dev4"
version = "0.2.0-dev5"
String fullversion = "1.7.10-10.13.2.1291"
group= "com.wildex999.tickdynamic" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "tickdynamic-kcauldron" + fullversion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
public class TickDynamicMod extends DummyModContainer
{
public static final String MODID = "tickDynamic";
public static final String VERSION = "0.2.0-dev4";
public static final String VERSION = "0.2.0-dev5";
public static boolean debug = false;
public static boolean debugGroups = false;
public static boolean debugTimer = false;
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/com/wildex999/tickdynamic/WorldEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public WorldEventHandler(TickDynamicMod mod) {
tileListManager = new HashMap<World, ListManager>();
}

@SubscribeEvent
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void worldTickEvent(WorldTickEvent event) {
Profiler profiler = event.world.theProfiler;
if(!(profiler instanceof CustomProfiler))
Expand All @@ -50,6 +50,16 @@ public void worldTickEvent(WorldTickEvent event) {
customProfiler.setStage(CustomProfiler.Stage.BeforeLoop);
}
else {
//Ensure Entity ticking stops
List entityList = event.world.loadedEntityList;
if(entityList != null && entityList instanceof ListManagerEntities) {
((ListManagerEntities)event.world.loadedEntityList).stopUpdate();
}
//Ensure TileEntity ticking stops
List tileList = event.world.loadedEntityList;
if(tileList != null && tileList instanceof ListManagerTileEntities) {
((ListManagerTileEntities)event.world.loadedTileEntityList).stopUpdate();
}
customProfiler.setStage(CustomProfiler.Stage.None);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.wildex999.tickdynamic.listinject;

import java.util.Iterator;
import java.util.List;

import com.wildex999.tickdynamic.TickDynamicMod;

Expand Down Expand Up @@ -34,6 +35,12 @@ public int size() {
return super.size();

if(!updateStarted) {
//Ensure Entity ticking stops
List entityList = this.world.loadedEntityList;
if(entityList != null && entityList instanceof ListManagerEntities) {
((ListManagerEntities)this.world.loadedEntityList).stopUpdate();
}

updateStarted = true;
entityIterator = new EntityIteratorTimed(this, this.getAge());
}
Expand Down

0 comments on commit 85edf62

Please sign in to comment.