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


Java TreeSpecies类代码示例

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


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

示例1: jungleWoodPlanksCanCreateCraftingTableAndJungleWoodStairs

import org.bukkit.TreeSpecies; //导入依赖的package包/类
@Test
public void jungleWoodPlanksCanCreateCraftingTableAndJungleWoodStairs() {
    Tree planks = new Tree(Material.WOOD);
    planks.setSpecies(TreeSpecies.JUNGLE);
    MaterialRecipes materialRecipes = recipeSnapshot.getMaterialRecipes(planks);
    boolean foundWorkBench = false;
    boolean foundJungleWoodPlanks = false;
    for (Recipe recipe : materialRecipes.getUsages()) {
        ItemStack result = recipe.getResult();
        if (Material.WORKBENCH.equals(result.getType())) {
            foundWorkBench = true;
        } else if (Material.JUNGLE_WOOD_STAIRS.equals(result.getType())) {
            foundJungleWoodPlanks = true;
        }
    }
    assertEqual(true, foundWorkBench);
    assertEqual(true, foundJungleWoodPlanks);
}
 
开发者ID:sciolizer,项目名称:craftinomicon,代码行数:19,代码来源:RecipeSnapshotTest.java

示例2: findJungleLog

import org.bukkit.TreeSpecies; //导入依赖的package包/类
/**
 * Finds a jungle log around this crop block.
 * @param crop The block to check around.
 * @return The rotation for which a jungle log was found, null otherwise.
 */
private BlockRotation findJungleLog(BlockLocation crop) {
    for (BlockRotation r : BlockRotation.values()) {
        Block block = crop.getRelative(r.getYawFace()).getBlock();
        if (block.getType() == Material.LOG) {
            BlockState state = block.getState();
            try {
                Tree tree = (Tree) state.getData();
                if (tree.getSpecies() == TreeSpecies.JUNGLE) {
                    return r;
                }
            } catch (ClassCastException e) {
            }
        }
    }
    return null;
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:22,代码来源:CropCocoa.java

示例3: checkForDoubleDrop

import org.bukkit.TreeSpecies; //导入依赖的package包/类
/**
 * Checks for double drops
 *
 * @param blockState Block being broken
 */
protected static void checkForDoubleDrop(BlockState blockState) {
    if (mcMMO.getModManager().isCustomLog(blockState) && mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) {
        Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
    }
    else {
        //TODO Remove this workaround when casting to Tree works again
        TreeSpecies species = TreeSpecies.GENERIC;
        if (blockState.getData() instanceof Tree) {
            species = ((Tree) blockState.getData()).getSpecies();
        }

        if (Config.getInstance().getWoodcuttingDoubleDropsEnabled(species)) {
            Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
        }
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:22,代码来源:Woodcutting.java

示例4: getTreeSpecies

import org.bukkit.TreeSpecies; //导入依赖的package包/类
public static TreeSpecies getTreeSpecies(EntityBoat.EnumBoatType boatType) {
    switch (boatType) {
        case SPRUCE:
            return TreeSpecies.REDWOOD;
        case BIRCH:
            return TreeSpecies.BIRCH;
        case JUNGLE:
            return TreeSpecies.JUNGLE;
        case ACACIA:
            return TreeSpecies.ACACIA;
        case DARK_OAK:
            return TreeSpecies.DARK_OAK;
        case OAK:
        default:
            return TreeSpecies.GENERIC;
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:18,代码来源:CraftBoat.java

示例5: getBoatType

import org.bukkit.TreeSpecies; //导入依赖的package包/类
public static EntityBoat.EnumBoatType getBoatType(TreeSpecies species) {
    switch (species) {
        case REDWOOD:
            return EntityBoat.EnumBoatType.SPRUCE;
        case BIRCH:
            return EntityBoat.EnumBoatType.BIRCH;
        case JUNGLE:
            return EntityBoat.EnumBoatType.JUNGLE;
        case ACACIA:
            return EntityBoat.EnumBoatType.ACACIA;
        case DARK_OAK:
            return EntityBoat.EnumBoatType.DARK_OAK;
        case GENERIC:
        default:
            return EntityBoat.EnumBoatType.OAK;
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:18,代码来源:CraftBoat.java

示例6: getContents

import org.bukkit.TreeSpecies; //导入依赖的package包/类
/**
 * Get the material in the flower pot
 *
 * @return material MaterialData for the block currently in the flower pot
 *     or null if empty
 */
public MaterialData getContents() {
    switch (getData()) {
        case 1:
            return new MaterialData(Material.RED_ROSE);
        case 2:
            return new MaterialData(Material.YELLOW_FLOWER);
        case 3:
            return new Tree(TreeSpecies.GENERIC);
        case 4:
            return new Tree(TreeSpecies.REDWOOD);
        case 5:
            return new Tree(TreeSpecies.BIRCH);
        case 6:
            return new Tree(TreeSpecies.JUNGLE);
        case 7:
            return new MaterialData(Material.RED_MUSHROOM);
        case 8:
            return new MaterialData(Material.BROWN_MUSHROOM);
        case 9:
            return new MaterialData(Material.CACTUS);
        case 10:
            return new MaterialData(Material.DEAD_BUSH);
        case 11:
            return new LongGrass(GrassSpecies.FERN_LIKE);
        default:
            return null;
    }
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:35,代码来源:FlowerPot.java

示例7: getExperienceFromLog

import org.bukkit.TreeSpecies; //导入依赖的package包/类
/**
 * Retrieves the experience reward from a log
 *
 * @param blockState Log being broken
 * @param experienceGainMethod How the log is being broken
 * @return Amount of experience
 */
protected static int getExperienceFromLog(BlockState blockState, ExperienceGainMethod experienceGainMethod) {
    // Mushrooms aren't trees so we could never get species data from them
    switch (blockState.getType()) {
        case HUGE_MUSHROOM_1:
            return ExperienceConfig.getInstance().getWoodcuttingXPHugeBrownMushroom();

        case HUGE_MUSHROOM_2:
            return ExperienceConfig.getInstance().getWoodcuttingXPHugeRedMushroom();

        default:
            break;
    }

    if (mcMMO.getModManager().isCustomLog(blockState)) {
        return mcMMO.getModManager().getBlock(blockState).getXpGain();
    }

    //TODO Remove this workaround when casting to Tree works again
    TreeSpecies species = TreeSpecies.GENERIC;
    if (blockState.getData() instanceof Tree) {
        species = ((Tree) blockState.getData()).getSpecies();
    }

    int xp = ExperienceConfig.getInstance().getWoodcuttingTreeXP(species);

    if (species == TreeSpecies.JUNGLE && experienceGainMethod == ExperienceGainMethod.TREE_FELLER) {
        xp *= 0.5;
    }

    return xp;
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:39,代码来源:Woodcutting.java

示例8: getContents

import org.bukkit.TreeSpecies; //导入依赖的package包/类
/**
 * Get the material in the flower pot
 *
 * @return material MaterialData for the block currently in the flower pot or null if empty
 */
public MaterialData getContents() {
    switch (getData()) {
        case 1:
            return new MaterialData(Material.RED_ROSE);
        case 2:
            return new MaterialData(Material.YELLOW_FLOWER);
        case 3:
            return new Tree(TreeSpecies.GENERIC);
        case 4:
            return new Tree(TreeSpecies.REDWOOD);
        case 5:
            return new Tree(TreeSpecies.BIRCH);
        case 6:
            return new Tree(TreeSpecies.JUNGLE);
        case 7:
            return new MaterialData(Material.RED_MUSHROOM);
        case 8:
            return new MaterialData(Material.BROWN_MUSHROOM);
        case 9:
            return new MaterialData(Material.CACTUS);
        case 10:
            return new MaterialData(Material.DEAD_BUSH);
        case 11:
            return new LongGrass(GrassSpecies.FERN_LIKE);
        default:
            return null;
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-API,代码行数:34,代码来源:FlowerPot.java

示例9: addCustomRecipes

import org.bukkit.TreeSpecies; //导入依赖的package包/类
@Override
public void addCustomRecipes(CustomRecipeManager crm) {
    for (TreeSpecies species : TreeSpecies.values()) {
        crm.addCustomRecipe(new SimpleCustomRecipe(this, STBUtil.makeLog(species).toItemStack(1), STBUtil.makePlank(species).toItemStack(6), 60));
    }
    crm.addCustomRecipe(new SimpleCustomRecipe(this, new ItemStack(Material.WOOD_DOOR), new ItemStack(Material.WOOD, 6), 40));
    crm.addCustomRecipe(new SimpleCustomRecipe(this, new ItemStack(Material.TRAP_DOOR), new ItemStack(Material.WOOD, 3), 40));
    crm.addCustomRecipe(new SimpleCustomRecipe(this, new ItemStack(Material.WOOD_PLATE), new ItemStack(Material.WOOD, 2), 40));
    crm.addCustomRecipe(new SimpleCustomRecipe(this, new ItemStack(Material.WOOD_BUTTON), new ItemStack(Material.WOOD, 1), 40));
    crm.addCustomRecipe(new SimpleCustomRecipe(this, new ItemStack(Material.WORKBENCH), new ItemStack(Material.WOOD, 4), 40));
    crm.addCustomRecipe(new SimpleCustomRecipe(this, new ItemStack(Material.SIGN), new ItemStack(Material.WOOD, 2), 40));
    crm.addCustomRecipe(new SimpleCustomRecipe(this, new ItemStack(Material.CHEST), new ItemStack(Material.WOOD, 8), 40));
}
 
开发者ID:desht,项目名称:sensibletoolbox,代码行数:14,代码来源:Sawmill.java

示例10: wood

import org.bukkit.TreeSpecies; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public static ItemStack wood(TreeSpecies type, String name, String... lores) {
    return setNameAndLores(new ItemStack(Material.WOOD, 1, type.getData()), name, lores);
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:5,代码来源:GuiUtil.java

示例11: Leaves

import org.bukkit.TreeSpecies; //导入依赖的package包/类
public Leaves(TreeSpecies species) {
    this();
    setSpecies(species);
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:5,代码来源:Leaves.java

示例12: Tree

import org.bukkit.TreeSpecies; //导入依赖的package包/类
public Tree(TreeSpecies species) {
    this();
    setSpecies(species);
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:5,代码来源:Tree.java

示例13: WoodenStep

import org.bukkit.TreeSpecies; //导入依赖的package包/类
public WoodenStep(TreeSpecies species) {
    this();
    setSpecies(species);
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:5,代码来源:WoodenStep.java

示例14: LumberjackSkill

import org.bukkit.TreeSpecies; //导入依赖的package包/类
public LumberjackSkill() {
	File configFile = new File(QuestManagerPlugin.questManagerPlugin.getDataFolder(),
			QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getSkillPath() + CONFIG_NAME);
	YamlConfiguration config = createConfig(configFile);

	
	if (!config.getBoolean("enabled", true)) {
		return;
	}
	
	this.startingLevel = config.getInt("startingLevel", 0);
	this.timingBase = config.getDouble("timingBase", .3);
	this.timingRate = config.getDouble("timingRate", .002);
	this.baseDelay = config.getDouble("baseTime", 1.5);
	this.delayDeviation = config.getDouble("delayDeviation", .25);
	this.baseHits = config.getInt("baseHits", 5);
	this.hitRate = config.getDouble("hitRate", .1);
	this.hitBonus = config.getDouble("hitBonus", .005);
	this.extraWoodPerLevel = config.getDouble("extraWoodPerLevel", 0.05);
	this.maxDifficultyRange = config.getInt("maxDifficultyRange", 20);
	this.qualityRate = config.getDouble("qualityRate", 0.01);
	this.millingEnabled = config.getBoolean("millingEnabled", true);
	this.millPenalty = config.getDouble("millPenalty", 0.05);
	this.restrictLower = config.getBoolean("restrictLower", false);
	
	this.activeSessions = new HashMap<>();
	this.lastLocations = new HashMap<>();
	this.treeRecords = new LinkedList<>();
	if (!config.contains("trees")) {
		QuestManagerPlugin.logger.warning("Didn't find any tree table"
				+ "for LumberjackSkill even though it's enabled!");
		return;
	} else {
		/*
		 * trees:
		 *   Elm:
		 *     difficulty: 40
		 *     ...
		 *   Witchwood:
		 *     difficulty: 85
		 *     ...
		 */
		ConfigurationSection sex = config.getConfigurationSection("trees"), subsex;
		RegionManager rManager = QuestManagerPlugin.questManagerPlugin.getEnemyManager();
		for (String key : sex.getKeys(false)) {
			if (key.startsWith("==")) {
				continue;
			}
							
			subsex = sex.getConfigurationSection(key);
			try {
				Wood wood = new Wood(Material.LOG, TreeSpecies.valueOf(subsex.getString("treeType").toUpperCase()));
				treeRecords.add(new TreeRecord(
						subsex.getInt("difficulty"), key,
						subsex.getItemStack("reward"), subsex.getInt("woodCount"),
						wood, rManager.getRegion(subsex.contains("region") ? 
								(subsex.get("region") == null ? null : ((LocationState) subsex.get("region")).getLocation())
								: null)
						));
			} catch (Exception e) {
				e.printStackTrace();
				QuestManagerPlugin.logger.warning("Skipping that one! ^");
			}
			
		}
	}
			
	LumberjackSequence.setSkillLink(this);
	Bukkit.getPluginManager().registerEvents(this, QuestManagerPlugin.questManagerPlugin);
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:71,代码来源:LumberjackSkill.java

示例15: createConfig

import org.bukkit.TreeSpecies; //导入依赖的package包/类
private YamlConfiguration createConfig(File configFile) {
	if (!configFile.exists()) {
		YamlWriter writer = new YamlWriter();
		
		writer.addLine("enabled", true, Lists.newArrayList("Whether or not this skill is allowed to be used.",  "true | false"))
			.addLine("startingLevel", 0, Lists.newArrayList("The level given to players who don't have this skill yet", "[int]"))
			.addLine("timingBase", .3, Lists.newArrayList("Base time a player can be early or late", "and still count as having hit", "[double] number of seconds"))
			.addLine("timingRate", .002, Lists.newArrayList("How many fewer seconds per difficulty", "that a player can hit and have it count", "[double] number of seconds"))
			.addLine("baseDelay", 1.5, Lists.newArrayList("Average time it takes to wind up a good", "swing. Shorter times are harder", "[double] number of seconds"))
			.addLine("delayDeviation", .25, Lists.newArrayList("Standard deviation on time for a", "full swing. Google [Std Deviation] for info", "[double] number of seconds"))
			.addLine("baseHits", 5, Lists.newArrayList("Base number of hits a player must make", "to fell the tree and get the wood.", "Larger numbers mean longer cutting times", "[int] larger than 0"))
			.addLine("hitRate", 0.1, Lists.newArrayList("Hits added to total hit count per", "difficulty of the wood", "[double] number of hits"))
			.addLine("hitBonus", .25, Lists.newArrayList("How much of the hits to subtract per", "skill level", "[double] .01 is 1%"))
			.addLine("extraWoodPerLevel", 0.05, Lists.newArrayList("Extra pieces of wood given to a player", "per level over difficulty level", "[double] 1.0 is a whole extra log"))
			.addLine("maxDifficultyRange", 20, Lists.newArrayList("Biggest gap between player and ore difficulty", "that will be allowed through RANDOM ore", "algorithm", "[int] larger than 0"))
			.addLine("qualityRate", 0.01, Lists.newArrayList("Bonus to quality per mining skill level", "[double] .01 is 1%"))
			.addLine("millingEnabled", true, Lists.newArrayList("Can players use logs on crafting tables", "and get a single item stack of average quality", "[true|false]"))
			.addLine("millPenalty", 0.05, Lists.newArrayList("If milling two items, how much of the sum quality", "is lost in the process?", "[double] .01 is 1%"))
			.addLine("restrictLower", false, Lists.newArrayList("Prevent players from getting wood with level too much lower than theirs"));
		
		
		Map<String, Map<String, Object>> map = new HashMap<>();
		Map<String, Object> sub = new HashMap<>();
		
		sub.put("difficulty", 10);
		ItemStack item = (new Wood(Material.LOG, TreeSpecies.GENERIC)).toItemStack();
		ItemMeta meta = item.getItemMeta();
		meta.setDisplayName("Oak Wood");
		meta.setLore(Lists.newArrayList("Common wood of common", "quality. Very useful"));
		item.setItemMeta(meta);
		sub.put("reward", item);
		sub.put("treeType", TreeSpecies.GENERIC.name());
		sub.put("woodCount", 2);
		sub.put("region", null);
		map.put("Oak", sub);
		
		
		sub = new HashMap<>();
		sub.put("difficulty", 15);
		item = (new Wood(Material.LOG, TreeSpecies.GENERIC)).toItemStack();
		meta = item.getItemMeta();
		meta.setDisplayName("WarmOak Wood");
		meta.setLore(Lists.newArrayList("Specialty oak prized over", "regular oak for it's color"));
		item.setItemMeta(meta);
		sub.put("reward", item);
		sub.put("treeType", TreeSpecies.GENERIC.name());
		sub.put("woodCount", 1);
		sub.put("region", new Location(Bukkit.getWorld("QuestWorld"), -400, 55, -855));
		map.put("WarmOak", sub);
		
		
		sub = new HashMap<>();
		sub.put("difficulty", 20);
		item = (new Wood(Material.LOG, TreeSpecies.BIRCH)).toItemStack();
		meta = item.getItemMeta();
		meta.setDisplayName("Birch Wood");
		meta.setLore(Lists.newArrayList("Light, eyed wood with little", "strength. It's value comes from", "it's color"));
		item.setItemMeta(meta);
		sub.put("reward", item);
		sub.put("treeType", TreeSpecies.BIRCH.name());
		sub.put("woodCount", 2);
		sub.put("region", null);
		map.put("Birch", sub);
		
		
		writer.addLine("trees", map, Lists.newArrayList("List of wood types and trees/regions", "they can be found at. If region is", "null, only the wood type", "and player level is taken into account.", "Plan difficulties carefully, as players that are", "at a level with no wood in range (maxDifficultyRange)", "are stuck forever!", "name: {difficulty: [int], reward: [itemstack], woodCount: [int], treeType: [TreeSpecies], region: [null or Location]}"));
		
		try {
			writer.save(configFile);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return writer.buildYaml();
	}
	
	YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
	return config;
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:80,代码来源:LumberjackSkill.java


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