當前位置: 首頁>>代碼示例>>Java>>正文


Java FMLNetworkHandler類代碼示例

本文整理匯總了Java中cpw.mods.fml.common.network.internal.FMLNetworkHandler的典型用法代碼示例。如果您正苦於以下問題:Java FMLNetworkHandler類的具體用法?Java FMLNetworkHandler怎麽用?Java FMLNetworkHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FMLNetworkHandler類屬於cpw.mods.fml.common.network.internal包,在下文中一共展示了FMLNetworkHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBlockActivated

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:rodolphito,項目名稱:Rival-Rebels-Mod,代碼行數:21,代碼來源:BlockNuclearBomb.java

示例2: onEntityInteraction

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
@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));
        }
    }
}
 
開發者ID:jglrxavpok,項目名稱:CustomAI,代碼行數:24,代碼來源:EntityEvents.java

示例3: handlePacket

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
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();
		}
	}
 
開發者ID:ArtixAllMighty,項目名稱:rpginventory,代碼行數:22,代碼來源:PacketHandler.java

示例4: onBlockActivated

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
@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;
}
 
開發者ID:theflogat,項目名稱:ModJam-4-Mod,代碼行數:21,代碼來源:BlockLine.java

示例5: func_147326_c

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
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
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:27,代碼來源:NetHandlerLoginServer.java

示例6: func_147326_c

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
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));
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:21,代碼來源:NetHandlerLoginServer.java

示例7: onBlockActivated

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
@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;
	}
}
 
開發者ID:testmad,項目名稱:GaiaMod,代碼行數:18,代碼來源:GaiaAltarBlock.java

示例8: onBlockActivated

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
@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;
	}
}
 
開發者ID:testmad,項目名稱:GaiaMod,代碼行數:18,代碼來源:EssenceAltarBlock.java

示例9: onBlockActivated

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
@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;
	}
}
 
開發者ID:testmad,項目名稱:GaiaMod,代碼行數:18,代碼來源:OrderShrineBlock.java

示例10: interactFirst

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
@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;
}
 
開發者ID:rodolphito,項目名稱:Rival-Rebels-Mod,代碼行數:16,代碼來源:EntityLaptop.java

示例11: onBlockActivated

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:rodolphito,項目名稱:Rival-Rebels-Mod,代碼行數:18,代碼來源:BlockTsarBomba.java

示例12: onBlockActivated

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:rodolphito,項目名稱:Rival-Rebels-Mod,代碼行數:16,代碼來源:BlockReciever.java

示例13: onBlockActivated

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:rodolphito,項目名稱:Rival-Rebels-Mod,代碼行數:16,代碼來源:BlockReactor.java

示例14: onBlockActivated

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:rodolphito,項目名稱:Rival-Rebels-Mod,代碼行數:16,代碼來源:BlockLoader.java

示例15: onBlockActivated

import cpw.mods.fml.common.network.internal.FMLNetworkHandler; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:rodolphito,項目名稱:Rival-Rebels-Mod,代碼行數:17,代碼來源:BlockLaptop.java


注:本文中的cpw.mods.fml.common.network.internal.FMLNetworkHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。