org.bukkit.entity.Rabbit Java Examples

The following examples show how to use org.bukkit.entity.Rabbit. 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: 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 #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: 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 #5
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 #6
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 #7
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 #8
Source File: RabbitPet.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setRabbitType(Rabbit.Type type) {
    ((IEntityRabbitPet) getEntityPet()).setRabbitType(type);
}
 
Example #9
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 #10
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 #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 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 #13
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 #14
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 #15
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 #16
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 #17
Source File: RabbitData.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("null")
@Override
   protected boolean init(Class<? extends Rabbit> c, Rabbit rabbit) {
       type = (rabbit == null) ? 0 : intFromType(rabbit.getRabbitType());
       return true;
   }
 
Example #18
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 #19
Source File: RabbitData.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void set(Rabbit entity) {
    if (type != 0) 
    	entity.setRabbitType(typeFromInt(type));
}
 
Example #20
Source File: RabbitData.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("null")
@Override
   protected boolean match(Rabbit entity) {
       return type == 0 || intFromType(entity.getRabbitType()) == type;
   }
 
Example #21
Source File: RabbitData.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Class<? extends Rabbit> getType() {
    return Rabbit.class;
}
 
Example #22
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 #23
Source File: RabbitPet.java    From SonarPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Rabbit.Type getRabbitType() {
    return ((IEntityRabbitPet) getEntityPet()).getType();
}
 
Example #24
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 #25
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 #26
Source File: EntityRabbitPet.java    From SonarPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Rabbit getBukkitEntity() {
    return (Rabbit) super.getBukkitEntity();
}
 
Example #27
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 #28
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 #29
Source File: IEntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 votes vote down vote up
Rabbit.Type getRabbitType(); 
Example #30
Source File: IEntityRabbitPet.java    From EchoPet with GNU General Public License v3.0 votes vote down vote up
void setRabbitType(Rabbit.Type type);