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