本文整理汇总了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);
}
示例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);
}
示例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");
}
示例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;
}
示例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));
}
示例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();
}
}
示例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;
}
示例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});
}
示例9: getIndustrialCraftItem
import ic2.api.item.IC2Items; //导入方法依赖的package包/类
public static ItemStack getIndustrialCraftItem(String indentifier)
{
return IC2Items.getItem(indentifier);
}
示例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
);
}
}
示例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;
}