本文整理汇总了Java中net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper类的典型用法代码示例。如果您正苦于以下问题:Java SimpleNetworkWrapper类的具体用法?Java SimpleNetworkWrapper怎么用?Java SimpleNetworkWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleNetworkWrapper类属于net.minecraftforge.fml.common.network.simpleimpl包,在下文中一共展示了SimpleNetworkWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preInit
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public void preInit(FMLPreInitializationEvent e) {
MinecraftForge.EVENT_BUS.register(new ForgeEventHandlers());
McJtyLib.preInit(e);
CommandHandler.registerCommands();
GeneralConfig.preInit(e);
File directory = e.getModConfigurationDirectory();
mainConfig = new Configuration(new File(directory.getPath(), "needtobreathe.cfg"));
Config.readConfig(mainConfig);
// PacketHandler.registerMessages("meecreeps");
SimpleNetworkWrapper network = PacketHandler.registerMessages(NeedToBreathe.MODID, "needtobreathe");
NTBMessages.registerNetworkMessages(network);
// Initialization of blocks and items typically goes here:
// ModEntities.init();
ModItems.init();
ModBlocks.init();
}
示例2: preInit
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public void preInit(FMLPreInitializationEvent e) {
MinecraftForge.EVENT_BUS.register(new ForgeEventHandlers());
McJtyLib.preInit(e);
CommandHandler.registerCommands();
MeeCreeps.api.registerFactories();
File directory = e.getModConfigurationDirectory();
config = new Configuration(new File(directory.getPath(), "meecreeps.cfg"));
Config.readConfig();
SimpleNetworkWrapper network = mcjty.lib.network.PacketHandler.registerMessages(MeeCreeps.MODID, "meecreeps");
MeeCreepsMessages.registerMessages(network);
// Initialization of blocks and items typically goes here:
ModEntities.init();
}
示例3: registerPacket
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public static <REQ extends IMessage, REPLY extends IMessage> void registerPacket(SimpleNetworkWrapper network, Class<REQ> requestMessageType, Class<? extends IMessageHandler<REQ, REPLY>> messageHandler, Side side) {
String packetPackageName = requestMessageType.getPackage().getName();
Iterator<String> iterator = packetByteDiscriminators.keySet().iterator();
byte discriminator = -1;
while(iterator.hasNext()) {
String pack = iterator.next();
if(pack.contains(packetPackageName)) {
packetByteDiscriminators.get(packetPackageName);
}
}
if(discriminator == -1) {
packetByteDiscriminators.put(packetPackageName, (byte) 0);
}
network.registerMessage(messageHandler, requestMessageType, packetByteDiscriminators.get(packetPackageName), side);
}
示例4: registerPackets
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public static void registerPackets(SimpleNetworkWrapper network)
{
network.registerMessage(PacketSetBlock.Handler.class, PacketSetBlock.class, 1, Side.SERVER);
network.registerMessage(PacketSetISType.Handler.class, PacketSetISType.class, 2, Side.SERVER);
network.registerMessage(PacketSetKeycardLevel.Handler.class, PacketSetKeycardLevel.class, 3, Side.SERVER);
network.registerMessage(PacketUpdateLogger.Handler.class, PacketUpdateLogger.class, 4, Side.CLIENT);
network.registerMessage(PacketCUpdateNBTTag.Handler.class, PacketCUpdateNBTTag.class, 5, Side.CLIENT);
network.registerMessage(PacketSUpdateNBTTag.Handler.class, PacketSUpdateNBTTag.class, 6, Side.SERVER);
network.registerMessage(PacketCPlaySoundAtPos.Handler.class, PacketCPlaySoundAtPos.class, 7, Side.CLIENT);
network.registerMessage(PacketSetExplosiveState.Handler.class, PacketSetExplosiveState.class, 8, Side.SERVER);
network.registerMessage(PacketGivePotionEffect.Handler.class, PacketGivePotionEffect.class, 9, Side.SERVER);
network.registerMessage(PacketSSetOwner.Handler.class, PacketSSetOwner.class, 10, Side.SERVER);
network.registerMessage(PacketSAddModules.Handler.class, PacketSAddModules.class, 11, Side.SERVER);
network.registerMessage(PacketSSetPassword.Handler.class, PacketSSetPassword.class, 12, Side.SERVER);
network.registerMessage(PacketSCheckPassword.Handler.class, PacketSCheckPassword.class, 13, Side.SERVER);
network.registerMessage(PacketSSyncTENBTTag.Handler.class, PacketSSyncTENBTTag.class, 14, Side.SERVER);
network.registerMessage(PacketSMountCamera.Handler.class, PacketSMountCamera.class, 15, Side.SERVER);
network.registerMessage(PacketSSetCameraRotation.Handler.class, PacketSSetCameraRotation.class, 16, Side.SERVER);
network.registerMessage(PacketCSetPlayerPositionAndRotation.Handler.class, PacketCSetPlayerPositionAndRotation.class, 17, Side.CLIENT);
network.registerMessage(PacketSOpenGui.Handler.class, PacketSOpenGui.class, 18, Side.SERVER);
network.registerMessage(PacketSToggleOption.Handler.class, PacketSToggleOption.class, 19, Side.SERVER);
network.registerMessage(PacketCRequestTEOwnableUpdate.Handler.class, PacketCRequestTEOwnableUpdate.class, 20, Side.SERVER);
network.registerMessage(PacketSUpdateTEOwnable.Handler.class, PacketSUpdateTEOwnable.class, 21, Side.CLIENT);
network.registerMessage(PacketSUpdateSliderValue.Handler.class, PacketSUpdateSliderValue.class, 22, Side.SERVER);
network.registerMessage(PacketSRemoveCameraTag.Handler.class, PacketSRemoveCameraTag.class, 23, Side.SERVER);
}
示例5: registerPackets
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public static void registerPackets(SimpleNetworkWrapper network)
{
network.registerMessage(PacketSetBlock.Handler.class, PacketSetBlock.class, 1, Side.SERVER);
network.registerMessage(PacketSetISType.Handler.class, PacketSetISType.class, 2, Side.SERVER);
network.registerMessage(PacketSetKeycardLevel.Handler.class, PacketSetKeycardLevel.class, 3, Side.SERVER);
network.registerMessage(PacketUpdateLogger.Handler.class, PacketUpdateLogger.class, 4, Side.CLIENT);
network.registerMessage(PacketCUpdateNBTTag.Handler.class, PacketCUpdateNBTTag.class, 5, Side.CLIENT);
network.registerMessage(PacketSUpdateNBTTag.Handler.class, PacketSUpdateNBTTag.class, 6, Side.SERVER);
network.registerMessage(PacketCPlaySoundAtPos.Handler.class, PacketCPlaySoundAtPos.class, 7, Side.CLIENT);
network.registerMessage(PacketSetExplosiveState.Handler.class, PacketSetExplosiveState.class, 8, Side.SERVER);
network.registerMessage(PacketGivePotionEffect.Handler.class, PacketGivePotionEffect.class, 9, Side.SERVER);
network.registerMessage(PacketSSetOwner.Handler.class, PacketSSetOwner.class, 10, Side.SERVER);
network.registerMessage(PacketSAddModules.Handler.class, PacketSAddModules.class, 11, Side.SERVER);
network.registerMessage(PacketSSetPassword.Handler.class, PacketSSetPassword.class, 12, Side.SERVER);
network.registerMessage(PacketSCheckPassword.Handler.class, PacketSCheckPassword.class, 13, Side.SERVER);
network.registerMessage(PacketSSyncTENBTTag.Handler.class, PacketSSyncTENBTTag.class, 14, Side.SERVER);
network.registerMessage(PacketSMountCamera.Handler.class, PacketSMountCamera.class, 15, Side.SERVER);
network.registerMessage(PacketSSetCameraRotation.Handler.class, PacketSSetCameraRotation.class, 16, Side.SERVER);
network.registerMessage(PacketCSetPlayerPositionAndRotation.Handler.class, PacketCSetPlayerPositionAndRotation.class, 17, Side.CLIENT);
network.registerMessage(PacketSOpenGui.Handler.class, PacketSOpenGui.class, 18, Side.SERVER);
network.registerMessage(PacketSToggleOption.Handler.class, PacketSToggleOption.class, 19, Side.SERVER);
network.registerMessage(PacketSUpdateSliderValue.Handler.class, PacketSUpdateSliderValue.class, 20, Side.SERVER);
network.registerMessage(PacketSRemoveCameraTag.Handler.class, PacketSRemoveCameraTag.class, 21, Side.SERVER);
}
示例6: onPlayerLogin
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
if(event.player instanceof EntityPlayerMP)
{
ServerConfigMessage msg = new ServerConfigMessage();
msg.recipeVillagerSlabsIsRecovery = CommonProxy.recipeVillagerSlabsIsRecovery;
SimpleNetworkWrapper netwrapper = CubicVillager.getProxy().simpleNetWrapper;
netwrapper.sendTo(msg, (EntityPlayerMP)event.player);
StringBuilder spawnedMessage = new StringBuilder(64);
spawnedMessage.append("プレイヤー ")
.append(((EntityPlayerMP)event.player).getName())
.append(" がワールドに参加しました。設定を送信しました。");
CubicVillager.LOG.info(spawnedMessage);
}
}
示例7: registerNetworkMessages
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public static void registerNetworkMessages(SimpleNetworkWrapper net) {
INSTANCE = net;
// Server side
// Client side
net.registerMessage(PacketSendCleanAirToClient.Handler.class, PacketSendCleanAirToClient.class, PacketHandler.nextID(), Side.CLIENT);
net.registerMessage(PacketIntegersFromServer.Handler.class, PacketIntegersFromServer.class, PacketHandler.nextID(), Side.CLIENT);
net.registerMessage(PacketPoisonFromServer.Handler.class, PacketPoisonFromServer.class, PacketHandler.nextID(), Side.CLIENT);
}
示例8: onPreInit
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
@Mod.EventHandler
public void onPreInit(FMLPreInitializationEvent event) {
Possessed.proxy.onPreInit();
Possessed.networkWrapper = new SimpleNetworkWrapper(Possessed.MODID);
Possessed.networkWrapper.registerMessage(PossessMessage.Handler.class, PossessMessage.class, 0, Side.CLIENT);
Possessed.networkWrapper.registerMessage(UpdatePossessedDataMessage.Handler.class, UpdatePossessedDataMessage.class, 1, Side.CLIENT);
Possessed.networkWrapper.registerMessage(PossessClickEmptyMessage.Handler.class, PossessClickEmptyMessage.class, 2, Side.SERVER);
Possessed.networkWrapper.registerMessage(PossessHurtMessage.Handler.class, PossessHurtMessage.class, 3, Side.CLIENT);
Possessed.networkWrapper.registerMessage(SyncDataMessage.Handler.class, SyncDataMessage.class, 4, Side.CLIENT);
Possessed.networkWrapper.registerMessage(StopPossessingMessage.Handler.class, StopPossessingMessage.class, 5, Side.SERVER);
}
示例9: setupNetwork
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
private final void setupNetwork(FMLPreInitializationEvent event)
{
SimpleNetworkWrapper modChannel = NetworkRegistry.INSTANCE.newSimpleChannel(ARKCraft.MODID);
ARKCraft.modChannel = modChannel;
int id = 0;
// The handler (usually in the packet class), the packet class, unique
// identifier, side to be handled
modChannel.registerMessage(OpenPlayerCrafting.Handler.class, OpenPlayerCrafting.class, id++, Side.SERVER);
modChannel.registerMessage(PlayerPoop.Handler.class, PlayerPoop.class, id++, Side.SERVER);
modChannel.registerMessage(OpenAttachmentInventory.Handler.class, OpenAttachmentInventory.class, id++,
Side.SERVER);
modChannel.registerMessage(ReloadStarted.Handler.class, ReloadStarted.class, id++, Side.SERVER);
modChannel.registerMessage(ReloadFinished.Handler.class, ReloadFinished.class, id++, Side.CLIENT);
modChannel.registerMessage(MessageHover.class, MessageHover.class, id++, Side.CLIENT);
modChannel.registerMessage(MessageHoverReq.class, MessageHoverReq.class, id++, Side.SERVER);
modChannel.registerMessage(BurnerToggle.Handler.class, BurnerToggle.class, id++, Side.SERVER);
modChannel.registerMessage(UpdateEngrams.Handler.class, UpdateEngrams.class, id++, Side.CLIENT);
modChannel.registerMessage(ARKPlayerUpdateRequest.Handler.class, ARKPlayerUpdateRequest.class, id++,
Side.SERVER);
modChannel.registerMessage(ARKPlayerUpdate.Handler.class, ARKPlayerUpdate.class, id++, Side.CLIENT);
modChannel.registerMessage(PlayerEngramCrafterUpdate.Handler.class, PlayerEngramCrafterUpdate.class, id++,
Side.CLIENT);
modChannel.registerMessage(ScrollGui.Handler.class, ScrollGui.class, id++, Side.SERVER);
modChannel.registerMessage(ARKModeToggle.Handler.class, ARKModeToggle.class, id++, Side.SERVER);
modChannel.registerMessage(GunFired.Handler.class, GunFired.class, id++, Side.SERVER);
}
示例10: registerNetwork
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public static SimpleNetworkWrapper registerNetwork() {
id = 0;
net = NetworkRegistry.INSTANCE.newSimpleChannel("ezChannel");
net.registerMessage(MessageCustomClick.Handler.class, MessageCustomClick.class, id++, Side.SERVER);
net.registerMessage(MessageRecipeSync.Handler.class, MessageRecipeSync.class, id++, Side.SERVER);
net.registerMessage(MessageCraftingSync.Handler.class, MessageCraftingSync.class, id++, Side.CLIENT);
net.registerMessage(MessageFilterUpdate.Handler.class, MessageFilterUpdate.class, id++, Side.CLIENT);
net.registerMessage(MessageSecureSync.Handler.class, MessageSecureSync.class, id++, Side.CLIENT);
net.registerMessage(MessageSecurePlayer.Handler.class, MessageSecurePlayer.class, id++, Side.SERVER);
return net;
}
示例11: sendTileEntityUpdatePacket
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public static <UTileEntity extends TileEntity & PartialUpdateHandler> void sendTileEntityUpdatePacket(UTileEntity tileEntity, String context, SimpleNetworkWrapper network, EntityPlayer player, Object... params)
{
if (!(player instanceof EntityPlayerMP))
throw new UnsupportedOperationException();
network.sendTo(PacketTileEntityData.packetEntityData(tileEntity, context, params), (EntityPlayerMP) player);
}
示例12: sendToPlayersWatchingChunk
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public static void sendToPlayersWatchingChunk(World world, int chunkX, int chunkZ, SimpleNetworkWrapper network, IMessage message)
{
List<EntityPlayerMP> playersWatching = getPlayersWatchingChunk(world, chunkX, chunkZ);
for (EntityPlayerMP playerMP : playersWatching)
{
network.sendTo(message, playerMP);
}
}
示例13: sendEEPUpdatePacketToPlayer
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public static void sendEEPUpdatePacketToPlayer(Entity entity, String capabilityKey, EnumFacing facing, String context, SimpleNetworkWrapper network, EntityPlayer player, Object... params)
{
if (!(player instanceof EntityPlayerMP))
throw new UnsupportedOperationException();
network.sendTo(PacketEntityCapabilityData.packetEntityData(entity, capabilityKey, facing, context, params), (EntityPlayerMP) player);
}
示例14: sendEEPUpdatePacket
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public static void sendEEPUpdatePacket(Entity entity, String capabilityKey, EnumFacing facing, String context, SimpleNetworkWrapper network, Object... params)
{
if (entity.world.isRemote)
throw new UnsupportedOperationException();
for (EntityPlayer player : ((WorldServer) entity.world).getEntityTracker().getTrackingPlayers(entity))
sendEEPUpdatePacketToPlayer(entity, capabilityKey, facing, context, network, player, params);
if (entity instanceof EntityPlayerMP) // Players don't 'track' themselves
sendEEPUpdatePacketToPlayer(entity, capabilityKey, facing, context, network, (EntityPlayer) entity, params);
}
示例15: sendTileEntityEventPacket
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; //导入依赖的package包/类
public static <ETileEntity extends TileEntity & ClientEventHandler> void sendTileEntityEventPacket(ETileEntity tileEntity, String context, SimpleNetworkWrapper network, Object... params)
{
if (!(tileEntity.getWorld().isRemote))
throw new UnsupportedOperationException();
network.sendToServer(PacketTileEntityClientEvent.packetEntityData(tileEntity, context, params));
}