net.minecraft.util.ActionResult类的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中net.minecraft.util.ActionResult类的一些代码示例,展示了ActionResult类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ActionResult类的具体详情如下:
包路径:net.minecraft.util.ActionResult
类名称:ActionResult

ActionResult介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
{
  Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
  return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
 ItemStack itemStackIn = playerIn.getHeldItem(hand);
 return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn);

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

p.posZ += dir.zOffset;
dispensedItem = tm.onItemRightClick( w, p, null ).getResult();

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(@Nonnull World world, EntityPlayer player, @Nonnull EnumHand hand) {
  ItemStack stack = player.getHeldItem(hand);
  // Copy from superclass with our own check
  boolean flag = canFire(stack, player);
  ActionResult<ItemStack> ret = ForgeEventFactory.onArrowNock(stack, world, player, hand, flag);
  if (ret != null) return ret;
  if (!player.capabilities.isCreativeMode && !flag)
  {
    return new ActionResult<>(EnumActionResult.FAIL, stack);
  }
  else
  {
    player.setActiveHand(hand);
    return new ActionResult<>(EnumActionResult.SUCCESS, stack);
  }
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

playerIn.getCooldownTracker().setCooldown(itemStackIn.getItem(), 4);
return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn);

代码示例来源:origin: SlimeKnights/TinkersConstruct

if(!ToolHelper.isBroken(itemStackIn)) {
 playerIn.setActiveHand(hand);
 return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
return new ActionResult<>(EnumActionResult.FAIL, itemStackIn);

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  ItemStack stack = player.getHeldItem(hand);
  if(player.capabilities.isCreativeMode || PlayerHelper.hasAmmo(player, AMMO_FUNC)) {
    player.setActiveHand(hand);
    return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
  }
  return ActionResult.newResult(EnumActionResult.PASS, stack);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
{
  if( p.isSneaking() )
  {
    this.encode( p.getHeldItem( hand ), p );
    p.swingArm( hand );
    return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
  }
  return new ActionResult<>( EnumActionResult.PASS, p.getHeldItem( hand ) );
}

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  player.openGui(Botania.instance, LibGuiIDs.BAUBLE_BOX, world, hand == EnumHand.OFF_HAND ? 1 : 0, 0, 0);
  return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
{
  this.clearPattern( player.getHeldItem( hand ), player );
  return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
}

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  player.setActiveHand(hand);
  return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

public class ItemTinkerBook extends Item {

 public ItemTinkerBook() {
  this.setCreativeTab(TinkerRegistry.tabGeneral);
  this.setMaxStackSize(1);
 }

 @Nonnull
 @Override
 public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
  ItemStack itemStack = playerIn.getHeldItem(handIn);
  if(worldIn.isRemote) {
   TinkerBook.INSTANCE.openGui(itemStack);
  }
  return new ActionResult<>(EnumActionResult.SUCCESS, itemStack);
 }

 @Override
 public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
  if(I18n.canTranslate(super.getUnlocalizedName(stack) + ".tooltip")) {
   tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() + LocUtils.translateRecursive(super.getUnlocalizedName(stack) + ".tooltip")));
  }
 }
}

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  player.setActiveHand(hand);
  return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public ActionResult<ItemStack> onItemRightClick( final World world, final EntityPlayer player, final EnumHand hand )
{
  this.disassembleDrive( player.getHeldItem( hand ), world, player );
  return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
}

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  player.setActiveHand(hand);
  return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
{
  if( Platform.isServer() )
  {
    Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
  }
  p.swingArm( hand );
  return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
}

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  player.setActiveHand(hand);
  return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
{
  AEApi.instance().registries().wireless().openWirelessTerminalGui( player.getHeldItem( hand ), w, player );
  return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
}

代码示例来源:origin: Vazkii/Botania

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  player.openGui(Botania.instance, LibGuiIDs.FLOWER_BAG, world, hand == EnumHand.OFF_HAND ? 1 : 0, 0, 0);
  return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
{
  if( Platform.isClient() )
  {
    final RayTraceResult mop = AppEng.proxy.getRTR();
    if( mop == null || mop.typeOfHit == RayTraceResult.Type.MISS )
    {
      NetworkHandler.instance().sendToServer( new PacketClick( BlockPos.ORIGIN, null, 0, 0, 0, hand ) );
    }
  }
  return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
}

相关文章

微信公众号

最新文章

更多