Java Code Examples for cpw.mods.fml.common.network.NetworkRegistry

The following are top voted examples for showing how to use cpw.mods.fml.common.network.NetworkRegistry. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: connor41-etfuturum2   File: EtFuturum.java   Source Code and License 9 votes vote down vote up
@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");
}
 
Example 2
Project: ExtraUtilities   File: ExtraUtils.java   Source Code and License 7 votes vote down vote up
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();
}
 
Example 3
Project: PopularMMOS-EpicProportions-Mod   File: epicproportionsmod_halloween.java   Source Code and License 7 votes vote down vote up
@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);
	
}
 
Example 4
Project: PAYDAY   File: PAYDAY.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 5
Project: connor41-etfuturum2   File: EtFuturum.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 6
Project: Technical   File: Technical.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 7
Project: OpenSensors   File: OpenSensors.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 8
Project: EnhancedLootBags   File: EnhancedLootBags.java   Source Code and License 6 votes vote down vote up
@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() );
}
 
Example 9
Project: 4Space-5   File: GalacticraftPacketHandler.java   Source Code and License 6 votes vote down vote up
@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;
    }
}
 
Example 10
Project: LotrAddonsRings   File: ProxyCommon.java   Source Code and License 6 votes vote down vote up
@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());


}
 
Example 11
Project: MidgarCrusade   File: Packets.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 12
Project: TRHS_Club_Mod_2016   File: FMLNetworkHandler.java   Source Code and License 6 votes vote down vote up
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);
    }
}
 
Example 13
Project: OpenTeleporter   File: CommonProxy.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 14
Project: VivecraftForgeExtensions   File: VivecraftForgePacketHandler.java   Source Code and License 6 votes vote down vote up
@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;
	}
}
 
Example 15
Project: Avaritiaddons   File: CommonProxy.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 16
Project: PrimitiveCraft   File: PrimitiveCraft.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 17
Project: DartCraft2   File: DartCraft2.java   Source Code and License 6 votes vote down vote up
@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?");
	}
}
 
Example 18
Project: Coding   File: Core.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 19
Project: KinetiCraft2-1.7.10-wip   File: CommonProxy.java   Source Code and License 6 votes vote down vote up
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());
}
 
Example 20
Project: KinetiCraft2-1.7.10-wip   File: KC2TileEntityBase.java   Source Code and License 6 votes vote down vote up
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);
    }
    */
}
 
Example 21
Project: CCFactoryManager   File: CCFactoryManager.java   Source Code and License 6 votes vote down vote up
@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");

}
 
Example 22
Project: CauldronGit   File: FMLNetworkHandler.java   Source Code and License 6 votes vote down vote up
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);
    }
}
 
Example 23
Project: M4thThings   File: TileQuantumTank.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 24
Project: roadstuff   File: RoadStuff.java   Source Code and License 6 votes vote down vote up
@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();
    }
}
 
Example 25
Project: Gadomancy   File: TileEssentiaCompressor.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 26
Project: HardcoreWither   File: HardcoreWither.java   Source Code and License 6 votes vote down vote up
@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());
}
 
Example 27
Project: Thallus   File: Thallus.java   Source Code and License 6 votes vote down vote up
@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");
}
 
Example 28
Project: amunra   File: ARPacketHandler.java   Source Code and License 6 votes vote down vote up
@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;
    }
}
 
Example 29
Project: vsminecraft   File: MekanismGenerators.java   Source Code and License 6 votes vote down vote up
@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.");
}
 
Example 30
Project: minecraft-quiverbow   File: PacketHandler.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 31
Project: 4Space-5   File: GalacticraftChannelHandler.java   Source Code and License 5 votes vote down vote up
/**
 * 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();
	}
}
 
Example 32
Project: 4Space-5   File: GalacticraftCore.java   Source Code and License 5 votes vote down vote up
@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)));
}
 
Example 33
Project: TRHS_Club_Mod_2016   File: NetworkDispatcher.java   Source Code and License 5 votes vote down vote up
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());
}
 
Example 34
Project: TRHS_Club_Mod_2016   File: NetworkDispatcher.java   Source Code and License 5 votes vote down vote up
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());
}
 
Example 35
Project: TRHS_Club_Mod_2016   File: NetworkDispatcher.java   Source Code and License 5 votes vote down vote up
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();
}
 
Example 36
Project: TRHS_Club_Mod_2016   File: SimpleChannelHandlerWrapper.java   Source Code and License 5 votes vote down vote up
@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);
    }
}
 
Example 37
Project: TRHS_Club_Mod_2016   File: FMLProxyPacket.java   Source Code and License 5 votes vote down vote up
@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");
        }
    }
}
 
Example 38
Project: TRHS_Club_Mod_2016   File: FMLNetworkHandler.java   Source Code and License 5 votes vote down vote up
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();
    }
}
 
Example 39
Project: TRHS_Club_Mod_2016   File: ForgeNetworkHandler.java   Source Code and License 5 votes vote down vote up
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());
}
 
Example 40
Project: Age-of-Kingdom   File: AgeOfKingdom.java   Source Code and License 5 votes vote down vote up
@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();
}
 
Example 41
Project: VivecraftForgeExtensions   File: ProxyServer.java   Source Code and License 5 votes vote down vote up
@Override
public void registerNetworkChannels() {
	super.registerNetworkChannels();
	VivecraftForge.networkVersion = NetworkRegistry.INSTANCE.newSimpleChannel("MC|Vive|Version");
	//VivecraftForge.networkFreeMove = NetworkRegistry.INSTANCE.newSimpleChannel("MC|Vive|FreeMove"); // currently not used
	VivecraftForge.networkLegacy = NetworkRegistry.INSTANCE.newSimpleChannel("MC|Vive");
	VivecraftForge.networkOK = NetworkRegistry.INSTANCE.newSimpleChannel("MC|ViveOK");
	VivecraftForge.networkVersion.registerMessage(ViveMessage.Handle.class, ViveMessage.class, 86, Side.SERVER);
	VivecraftForge.networkLegacy.registerMessage(ViveMessage.Handle.class, ViveMessage.class, 112, Side.SERVER);
}
 
Example 42
Project: RFUtilities   File: RFUtilities.java   Source Code and License 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    LogHelper.info("Hello Minecraft!");
    TE_LOADED = Loader.isModLoaded("ThermalExpansion");
    OC_LOADED = Loader.isModLoaded("OpenComputers");
    RFU_NET_WRAPPER = NetworkRegistry.INSTANCE.newSimpleChannel("rfu");
    proxy.preInit(event);
    LogHelper.info("PreInit complete");
}
 
Example 43
Project: RFUtilities   File: RFUtilities.java   Source Code and License 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    LogHelper.info("Hello Minecraft!");
    TE_LOADED = Loader.isModLoaded("ThermalExpansion");
    OC_LOADED = Loader.isModLoaded("OpenComputers");
    CC_LOADED = Loader.isModLoaded("ComputerCraft");
    RFU_NET_WRAPPER = NetworkRegistry.INSTANCE.newSimpleChannel("rfu");
    proxy.preInit(event);
    LogHelper.info("PreInit complete");
}
 
Example 44
Project: Lotr_Mod_Addons   File: LOTRRings.java   Source Code and License 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
    NetworkRegistry.INSTANCE.registerGuiHandler(this, new UIHandler());

    LOTRRItems.register();
    LOTRRBlocks.register();
    LOTRRTileEntities.register();
   proxy.init(event);
}
 
Example 45
Project: ThermosRebased   File: FanEventHandler.java   Source Code and License 5 votes vote down vote up
@Subscribe
public void constructMod(final FMLConstructionEvent event) {
    try {
        final ModClassLoader modClassLoader = event.getModClassLoader();
        modClassLoader.addFile(this.mContainer.getSource());
        modClassLoader.clearNegativeCacheFor(this.mCandidate.getClassList());
        NetworkRegistry.INSTANCE.register(this.mContainer, (Class)this.mContainer.getClass(), (String)null, event.getASMHarvestedData());
        Injector.inject(this.mMod, Injector.Phase.Construct, FMLCommonHandler.instance().getSide());
    }
    catch (Throwable e) {
        throw new IllegalStateException("Cannot construct fan", e);
    }
}
 
Example 46
Project: ThermosRebased   File: ImaginePacket.java   Source Code and License 5 votes vote down vote up
public void process(final ChannelHandlerContext ctx, final EntityPlayer player) {
    final Side side = (Side)ctx.channel().attr(NetworkRegistry.CHANNEL_SOURCE).get();
    if (side.isClient()) {
        this.processClient(ctx, player);
    }
    else {
        this.processServer(ctx, player);
    }
}
 
Example 47
Project: ThermosRebased   File: ImaginePacketCodec.java   Source Code and License 5 votes vote down vote up
protected void encode(final ChannelHandlerContext ctx, final ImaginePacket packet, final List<Object> out) throws Exception {
    final WritableBuf buffer = new WritableBuf(Unpooled.buffer());
    final ImaginePacketRegistry packetRegistry = (ImaginePacketRegistry)ctx.attr((AttributeKey)ImaginePacketCodec.PACKET_REGISTRY).get();
    final Class<? extends ImaginePacket> packetClass = packet.getClass();
    final int packetClassId = packetRegistry.id(packetClass);
    if (packetRegistry.missing(packetClass)) {
        packetRegistry.register(packetClassId, packetClass);
        buffer.writeBoolean(true);
        buffer.writeInt(packetClassId);
        final byte[] classNameBytes = packetClass.getName().getBytes(ImaginePacketCodec.UTF_8);
        final int classNameLength = classNameBytes.length;
        buffer.writeInt(classNameLength);
        buffer.writeBytes(classNameBytes, 0, classNameLength);
    }
    else {
        buffer.writeBoolean(false);
        buffer.writeInt(packetClassId);
    }
    packet.writePacket(ctx, buffer);
    final FMLProxyPacket proxy = new FMLProxyPacket((ByteBuf)buffer, (String)ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
    final WeakReference<FMLProxyPacket> ref = ((ThreadLocal)ctx.attr((AttributeKey)ImaginePacketCodec.PACKET_TRACKER).get()).get();
    final FMLProxyPacket old = (ref == null) ? null : ref.get();
    if (old != null) {
        proxy.setDispatcher(old.getDispatcher());
    }
    out.add(proxy);
}
 
Example 48
Project: PopularMMOS-EpicProportions-Mod   File: CommonProxy.java   Source Code and License 5 votes vote down vote up
public void init(FMLInitializationEvent e) {
   //GameRegistry.registerWorldGenerator(new ModWorldGen(), 0);
   //FMLCommonHandler.instance().bus().register(new MyEventHandler());
      //MinecraftForge.EVENT_BUS.register(new MyEventHandler());
      //System.out.print("common init fired!");
	
//LogHelper.init();
NetworkRegistry.INSTANCE.registerGuiHandler(EpicProportionsMod.instance, new GuiModInfoHandler());
}
 
Example 49
Project: OpenTechnology   File: CommonProxy.java   Source Code and License 5 votes vote down vote up
public void init(FMLInitializationEvent e) {
    MinecraftForge.EVENT_BUS.register(new CommonEvents());
    FMLCommonHandler.instance().bus().register(new FMLEvents());
    NetworkRegistry.INSTANCE.registerGuiHandler(OpenTechnology.instance, new GuiHandler());

    wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(OpenTechnology.MODID);
    wrapper.registerMessage(new SparkPacketHandler(), SparkPacket.class, 0, Side.CLIENT);

    Blocks.init();
    Items.init();
    Drivers.init();
    Recipes.init();
    TileEntities.init();
}
 
Example 50
Project: TeleComponents   File: CommonProxy.java   Source Code and License 5 votes vote down vote up
public void init(FMLInitializationEvent e)
{
    Recipes.init();
    NetworkRegistry.INSTANCE.registerGuiHandler(TeleComponents.instance, new GuiHandler());
    MinecraftForge.EVENT_BUS.register(new BlockOverride());

    OreDictionary.registerOre("ingotTeleIngot", ModItems.teleIngot);
    OreDictionary.registerOre("blockTeleIngot", ModBlocks.teleIngotBlock);
    OreDictionary.registerOre("compressedEndStone", ModBlocks.compressedEndStone);
    OreDictionary.registerOre("nuggetObsidian", ModItems.obsidianChunk);

    LogHelper.info("Initalization Complete");
}
 
Example 51
Project: DualCraft   File: DualCraft.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void init(FMLInitializationEvent event)
{
    LogHelper.info("Beginning Init Phase");
    MinecraftForge.EVENT_BUS.register(new WorldEventHandler());
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
    LogHelper.info("Ending Init Phase");
}
 
Example 52
Project: GakaisFlightTable   File: FlightTableMod.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void init(FMLInitializationEvent event)
{
    NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
    FMLCommonHandler.instance().bus().register(this);

    GameRegistry.registerItem(redstoneFeather, "redstoneFeather");
    GameRegistry.registerItem(creativeFeather, "creativeFeather");
    GameRegistry.registerTileEntity(TileEntityFlightTable.class, FlightTableMod.MODID);
    GameRegistry.registerBlock(flightTable, "flightTable");

    GameRegistry.addShapedRecipe(new ItemStack(flightTable), //
            "dod", //
            "ogo", //
            "dod", //
            'd', Items.diamond, //
            'o', Blocks.obsidian, //
            'g', Blocks.redstone_lamp);

    GameRegistry.addShapedRecipe(new ItemStack(redstoneFeather), //
            " r ", //
            "rfr", //
            " r ", //
            'f', Items.feather, //
            'r', Items.redstone);

    fuels.put(Items.feather, 12000);
    fuels.put(redstoneFeather, 48000);
    fuels.put(creativeFeather, 1200);
}
 
Example 53
Project: NewHorizonsCoreMod   File: MainRegistry.java   Source Code and License 5 votes vote down vote up
private void InitAdditionalBlocks()
{
    GameRegistry.registerBlock(_mBlockBabyChest, ItemBlockBabyChest.class, "BabyChest");
    GameRegistry.addShapelessRecipe(new ItemStack(_mBlockBabyChest, 9), new ItemStack(Blocks.chest, 1, 0));
    GameRegistry.registerTileEntity(TileEntityBabyChest.class, "teBabyChest");

    NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());

    proxy.registerRenderInfo();
}
 
Example 54
Project: LambdaLib   File: GuiHandlerRegistration.java   Source Code and License 5 votes vote down vote up
private void regHandler(RegModInformation mod, GuiHandlerBase handler) {
    ModGuiHandler modHandler = modHandlers.get(mod);
    if (modHandler == null) {
        modHandler = new ModGuiHandler();
        modHandlers.put(mod, modHandler);
        NetworkRegistry.INSTANCE.registerGuiHandler(mod.getModInstance(), modHandler);
    }
    int id =  modHandler.addHandler(handler.getHandler());
    handler.register(mod.getModInstance(), id);
}
 
Example 55
Project: DartCraft2   File: DartCraft2.java   Source Code and License 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
	NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
	proxy.registerEvents();
	proxy.registerClient();
	proxy.registerOreDictEntries();
	proxy.registerTileEntities();
       proxy.registerClientEvents();
	Recipes.init();
}
 
Example 56
Project: OpenFM   File: OpenFM.java   Source Code and License 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
	NetworkRegistry.INSTANCE.registerGuiHandler(this, new OFMGuiHandler());
	MinecraftForge.EVENT_BUS.register(new ClientEvent());
	FMLCommonHandler.instance().bus().register(new ClientEvent());
	MinecraftForge.EVENT_BUS.register(new ServerEvent());
	FMLCommonHandler.instance().bus().register(new ServerEvent());
	FMLCommonHandler.instance().bus().register(instance);
	MinecraftForge.EVENT_BUS.register(instance);
	ContentRegistry.init();
	proxy.initTileEntities();
	proxy.registerRenderers();
}
 
Example 57
Project: LyokoEnergistics   File: LyokoEnergistics.java   Source Code and License 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent envent){
	ModFluid.initFluid();
	ModItem.init();
	ModBlock.init();
	ModBlock.initFluid();
	MinecraftForge.EVENT_BUS.register(new TextureEvent());
	network = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MOD_ID);
	network.registerMessage(PacketMaterializationScanner.Handler.class, PacketMaterializationScanner.class, 0, Side.SERVER);
	network.registerMessage(PacketSuperComputer.Handler.class, PacketSuperComputer.class, 1, Side.SERVER);
	network.registerMessage(PacketTowerConsol.Handler.class, PacketTowerConsol.class, 2, Side.SERVER);
	NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());

}
 
Example 58
Project: Anti-AntiCheat-MOD   File: AntiAntiCheat.java   Source Code and License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    instance = this;
    this.config = new Configuration(new File(String.format("%s/%s.cfg", event.getModConfigurationDirectory(), "AntiAntiCheat")));

    channelmap = NetworkRegistry.INSTANCE.newChannel("LALAACM", new AntiCheatHandle());
    packetHandler.perInitialise();

    FMLLog.info("preInit over");
}
 
Example 59
Project: Gadomancy   File: TileNodeManipulator.java   Source Code and License 5 votes vote down vote up
private void playAspectDrainFromWand(Aspect drained) {
    if(drained == null) return;
    NetworkRegistry.TargetPoint point = getTargetPoint(32);
    PacketTCWispyLine line = new PacketTCWispyLine(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 0.8, zCoord + 0.5,
            xCoord + 0.5, yCoord + 1.4 + (((double) worldObj.rand.nextInt(4)) / 10D), zCoord + 0.5, 40, drained.getColor());
    PacketHandler.INSTANCE.sendToAllAround(line, point);
}
 
Example 60
Project: CauldronGit   File: NetworkDispatcher.java   Source Code and License 5 votes vote down vote up
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.isLocalChannel());
}