當前位置: 首頁>>代碼示例>>Java>>正文


Java IMessageHandler類代碼示例

本文整理匯總了Java中cpw.mods.fml.common.network.simpleimpl.IMessageHandler的典型用法代碼示例。如果您正苦於以下問題:Java IMessageHandler類的具體用法?Java IMessageHandler怎麽用?Java IMessageHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IMessageHandler類屬於cpw.mods.fml.common.network.simpleimpl包,在下文中一共展示了IMessageHandler類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerMessage

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
/**
 * Registers an {@link AbstractMessage} to the appropriate side(s)
 */
private static final <T extends AbstractMessage<T> & IMessageHandler<T, IMessage>> void registerMessage(Class<T> clazz) {
	if (AbstractMessage.AbstractClientMessage.class.isAssignableFrom(clazz)) {
		PacketDispatcher.dispatcher.registerMessage(clazz, clazz, packetId++, Side.CLIENT);
	} else if (AbstractMessage.AbstractServerMessage.class.isAssignableFrom(clazz)) {
		PacketDispatcher.dispatcher.registerMessage(clazz, clazz, packetId++, Side.SERVER);
	} else {
		PacketDispatcher.dispatcher.registerMessage(clazz, clazz, packetId, Side.CLIENT);
		PacketDispatcher.dispatcher.registerMessage(clazz, clazz, packetId++, Side.SERVER);
	}
}
 
開發者ID:roryclaasen,項目名稱:RorysMod,代碼行數:14,代碼來源:PacketDispatcher.java

示例2: register

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
private <REQ extends IMessage> void register(Class<?> handler, Class<REQ> msg, Side side) {
    Class<? extends IMessageHandler<REQ, IMessage>> messageHandler = (Class<? extends IMessageHandler<REQ, IMessage>>) handler;
    SimpleNetworkWrapper wrapper = (SimpleNetworkWrapper) helper.getModField();
    int id = helper.getNextIDForMod();
    //System.out.println(msg + " -> " + id);
    wrapper.registerMessage(messageHandler, msg, id, side);
}
 
開發者ID:LambdaInnovation,項目名稱:LambdaLib,代碼行數:8,代碼來源:MessageHandlerRegistration.java

示例3: registerPacket

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
public static void registerPacket(CustomPacket packet) {
	if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
		wrapper.registerMessage((Class<? extends IMessageHandler<CustomPacket, IMessage>>) packet.getClass(), (Class<CustomPacket>) packet.getClass(), counter++, Side.CLIENT);
	}
	else {
		wrapper.registerMessage((Class<? extends IMessageHandler<CustomPacket, IMessage>>) packet.getClass(), (Class<CustomPacket>) packet.getClass(), counter++, Side.SERVER);
	}
}
 
開發者ID:DeltaStrium,項目名稱:RecycleCraft,代碼行數:9,代碼來源:PacketHandler.java

示例4: register

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
/**
 * Register a packet
 * @param packet the packet to register
 * @param side the side to register the packet for
 * @param id the id of the packet
 */
@SuppressWarnings("unchecked")
public static void register(Class<? extends IPacket> packet, Side side, int id)
{
	Class<? extends Object> clazz = packet;
	INSTANCE.registerMessage((Class<? extends IMessageHandler<IMessage, IMessage>>)clazz, (Class<IMessage>)clazz, id, side);
}
 
開發者ID:TeamCoderCraft,項目名稱:EnergizedPower,代碼行數:13,代碼來源:PacketHandler.java

示例5: registerMessage

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
/**
 * This method assumes that the same class is used for both the message and the message handler
 */
@SuppressWarnings("unchecked")
private static <REQ extends IMessage, REPLY extends IMessage> void registerMessage(Class<?> clazz, PacketSide side) {
    if (side == PacketSide.CLIENT || side == PacketSide.BOTH) CHANNEL.registerMessage((Class<? extends IMessageHandler<REQ, REPLY>>) clazz, (Class<REQ>) clazz, descriminator, Side.CLIENT);
    if (side == PacketSide.SERVER || side == PacketSide.BOTH) CHANNEL.registerMessage((Class<? extends IMessageHandler<REQ, REPLY>>) clazz, (Class<REQ>) clazz, descriminator, Side.SERVER);
    descriminator++;
}
 
開發者ID:dmillerw,項目名稱:AutomationMod,代碼行數:10,代碼來源:PacketHandler.java

示例6: registerUniversalMessage

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
private <REQ extends IMessage, REPLY extends IMessage> void registerUniversalMessage( 
		Class<? extends IMessageHandler<REQ, REPLY>> messageHandler, Class<REQ> requestMessageType) {
	network.registerMessage(messageHandler, requestMessageType, discriminator, Side.CLIENT);
	discriminator++;
	network.registerMessage(messageHandler, requestMessageType, discriminator, Side.SERVER);
	discriminator++;
}
 
開發者ID:soultek101,項目名稱:projectzulu1.7.10-pre-1.3a,代碼行數:8,代碼來源:PacketPipeline.java

示例7: regMessage

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
private void regMessage(Class<? extends IMessage> message, Side side, Side otherSide) {
    if(otherSide != null) {
        regMessage(message, otherSide);
    }
    if(messageID > 255) {
        System.out.println("Warning: Over 255 messages registered, need another channel");
    } else {
        Class<? extends IMessageHandler<IMessage, IMessage>> messageHandlerClass = (Class<? extends IMessageHandler<IMessage, IMessage>>) message.getDeclaredClasses()[0];
        ZombieTC.network.registerMessage(messageHandlerClass, (Class<IMessage>)message, messageID, side);
        messageID++;
    }
}
 
開發者ID:gigimoi,項目名稱:Zombie-Total-Conversion-Craft,代碼行數:13,代碼來源:CommonProxy.java

示例8: registerMessage

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
public static <REQ extends IMessage, REPLY extends IMessage> void registerMessage(Class<? extends IMessageHandler<REQ, REPLY>> messageHandler, Class<REQ> requestMessageType, Side receivingSide)
{
    INSTANCE.registerMessage(messageHandler, requestMessageType, counter, receivingSide);
    counter++;
}
 
開發者ID:Zundrel,項目名稱:Ye-Olde-Chat,代碼行數:6,代碼來源:PacketHandler.java

示例9: register

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
/** Register a message type with this message handler on this side using the ID. */
public <T extends IMessage & IMessageHandler<T, IMessage>> void register(int id, Side receivingSide, Class<T> messageClass) {
	registerMessage(messageClass, messageClass, id, receivingSide);
}
 
開發者ID:copygirl,項目名稱:copycore,代碼行數:5,代碼來源:NetworkChannel.java

示例10: registerClientMessage

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
private <REQ extends IMessage, REPLY extends IMessage> void registerClientMessage( 
		Class<? extends IMessageHandler<REQ, REPLY>> messageHandler, Class<REQ> requestMessageType) {
	network.registerMessage(messageHandler, requestMessageType, discriminator, Side.CLIENT);
	discriminator++;
}
 
開發者ID:soultek101,項目名稱:projectzulu1.7.10-pre-1.3a,代碼行數:6,代碼來源:PacketPipeline.java

示例11: registerServerMessage

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
private <REQ extends IMessage, REPLY extends IMessage> void registerServerMessage( 
		Class<? extends IMessageHandler<REQ, REPLY>> messageHandler, Class<REQ> requestMessageType) {
	network.registerMessage(messageHandler, requestMessageType, discriminator, Side.SERVER);
	discriminator++;
}
 
開發者ID:soultek101,項目名稱:projectzulu1.7.10-pre-1.3a,代碼行數:6,代碼來源:PacketPipeline.java

示例12: registerMessage

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
/**
 * Register a message; Automatic side detection
 * 
 * @param handlerClass
 * @param messageClass
 */
protected final <REQ extends IMessage, REPLY extends IMessage> void registerMessage( Class<? extends IMessageHandler<REQ, REPLY>> handlerClass, Class<REQ> messageClass )
{
  Side side = AbstractClientMessageHandler.class.isAssignableFrom( handlerClass ) ? Side.CLIENT : Side.SERVER;
  dispatcher.registerMessage( handlerClass, messageClass, _mPacketId++, side );
}
 
開發者ID:GTNewHorizons,項目名稱:Yamcl,代碼行數:12,代碼來源:PacketDispatcher.java

示例13: registerMessage

import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; //導入依賴的package包/類
/**
 * @param clazz  Class with all the message goodness, must extend MessageAbstract.
 * @param target Side that the message is being sent to.
 */
public <REQ extends IMessage, REPLY extends IMessage> void registerMessage(Class<? extends MessageAbstract<REQ, REPLY>> clazz, Side target) {
    network.registerMessage((Class<? extends IMessageHandler<REQ, REPLY>>) clazz, (Class<REQ>) clazz, discriminator++, target);
}
 
開發者ID:NPException,項目名稱:Dimensional-Pockets,代碼行數:8,代碼來源:NetworkDispatcher.java


注:本文中的cpw.mods.fml.common.network.simpleimpl.IMessageHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。