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

x33g5p2x  于2022-01-19 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(99)

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

EnumHand.ordinal介绍

暂无

代码示例

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

public PacketPartPlacement( final BlockPos pos, final EnumFacing face, final float eyeHeight, final EnumHand hand )
{
  final ByteBuf data = Unpooled.buffer();
  data.writeInt( this.getPacketID() );
  data.writeInt( pos.getX() );
  data.writeInt( pos.getY() );
  data.writeInt( pos.getZ() );
  data.writeByte( face.ordinal() );
  data.writeFloat( eyeHeight );
  data.writeByte( hand.ordinal() );
  this.configureWrite( data );
}

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

public PacketClick( final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand, boolean leftClick )
{
  final ByteBuf data = Unpooled.buffer();
  data.writeInt( this.getPacketID() );
  data.writeInt( this.x = pos.getX() );
  data.writeInt( this.y = pos.getY() );
  data.writeInt( this.z = pos.getZ() );
  if( side == null )
  {
    data.writeByte( -1 );
  }
  else
  {
    data.writeByte( side.ordinal() );
  }
  data.writeFloat( this.hitX = hitX );
  data.writeFloat( this.hitY = hitY );
  data.writeFloat( this.hitZ = hitZ );
  data.writeByte( hand.ordinal() );
  data.writeBoolean( this.leftClick = leftClick );
  this.configureWrite( data );
}

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

public PacketDrainStaff(int powerUse, EnumHand hand) {
 this.powerUse = powerUse;
 this.hand = hand.ordinal();
}

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

@Override
public void toBytes(ByteBuf buffer) {
 buffer.writeByte(hand.ordinal());
}

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

public PacketTravelEvent(BlockPos pos, int powerUse, boolean conserveMotion, TravelSource source, EnumHand hand) {
 this.pos = pos.toLong();
 this.powerUse = powerUse;
 this.conserveMotion = conserveMotion;
 this.source = source.ordinal();
 this.hand = (hand == null ? EnumHand.MAIN_HAND : hand).ordinal();
}

代码示例来源:origin: sinkillerj/ProjectE

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand)
{
  if (!world.isRemote)
  {
    player.openGui(PECore.instance, Constants.ALCH_BAG_GUI, world, hand.ordinal(), -1, -1);
  }
  
  return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(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.itemPowerItemFilter.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.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);
}

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

@Override
@Nonnull
public ActionResult<ItemStack> onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
 if (!world.isRemote && player.isSneaking()) {
  ModObject.itemFluidFilter.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()) {
  ForestryIntegrationObject.itemSpeciesItemFilter.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 worldIn, @Nonnull EntityPlayer playerIn, @Nonnull EnumHand handIn) {
 if (!worldIn.isRemote && playerIn.isSneaking()) {
  ModObject.itemExistingItemFilter.openGui(worldIn, playerIn.getPosition(), playerIn, null, handIn.ordinal());
  return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn));
 }
 return super.onItemRightClick(worldIn, playerIn, handIn);
}

代码示例来源:origin: Mine-and-blade-admin/Battlegear2

@Override
  public float apply(@Nonnull ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
    if (stack.getItem() instanceof IArrowContainer2 && entityIn != null && entityIn.isHandActive()) {
      EnumHand hand = EnumHand.values()[entityIn.getActiveHand().ordinal() + 1 % 2];
      if(entityIn.getHeldItem(hand) == stack){
        return 1;
      }
    }
    return 0;
  }
};

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

@Override
public @Nonnull ActionResult<ItemStack> onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
 ItemStack stack = player.getHeldItem(hand);
 if (player.isSneaking() && TelepadTarget.readFromNBT(stack) != null) {
  ModObjectRegistry.getModObjectNN(this).openClientGui(world, player, GUI_ID_LOCATION_PRINTOUT, hand.ordinal(), 0);
  return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
 }
 return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
}

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

@Override
@Nonnull
public ActionResult<ItemStack> onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
 if (!world.isRemote && player.isSneaking()) {
  ModObjectRegistry.getModObjectNN(this).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()) {
  ModObjectRegistry.getModObjectNN(this).openGui(world, player.getPosition(), player, null, hand.ordinal());
  return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
 }
 return super.onItemRightClick(world, player, hand);
}

代码示例来源:origin: GregTechCE/GregTech

@Override
protected void writeHolderToSyncData(PacketBuffer syncData, PlayerInventoryHolder holder) {
  syncData.writeByte(holder.hand.ordinal());
  syncData.writeItemStack(holder.getCurrentItem());
}

代码示例来源:origin: blay09/CookingForBlockheads

@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
  player.openGui(CookingForBlockheads.instance, GuiHandler.ITEM_RECIPE_BOOK, world, hand.ordinal(), 0, 0);
  return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

@Override
public void getPayload(
    final PacketBuffer buffer )
{
  writeBitLoc( from, buffer );
  writeBitLoc( to, buffer );
  buffer.writeEnumValue( place );
  buffer.writeVarIntToBuffer( side.ordinal() );
  buffer.writeVarIntToBuffer( mode.ordinal() );
  buffer.writeVarIntToBuffer( hand.ordinal() );
}

代码示例来源:origin: raoulvdberge/refinedstorage

@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
  ItemStack stack = player.getHeldItem(hand);
  if (!world.isRemote) {
    if (player.isSneaking()) {
      return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RSItems.FILTER));
    }
    player.openGui(RS.INSTANCE, RSGui.FILTER, world, hand.ordinal(), 0, 0);
    return new ActionResult<>(EnumActionResult.SUCCESS, stack);
  }
  return new ActionResult<>(EnumActionResult.PASS, stack);
}

相关文章

微信公众号

最新文章

更多