mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Fix ticking for GUI ticks too!
This commit is contained in:
1 parent
c588750c96
commit
05f9861da4
3 files changed
+17
-10
No files matched your search
@@ -46,7 +46,7 @@ public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
|
||||
// World and render ticks
|
||||
if (tickEnd && ( tick==TickType.RENDER || tick==TickType.GAME ) && hasWorld) {
|
||||
return onTickInGame((Float) data[0], mc);
|
||||
} else if (((tickEnd && tick==TickType.WORLDGUI) || (tickEnd && tick==TickType.GUI))) {
|
||||
} else if (tickEnd && (tick==TickType.WORLDGUI || tick==TickType.GUI) && data[1]!=null) {
|
||||
return onTickInGUI((Float) data[0], mc, (GuiScreen)data[1]);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -57,24 +57,31 @@ public class BaseModTicker implements ITickHandler
|
||||
|
||||
private void tickBaseMod(EnumSet<TickType> types, boolean end, Object... tickData)
|
||||
{
|
||||
if (FMLCommonHandler.instance().getSide().isServer() || ticks.contains(TickType.RENDER))
|
||||
if (FMLCommonHandler.instance().getSide().isClient() && ( ticks.contains(TickType.GAME) || ticks.contains(TickType.WORLDGUI)))
|
||||
{
|
||||
sendTick(types, end, tickData);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (end && ticks.contains(TickType.GAME) && (types.contains(TickType.GAME) || types.contains(TickType.WORLDLOAD)))
|
||||
EnumSet cTypes=EnumSet.copyOf(types);
|
||||
if (end && ( types.contains(TickType.GAME) || types.contains(TickType.WORLDLOAD) || types.contains(TickType.WORLDGUI)))
|
||||
{
|
||||
clockTickTrigger = true;
|
||||
cTypes.remove(TickType.GAME);
|
||||
cTypes.remove(TickType.WORLDLOAD);
|
||||
cTypes.remove(TickType.WORLDGUI);
|
||||
}
|
||||
|
||||
if (end && clockTickTrigger && types.contains(TickType.RENDER))
|
||||
{
|
||||
clockTickTrigger = false;
|
||||
sendTick(EnumSet.of(TickType.GAME),end,tickData);
|
||||
cTypes.remove(TickType.RENDER);
|
||||
if (ticks.contains(TickType.GAME)) cTypes.add(TickType.GAME);
|
||||
if (ticks.contains(TickType.WORLDGUI)) cTypes.add(TickType.WORLDGUI);
|
||||
}
|
||||
|
||||
sendTick(cTypes, end, tickData);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendTick(types, end, tickData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void sendTick(EnumSet<TickType> types, boolean end, Object... tickData)
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ModLoaderHelper
|
||||
ModLoaderModContainer mlmc = findOrBuildModContainer(mod);
|
||||
EnumSet<TickType> ticks = mlmc.getTickHandler().ticks();
|
||||
// If we're enabled and we don't want clock ticks we get render ticks
|
||||
if (enable && !useClock && FMLCommonHandler.instance().getSide().isClient()) {
|
||||
if (enable && !useClock) {
|
||||
ticks.add(TickType.GUI);
|
||||
} else {
|
||||
ticks.remove(TickType.GUI);
|
||||
|
||||
Reference in new issue
Block a user