Java Code Examples for net.minecraft.init.Items.GOLDEN_APPLE

The following are Jave code examples for showing how to use GOLDEN_APPLE of the net.minecraft.init.Items class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Backmemed   File: EntityZombieVillager.java   View Source Code Vote up 6 votes
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);

    if (itemstack.getItem() == Items.GOLDEN_APPLE && itemstack.getMetadata() == 0 && this.isPotionActive(MobEffects.WEAKNESS))
    {
        if (!player.capabilities.isCreativeMode)
        {
            itemstack.func_190918_g(1);
        }

        if (!this.world.isRemote)
        {
            this.func_190734_b(this.rand.nextInt(2401) + 3600);
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
Example 2
Project: CustomWorldGen   File: EntityZombie.java   View Source Code Vote up 6 votes
public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
{
    if (stack != null && stack.getItem() == Items.GOLDEN_APPLE && stack.getMetadata() == 0 && this.isVillager() && this.isPotionActive(MobEffects.WEAKNESS))
    {
        if (!player.capabilities.isCreativeMode)
        {
            --stack.stackSize;
        }

        if (!this.worldObj.isRemote)
        {
            this.startConversion(this.rand.nextInt(2401) + 3600);
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
Example 3
Project: BetterBeginningsReborn   File: BBEventHandler.java   View Source Code Vote up 5 votes
@SubscribeEvent
   public void onItemSmelted(PlayerEvent.ItemSmeltedEvent e)
   {
if (e.smelting.getItem() == Items.GOLDEN_APPLE && e.smelting.getItemDamage() == 1)
{
	//TODO Advancement 
       //RegisterAchievements.achievementGet(e.player, "notchApple");
}
   }
 
Example 4
Project: FoodCraft-Reloaded   File: FCRCreativeTabs.java   View Source Code Vote up 4 votes
@Nonnull
@Override
public ItemStack getTabIconItem() {
    return new ItemStack(Items.GOLDEN_APPLE);
}