当前位置: 首页>>代码示例>>Java>>正文


Java ItemStack.onCrafting方法代码示例

本文整理汇总了Java中net.minecraft.item.ItemStack.onCrafting方法的典型用法代码示例。如果您正苦于以下问题:Java ItemStack.onCrafting方法的具体用法?Java ItemStack.onCrafting怎么用?Java ItemStack.onCrafting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.item.ItemStack的用法示例。


在下文中一共展示了ItemStack.onCrafting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
protected void onCrafting(ItemStack stack) {
    stack.onCrafting(this.player.world, this.player, this.removeCount);

    if (!this.player.world.isRemote) {
        int i = this.removeCount;
        CraftiniumSmelt smelt = CraftiniumSmeltRegistry.findMatchingXp(stack, this.player.world, this.forge);
        float f = smelt == null ? 0 : smelt.experience(stack, this.player.world, this.forge);

        if (f == 0.0F) {
            i = 0;
        } else if (f < 1.0F) {
            int j = MathHelper.floor((float) i * f);

            if (j < MathHelper.ceil((float) i * f) && Math.random() < (double) ((float) i * f - (float) j)) {
                ++j;
            }

            i = j;
        }

        while (i > 0) {
            int k = EntityXPOrb.getXPSplit(i);
            i -= k;
            this.player.world.spawnEntity(new EntityXPOrb(this.player.world, this.player.posX, this.player.posY + 0.5D, this.player.posZ + 0.5D, k));
        }
    }

    this.removeCount = 0;

    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(player, stack);
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:33,代码来源:CraftiniumForgeOutputSlot.java

示例2: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
protected void onCrafting(ItemStack stack) {
    if (this.amountCrafted > 0) {
        stack.onCrafting(this.player.world, this.player, this.amountCrafted);
        net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(this.player, stack, craftMatrix);
    }
    this.amountCrafted = 0;
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:8,代码来源:CraftiniumSlotCrafting.java

示例3: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
     * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
     */
    protected void onCrafting(ItemStack stack) {
        stack.onCrafting(this.player.world, this.player, this.removeCount);

//        if (!this.player.world.isRemote) {
//            int i = this.removeCount;
//            float f = RecipeManager.getInstance().getXp(stack);
//
//            if (f == 0.0F)
//                i = 0;
//            else if (f < 1.0F) {
//                int j = MathHelper.floor((float)i * f);
//                if (j < MathHelper.ceil((float)i * f) && Math.random() < (double)((float)i * f - (float)j))
//                    ++j;
//                i = j;
//            }
//
//            while (i > 0) {
//                int k = EntityXPOrb.getXPSplit(i);
//                i -= k;
//                this.player.world.spawnEntity(new EntityXPOrb(this.player.world, this.player.posX, this.player.posY + 0.5D, this.player.posZ + 0.5D, k));
//            }
//        }

        this.removeCount = 0;

        MinecraftForge.EVENT_BUS.post(new DrinkMadeEvent(player, stack));
    }
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:31,代码来源:SlotDrinkMachineOutput.java

示例4: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.player.world, this.player, this.removeCount);

    if (!this.player.world.isRemote)
    {
        int i = this.removeCount;
        float f = FurnaceRecipes.instance().getSmeltingExperience(stack);

        if (f == 0.0F)
        {
            i = 0;
        }
        else if (f < 1.0F)
        {
            int j = MathHelper.floor((float)i * f);

            if (j < MathHelper.ceil((float)i * f) && Math.random() < (double)((float)i * f - (float)j))
            {
                ++j;
            }

            i = j;
        }

        while (i > 0)
        {
            int k = EntityXPOrb.getXPSplit(i);
            i -= k;
            this.player.world.spawnEntity(new EntityXPOrb(this.player.world, this.player.posX, this.player.posY + 0.5D, this.player.posZ + 0.5D, k));
        }
    }

    this.removeCount = 0;
    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(player, stack);
}
 
开发者ID:cubex2,项目名称:morefurnaces,代码行数:40,代码来源:SlotOutput.java

示例5: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.player.world, this.player, this.removeCount);

    if (!this.player.world.isRemote)
    {
        int i = this.removeCount;
        //cooking in a pan yields generally more experience then cooking in a regular furnace
        float f = 0.8f; // FurnaceRecipes.instance().getSmeltingExperience(stack);

        if (f == 0.0F)
        {
            i = 0;
        }
        else if (f < 1.0F)
        {
            int j = MathHelper.floor((float)i * f);

            if (j < MathHelper.ceil((float)i * f) && Math.random() < (double)((float)i * f - (float)j))
            {
                ++j;
            }

            i = j;
        }

        while (i > 0)
        {
            int k = EntityXPOrb.getXPSplit(i);
            i -= k;
            this.player.world.spawnEntity(new EntityXPOrb(this.player.world, this.player.posX, this.player.posY + 0.5D, this.player.posZ + 0.5D, k));
        }
    }

    this.removeCount = 0;

    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(player, stack);

    if (stack.getItem() == Items.IRON_INGOT)
    {
        this.player.addStat(AchievementList.ACQUIRE_IRON);
    }

    if (stack.getItem() == Items.COOKED_FISH)
    {
        this.player.addStat(AchievementList.COOK_FISH);
    }
}
 
开发者ID:ArtixAllMighty,项目名称:ExSartagine,代码行数:52,代码来源:SlotPanOutput.java

示例6: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.field_75228_b);

    if (!this.thePlayer.worldObj.isRemote)
    {
        int i = this.field_75228_b;
        float f = FurnaceRecipes.instance().getSmeltingExperience(stack);

        if (f == 0.0F)
        {
            i = 0;
        }
        else if (f < 1.0F)
        {
            int j = MathHelper.floor_float((float)i * f);

            if (j < MathHelper.ceiling_float_int((float)i * f) && Math.random() < (double)((float)i * f - (float)j))
            {
                ++j;
            }

            i = j;
        }

        while (i > 0)
        {
            int k = EntityXPOrb.getXPSplit(i);
            i -= k;
            this.thePlayer.worldObj.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.worldObj, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, k));
        }
    }

    this.field_75228_b = 0;

    if (stack.getItem() == Items.iron_ingot)
    {
        this.thePlayer.triggerAchievement(AchievementList.acquireIron);
    }

    if (stack.getItem() == Items.cooked_fish)
    {
        this.thePlayer.triggerAchievement(AchievementList.cookFish);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:49,代码来源:SlotFurnaceOutput.java

示例7: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.field_75231_g);
    this.field_75231_g = 0;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:9,代码来源:SlotMerchantResult.java

示例8: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    if (this.amountCrafted > 0)
    {
        stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
    }

    this.amountCrafted = 0;

    if (stack.getItem() == Item.getItemFromBlock(Blocks.crafting_table))
    {
        this.thePlayer.triggerAchievement(AchievementList.buildWorkBench);
    }

    if (stack.getItem() instanceof ItemPickaxe)
    {
        this.thePlayer.triggerAchievement(AchievementList.buildPickaxe);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.furnace))
    {
        this.thePlayer.triggerAchievement(AchievementList.buildFurnace);
    }

    if (stack.getItem() instanceof ItemHoe)
    {
        this.thePlayer.triggerAchievement(AchievementList.buildHoe);
    }

    if (stack.getItem() == Items.bread)
    {
        this.thePlayer.triggerAchievement(AchievementList.makeBread);
    }

    if (stack.getItem() == Items.cake)
    {
        this.thePlayer.triggerAchievement(AchievementList.bakeCake);
    }

    if (stack.getItem() instanceof ItemPickaxe && ((ItemPickaxe)stack.getItem()).getToolMaterial() != Item.ToolMaterial.WOOD)
    {
        this.thePlayer.triggerAchievement(AchievementList.buildBetterPickaxe);
    }

    if (stack.getItem() instanceof ItemSword)
    {
        this.thePlayer.triggerAchievement(AchievementList.buildSword);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.enchanting_table))
    {
        this.thePlayer.triggerAchievement(AchievementList.enchantments);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.bookshelf))
    {
        this.thePlayer.triggerAchievement(AchievementList.bookcase);
    }

    if (stack.getItem() == Items.golden_apple && stack.getMetadata() == 1)
    {
        this.thePlayer.triggerAchievement(AchievementList.overpowered);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:68,代码来源:SlotCrafting.java

示例9: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.removeCount);

    if (!this.thePlayer.worldObj.isRemote)
    {
        int i = this.removeCount;
        float f = FurnaceRecipes.instance().getSmeltingExperience(stack);

        if (f == 0.0F)
        {
            i = 0;
        }
        else if (f < 1.0F)
        {
            int j = MathHelper.floor_float((float)i * f);

            if (j < MathHelper.ceiling_float_int((float)i * f) && Math.random() < (double)((float)i * f - (float)j))
            {
                ++j;
            }

            i = j;
        }

        while (i > 0)
        {
            int k = EntityXPOrb.getXPSplit(i);
            i -= k;
            this.thePlayer.worldObj.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.worldObj, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, k));
        }
    }

    this.removeCount = 0;

    net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, stack);

    if (stack.getItem() == Items.IRON_INGOT)
    {
        this.thePlayer.addStat(AchievementList.ACQUIRE_IRON);
    }

    if (stack.getItem() == Items.COOKED_FISH)
    {
        this.thePlayer.addStat(AchievementList.COOK_FISH);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:51,代码来源:SlotFurnaceOutput.java

示例10: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    if (this.amountCrafted > 0)
    {
        stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
    }

    this.amountCrafted = 0;

    if (stack.getItem() == Item.getItemFromBlock(Blocks.CRAFTING_TABLE))
    {
        this.thePlayer.addStat(AchievementList.BUILD_WORK_BENCH);
    }

    if (stack.getItem() instanceof ItemPickaxe)
    {
        this.thePlayer.addStat(AchievementList.BUILD_PICKAXE);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.FURNACE))
    {
        this.thePlayer.addStat(AchievementList.BUILD_FURNACE);
    }

    if (stack.getItem() instanceof ItemHoe)
    {
        this.thePlayer.addStat(AchievementList.BUILD_HOE);
    }

    if (stack.getItem() == Items.BREAD)
    {
        this.thePlayer.addStat(AchievementList.MAKE_BREAD);
    }

    if (stack.getItem() == Items.CAKE)
    {
        this.thePlayer.addStat(AchievementList.BAKE_CAKE);
    }

    if (stack.getItem() instanceof ItemPickaxe && ((ItemPickaxe)stack.getItem()).getToolMaterial() != Item.ToolMaterial.WOOD)
    {
        this.thePlayer.addStat(AchievementList.BUILD_BETTER_PICKAXE);
    }

    if (stack.getItem() instanceof ItemSword)
    {
        this.thePlayer.addStat(AchievementList.BUILD_SWORD);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.ENCHANTING_TABLE))
    {
        this.thePlayer.addStat(AchievementList.ENCHANTMENTS);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.BOOKSHELF))
    {
        this.thePlayer.addStat(AchievementList.BOOKCASE);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:63,代码来源:SlotCrafting.java

示例11: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.removeCount);
    this.removeCount = 0;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:SlotMerchantResult.java

示例12: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
    * the itemStack passed in is the output - ie, iron ingots, and pickaxes,
    * not ore and wood.
    */
   @Override
   protected void onCrafting(ItemStack stack)
   {
stack.onCrafting(thePlayer.world, thePlayer, amountCrafted);
amountCrafted = 0;

//TODO Reimplement as advancements
/*if (stack.getItem() == Item.getItemFromBlock(Blocks.CRAFTING_TABLE))
{
    thePlayer.addStat(AchievementList.BUILD_WORK_BENCH, 1);
}

if (stack.getItem() instanceof ItemPickaxe)
{
    thePlayer.addStat(AchievementList.BUILD_PICKAXE, 1);
}

if (stack.getItem() == Item.getItemFromBlock(Blocks.FURNACE))
{
    thePlayer.addStat(AchievementList.BUILD_FURNACE, 1);
}

if (stack.getItem() instanceof ItemHoe)
{
    thePlayer.addStat(AchievementList.BUILD_HOE, 1);
}

if (stack.getItem() == Items.BREAD)
{
    thePlayer.addStat(AchievementList.MAKE_BREAD, 1);
}

if (stack.getItem() == Items.CAKE)
{
    thePlayer.addStat(AchievementList.BAKE_CAKE, 1);
}

if (stack.getItem() instanceof ItemPickaxe
	&& ((ItemPickaxe)stack.getItem()).getToolMaterial() != Item.ToolMaterial.WOOD)
{
    thePlayer.addStat(AchievementList.BUILD_BETTER_PICKAXE, 1);
}

if (stack.getItem() instanceof ItemSword
	&& !((ItemSword)stack.getItem()).getToolMaterialName().equals("noobwood"))
{
    thePlayer.addStat(AchievementList.BUILD_SWORD, 1);
}

if (stack.getItem() == Item.getItemFromBlock(Blocks.ENCHANTING_TABLE))
{
    thePlayer.addStat(AchievementList.ENCHANTMENTS, 1);
}

if (stack.getItem() == Item.getItemFromBlock(Blocks.BOOKSHELF))
{
    thePlayer.addStat(AchievementList.BOOKCASE, 1);
}*/
   }
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:64,代码来源:SlotAdvancedCrafting.java

示例13: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.thePlayer.world, this.thePlayer, this.removeCount);

    if (!this.thePlayer.world.isRemote)
    {
        int i = this.removeCount;
        float f = FurnaceRecipes.instance().getSmeltingExperience(stack);

        if (f == 0.0F)
        {
            i = 0;
        }
        else if (f < 1.0F)
        {
            int j = MathHelper.floor((float)i * f);

            if (j < MathHelper.ceil((float)i * f) && Math.random() < (double)((float)i * f - (float)j))
            {
                ++j;
            }

            i = j;
        }

        while (i > 0)
        {
            int k = EntityXPOrb.getXPSplit(i);
            i -= k;
            this.thePlayer.world.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.world, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, k));
        }
    }

    this.removeCount = 0;

    if (stack.getItem() == Items.IRON_INGOT)
    {
        this.thePlayer.addStat(AchievementList.ACQUIRE_IRON);
    }

    if (stack.getItem() == Items.COOKED_FISH)
    {
        this.thePlayer.addStat(AchievementList.COOK_FISH);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:49,代码来源:SlotFurnaceOutput.java

示例14: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    stack.onCrafting(this.thePlayer.world, this.thePlayer, this.removeCount);
    this.removeCount = 0;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:SlotMerchantResult.java

示例15: onCrafting

import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    if (this.amountCrafted > 0)
    {
        stack.onCrafting(this.thePlayer.world, this.thePlayer, this.amountCrafted);
    }

    this.amountCrafted = 0;

    if (stack.getItem() == Item.getItemFromBlock(Blocks.CRAFTING_TABLE))
    {
        this.thePlayer.addStat(AchievementList.BUILD_WORK_BENCH);
    }

    if (stack.getItem() instanceof ItemPickaxe)
    {
        this.thePlayer.addStat(AchievementList.BUILD_PICKAXE);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.FURNACE))
    {
        this.thePlayer.addStat(AchievementList.BUILD_FURNACE);
    }

    if (stack.getItem() instanceof ItemHoe)
    {
        this.thePlayer.addStat(AchievementList.BUILD_HOE);
    }

    if (stack.getItem() == Items.BREAD)
    {
        this.thePlayer.addStat(AchievementList.MAKE_BREAD);
    }

    if (stack.getItem() == Items.CAKE)
    {
        this.thePlayer.addStat(AchievementList.BAKE_CAKE);
    }

    if (stack.getItem() instanceof ItemPickaxe && ((ItemPickaxe)stack.getItem()).getToolMaterial() != Item.ToolMaterial.WOOD)
    {
        this.thePlayer.addStat(AchievementList.BUILD_BETTER_PICKAXE);
    }

    if (stack.getItem() instanceof ItemSword)
    {
        this.thePlayer.addStat(AchievementList.BUILD_SWORD);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.ENCHANTING_TABLE))
    {
        this.thePlayer.addStat(AchievementList.ENCHANTMENTS);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.BOOKSHELF))
    {
        this.thePlayer.addStat(AchievementList.BOOKCASE);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:63,代码来源:SlotCrafting.java


注:本文中的net.minecraft.item.ItemStack.onCrafting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。