Incorporate server patches into client

This commit is contained in:
Christian 2012-07-06 10:29:17 -04:00
parent 0ff59e7978
commit 98e31e5f03
10 changed files with 197 additions and 38 deletions

View file

@ -584,6 +584,20 @@ public class FMLClientHandler implements IFMLSidedHandler
return client.field_6297_D; return client.field_6297_D;
} }
/**
* @param player
*/
public void announceLogin(EntityPlayer player)
{
for (ModContainer mod : Loader.getModList())
{
if (mod.wantsPlayerTracking())
{
mod.getPlayerTracker().onPlayerLogin(player);
}
}
}
/** /**
* @param player * @param player
*/ */
@ -1168,4 +1182,22 @@ public class FMLClientHandler implements IFMLSidedHandler
{ {
WorldType.field_48635_b.removeBiome(biome); WorldType.field_48635_b.removeBiome(biome);
} }
/**
* Handle a login
*
* @param loginPacket
* @param networkManager
*/
public void handleClientLogin(NetworkManager networkManager)
{
Packet250CustomPayload packet = new Packet250CustomPayload();
packet.field_44012_a = "REGISTER";
packet.field_44011_c = FMLCommonHandler.instance().getPacketRegistry();
packet.field_44010_b = packet.field_44011_c.length;
if (packet.field_44010_b > 0)
{
networkManager.func_972_a(packet);
}
}
} }

View file

@ -658,8 +658,34 @@ public class FMLCommonHandler
worldGenerators.add(generator); worldGenerators.add(generator);
} }
public void onPostServerTick()
{
FMLCommonHandler.instance().tickEnd(EnumSet.of(TickType.GAME));
}
/**
* Every tick just after world and other ticks occur
*/
public void onPostWorldTick(Object world)
{
FMLCommonHandler.instance().tickEnd(EnumSet.of(TickType.WORLD), world);
}
public void onPreServerTick()
{
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.GAME));
}
/**
* Every tick just before world and other ticks occur
*/
public void onPreWorldTick(Object world)
{
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.WORLD), world);
}
public void onWorldLoadTick() public void onWorldLoadTick()
{ {
tickStart(EnumSet.of(TickType.WORLDLOAD)); FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.WORLDLOAD));
} }
} }

View file

@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/src/ChunkProviderServer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/ChunkProviderServer.java 0000-00-00 00:00:00.000000000 -0000
@@ -7,6 +7,8 @@
import java.util.List;
import java.util.Set;
+import cpw.mods.fml.client.FMLClientHandler;
+
public class ChunkProviderServer implements IChunkProvider
{
private Set field_56907_b = new HashSet();
@@ -177,6 +179,7 @@
if (this.field_56905_d != null)
{
this.field_56905_d.func_534_a(p_534_1_, p_534_2_, p_534_3_);
+ FMLClientHandler.instance().onChunkPopulate(p_534_1_, p_534_2_, p_534_3_, this.field_56910_h, this.field_56905_d);
var4.func_1006_f();
}
}

View file

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/src/DedicatedServer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/DedicatedServer.java 0000-00-00 00:00:00.000000000 -0000
@@ -33,6 +33,8 @@
var1.start();
ConsoleLogManager.func_57436_a();
field_56394_a.info("Starting minecraft server version 12w26a");
+ // TODO
+// FMLServerHandler.instance().onPreLoad(this);
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L)
{
@@ -98,6 +100,8 @@
field_56394_a.warning("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
+ // TODO
+// FMLServerHandler.instance().onLoadComplete();
this.func_56309_a(new DedicatedPlayerList(this));
long var4 = System.nanoTime();

View file

@ -18,3 +18,33 @@
for (long var50 = 0L; this.field_56406_t; this.field_56383_O = true) for (long var50 = 0L; this.field_56406_t; this.field_56383_O = true)
{ {
long var5 = System.currentTimeMillis(); long var5 = System.currentTimeMillis();
@@ -407,9 +411,11 @@
protected void func_56322_n()
{
+ FMLCommonHandler.instance().rescheduleTicks();
long var1 = System.nanoTime();
AxisAlignedBB.func_58144_a().func_58151_a();
Vec3.func_58128_a().func_58135_a();
+ FMLCommonHandler.instance().onPreServerTick();
++this.field_56404_v;
this.func_56292_o();
@@ -439,6 +445,7 @@
{
this.field_56398_m.func_57207_b();
}
+ FMLCommonHandler.instance().onPostServerTick();
}
protected void func_56292_o()
@@ -456,7 +463,9 @@
this.field_56407_s.func_57105_a(new Packet4UpdateTime(var4.func_22139_r()), var4.field_4209_q.field_4218_e);
}
+ FMLCommonHandler.instance().onPreWorldTick(var4);
var4.func_649_g();
+ FMLCommonHandler.instance().onPostWorldTick(var4);
while (true)
{

View file

@ -0,0 +1,26 @@
--- ../src-base/minecraft/net/minecraft/src/NetServerHandler.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/NetServerHandler.java 0000-00-00 00:00:00.000000000 -0000
@@ -601,7 +601,10 @@
}
}
- if (var2.startsWith("/"))
+ if (FMLServerHandler.instance().handleChatPacket(p_23_1_,field_16_e)) {
+ // We handled it
+ }
+ else if (var2.startsWith("/"))
{
this.func_56721_b(var2);
}
@@ -1013,4 +1016,11 @@
}
}
}
+//TODO
+ /*
+ @Override
+ public void func_44001_a(Packet250CustomPayload p_44001_1_) {
+ FMLServerHandler.instance().handlePacket250(p_44001_1_, field_16_e);
+ }
+ */
}

View file

@ -0,0 +1,37 @@
--- ../src-base/minecraft/net/minecraft/src/ServerConfigurationManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/ServerConfigurationManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -10,6 +10,8 @@
import java.util.Set;
import java.util.logging.Logger;
+import cpw.mods.fml.client.FMLClientHandler;
+
public abstract class ServerConfigurationManager
{
private static final SimpleDateFormat field_57132_e = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
@@ -70,6 +72,8 @@
}
p_57113_2_.func_56256_h();
+ FMLClientHandler.instance().handleClientLogin(p_57113_1_);
+ FMLClientHandler.instance().announceLogin(p_57113_2_);
}
public void func_57096_a(WorldServer[] p_57096_1_)
@@ -143,6 +147,7 @@
public void func_57093_e(EntityPlayerMP p_57093_1_)
{
+ FMLClientHandler.instance().announceLogout(p_57093_1_);
this.func_57118_b(p_57093_1_);
WorldServer var2 = p_57093_1_.func_56260_H();
var2.func_607_d(p_57093_1_);
@@ -354,6 +359,8 @@
p_57125_1_.field_56267_c.func_57360_a(var5);
this.func_57120_b(p_57125_1_, var5);
this.func_57124_f(p_57125_1_);
+
+ FMLClientHandler.instance().announceDimensionChange(p_57125_1_);
}
public void func_57104_b()

View file

@ -27,7 +27,7 @@
long var1 = System.nanoTime(); long var1 = System.nanoTime();
AxisAlignedBB.func_58089_a().func_58066_a(); AxisAlignedBB.func_58089_a().func_58066_a();
Vec3.func_58052_a().func_58075_a(); Vec3.func_58052_a().func_58075_a();
+ FMLServerHandler.instance().onPreServerTick(); + FMLCommonHandler.instance().onPreServerTick();
++this.field_9014_h; ++this.field_9014_h;
this.func_56160_o(); this.func_56160_o();
@ -35,7 +35,7 @@
{ {
this.field_56221_m.func_56622_b(); this.field_56221_m.func_56622_b();
} }
+ FMLServerHandler.instance().onPostServerTick(); + FMLCommonHandler.instance().onPostServerTick();
} }
public void func_56160_o() public void func_56160_o()
@ -43,9 +43,9 @@
this.field_6033_f.func_28169_a(new Packet4UpdateTime(var4.func_22080_k()), var4.field_4272_q.field_6165_g); this.field_6033_f.func_28169_a(new Packet4UpdateTime(var4.func_22080_k()), var4.field_4272_q.field_6165_g);
} }
+ FMLServerHandler.instance().onPreWorldTick(var4); + FMLCommonHandler.instance().onPreWorldTick(var4);
var4.func_22077_g(); var4.func_22077_g();
+ FMLServerHandler.instance().onPostWorldTick(var4); + FMLCommonHandler.instance().onPostWorldTick(var4);
while (true) while (true)
{ {

View file

@ -13,7 +13,7 @@
} }
p_56432_2_.func_20057_k(); p_56432_2_.func_20057_k();
+ FMLServerHandler.instance().handleLogin(p_56432_1_); + FMLServerHandler.instance().handleClientLogin(p_56432_1_);
+ FMLServerHandler.instance().announceLogin(p_56432_2_); + FMLServerHandler.instance().announceLogin(p_56432_2_);
} }

View file

@ -18,7 +18,6 @@ import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.Random; import java.util.Random;
@ -55,7 +54,6 @@ import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.ProxyInjector; import cpw.mods.fml.common.ProxyInjector;
import cpw.mods.fml.common.ReflectionHelper; import cpw.mods.fml.common.ReflectionHelper;
import cpw.mods.fml.common.Side; import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.modloader.ModLoaderModContainer; import cpw.mods.fml.common.modloader.ModLoaderModContainer;
import cpw.mods.fml.common.modloader.ModProperty; import cpw.mods.fml.common.modloader.ModProperty;
import cpw.mods.fml.common.registry.FMLRegistry; import cpw.mods.fml.common.registry.FMLRegistry;
@ -153,35 +151,6 @@ public class FMLServerHandler implements IFMLSidedHandler
throw new RuntimeException(message, exception); throw new RuntimeException(message, exception);
} }
public void onPreServerTick()
{
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.GAME));
}
public void onPostServerTick()
{
FMLCommonHandler.instance().tickEnd(EnumSet.of(TickType.GAME));
}
/**
* Every tick just before world and other ticks occur
*/
public void onPreWorldTick(World world)
{
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.WORLD), world);
}
/**
* Every tick just after world and other ticks occur
*/
public void onPostWorldTick(World world)
{
FMLCommonHandler.instance().tickEnd(EnumSet.of(TickType.WORLD), world);
}
public void onWorldLoadTick()
{
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.WORLDLOAD));
}
/** /**
* Get the server instance * Get the server instance
* *
@ -468,7 +437,7 @@ public class FMLServerHandler implements IFMLSidedHandler
* @param loginPacket * @param loginPacket
* @param networkManager * @param networkManager
*/ */
public void handleLogin(NetworkManager networkManager) public void handleClientLogin(NetworkManager networkManager)
{ {
Packet250CustomPayload packet = new Packet250CustomPayload(); Packet250CustomPayload packet = new Packet250CustomPayload();
packet.field_44005_a = "REGISTER"; packet.field_44005_a = "REGISTER";