Add in missing patch - also, launch FML properly from the server

This commit is contained in:
Christian 2012-08-09 09:21:16 -04:00
parent 6d0f7ace17
commit 6eb4bceee3
6 changed files with 86 additions and 1 deletions

View file

@ -47,6 +47,7 @@ import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import net.minecraft.client.Minecraft;
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.BaseMod;
import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.Block;
@ -409,4 +410,16 @@ public class FMLClientHandler implements IFMLSidedHandler
ent.field_70117_cu = packet.serverY;
ent.field_70116_cv = packet.serverZ;
}
@Override
public void beginServerLoading(MinecraftServer server)
{
// NOOP
}
@Override
public void finishServerLoading()
{
// NOOP
}
}

View file

@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -35,10 +36,12 @@ import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.DedicatedServer;
import net.minecraft.src.Entity;
import net.minecraft.src.World;
import com.google.common.base.Strings;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Lists;
@ -356,4 +359,24 @@ public class FMLCommonHandler
{
sidedDelegate.adjustEntityLocationOnClient(entitySpawnAdjustmentPacket);
}
public void onServerStart(DedicatedServer dedicatedServer)
{
try
{
// Done this way so that the client doesn't depend on server side handler
Class<?> cls = Class.forName("cpw.mods.fml.server.FMLServerHandler", true, getClass().getClassLoader());
}
catch (ClassNotFoundException e)
{
FMLLog.log(Level.SEVERE, e, "Unable to load the FML server handler");
throw Throwables.propagate(e);
}
sidedDelegate.beginServerLoading(dedicatedServer);
}
public void onServerStarted()
{
sidedDelegate.finishServerLoading();
}
}

View file

@ -7,6 +7,8 @@ import java.util.List;
import java.util.Properties;
import java.util.logging.Logger;
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.DedicatedServer;
import net.minecraft.src.Entity;
import net.minecraft.src.World;
@ -31,4 +33,8 @@ public interface IFMLSidedHandler
Entity spawnEntityIntoClientWorld(Class<? extends Entity> entityClass, EntitySpawnPacket packet);
void adjustEntityLocationOnClient(EntitySpawnAdjustmentPacket entitySpawnAdjustmentPacket);
void beginServerLoading(MinecraftServer server);
void finishServerLoading();
}

View file

@ -0,0 +1,25 @@
--- ../src-base/common/net/minecraft/src/DedicatedServer.java
+++ ../src-work/common/net/minecraft/src/DedicatedServer.java
@@ -1,5 +1,6 @@
package net.minecraft.src;
+import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import java.io.File;
@@ -36,6 +37,7 @@
var1.start();
ConsoleLogManager.func_73699_a();
field_71306_a.info("Starting minecraft server version 1.3.1");
+ FMLCommonHandler.instance().onServerStart(this);
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L)
{
@@ -101,6 +103,7 @@
field_71306_a.warning("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
+ FMLCommonHandler.instance().onServerStarted();
this.func_71210_a(new DedicatedPlayerList(this));
long var4 = System.nanoTime();

View file

@ -9,7 +9,21 @@
public class EntityTrackerEntry
{
@@ -306,6 +308,13 @@
@@ -232,6 +234,13 @@
this.field_73138_k = this.field_73132_a.field_70181_x;
this.field_73135_l = this.field_73132_a.field_70179_y;
+ int posX = MathHelper.func_76128_c(this.field_73137_j * 32.0D);
+ int posY = MathHelper.func_76128_c(this.field_73138_k * 32.0D);
+ int posZ = MathHelper.func_76128_c(this.field_73135_l * 32.0D);
+ if (posX != this.field_73128_d || posY != this.field_73129_e || posZ != this.field_73126_f)
+ {
+ FMLNetworkHandler.makeEntitySpawnAdjustment(this.field_73132_a.field_70157_k, p_73117_1_, this.field_73128_d, this.field_73129_e, this.field_73126_f);
+ }
if (this.field_73143_t && !(var6 instanceof Packet24MobSpawn))
{
p_73117_1_.field_71135_a.func_72567_b(new Packet28EntityVelocity(this.field_73132_a.field_70157_k, this.field_73132_a.field_70159_w, this.field_73132_a.field_70181_x, this.field_73132_a.field_70179_y));
@@ -306,6 +315,13 @@
System.out.println("Fetching addPacket for removed entity");
}

View file

@ -89,6 +89,10 @@ public class FMLServerHandler implements IFMLSidedHandler
*/
private MinecraftServer server;
private FMLServerHandler()
{
FMLCommonHandler.instance().beginLoading(this);
}
/**
* Called to start the whole game off from
* {@link MinecraftServer#startServer}