Halfway through ticking- won't compile

This commit is contained in:
Christian Weeks 2012-05-06 00:58:40 -04:00
parent 8c79b9b946
commit 49be023eab
6 changed files with 77 additions and 12 deletions

View file

@ -33,7 +33,7 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
* @param minecraftInstance
* @return
*/
public final boolean doTickInGame(Object minecraftInstance)
public final boolean doTickInGame(float clock, Object minecraftInstance)
{
return onTickInGame((Minecraft)minecraftInstance);
}

View file

@ -720,12 +720,15 @@ public class ModLoader
{
ModLoaderModContainer mlmc = (ModLoaderModContainer) ModLoaderModContainer.findContainerFor(mod);
mlmc.setTicking(enable);
mlmc.setClockTicks(useClock);
}
static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
{
//TODO
ModLoaderModContainer mlmc = (ModLoaderModContainer) ModLoaderModContainer.findContainerFor(mod);
mlmc.setGUITicking(enable);
mlmc.setGUIClockTicks(useClock);
}
/**

View file

@ -60,7 +60,7 @@ public class FMLCommonHandler
*/
private IFMLSidedHandler sidedDelegate;
private int uniqueEntityListId = 250;
private int uniqueEntityListId = 220;
/**
@ -307,4 +307,14 @@ public class FMLCommonHandler
}
languagePack.putAll(langPack);
}
/**
* @param modLoaderModContainer
* @return
*/
public boolean shouldTickMod(ModContainer modContainer)
{
// TODO Auto-generated method stub
return false;
}
}

View file

@ -55,14 +55,20 @@ public interface ModContainer
* @return
*/
String getName();
/**
* Should the mod tick
* @param clock
* @return
*/
boolean shouldTick(float clock);
/**
* A tick has started
*/
void tickStart();
void tickStart(float clock);
/**
* A tick has ended
*/
void tickEnd();
void tickEnd(float clock);
/**
* Does this mod match the supplied mod?
* @param mod

View file

@ -47,6 +47,9 @@ public class ModLoaderModContainer implements ModContainer
private ArrayList<String> dependencies;
private ArrayList<String> preDependencies;
private ArrayList<String> postDependencies;
private boolean clockTicks;
private boolean guiTicks;
private boolean guiClockTicks;
public ModLoaderModContainer(Class <? extends BaseMod > modClazz, File modSource)
{
this.modClazz = modClazz;
@ -278,15 +281,18 @@ public class ModLoaderModContainer implements ModContainer
}
@Override
public void tickStart()
public boolean shouldTick(float clock)
{
if (isTicking)
{
isTicking = mod.doTickInGame(FMLCommonHandler.instance().getMinecraftInstance());
}
return isTicking && ((!clockTicks || clock!=lastClock ) || ()
return false;
}
@Override
public void tickEnd()
public void tickStart(float clock)
{
isTicking = mod.doTickInGame(clock, FMLCommonHandler.instance().getMinecraftInstance());
}
@Override
public void tickEnd(float clock)
{
// NOOP for modloader
}
@ -526,4 +532,28 @@ public class ModLoaderModContainer implements ModContainer
{
return mod;
}
/**
* @param useClock
*/
public void setClockTicks(boolean useClock)
{
this.clockTicks=useClock;
}
/**
* @param enable
*/
public void setGUITicking(boolean enable)
{
this.guiTicks=enable;
}
/**
* @param useClock
*/
public void setGUIClockTicks(boolean useClock)
{
this.guiClockTicks=useClock;
}
}

View file

@ -25,3 +25,19 @@
this.func_6250_c("Startup");
this.field_6286_O = new OpenGlCapsChecker();
this.field_6301_A.func_340_a(this.field_6304_y);
@@ -1340,6 +1344,7 @@
this.func_28001_B();
}
+ FMLClientHandler.instance().onPreTick();
Profiler.func_40663_a("stats");
this.field_25001_G.func_27178_d();
Profiler.func_40661_c("gui");
@@ -1730,6 +1735,7 @@
}
Profiler.func_40662_b();
+ FMLClientHandler.instance().onPostTick();
this.field_6287_N = System.currentTimeMillis();
}