47 lines
2.0 KiB
Diff
47 lines
2.0 KiB
Diff
|
--- ../src-base/minecraft/cpw/mods/fml/common/network/simpleimpl/SimpleChannelHandlerWrapper.java
|
||
|
+++ ../src-work/minecraft/cpw/mods/fml/common/network/simpleimpl/SimpleChannelHandlerWrapper.java
|
||
|
@@ -2,10 +2,9 @@
|
||
|
|
||
|
import org.apache.logging.log4j.Level;
|
||
|
|
||
|
-import net.minecraft.network.INetHandler;
|
||
|
-
|
||
|
import com.google.common.base.Preconditions;
|
||
|
|
||
|
+import cc.capture.type.CaptureBlock;
|
||
|
import cpw.mods.fml.common.FMLLog;
|
||
|
import cpw.mods.fml.common.network.FMLOutboundHandler;
|
||
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||
|
@@ -13,6 +12,10 @@
|
||
|
import io.netty.channel.ChannelFutureListener;
|
||
|
import io.netty.channel.ChannelHandlerContext;
|
||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||
|
+import net.minecraft.entity.player.EntityPlayerMP;
|
||
|
+import net.minecraft.network.INetHandler;
|
||
|
+import net.minecraft.network.NetHandlerPlayServer;
|
||
|
+import net.minecraft.server.MinecraftServer;
|
||
|
|
||
|
public class SimpleChannelHandlerWrapper<REQ extends IMessage, REPLY extends IMessage> extends SimpleChannelInboundHandler<REQ> {
|
||
|
private final IMessageHandler<? super REQ, ? extends REPLY> messageHandler;
|
||
|
@@ -34,9 +37,17 @@
|
||
|
{
|
||
|
INetHandler iNetHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
|
||
|
MessageContext context = new MessageContext(iNetHandler, side);
|
||
|
- REPLY result = messageHandler.onMessage(msg, context);
|
||
|
- if (result != null)
|
||
|
- {
|
||
|
+
|
||
|
+ CaptureBlock tCapture=null;
|
||
|
+ if(MinecraftServer.cauldronConfig.modPacketPlace.getValue()&&iNetHandler instanceof NetHandlerPlayServer){
|
||
|
+ EntityPlayerMP tPlayer=((NetHandlerPlayServer)iNetHandler).playerEntity;
|
||
|
+ tCapture=tPlayer.worldObj.mCapture.startCapture(tPlayer);
|
||
|
+ }
|
||
|
+
|
||
|
+ REPLY result=messageHandler.onMessage(msg,context);
|
||
|
+
|
||
|
+ if(tCapture!=null) tCapture.endCapture();
|
||
|
+ if(result!=null){
|
||
|
ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.REPLY);
|
||
|
ctx.writeAndFlush(result).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||
|
}
|