Java Code Examples for org.bukkit.entity.Rabbit#Type

The following examples show how to use org.bukkit.entity.Rabbit#Type . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RabbitData.java    From Skript with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: RabbitData.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
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;
 }
 
Example 3
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Rabbit.Type getRabbitType() {
    return TypeMapping.fromMagic(this.datawatcher.getByte(18));
}
 
Example 6
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
private static void set(Rabbit.Type type, int magicValue) {
    NMS_TYPES[type.ordinal()] = magicValue;
    if (magicValue < INVERSE.length) {
        INVERSE[magicValue] = type;
    }
}
 
Example 7
Source File: RabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Rabbit.Type getRabbitType() {
    return ((IEntityRabbitPet) getEntityPet()).getRabbitType();
}
 
Example 8
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setRabbitType(Rabbit.Type type) {
    this.datawatcher.watch(18, Byte.valueOf((byte) TypeMapping.toMagic(type)));
}
 
Example 9
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Rabbit.Type getRabbitType() {
    return TypeMapping.fromMagic(this.datawatcher.getByte(18));
}
 
Example 10
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
private static void set(Rabbit.Type type, int magicValue) {
    NMS_TYPES[type.ordinal()] = magicValue;
    if (magicValue < INVERSE.length) {
        INVERSE[magicValue] = type;
    }
}
 
Example 11
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setRabbitType(Rabbit.Type type) {
    this.datawatcher.watch(18, Byte.valueOf((byte) TypeMapping.toMagic(type)));
}
 
Example 12
Source File: EntityRabbitPet.java    From SonarPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setType(Rabbit.Type type) {
    getBukkitEntity().setRabbitType(type);
}
 
Example 13
Source File: EntityRabbitPet.java    From SonarPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Rabbit.Type getType() {
    return getBukkitEntity().getRabbitType();
}
 
Example 14
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
protected static int toMagic(Rabbit.Type type) {
    return NMS_TYPES[type.ordinal()];
}
 
Example 15
Source File: RabbitPet.java    From SonarPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setRabbitType(Rabbit.Type type) {
    ((IEntityRabbitPet) getEntityPet()).setType(type);
}
 
Example 16
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Rabbit.Type getRabbitType() {
    return TypeMapping.fromMagic(this.datawatcher.getByte(18));
}
 
Example 17
Source File: EntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
protected static int toMagic(Rabbit.Type type) {
    return NMS_TYPES[type.ordinal()];
}
 
Example 18
Source File: IEntityRabbitPet.java    From SonarPet with GNU General Public License v3.0 votes vote down vote up
void setType(Rabbit.Type type); 
Example 19
Source File: IRabbitPet.java    From EchoPet with GNU General Public License v3.0 votes vote down vote up
Rabbit.Type getRabbitType(); 
Example 20
Source File: IEntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 votes vote down vote up
Rabbit.Type getRabbitType();