コード例 #1
0
  @Override
  public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer player) {
    world.playSoundAtEntity(
        player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!world.isRemote)
      world.spawnEntityInWorld(
          new EntityProjectileEnhancedEnderPearl(
              world, player, EnhancementRegistry.getEnhancementList(is)));
    if (!player.capabilities.isCreativeMode) --is.stackSize;
    return is;
  }
コード例 #2
0
  public static void register() {
    EnhancementData<SpatialDashGemEnhancements> data =
        EnhancementRegistry.registerEnhancement(
            new Item[] {ItemList.spatial_dash_gem}, SpatialDashGemEnhancements.class);

    data.register(CAPACITY)
        .setMaxLevel(3)
        .addPowder(2, amount -> amount * 1.5F)
        .addIngredient(ItemList.ancient_dust, 5, amount -> amount * 1.5F);

    data.register(RANGE)
        .setMaxLevel(3)
        .addPowder(2, amount -> amount * 1.5F)
        .addIngredient(Items.ender_pearl, 5, amount -> amount * 1.5F)
        .addIngredient(Items.ender_pearl, 5, amount -> amount * 3F)
        .addIngredient(ItemList.stardust, 12, amount -> amount * amount * 5, 2);

    data.register(SPEED).setMaxLevel(3).addPowder(2, amount -> amount * 1.5F);
  }
コード例 #3
0
 @Override
 @SideOnly(Side.CLIENT)
 public void addInformation(
     ItemStack is, EntityPlayer player, List textLines, boolean showAdvancedInfo) {
   EnhancementRegistry.getEnhancementList(is).addTooltip(textLines, EnumChatFormatting.YELLOW);
 }