mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-13 11:41:26 +01:00
Fix spacing, call setType, check if valid
This commit is contained in:
parent
0ed3235258
commit
46e1ecdd2a
@ -19,18 +19,17 @@ public class RabbitType extends Trait {
|
|||||||
@Override
|
@Override
|
||||||
public void onSpawn() {
|
public void onSpawn() {
|
||||||
rabbit = npc.getEntity() instanceof Rabbit ? (Rabbit) npc.getEntity() : null;
|
rabbit = npc.getEntity() instanceof Rabbit ? (Rabbit) npc.getEntity() : null;
|
||||||
|
setType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(RabbitTypes type) {
|
public void setType(RabbitTypes type) {
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
if (rabbit != null) {
|
if (rabbit != null && rabbit.isValid()) {
|
||||||
((EntityRabbit)((CraftRabbit)rabbit).getHandle()).r(type.type);
|
((EntityRabbit)((CraftRabbit)rabbit).getHandle()).r(type.type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RabbitTypes {
|
public enum RabbitTypes {
|
||||||
|
|
||||||
BROWN(0),
|
BROWN(0),
|
||||||
WHITE(1),
|
WHITE(1),
|
||||||
BLACK(2),
|
BLACK(2),
|
||||||
|
Loading…
Reference in New Issue
Block a user