More ticking hooks, and some other bits of clean up. Very close to "done" now.
This commit is contained in:
parent
b5dc18ff7e
commit
7b2d09844c
8 changed files with 114 additions and 26 deletions
|
@ -86,6 +86,7 @@ import net.minecraft.src.WorldClient;
|
|||
import net.minecraft.src.WorldType;
|
||||
import argo.jdom.JdomParser;
|
||||
import argo.jdom.JsonNode;
|
||||
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
@ -173,6 +174,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
ObfuscationReflectionHelper.detectObfuscation(World.class);
|
||||
TextureFXManager.instance().setClient(client);
|
||||
FMLCommonHandler.instance().beginLoading(this);
|
||||
new ModLoaderClientHelper(client);
|
||||
try
|
||||
{
|
||||
Class<?> optifineConfig = Class.forName("Config", false, Loader.instance().getModClassLoader());
|
||||
|
@ -221,13 +223,6 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
}
|
||||
RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.field_78727_a.field_78729_o);
|
||||
|
||||
// TODO
|
||||
// for (ModContainer mod : Loader.getModList()) {
|
||||
// mod.gatherRenderers(RenderManager.field_1233_a.getRendererList());
|
||||
// for (Render r : RenderManager.field_1233_a.getRendererList().values()) {
|
||||
// r.func_4009_a(RenderManager.field_1233_a);
|
||||
// }
|
||||
// }
|
||||
KeyBindingRegistry.uploadKeyBindingsToGame(client.field_71474_y);
|
||||
|
||||
// Mark this as a "first tick"
|
||||
|
|
|
@ -10,10 +10,11 @@ import net.minecraft.src.BaseMod;
|
|||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.Render;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.modloader.IModLoaderSidedHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
||||
|
||||
public class ModLoaderClientHelper
|
||||
public class ModLoaderClientHelper implements IModLoaderSidedHelper
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -45,4 +46,18 @@ public class ModLoaderClientHelper
|
|||
|
||||
mod.registerAnimation(game);
|
||||
}
|
||||
|
||||
public ModLoaderClientHelper(Minecraft client)
|
||||
{
|
||||
this.client = client;
|
||||
ModLoaderHelper.sidedHelper = this;
|
||||
}
|
||||
|
||||
private Minecraft client;
|
||||
|
||||
@Override
|
||||
public void finishModLoading(ModLoaderModContainer mc)
|
||||
{
|
||||
handleFinishLoadingFor(mc, client);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import java.util.zip.ZipInputStream;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.src.DedicatedServer;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.World;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
@ -187,11 +188,6 @@ public class FMLCommonHandler
|
|||
return sidedDelegate.getSide();
|
||||
}
|
||||
|
||||
public void addAuxilliaryModContainer(ModContainer ticker)
|
||||
{
|
||||
auxilliaryContainers.add(ticker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise an exception
|
||||
*
|
||||
|
@ -212,8 +208,6 @@ public class FMLCommonHandler
|
|||
private Class<?> forge;
|
||||
private boolean noForge;
|
||||
private List<String> brandings;
|
||||
private List<ModContainer> auxilliaryContainers = new ArrayList<ModContainer>();
|
||||
|
||||
private Class<?> findMinecraftForge()
|
||||
{
|
||||
if (forge==null && !noForge)
|
||||
|
@ -309,9 +303,13 @@ public class FMLCommonHandler
|
|||
tickStart(EnumSet.of(TickType.WORLD), Side.SERVER, world);
|
||||
}
|
||||
|
||||
public void onWorldLoadTick(Object world)
|
||||
public void onWorldLoadTick(World[] worlds)
|
||||
{
|
||||
tickStart(EnumSet.of(TickType.WORLDLOAD), Side.SERVER, world);
|
||||
rescheduleTicks(Side.SERVER);
|
||||
for (World w : worlds)
|
||||
{
|
||||
tickStart(EnumSet.of(TickType.WORLDLOAD), Side.SERVER, w);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleServerStarting(MinecraftServer server)
|
||||
|
@ -391,4 +389,14 @@ public class FMLCommonHandler
|
|||
{
|
||||
tickEnd(EnumSet.of(TickType.RENDER), Side.CLIENT, timer);
|
||||
}
|
||||
|
||||
public void onPlayerPreTick(EntityPlayer player)
|
||||
{
|
||||
tickStart(EnumSet.of(TickType.PLAYER), Side.SERVER, player);
|
||||
}
|
||||
|
||||
public void onPlayerPostTick(EntityPlayer player)
|
||||
{
|
||||
tickEnd(EnumSet.of(TickType.PLAYER), Side.SERVER, player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package cpw.mods.fml.common.modloader;
|
||||
|
||||
public interface IModLoaderSidedHelper
|
||||
{
|
||||
|
||||
void finishModLoading(ModLoaderModContainer mc);
|
||||
|
||||
}
|
|
@ -28,6 +28,7 @@ import cpw.mods.fml.common.IWorldGenerator;
|
|||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
|
@ -37,6 +38,7 @@ public class ModLoaderHelper
|
|||
{
|
||||
private static Map<BaseMod, ModLoaderModContainer> notModCallbacks=new HashMap<BaseMod, ModLoaderModContainer>();
|
||||
|
||||
public static IModLoaderSidedHelper sidedHelper;
|
||||
public static void updateStandardTicks(BaseMod mod, boolean enable, boolean useClock)
|
||||
{
|
||||
ModLoaderModContainer mlmc = findOrBuildModContainer(mod);
|
||||
|
@ -129,4 +131,12 @@ public class ModLoaderHelper
|
|||
{
|
||||
return new ModLoaderCraftingHelper(mod);
|
||||
}
|
||||
|
||||
public static void finishModLoading(ModLoaderModContainer mc)
|
||||
{
|
||||
if (sidedHelper != null)
|
||||
{
|
||||
sidedHelper.finishModLoading(mc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.EnumSet;
|
|||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.IScheduledTickHandler;
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
|
@ -40,9 +41,9 @@ public class mod_testMod extends BaseMod {
|
|||
t2.interval=2;
|
||||
TickTester t3 = new TickTester();
|
||||
t3.interval=3;
|
||||
TickRegistry.registerScheduledTickHandler(t1);
|
||||
TickRegistry.registerScheduledTickHandler(t2);
|
||||
TickRegistry.registerScheduledTickHandler(t3);
|
||||
TickRegistry.registerScheduledTickHandler(t1, Side.CLIENT);
|
||||
TickRegistry.registerScheduledTickHandler(t2, Side.SERVER);
|
||||
TickRegistry.registerScheduledTickHandler(t3, Side.CLIENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,15 +10,18 @@
|
|||
import net.minecraft.src.AnvilSaveConverter;
|
||||
import net.minecraft.src.AxisAlignedBB;
|
||||
import net.minecraft.src.CallableIsServerModded;
|
||||
@@ -364,6 +367,7 @@
|
||||
@@ -364,7 +367,10 @@
|
||||
{
|
||||
if (this.func_71197_b())
|
||||
{
|
||||
+ FMLCommonHandler.instance().handleServerStarted();
|
||||
long var1 = System.currentTimeMillis();
|
||||
+
|
||||
+ FMLCommonHandler.instance().onWorldLoadTick(field_71305_c);
|
||||
|
||||
for (long var50 = 0L; this.field_71317_u; this.field_71296_Q = true)
|
||||
@@ -403,6 +407,7 @@
|
||||
{
|
||||
@@ -403,6 +409,7 @@
|
||||
|
||||
Thread.sleep(1L);
|
||||
}
|
||||
|
@ -26,7 +29,37 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
@@ -1117,6 +1122,12 @@
|
||||
@@ -466,9 +473,11 @@
|
||||
|
||||
public void func_71217_p()
|
||||
{
|
||||
+ FMLCommonHandler.instance().rescheduleTicks(Side.SERVER);
|
||||
long var1 = System.nanoTime();
|
||||
AxisAlignedBB.func_72332_a().func_72298_a();
|
||||
Vec3.func_72437_a().func_72343_a();
|
||||
+ FMLCommonHandler.instance().onPreServerTick();
|
||||
++this.field_71315_w;
|
||||
|
||||
if (this.field_71295_T)
|
||||
@@ -514,6 +523,7 @@
|
||||
|
||||
this.field_71304_b.func_76319_b();
|
||||
this.field_71304_b.func_76319_b();
|
||||
+ FMLCommonHandler.instance().onPostServerTick();
|
||||
}
|
||||
|
||||
public void func_71190_q()
|
||||
@@ -537,7 +547,9 @@
|
||||
}
|
||||
|
||||
this.field_71304_b.func_76320_a("tick");
|
||||
+ FMLCommonHandler.instance().onPreWorldTick(var4);
|
||||
var4.func_72835_b();
|
||||
+ FMLCommonHandler.instance().onPostWorldTick(var4);
|
||||
this.field_71304_b.func_76318_c("lights");
|
||||
|
||||
while (true)
|
||||
@@ -1117,6 +1129,12 @@
|
||||
@SideOnly(Side.SERVER)
|
||||
public static void main(String[] p_main_0_)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
--- ../src-base/common/net/minecraft/src/EntityPlayer.java
|
||||
+++ ../src-work/common/net/minecraft/src/EntityPlayer.java
|
||||
@@ -2,6 +2,8 @@
|
||||
@@ -1,7 +1,10 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
+import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
+import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||
|
@ -9,11 +11,27 @@
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1608,4 +1610,9 @@
|
||||
@@ -131,6 +134,7 @@
|
||||
|
||||
public void func_70071_h_()
|
||||
{
|
||||
+ FMLCommonHandler.instance().onPlayerPreTick(this);
|
||||
if (this.field_71074_e != null)
|
||||
{
|
||||
ItemStack var1 = this.field_71071_by.func_70448_g();
|
||||
@@ -254,6 +258,7 @@
|
||||
{
|
||||
this.field_71100_bB.func_75118_a(this);
|
||||
}
|
||||
+ FMLCommonHandler.instance().onPlayerPostTick(this);
|
||||
}
|
||||
|
||||
protected void func_71010_c(ItemStack p_71010_1_, int p_71010_2_)
|
||||
@@ -1608,4 +1613,9 @@
|
||||
{
|
||||
return this.field_71078_a;
|
||||
}
|
||||
+
|
||||
+
|
||||
+ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z)
|
||||
+ {
|
||||
+ FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z);
|
||||
|
|
Loading…
Reference in a new issue