本文整理汇总了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());
}
示例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);
}
示例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());
}
}
示例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());
}
示例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);
}
示例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);
}
示例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());
}
示例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)));
}
示例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);
}
}
示例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()));
}
示例11: getTabIconItem
public ItemStack getTabIconItem()
{
return new ItemStack(Items.APPLE);
}
示例12: getTabIconItem
@SideOnly(Side.CLIENT)
public Item getTabIconItem()
{
return Items.APPLE;
}