本文整理汇总了Java中net.minecraft.item.crafting.IRecipe.getRecipeOutput方法的典型用法代码示例。如果您正苦于以下问题:Java IRecipe.getRecipeOutput方法的具体用法?Java IRecipe.getRecipeOutput怎么用?Java IRecipe.getRecipeOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.crafting.IRecipe
的用法示例。
在下文中一共展示了IRecipe.getRecipeOutput方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeRecipe
import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/**
* Removes all recipes that produce a given item.
* @param itemToRemove The item whose recipes are to be removed.
*/
private static void removeRecipe(Item itemToRemove) {
Iterator<IRecipe> iter = CraftingManager.getInstance().getRecipeList().iterator();
while (iter.hasNext()) {
IRecipe recipe = iter.next();
ItemStack out = recipe.getRecipeOutput();
if (out != ItemStack.EMPTY && out.getItem() == itemToRemove) {
FMLLog.info("Removing recipe for " + out);
iter.remove();
}
}
}
示例2: unregister
import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
public void unregister() {
Iterator<IRecipe> it = CraftingManager.getInstance().getRecipeList().iterator();
while (it.hasNext()) {
IRecipe recipe = it.next();
ItemStack output = recipe.getRecipeOutput();
if (output != null && output.getItem() != null) {
if (output.isItemEqual(new ItemStack(Items.IRON_SWORD))){
output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 6, 0), EntityEquipmentSlot.MAINHAND);
}
if (output.isItemEqual(new ItemStack(Items.GOLDEN_SWORD))){
output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 5, 0), EntityEquipmentSlot.MAINHAND);
}
if (output.isItemEqual(new ItemStack(Items.DIAMOND_SWORD))){
output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 8, 0), EntityEquipmentSlot.MAINHAND);
}
if (output.isItemEqual(new ItemStack(Items.WOODEN_SWORD))){
output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 4, 0), EntityEquipmentSlot.MAINHAND);
}
if (output.isItemEqual(new ItemStack(Items.STONE_SWORD))){
output.addAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 20, 0), EntityEquipmentSlot.MAINHAND);
output.addAttributeModifier(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier("Weapon modifier", 5, 0), EntityEquipmentSlot.MAINHAND);
}
}
}
}
示例3: initCraftableStats
import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/**
* Initializes statistics related to craftable items. Is only called after both block and item stats have been
* initialized.
*/
private static void initCraftableStats()
{
Set<Item> set = Sets.<Item>newHashSet();
for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList())
{
if (irecipe.getRecipeOutput() != null)
{
set.add(irecipe.getRecipeOutput().getItem());
}
}
for (ItemStack itemstack : FurnaceRecipes.instance().getSmeltingList().values())
{
set.add(itemstack.getItem());
}
for (Item item : set)
{
if (item != null)
{
int i = Item.getIdFromItem(item);
String s = func_180204_a(item);
if (s != null)
{
objectCraftStats[i] = (new StatCrafting("stat.craftItem.", s, new ChatComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat();
}
}
}
replaceAllSimilarBlocks(objectCraftStats);
}
示例4: attemptCrafting
import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/** Attempt to craft the given recipe.<br>
* This pays no attention to tedious things like using the right crafting table / brewing stand etc, or getting the right shape.<br>
* It simply takes the raw ingredients out of the player's inventory, and inserts the output of the recipe, if possible.
* @param player the SERVER SIDE player that will do the crafting.
* @param recipe the IRecipe we wish to craft.
* @return true if the recipe had an output, and the player had the required ingredients to create it; false otherwise.
*/
public static boolean attemptCrafting(EntityPlayerMP player, IRecipe recipe)
{
if (player == null || recipe == null)
return false;
ItemStack is = recipe.getRecipeOutput();
if (is == null)
return false;
List<ItemStack> ingredients = getIngredients(recipe);
if (playerHasIngredients(player, ingredients))
{
// We have the ingredients we need, so directly manipulate the inventory.
// First, remove the ingredients:
removeIngredientsFromPlayer(player, ingredients);
// Now add the output of the recipe:
ItemStack resultForInventory = is.copy();
ItemStack resultForReward = is.copy();
player.inventory.addItemStackToInventory(resultForInventory);
RewardForCollectingItemImplementation.GainItemEvent event = new RewardForCollectingItemImplementation.GainItemEvent(resultForReward);
MinecraftForge.EVENT_BUS.post(event);
return true;
}
return false;
}
示例5: initCraftableStats
import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/**
* Initializes statistics related to craftable items. Is only called after both block and item stats have been
* initialized.
*/
private static void initCraftableStats()
{
Set<Item> set = Sets.<Item>newHashSet();
for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList())
{
ItemStack itemstack = irecipe.getRecipeOutput();
if (!itemstack.func_190926_b())
{
set.add(irecipe.getRecipeOutput().getItem());
}
}
for (ItemStack itemstack1 : FurnaceRecipes.instance().getSmeltingList().values())
{
set.add(itemstack1.getItem());
}
for (Item item : set)
{
if (item != null)
{
int i = Item.getIdFromItem(item);
String s = getItemName(item);
if (s != null)
{
CRAFTS_STATS[i] = (new StatCrafting("stat.craftItem.", s, new TextComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
}
}
}
replaceAllSimilarBlocks(CRAFTS_STATS);
}
示例6: initCraftableStats
import net.minecraft.item.crafting.IRecipe; //导入方法依赖的package包/类
/**
* Initializes statistics related to craftable items. Is only called after both block and item stats have been
* initialized.
*/
private static void initCraftableStats()
{
Set<Item> set = Sets.<Item>newHashSet();
for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList())
{
if (irecipe.getRecipeOutput() != null)
{
set.add(irecipe.getRecipeOutput().getItem());
}
}
for (ItemStack itemstack : FurnaceRecipes.instance().getSmeltingList().values())
{
set.add(itemstack.getItem());
}
for (Item item : set)
{
if (item != null)
{
int i = Item.getIdFromItem(item);
String s = getItemName(item);
if (s != null)
{
CRAFTS_STATS[i] = (new StatCrafting("stat.craftItem.", s, new TextComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
}
}
}
replaceAllSimilarBlocks(CRAFTS_STATS, true);
}