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


Java SimpleNetworkWrapper類代碼示例

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


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

示例1: GuiNGTablet

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public GuiNGTablet(String modid, String texture, SimpleNetworkWrapper wrapper, ItemStack stack) {
    ngtGuiTextures = new ResourceLocation(modid.toLowerCase(),texture);
    this.wrapper = wrapper;
    this.ngtObj = stack;

    if (stack.hasTagCompound()) {
        NBTTagCompound var4 = stack.getTagCompound();
        this.ngtPages = var4.getTagList("pages", 8);
        if (this.ngtPages != null) {
            this.ngtPages = (NBTTagList)this.ngtPages.copy();
            this.ngtTotalPages = this.ngtPages.tagCount();
            if (this.ngtTotalPages < 1) {
                this.ngtTotalPages = 1;
            }
        }
    }

    if (this.ngtPages == null) {
        this.ngtPages = new NBTTagList();
        this.ngtPages.appendTag(new NBTTagString(""));
        this.ngtTotalPages = 1;
    }

}
 
開發者ID:NSDN,項目名稱:NyaSamaRailway,代碼行數:25,代碼來源:GuiNGTablet.java

示例2: setupPackets

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public void setupPackets(SimpleNetworkWrapper network) {
	network.registerMessage(PacketCheckKeypadCode.Handler.class, PacketCheckKeypadCode.class, 0, Side.SERVER);
	network.registerMessage(PacketCheckRetinalScanner.Handler.class, PacketCheckRetinalScanner.class, 1, Side.SERVER);
	network.registerMessage(PacketCreateExplosion.Handler.class, PacketCreateExplosion.class, 2, Side.SERVER);
	network.registerMessage(PacketSetBlock.Handler.class, PacketSetBlock.class, 3, Side.SERVER);
	network.registerMessage(PacketSetBlockMetadata.Handler.class, PacketSetBlockMetadata.class, 4, Side.SERVER);
	network.registerMessage(PacketSetISType.Handler.class, PacketSetISType.class, 5, Side.SERVER);
	network.registerMessage(PacketSetKeycardLevel.Handler.class, PacketSetKeycardLevel.class, 6, Side.SERVER);
	network.registerMessage(PacketSetKeypadCode.Handler.class, PacketSetKeypadCode.class, 7, Side.SERVER);
	network.registerMessage(PacketUpdateClient.Handler.class, PacketUpdateClient.class, 8, Side.SERVER);
	network.registerMessage(PacketUpdateLogger.Handler.class, PacketUpdateLogger.class, 9, Side.CLIENT);
	network.registerMessage(PacketCUpdateNBTTag.Handler.class, PacketCUpdateNBTTag.class, 10, Side.CLIENT);
	network.registerMessage(PacketSUpdateNBTTag.Handler.class, PacketSUpdateNBTTag.class, 11, Side.SERVER);
	network.registerMessage(PacketCUpdateCooldown.Handler.class, PacketCUpdateCooldown.class, 12, Side.CLIENT);
	network.registerMessage(PacketCPlaySoundAtPos.Handler.class, PacketCPlaySoundAtPos.class, 13, Side.CLIENT);
	network.registerMessage(PacketSDebugField.Handler.class, PacketSDebugField.class, 14, Side.SERVER);
	network.registerMessage(PacketCUpdateOwner.Handler.class, PacketCUpdateOwner.class, 15, Side.CLIENT);
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:19,代碼來源:ConfigurationHandler.java

示例3: register

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public static void register(Logger logger, SimpleNetworkWrapper wrapper, int discriminatorStart) {
    int discriminator = discriminatorStart;

    NGTPacket.logger = logger;
    wrapper.registerMessage(NGTPacketHandler.class, NGTPacket.class, discriminator, Side.SERVER);
    discriminator += 1;
    wrapper.registerMessage(ParticlePacketHandler.class, ParticlePacket.class, discriminator, Side.CLIENT);
}
 
開發者ID:NSDN,項目名稱:NyaSamaRailway,代碼行數:9,代碼來源:NetworkRegister.java

示例4: NGTablet

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public NGTablet(String modid, SimpleNetworkWrapper wrapper, String name, String icon) {
    super();
    this.modid = modid.toLowerCase();
    this.wrapper = wrapper;

    setUnlocalizedName(name);
    setMaxStackSize(1);
    setTextureName(this.modid + ":" + icon);
}
 
開發者ID:NSDN,項目名稱:NyaSamaRailway,代碼行數:10,代碼來源:NGTablet.java

示例5: register

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的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

示例6: test

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
@Test
public void test()
{
    SimpleNetworkWrapper simpleChannel = NetworkRegistry.INSTANCE.newSimpleChannel("TEST");
    simpleChannel.registerMessage(SimpleNetHandler1.class, SimpleNetTestMessage1.class, 1, Side.SERVER);
    simpleChannel.registerMessage(SimpleNetHandler2.class, SimpleNetTestMessage2.class, 2, Side.CLIENT);
    assertTrue("Hello", true);
}
 
開發者ID:alexandrage,項目名稱:CauldronGit,代碼行數:9,代碼來源:SimpleNetTester.java

示例7: registerPackets

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public static void registerPackets(SimpleNetworkWrapper network)
{
	network.registerMessage(PacketSetBlock.Handler.class, PacketSetBlock.class, 1, Side.SERVER);
	network.registerMessage(PacketSetBlockMetadata.Handler.class, PacketSetBlockMetadata.class, 2, Side.SERVER);
	network.registerMessage(PacketSetISType.Handler.class, PacketSetISType.class, 3, Side.SERVER);
	network.registerMessage(PacketSetKeycardLevel.Handler.class, PacketSetKeycardLevel.class, 4, Side.SERVER);
	network.registerMessage(PacketUpdateLogger.Handler.class, PacketUpdateLogger.class, 5, Side.CLIENT);
	network.registerMessage(PacketCUpdateNBTTag.Handler.class, PacketCUpdateNBTTag.class, 6, Side.CLIENT);
	network.registerMessage(PacketSUpdateNBTTag.Handler.class, PacketSUpdateNBTTag.class, 7, Side.SERVER);
	network.registerMessage(PacketCPlaySoundAtPos.Handler.class, PacketCPlaySoundAtPos.class, 8, Side.CLIENT);
	network.registerMessage(PacketSetExplosiveState.Handler.class, PacketSetExplosiveState.class, 9, Side.SERVER);
	network.registerMessage(PacketGivePotionEffect.Handler.class, PacketGivePotionEffect.class, 10, Side.SERVER);
	network.registerMessage(PacketSetBlockAndMetadata.Handler.class, PacketSetBlockAndMetadata.class, 11, Side.SERVER);
	network.registerMessage(PacketSSetOwner.Handler.class, PacketSSetOwner.class, 12, Side.SERVER);
	network.registerMessage(PacketSAddModules.Handler.class, PacketSAddModules.class, 13, Side.SERVER);
	network.registerMessage(PacketCSetCameraLocation.Handler.class, PacketCSetCameraLocation.class, 14, Side.CLIENT);
	network.registerMessage(PacketCRemoveLGView.Handler.class, PacketCRemoveLGView.class, 15, Side.CLIENT);
	network.registerMessage(PacketCCreateLGView.Handler.class, PacketCCreateLGView.class, 16, Side.CLIENT);
	network.registerMessage(PacketSSetPassword.Handler.class, PacketSSetPassword.class, 17, Side.SERVER);
	network.registerMessage(PacketSCheckPassword.Handler.class, PacketSCheckPassword.class, 18, Side.SERVER);
	network.registerMessage(PacketSSyncTENBTTag.Handler.class, PacketSSyncTENBTTag.class, 19, Side.SERVER);
	network.registerMessage(PacketSMountCamera.Handler.class, PacketSMountCamera.class, 20, Side.SERVER);
	network.registerMessage(PacketSSetCameraRotation.Handler.class, PacketSSetCameraRotation.class, 21, Side.SERVER);
	network.registerMessage(PacketCSetPlayerPositionAndRotation.Handler.class, PacketCSetPlayerPositionAndRotation.class, 22, Side.CLIENT);
	network.registerMessage(PacketCSpawnLightning.Handler.class, PacketCSpawnLightning.class, 23, Side.CLIENT);
	network.registerMessage(PacketSOpenGui.Handler.class, PacketSOpenGui.class, 24, Side.SERVER);
	network.registerMessage(PacketSToggleOption.Handler.class, PacketSToggleOption.class, 25, Side.SERVER);
	network.registerMessage(PacketSUpdateSliderValue.Handler.class, PacketSUpdateSliderValue.class, 26, Side.SERVER);
	network.registerMessage(PacketSRemoveCameraTag.Handler.class, PacketSRemoveCameraTag.class, 27, Side.SERVER);
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:31,代碼來源:RegistrationHandler.java

示例8: sendTileEntityUpdatePacket

import cpw.mods.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);
}
 
開發者ID:Dennisbonke,項目名稱:DBLibOld,代碼行數:8,代碼來源:IvNetworkHelperServer.java

示例9: sendToPlayersWatchingChunk

import cpw.mods.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);
    }
}
 
開發者ID:Dennisbonke,項目名稱:DBLibOld,代碼行數:10,代碼來源:IvNetworkHelperServer.java

示例10: sendEEPUpdatePacketToPlayer

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public static void sendEEPUpdatePacketToPlayer(Entity entity, String eepKey, String context, SimpleNetworkWrapper network, EntityPlayer player, Object... params)
{
    if (!(player instanceof EntityPlayerMP))
        throw new UnsupportedOperationException();

    network.sendTo(PacketExtendedEntityPropertiesData.packetEntityData(entity, eepKey, context, params), (EntityPlayerMP) player);
}
 
開發者ID:Dennisbonke,項目名稱:DBLibOld,代碼行數:8,代碼來源:IvNetworkHelperServer.java

示例11: sendEEPUpdatePacket

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public static void sendEEPUpdatePacket(Entity entity, String eepKey, String context, SimpleNetworkWrapper network, Object... params)
{
    if (entity.worldObj.isRemote)
        throw new UnsupportedOperationException();

    for (EntityPlayer player : ((WorldServer) entity.worldObj).getEntityTracker().getTrackingPlayers(entity))
        sendEEPUpdatePacketToPlayer(entity, eepKey, context, network, player, params);

    if (entity instanceof EntityPlayer) // Players don't 'track' themselves
        sendEEPUpdatePacketToPlayer(entity, eepKey, context, network, (EntityPlayer) entity, params);
}
 
開發者ID:Dennisbonke,項目名稱:DBLibOld,代碼行數:12,代碼來源:IvNetworkHelperServer.java

示例12: sendTileEntityEventPacket

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public static <ETileEntity extends TileEntity & ClientEventHandler> void sendTileEntityEventPacket(ETileEntity tileEntity, String context, SimpleNetworkWrapper network, Object... params)
{
    if (!(tileEntity.getWorldObj().isRemote))
        throw new UnsupportedOperationException();

    network.sendToServer(PacketTileEntityClientEvent.packetEntityData(tileEntity, context, params));
}
 
開發者ID:Dennisbonke,項目名稱:DBLibOld,代碼行數:8,代碼來源:IvNetworkHelperClient.java

示例13: send

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public void send(SimpleNetworkWrapper wrapper, int dimension) {
    if (wrapper == null) return;
    wrapper.sendToDimension(this, dimension);
}
 
開發者ID:NSDN,項目名稱:NyaSamaRailway,代碼行數:5,代碼來源:ParticlePacket.java

示例14: getNetworkWrapper

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public SimpleNetworkWrapper getNetworkWrapper() {
    return null;
}
 
開發者ID:NSDN,項目名稱:NyaSamaRailway,代碼行數:4,代碼來源:NGTablet.java

示例15: runNGT

import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; //導入依賴的package包/類
public void runNGT(ItemStack itemStack, World world, EntityPlayer player) {
    if (player.isSneaking()) {
        NBTTagList list = Util.getTagListFromNGT(itemStack);
        if (list == null) return;
        String[][] code = NSASM.getCode(list);
        new NSASM(code) {
            @Override
            public SimpleNetworkWrapper getWrapper() {
                return getNetworkWrapper();
            }

            @Override
            public World getWorld() {
                return world;
            }

            @Override
            public double getX() {
                return player.posX;
            }

            @Override
            public double getY() {
                return player.posY + 1.5;
            }

            @Override
            public double getZ() {
                return player.posZ;
            }

            @Override
            public EntityPlayer getPlayer() {
                return player;
            }

            @Override
            public void loadFunc(LinkedHashMap<String, Operator> funcList) {
                funcList.put("rnd", ((dst, src) -> {
                    if (src != null) return Result.ERR;
                    if (dst == null) return Result.ERR;
                    if (dst.readOnly) return Result.ERR;

                    dst.type = RegType.INT;
                    dst.data = Math.round(Math.random() * 255);
                    return Result.OK;
                }));
            }
        }.run();
    }
}
 
開發者ID:NSDN,項目名稱:NyaSamaRailway,代碼行數:52,代碼來源:NGTablet.java


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