Java 类cpw.mods.fml.common.network.internal.FMLNetworkHandler 实例源码

项目:Rival-Rebels-Mod    文件:BlockNuclearBomb.java   
/**
 * Called upon block activation (right click on the block.)
 */
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
    if (!par5EntityPlayer.isSneaking())
    {
        if (par5EntityPlayer.inventory.getCurrentItem() != null && par5EntityPlayer.inventory.getCurrentItem().getItem() == RivalRebels.pliers)
        {
            FMLNetworkHandler.openGui(par5EntityPlayer, RivalRebels.instance, 0, par1World, x, y, z);
            // par5EntityPlayer.openGui(RivalRebels.instance, RivalRebels.nuclearBombGuiID, par1World, x, y, z);
        }
        else if (!par1World.isRemote)
        {
            par5EntityPlayer.addChatMessage(new ChatComponentText("§7[§4Orders§7] §cUse pliers to open."));
        }
    }
    return false;
}
项目:CustomAI    文件:EntityEvents.java   
@SubscribeEvent
public void onEntityInteraction(EntityInteractEvent e)
{
    ItemStack stack = e.entityPlayer.getCurrentEquippedItem();
    if(stack != null)
    {
        if(stack.getItem() == ModCustomAI.rewriterItem)
        {
            e.setCanceled(true);
            CustomAIPlayerExtendedProperties props = (CustomAIPlayerExtendedProperties)e.entityPlayer.getExtendedProperties(ModCustomAI.MODID);
            if(props == null)
            {
                e.entityPlayer.registerExtendedProperties(ModCustomAI.MODID, new CustomAIPlayerExtendedProperties());
            }
            props.setEntityInteractingWith(e.target.getEntityId(), e.target.getClass());
            FMLNetworkHandler.openGui(e.entityPlayer, ModCustomAI.instance, 0, e.entityPlayer.worldObj, (int)Math.floor(e.entityPlayer.posX), (int)Math.floor(e.entityPlayer.posY), (int)Math.floor(e.entityPlayer.posZ));
        }
        else if(stack.getItem() == ModCustomAI.copierItem)
        {
            e.setCanceled(!((AICopierItem)stack.getItem()).onInteract(e.entityPlayer.worldObj, stack, e.entityPlayer, e.target));
        }
    }
}
项目:rpginventory    文件:PacketHandler.java   
public void handlePacket(Packet250CustomPayload packet, Player player) {

        EntityPlayer p = (EntityPlayer) player;
        World world = p.worldObj;

        DataInputStream dis = new DataInputStream(new ByteArrayInputStream(
                packet.data));
        try {
            int guiId = dis.readInt();
            switch (guiId) {
            case 0:
                FMLNetworkHandler.openGui(p, mod_wwbs.instance, 2, p.worldObj,
                        dis.readInt(), dis.readInt(), dis.readInt());
                break;
            default:
                break;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
项目:ModJam-4-Mod    文件:BlockLine.java   
@Override
public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    try{if(!w.isRemote){
        TileEntity tile = w.getTileEntity(x, y, z);
        if(tile!=null && tile instanceof TEPipe){
            ItemStack heldItem = player.inventory.mainInventory[player.inventory.currentItem].copy();
            if(heldItem != null && heldItem.getItem() instanceof ItemWrench){
                if(heldItem.getItemDamage()<1){
                    if(((TEPipe)tile).itemMod[side].canChange(w, x, y, z, SIDE.getDirFromSide(side)))
                        FMLNetworkHandler.openGui(player, SmartLines.instance, side, w, x, y, z);
                }else{
                    ((TEPipe)tile).itemMod[side].nextMode(w, x, y, z, SIDE.getDirFromSide(side));
                    player.addChatComponentMessage(new ChatComponentText(((TEPipe)tile).itemMod[side].modes.toString()));
                }
                return true;
            }
        }
    }}catch(Exception e){}
    return false;
}
项目:Cauldron    文件:NetHandlerLoginServer.java   
public void func_147326_c()
{
    // Spigot start - Moved to initUUID
    /*
    if (!this.field_147337_i.isComplete())
    {
        this.field_147337_i = this.func_152506_a(this.field_147337_i);
    }
    */
    // Spigot end

    // CraftBukkit start - fire PlayerLoginEvent
    EntityPlayerMP s = this.field_147327_f.getConfigurationManager().attemptLogin(this, this.field_147337_i, this.hostname);

    if (s == null)
    {
        // this.func_147322_a(s);
        // CraftBukkit end
    }
    else
    {
        this.field_147328_g = NetHandlerLoginServer.LoginState.ACCEPTED;
        this.field_147333_a.scheduleOutboundPacket(new S02PacketLoginSuccess(this.field_147337_i), new GenericFutureListener[0]);
        FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.getConfigurationManager(), this.field_147333_a, this.field_147327_f.getConfigurationManager().processLogin(this.field_147337_i, s)); // CraftBukkit - add player reference
    }
}
项目:Cauldron    文件:NetHandlerLoginServer.java   
public void func_147326_c()
{
    if (!this.field_147337_i.isComplete())
    {
        this.field_147337_i = this.func_152506_a(this.field_147337_i);
    }

    String s = this.field_147327_f.getConfigurationManager().allowUserToConnect(this.field_147333_a.getSocketAddress(), this.field_147337_i);

    if (s != null)
    {
        this.func_147322_a(s);
    }
    else
    {
        this.field_147328_g = NetHandlerLoginServer.LoginState.ACCEPTED;
        this.field_147333_a.scheduleOutboundPacket(new S02PacketLoginSuccess(this.field_147337_i), new GenericFutureListener[0]);
        FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.getConfigurationManager(), this.field_147333_a, this.field_147327_f.getConfigurationManager().createPlayerForUser(this.field_147337_i));
    }
}
项目:GaiaMod    文件:GaiaAltarBlock.java   
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
        EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    if (world.isRemote) {
        return true;
    } else if (!player.isSneaking()) {
        TileEntityGaiaAltar entity = (TileEntityGaiaAltar) world
                .getTileEntity(x, y, z);
        if (entity != null) {
            FMLNetworkHandler.openGui(player, GaiaMod.instance,
                    ModGui.guiIDGaiaAltar, world, x, y, z);
        }
        return true;
    } else {
        return false;
    }
}
项目:GaiaMod    文件:EssenceAltarBlock.java   
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
        EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    if (world.isRemote) {
        return true;
    } else if (!player.isSneaking()) {
        TileEntityEssenceAltar entity = (TileEntityEssenceAltar) world
                .getTileEntity(x, y, z);
        if (entity != null) {
            FMLNetworkHandler.openGui(player, GaiaMod.instance,
                    ModGui.guiIDEssenceAltar, world, x, y, z);
        }
        return true;
    } else {
        return false;
    }
}
项目:GaiaMod    文件:OrderShrineBlock.java   
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
        EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    if (world.isRemote) {
        return true;
    } else if (!player.isSneaking()) {
        TileEntityOrderShrine entity = (TileEntityOrderShrine) world
                .getTileEntity(x, y, z);
        if (entity != null) {
            FMLNetworkHandler.openGui(player, GaiaMod.instance,
                    ModGui.guiIDOrderShrine, world, x, y, z);
        }
        return true;
    } else {
        return false;
    }
}
项目:Rival-Rebels-Mod    文件:EntityLaptop.java   
@Override
public boolean interactFirst(EntityPlayer player)
{
    if (player.isSneaking() && !player.worldObj.isRemote)
    {
        FMLNetworkHandler.openGui(player, RivalRebels.instance, 0, player.worldObj, 0, 0, 0);
        // player.openGui(RivalRebels.instance, RivalRebels.rrchestGuiID, player.worldObj, 0, 0, 0);
    }
    if (!player.isSneaking() && player.inventory.addItemStackToInventory(new ItemStack(RivalRebels.controller)))
    {
        player.swingItem();
        setDead();
    }
    return true;
}
项目:Rival-Rebels-Mod    文件:BlockTsarBomba.java   
/**
 * Called upon block activation (right click on the block.)
 */
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
    if (par5EntityPlayer.inventory.getCurrentItem() != null && par5EntityPlayer.inventory.getCurrentItem().getItem() == RivalRebels.pliers)
    {
        FMLNetworkHandler.openGui(par5EntityPlayer, RivalRebels.instance, 0, par1World, x, y, z);
        // par5EntityPlayer.openGui(RivalRebels.instance, RivalRebels.tsarguiID, par1World, x, y, z);
    }
    else if (!par1World.isRemote)
    {
        par5EntityPlayer.addChatMessage(new ChatComponentText("§7[§4Orders§7] §cUse pliers to open."));
    }
    return false;
}
项目:Rival-Rebels-Mod    文件:BlockTheoreticalTsarBomba.java   
/**
 * Called upon block activation (right click on the block.)
 */
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
    if (par5EntityPlayer.inventory.getCurrentItem() != null && par5EntityPlayer.inventory.getCurrentItem().getItem() == RivalRebels.pliers)
    {
        FMLNetworkHandler.openGui(par5EntityPlayer, RivalRebels.instance, 0, par1World, x, y, z);
        // par5EntityPlayer.openGui(RivalRebels.instance, RivalRebels.tsarguiID, par1World, x, y, z);
    }
    else if (!par1World.isRemote)
    {
        par5EntityPlayer.addChatMessage(new ChatComponentText("§7[§4Orders§7] §cUse pliers to open."));
    }
    return false;
}
项目:Rival-Rebels-Mod    文件:BlockAntimatterBomb.java   
/**
 * Called upon block activation (right click on the block.)
 */
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
    if (par5EntityPlayer.inventory.getCurrentItem() != null && par5EntityPlayer.inventory.getCurrentItem().getItem() == RivalRebels.pliers)
    {
        FMLNetworkHandler.openGui(par5EntityPlayer, RivalRebels.instance, 0, par1World, x, y, z);
        // par5EntityPlayer.openGui(RivalRebels.instance, RivalRebels.tsarguiID, par1World, x, y, z);
    }
    else if (!par1World.isRemote)
    {
        par5EntityPlayer.addChatMessage(new ChatComponentText("§7[§4Orders§7] §cUse pliers to open."));
    }
    return false;
}
项目:Rival-Rebels-Mod    文件:BlockReciever.java   
/**
 * Called upon block activation (right click on the block.)
 */
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
    if (!par1World.isRemote)
    {
        // par5EntityPlayer.openGui(RivalRebels.instance, RivalRebels.recieverGuiID, par1World, par2, par3, par4);
        FMLNetworkHandler.openGui(par5EntityPlayer, RivalRebels.instance, 0, par1World, par2, par3, par4);
    }
    RivalRebelsSoundPlayer.playSound(par1World, 10, 3, par2, par3, par4);

    return true;
}
项目:Rival-Rebels-Mod    文件:BlockReactor.java   
/**
 * Called upon block activation (right click on the block.)
 */
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
    if (!par1World.isRemote)
    {
        FMLNetworkHandler.openGui(par5EntityPlayer, RivalRebels.instance, 0, par1World, par2, par3, par4);
        // par5EntityPlayer.openGui(RivalRebels.instance, RivalRebels.tokamakID, par1World, par2, par3, par4);
    }
    RivalRebelsSoundPlayer.playSound(par1World, 10, 3, par2, par3, par4);

    return true;
}
项目:Rival-Rebels-Mod    文件:BlockLoader.java   
/**
 * Called upon block activation (right click on the block.)
 */
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
    if (!par1World.isRemote)
    {
        FMLNetworkHandler.openGui(par5EntityPlayer, RivalRebels.instance, 0, par1World, par2, par3, par4);
        // par5EntityPlayer.openGui(RivalRebels.instance, RivalRebels.rrchestGuiID, par1World, par2, par3, par4);
    }
    RivalRebelsSoundPlayer.playSound(par1World, 10, 3, par2, par3, par4);

    return true;
}
项目:Rival-Rebels-Mod    文件:BlockLaptop.java   
/**
 * Called upon block activation (right click on the block.)
 */
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
    ((TileEntityLaptop) par1World.getTileEntity(par2, par3, par4)).refreshTasks();
    if (!par1World.isRemote)
    {
        FMLNetworkHandler.openGui(par5EntityPlayer, RivalRebels.instance, 0, par1World, par2, par3, par4);
        // par5EntityPlayer.openGui(RivalRebels.instance, RivalRebels.rrchestGuiID, par1World, par2, par3, par4);
    }
    RivalRebelsSoundPlayer.playSound(par1World, 10, 3, par2, par3, par4);

    return true;
}
项目:Avaritiaddons    文件:BlockInfinityChest.java   
@Override
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer entityPlayer, final int side, final float hitX, final float hitY, final float hitZ)
{
    if (!world.isRemote)
        FMLNetworkHandler.openGui(entityPlayer, Avaritiaddons.instance, Avaritiaddons.GUI_ID_INFINITY_CHEST, world, x, y, z);
    return true;
}
项目:FissionWarfare    文件:BlockContainerBase.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float f2, float f3) {

    if (!world.isRemote) {          
        FMLNetworkHandler.openGui(player, FissionWarfare.instance, 0, world, x, y, z);  
    }

    return true;    
}
项目:FissionWarfare    文件:BlockControlPanel.java   
@Override
public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer p, int i, float f, float f2, float f3) {

    Location loc = new Location(w, x, y, z);
    Location tileLoc = loc.add(loc.getMetadata(), true);

    if (!w.isRemote) {          
        FMLNetworkHandler.openGui(p, FissionWarfare.instance, 0, tileLoc.world, tileLoc.x, tileLoc.y, tileLoc.z);   
    }

    return true;
}
项目:RorysMod    文件:BlockRifleTable.java   
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float hitX, float hitY, float hitZ) {
    if (!world.isRemote) {
        FMLNetworkHandler.openGui(player, RorysMod.instance, RorysMod.GUIS.RILE_TABLE.ordinal(), world, x, y, z);
    }
    return true;
}
项目:toolscompressor    文件:ToolsCompressor.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){
    if(world.isRemote){
        return true;
    } else if(!player.isSneaking()) {
        TileEntityToolsCompressor te = (TileEntityToolsCompressor) world.getTileEntity(x, y, z);

        if(te != null){
            FMLNetworkHandler.openGui(player, MainToolsCompressor.instance, MainToolsCompressor.guiIdToolsCompressor, world, x, y, z);
        }

        return true;
    } else {
        return false;
    }
}
项目:MHuanterMod    文件:GearExtruder.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
    TileEntity tileEntity = world.getTileEntity(x, y, z);
    if (tileEntity == null || player.isSneaking()) {
            return false;
    }
    if(!world.isRemote){
        FMLNetworkHandler.openGui(player, ModulMach.instance, ModulMach.guiGearExtruder, world, x, y, z);
    }
    return true;
}
项目:MHuanterMod    文件:BasicGenerator.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
    TileEntity tileEntity = world.getTileEntity(x, y, z);
    if (tileEntity == null || player.isSneaking()) {
        return false;
    }
    if(!world.isRemote){
        FMLNetworkHandler.openGui(player, ModulMach.instance, ModulMach.guiBasicGenerator, world, x, y, z);
    }
    return true;
}
项目:SmeltyCraft    文件:BlockSmeltingFurnace.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
    {
//        if(!world.isRemote)
//        {
            FMLNetworkHandler.openGui(player, SmeltyCraft.instance, GUIs.SMELTING_FURNACE, world, x, y, z);
//        }
        return true;
    }
项目:ExtraCarts-1.7.10    文件:EntityExtraCartChestMinecart.java   
@Override
public boolean interactFirst(EntityPlayer player)
{
    if(net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, player))) {
        return true;
    }

    if (!this.worldObj.isRemote && !player.isSneaking())
    {
        FMLNetworkHandler.openGui(player, ExtraCarts.instance, 2, player.worldObj, this.getEntityId(), 0, 0);
    }

    return true;
}
项目:CarbonMod    文件:ModBlockChemicalExtractor.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    if(!world.isRemote) {
        FMLNetworkHandler.openGui(player, CarbonMod.instance, ModBlocks.chemicalExtractorGuiID, world, x, y, z);
    }
    else if(world.isRemote) {

    }
    return true;    
}
项目:CarbonMod    文件:ModBlockCompressionChamber.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    if(!world.isRemote) {
        FMLNetworkHandler.openGui(player, CarbonMod.instance, ModBlocks.compressionChamberGuiID, world, x, y, z);
    }
    else if(world.isRemote) {

    }
    return true;    
}
项目:PlasmaticSpace    文件:sfAlloySmelter.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    if(!world.isRemote) {
        FMLNetworkHandler.openGui(player, PlasmaticSpace.instance, 2, world, x, y, z);
    }

    return true;
}
项目:PlasmaticSpace    文件:CuttingMachine.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {

        if(!world.isRemote) {
            FMLNetworkHandler.openGui(player, PlasmaticSpace.instance, PlasmaticSpace.guiIDCutter, world, x, y, z);
        }
        return true;
    }
项目:PlasmaticSpace    文件:Cutter.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    if(!world.isRemote) {
        FMLNetworkHandler.openGui(player, PlasmaticSpace.instance, 3, world, x, y, z);
    }

    return true;
}
项目:PlasmaticSpace    文件:WindTurbine.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    if(!world.isRemote) {
        FMLNetworkHandler.openGui(player, PlasmaticSpace.instance, 0, world, x, y, z);
    }

    return true;
}
项目:Talismans    文件:BlockTalismanDuplicator.java   
public boolean onBlockActivated(World world, int x, int y, int z,
        EntityPlayer entity, int side, float hitX, float hitY, float hitZ) {
    if (!world.isRemote) {
        FMLNetworkHandler.openGui(entity, Talismans.instance, 0, world, x,
                y, z);

    }

    return true;
}
项目:TectoCraft    文件:TectonicSmasher.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    if(!world.isRemote) {
        FMLNetworkHandler.openGui(player, TectoCraft.instance, TectoCraft.guiIDSmasher, world, x, y, z);
    }

    return true;
}
项目:TectoCraft    文件:TectonicOven.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
    if(!world.isRemote) {
        FMLNetworkHandler.openGui(player, TectoCraft.instance, TectoCraft.guiIDTectoOven, world, x, y, z);
    }

    return true;
}
项目:BeanCraft    文件:BlockBioGenerator.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
    if(!world.isRemote)
    {
        FMLNetworkHandler.openGui(player, BeanCraft.instance, ModGUIs.guiIDBioGen, world, x, y, z);
    }

    return true;
}
项目:BeanCraft    文件:BlockBioExtractor.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
    if(!world.isRemote)
    {
        FMLNetworkHandler.openGui(player, BeanCraft.instance, ModGUIs.guiIDBioExtractor, world, x, y, z);
    }

    return true;
}
项目:BeanCraft    文件:BlockBioInfuser.java   
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
    if(!world.isRemote)
    {
        FMLNetworkHandler.openGui(player, BeanCraft.instance, ModGUIs.guiIDBioInfuser, world, x, y, z);
    }

    return true;
}
项目:rpginventory    文件:BlockForge.java   
/**
 * called everytime the player right clicks this block
 */
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
        EntityPlayer player, int i2, float a, float b, float c) {
    FMLNetworkHandler.openGui(player, RpgInventoryMod.instance, 2, world,
            x, y, z);
    return true;
}
项目:rpginventory    文件:PacketOpenRpgInventory.java   
@Override
public IMessage onMessage(PacketOpenRpgInventory message, MessageContext ctx) {
    EntityPlayerMP p = ctx.getServerHandler().playerEntity;
    World world = p.worldObj;

    FMLNetworkHandler.openGui(p, RpgInventoryMod.instance, 1, world, (int)p.posX, (int)p.posY, (int)p.posZ);

    return null;
}