當前位置: 首頁>>代碼示例>>Java>>正文


Java Items.APPLE屬性代碼示例

本文整理匯總了Java中net.minecraft.init.Items.APPLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Items.APPLE屬性的具體用法?Java Items.APPLE怎麽用?Java Items.APPLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.init.Items的用法示例。


在下文中一共展示了Items.APPLE屬性的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: test_getDroppedStacks_simple

@Test
public void test_getDroppedStacks_simple()
{
    BlockDrop drop1 = new BlockDrop(new WrappedItemStackConstant(new ItemStack(Items.APPLE)), IntRange.create(1, 1));
    BlockDrop drop2 = new BlockDrop(new WrappedItemStackConstant(new ItemStack(Items.STICK)), IntRange.create(2, 2));

    List<ItemStack> drops = ItemHelper.getDroppedStacks(new BlockDrop[] {drop1, drop2});
    ItemStack stack1 = drops.get(0);
    ItemStack stack2 = drops.get(1);

    assertSame(Items.APPLE, stack1.getItem());
    assertEquals(1, stack1.getCount());

    assertSame(Items.STICK, stack2.getItem());
    assertEquals(2, stack2.getCount());
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:16,代碼來源:ItemHelperTests.java

示例2: test_getDroppedStacks_range

@Test
public void test_getDroppedStacks_range()
{
    BlockDrop drop1 = new BlockDrop(new WrappedItemStackConstant(new ItemStack(Items.APPLE)), IntRange.create(1, 10));
    BlockDrop drop2 = new BlockDrop(new WrappedItemStackConstant(new ItemStack(Items.STICK)), IntRange.create(11, 20));

    List<ItemStack> drops = ItemHelper.getDroppedStacks(new BlockDrop[] {drop1, drop2});
    ItemStack stack1 = drops.get(0);
    ItemStack stack2 = drops.get(1);

    assertSame(Items.APPLE, stack1.getItem());
    assertTrue(stack1.getCount() >= 1 && stack1.getCount() <= 10);

    assertSame(Items.STICK, stack2.getItem());
    assertTrue(stack2.getCount() >= 11 && stack2.getCount() <= 20);
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:16,代碼來源:ItemHelperTests.java

示例3: doTest

private void doTest(boolean inOrder, boolean enoughDamage)
{
    DamageableShapelessOreRecipe recipe = new DamageableShapelessOreRecipe(new ResourceLocation("group"),
                                                                           new int[] {enoughDamage ? 5 : 5000, 0},
                                                                           new ItemStack(Blocks.DIRT), new ItemStack(Items.WOODEN_SWORD), new ItemStack(Items.APPLE));
    InventoryCrafting inv = new InventoryCrafting(new Container()
    {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn)
        {
            return false;
        }
    }, 3, 3);
    inv.setInventorySlotContents(inOrder ? 3 : 4, new ItemStack(Items.WOODEN_SWORD));
    inv.setInventorySlotContents(inOrder ? 4 : 3, new ItemStack(Items.APPLE));

    assertSame(enoughDamage, recipe.matches(inv, null));

    if (enoughDamage)
    {
        NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
        assertSame(Items.WOODEN_SWORD, remaining.get(inOrder ? 3 : 4).getItem());
        assertEquals(5, remaining.get(inOrder ? 3 : 4).getItemDamage());
    }
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:25,代碼來源:DamageableShapelessOreRecipeTest.java

示例4: test_getDrops

@Test
public void test_getDrops()
{
    ContentBlockSnow content = new ContentBlockSnow();
    content.id = "test_getDrops";
    content.snowball = new WrappedItemStackConstant(new ItemStack(Items.APPLE, 3));
    content.drop = Attribute.constant(new BlockDrop[] {new BlockDrop(new WrappedItemStackConstant(new ItemStack(Items.STICK)), IntRange.create(2, 2))});

    Block block = content.createBlock();

    NonNullList<ItemStack> drops = NonNullList.create();
    block.getDrops(drops, null, null, block.getDefaultState().withProperty(BlockSnow.LAYERS, 5), 0);
    ItemStack drop1 = drops.get(0);
    ItemStack drop2 = drops.get(1);

    assertEquals(2, drops.size());

    assertSame(Items.APPLE, drop1.getItem());
    assertEquals(18, drop1.getCount());

    assertSame(Items.STICK, drop2.getItem());
    assertEquals(2, drop2.getCount());
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:23,代碼來源:BlockSnowTest.java

示例5: test_addRecipe

@Test
public void test_addRecipe()
{
    ShapelessRecipe recipe = new ShapelessRecipe();
    recipe.recipeList = new ResourceLocation("testmod:recipes");
    recipe.items.add(new RecipeInputImpl("stickWood"));
    recipe.result = new WrappedItemStackConstant(new ItemStack(Items.APPLE));

    int prevRecipes = CraftingManagerCS4.getRecipes(recipe.recipeList).size();

    recipe.addRecipe();

    int newRecipes = CraftingManagerCS4.getRecipes(recipe.recipeList).size();

    assertEquals(prevRecipes + 1, newRecipes);
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:16,代碼來源:ShapelessRecipeTests.java

示例6: test_addRecipe

@Test
public void test_addRecipe() throws Exception
{
    ShapedRecipe recipe = new ShapedRecipe();
    recipe.recipeList = new ResourceLocation("testmod:recipes");
    recipe.shape = new String[] {"a"};
    recipe.items.put('a', new RecipeInputImpl("stickWood"));
    recipe.result = new WrappedItemStackConstant(new ItemStack(Items.APPLE));

    int prevRecipes = CraftingManagerCS4.getRecipes(recipe.recipeList).size();

    recipe.addRecipe();

    int newRecipes = CraftingManagerCS4.getRecipes(recipe.recipeList).size();

    assertEquals(prevRecipes + 1, newRecipes);
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:17,代碼來源:ShapedRecipeTests.java

示例7: test_getDroppedStacks_emptyStack

@Test
public void test_getDroppedStacks_emptyStack()
{
    BlockDrop drop = new BlockDrop(new WrappedItemStackConstant(new ItemStack(Items.APPLE)), IntRange.create(0, 0));

    List<ItemStack> drops = ItemHelper.getDroppedStacks(new BlockDrop[] {drop});

    assertTrue(drops.isEmpty());
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:9,代碼來源:ItemHelperTests.java

示例8: test_canApplyWithFilter

@Test
public void test_canApplyWithFilter() throws Exception
{
    ShiftClickRule rule = new ShiftClickRule();
    rule.from = new int[] {0, 3};
    rule.to = new int[] {5, 10};
    rule.filter = stack -> stack.getItem() == Items.APPLE;

    assertTrue(rule.canApply(0, new ItemStack(Items.APPLE)));
    assertFalse(rule.canApply(0, new ItemStack(Items.STICK)));
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:11,代碼來源:ShiftClickRuleTest.java

示例9: onLivingUpdate

@Override
public void onLivingUpdate() {
    super.onLivingUpdate();
    //Item stuff
    List<Item> listItems = ImmutableList.copyOf(Item.REGISTRY);
    //Random rand2 = new Random();
    int listSize = listItems.size();
    int randomInt = rand.nextInt(listSize);


    if(!this.world.isRemote && timeToDiamond == 0 || timeToDiamond == -1){
        Item item = new Item();
        if(!listItems.isEmpty()) {
            item = listItems.get(randomInt);
        }
        if(item.toString().equals("net.minecraft.item.null")){
            item = Items.APPLE;
        }

        this.playSound(SoundEvents.ENTITY_CHICKEN_EGG, 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
        this.dropItem(item, 1);
        this.timeToDiamond = this.rand.nextInt(6000) + 6000;

    }

    if(!world.isRemote && timeToDiamond > 0){
        timeToDiamond--;
        //System.out.println("SAUSAGE Time set to:" + timeToDiamond);

        //System.out.println(item);
    }
}
 
開發者ID:OCDiary,項目名稱:TheOink,代碼行數:32,代碼來源:OinkSausage.java

示例10: reload

@Override
  public void reload() {

if (this.parent != null) {
	
	this.parent.reload();
}

CRTADV.log.info("Hooking into advancements. {} existing advancements found.", Iterables.size(AdvancementManager.ADVANCEMENT_LIST.getAdvancements()));

      Map<ResourceLocation, Advancement.Builder> map = new HashMap<>();
      TextComponentString hello = new TextComponentString("hello");
      ItemStack icon = new ItemStack(Items.APPLE);
      DisplayInfo inf = new DisplayInfo(icon, hello, hello, null, FrameType.GOAL, true, true, false);
      AdvancementRewards rewardsIn = new AdvancementRewards(5, new ResourceLocation[0], new ResourceLocation[0], FunctionObject.CacheableFunction.EMPTY);
      Map<String, Criterion> crit = new HashMap<>();
      crit.put("test", new Criterion(new PlacedBlockTrigger.Instance(Blocks.DIAMOND_BLOCK, null, LocationPredicate.ANY, ItemPredicate.ANY)));
      Advancement advancement = new Advancement(new ResourceLocation("test"), AdvancementManager.ADVANCEMENT_LIST.getAdvancement(new ResourceLocation("minecraft:story/upgrade_tools")), inf, rewardsIn, crit, new String[0][0]);
      map.put(new ResourceLocation("test"), advancement.copy());
      System.out.println(AdvancementManager.ADVANCEMENT_LIST.getAdvancements());
      AdvancementManager.ADVANCEMENT_LIST.loadAdvancements(map);
      System.out.println(AdvancementManager.ADVANCEMENT_LIST.getAdvancements());
      
      for (Advancement advancement1 : ADVANCEMENT_LIST.getRoots())
      {
          if (advancement1.getDisplay() != null)
          {
              AdvancementTreeNode.layout(advancement1);
          }
      }
      
CRTADV.log.info("{} advancements found.", Iterables.size(AdvancementManager.ADVANCEMENT_LIST.getAdvancements()));
  }
 
開發者ID:jaredlll08,項目名稱:CraftTweaker-Advancements,代碼行數:33,代碼來源:AdvancementManagerWrapper.java

示例11: getTabIconItem

public ItemStack getTabIconItem()
{
    return new ItemStack(Items.APPLE);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:4,代碼來源:CreativeTabs.java

示例12: getTabIconItem

@SideOnly(Side.CLIENT)
public Item getTabIconItem()
{
    return Items.APPLE;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:5,代碼來源:CreativeTabs.java


注:本文中的net.minecraft.init.Items.APPLE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。