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


Java MachineRecipe类代码示例

本文整理汇总了Java中me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe的典型用法代码示例。如果您正苦于以下问题:Java MachineRecipe类的具体用法?Java MachineRecipe怎么用?Java MachineRecipe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MachineRecipe类属于me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems包,在下文中一共展示了MachineRecipe类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tick

import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void tick(Block b) {
	if (isProcessing(b)) {
		int timeleft = progress.get(b);
		if (timeleft > 0) {
			ItemStack item = getProgressBar().clone();
	        item.setDurability(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
			ItemMeta im = item.getItemMeta();
			im.setDisplayName(" ");
			List<String> lore = new ArrayList<String>();
			lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
			lore.add("");
			lore.add(MachineHelper.getTimeLeft(timeleft / 2));
			im.setLore(lore);
			item.setItemMeta(im);
			
			BlockStorage.getInventory(b).replaceExistingItem(22, item);
			
			if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
			ChargableBlock.addCharge(b, -getEnergyConsumption());
			
			progress.put(b, timeleft - 1);
		}
		else {
			BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "));
			pushItems(b, processing.get(b).getOutput());
			
			progress.remove(b);
			processing.remove(b);
		}
	}
	else if (OreGenSystem.getSupplies(OreGenSystem.getResource("Milky Quartz"), b.getChunk(), false) > 0) {
		MachineRecipe r = new MachineRecipe(24, new ItemStack[0], new ItemStack[] {ChestTerminal.quartz});
		if (!fits(b, r.getOutput())) return;
		processing.put(b, r);
		progress.put(b, r.getTicks());
		OreGenSystem.setSupplies(OreGenSystem.getResource("Milky Quartz"), b.getChunk(), OreGenSystem.getSupplies(OreGenSystem.getResource("Milky Quartz"), b.getChunk(), false) - 1);
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:ChestTerminal,代码行数:40,代码来源:QuartzDrill.java

示例2: registerDefaultRecipes

import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; //导入依赖的package包/类
@Override
public void registerDefaultRecipes() {
	registerRecipe(new MachineRecipe(8, new ItemStack[] {SlimefunItems.ALUMINUM_DUST}, new ItemStack[] {SlimefunItems.ALUMINUM_INGOT}));
	registerRecipe(new MachineRecipe(8, new ItemStack[] {SlimefunItems.COPPER_DUST}, new ItemStack[] {SlimefunItems.COPPER_INGOT}));
	registerRecipe(new MachineRecipe(8, new ItemStack[] {SlimefunItems.GOLD_DUST}, new ItemStack[] {SlimefunItems.GOLD_4K}));
	registerRecipe(new MachineRecipe(8, new ItemStack[] {SlimefunItems.IRON_DUST}, new ItemStack[] {new ItemStack(Material.IRON_INGOT)}));
	registerRecipe(new MachineRecipe(8, new ItemStack[] {SlimefunItems.LEAD_DUST}, new ItemStack[] {SlimefunItems.LEAD_INGOT}));
	registerRecipe(new MachineRecipe(8, new ItemStack[] {SlimefunItems.MAGNESIUM_DUST}, new ItemStack[] {SlimefunItems.MAGNESIUM_INGOT}));
	registerRecipe(new MachineRecipe(8, new ItemStack[] {SlimefunItems.SILVER_DUST}, new ItemStack[] {SlimefunItems.SILVER_INGOT}));
	registerRecipe(new MachineRecipe(8, new ItemStack[] {SlimefunItems.TIN_DUST}, new ItemStack[] {SlimefunItems.TIN_INGOT}));
	registerRecipe(new MachineRecipe(8, new ItemStack[] {SlimefunItems.ZINC_DUST}, new ItemStack[] {SlimefunItems.ZINC_INGOT}));
}
 
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:13,代码来源:ElectricIngotFactory.java

示例3: registerDefaultRecipes

import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; //导入依赖的package包/类
public void registerDefaultRecipes()
{
    registerRecipe(new MachineRecipe(8, new ItemStack[] {
        SlimefunItems.ALUMINUM_DUST
    }, new ItemStack[] {
        SlimefunItems.ALUMINUM_INGOT
    }));
    registerRecipe(new MachineRecipe(8, new ItemStack[] {
        SlimefunItems.COPPER_DUST
    }, new ItemStack[] {
        SlimefunItems.COPPER_INGOT
    }));
    registerRecipe(new MachineRecipe(8, new ItemStack[] {
        SlimefunItems.GOLD_DUST
    }, new ItemStack[] {
        SlimefunItems.GOLD_4K
    }));
    registerRecipe(new MachineRecipe(8, new ItemStack[] {
        SlimefunItems.IRON_DUST
    }, new ItemStack[] {
        new ItemStack(Material.IRON_INGOT)
    }));
    registerRecipe(new MachineRecipe(8, new ItemStack[] {
        SlimefunItems.LEAD_DUST
    }, new ItemStack[] {
        SlimefunItems.LEAD_INGOT
    }));
    registerRecipe(new MachineRecipe(8, new ItemStack[] {
        SlimefunItems.MAGNESIUM_DUST
    }, new ItemStack[] {
        SlimefunItems.MAGNESIUM_INGOT
    }));
    registerRecipe(new MachineRecipe(8, new ItemStack[] {
        SlimefunItems.SILVER_DUST
    }, new ItemStack[] {
        SlimefunItems.SILVER_INGOT
    }));
    registerRecipe(new MachineRecipe(8, new ItemStack[] {
        SlimefunItems.TIN_DUST
    }, new ItemStack[] {
        SlimefunItems.TIN_INGOT
    }));
    registerRecipe(new MachineRecipe(8, new ItemStack[] {
        SlimefunItems.ZINC_DUST
    }, new ItemStack[] {
        SlimefunItems.ZINC_INGOT
    }));
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:49,代码来源:ElectricIngotFactory.java

示例4: tick

import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void tick(Block b) {
	if (isProcessing(b)) {
		int timeleft = progress.get(b);
		if (timeleft > 0) {
			ItemStack item = getProgressBar().clone();
	        item.setDurability(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
			ItemMeta im = item.getItemMeta();
			im.setDisplayName(" ");
			List<String> lore = new ArrayList<String>();
			lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
			lore.add("");
			lore.add(MachineHelper.getTimeLeft(timeleft / 2));
			im.setLore(lore);
			item.setItemMeta(im);
			
			BlockStorage.getInventory(b).replaceExistingItem(22, item);
			
			if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
			ChargableBlock.addCharge(b, -getEnergyConsumption());
			
			progress.put(b, timeleft - 1);
		}
		else {
			BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "));
			pushItems(b, processing.get(b).getOutput());
			
			progress.remove(b);
			processing.remove(b);
		}
	}
	else if (OreGenSystem.getSupplies(OreGenSystem.getResource("Oil"), b.getChunk(), false) > 0) {
		for (int slot: getInputSlots()) {
			if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.BUCKET), true)) {
				MachineRecipe r = new MachineRecipe(26, new ItemStack[0], new ItemStack[] {SlimefunItems.BUCKET_OF_OIL});
				if (!fits(b, r.getOutput())) return;
				BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), 1));
				processing.put(b, r);
				progress.put(b, r.getTicks());
				OreGenSystem.setSupplies(OreGenSystem.getResource("Oil"), b.getChunk(), OreGenSystem.getSupplies(OreGenSystem.getResource("Oil"), b.getChunk(), false) - 1);
				break;
			}
		}
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:46,代码来源:OilPump.java

示例5: tick

import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void tick(Block b) {
	if (isProcessing(b)) {
		int timeleft = progress.get(b);
		if (timeleft > 0) {
			ItemStack item = getProgressBar().clone();
	        item.setDurability(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
			ItemMeta im = item.getItemMeta();
			im.setDisplayName(" ");
			List<String> lore = new ArrayList<String>();
			lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
			lore.add("");
			lore.add(MachineHelper.getTimeLeft(timeleft / 2));
			im.setLore(lore);
			item.setItemMeta(im);
			
			BlockStorage.getInventory(b).replaceExistingItem(22, item);
			
			if (ChargableBlock.isChargable(b)) {
				if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
				ChargableBlock.addCharge(b, -getEnergyConsumption());
				progress.put(b, timeleft - 1);
			}
			else progress.put(b, timeleft - 1);
		}
		else {
			BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "));
			pushItems(b, processing.get(b).getOutput());
			
			progress.remove(b);
			processing.remove(b);
		}
	}
	else {
		for (int slot: getInputSlots()) {
			if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), SlimefunItems.BUCKET_OF_OIL, true)) {
				MachineRecipe r = new MachineRecipe(40, new ItemStack[0], new ItemStack[] {SlimefunItems.BUCKET_OF_FUEL});
				if (!fits(b, r.getOutput())) return;
				BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), 1));
				processing.put(b, r);
				progress.put(b, r.getTicks());
				break;
			}
		}
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:47,代码来源:Refinery.java

示例6: tick

import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void tick(Block b) {
	if (isProcessing(b)) {
		int timeleft = progress.get(b);
		if (timeleft > 0 && getSpeed() < 10) {
			ItemStack item = getProgressBar().clone();
	        item.setDurability(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
			ItemMeta im = item.getItemMeta();
			im.setDisplayName(" ");
			List<String> lore = new ArrayList<String>();
			lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
			lore.add("");
			lore.add(MachineHelper.getTimeLeft(timeleft / 2));
			im.setLore(lore);
			item.setItemMeta(im);
			
			BlockStorage.getInventory(b).replaceExistingItem(22, item);
			
			if (ChargableBlock.isChargable(b)) {
				if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
				ChargableBlock.addCharge(b, -getEnergyConsumption());
				progress.put(b, timeleft - 1);
			}
			else progress.put(b, timeleft - 1);
		}
		else if (ChargableBlock.isChargable(b)) {
			if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
			ChargableBlock.addCharge(b, -getEnergyConsumption());

			BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "));
			pushItems(b, processing.get(b).getOutput());
			
			progress.remove(b);
			processing.remove(b);
		}
	}
	else {
		for (int slot: getInputSlots()) {
			if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.GRAVEL), true)) {
				ItemStack output = SlimefunItems.SIFTED_ORE;
				if (CSCoreLib.randomizer().nextInt(100) < 16) output = new ItemStack(Material.FLINT);
				if (CSCoreLib.randomizer().nextInt(100) < 16) output = new ItemStack(Material.CLAY_BALL);
				
				MachineRecipe r = new MachineRecipe(3 / getSpeed(), new ItemStack[0], new ItemStack[] {output});
				if (!fits(b, r.getOutput())) return;
				BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), 1));
				processing.put(b, r);
				progress.put(b, r.getTicks());
				break;
			}
		}
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:54,代码来源:ElectricGoldPan.java

示例7: tick

import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void tick(Block b) {
	if (isProcessing(b)) {
		int timeleft = progress.get(b);
		if (timeleft > 0) {
			ItemStack item = getProgressBar().clone();
	        item.setDurability(MachineHelper.getDurability(item, timeleft, processing.get(b).getTicks()));
			ItemMeta im = item.getItemMeta();
			im.setDisplayName(" ");
			List<String> lore = new ArrayList<String>();
			lore.add(MachineHelper.getProgress(timeleft, processing.get(b).getTicks()));
			lore.add("");
			lore.add(MachineHelper.getTimeLeft(timeleft / 2));
			im.setLore(lore);
			item.setItemMeta(im);
			
			BlockStorage.getInventory(b).replaceExistingItem(22, item);
			
			if (ChargableBlock.isChargable(b)) {
				if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
				ChargableBlock.addCharge(b, -getEnergyConsumption());
				progress.put(b, timeleft - 1);
			}
			else progress.put(b, timeleft - 1);
		}
		else {
			BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "));
			pushItems(b, processing.get(b).getOutput());
			
			progress.remove(b);
			processing.remove(b);
		}
	}
	else {
		MachineRecipe r = null;
		Map<Integer, Integer> found = new HashMap<Integer, Integer>();
		outer:
		for (MachineRecipe recipe: recipes) {
			for (ItemStack input: recipe.getInput()) {
				slots:
				for (int slot: getInputSlots()) {
					if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), input, true)) {
						found.put(slot, input.getAmount());
						break slots;
					}
				}
			}
			if (found.size() == recipe.getInput().length) {
				r = recipe;
				break outer;
			}
			else found.clear();
		}
		
		if (r != null) {
			if (!fits(b, r.getOutput())) return;
			for (Map.Entry<Integer, Integer> entry: found.entrySet()) {
				BlockStorage.getInventory(b).replaceExistingItem(entry.getKey(), InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(entry.getKey()), entry.getValue()));
			}
			processing.put(b, r);
			progress.put(b, r.getTicks());
		}
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:65,代码来源:HeatedPressureChamber.java


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