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


Java SpawnEggMeta类代码示例

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


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

示例1: parse

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
public static ItemMeta parse(Element xml, ItemMeta source) {
    if (source instanceof BannerMeta) {
        return parseBanner(xml, (BannerMeta) source);
    } else if (source instanceof BookMeta) {
        return parseBook(xml, (BookMeta) source);
    } else if (source instanceof EnchantmentStorageMeta) {
        return parseEnchantmentStorage(xml, (EnchantmentStorageMeta) source);
    } else if (source instanceof FireworkMeta) {
        return parseFirework(xml, (FireworkMeta) source);
    } else if (source instanceof FireworkEffectMeta) {
        return parseFireworkEffect(xml, (FireworkEffectMeta) source);
    } else if (source instanceof LeatherArmorMeta) {
        return parseLeatherArmor(xml, (LeatherArmorMeta) source);
    } else if (source instanceof MapMeta) {
        return parseMap(xml, (MapMeta) source);
    } else if (source instanceof PotionMeta) {
        return parsePotion(xml, (PotionMeta) source);
    } else if (source instanceof SkullMeta) {
        return parseSkull(xml, (SkullMeta) source);
    } else if (source instanceof SpawnEggMeta) {
        return parseSpawnEgg(xml, (SpawnEggMeta) source);
    }

    return source;
}
 
开发者ID:ShootGame,项目名称:Arcade2,代码行数:26,代码来源:XMLItemMeta.java

示例2: makeSpawnEgg

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
/**
 * Makes a call to the ExpenseHandler, generates a SpawnEgg, assigns data to
 * it and drops it where the mob used to be.
 * @param entry - The EggTrackerEntry we are dealing with for this SpawnEgg.
 */
public void makeSpawnEgg(EggTrackerEntry entry) {
    Player player = entry.getPlayer();
    LivingEntity livingEntity = entry.getEntity();
    expenseHandler.execute(player);
    ItemStack stack = new ItemStack(Material.MONSTER_EGG);
    SpawnEggMeta meta = (SpawnEggMeta) stack.getItemMeta();
    meta.setSpawnedType(livingEntity.getType());
    String name = Text.a + livingEntity.getType().getEntityClass().getSimpleName();
    
    if (livingEntity.getCustomName() != null) {
        name += ": " + livingEntity.getCustomName();
    }
    
    meta.setDisplayName(name);
    meta.setLore(new LorePacker(livingEntity).getLore());
    stack.setItemMeta(meta);
    livingEntity.getWorld().dropItem(livingEntity.getLocation(), stack);
    livingEntity.remove();
    player.sendMessage(String.format("%s%s%s%s captured successfully!", Text.tag, Text.a, livingEntity.getType().getEntityClass().getSimpleName(), Text.b));
}
 
开发者ID:RedPanda4552,项目名称:SimpleEgg,代码行数:26,代码来源:CaptureManager.java

示例3: getSpawnEgg

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
@Override
public ItemStack getSpawnEgg(EntityType type, int amount) {
    ItemStack egg = new ItemStack(Material.MONSTER_EGG, amount);
    SpawnEggMeta spm = (SpawnEggMeta)egg.getItemMeta();
    spm.setSpawnedType(type);
    egg.setItemMeta(spm);
    return egg;
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:9,代码来源:NMSHandler.java

示例4: getHorseItem

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
private ItemStack getHorseItem() {
    ItemStack item = new ItemStack(Material.MONSTER_EGG);
    SpawnEggMeta meta = (SpawnEggMeta) item.getItemMeta();
    meta.setSpawnedType(EntityType.HORSE);
    item.setItemMeta(meta);
    return item;
}
 
开发者ID:upperlevel,项目名称:book-api,代码行数:8,代码来源:Main.java

示例5: parseSpawnEgg

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
public static SpawnEggMeta parseSpawnEgg(Element xml, SpawnEggMeta source) {
    Element spawnerEgg = xml.getChild("spawner-egg");
    if (spawnerEgg != null) {
        EntityType entity = XMLEntity.parse(spawnerEgg.getTextNormalize());
        if (entity != null) {
            source.setSpawnedType(entity);
        }
    }

    return source;
}
 
开发者ID:ShootGame,项目名称:Arcade2,代码行数:12,代码来源:XMLItemMeta.java

示例6: eggUseOnEntity

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
@EventHandler
public void eggUseOnEntity(PlayerInteractEntityEvent event) {
    ItemStack stack = event.getPlayer().getInventory().getItemInMainHand();
    ItemMeta meta = stack.getItemMeta();
    
    if (meta instanceof SpawnEggMeta) {
        SpawnEggMeta spawnEggMeta = (SpawnEggMeta) meta;
        
        if (isSimpleEgg(spawnEggMeta)) {
            event.getPlayer().sendMessage(Text.tag + "You cannot use a SimpleEgg to make babies out of other adult mobs.");
            event.setCancelled(true);
        }
    }
}
 
开发者ID:RedPanda4552,项目名称:SimpleEgg,代码行数:15,代码来源:ListenerEggEvents.java

示例7: isVersionCurrent

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
/**
 * Check if an egg's identifier line exists and the version on it matches
 * the current plugin version.
 * @return True if the egg is current, false otherwise.
 */
private boolean isVersionCurrent(SpawnEggMeta meta) {
    if (isSimpleEgg(meta)) {
        if (ChatColor.stripColor(meta.getLore().get(0)).endsWith(Main.getSelf().getDescription().getVersion())) {
            return true;
        }
    }
    
    return false;
}
 
开发者ID:RedPanda4552,项目名称:SimpleEgg,代码行数:15,代码来源:ListenerEggEvents.java

示例8: getEgg

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
public static String getEgg(ItemStack itemStack) {
	if (itemStack != null) {
		if (itemStack.getType() == Material.MONSTER_EGG) {
			ItemMeta itemMeta = itemStack.getItemMeta();
			if (itemMeta instanceof SpawnEggMeta) {
				SpawnEggMeta spawnEggMeta = (SpawnEggMeta) itemMeta;
				return spawnEggMeta.getSpawnedType() != null ? StringUtilities.capitalizeFully(spawnEggMeta.getSpawnedType().name()) : null;
			}
		}
	}
	return null;
}
 
开发者ID:KingFaris10,项目名称:KingKits,代码行数:13,代码来源:EggUtilities.java

示例9: initialize

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
@Override
public SerialItemData initialize(ItemStack stack) {
  ItemMeta meta = stack.getItemMeta();
  if(meta instanceof SpawnEggMeta) {
    valid = true;
    entity = ((SpawnEggMeta)meta).getSpawnedType().name();
  }
  return this;
}
 
开发者ID:TheNewEconomy,项目名称:TNE-Bukkit,代码行数:10,代码来源:SpawnEggData.java

示例10: build

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
@Override
public ItemStack build(ItemStack stack) {
  if(valid) {
    SpawnEggMeta meta = (SpawnEggMeta)stack.getItemMeta();
    meta.setSpawnedType(EntityType.valueOf(entity));
    stack.setItemMeta(meta);
  }
  return stack;
}
 
开发者ID:TheNewEconomy,项目名称:TNE-Bukkit,代码行数:10,代码来源:SpawnEggData.java

示例11: processMeta

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
@Override
public void processMeta(Player player, ItemMeta m) {//Add support for older versions
    super.processMeta(player, m);
    SpawnEggMeta meta = (SpawnEggMeta) m;
    meta.setSpawnedType(type);
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:7,代码来源:SpawnEggCustomItem.java

示例12: SpawnEggMetaStorage

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
public SpawnEggMetaStorage(SpawnEggMeta meta) {
    super(meta);
}
 
开发者ID:OrigamiDream,项目名称:Leveled-Storage,代码行数:4,代码来源:SpawnEggMetaStorage.java

示例13: isSimpleEgg

import org.bukkit.inventory.meta.SpawnEggMeta; //导入依赖的package包/类
/**
 * Check if an egg's identifier line exists, regardless of version.
 * @return True if it has an identifier of any version, false otherwise.
 */
private boolean isSimpleEgg(SpawnEggMeta meta) {
    return meta.hasLore() && ChatColor.stripColor(meta.getLore().get(0)).startsWith("Identifier: SimpleEgg." + meta.getSpawnedType().getEntityClass().getSimpleName());
}
 
开发者ID:RedPanda4552,项目名称:SimpleEgg,代码行数:8,代码来源:ListenerEggEvents.java


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