First functional release under reobfuscation.

This commit is contained in:
Christian 2013-12-12 18:01:09 -05:00
parent 7956c2f659
commit e4479b81cb
13 changed files with 142 additions and 41 deletions

View file

@ -44,7 +44,7 @@
Display.setVSyncEnabled(this.field_71474_y.field_74352_v); Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
} }
@@ -916,9 +925,11 @@ @@ -915,9 +924,11 @@
if (!this.field_71454_w) if (!this.field_71454_w)
{ {
@ -56,7 +56,7 @@
} }
GL11.glFlush(); GL11.glFlush();
@@ -1491,11 +1502,15 @@ @@ -1490,11 +1501,15 @@
public void func_71407_l() public void func_71407_l()
{ {
@ -72,7 +72,7 @@
this.field_71424_I.func_76320_a("gui"); this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n) if (!this.field_71445_n)
@@ -1978,6 +1993,8 @@ @@ -1977,6 +1992,8 @@
this.field_71453_ak.func_74428_b(); this.field_71453_ak.func_74428_b();
} }

View file

@ -10,12 +10,3 @@
import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory; import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@@ -108,7 +111,7 @@
public final ItemInWorldManager field_71134_c;
public double field_71131_d;
public double field_71132_e;
- public final List field_71129_f = new LinkedList();
+ public final Queue field_71129_f = new ConcurrentLinkedQueue();
public final List field_71130_g = new LinkedList();
private final StatisticsFile field_147103_bO;
private float field_130068_bO = Float.MIN_VALUE;

View file

@ -24,4 +24,9 @@ public class FMLNetworkException extends RuntimeException
public FMLNetworkException() public FMLNetworkException()
{ {
} }
public FMLNetworkException(String string)
{
super(string);
}
} }

View file

@ -164,6 +164,13 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
} }
OutboundTarget outboundTarget; OutboundTarget outboundTarget;
Object args = null; Object args = null;
NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
// INTERNAL message callback - let it pass out
if (dispatcher != null)
{
ctx.write(msg, promise);
return;
}
if (ctx.channel().attr(NetworkRegistry.CHANNEL_SOURCE).get() == Side.CLIENT) if (ctx.channel().attr(NetworkRegistry.CHANNEL_SOURCE).get() == Side.CLIENT)
{ {
outboundTarget = OutboundTarget.TOSERVER; outboundTarget = OutboundTarget.TOSERVER;
@ -183,9 +190,9 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
ctx.write(msg, promise); ctx.write(msg, promise);
return; return;
} }
for (NetworkDispatcher dispatcher : dispatchers) for (NetworkDispatcher targetDispatcher : dispatchers)
{ {
dispatcher.sendProxy((FMLProxyPacket) msg); targetDispatcher.sendProxy((FMLProxyPacket) msg);
} }
} }

View file

@ -4,6 +4,7 @@ import io.netty.channel.ChannelHandlerContext;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.internal.FMLMessage;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.common.registry.GameData; import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -83,10 +84,9 @@ enum FMLHandshakeClientState implements IHandshakeState<FMLHandshakeClientState>
@Override @Override
public FMLHandshakeClientState accept(ChannelHandlerContext ctx, FMLHandshakeMessage msg) public FMLHandshakeClientState accept(ChannelHandlerContext ctx, FMLHandshakeMessage msg)
{ {
NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get(); FMLMessage.CompleteHandshake complete = new FMLMessage.CompleteHandshake(Side.SERVER);
dispatcher.continueToClientPlayState();
FMLLog.info("Client side modded connection established");
ctx.writeAndFlush(new FMLHandshakeMessage.HandshakeAck()); ctx.writeAndFlush(new FMLHandshakeMessage.HandshakeAck());
ctx.fireChannelRead(complete);
return DONE; return DONE;
} }
}, },

View file

@ -4,6 +4,7 @@ import io.netty.channel.ChannelHandlerContext;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.internal.FMLMessage;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.common.registry.GameData; import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -65,9 +66,8 @@ enum FMLHandshakeServerState implements IHandshakeState<FMLHandshakeServerState>
@Override @Override
public FMLHandshakeServerState accept(ChannelHandlerContext ctx, FMLHandshakeMessage msg) public FMLHandshakeServerState accept(ChannelHandlerContext ctx, FMLHandshakeMessage msg)
{ {
NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).get(); FMLMessage.CompleteHandshake complete = new FMLMessage.CompleteHandshake(Side.SERVER);
FMLLog.info("Server side modded connection established"); ctx.fireChannelRead(complete);
dispatcher.continueToServerPlayState();
return DONE; return DONE;
} }
}, },

View file

@ -12,6 +12,7 @@ import io.netty.util.concurrent.GenericFutureListener;
import io.netty.util.concurrent.ScheduledFuture; import io.netty.util.concurrent.ScheduledFuture;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.util.List;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -26,7 +27,10 @@ import net.minecraft.network.play.server.S40PacketDisconnect;
import net.minecraft.server.management.ServerConfigurationManager; import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.network.FMLNetworkException;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.internal.FMLMessage;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.common.network.internal.FMLProxyPacket; import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -67,6 +71,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
private ConnectionType connectionType; private ConnectionType connectionType;
private final Side side; private final Side side;
private final EmbeddedChannel handshakeChannel; private final EmbeddedChannel handshakeChannel;
private NetHandlerPlayServer serverHandler;
public NetworkDispatcher(NetworkManager manager) public NetworkDispatcher(NetworkManager manager)
{ {
@ -127,6 +132,12 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
// This will be ignored by vanilla clients // This will be ignored by vanilla clients
this.state = ConnectionState.AWAITING_HANDSHAKE; this.state = ConnectionState.AWAITING_HANDSHAKE;
this.manager.channel().pipeline().addFirst("fml:vanilla_detector", new VanillaTimeoutWaiter()); this.manager.channel().pipeline().addFirst("fml:vanilla_detector", new VanillaTimeoutWaiter());
// Need to start the handler here, so we can send custompayload packets
serverHandler = new NetHandlerPlayServer(scm.func_72365_p(), manager, player);
// NULL the play server here - we restore it further on. If not, there are packets sent before the login
player.field_71135_a = null;
// manually for the manager into the PLAY state, so we can send packets later
this.manager.func_150723_a(EnumConnectionState.PLAY);
} }
void clientListenForServerHandshake() void clientListenForServerHandshake()
@ -135,30 +146,19 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
this.state = ConnectionState.AWAITING_HANDSHAKE; this.state = ConnectionState.AWAITING_HANDSHAKE;
} }
void continueToClientPlayState()
{
this.state = ConnectionState.CONNECTED;
this.connectionType = ConnectionType.MODDED;
completeClientSideConnection();
}
private void completeClientSideConnection() private void completeClientSideConnection()
{ {
} FMLLog.info("[%s] Client side modded connection established", Thread.currentThread().getName());
void continueToServerPlayState()
{
this.state = ConnectionState.CONNECTED; this.state = ConnectionState.CONNECTED;
this.connectionType = ConnectionType.MODDED; this.connectionType = ConnectionType.MODDED;
completeServerSideConnection();
} }
private void completeServerSideConnection() private void completeServerSideConnection()
{ {
NetHandlerPlayServer nethandler = new NetHandlerPlayServer(scm.func_72365_p(), manager, player); FMLLog.info("[%s] Server side modded connection established", Thread.currentThread().getName());
// NULL the play server here - we restore it further on. If not, there are packets sent before the login this.state = ConnectionState.CONNECTED;
player.field_71135_a = null; this.connectionType = ConnectionType.MODDED;
scm.func_72355_a(manager, player, nethandler); scm.func_72355_a(manager, player, serverHandler);
} }
@Override @Override
protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception
@ -175,12 +175,11 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
else if (msg instanceof S40PacketDisconnect && state != ConnectionState.CONNECTED) else if (msg instanceof S40PacketDisconnect && state != ConnectionState.CONNECTED)
{ {
// Switch to play state to handle the disconnect message // Switch to play state to handle the disconnect message
continueToClientPlayState(); completeClientSideConnection();
} }
else if (state != ConnectionState.CONNECTED) else if (state != ConnectionState.CONNECTED)
{ {
FMLLog.info("Unexpected packet during modded negotiation - assuming vanilla"); FMLLog.info("Unexpected packet during modded negotiation - assuming vanilla or keepalives : %s", msg.getClass().getName());
kickVanilla();
} }
if (!handled) if (!handled)
{ {
@ -222,6 +221,18 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
{ {
FMLProxyPacket proxy = new FMLProxyPacket(msg); FMLProxyPacket proxy = new FMLProxyPacket(msg);
handshakeChannel.writeInbound(proxy); handshakeChannel.writeInbound(proxy);
// forward any messages into the regular channel
for (Object push : handshakeChannel.inboundMessages())
{
List<FMLProxyPacket> messageResult = FMLNetworkHandler.forwardHandshake((FMLMessage.CompleteHandshake)push, this, Side.CLIENT);
for (FMLProxyPacket result: messageResult)
{
result.setTarget(Side.CLIENT);
result.payload().resetReaderIndex();
context.fireChannelRead(result);
}
}
handshakeChannel.inboundMessages().clear();
return true; return true;
} }
else if (NetworkRegistry.INSTANCE.hasChannel(channelName, Side.CLIENT)) else if (NetworkRegistry.INSTANCE.hasChannel(channelName, Side.CLIENT))
@ -245,6 +256,17 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
{ {
FMLProxyPacket proxy = new FMLProxyPacket(msg); FMLProxyPacket proxy = new FMLProxyPacket(msg);
handshakeChannel.writeInbound(proxy); handshakeChannel.writeInbound(proxy);
for (Object push : handshakeChannel.inboundMessages())
{
List<FMLProxyPacket> messageResult = FMLNetworkHandler.forwardHandshake((FMLMessage.CompleteHandshake)push, this, Side.SERVER);
for (FMLProxyPacket result: messageResult)
{
result.setTarget(Side.SERVER);
result.payload().resetReaderIndex();
context.fireChannelRead(result);
}
}
handshakeChannel.inboundMessages().clear();
return true; return true;
} }
else if (NetworkRegistry.INSTANCE.hasChannel(channelName, Side.SERVER)) else if (NetworkRegistry.INSTANCE.hasChannel(channelName, Side.SERVER))
@ -352,4 +374,20 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
{ {
ctx.flush(); ctx.flush();
} }
public void completeHandshake(Side target)
{
if (state == ConnectionState.CONNECTED)
{
throw new FMLNetworkException("Attempt to double complete!");
}
if (side == Side.CLIENT)
{
completeClientSideConnection();
}
else
{
completeServerSideConnection();
}
}
} }

View file

@ -16,8 +16,27 @@ import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import cpw.mods.fml.common.registry.IThrowableEntity; import cpw.mods.fml.common.registry.IThrowableEntity;
import cpw.mods.fml.relauncher.Side;
public abstract class FMLMessage { public abstract class FMLMessage {
public static class CompleteHandshake extends FMLMessage {
Side target;
public CompleteHandshake() {}
public CompleteHandshake(Side target)
{
this.target = target;
}
@Override
void fromBytes(ByteBuf buf)
{
target = Side.values()[buf.readByte()];
}
@Override
void toBytes(ByteBuf buf)
{
buf.writeByte(target.ordinal());
}
}
public static class OpenGui extends FMLMessage { public static class OpenGui extends FMLMessage {
int windowId; int windowId;
int networkId; int networkId;

View file

@ -14,6 +14,7 @@ package cpw.mods.fml.common.network.internal;
import io.netty.channel.embedded.EmbeddedChannel; import io.netty.channel.embedded.EmbeddedChannel;
import java.util.ArrayList;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -35,10 +36,11 @@ import cpw.mods.fml.common.FMLContainer;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.network.FMLOutboundHandler; import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.FMLOutboundHandler.OutboundTarget; import cpw.mods.fml.common.network.FMLOutboundHandler.OutboundTarget;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.handshake.FMLHandshakeMessage; import cpw.mods.fml.common.network.handshake.FMLHandshakeMessage;
import cpw.mods.fml.common.network.handshake.NetworkDispatcher; import cpw.mods.fml.common.network.handshake.NetworkDispatcher;
import cpw.mods.fml.common.network.internal.FMLMessage.CompleteHandshake;
import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -508,7 +510,7 @@ public class FMLNetworkHandler
} }
public static void registerChannel(FMLContainer container, Side side) public static void registerChannel(FMLContainer container, Side side)
{ {
channelPair = NetworkRegistry.INSTANCE.newChannel(container, "FML", new FMLRuntimeCodec()); channelPair = NetworkRegistry.INSTANCE.newChannel(container, "FML", new FMLRuntimeCodec(), new HandshakeCompletionHandler());
EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER); EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE); embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE);
@ -518,4 +520,18 @@ public class FMLNetworkHandler
} }
} }
public static List<FMLProxyPacket> forwardHandshake(CompleteHandshake push, NetworkDispatcher target, Side side)
{
channelPair.get(side).attr(NetworkDispatcher.FML_DISPATCHER).set(target);
channelPair.get(side).writeOutbound(push);
ArrayList<FMLProxyPacket> list = new ArrayList<FMLProxyPacket>();
for (Object o: channelPair.get(side).outboundMessages())
{
list.add((FMLProxyPacket)o);
}
channelPair.get(side).outboundMessages().clear();
return list;
}
} }

View file

@ -86,4 +86,9 @@ public class FMLProxyPacket extends Packet {
{ {
return new S3FPacketCustomPayload(channel, payload.array()); return new S3FPacketCustomPayload(channel, payload.array());
} }
public void setTarget(Side target)
{
this.target = target;
}
} }

View file

@ -7,6 +7,7 @@ import io.netty.channel.ChannelHandlerContext;
public class FMLRuntimeCodec extends FMLIndexedMessageToMessageCodec<FMLMessage> { public class FMLRuntimeCodec extends FMLIndexedMessageToMessageCodec<FMLMessage> {
public FMLRuntimeCodec() public FMLRuntimeCodec()
{ {
addDiscriminator(0,FMLMessage.CompleteHandshake.class);
addDiscriminator(1,FMLMessage.OpenGui.class); addDiscriminator(1,FMLMessage.OpenGui.class);
addDiscriminator(2,FMLMessage.EntitySpawnMessage.class); addDiscriminator(2,FMLMessage.EntitySpawnMessage.class);
addDiscriminator(3,FMLMessage.EntityAdjustMessage.class); addDiscriminator(3,FMLMessage.EntityAdjustMessage.class);

View file

@ -0,0 +1,17 @@
package cpw.mods.fml.common.network.internal;
import cpw.mods.fml.common.network.handshake.NetworkDispatcher;
import cpw.mods.fml.common.network.internal.FMLMessage.CompleteHandshake;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.ChannelHandler.Sharable;
@Sharable
public class HandshakeCompletionHandler extends SimpleChannelInboundHandler<FMLMessage.CompleteHandshake> {
@Override
protected void channelRead0(ChannelHandlerContext ctx, CompleteHandshake msg) throws Exception
{
NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).getAndRemove();
dispatcher.completeHandshake(msg.target);
}
}

View file

@ -71,6 +71,8 @@ public net.minecraft.entity.passive.EntityVillager field_70958_bB
public net.minecraft.entity.passive.EntityVillager field_70960_bC public net.minecraft.entity.passive.EntityVillager field_70960_bC
## GuiButtonMerchant ## GuiButtonMerchant
#public axx #CL:GuiButtonMerchant #public axx #CL:GuiButtonMerchant
# GuiScreen
public net.minecraft.client.gui.GuiScreen field_146297_k # minecraft instance - public because gui's outside access it
# Minecraft # Minecraft
#public atv.D #FD:Minecraft/field_71425_J #running #public atv.D #FD:Minecraft/field_71425_J #running
public net.minecraft.client.Minecraft field_71446_o # textureManager public net.minecraft.client.Minecraft field_71446_o # textureManager