net.minecraft.util.ActionResult.<init>()方法的使用及代码示例

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

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

ActionResult.<init>介绍

暂无

代码示例

代码示例来源: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: 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

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

代码示例来源: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: 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: 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: 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: 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: 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: 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 ) );
}

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

ItemStack itemStackIn = playerIn.getHeldItem(hand);
playerIn.setActiveHand(hand);
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);

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

@Override
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
{
  final RayTraceResult target = this.rayTrace( w, p, true );
  if( target == null )
  {
    return new ActionResult<>( EnumActionResult.FAIL, p.getHeldItem( hand ) );
  }
  else
  {
    if( target.typeOfHit == RayTraceResult.Type.BLOCK )
    {
      final IBlockState state = w.getBlockState( target.getBlockPos() );
      if( state.getMaterial() == Material.LAVA || state.getMaterial() == Material.WATER )
      {
        if( Platform.hasPermissions( new DimensionalCoord( w, target.getBlockPos() ), p ) )
        {
          this.onItemUse( p, w, target.getBlockPos(), hand, EnumFacing.UP, 0.0F, 0.0F, 0.0F );
        }
      }
    }
  }
  return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
}

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

return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
return new ActionResult<>(EnumActionResult.FAIL, itemStackIn);

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

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

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

return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
        if( ammo == null )
          return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
        if( aeAmmo == null )
          return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
          return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
      return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
return new ActionResult<>( EnumActionResult.FAIL, p.getHeldItem( hand ) );

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

if(playerIn.canEat(false) && getUses(itemStackIn) > 0) {
 playerIn.setActiveHand(hand);
 return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
 return new ActionResult<>(EnumActionResult.FAIL, itemStackIn);

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

assert statBase != null;
playerIn.addStat(statBase);
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);

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

ItemStack itemStackIn = playerIn.getHeldItem(hand);
playerIn.setActiveHand(hand);
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
@Nonnull
public ActionResult<ItemStack> onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
 if (!world.isRemote && player.isSneaking()) {
  ModObject.itemBasicItemFilter.openGui(world, player.getPosition(), player, null, hand.ordinal());
  return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
 }
 return super.onItemRightClick(world, player, hand);
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
@Nonnull
public ActionResult<ItemStack> onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
 if (!world.isRemote && player.isSneaking()) {
  ModObject.itemModItemFilter.openGui(world, player.getPosition(), player, null, hand.ordinal());
  return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
 }
 return super.onItemRightClick(world, player, hand);
}

相关文章