本文整理汇总了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);
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}*/
}
示例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);
}
}
示例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;
}
示例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);
}
}