Search in sources :

Example 1 with SimpleNetworkWrapper

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

the class SimpleNetTester method test.

@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);
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) Test(org.junit.Test)

Example 2 with SimpleNetworkWrapper

use of net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper in project Overloaded by CJ-MC-Mods.

the class CommonProxy method init.

public void init(FMLInitializationEvent event) {
    ModBlocks.addRecipes();
    ModItems.registerRecipes();
    networkWrapper = new SimpleNetworkWrapper("overloaded");
    networkWrapper.registerMessage(MultiToolLeftClickHandler.class, MultiToolLeftClickMessage.class, 0, Side.SERVER);
    networkWrapper.registerMessage(MultiToolRightClickHandler.class, MultiToolRightClickMessage.class, 1, Side.SERVER);
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper)

Example 3 with SimpleNetworkWrapper

use of net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper in project XNet 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 + "xnet", "xnet.cfg"));
    readMainConfig();
    SimpleNetworkWrapper network = PacketHandler.registerMessages(XNet.MODID, "xnet");
    XNetMessages.registerNetworkMessages(network);
    ModItems.init();
    ModBlocks.init();
    XNet.xNetApi.registerChannelType(new ItemChannelType());
    XNet.xNetApi.registerChannelType(new EnergyChannelType());
    XNet.xNetApi.registerChannelType(new FluidChannelType());
    XNet.xNetApi.registerChannelType(new LogicChannelType());
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) FluidChannelType(mcjty.xnet.apiimpl.fluids.FluidChannelType) LogicChannelType(mcjty.xnet.apiimpl.logic.LogicChannelType) GeneralConfiguration(mcjty.xnet.config.GeneralConfiguration) Configuration(net.minecraftforge.common.config.Configuration) ForgeEventHandlers(mcjty.xnet.ForgeEventHandlers) ItemChannelType(mcjty.xnet.apiimpl.items.ItemChannelType) File(java.io.File) EnergyChannelType(mcjty.xnet.apiimpl.energy.EnergyChannelType)

Example 4 with SimpleNetworkWrapper

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

the class CommonProxy method preInit.

public void preInit(FMLPreInitializationEvent e) {
    MinecraftForge.EVENT_BUS.register(new ForgeEventHandlers());
    McJtyLib.preInit(e);
    CommandHandler.registerCommands();
    reflect();
    GeneralConfig.preInit(e);
    modConfigDir = e.getModConfigurationDirectory();
    mainConfig = new Configuration(new File(modConfigDir.getPath() + File.separator + "rftools", "rftools.cfg"));
    CapabilityManager.INSTANCE.register(BuffProperties.class, new Capability.IStorage<BuffProperties>() {

        @Override
        public NBTBase writeNBT(Capability<BuffProperties> capability, BuffProperties instance, EnumFacing side) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void readNBT(Capability<BuffProperties> capability, BuffProperties instance, EnumFacing side, NBTBase nbt) {
            throw new UnsupportedOperationException();
        }
    }, () -> {
        throw new UnsupportedOperationException();
    });
    CapabilityManager.INSTANCE.register(FavoriteDestinationsProperties.class, new Capability.IStorage<FavoriteDestinationsProperties>() {

        @Override
        public NBTBase writeNBT(Capability<FavoriteDestinationsProperties> capability, FavoriteDestinationsProperties instance, EnumFacing side) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void readNBT(Capability<FavoriteDestinationsProperties> capability, FavoriteDestinationsProperties instance, EnumFacing side, NBTBase nbt) {
            throw new UnsupportedOperationException();
        }
    }, () -> {
        throw new UnsupportedOperationException();
    });
    CapabilityManager.INSTANCE.register(IModuleProvider.class, new Capability.IStorage<IModuleProvider>() {

        @Override
        public NBTBase writeNBT(Capability<IModuleProvider> capability, IModuleProvider instance, EnumFacing side) {
            throw new UnsupportedOperationException();
        }

        @Override
        public void readNBT(Capability<IModuleProvider> capability, IModuleProvider instance, EnumFacing side, NBTBase nbt) {
            throw new UnsupportedOperationException();
        }
    }, () -> {
        throw new UnsupportedOperationException();
    });
    readMainConfig();
    SimpleNetworkWrapper network = PacketHandler.registerMessages(RFTools.MODID, "rftools");
    RFToolsMessages.registerNetworkMessages(network);
    ModItems.init();
    ModBlocks.init();
    ModWorldgen.init();
    RFTools.screenModuleRegistry.registerBuiltins();
    ForgeChunkManager.setForcedChunkLoadingCallback(RFTools.instance, (tickets, world) -> {
    });
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) BoosterConfiguration(mcjty.rftools.blocks.booster.BoosterConfiguration) BlockProtectorConfiguration(mcjty.rftools.blocks.blockprotector.BlockProtectorConfiguration) GeneralConfiguration(mcjty.rftools.GeneralConfiguration) SpawnerConfiguration(mcjty.rftools.blocks.spawner.SpawnerConfiguration) ModularStorageConfiguration(mcjty.rftools.blocks.storage.ModularStorageConfiguration) StorageScannerConfiguration(mcjty.rftools.blocks.storagemonitor.StorageScannerConfiguration) Configuration(net.minecraftforge.common.config.Configuration) ShieldConfiguration(mcjty.rftools.blocks.shield.ShieldConfiguration) CoalGeneratorConfiguration(mcjty.rftools.blocks.generator.CoalGeneratorConfiguration) SecurityConfiguration(mcjty.rftools.blocks.security.SecurityConfiguration) NetworkMonitorConfiguration(mcjty.rftools.items.netmonitor.NetworkMonitorConfiguration) TeleportConfiguration(mcjty.rftools.blocks.teleporter.TeleportConfiguration) MachineInfuserConfiguration(mcjty.rftools.blocks.infuser.MachineInfuserConfiguration) CrafterConfiguration(mcjty.rftools.blocks.crafter.CrafterConfiguration) EnvironmentalConfiguration(mcjty.rftools.blocks.environmental.EnvironmentalConfiguration) ElevatorConfiguration(mcjty.rftools.blocks.elevator.ElevatorConfiguration) ScannerConfiguration(mcjty.rftools.blocks.shaper.ScannerConfiguration) EndergenicConfiguration(mcjty.rftools.blocks.endergen.EndergenicConfiguration) ScreenConfiguration(mcjty.rftools.blocks.screens.ScreenConfiguration) PowerCellConfiguration(mcjty.rftools.blocks.powercell.PowerCellConfiguration) BuilderConfiguration(mcjty.rftools.blocks.builder.BuilderConfiguration) Capability(net.minecraftforge.common.capabilities.Capability) EnumFacing(net.minecraft.util.EnumFacing) FavoriteDestinationsProperties(mcjty.rftools.playerprops.FavoriteDestinationsProperties) BuffProperties(mcjty.rftools.playerprops.BuffProperties) NBTBase(net.minecraft.nbt.NBTBase) ForgeEventHandlers(mcjty.rftools.ForgeEventHandlers) IModuleProvider(mcjty.rftools.api.screens.IModuleProvider) File(java.io.File)

Example 5 with SimpleNetworkWrapper

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

the class GuiCraftingGrid method initGui.

public void initGui(final ModBase modBase, final SimpleNetworkWrapper network, final Minecraft mc, GenericGuiContainer<?> gui, BlockPos pos, CraftingGridProvider provider, int guiLeft, int guiTop, int xSize, int ySize) {
    this.mc = mc;
    this.gui = gui;
    SimpleNetworkWrapper network1 = network;
    this.provider = provider;
    this.pos = pos;
    recipeList = new WidgetList(mc, gui).setLayoutHint(new PositionalLayout.PositionalHint(5, 5, 56, 102));
    recipeList.addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
        }

        @Override
        public void doubleClick(Widget parent, int index) {
            selectRecipe();
        }
    });
    craft1Button = new Button(mc, gui).setText("1").setLayoutHint(new PositionalLayout.PositionalHint(29, 183, 14, 10)).setTooltips("Craft one").addButtonEvent(parent -> craft(1));
    craft4Button = new Button(mc, gui).setText("4").setLayoutHint(new PositionalLayout.PositionalHint(45, 183, 14, 10)).setTooltips("Craft four").addButtonEvent(parent -> craft(4));
    craft8Button = new Button(mc, gui).setText("8").setLayoutHint(new PositionalLayout.PositionalHint(29, 195, 14, 10)).setTooltips("Craft eight").addButtonEvent(parent -> craft(8));
    craftSButton = new Button(mc, gui).setText("*").setLayoutHint(new PositionalLayout.PositionalHint(45, 195, 14, 10)).setTooltips("Craft a stack").addButtonEvent(parent -> craft(-1));
    storeButton = new Button(mc, gui).setText("Store").setLayoutHint(new PositionalLayout.PositionalHint(5, 109, 56, 14)).setTooltips("Store the current recipe").addButtonEvent(parent -> store());
    Panel sidePanel = new Panel(mc, gui).setLayout(new PositionalLayout()).addChild(craft1Button).addChild(craft4Button).addChild(craft8Button).addChild(craftSButton).addChild(storeButton).addChild(recipeList);
    int sideLeft = guiLeft - CraftingGridInventory.GRID_WIDTH - 2;
    int sideTop = guiTop;
    sidePanel.setBounds(new Rectangle(sideLeft, sideTop, CraftingGridInventory.GRID_WIDTH, CraftingGridInventory.GRID_HEIGHT));
    sidePanel.setBackground(iconLocation);
    craftWindow = new Window(gui, sidePanel);
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) BlockTools(mcjty.lib.varia.BlockTools) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Arguments(mcjty.lib.network.Arguments) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStack(net.minecraft.item.ItemStack) Gui(net.minecraft.client.gui.Gui) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) Minecraft(net.minecraft.client.Minecraft) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ModBase(mcjty.lib.base.ModBase) RFTools(mcjty.rftools.RFTools) IRecipe(net.minecraft.item.crafting.IRecipe) GlStateManager(net.minecraft.client.renderer.GlStateManager) BlockPos(net.minecraft.util.math.BlockPos) Mouse(org.lwjgl.input.Mouse) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Slot(net.minecraft.inventory.Slot) ResourceLocation(net.minecraft.util.ResourceLocation) CommandHandler(mcjty.rftools.CommandHandler) InventoryCrafting(net.minecraft.inventory.InventoryCrafting) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

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