@Mod.EventHandler public void init(FMLInitializationEvent event) { proxy.init(event); // register CommonProxy as our GuiHandler NetworkRegistry.INSTANCE.registerGuiHandler(MODID, new CommonProxy()); ItemLoader.LoadItems(); BlockLoader.loadBlocks(); Recipes.registerRecpies(); EntityLoader.LoadEntitys(); OreDict.addores(); //Achievements.loadAchievements(); //Stats.RegisterStats(); GameRegistry.registerWorldGenerator(new ModWorldGen(), 0); }
@EventHandler public void init(FMLInitializationEvent evt) { INSTANCE.registerMessage(LobbyPlayerOpenedGuiPacketHandler.class, LobbyPlayerOpenedGuiPacket.class, 0, Side.SERVER); INSTANCE.registerMessage(LobbyBeginGamePacketHandler.class, LobbyBeginGamePacket.class, 1, Side.SERVER); INSTANCE.registerMessage(PacketSyncPlayerPropertiesClientHandler.class, PacketSyncPlayerPropertiesClient.class, 2, Side.CLIENT); INSTANCE.registerMessage(PacketSyncPlayerPropertiesServerHandler.class, PacketSyncPlayerPropertiesServer.class, 3, Side.SERVER); INSTANCE.registerMessage(PacketSyncTileEntityServerHandler.class, PacketSyncTileEntityServer.class, 4, Side.SERVER); INSTANCE.registerMessage(PacketSyncTileEntityClientHandler.class, PacketSyncTileEntityClient.class, 5, Side.CLIENT); NetworkRegistry.INSTANCE.registerGuiHandler(PAYDAY.instance, new MGuiHandler()); GameRegistry.registerBlock(lobbyBlock, "Lobby"); GameRegistry.registerTileEntity(LobbyTileEntity.class, "lobby_tile_entity"); FMLCommonHandler.instance().bus().register(eventHandler); MinecraftForge.EVENT_BUS.register(eventHandler); }
@EventHandler public void preInit(FMLPreInitializationEvent event) { ConfigurationHandler.INSTANCE.init(new File(event.getModConfigurationDirectory().getAbsolutePath() + File.separator + Reference.MOD_ID + ".cfg")); GameRegistry.registerWorldGenerator(new EtFuturumWorldGenerator(), 0); GameRegistry.registerWorldGenerator(new EtFuturumNetherGenerator(), 1); ModBlocks.init(); ModItems.init(); ModEnchantments.init(); OceanMonument.makeMap(); NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); networkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MOD_ID); networkWrapper.registerMessage(ArmourStandInteractHandler.class, ArmourStandInteractMessage.class, 0, Side.SERVER); networkWrapper.registerMessage(BlackHeartParticlesHandler.class, BlackHeartParticlesMessage.class, 1, Side.CLIENT); networkWrapper.registerMessage(SetPlayerModelHandler.class, SetPlayerModelMessage.class, 2, Side.CLIENT); }
@EventHandler public void init(FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy); ModRecipes.init(); proxy.registerEvents(); proxy.registerEntities(); proxy.registerRenderers(); if (ModEntityList.hasEntitiesWithEggs()) { ModEntityList.entity_egg = new ItemEntityEgg(); GameRegistry.registerItem(ModEntityList.entity_egg, "entity_egg"); OreDictionary.registerOre("mobEgg", ModEntityList.entity_egg); } isTinkersConstructLoaded = Loader.isModLoaded("TConstruct"); }
public void init(final FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler((Object)ExtraUtilsMod.instance, (IGuiHandler)new GuiHandler()); if (Loader.isModLoaded("ForgeMultipart")) { this.FMPRegisterPassThroughInterfaces(); } ExtraUtilsMod.proxy.registerEventHandler(); ExtraUtilsMod.proxy.registerRenderInformation(); if (Loader.isModLoaded("ThermalExpansion")) { TE4IMC.addIntegration(); } if (Loader.isModLoaded("MineFactoryReloaded")) { MFRIntegration.registerMFRIntegration(); } for (final ILoading loader : this.loaders) { loader.init(); } EE3Integration.finalRegister(); }
@Override protected void channelRead0(ChannelHandlerContext ctx, IPacket msg) throws Exception { INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get(); EntityPlayer player = GalacticraftCore.proxy.getPlayerFromNetHandler(netHandler); switch (FMLCommonHandler.instance().getEffectiveSide()) { case CLIENT: msg.handleClientSide(player); break; case SERVER: msg.handleServerSide(player); break; default: break; } }
public static void initialize() { network = NetworkRegistry.INSTANCE.newSimpleChannel("MagicCrusade"); network.registerMessage(PacketLogIn.Handler.class, PacketLogIn.class, 0, Side.CLIENT); network.registerMessage(PacketDisplayGui.Handler.class, PacketDisplayGui.class, 1, Side.CLIENT); network.registerMessage(PacketParticleEffectToClient.Handler.class, PacketParticleEffectToClient.class, 2, Side.CLIENT); network.registerMessage(PacketParticleEffectToServer.Handler.class, PacketParticleEffectToServer.class, 3, Side.SERVER); network.registerMessage(PacketSpellToServer.Handler.class, PacketSpellToServer.class, 4, Side.SERVER); network.registerMessage(PacketSetClasse.Handler.class, PacketSetClasse.class, 5, Side.SERVER); network.registerMessage(PacketExpToClient.Handler.class, PacketExpToClient.class, 6, Side.CLIENT); network.registerMessage(PacketTeamToClient.Handler.class, PacketTeamToClient.class, 7, Side.CLIENT); network.registerMessage(PacketTeamToServer.Handler.class, PacketTeamToServer.class, 8, Side.SERVER); network.registerMessage(PacketLevel.Handler.class, PacketLevel.class, 9, Side.CLIENT); network.registerMessage(PacketGameStart.Handler.class, PacketGameStart.class, 10, Side.CLIENT); network.registerMessage(PacketGameStop.Handler.class, PacketGameStop.class, 11, Side.CLIENT); network.registerMessage(PacketTogglePvp.Handler.class, PacketTogglePvp.class, 12, Side.CLIENT); network.registerMessage(PacketBorders.Handler.class, PacketBorders.class, 13, Side.CLIENT); network.registerMessage(PacketSetRace.Handler.class, PacketSetRace.class, 14, Side.SERVER); }
public static String checkModList(Map<String,String> listData, Side side) { List<ModContainer> rejects = Lists.newArrayList(); for (Entry<ModContainer, NetworkModHolder> networkMod : NetworkRegistry.INSTANCE.registry().entrySet()) { boolean result = networkMod.getValue().check(listData, side); if (!result) { rejects.add(networkMod.getKey()); } } if (rejects.isEmpty()) { return null; } else { FMLLog.info("Rejecting connection %s: %s", side, rejects); return String.format("Mod rejections %s",rejects); } }
@Override protected void channelRead0(ChannelHandlerContext ctx, IPacket msg) throws Exception { INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get(); EntityPlayer player = VivecraftForge.proxy.getPlayerFromNetHandler(netHandler); switch (FMLCommonHandler.instance().getEffectiveSide()) { case CLIENT: msg.handleClient(player); break; case SERVER: msg.handleServer(player); break; default: VivecraftForgeLog.severe("Impossible scenario encountered! Effective side is neither server nor client!"); break; } }
public void preInit() { GameRegistry.registerBlock(BlockCompressedChest.instance, ItemBlockAvaritiaddonsChest.class, "CompressedChest"); GameRegistry.registerBlock(BlockInfinityChest.instance, ItemBlockAvaritiaddonsChest.class, "InfinityChest"); GameRegistry.registerBlock(BlockExtremeAutoCrafter.instance, "ExtremeAutoCrafter"); GameRegistry.registerTileEntity(TileEntityCompressedChest.class, "Avaritiaddons:CompressedChest"); GameRegistry.registerTileEntity(TileEntityInfinityChest.class, "Avaritiaddons:InfinityChest"); GameRegistry.registerTileEntity(TileEntityExtremeAutoCrafter.class, "Avaritiaddons:ExtremeAutoCrafter"); NetworkRegistry.INSTANCE.registerGuiHandler(Avaritiaddons.instance, GuiHandler.instance); networkWrapper.registerMessage(InfinityChestSlotSync.Handler.class, InfinityChestSlotSync.class, 0, Side.SERVER); networkWrapper.registerMessage(InfinityChestSlotSync.Handler.class, InfinityChestSlotSync.class, 1, Side.CLIENT); networkWrapper.registerMessage(InfinityChestClick.Handler.class, InfinityChestClick.class, 2, Side.SERVER); networkWrapper.registerMessage(InfinityChestClick.Handler.class, InfinityChestClick.class, 3, Side.CLIENT); networkWrapper.registerMessage(InfinityChestConfirmation.Handler.class, InfinityChestConfirmation.class, 4, Side.SERVER); networkWrapper.registerMessage(InfinityChestConfirmation.Handler.class, InfinityChestConfirmation.class, 5, Side.CLIENT); networkWrapper.registerMessage(InfinityChestSyncAllSlots.Handler.class, InfinityChestSyncAllSlots.class, 6, Side.SERVER); networkWrapper.registerMessage(InfinityChestSyncAllSlots.Handler.class, InfinityChestSyncAllSlots.class, 7, Side.CLIENT); }
@Mod.EventHandler public void init(FMLInitializationEvent event) { //Load Mod Items ModItems.init(); //Load Mod Blocks ModBlocks.init(); //Load Mod Recipes ModRecipes.init(); //Register Renders on client side proxy.initRenders(); //Register GuiHandler NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, new GuiHandler()); //Register Mod Compat CompatHandler.init(event); //Register Leave drops MinecraftForge.EVENT_BUS.register(EventDrops.instancemain); //Register Mod World Gen ModWorldGen.init(); }
@Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { try { ConfigRegistry.registerConfig(new Config()); } catch (ConfigException e) { e.printStackTrace(); } NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel("dartcraft2"); proxy.registerPackets(); GameRegistry.registerWorldGenerator(new WorldGenPowerOre(), 1); ModFluids.init(); ModBlocks.init(); ModItems.init(); try { prepareAPI(); } catch (FailedAPIRequest failedAPIRequest) { failedAPIRequest.printStackTrace(); LOGGER.warn("Did another mod mess with the API?"); } }
private void setupNetwork() { NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); modChannel = NetworkRegistry.INSTANCE.newSimpleChannel(REFERENCE.MODID); int id = 0; modChannel.registerMessage(DragonPlayerUpdateLevel.Handler.class, DragonPlayerUpdateLevel.class, id++, Side.CLIENT); modChannel.registerMessage(DragonPlayerUpdateIsDragon.Handler.class, DragonPlayerUpdateIsDragon.class, id++, Side.CLIENT); modChannel.registerMessage(DragonPlayerUpdateDragonName.Handler.class, DragonPlayerUpdateDragonName.class, id++, Side.CLIENT); modChannel.registerMessage(StaffUpdateSetTargetOnFire.Handler.class, StaffUpdateSetTargetOnFire.class, id++, Side.SERVER); modChannel.registerMessage(StaffUpdateDamageTarget.Handler.class, StaffUpdateDamageTarget.class, id++, Side.SERVER); modChannel.registerMessage(StaffUpdateWitherTarget.Handler.class, StaffUpdateWitherTarget.class, id++, Side.SERVER); modChannel.registerMessage(StaffUpdatePoisonTarget.Handler.class, StaffUpdatePoisonTarget.class, id++, Side.SERVER); modChannel.registerMessage(DragonAbilityLavaToObsidian.Handler.class, DragonAbilityLavaToObsidian.class, id++, Side.CLIENT); modChannel.registerMessage(StaffUpdateTeleportThroughWall.Handler.class, StaffUpdateTeleportThroughWall.class, id++, Side.SERVER); modChannel.registerMessage(StaffUpdateTeleportThroughWallInDark.Handler.class, StaffUpdateTeleportThroughWallInDark.class, id++, Side.SERVER); modChannel.registerMessage(StaffUpdateDropEntity.Handler.class, StaffUpdateDropEntity.class, id++, Side.SERVER); modChannel.registerMessage(StaffUpdateMountEntity.Handler.class, StaffUpdateMountEntity.class, id++, Side.SERVER); modChannel.registerMessage(StaffUpdateDestroyBlock.Handler.class, StaffUpdateDestroyBlock.class, id++, Side.SERVER); }
public void preInit() { /* Network stuff */ CommonPacketHandler.init(); /* Items */ KinetiCraft2Items.init(); /* Blocks */ KinetiCraft2Blocks.init(); /* Tile Entities */ KinectiCraft2TileEntities.init(); /* GUI */ NetworkRegistry.INSTANCE.registerGuiHandler(KinetiCraft2.instance, new KC2GuiHandler()); }
private void sendUpdatePacket() { if(this.worldObj.isRemote) { return; } if(this.worldObj.playerEntities.size() <= 0) { //LogHelper.info("Returning. No players here!"); return; } CommonPacketHandler.INSTANCE.sendToAllAround(getUpdatePacket(), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); for(EntityPlayer player : (List<EntityPlayer>)this.worldObj.playerEntities) { // Send update if player is within a certain range if (player.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 128D) { //LogHelper.info("UPDATE SENT."); CommonPacketHandler.INSTANCE.sendTo(getUpdatePacket(), (EntityPlayerMP)player); } } /* if(this.worldObj.isRemote) { return; } if(this.updatePlayers.size() <= 0) { return; } for(EntityPlayer player : updatePlayers) { CommonPacketHandler.INSTANCE.sendTo(getUpdatePacket(), (EntityPlayerMP)player); } */ }
@EventHandler public void init(FMLInitializationEvent event) { PacketHandler.init(); Recipes.init(); proxy.registerTileEntities(); proxy.registerRenderers(); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); FMLCommonHandler.instance().bus().register(new TickHandler()); LuaType.registerTypeConverter(new ConverterFluidTankInfo()); LuaType.registerTypeConverter(new ConverterForgeDirection()); LuaType.registerTypeConverter(new ConverterAdvancedItemStack()); LuaType.registerClassToNameMapping(FluidTankInfo.class, "fluid_tank"); LuaType.registerClassToNameMapping(ForgeDirection.class, "direction"); LuaType.registerClassToNameMapping(AdvancedItemStack.class, "item_with_nbt"); }
@Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { if (isValveDirection(from)) { FluidStack toReturn = tank.drain(maxDrain,doDrain); if (doDrain && Configurations.ENABLE_TANK_PARTICLES && toReturn.amount > 0) { ModPackets.INSTANCE.sendToAllAround(new PacketFilling(xCoord,yCoord,zCoord, MiscHelper.getDirectionInteger(from),0, FluidRegistry.getFluidName(toReturn),toReturn.amount,tankSize), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId,xCoord,yCoord,zCoord,32)); } if (doDrain) { prepareSync(); } return toReturn; } return null; }
@EventHandler public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); config = new Configuration(event.getSuggestedConfigurationFile()); RoadStuffConfig.syncConfig(); RoadStuffBlocks.initBlocks(); RoadStuffItems.initItems(); GameRegistry.registerWorldGenerator(oreGen, 0); RoadStuffAchievements.initAchievements(); network = NetworkRegistry.INSTANCE.newSimpleChannel(MODID); network.registerMessage(PacketSignType.Handler.class, PacketSignType.class, 0, Side.SERVER); if(Loader.isModLoaded("chisel")) { Chisel.sendIMC(); } }
private boolean doDrain(Aspect a, List<WorldCoordinates> coordinates) { for (WorldCoordinates coordinate : coordinates) { TileEntity sourceTile = worldObj.getTileEntity(coordinate.x, coordinate.y, coordinate.z); if ((sourceTile == null) || (!(sourceTile instanceof IAspectSource))) { continue; } if(sourceTile instanceof TileEssentiaCompressor) continue; IAspectSource as = (IAspectSource)sourceTile; AspectList contains = as.getAspects(); if(contains == null || contains.visSize() > al.visSize()) continue; if(!canAccept(a)) continue; if (as.takeFromContainer(a, 1)) { PacketHandler.INSTANCE.sendToAllAround(new PacketFXEssentiaSource(xCoord, yCoord + 1, zCoord, (byte)(xCoord - coordinate.x), (byte)(yCoord - coordinate.y + 1), (byte)(zCoord - coordinate.z), a.getColor()), new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord + 1, zCoord, 32.0D)); return true; } } return false; }
@Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { logger.info(TextHelper.localize("info." + ModInformation.ID + ".console.load.preInit")); ConfigManager.getInstance().init(event.getModConfigurationDirectory()); powerUpManager.init(); ItemRegistry.registerItems(); BlockRegistry.registerBlocks(); PotionRegistry.registerPotions(); EntityRegistry.register(); FMLCommonHandler.instance().bus().register(eventHandler); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); }
@Mod.EventHandler public void init(FMLInitializationEvent event) { // Register the GUI Handler NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler()); // Register the Achievement Handler FMLCommonHandler.instance().bus().register(new AchievementHandler()); // Initialize mod tile entities TileEntities.init(); // Initialize event handlers proxy.registerEventHandlers(); // Initialize mod recipes Recipes.init(); // Register the Waila data provider // FMLInterModComms.sendMessage("Waila", "register", "com.kithio.thallus.waila.WailaDataProvider.callbackRegister"); }
@Override protected void channelRead0(ChannelHandlerContext ctx, IPacket msg) throws Exception { INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get(); //this should work // EntityPlayer player = getPlayerFromNetHandler(netHandler); EntityPlayer player = GalacticraftCore.proxy.getPlayerFromNetHandler(netHandler); switch (FMLCommonHandler.instance().getEffectiveSide()) { case CLIENT: msg.handleClientSide(player); break; case SERVER: msg.handleServerSide(player); break; default: break; } }
@EventHandler public void init(FMLInitializationEvent event) { //Add this module to the core list Mekanism.modulesLoaded.add(this); packetHandler.initialize(); //Set up the GUI handler NetworkRegistry.INSTANCE.registerGuiHandler(this, new GeneratorsGuiHandler()); FMLCommonHandler.instance().bus().register(this); //Load the proxy proxy.loadConfiguration(); proxy.registerRegularTileEntities(); proxy.registerSpecialTileEntities(); proxy.registerRenderInformation(); addRecipes(); //Finalization Mekanism.logger.info("Loaded MekanismGenerators module."); }
public static void initPackets() { net = NetworkRegistry.INSTANCE.newSimpleChannel("quiverchevsky".toUpperCase()); registerMessage(ParticlePacket.class, ParticleMessage.class); registerMessage(PositionPacket.class, PositionMessage.class); registerMessage(KickbackPacket.class, KickbackMessage.class); registerMessage(TurretInventoryPacket.class, TurretInventoryMessage.class); registerMessage(TurretStatePacket.class, TurretStateMessage.class); }
@Mod.EventHandler public void init(FMLInitializationEvent event) { proxy.registerNetworkStuff(); NetworkRegistry.INSTANCE.registerGuiHandler(this, new TechnicalGuiHandler()); TechnicalItem.removeVanillaRecipes(); Recipes.init(); FMLCommonHandler.instance().bus().register(new EventListener()); radioactivityPotion = (new PotionTechnical(radioactivityPotionId, true, 0)).setIconIndex(0, 0).setPotionName("potion.radioactivityPotion"); TechnicalAchievement.init(); AchievementPage.registerAchievementPage(technicalAchievementPage); }
@EventHandler public void init(FMLInitializationEvent event) { long time = System.nanoTime(); ContentRegistry.init(); FMLCommonHandler.instance().bus().register(this); NetworkRegistry.INSTANCE.registerGuiHandler(OpenSensors.instance, new GUIHandler()); logger.info("Finished init in %d ms", (System.nanoTime() - time) / 1000000); }
@EventHandler public void init( FMLInitializationEvent event ) { FMLCommonHandler.instance().bus().register( AdminLogonErrors ); FMLCommonHandler.instance().bus().register( LootGroupHandler ); MinecraftForge.EVENT_BUS.register( LootGroupHandler ); NetworkRegistry.INSTANCE.registerGuiHandler( this, new GuiHandler() ); }
/** * Send this message to everyone within a certain range of a point. * <p/> * Adapted from CPW's code in * cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper * * @param message The message to send * @param point The * {@link cpw.mods.fml.common.network.NetworkRegistry.TargetPoint} * around which to send */ public void sendToAllAround(IPacket message, NetworkRegistry.TargetPoint point) { try { this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point); this.channels.get(Side.SERVER).writeOutbound(message); } catch (Exception e) { GCLog.severe("Forge error when sending network packet to nearby players - this is not a Galacticraft bug, does another mod make fake players?"); e.printStackTrace(); } }
@EventHandler public void preInit(FMLPreInitializationEvent event) { isPlanetsLoaded = Loader.isModLoaded(Constants.MOD_ID_PLANETS); GCCoreUtil.nextID = 0; MinecraftForge.EVENT_BUS.register(new EventHandlerGC()); handler = new GCPlayerHandler(); MinecraftForge.EVENT_BUS.register(handler); FMLCommonHandler.instance().bus().register(handler); GalacticraftCore.proxy.preInit(event); ConnectionPacket.bus = NetworkRegistry.INSTANCE.newEventDrivenChannel(ConnectionPacket.CHANNEL); ConnectionPacket.bus.register(new ConnectionPacket()); ConfigManagerCore.initialize(new File(event.getModConfigurationDirectory(), GalacticraftCore.CONFIG_FILE)); EnergyConfigHandler.setDefaultValues(new File(event.getModConfigurationDirectory(), GalacticraftCore.POWER_CONFIG_FILE)); ChunkLoadingCallback.loadConfig(new File(event.getModConfigurationDirectory(), GalacticraftCore.CHUNKLOADER_CONFIG_FILE)); this.registerOilandFuel(); if (Loader.isModLoaded("PlayerAPI")) { ServerPlayerAPI.register(Constants.MOD_ID_CORE, GCPlayerBaseMP.class); } GCBlocks.initBlocks(); GCItems.initItems(); //Allow canisters to be filled from other mods' tanks containing fuel / oil fluids FluidContainerRegistry.registerFluidContainer(new FluidContainerData(new FluidStack(GalacticraftCore.fluidFuel, 1000), new ItemStack(GCItems.fuelCanister, 1, 1), new ItemStack(GCItems.oilCanister, 1, ItemCanisterGeneric.EMPTY))); FluidContainerRegistry.registerFluidContainer(new FluidContainerData(new FluidStack(GalacticraftCore.fluidOil, 1000), new ItemStack(GCItems.oilCanister, 1, 1), new ItemStack(GCItems.oilCanister, 1, ItemCanisterGeneric.EMPTY))); }
@Mod.EventHandler public void onInit(FMLInitializationEvent e){ /* REGISTERS ALL COMMON THINGS SO FOR BOTH SERVER AND CLIENT... */ LOTRAddonsItems.registerRings(); LOTRAddonsBlocks.registerBlocks(); LOTRAddonsEntities.registerEntities(); NetworkRegistry.INSTANCE.registerGuiHandler(LOTRAddons.lotrAddons, new GuiHandler()); }
public NetworkDispatcher(NetworkManager manager) { super(Packet.class, false); this.manager = manager; this.scm = null; this.side = Side.CLIENT; this.handshakeChannel = new EmbeddedChannel(new HandshakeInjector(this), new ChannelRegistrationHandler(), new FMLHandshakeCodec(), new HandshakeMessageHandler<FMLHandshakeClientState>(FMLHandshakeClientState.class)); this.handshakeChannel.attr(FML_DISPATCHER).set(this); this.handshakeChannel.attr(NetworkRegistry.CHANNEL_SOURCE).set(Side.SERVER); this.handshakeChannel.attr(NetworkRegistry.FML_CHANNEL).set("FML|HS"); this.handshakeChannel.attr(IS_LOCAL).set(manager.func_150731_c()); }
public NetworkDispatcher(NetworkManager manager, ServerConfigurationManager scm) { super(Packet.class, false); this.manager = manager; this.scm = scm; this.side = Side.SERVER; this.handshakeChannel = new EmbeddedChannel(new HandshakeInjector(this), new ChannelRegistrationHandler(), new FMLHandshakeCodec(), new HandshakeMessageHandler<FMLHandshakeServerState>(FMLHandshakeServerState.class)); this.handshakeChannel.attr(FML_DISPATCHER).set(this); this.handshakeChannel.attr(NetworkRegistry.CHANNEL_SOURCE).set(Side.CLIENT); this.handshakeChannel.attr(NetworkRegistry.FML_CHANNEL).set("FML|HS"); this.handshakeChannel.attr(IS_LOCAL).set(manager.func_150731_c()); }
private void cleanAttributes(ChannelHandlerContext ctx) { ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).remove(); ctx.channel().attr(NetworkRegistry.NET_HANDLER).remove(); ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).remove(); this.handshakeChannel.attr(FML_DISPATCHER).remove(); this.manager.channel().attr(FML_DISPATCHER).remove(); }
@Override protected void channelRead0(ChannelHandlerContext ctx, REQ msg) throws Exception { INetHandler iNetHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get(); MessageContext context = new MessageContext(iNetHandler, side); REPLY result = messageHandler.onMessage(msg, context); if (result != null) { ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.REPLY); ctx.writeAndFlush(result).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); } }
@Override public void func_148833_a(INetHandler inethandler) { this.netHandler = inethandler; EmbeddedChannel internalChannel = NetworkRegistry.INSTANCE.getChannel(this.channel, this.target); if (internalChannel != null) { internalChannel.attr(NetworkRegistry.NET_HANDLER).set(this.netHandler); try { if (internalChannel.writeInbound(this)) { badPackets.add(this.channel); if (badPackets.size() % packetCountWarning == 0) { FMLLog.severe("Detected ongoing potential memory leak. %d packets have leaked. Top offenders", badPackets.size()); int i = 0; for (Entry<String> s : Multisets.copyHighestCountFirst(badPackets).entrySet()) { if (i++ > 10) break; FMLLog.severe("\t %s : %d", s.getElement(), s.getCount()); } } } internalChannel.inboundMessages().clear(); } catch (FMLNetworkException ne) { FMLLog.log(Level.ERROR, ne, "There was a network exception handling a packet on channel %s", channel); dispatcher.rejectHandshake(ne.getMessage()); } catch (Throwable t) { FMLLog.log(Level.ERROR, t, "There was a critical exception handling a packet on channel %s", channel); dispatcher.rejectHandshake("A fatal error has occured, this connection is terminated"); } } }
public static void registerChannel(FMLContainer container, Side side) { channelPair = NetworkRegistry.INSTANCE.newChannel(container, "FML", new FMLRuntimeCodec(), new HandshakeCompletionHandler()); EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER); embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE); if (side == Side.CLIENT) { addClientHandlers(); } }
public static void registerChannel(ForgeModContainer forgeModContainer, Side side) { channelPair = NetworkRegistry.INSTANCE.newChannel(forgeModContainer, "FORGE", new ForgeRuntimeCodec()); if (side == Side.CLIENT) { addClientHandlers(); } FMLEmbeddedChannel serverChannel = channelPair.get(Side.SERVER); serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE); String handlerName = serverChannel.findChannelHandlerNameForType(ForgeRuntimeCodec.class); serverChannel.pipeline().addAfter(handlerName, "ServerToClientConnection", new ServerToClientConnectionEstablishedHandler()); }
@EventHandler public void init(FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE, serverProxy); GameRegistry.registerWorldGenerator(blockGenerator, 0); serverProxy.init(event); blockManager.init(event); itemManager.init(event); eventManager.init(event); entityManager.init(event); questManager.init(event); PlayerAokIEEP.init(); }
public void init(FMLInitializationEvent e) { wrapper = NetworkRegistry.INSTANCE.newSimpleChannel("OpenTeleporter"); GameRegistry.registerBlock(new BlockTeleporter(), "Teleporter"); GameRegistry.registerTileEntity(TileEntityTeleporter.class, "TileEntityTeleporter"); wrapper.registerMessage(PacketPlayerPosition.Handler.class, PacketPlayerPosition.class, 0, Side.CLIENT); wrapper.registerMessage(PacketTeleporter.Handler.class, PacketTeleporter.class, 1, Side.CLIENT); }