下面列出了org.bukkit.Material#REDSTONE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private Material getDropType(){
if (type == UniversalMaterial.NETHER_QUARTZ_ORE.getType()){
return Material.QUARTZ;
}
switch (type){
case DIAMOND_ORE:
return Material.DIAMOND;
case GOLD_ORE:
return Material.GOLD_INGOT;
case IRON_ORE:
return Material.IRON_INGOT;
case COAL_ORE:
return Material.COAL;
case LAPIS_ORE:
return UniversalMaterial.LAPIS_LAZULI.getType();
case EMERALD_ORE:
return Material.EMERALD;
case REDSTONE_ORE:
return Material.REDSTONE;
case GRAVEL:
return Material.FLINT;
}
return null;
}
/**
* This method returns the outcome that mining certain ores yields.
*
* @param ore
* The {@link Material} of the ore that was mined
*
* @return The outcome when mining this ore
*/
public ItemStack getOutcome(Material ore) {
if (hasSilkTouch()) {
return new ItemStack(ore);
}
Random random = ThreadLocalRandom.current();
switch (ore) {
case COAL_ORE:
return new ItemStack(Material.COAL);
case DIAMOND_ORE:
return new ItemStack(Material.DIAMOND);
case EMERALD_ORE:
return new ItemStack(Material.EMERALD);
case NETHER_QUARTZ_ORE:
return new ItemStack(Material.QUARTZ);
case REDSTONE_ORE:
return new ItemStack(Material.REDSTONE, 4 + random.nextInt(2));
case LAPIS_ORE:
return new ItemStack(Material.LAPIS_LAZULI, 4 + random.nextInt(4));
default:
// This includes Iron and Gold ore
return new ItemStack(ore);
}
}
@Test
public void testSoulboundSlimefunItem() {
SlimefunItem item = new SoulboundMock(new Category(new NamespacedKey(plugin, "soulbound_category"), new CustomItem(Material.REDSTONE, "&4Walshrus forever")));
item.register(plugin);
Assertions.assertTrue(SlimefunUtils.isSoulbound(item.getItem()));
}
@Override
protected ItemStack getIcon()
{
return new ItemStack(Material.REDSTONE);
}
private ItemStack brew(Material input, Material potionType, PotionMeta potion) {
PotionData data = potion.getBasePotionData();
if (data.getType() == PotionType.WATER) {
if (input == Material.FERMENTED_SPIDER_EYE) {
potion.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false));
return new ItemStack(potionType);
}
else if (input == Material.NETHER_WART) {
potion.setBasePotionData(new PotionData(PotionType.AWKWARD, false, false));
return new ItemStack(potionType);
}
else if (potionType == Material.POTION && input == Material.GUNPOWDER) {
return new ItemStack(Material.SPLASH_POTION);
}
else if (potionType == Material.SPLASH_POTION && input == Material.DRAGON_BREATH) {
return new ItemStack(Material.LINGERING_POTION);
}
else {
return null;
}
}
else if (input == Material.FERMENTED_SPIDER_EYE) {
potion.setBasePotionData(new PotionData(fermentations.get(data.getType()), false, false));
return new ItemStack(potionType);
}
else if (input == Material.REDSTONE) {
potion.setBasePotionData(new PotionData(data.getType(), true, data.isUpgraded()));
return new ItemStack(potionType);
}
else if (input == Material.GLOWSTONE_DUST) {
potion.setBasePotionData(new PotionData(data.getType(), data.isExtended(), true));
return new ItemStack(potionType);
}
else if (data.getType() == PotionType.AWKWARD && potionRecipes.containsKey(input)) {
potion.setBasePotionData(new PotionData(potionRecipes.get(input), false, false));
return new ItemStack(potionType);
}
else {
return null;
}
}
public SoulboundMock(Category category) {
super(category, new SlimefunItemStack("MOCK_SOULBOUND", Material.REDSTONE, "&4Almighty Redstone"), RecipeType.NULL, new ItemStack[9]);
}