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


Java ChargableBlock.isChargable方法代码示例

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


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

示例1: tick

import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; //导入方法依赖的package包/类
protected void tick(Block b) {
	if (ChargableBlock.isChargable(b)) {
		if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
		int i = getSize() / 2;
		loop:
    	for (int x = -i; x <= i; x++) {
    		for (int z = -i; z <= i; z++) {
        		Block block = new Location(b.getWorld(), b.getX() + x, b.getY() + 2, b.getZ() + z).getBlock();
        		if (canHarvest(block)) {
        			ItemStack item = harvest(block);
        			if (!fits(block, new ItemStack[] {item})) break loop;
        			pushItems(b, new ItemStack[] {item});
        			ChargableBlock.addCharge(b, -getEnergyConsumption());
        			break loop;
        		}
        	}
    	}
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:20,代码来源:AFarm.java

示例2: tick

import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; //导入方法依赖的package包/类
protected void tick(Block b)
    {
        if(ChargableBlock.isChargable(b))
        {
            if(ChargableBlock.getCharge(b) < getEnergyConsumption())
                return;
            int i = getSize() / 2;
label0:
            for(int x = -i; x <= i; x++)
            {
                for(int z = -i; z <= i; z++)
                {
                    Block block = (new Location(b.getWorld(), b.getX() + x, b.getY() + 2, b.getZ() + z)).getBlock();
                    if(!canHarvest(block))
                        continue;
                    ItemStack item = harvest(block);
                    if(fits(block, new ItemStack[] {
    item
}))
                    {
                        pushItems(b, new ItemStack[] {
                            item
                        });
                        ChargableBlock.addCharge(b, -getEnergyConsumption());
                    }
                    break label0;
                }

            }

        }
    }
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:33,代码来源:AFarm.java

示例3: tick

import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; //导入方法依赖的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().clone());
			
			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:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:65,代码来源:AContainer.java

示例4: tick

import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; //导入方法依赖的package包/类
protected void tick(Block b)
{
    if(isProcessing(b))
    {
        int timeleft = ((Integer)progress.get(b)).intValue();
        if(timeleft > 0)
        {
            ItemStack item = getProgressBar().clone();
            item.setDurability(MachineHelper.getDurability(item, timeleft, ((MachineRecipe)processing.get(b)).getTicks()));
            ItemMeta im = item.getItemMeta();
            im.setDisplayName(" ");
            List lore = new ArrayList();
            lore.add(MachineHelper.getProgress(timeleft, ((MachineRecipe)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, Integer.valueOf(timeleft - 1));
            } else
            {
                progress.put(b, Integer.valueOf(timeleft - 1));
            }
        } else
        {
            BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte)15), " ", new String[0]));
            pushItems(b, ((MachineRecipe)processing.get(b)).getOutput());
            progress.remove(b);
            processing.remove(b);
        }
    } else
    {
        int ai[];
        int j = (ai = getInputSlots()).length;
        for(int i = 0; i < j; i++)
        {
            int slot = ai[i];
            if(!SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), SlimefunItems.BUCKET_OF_OIL, true))
                continue;
            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, Integer.valueOf(r.getTicks()));
            break;
        }

    }
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:58,代码来源:Refinery.java

示例5: tick

import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; //导入方法依赖的package包/类
protected void tick(Block b)
{
    if(isProcessing(b))
    {
        int timeleft = ((Integer)progress.get(b)).intValue();
        if(timeleft > 0)
        {
            ItemStack item = getProgressBar().clone();
            item.setDurability(MachineHelper.getDurability(item, timeleft, ((MachineRecipe)processing.get(b)).getTicks()));
            ItemMeta im = item.getItemMeta();
            im.setDisplayName(" ");
            List lore = new ArrayList();
            lore.add(MachineHelper.getProgress(timeleft, ((MachineRecipe)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, Integer.valueOf(timeleft - 1));
            } else
            {
                progress.put(b, Integer.valueOf(timeleft - 1));
            }
        } else
        {
            BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte)15), " ", new String[0]));
            pushItems(b, ((MachineRecipe)processing.get(b)).getOutput());
            progress.remove(b);
            processing.remove(b);
        }
    } else
    {
        MachineRecipe r = null;
        Map found = new HashMap();
        for(Iterator iterator = recipes.iterator(); iterator.hasNext(); found.clear())
        {
            MachineRecipe recipe = (MachineRecipe)iterator.next();
            ItemStack aitemstack[];
            int j = (aitemstack = recipe.getInput()).length;
            for(int i = 0; i < j; i++)
            {
                ItemStack input = aitemstack[i];
                int ai[];
                int l = (ai = getInputSlots()).length;
                for(int k = 0; k < l; k++)
                {
                    int slot = ai[k];
                    if(!SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), input, true))
                        continue;
                    found.put(Integer.valueOf(slot), Integer.valueOf(input.getAmount()));
                    break;
                }

            }

            if(found.size() != recipe.getInput().length)
                continue;
            r = recipe;
            break;
        }

        if(r != null)
        {
            if(!fits(b, r.getOutput()))
                return;
            java.util.Map.Entry entry;
            for(Iterator iterator1 = found.entrySet().iterator(); iterator1.hasNext(); BlockStorage.getInventory(b).replaceExistingItem(((Integer)entry.getKey()).intValue(), InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(((Integer)entry.getKey()).intValue()), ((Integer)entry.getValue()).intValue())))
                entry = (java.util.Map.Entry)iterator1.next();

            processing.put(b, r);
            progress.put(b, Integer.valueOf(r.getTicks()));
        }
    }
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:80,代码来源:HeatedPressureChamber.java

示例6: debug

import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void debug(PlayerInteractEvent e) {
	if (e.getAction().equals(Action.PHYSICAL) || !e.getHand().equals(EquipmentSlot.HAND)) return;
	Player p = e.getPlayer();
	if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.DEBUG_FISH, true) || SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInOffHand(), SlimefunItems.DEBUG_FISH, true)) {
		e.setCancelled(true);
		if (p.isOp()) {
			switch (e.getAction()) {
			case LEFT_CLICK_BLOCK: {
				if (p.isSneaking()) {
					if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
						BlockStorage.clearBlockInfo(e.getClickedBlock());
					}
				}
				else e.setCancelled(false);
				break;
			}
			case RIGHT_CLICK_BLOCK: {
				if (p.isSneaking()) {
					Block b = e.getClickedBlock().getRelative(e.getBlockFace());
					b.setType(Material.SKULL);
					try {
						CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTllYjlkYTI2Y2YyZDMzNDEzOTdhN2Y0OTEzYmEzZDM3ZDFhZDEwZWFlMzBhYjI1ZmEzOWNlYjg0YmMifX19");
					} catch (Exception e1) {
						e1.printStackTrace();
					}
				}
				else if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
					p.sendMessage(" ");
					p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&d" + e.getClickedBlock().getType() + ":" + e.getClickedBlock().getData() + " &[email protected] X: " + e.getClickedBlock().getX() + " Y: " + e.getClickedBlock().getY() + " Z: " + e.getClickedBlock().getZ()));
					p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dID: " + "&e" + BlockStorage.checkID(e.getClickedBlock())));
					if (e.getClickedBlock().getState() instanceof Skull) {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dSkull: " + "&2\u2714"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dRotation: &e" + ((Skull) e.getClickedBlock().getState()).getRotation().toString()));
					}
					if (BlockStorage.getStorage(e.getClickedBlock().getWorld()).hasInventory(e.getClickedBlock().getLocation())) {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dInventory: " + "&2\u2714"));
					}
					else {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dInventory: " + "&4\u2718"));
					}
					if (BlockStorage.check(e.getClickedBlock()).isTicking()) {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dTicking: " + "&2\u2714"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dAsync: &e" + (BlockStorage.check(e.getClickedBlock()).getTicker().isSynchronized() ? "&4\u2718": "&2\u2714")));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dTimings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock()) + "ms"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dTotal Timings: &e" + SlimefunStartup.ticker.getTimings(BlockStorage.checkID(e.getClickedBlock())) + "ms"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dChunk Timings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock().getChunk()) + "ms"));
					}
					else if (BlockStorage.check(e.getClickedBlock()).getEnergyTicker() != null) {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dTicking: " + "&b~ &3(Indirect)"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dTimings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock()) + "ms"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dChunk Timings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock().getChunk()) + "ms"));
					}
					else {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dTicking: " + "&4\u2718"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&dTicking: " + "&4\u2718"));
					}
					if (ChargableBlock.isChargable(e.getClickedBlock())) {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dChargable: " + "&2\u2714"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dEnergy: &e" + ChargableBlock.getCharge(e.getClickedBlock()) + " / " + ChargableBlock.getMaxCharge(e.getClickedBlock())));
					}
					else {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dChargable: " + "&4\u2718"));
					}
					p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6" + BlockStorage.getBlockInfoAsJson(e.getClickedBlock())));
					p.sendMessage(" ");
				}
				break;
			}
			default:
				break;
				
			}
		}
	}
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:78,代码来源:ItemListener.java

示例7: tick

import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; //导入方法依赖的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

示例8: tick

import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; //导入方法依赖的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

示例9: tick

import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; //导入方法依赖的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

示例10: debug

import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void debug(PlayerInteractEvent e) {
	if (e.getAction().equals(Action.PHYSICAL) || !e.getHand().equals(EquipmentSlot.HAND)) return;
	Player p = e.getPlayer();
	if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.DEBUG_FISH, true) || SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInOffHand(), SlimefunItems.DEBUG_FISH, true)) {
		e.setCancelled(true);
		if (p.isOp()) {
			switch (e.getAction()) {
			case LEFT_CLICK_BLOCK: {
				if (p.isSneaking()) {
					if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
						BlockStorage.clearBlockInfo(e.getClickedBlock());
					}
				}
				else e.setCancelled(false);
				break;
			}
			case RIGHT_CLICK_BLOCK: {
				if (p.isSneaking()) {
					Block b = e.getClickedBlock().getRelative(e.getBlockFace());
					b.setType(Material.SKULL);
					try {
						CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTllYjlkYTI2Y2YyZDMzNDEzOTdhN2Y0OTEzYmEzZDM3ZDFhZDEwZWFlMzBhYjI1ZmEzOWNlYjg0YmMifX19");
					} catch (Exception e1) {
						e1.printStackTrace();
					}
				}
				else if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
					p.sendMessage(" ");
					p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&d" + e.getClickedBlock().getType() + ":" + e.getClickedBlock().getData() + " &[email protected] X: " + e.getClickedBlock().getX() + " Y: " + e.getClickedBlock().getY() + " Z: " + e.getClickedBlock().getZ()));
					p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dID: " + "&e" + BlockStorage.checkID(e.getClickedBlock())));
					if (e.getClickedBlock().getState() instanceof Skull) {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dSkull: " + "&2\u2714"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dRotation: &e" + ((Skull) e.getClickedBlock().getState()).getRotation().toString()));
					}
					if (BlockStorage.getStorage(e.getClickedBlock().getWorld()).hasInventory(e.getClickedBlock().getLocation())) {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dInventory: " + "&2\u2714"));
					}
					else {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dInventory: " + "&4\u2718"));
					}
					if (BlockStorage.check(e.getClickedBlock()).isTicking()) {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dTicking: " + "&2\u2714"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dAsync: &e" + (BlockStorage.check(e.getClickedBlock()).getTicker().isSynchronized() ? "&4\u2718": "&2\u2714")));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dTimings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock()) + "ms"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dTotal Timings: &e" + SlimefunStartup.ticker.getTimings(BlockStorage.checkID(e.getClickedBlock())) + "ms"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dChunk Timings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock().getChunk()) + "ms"));
					}
					else if (BlockStorage.check(e.getClickedBlock()).getEnergyTicker() != null) {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dTicking: " + "&b~ &3(Indirect)"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dTimings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock()) + "ms"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dChunk Timings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock().getChunk()) + "ms"));
					}
					else {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dTicking: " + "&4\u2718"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&dTicking: " + "&4\u2718"));
					}
					if (ChargableBlock.isChargable(e.getClickedBlock())) {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dChargable: " + "&2\u2714"));
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "  &dEnergy: &e" + ChargableBlock.getCharge(e.getClickedBlock()) + " / " + ChargableBlock.getMaxCharge(e.getClickedBlock())));
					}
					else {
						p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dChargable: " + "&4\u2718"));
					}
					p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6" + BlockStorage.getBlockInfoAsJson(e.getClickedBlock())));
					p.sendMessage(" ");
				}
				break;
			}
			default:
				break;

			}
		}
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:78,代码来源:ItemListener.java


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