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


Java IC2Items.getItem方法代码示例

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


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

示例1: parse

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
@Override
public Ingredient parse(JsonContext context, JsonObject json)
{
	String name = JsonUtils.getString(json, "name");
	
	ItemStack stack = null;
	
	// If item with variant.
	if (name.contains("#")) {
		String[] parts = name.split("#");
		stack = IC2Items.getItem(parts[0], parts[1]);
	} else {
		stack = IC2Items.getItem(name);
	}
	
	if (stack == null)
		throw new JsonSyntaxException("IC2 item with name " + name + " could not be found");
	
	return Ingredient.fromStacks(stack);
}
 
开发者ID:TwilightWingsStudio,项目名称:CompositeGear,代码行数:21,代码来源:IC2IngredientFactory.java

示例2: onRightClick

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onRightClick(ItemStack itemStack, EntityPlayer entityPlayer, EnumHand hand) {
    ItemStack target = IC2Items.getItem("nuclear", "uranium_238");
    if (itemStack.isItemEqual(target)) {
        if (PLConfig.instance.throwableUran238) {
            if (!entityPlayer.capabilities.isCreativeMode) {
                --itemStack.stackSize;
            }

            entityPlayer.world.playSound(entityPlayer, entityPlayer.getPosition(),
                    SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS,
                    0.5F, 0.4F / (new Random().nextFloat() * 0.4F + 0.8F));
            if (!entityPlayer.world.isRemote) {
                entityPlayer.world.spawnEntity(new EntityThrownItem(entityPlayer.world, entityPlayer, itemStack));
            }
        }
        return ActionResult.newResult(EnumActionResult.SUCCESS, itemStack);
    }
    return ActionResult.newResult(EnumActionResult.PASS, itemStack);
}
 
开发者ID:GoodTimeStudio,项目名称:Production-Line,代码行数:21,代码来源:ThrowableUranium238Handler.java

示例3: init

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
@Override
public void init() {
    glassFibreCable = IC2Items.getItem("cable", "type:glass");
    overclockerUpgrade = IC2Items.getItem("upgrade", "overclocker");
    transformerUpgrade = IC2Items.getItem("upgrade", "transformer");
    energyStorageUpgrade = IC2Items.getItem("upgrade", "energy_storage");
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:IC2.java

示例4: onBlockActivated

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY,
		float hitZ){
	if(player.inventory.getCurrentItem() == IC2Items.getItem("wrench") || player.inventory.getCurrentItem() == IC2Items.getItem("electricWrench"))
		return true;

	if(!player.isSneaking()){
		player.openGui(AFSUMod.instance, 0, world, pos.getX(), pos.getY(), pos.getZ());
		return true;
	}

	return false;
}
 
开发者ID:xbony2,项目名称:AFSU,代码行数:14,代码来源:AFSUBlock.java

示例5: postInit

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
@Override
public void postInit() {

    ItemStack lapotron = IC2Items.getItem("lapotronCrystal");
    ItemStack carbon = IC2Items.getItem("carbonPlate");
    ItemStack hardenedElectrum = Vanilla.temperedElectrum;

    GameRegistry.addRecipe(new ShapedOreRecipe(stackHelmetModular, "HCH", "F F", 'F', carbon, 'H', hardenedElectrum, 'c', lapotron));
    GameRegistry.addRecipe(new ShapedOreRecipe(stackChestplateModular, "H H", "FCF", "HHH", 'F', carbon, 'H', hardenedElectrum, 'c', lapotron));
    GameRegistry.addRecipe(new ShapedOreRecipe(stackLeggingsModular, "HCH", "F F", "H H", 'F', carbon, 'H', hardenedElectrum, 'c', lapotron));
    GameRegistry.addRecipe(new ShapedOreRecipe(stackBootsModular, "F F", "HCH", 'F', carbon, 'H', hardenedElectrum, 'c', lapotron));
}
 
开发者ID:chbachman,项目名称:ModularArmour,代码行数:13,代码来源:IndustrialCraft2.java

示例6: init

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
@Override
public void init(){
    ItemStack advancedCircuit = IC2Items.getItem("advancedCircuit");
    ItemStack glassFibreCable = IC2Items.getItem("glassFiberCableItem");
    ItemStack advancedAlloy = IC2Items.getItem("advancedAlloy");
    ItemStack generator = IC2Items.getItem("generator");

    if(Config.enablePneumaticGeneratorRecipe) GameRegistry.addRecipe(new ItemStack(pneumaticGenerator), "pca", "trg", "pca", 'p', Itemss.printedCircuitBoard, 'c', advancedCircuit, 'a', advancedAlloy, 't', new ItemStack(Blockss.advancedPressureTube, 1, 0), 'r', Itemss.turbineRotor, 'g', glassFibreCable);
    if(Config.enableElectricCompressorRecipe) GameRegistry.addRecipe(new ItemStack(electricCompressor), "acp", "frt", "agp", 'p', Itemss.printedCircuitBoard, 'c', advancedCircuit, 'a', advancedAlloy, 't', new ItemStack(Blockss.advancedPressureTube, 1, 0), 'r', Itemss.turbineRotor, 'f', glassFibreCable, 'g', generator);
    try {
        if(Class.forName("ic2.api.recipe.Recipes") != null && Recipes.class.getField("macerator") != null && IMachineRecipeManager.class.getMethod("addRecipe", IRecipeInput.class, NBTTagCompound.class, ItemStack[].class) != null) {
            if(Config.enableCreeperPlantMaceratorRecipe) {
                Recipes.macerator.addRecipe(new IC2RecipeInput(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.CREEPER_PLANT_DAMAGE)), null, new ItemStack(Items.gunpowder));
                Recipes.macerator.addRecipe(new IC2RecipeInput(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.CREEPER_PLANT_DAMAGE + 16)), null, new ItemStack(Items.gunpowder));
            }
            if(Config.enableHeliumPlantMaceratorRecipe) {
                Recipes.macerator.addRecipe(new IC2RecipeInput(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.HELIUM_PLANT_DAMAGE)), null, new ItemStack(Items.glowstone_dust));
                Recipes.macerator.addRecipe(new IC2RecipeInput(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.HELIUM_PLANT_DAMAGE + 16)), null, new ItemStack(Items.glowstone_dust));
            }
            if(Config.enableFlyingFlowerExtractorRecipe) {
                Recipes.extractor.addRecipe(new IC2RecipeInput(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.FLYING_FLOWER_DAMAGE)), null, new ItemStack(Items.feather));
                Recipes.extractor.addRecipe(new IC2RecipeInput(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.FLYING_FLOWER_DAMAGE + 16)), null, new ItemStack(Items.feather));
            }
            if(Config.enablePropulsionPlantExtractorRecipe) {
                Recipes.extractor.addRecipe(new IC2RecipeInput(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.PROPULSION_PLANT_DAMAGE)), null, new ItemStack(Items.sugar, 2, 1));
                Recipes.extractor.addRecipe(new IC2RecipeInput(new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.PROPULSION_PLANT_DAMAGE + 16)), null, new ItemStack(Items.sugar, 2, 1));
            }
        }
    } catch(Exception e) {
        System.err.println("[PneumaticCraft] Failed to load IC2's macerator, extractor and compressor recipes!");
        e.printStackTrace();
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:34,代码来源:IC2.java

示例7: getIC2Upgrades

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
@Optional.Method(modid = ModIds.INDUSTRIALCRAFT)
protected int getIC2Upgrades(String ic2ItemKey, int[] upgradeSlots){
    ItemStack itemStack = IC2Items.getItem(ic2ItemKey);
    if(itemStack == null) return 0;
    int upgrades = 0;
    if(this instanceof IInventory) {// this always should be true.
        IInventory inv = (IInventory)this;
        for(int i : upgradeSlots) {
            if(inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() == itemStack.getItem()) {
                upgrades += inv.getStackInSlot(i).stackSize;
            }
        }
    }
    return upgrades;
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:16,代码来源:TileEntityBase.java

示例8: loadRecipes

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
public static void loadRecipes(String modName) {
    Equivalency.loadModRecipes(modName);

    if (ModVars.ic2Recipe) {
        try {
            uraniumDrop = IC2Items.getItem("Uran238");
        } catch (Exception e) {
            Equivalency.logger.logError("Could not get IC2 Uranium, disabling recipes!");
        }
    }
    // 3 Resin -> Leather
    TransmutationHelper.addRecipe(Items.leather, new Object[]{stickyResin, stickyResin});
    // Leather -> 3 Resin
    TransmutationHelper.addRecipe(new ItemStack(stickyResin.getItem(), 2), new Object[]{Items.leather});
}
 
开发者ID:Lomeli12,项目名称:Equivalency,代码行数:16,代码来源:IC2Recipes.java

示例9: getIndustrialCraftItem

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
public static ItemStack getIndustrialCraftItem(String indentifier)
{
	return IC2Items.getItem(indentifier);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:5,代码来源:RecipeUtil.java

示例10: ic2

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
public static void ic2(){
    if(Config.registerLDA){
        addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.antenna)),
                "ici",
                "ici",
                "ici",
                'i', IC2Items.getItem("denseplateadviron"),
                'c', li.cil.oc.api.Items.get("cable").createItemStack(1)
        );
    }

    if(Config.registerTeslaUpgrade){
        addRecipe(new ItemStack(ot.item.Items.tesla),
                "ccc",
                "pbp",
                "ccc",
                'c', IC2Items.getItem("ironCableItem"),
                'p', li.cil.oc.api.Items.get("chip3").createItemStack(1),
                'b', IC2Items.getItem("hvTransformer")
        );
    }

    if(Config.registerNR){
        ItemStack vent = IC2Items.getItem("reactorVentDiamond");
        vent.setItemDamage(1);
        ItemStack lead = IC2Items.getItem("leadBlock");
        lead.setItemDamage(4);
        ItemStack reflector = IC2Items.getItem("reactorReflectorThick");
        reflector.setItemDamage(1);
        addRecipe(new ItemStack(ot.item.Items.nr),
                "vvv",
                "oro",
                "lcl",
                'v', vent,
                'r', IC2Items.getItem("nuclearReactor"),
                'o', reflector,
                'l', lead,
                'c', li.cil.oc.api.Items.get("cpu3").createItemStack(1)
        );
    }

    if(Config.registerEnergyController){
        ItemStack advBattery = IC2Items.getItem("advBattery");
        advBattery.setItemDamage(26);
        addRecipe(new ItemStack(Item.getItemFromBlock(Blocks.energyController)),
                "ibi",
                "cpc",
                "ibi",
                'i', new ItemStack(Items.iron_ingot),
                'c', IC2Items.getItem("insulatedGoldCableItem"),
                'p', li.cil.oc.api.Items.get("cpu1").createItemStack(1),
                'b', advBattery
        );
    }
}
 
开发者ID:Avaja,项目名称:OpenTechnology,代码行数:56,代码来源:Recipes.java

示例11: isIC2Item

import ic2.api.item.IC2Items; //导入方法依赖的package包/类
/**
 * This will return true if the given item ID is the same as the item id that can be retrieved from IC2's item key.
 * @param id
 * @param ic2ItemKey
 * @return
 */
@Optional.Method(modid = ModIds.INDUSTRIALCRAFT)
public static boolean isIC2Item(Item id, String ic2ItemKey){
    ItemStack ic2Item = IC2Items.getItem(ic2ItemKey);
    return ic2Item != null && ic2Item.getItem() == id;
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:12,代码来源:PneumaticCraftUtils.java


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