当前位置: 首页>>代码示例>>Java>>正文


Java FMLNetworkHandler.openGui方法代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui方法的典型用法代码示例。如果您正苦于以下问题:Java FMLNetworkHandler.openGui方法的具体用法?Java FMLNetworkHandler.openGui怎么用?Java FMLNetworkHandler.openGui使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.fml.common.network.internal.FMLNetworkHandler的用法示例。


在下文中一共展示了FMLNetworkHandler.openGui方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBlockActivated

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
		EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
	if (!worldIn.isRemote)
		
		if (state.getValue(HOLDER))
			FMLNetworkHandler.openGui(playerIn, TF2weapons.instance, 2, worldIn, pos.getX(), pos.getY(),
					pos.getZ());
		else
			for (int x = -1; x < 2; x++)
				for (int y = -1; y < 2; y++)
					for (int z = -1; z < 2; z++)
						if (worldIn.getBlockState(pos.add(x, y, z)).getBlock() instanceof BlockUpgradeStation
								&& worldIn.getBlockState(pos.add(x, y, z)).getValue(HOLDER)) {
							FMLNetworkHandler.openGui(playerIn, TF2weapons.instance, 2, worldIn, pos.getX() + x,
									pos.getY() + y, pos.getZ() + z);
							return true;
						}
	return true;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:21,代码来源:BlockUpgradeStation.java

示例2: processInteract

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
	if (!(player.getHeldItemMainhand() != null
			&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
			&& (this.getOwner() == player || this.getAttackTarget() == null || this.friendly) && this.isEntityAlive() && !this.isTrading()
			&& !this.isChild() && !player.isSneaking()) {
		if (this.world.isRemote && player.getTeam() == null
				&& ((this.getCapability(TF2weapons.WEAPONS_CAP, null).state & 1) == 0 || this.friendly)
				&& !player.isCreative())
			ClientProxy.displayScreenConfirm("Choose a team to interact",
					"Visit the Mann Co. Store located in a village");
		if (!this.world.isRemote && (TF2Util.isOnSameTeam(this, player) || player.isCreative())
				&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
			this.setCustomer(player);
			FMLNetworkHandler.openGui(player, TF2weapons.instance, 4, world, this.getEntityId(), 0, 0);
		}

		player.addStat(StatList.TALKED_TO_VILLAGER);
		return true;
	} else
		return super.processInteract(player, hand);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:23,代码来源:EntityTF2Character.java

示例3: processInteract

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
	EntityLivingBase owner = this.getOwner();
	if (owner != null) {
		if (owner.equals(player)) {
			if (!player.isSneaking()) {
				FMLNetworkHandler.openGui(player, Overlord.instance, hashCode(), world, (int) this.posX, (int) this.posY, (int) this.posZ);
				return true;
			} else {
				if (!world.isRemote) {
					ItemStack stack = player.getHeldItem(hand);
					if (!stack.isEmpty()) {
						if (stack.getItem() == Overlord.converted_spawner) {
							NBTTagCompound compound = new NBTTagCompound();
							this.writeEntityToNBT(compound);
							stack.setTagCompound(compound);
						}
					}
				}
			}
		}
	}
	return super.processInteract(player, hand);
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:25,代码来源:EntityConvertedSkeleton.java

示例4: processInteract

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
	EntityLivingBase owner = this.getOwner();
	if (owner != null) {
		if (owner.equals(player)) {
			if (!player.isSneaking()) {
				FMLNetworkHandler.openGui(player, Overlord.instance, hashCode(), world, (int) this.posX, (int) this.posY, (int) this.posZ);
				return true;
			} else {
				if (!world.isRemote) {
					ItemStack itemStackUsing = player.getHeldItem(hand);
					if (!itemStackUsing.isEmpty()) {
						if (itemStackUsing.getItem() == Overlord.baby_spawner) {
							NBTTagCompound compound = new NBTTagCompound();
							this.writeEntityToNBT(compound);
							itemStackUsing.setTagCompound(compound);
						}
					}
				}
			}
		}
	}
	return super.processInteract(player, hand);
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:25,代码来源:EntityBabySkeleton.java

示例5: processInteract

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
	if (this.getOwner() != null) {
		if (this.getOwner().equals(player)) {
			if (!player.isSneaking()) {
				FMLNetworkHandler.openGui(player, Overlord.instance, hashCode(), world, (int) this.posX, (int) this.posY, (int) this.posZ);
				return true;
			} else {
				if (!world.isRemote) {
					ItemStack stack = player.getHeldItem(hand);
					if (!stack.isEmpty()) {
						if (stack.getItem() == Overlord.warrior_spawner) {
							NBTTagCompound compound = new NBTTagCompound();
							this.writeEntityToNBT(compound);
							stack.setTagCompound(compound);
						}
					}
				}
			}
		}
	}
	return super.processInteract(player, hand);
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:24,代码来源:EntitySkeletonWarrior.java

示例6: onItemRightClick

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
@Nonnull
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, @Nonnull EnumHand hand) {
	ItemStack stack = playerIn.getHeldItem(hand);
	if (stack.getTagCompound() == null)
		stack.setTagCompound(new NBTTagCompound());
	if (!stack.getTagCompound().hasKey("Owner")) {
		stack.getTagCompound().setString("Owner", playerIn.getUniqueID().toString());
		stack.getTagCompound().setString("OwnerName", playerIn.getDisplayNameString());
		return new ActionResult(EnumActionResult.SUCCESS, stack);
	} else if (canOpenGui) {
		if (stack.getTagCompound().getString("Owner").equals(playerIn.getUniqueID().toString())) {
			FMLNetworkHandler.openGui(playerIn, Overlord.instance, -1, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);
			if (consumable)
				stack.shrink(1);
			return new ActionResult(EnumActionResult.SUCCESS, stack);
		} else {
			return new ActionResult(EnumActionResult.FAIL, stack);
		}
	} else {
		return new ActionResult(EnumActionResult.PASS, stack);
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:25,代码来源:ItemOverlordsSeal.java

示例7: processInteract

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
    ItemStack itemstack = player.getHeldItem(hand);
    boolean flag = itemstack.getItem() == Items.NAME_TAG;

    if (flag) {
        return itemstack.interactWithEntity(player, this, hand);
    } else if (this.isEntityAlive() && !this.isTrading()) {
        if (this.buyingList == null) {
            this.populateBuyingList();
        }

        if (!this.buyingList.isEmpty()) {
            FMLNetworkHandler.openGui(player, AOTA.instance, hashCode(), world, (int) posX, (int) posY, (int) posZ);
            if (!this.world.isRemote)
                this.setCustomer(player);
            return true;
        } else {
            AOTA.logWarn("Tradeable entity " + hashCode() + " has an empty buyingList.");
            return super.processInteract(player, hand);
        }
    } else {
        return super.processInteract(player, hand);
    }
}
 
开发者ID:CountGrimhart,项目名称:Count-Armours,代码行数:26,代码来源:EntityTradeable.java

示例8: onBlockActivated

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
	if(worldIn.isRemote)
		return true;
	else if(!playerIn.isSneaking()){
		TileEntity tileentity = worldIn.getTileEntity(pos);

		if (tileentity instanceof TileEntityDehydrator)
		{
			FMLNetworkHandler.openGui(playerIn, PSC.MODID, 0, worldIn, pos.getX(), pos.getY(), pos.getZ());
		}
		return true;
	}else
		return false;
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Sugar-Cane-Uses,代码行数:17,代码来源:BlockDehydrator.java

示例9: onBlockActivated

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof ForgeTeslaTileEntity)
        {
            FMLNetworkHandler.openGui(playerIn, AlloycraftMain.instance, AlloycraftMain.guiIDForgeTesla, worldIn, pos.getX(), pos.getY(), pos.getZ());
        }

        return true;
    }
}
 
开发者ID:AshIndigo,项目名称:Alloycraft,代码行数:19,代码来源:ForgeTeslaBlock.java

示例10: onBlockActivated

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof ForgeTileEntity)
        {
            FMLNetworkHandler.openGui(playerIn, AlloycraftMain.instance, AlloycraftMain.guiIDForge, worldIn, pos.getX(), pos.getY(), pos.getZ());
        }

        return true;
    }
}
 
开发者ID:AshIndigo,项目名称:Alloycraft,代码行数:19,代码来源:ForgeBlock.java

示例11: onBlockActivated

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos,
		IBlockState state, EntityPlayer entity, EnumFacing side,
		float x, float y, float z) 
{
	int X = (int) x;
	int Y = (int) y;
	int Z = (int) z;
	
	if (!world.isRemote) 
	{
		FMLNetworkHandler.openGui(entity, Talismans2.instance, 0, world, X,Y, Z);
		System.out.print("OPEN GUI MAYBE");
	}

	return true;
}
 
开发者ID:TeamC4,项目名称:Talismans2,代码行数:18,代码来源:BlockTalismanCrafter.java

示例12: onBlockActivated

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand,
		ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) {
	if (world.isRemote) return true;

	else {
		TileEntityNuclearIOPort te = (TileEntityNuclearIOPort) world.getTileEntity(blockPos);
		if (te != null) {
			if (player.getActiveItemStack() == null || !(player.getActiveItemStack().getItem() instanceof ItemWrench)) FMLNetworkHandler
					.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityNuclearIOPort.class),
							world, blockPos.getX(), blockPos.getY(), blockPos.getZ());

			else return false;
		}
		
		return true;
	}
}
 
开发者ID:hockeyhurd,项目名称:Project-Zed,代码行数:19,代码来源:BlockNuclearIOPort.java

示例13: onBlockActivated

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack stack,
		EnumFacing side, float hitX, float hitY, float hitZ) {
	if (world.isRemote) return true;

	else {
		AbstractTileEntityMachine te = (AbstractTileEntityMachine) world.getTileEntity(blockPos);
		if (te != null) {
			if (stack == null || !(stack.getItem() instanceof ItemWrench))
				FMLNetworkHandler
						.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialHarvester.class),
								world, blockPos.getX(), blockPos.getY(), blockPos.getZ());

			else return false;
		}

		return true;
	}
}
 
开发者ID:hockeyhurd,项目名称:Project-Zed,代码行数:20,代码来源:BlockIndustrialHarvester.java

示例14: onBlockActivated

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand,
		ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) {
	if (world.isRemote) return true;

	else {
		TileEntityIndustrialQuarry te = (TileEntityIndustrialQuarry) world.getTileEntity(blockPos);
		if (te != null) {
			if (stack == null || !(stack.getItem() instanceof ItemWrench)) {
				FMLNetworkHandler
						.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialQuarry.class), world,
								blockPos.getX(), blockPos.getY(), blockPos.getZ());
				player.addChatComponentMessage(ChatUtils.createComponent(false, "is done: " + te.isDone()));
			}

			else return false;
		}

		return true;
	}

	// player.addChatComponentMessage(ChatUtils.createComponent(false, "is done: " + te.isDone()));
}
 
开发者ID:hockeyhurd,项目名称:Project-Zed,代码行数:24,代码来源:BlockIndustrialQuarry.java

示例15: onBlockActivated

import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumHand hand, ItemStack stack,
		EnumFacing side, float hitX, float hitY, float hitZ) {
	if (world.isRemote) return true;

	else {
		AbstractTileEntityMachine te = (AbstractTileEntityMachine) world.getTileEntity(blockPos);
		if (te != null) {
			if (stack == null || !(stack.getItem() instanceof ItemWrench))
				FMLNetworkHandler
						.openGui(player, ProjectZed.instance, TileEntityRegistry.instance().getID(TileEntityIndustrialFurnace.class),
								world, blockPos.getX(), blockPos.getY(), blockPos.getZ());

			else return false;
		}

		return true;
	}
}
 
开发者ID:hockeyhurd,项目名称:Project-Zed,代码行数:20,代码来源:BlockIndustrialFurnace.java


注:本文中的net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。