Java 类cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper 实例源码

项目:NyaSamaRailway    文件:GuiNGTablet.java   
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;
    }

}
项目:SecurityCraft    文件:ConfigurationHandler.java   
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);
}
项目:NyaSamaRailway    文件:NetworkRegister.java   
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);
}
项目:NyaSamaRailway    文件:NGTablet.java   
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);
}
项目:LambdaLib    文件:MessageHandlerRegistration.java   
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);
}
项目:CauldronGit    文件:SimpleNetTester.java   
@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);
}
项目:SecurityCraft    文件:RegistrationHandler.java   
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);
}
项目:Cauldron    文件:SimpleNetTester.java   
@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);
}
项目:DBLibOld    文件:IvNetworkHelperServer.java   
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);
}
项目:DBLibOld    文件:IvNetworkHelperServer.java   
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);
    }
}
项目:DBLibOld    文件:IvNetworkHelperServer.java   
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);
}
项目:DBLibOld    文件:IvNetworkHelperServer.java   
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);
}
项目:DBLibOld    文件:IvNetworkHelperClient.java   
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));
}
项目:NyaSamaRailway    文件:ParticlePacket.java   
public void send(SimpleNetworkWrapper wrapper, int dimension) {
    if (wrapper == null) return;
    wrapper.sendToDimension(this, dimension);
}
项目:NyaSamaRailway    文件:NGTablet.java   
public SimpleNetworkWrapper getNetworkWrapper() {
    return null;
}
项目:NyaSamaRailway    文件:NGTablet.java   
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();
    }
}
项目:NyaSamaRailway    文件:ItemNGT.java   
@Override
public SimpleNetworkWrapper getNetworkWrapper() {
    return NetworkWrapper.instance;
}
项目:NyaSamaRailway    文件:RailSnifferCore.java   
@Override
public SimpleNetworkWrapper getWrapper() {
    return NetworkWrapper.instance;
}
项目:NyaSamaRailway    文件:RailRFIDCore.java   
@Override
public SimpleNetworkWrapper getWrapper() {
    return NetworkWrapper.instance;
}
项目:PowerLines    文件:PowerLinesMod.java   
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    event.getModMetadata().version = "0.0.4";

    PowerLinesMod.config = new Configuration(event.getSuggestedConfigurationFile());

    PowerLinesMod.config.get("power-grid", "max-energy", 1000000, "The maximum amount of RF a power grid can store.");

    PowerLinesMod.config.get("large-power-line", "max-distance", 64, "The maximum distance between two large power lines in Euclidian space.");
    PowerLinesMod.config.get("large-power-line", "max-angle", 45, "The maximum angle between two large power lines, measured in degrees. The default is 45.");

    PowerLinesMod.config.get("medium-power-line", "max-distance", 32, "The maximum distance between two medium power lines in Euclidian space.");
    PowerLinesMod.config.get("medium-power-line", "max-angle", 35, "The maximum angle between two medium power lines, measured in degrees. The default is 35.");

    PowerLinesMod.config.get("small-power-line", "max-distance", 16, "The maximum distance between two small power lines in Euclidian space.");
    PowerLinesMod.config.get("small-power-line", "max-angle", 25, "The maximum angle between two small power lines, measured in degrees. The default is 25.");

    PowerLinesMod.config.get("substation", "max-distance", 8, "The maximum distance between a substation and a power line in Euclidian space.");
    PowerLinesMod.config.get("substation", "max-angle", 45, "The maximum angle between a substation and a power line, measured in degrees. The default is 45.");

    if (PowerLinesMod.config.hasChanged()) PowerLinesMod.config.save();

    PowerLinesMod.blocks = new Blocks();
    PowerLinesMod.items = new Items();

    PowerLinesMod.networking = new SimpleNetworkWrapper("powerlines");
    PowerLinesMod.networking.registerMessage(PowerGridSynchronizationMessage.class, PowerGridSynchronizationMessage.class, 0, Side.CLIENT);
    PowerLinesMod.networking.registerMessage(PowerGridEnergyStateMessage.class, PowerGridEnergyStateMessage.class, 1, Side.CLIENT);
    PowerLinesMod.networking.registerMessage(PowerGridCreatedMessage.class, PowerGridCreatedMessage.class, 2, Side.CLIENT);
    PowerLinesMod.networking.registerMessage(PowerGridDestroyedMessage.class, PowerGridDestroyedMessage.class, 3, Side.CLIENT);
    PowerLinesMod.networking.registerMessage(PowerGridNodeConnectedMessage.class, PowerGridNodeConnectedMessage.class, 4, Side.CLIENT);
    PowerLinesMod.networking.registerMessage(PowerGridNodeDisconnectedMessage.class, PowerGridNodeDisconnectedMessage.class, 5, Side.CLIENT);
    PowerLinesMod.networking.registerMessage(PowerGridNodeNeighbourshipMessage.class, PowerGridNodeNeighbourshipMessage.class, 6, Side.CLIENT);
    PowerLinesMod.networking.registerMessage(PowerGridConnectionStateMessage.class, PowerGridConnectionStateMessage.class, 7, Side.CLIENT);
    PowerLinesMod.networking.registerMessage(NodeWrenchedMessage.class, NodeWrenchedMessage.class, 8, Side.CLIENT);
    PowerLinesMod.networking.registerMessage(SetNodeUUIDMessage.class, SetNodeUUIDMessage.class, 9, Side.CLIENT);
    PowerLinesMod.networking.registerMessage(SetGridUUIDMessage.class, SetGridUUIDMessage.class, 10, Side.CLIENT);

    GameRegistry.registerBlock(PowerLinesMod.blocks.boundingBox, "BoundingBox");
    GameRegistry.registerTileEntity(TileEntityBoundingBox.class, "BoundingBox");
    GameRegistry.registerTileEntity(TileEntityFluxedBoundingBox.class, "FluxedBoundingBox");
    GameRegistry.registerTileEntity(TileEntityDumbFluxedBoundingBox.class, "DumbFluxedBoundingBox");

    GameRegistry.registerBlock(PowerLinesMod.blocks.largePowerLine, ItemBlockLargePowerLine.class, "LargePowerLine");
    GameRegistry.registerTileEntity(TileEntityLargePowerLine.class, "LargePowerLine");

    GameRegistry.registerBlock(PowerLinesMod.blocks.mediumPowerLine, ItemBlockMediumPowerLine.class, "MediumPowerLine");
    GameRegistry.registerTileEntity(TileEntityMediumPowerLine.class, "MediumPowerLine");

    GameRegistry.registerBlock(PowerLinesMod.blocks.subStation, ItemBlockSubStation.class, "SubStation");
    GameRegistry.registerTileEntity(TileEntitySubStation.class, "SubStation");

    GameRegistry.registerItem(PowerLinesMod.items.powerGridLinker, "GridLinker", "powerlines");
    GameRegistry.registerItem(PowerLinesMod.items.debuggingStick, "DebuggingStick", "powerlines");
    GameRegistry.registerItem(PowerLinesMod.items.craftingAlpha, "CrafitingAlpha", "powerlines");
    GameRegistry.registerItem(PowerLinesMod.items.craftingBravo, "CrafitingBravo", "powerlines");

    CraftingRecipesHandler.registerRecipes();
    FurnaceRecipesHandler.registerRecipes();

    FMLInterModComms.sendMessage("Waila", "register", "untouchedwagons.minecraft.powerlines.integration.waila.WailaDataProvider.callbackRegister");
}
项目:Electrometrics    文件:NetworkHandler.java   
public static SimpleNetworkWrapper getNetworkWrapper() {
    return networkWrapper;
}
项目:CrayCrafting    文件:CrayCrafting.java   
public static SimpleNetworkWrapper getSnw()
{
    return instance.snw;
}
项目:PlaceableTools    文件:PlaceableTools.java   
public static SimpleNetworkWrapper getSnw()
{
    return instance.snw;
}
项目:DBLibOld    文件:IvNetworkHelperServer.java   
public static <UTileEntity extends TileEntity & PartialUpdateHandler> void sendTileEntityUpdatePacket(UTileEntity tileEntity, String context, SimpleNetworkWrapper network, Object... params)
{
    sendToPlayersWatchingChunk(tileEntity.getWorldObj(), tileEntity.xCoord / 16, tileEntity.zCoord / 16, network, PacketTileEntityData.packetEntityData(tileEntity, context, params));
}
项目:DBLibOld    文件:IvNetworkHelperClient.java   
@Deprecated
public static <ETileEntity extends TileEntity & ClientEventHandler> void sendTileEntityUpdatePacket(ETileEntity tileEntity, String context, SimpleNetworkWrapper network, Object... params)
{
    sendTileEntityEventPacket(tileEntity, context, network, params);
}
项目:Pay2Spawn    文件:Pay2Spawn.java   
public static SimpleNetworkWrapper getSnw()
{
    return instance.snw;
}
项目:TRHS_Club_Mod_2016    文件:NetworkRegistry.java   
/**
 * Construct a new {@link SimpleNetworkWrapper} for the channel.
 *
 * @param name The name of the channel
 * @return A {@link SimpleNetworkWrapper} for handling this channel
 */
public SimpleNetworkWrapper newSimpleChannel(String name)
{
    return new SimpleNetworkWrapper(name);
}
项目:CauldronGit    文件:NetworkRegistry.java   
/**
 * Construct a new {@link SimpleNetworkWrapper} for the channel.
 *
 * @param name The name of the channel
 * @return A {@link SimpleNetworkWrapper} for handling this channel
 */
public SimpleNetworkWrapper newSimpleChannel(String name)
{
    return new SimpleNetworkWrapper(name);
}
项目:Cauldron    文件:NetworkRegistry.java   
/**
 * Construct a new {@link SimpleNetworkWrapper} for the channel.
 *
 * @param name The name of the channel
 * @return A {@link SimpleNetworkWrapper} for handling this channel
 */
public SimpleNetworkWrapper newSimpleChannel(String name)
{
    return new SimpleNetworkWrapper(name);
}
项目:Cauldron    文件:NetworkRegistry.java   
/**
 * Construct a new {@link SimpleNetworkWrapper} for the channel.
 *
 * @param name The name of the channel
 * @return A {@link SimpleNetworkWrapper} for handling this channel
 */
public SimpleNetworkWrapper newSimpleChannel(String name)
{
    return new SimpleNetworkWrapper(name);
}
项目:Cauldron    文件:NetworkRegistry.java   
/**
 * Construct a new {@link SimpleNetworkWrapper} for the channel.
 *
 * @param name The name of the channel
 * @return A {@link SimpleNetworkWrapper} for handling this channel
 */
public SimpleNetworkWrapper newSimpleChannel(String name)
{
    return new SimpleNetworkWrapper(name);
}
项目:NyaSamaRailway    文件:NSASM.java   
public abstract SimpleNetworkWrapper getWrapper();