本文整理汇总了Java中org.bukkit.entity.Rabbit类的典型用法代码示例。如果您正苦于以下问题:Java Rabbit类的具体用法?Java Rabbit怎么用?Java Rabbit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Rabbit类属于org.bukkit.entity包,在下文中一共展示了Rabbit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: typeFromInt
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
private static Rabbit.Type typeFromInt(int i){
switch(i){
case 1:
return Rabbit.Type.BLACK;
case 2:
return Rabbit.Type.BLACK_AND_WHITE;
case 3:
return Rabbit.Type.BROWN;
case 4:
return Rabbit.Type.GOLD;
case 5:
return Rabbit.Type.SALT_AND_PEPPER;
case 6:
return Rabbit.Type.THE_KILLER_BUNNY;
case 7:
return Rabbit.Type.WHITE;
default:
break;
}
return Rabbit.Type.BLACK;
}
示例2: RabbitMenu
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public RabbitMenu(Plot plot, Rabbit rabbit) {
super(plot, rabbit);
//type
ItemStack type = new ItemStack(Material.BONE);
ItemMeta typeMeta = type.getItemMeta();
typeMeta.setDisplayName(ChatColor.GREEN + "Change type");
type.setItemMeta(typeMeta);
insertItem(type, event -> {
new RabbitTypeMenu(rabbit).open((Player) event.getWhoClicked());
event.setCancelled(true);
}, 0);
}
示例3: isPet
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
private boolean isPet(Entity entity) {
if (entity instanceof ArmorStand) {
final ArmorStand stand = (ArmorStand) entity;
final int xidentifier = (int) stand.getBodyPose().getZ();
final int identifier = (int) stand.getRightArmPose().getX();
if (xidentifier == 2877 && identifier == 2877) {
return true;
}
} else if (entity instanceof Rabbit && entity.getCustomName() != null && entity.getCustomName().equals("PetBlockIdentifier")) {
return true;
}
return false;
}
示例4: isDeadBall
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
private boolean isDeadBall(Entity entity) {
if (!this.isBall(entity)) {
if (entity instanceof ArmorStand) {
final ArmorStand stand = (ArmorStand) entity;
final int xidentifier = (int) stand.getBodyPose().getZ();
final int identifier = (int) stand.getRightArmPose().getX();
if (xidentifier == 2777 && identifier == 2777) {
return true;
}
} else if (entity instanceof Rabbit && entity.getCustomName() != null && entity.getCustomName().equals("MyBallsIdentifier")) {
return true;
}
}
return false;
}
示例5: fromMagic
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
protected static Rabbit.Type fromMagic(int magicValue) {
if (magicValue < INVERSE.length) {
return INVERSE[magicValue];
} else if (magicValue == 99) {
return Rabbit.Type.THE_KILLER_BUNNY;
}
// a default
return Rabbit.Type.BROWN;
}
示例6: fromMagic
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
protected static Rabbit.Type fromMagic(int magicValue){
if(magicValue < INVERSE.length){
return INVERSE[magicValue];
}else if(magicValue == 99){ return Rabbit.Type.THE_KILLER_BUNNY; }
// a default
return Rabbit.Type.BROWN;
}
示例7: onLoad
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
@Override
public void onLoad() {
add(Rabbit.Type.BROWN, "Brown", "BR");
add(Rabbit.Type.WHITE, "White", "WH", "W");
add(Rabbit.Type.BLACK, "Black", "BL", "B");
add(Rabbit.Type.BLACK_AND_WHITE, "Black and White", "BW", "Black White");
add(Rabbit.Type.GOLD, "Gold", "GO", "G");
add(Rabbit.Type.SALT_AND_PEPPER, "Salt and Pepper", "SP", "Salt", "Pepper", "Salt Pepper");
add(Rabbit.Type.THE_KILLER_BUNNY, "The Killer Bunny", "TKB", "KB", "K", "Killer", "Killer Bunny", "KillerB");
}
示例8: intFromType
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
private static int intFromType(Rabbit.Type type){
int i = 0;
switch(type){
case BLACK:
i = 1;
break;
case BLACK_AND_WHITE:
i = 2;
break;
case BROWN:
i = 3;
break;
case GOLD:
i = 4;
break;
case SALT_AND_PEPPER:
i = 5;
break;
case THE_KILLER_BUNNY:
i = 6;
break;
case WHITE:
i = 7;
break;
default:
break;
}
return i;
}
示例9: isMonster
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
private boolean isMonster(Entity entity)
{
if(entity instanceof Monster) return true;
EntityType type = entity.getType();
if(type == EntityType.GHAST || type == EntityType.MAGMA_CUBE || type == EntityType.SHULKER) return true;
if(type == EntityType.RABBIT)
{
Rabbit rabbit = (Rabbit)entity;
if(rabbit.getRabbitType() == Rabbit.Type.THE_KILLER_BUNNY) return true;
}
return false;
}
示例10: rawset
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
@Override
public void rawset(LuaValue key, LuaValue value) {
if (key.isstring()) {
switch (key.checkjstring()) {
case "type":
getRabbitTrait().setRabbitType(ScriptUtil.enumValue(value, Rabbit.Type.class));
break;
}
}
super.rawset(key, value);
}
示例11: on
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
@EventHandler
public void on(CreatureSpawnEvent event) {
if (!(event.getEntity() instanceof Rabbit)) return;
Rabbit rabbit = (Rabbit) event.getEntity();
// switch to a killer rabbit
if (random.nextDouble() < .01D) rabbit.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY);
}
示例12: RabbitAnimal
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
public RabbitAnimal(Entity entity) {
PreCon.notNull(entity);
PreCon.isValid(entity instanceof Rabbit, "org.bukkit.entity.Rabbit expected.");
Rabbit rabbit = (Rabbit)entity;
_type = rabbit.getRabbitType();
}
示例13: apply
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
@Override
public boolean apply(Entity entity) {
PreCon.notNull(entity);
PreCon.isValid(entity instanceof Rabbit, "org.bukkit.entity.Rabbit expected.");
Rabbit rabbit = (Rabbit)entity;
rabbit.setRabbitType(_type);
return true;
}
示例14: deserialize
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
@Override
public void deserialize(LoreMetaMap metaMap) {
LoreMetaItem typeItem = metaMap.get("rabbit-type");
if (typeItem != null)
_type = typeItem.enumValue(Rabbit.Type.class);
}
示例15: getMovementEntity
import org.bukkit.entity.Rabbit; //导入依赖的package包/类
@Override
public Rabbit getMovementEntity() {
return this.slime.getSpigotEntity();
}