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


Java EntityPlayer.openGui方法代码示例

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


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

示例1: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player,
    EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
    player.openGui(ModMain.modInstance, BBGuiHandler.WICKER_BASKET_ID, world, pos.getX(), pos.getY(), pos.getZ());
    return true;
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:8,代码来源:BlockWickerBasket.java

示例2: openGui

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private boolean openGui(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn)
{
    Optional<ContentGuiBase> gui = getGui(state);

    if (gui.isPresent())
    {
        if (worldIn.isRemote)
        {
            return true;
        } else
        {
            playerIn.openGui(CustomStuff4.INSTANCE, gui.get().getGuiId(), worldIn, pos.getX(), pos.getY(), pos.getZ());

            return true;
        }
    }

    return false;
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:20,代码来源:BlockMixin.java

示例3: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if(!worldIn.isRemote) {
        TileEntity te = worldIn.getTileEntity(pos);
        if(te != null && te instanceof TileFluidTank) {
            ItemStack activeHand = playerIn.getHeldItem(hand);
            if(!activeHand.isEmpty() && FluidUtil.getFluidHandler(activeHand) !=  null) {
                FluidTank ft = ((TileFluidTank) te).getTank();
                boolean canFillPrev = ft.canFill();
                boolean canDrainPrev = ft.canDrain();
                ft.setCanFill(true);
                ft.setCanDrain(true);
                try {
                    FluidUtil.interactWithFluidHandler(playerIn, hand, ft);
                } finally {
                    ft.setCanFill(canFillPrev);
                    ft.setCanDrain(canDrainPrev);
                }
                return true;
            }
            playerIn.openGui(ModularMachinery.MODID, CommonProxy.GuiType.TANK_INVENTORY.ordinal(), worldIn, pos.getX(), pos.getY(), pos.getZ());
        }
    }
    return true;
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:26,代码来源:BlockFluidOutputHatch.java

示例4: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (worldIn.getTileEntity(pos) == null)
        createNewTileEntity(worldIn, getMetaFromState(state));
    playerIn.openGui(FoodCraftReloaded.INSTANCE, GuiID.SMELTING_PRESSURE_COOKER, worldIn, pos.getX(), pos.getY(), pos.getZ());
    return true;
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:8,代码来源:BlockSmeltingDrinkMachine.java

示例5: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    playerIn.openGui(ToolBelt.instance, GuiHandler.BELT, worldIn, hand.ordinal(), 0, 0);

    return new ActionResult<>(EnumActionResult.SUCCESS, playerIn.getHeldItem(hand));
}
 
开发者ID:gigaherz,项目名称:ToolBelt,代码行数:8,代码来源:ItemToolBelt.java

示例6: onItemUse

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if(worldIn.isRemote && getAssociatedMachine(player.getHeldItem(hand)) != null) {
        player.openGui(ModularMachinery.MODID, CommonProxy.GuiType.BLUEPRINT_PREVIEW.ordinal(), worldIn, hand == EnumHand.MAIN_HAND ? 0 : 1, 0, 0);
    }
    return EnumActionResult.SUCCESS;
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:8,代码来源:ItemBlueprint.java

示例7: showActionOptions

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public static void showActionOptions(ActionOptions options, int guiid) {
    EntityPlayer player = MeeCreeps.proxy.getClientPlayer();
    World worldIn = MeeCreeps.proxy.getClientWorld();
    BlockPos pos = options.getTargetPos();
    lastOptions = options;
    player.openGui(MeeCreeps.instance, guiid, worldIn, pos.getX(), pos.getY(), pos.getZ());
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:8,代码来源:ClientActionManager.java

示例8: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing dir, float x, float y, float z) {
	if (!world.isRemote) {
		ItemStack stack = player.getHeldItem(hand);
		if (stack.getItem() instanceof ItemUpgrade) {
			if (InventoryUtils.addStackToInventory(stack, (TileEntityUpgradeStation) world.getTileEntity(pos))) {
				stack.setCount(0);
				return true;
			}
		}
		player.openGui(MiningWells.instance, ModGuiHandler.GUI_UPGRADE_STATION, world, pos.getX(), pos.getY(), pos.getZ());
	}
	return true;
}
 
开发者ID:cjburkey01,项目名称:MiningWells,代码行数:14,代码来源:BlockUpgradeStation.java

示例9: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) {
    if (player.isSneaking()) return false;
    TileEntity te = world.getTileEntity(pos);
    if (!world.isRemote && te instanceof TileEntityPressureChamberValve) {
        if (((TileEntityPressureChamberValve) te).multiBlockSize > 0) {
            player.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.PRESSURE_CHAMBER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
        } else if (((TileEntityPressureChamberValve) te).accessoryValves.size() > 0) { // when
            // this
            // isn't
            // the
            // core
            // Valve,
            // track
            // down
            // the
            // core
            // Valve.
            //  System.out.println("size: " + ((TileEntityPressureChamberValve)te).accessoryValves.size());
            for (TileEntityPressureChamberValve valve : ((TileEntityPressureChamberValve) te).accessoryValves) {
                if (valve.multiBlockSize > 0) {
                    player.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.PRESSURE_CHAMBER.ordinal(), world, valve.getPos().getX(), valve.getPos().getY(), valve.getPos().getZ());
                    break;
                }
            }
        } else {
            return false;
        }
        return true;
    }
    return true;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:33,代码来源:BlockPressureChamberValve.java

示例10: onItemUse

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    player.openGui(ToolBelt.instance, GuiHandler.BELT, worldIn, hand.ordinal(), 0, 0);

    return EnumActionResult.SUCCESS;
}
 
开发者ID:gigaherz,项目名称:ToolBelt,代码行数:8,代码来源:ItemToolBelt.java

示例11: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if(!worldIn.isRemote) {
        playerIn.openGui(PrimalChests.INSTANCE, 1, worldIn, pos.getX(), pos.getY(), pos.getZ());
    }
    return true;
}
 
开发者ID:jaredlll08,项目名称:PrimalChests,代码行数:8,代码来源:BlockPrimalChestAdvanced.java

示例12: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand){
	ItemStack stack = player.getHeldItem(hand);
	if (isComplete(stack) && !isLearned(stack)){
		player.openGui(Melodium.instance, hand == EnumHand.MAIN_HAND ? GuiLearnSpell.MAIN_ID : GuiLearnSpell.OFF_ID, world, (int)player.posX, (int)player.posY, (int)player.posZ);
	}
	return new ActionResult<ItemStack>(EnumActionResult.FAIL,stack);
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:9,代码来源:ItemCompositionPaper.java

示例13: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
		EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {

	if(!(worldIn.getTileEntity(pos) instanceof TileEntityPan) || hand == EnumHand.OFF_HAND)
		return false;

	playerIn.openGui(ExSartagine.instance, 0, worldIn, pos.getX(), pos.getY(), pos.getZ());
	return true;
}
 
开发者ID:ArtixAllMighty,项目名称:ExSartagine,代码行数:11,代码来源:BlockPan.java

示例14: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	if (world.isRemote) return true;
	TileEntityBarrel barrel = (TileEntityBarrel) world.getTileEntity(pos);
	world.notifyBlockUpdate(pos, state, state, 3);
	ItemStack stack = player.getHeldItem(hand);
	if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
		IFluidHandlerItem itemHandler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
		IFluidHandler barrelHandler = barrel.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null);
		FluidStack fluidInItem = itemHandler.drain(Fluid.BUCKET_VOLUME, false);
		FluidStack fluidInBarrel = barrelHandler.drain(Fluid.BUCKET_VOLUME, false);
		if ((fluidInBarrel != null && fluidInBarrel.amount > 0) && (fluidInItem == null || fluidInItem.amount == 0 || (fluidInItem.isFluidEqual(fluidInBarrel) && fluidInItem.amount < Fluid.BUCKET_VOLUME))) {
			itemHandler.fill(barrelHandler.drain(Fluid.BUCKET_VOLUME, true), true);
			player.setHeldItem(hand, itemHandler.getContainer());
		} else if (fluidInItem != null && fluidInItem.amount > 0 && fluidInItem.getFluid() != null && (fluidInBarrel == null || fluidInBarrel.amount == 0 || (fluidInBarrel.amount < Fluid.BUCKET_VOLUME && fluidInBarrel.isFluidEqual(fluidInItem)))) {
			FluidStack fsin = itemHandler.drain(Fluid.BUCKET_VOLUME, true);
			if (fsin != null && fsin.amount > 0 && fsin.getFluid() != null) {
				barrelHandler.fill(fsin, true);
				player.setHeldItem(hand, itemHandler.getContainer());
				player.inventory.markDirty();
			}
		}
		return true;
	}

	player.openGui(Bewitchment.instance, LibGui.BARREL.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
	return true;
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:29,代码来源:BlockBarrel.java

示例15: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if(!worldIn.isRemote) {
        playerIn.openGui(PrimalChests.INSTANCE, 0, worldIn, pos.getX(), pos.getY(), pos.getZ());
    }
    return true;
}
 
开发者ID:jaredlll08,项目名称:PrimalChests,代码行数:8,代码来源:BlockPrimalChest.java


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