mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 19:59:42 +00:00
Attempt to build some protocol negotiation, and fix packet1login so that the dimension is a short, matching packet9respawn
This commit is contained in:
1 parent
16fe495d18
commit
ecd4e46a45
7 files changed
+109
-19
No files matched your search
@@ -38,5 +38,7 @@ public interface IFMLSidedHandler
|
||||
|
||||
void handleTinyPacket(NetHandler handler, Packet131MapData mapData);
|
||||
|
||||
void setCompatibilityLevel(NetHandler netHandler, byte compatibilityLevel);
|
||||
void setClientCompatibilityLevel(byte compatibilityLevel);
|
||||
|
||||
byte getClientCompatibilityLevel();
|
||||
}
|
||||
@@ -218,6 +218,8 @@ public class FMLNetworkHandler
|
||||
|
||||
public static Packet1Login getFMLFakeLoginPacket()
|
||||
{
|
||||
// Always reset compat to zero before sending our fake packet
|
||||
FMLCommonHandler.instance().getSidedDelegate().setClientCompatibilityLevel((byte) 0);
|
||||
Packet1Login fake = new Packet1Login();
|
||||
// Hash FML using a simple function
|
||||
fake.field_73561_a = FML_HASH;
|
||||
@@ -412,4 +414,9 @@ public class FMLNetworkHandler
|
||||
{
|
||||
return PROTOCOL_VERSION;
|
||||
}
|
||||
|
||||
public static boolean vanillaLoginPacketCompatibility()
|
||||
{
|
||||
return FMLCommonHandler.instance().getSidedDelegate().getClientCompatibilityLevel() == 0;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class ModListRequestPacket extends FMLPacket
|
||||
{
|
||||
compatibilityLevel = in.readByte();
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
catch (IllegalStateException e)
|
||||
{
|
||||
FMLLog.fine("No compatibility byte found - the server is too old");
|
||||
}
|
||||
@@ -110,16 +110,9 @@ public class ModListRequestPacket extends FMLPacket
|
||||
}
|
||||
}
|
||||
|
||||
if (compatibilityLevel != 0)
|
||||
{
|
||||
FMLLog.fine("The server has compatibility level %d", compatibilityLevel);
|
||||
FMLCommonHandler.instance().getSidedDelegate().setCompatibilityLevel(netHandler, compatibilityLevel);
|
||||
}
|
||||
Packet250CustomPayload pkt = new Packet250CustomPayload();
|
||||
pkt.field_73630_a = "FML";
|
||||
pkt.field_73629_c = FMLPacket.makePacket(MOD_LIST_RESPONSE, modVersions, missingMods);
|
||||
pkt.field_73628_b = pkt.field_73629_c.length;
|
||||
FMLLog.fine("The server has compatibility level %d", compatibilityLevel);
|
||||
FMLCommonHandler.instance().getSidedDelegate().setClientCompatibilityLevel(compatibilityLevel);
|
||||
|
||||
mgr.func_74429_a(pkt);
|
||||
mgr.func_74429_a(PacketDispatcher.getPacket("FML", FMLPacket.makePacket(MOD_LIST_RESPONSE, modVersions, missingMods)));
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.NetClientHandler;
|
||||
import net.minecraft.src.NetHandler;
|
||||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.Packet131MapData;
|
||||
@@ -164,8 +165,15 @@ public class FMLServerHandler implements IFMLSidedHandler
|
||||
// NOOP on server
|
||||
}
|
||||
@Override
|
||||
public void setCompatibilityLevel(NetHandler netHandler, byte compatibilityLevel)
|
||||
public void setClientCompatibilityLevel(byte compatibilityLevel)
|
||||
{
|
||||
// NOOP on server
|
||||
}
|
||||
@Override
|
||||
public byte getClientCompatibilityLevel()
|
||||
{
|
||||
System.out.printf("Server Compatibility %d\n", 0);
|
||||
Thread.dumpStack();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user