• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ItemHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中cofh.lib.util.helpers.ItemHelper的典型用法代码示例。如果您正苦于以下问题:Java ItemHelper类的具体用法?Java ItemHelper怎么用?Java ItemHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ItemHelper类属于cofh.lib.util.helpers包,在下文中一共展示了ItemHelper类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: receiveEnergy

import cofh.lib.util.helpers.ItemHelper; //导入依赖的package包/类
public int receiveEnergy(ItemStack var1, int var2, boolean var3) {
	int var4 = ItemHelper.getItemDamage(var1);
	if(var4 <= ItemCapacitor.Types.CREATIVE.ordinal()) {
		return 0;
	} else {
		if(var1.stackTagCompound == null) {
			EnergyHelper.setDefaultEnergyTag(var1, 0);
		}

		int var5 = var1.stackTagCompound.getInteger("Energy");
		int receive = ItemCapacitor.Types.POTATO.ordinal() == var4 ? TileEntitySolarGenerator.RECEIVE[var4] : ItemCapacitor.RECEIVE[var4];
		int var6 = Math.min(var2, Math.min(ItemCapacitor.CAPACITY[var4] - var5, receive));
		if(!var3 && var1.getItemDamage() != ItemCapacitor.Types.CREATIVE.ordinal()) {
			var5 += var6;
			var1.stackTagCompound.setInteger("Energy", var5);
		}

		return var6;
	}
}
 
开发者ID:Mitchellbrine,项目名称:PortableRF,代码行数:21,代码来源:ItemSolarGenerator.java


示例2: addProbabilisticRecipe

import cofh.lib.util.helpers.ItemHelper; //导入依赖的package包/类
public static void addProbabilisticRecipe(ItemStack output, double prob, ItemStack... input) throws Throwable {

        if (!EE3_PRESENT || output == null || prob == 0) {
            return;
        }
        if (prob == 1.0) {
            addRecipe(output, input);
        }
        else {
            int[] ratio = getRatio(output.stackSize * prob, 16);

            ArrayList<ItemStack> multInput = new ArrayList<ItemStack>();
            for (int i = 0; i < ratio[1]; i++) {
                for (ItemStack stack : input) {
                    multInput.add(stack.copy());
                }
            }

            addRecipe(ItemHelper.cloneStack(output, ratio[0]), multInput.toArray());
        }
    }
 
开发者ID:Dragon9815,项目名称:PlayerInterfaceMod,代码行数:22,代码来源:EE3Helper.java


示例3: processItem

import cofh.lib.util.helpers.ItemHelper; //导入依赖的package包/类
private void processItem() {
    if (this.canProcess()) {
        ItemStack result = RareMetalExtractorRecipes.getOutput(this.currentlyProcessed);
        if (this.getInventory()[1] == null) {
            this.getInventory()[1] = result.copy();
        } else if (ItemHelper.isOreNameEqual(this.getInventory()[1], ItemHelper.getOreName(result))) {
            this.getInventory()[1].stackSize += result.stackSize;
        }

        this.processedItem -= RareMetalExtractorRecipes.getInputSize(this.currentlyProcessed);

        this.processingEnergy = -1;
        if (this.processedItem <= 0) {
            this.currentlyProcessed = null;
        }
    }
}
 
开发者ID:SKCraft,项目名称:SMES,代码行数:18,代码来源:TileEntityRareMetalExtractor.java


示例4: getServerGuiElement

import cofh.lib.util.helpers.ItemHelper; //导入依赖的package包/类
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    switch (ID) {

    case ARMOUR_ID:
        if (ItemHelper.isPlayerHoldingItem(IModularItem.class, player)) {
            return new ArmourContainer(player.getHeldItem(), player.inventory);
        }
    case RECIPE_ID:
        return new RecipeContainer(player.getHeldItem(), player.inventory, world);
    case TABLET_ID:
        return new TabletContainer(player);
    default:
        return null;
    }
}
 
开发者ID:chbachman,项目名称:ModularArmour,代码行数:17,代码来源:GuiHandler.java


示例5: getClientGuiElement

import cofh.lib.util.helpers.ItemHelper; //导入依赖的package包/类
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    switch (ID) {

    case ARMOUR_ID:
        if (ItemHelper.isPlayerHoldingItem(IModularItem.class, player)) {
            return new ArmourGui(new ArmourContainer(player.getHeldItem(), player.inventory), player.inventory);
        }
    case RECIPE_ID:
        return new RecipeGui(new RecipeContainer(player.getHeldItem(), player.inventory, world), player.inventory);
    case TABLET_ID:
        return new TabletGui(new TabletContainer(player));
    default:
        return null;
    }
}
 
开发者ID:chbachman,项目名称:ModularArmour,代码行数:17,代码来源:GuiHandler.java


示例6: postInit

import cofh.lib.util.helpers.ItemHelper; //导入依赖的package包/类
public static void postInit() {
    ItemHelper.addShapedOreRecipe(drillHeadIron, "I  ", " B ", "  B", 'I', "ingotIron", 'B', "blockIron");
    ItemHelper.addShapedOreRecipe(drillHeadDiamond, "DD", "DH", 'D', "gemDiamond", 'H', drillHeadIron);
    //ItemHelper.addShapedOreRecipe(drillHeadObsidian, "O  ", "   ", "   ", 'O', Blocks.obsidian);

    if (Config.thermalExpansionRecipes && Loader.isModLoaded("ThermalExpansion")) {
        ItemHelper.addShapedOreRecipe(toolDrillIron, "HI ", "ICI", " IR", 'I', "ingotInvar", 'H', drillHeadIron, 'C', TEItems.capacitorHardened, 'R', TEItems.powerCoilElectrum);
    } else {
        ItemHelper.addShapedOreRecipe(toolDrillIron, "HI ", "ICI", " IR", 'I', "ingotIron", 'H', drillHeadIron, 'C', Blocks.redstone_block, 'R', Items.gold_ingot);
    }

    ItemHelper.addShapedOreRecipe(toolDrillDiamond, "H ", " D", 'H', drillHeadDiamond, 'D', toolDrillIron);
    ItemHelper.addShapedOreRecipe(toolDrillObsidian, "H ", " D", 'H', drillHeadObsidian, 'D', toolDrillDiamond);
}
 
开发者ID:Nentify,项目名称:Drillify,代码行数:15,代码来源:DrillifyItems.java


示例7: extractEnergy

import cofh.lib.util.helpers.ItemHelper; //导入依赖的package包/类
public int extractEnergy(ItemStack var1, int var2, boolean var3) {
	if(var1.stackTagCompound == null) {
		EnergyHelper.setDefaultEnergyTag(var1, 0);
	}

	int var4 = var1.stackTagCompound.getInteger("Energy");
	int var5 = Math.min(var2, Math.min(var4, ItemCapacitor.SEND[ItemHelper.getItemDamage(var1)]));
	if(!var3 && var1.getItemDamage() != ItemCapacitor.Types.CREATIVE.ordinal()) {
		var4 -= var5;
		var1.stackTagCompound.setInteger("Energy", var4);
	}

	return var5;
}
 
开发者ID:Mitchellbrine,项目名称:PortableRF,代码行数:15,代码来源:ItemSolarGenerator.java


示例8: getDisplayDamage

import cofh.lib.util.helpers.ItemHelper; //导入依赖的package包/类
public int getDisplayDamage(ItemStack var1) {
	return var1.stackTagCompound == null?ItemCapacitor.CAPACITY[ItemHelper.getItemDamage(var1)]:ItemCapacitor.CAPACITY[ItemHelper.getItemDamage(var1)] - var1.stackTagCompound.getInteger("Energy");
}
 
开发者ID:Mitchellbrine,项目名称:PortableRF,代码行数:4,代码来源:ItemSolarGenerator.java


示例9: getMaxDamage

import cofh.lib.util.helpers.ItemHelper; //导入依赖的package包/类
public int getMaxDamage(ItemStack var1) {
	return ItemCapacitor.CAPACITY[ItemHelper.getItemDamage(var1)];
}
 
开发者ID:Mitchellbrine,项目名称:PortableRF,代码行数:4,代码来源:ItemSolarGenerator.java



注:本文中的cofh.lib.util.helpers.ItemHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Color类代码示例发布时间:2022-05-22
下一篇:
Java ReadTimeoutException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap