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

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

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

ActionResult.newResult介绍

暂无

代码示例

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

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  ItemStack stack = player.getHeldItem(hand);
  if(player.canEat(false) && isRightPlayer(player, stack)) {
    player.setActiveHand(hand);
    return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
  }
  return ActionResult.newResult(EnumActionResult.PASS, stack);
}

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

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

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

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

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

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  ItemStack stack = player.getHeldItem(hand);
  if(getBlock(stack) != null && player.isSneaking()) {
    int dmg = stack.getItemDamage();
    stack.setItemDamage(~dmg & 1);
    player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 0.3F, 0.1F);
    return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
  }
  return ActionResult.newResult(EnumActionResult.PASS, stack);
}

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

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  ItemStack stack = player.getHeldItem(hand);
  if(ManaItemHandler.requestManaExact(stack, player, COST_SELF, false)) {
    if(!player.world.isRemote)
      player.displayGUIChest(player.getInventoryEnderChest());
    ManaItemHandler.requestManaExact(stack, player, COST_SELF, true);
    player.playSound(SoundEvents.ENTITY_ENDERMEN_TELEPORT, 1F, 1F);
    return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
  }
  return ActionResult.newResult(EnumActionResult.PASS, stack);
}

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

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  ItemStack stack = player.getHeldItem(hand);
  int dmg = stack.getItemDamage();
  stack.setItemDamage(~dmg & 1);
  world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.NEUTRAL, 0.3F, 0.1F);
  return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}

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

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  ItemStack stack = player.getHeldItem(hand);
  if(player.isSneaking()) {
    if(!world.isRemote)
      setBindMode(stack, !getBindMode(stack));
    else player.playSound(ModSounds.ding, 0.1F, 1F);
  }
  return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}

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

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  if(!player.capabilities.isCreativeMode)
    player.getHeldItem(hand).shrink(1);
  world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
  if(!world.isRemote) {
    EntityVineBall ball = new EntityVineBall(player, true);
    ball.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
    world.spawnEntity(ball);
  }
  return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}

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

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  ItemStack stack = player.getHeldItem(hand);
  getMana(stack);
  int level = getLevel(stack);
  if(level != 0) {
    setEnabled(stack, !isEnabled(stack));
    if(!world.isRemote)
      world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.terraPickMode, SoundCategory.PLAYERS, 0.5F, 0.4F);
  }
  return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}

相关文章