Search in sources :

Example 6 with SimpleNetworkWrapper

use of net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper in project RebornCore by TechReborn.

the class NetworkManager method createOrGetNetworkWrapper.

public static SimpleNetworkWrapper createOrGetNetworkWrapper(Class<? extends INetworkPacket> packetClass) {
    String wrapperName = getWrapperName(packetClass);
    if (packageWrapperMap.containsKey(wrapperName)) {
        return packageWrapperMap.get(wrapperName);
    } else {
        SimpleNetworkWrapper newNetworkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(wrapperName);
        RebornCore.logHelper.info("Created new network wrapper " + wrapperName);
        packageWrapperMap.put(wrapperName, newNetworkWrapper);
        return newNetworkWrapper;
    }
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper)

Example 7 with SimpleNetworkWrapper

use of net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper in project RFToolsDimensions by McJty.

the class CommonProxy method preInit.

public void preInit(FMLPreInitializationEvent e) {
    GeneralConfig.preInit(e);
    modConfigDir = e.getModConfigurationDirectory();
    mainConfig = new Configuration(new File(modConfigDir.getPath() + File.separator + "rftools", "dimensions.cfg"));
    readMainConfig();
    SimpleNetworkWrapper network = PacketHandler.registerMessages(RFToolsDim.MODID, "rftoolsdim");
    RFToolsDimMessages.registerNetworkMessages(network);
    ModItems.init();
    ModBlocks.init();
    ModDimensions.init();
    KnownDimletConfiguration.setupChestLoot();
    DimletRules.readRules(modConfigDir);
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) KnownDimletConfiguration(mcjty.rftoolsdim.dimensions.dimlets.KnownDimletConfiguration) Configuration(net.minecraftforge.common.config.Configuration) File(java.io.File)

Example 8 with SimpleNetworkWrapper

use of net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper in project RebornCore by TechReborn.

the class NetworkManager method registerPacket.

public static PacketDetails registerPacket(Class<? extends INetworkPacket> packetClass, Side side) {
    SimpleNetworkWrapper wrapper = createOrGetNetworkWrapper(packetClass);
    int id = getNextIDForWrapper(wrapper);
    wrapper.registerMessage(PacketWrapper.PacketWrapperHandler.class, PacketWrapper.class, id, side);
    packetWrapperMap.put(packetClass, wrapper);
    RebornCore.logHelper.info("Registed packet to " + getWrapperName(packetClass) + " side: " + side + " id:" + id);
    PacketDetails packetDetails = new PacketDetails(packetClass, id, wrapper);
    packetList.add(packetDetails);
    return packetDetails;
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper)

Example 9 with SimpleNetworkWrapper

use of net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper in project Logistical-Automation by Zundrel.

the class LogisticalAutomation method init.

@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    TileRegistry.init();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
    networkWrapper = new SimpleNetworkWrapper(ModInfo.MOD_ID);
    networkWrapper.registerMessage(MessageButton.class, MessageButton.class, 0, Side.SERVER);
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) GuiHandler(com.zundrel.logisticalautomation.common.handler.GuiHandler)

Example 10 with SimpleNetworkWrapper

use of net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper in project RFToolsControl by McJty.

the class CommonProxy method preInit.

public void preInit(FMLPreInitializationEvent e) {
    MinecraftForge.EVENT_BUS.register(new ForgeEventHandlers());
    McJtyLib.preInit(e);
    CommandHandler.registerCommands();
    GeneralConfig.preInit(e);
    modConfigDir = e.getModConfigurationDirectory();
    mainConfig = new Configuration(new File(modConfigDir.getPath() + File.separator + "rftools", "control.cfg"));
    readMainConfig();
    SimpleNetworkWrapper network = PacketHandler.registerMessages(RFToolsControl.MODID, "rftoolsctrl");
    RFToolsCtrlMessages.registerNetworkMessages(network);
    Opcodes.init();
    Functions.init();
    ModBlocks.init();
    ModItems.init();
// if (RFToolsControl.mcmpPresent) {
// MCMPSetup.init();
// }
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) GeneralConfiguration(mcjty.rftoolscontrol.config.GeneralConfiguration) Configuration(net.minecraftforge.common.config.Configuration) ForgeEventHandlers(mcjty.rftoolscontrol.ForgeEventHandlers) File(java.io.File)

Aggregations

SimpleNetworkWrapper (net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper)10 File (java.io.File)4 Configuration (net.minecraftforge.common.config.Configuration)4 GuiHandler (com.zundrel.logisticalautomation.common.handler.GuiHandler)1 Rectangle (java.awt.Rectangle)1 ModBase (mcjty.lib.base.ModBase)1 StyleConfig (mcjty.lib.base.StyleConfig)1 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)1 Window (mcjty.lib.gui.Window)1 DefaultSelectionEvent (mcjty.lib.gui.events.DefaultSelectionEvent)1 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)1 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)1 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)1 Arguments (mcjty.lib.network.Arguments)1 BlockTools (mcjty.lib.varia.BlockTools)1 CommandHandler (mcjty.rftools.CommandHandler)1 ForgeEventHandlers (mcjty.rftools.ForgeEventHandlers)1 GeneralConfiguration (mcjty.rftools.GeneralConfiguration)1 RFTools (mcjty.rftools.RFTools)1 IModuleProvider (mcjty.rftools.api.screens.IModuleProvider)1