SPIGOT-4784: Collar colour API for Cats

This commit is contained in:
md_5 2019-04-27 12:52:52 +10:00
parent 6bb1f087e7
commit 884028b23b

View file

@ -2,6 +2,8 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import net.minecraft.server.EntityCat;
import net.minecraft.server.EnumColor;
import org.bukkit.DyeColor;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Cat;
import org.bukkit.entity.EntityType;
@ -38,4 +40,14 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
getHandle().setCatType(type.ordinal());
}
@Override
public DyeColor getCollarColor() {
return DyeColor.getByWoolData((byte) getHandle().ei().getColorIndex());
}
@Override
public void setCollarColor(DyeColor color) {
getHandle().a(EnumColor.fromColorIndex(color.getWoolData()));
}
}