本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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()));
}
示例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;
}
}