mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 19:15:32 +00:00
Add in a "world load" tick fired just as the world completes loading. This SHOULD fix millinaire.
This commit is contained in:
1 parent
f3b15940ee
commit
3454b43daa
6 files changed
+44
-23
No files matched your search
@@ -230,9 +230,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
{
|
||||
if (client.field_6324_e != null) {
|
||||
FMLCommonHandler.instance().worldTickStart();
|
||||
if (client.field_6313_p !=null) {
|
||||
FMLCommonHandler.instance().tickStart(TickType.WORLDGUI, 0.0f, client.field_6313_p);
|
||||
}
|
||||
FMLCommonHandler.instance().tickStart(TickType.WORLDGUI, 0.0f, client.field_6313_p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,12 +241,18 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
{
|
||||
if (client.field_6324_e != null) {
|
||||
FMLCommonHandler.instance().worldTickEnd();
|
||||
if (client.field_6313_p!=null) {
|
||||
FMLCommonHandler.instance().tickEnd(TickType.WORLDGUI, 0.0f, client.field_6313_p);
|
||||
}
|
||||
FMLCommonHandler.instance().tickEnd(TickType.WORLDGUI, 0.0f, client.field_6313_p);
|
||||
}
|
||||
}
|
||||
|
||||
public void onWorldLoadTick()
|
||||
{
|
||||
if (client.field_6324_e != null) {
|
||||
FMLCommonHandler.instance().tickStart(TickType.WORLDLOADTICK);
|
||||
FMLCommonHandler.instance().tickStart(TickType.GUILOADTICK);
|
||||
}
|
||||
}
|
||||
|
||||
public void onRenderTickStart(float partialTickTime)
|
||||
{
|
||||
if (client.field_6324_e != null) {
|
||||
@@ -257,11 +261,8 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
loadTextures(fallbackTexturePack);
|
||||
firstTick = false;
|
||||
}
|
||||
FMLCommonHandler.instance().tickStart(TickType.RENDER, partialTickTime);
|
||||
if (client.field_6324_e!=null)
|
||||
{
|
||||
FMLCommonHandler.instance().tickStart(TickType.GUI, partialTickTime, client.field_6313_p);
|
||||
}
|
||||
FMLCommonHandler.instance().tickStart(TickType.RENDER, partialTickTime);
|
||||
FMLCommonHandler.instance().tickStart(TickType.GUI, partialTickTime, client.field_6313_p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,9 +270,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
||||
{
|
||||
if (client.field_6324_e != null) {
|
||||
FMLCommonHandler.instance().tickEnd(TickType.RENDER, partialTickTime);
|
||||
if (client.field_6324_e!=null) {
|
||||
FMLCommonHandler.instance().tickEnd(TickType.GUI, partialTickTime, client.field_6313_p);
|
||||
}
|
||||
FMLCommonHandler.instance().tickEnd(TickType.GUI, partialTickTime, client.field_6313_p);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -42,6 +42,10 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
|
||||
return onTickInGame((Float) data[0], mc);
|
||||
} else if (((tickEnd && tick==TickType.WORLDGUI) || (tickEnd && tick==TickType.GUI))) {
|
||||
return onTickInGUI((Float) data[0], mc, (GuiScreen)data[1]);
|
||||
} else if (tick == TickType.WORLDLOADTICK) {
|
||||
return onTickInGame(0.0f, mc);
|
||||
} else if (tick == TickType.GUILOADTICK) {
|
||||
return onTickInGUI(0.0f, mc, mc.field_6313_p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -206,17 +207,19 @@ public interface ModContainer
|
||||
IPlayerTracker getPlayerTracker();
|
||||
|
||||
public enum TickType {
|
||||
WORLD, RENDER, GUI, WORLDGUI;
|
||||
WORLD, RENDER, GUI, WORLDGUI,WORLDLOADTICK, GUILOADTICK;
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public TickType partnerTick()
|
||||
public EnumSet<TickType> partnerTicks()
|
||||
{
|
||||
if (this==WORLD) return RENDER;
|
||||
if (this==RENDER) return WORLD;
|
||||
if (this==GUI) return WORLDGUI;
|
||||
if (this==WORLDGUI) return GUI;
|
||||
if (this==WORLD) return EnumSet.of(RENDER,WORLDLOADTICK);
|
||||
if (this==RENDER) return EnumSet.of(WORLD, WORLDLOADTICK);
|
||||
if (this==GUI) return EnumSet.of(WORLDGUI, GUILOADTICK);
|
||||
if (this==WORLDGUI) return EnumSet.of(GUI, GUILOADTICK);
|
||||
if (this==WORLDLOADTICK) return EnumSet.of(WORLD, RENDER);
|
||||
if (this==GUILOADTICK) return EnumSet.of(GUI, WORLDGUI);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,10 @@ public class ModLoaderHelper
|
||||
} else {
|
||||
ticks.remove(TickType.WORLD);
|
||||
}
|
||||
|
||||
if (enable) {
|
||||
ticks.add(TickType.WORLDLOADTICK);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateGUITicks(BaseMod mod, boolean enable, boolean useClock)
|
||||
@@ -64,6 +68,9 @@ public class ModLoaderHelper
|
||||
} else {
|
||||
ticks.remove(TickType.WORLDGUI);
|
||||
}
|
||||
if (enable) {
|
||||
ticks.add(TickType.GUILOADTICK);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -332,7 +332,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||
boolean keepTicking=mod.doTickInGame(tick, false, FMLCommonHandler.instance().getMinecraftInstance(), data);
|
||||
if (!keepTicking) {
|
||||
ticks.remove(tick);
|
||||
ticks.remove(tick.partnerTick());
|
||||
ticks.removeAll(tick.partnerTicks());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,7 +344,7 @@ public class ModLoaderModContainer implements ModContainer
|
||||
boolean keepTicking=mod.doTickInGame(tick, true, FMLCommonHandler.instance().getMinecraftInstance(), data);
|
||||
if (!keepTicking) {
|
||||
ticks.remove(tick);
|
||||
ticks.remove(tick.partnerTick());
|
||||
ticks.removeAll(tick.partnerTicks());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,15 @@
|
||||
this.field_6287_N = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@@ -2250,7 +2260,11 @@
|
||||
@@ -1985,6 +1995,7 @@
|
||||
|
||||
System.gc();
|
||||
this.field_6287_N = 0L;
|
||||
+ FMLClientHandler.instance().onWorldLoadTick();
|
||||
}
|
||||
|
||||
private void func_22002_b(String p_22002_1_, String p_22002_2_)
|
||||
@@ -2250,7 +2261,11 @@
|
||||
{
|
||||
var2 = p_main_0_[1];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user