Add 1.19 mobs/data

This commit is contained in:
Josh Roy 2022-06-07 15:28:05 -04:00 committed by MD
parent d04c933abe
commit 18f9af898e
3 changed files with 23 additions and 0 deletions

View File

@ -105,6 +105,11 @@ public enum Mob {
AXOLOTL("Axolotl", Enemies.FRIENDLY, "AXOLOTL"),
GOAT("Goat", Enemies.NEUTRAL, "GOAT"),
GLOW_SQUID("GlowSquid", Enemies.FRIENDLY, "GLOW_SQUID"),
ALLAY("Allay", Enemies.FRIENDLY, "ALLAY"),
FROG("Frog", Enemies.FRIENDLY, "FROG"),
TADPOLE("Tadpole", Enemies.FRIENDLY, "TADPOLE"),
WARDEN("Warden", Enemies.ENEMY, "WARDEN"),
CHEST_BOAT("ChestBoat", Enemies.NEUTRAL, "CHEST_BOAT"),
;
public static final Logger logger = Logger.getLogger("Essentials");

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Axolotl;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fox;
import org.bukkit.entity.Frog;
import org.bukkit.entity.Llama;
import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Ocelot;
@ -37,6 +38,7 @@ public final class MobCompat {
public static final EntityType PHANTOM = getEntityType("PHANTOM");
public static final EntityType AXOLOTL = getEntityType("AXOLOTL");
public static final EntityType GOAT = getEntityType("GOAT");
public static final EntityType FROG = getEntityType("FROG");
// Constants for mobs that have changed since earlier versions
public static final EntityType CAT = getEntityType("CAT", "OCELOT");
@ -164,6 +166,15 @@ public final class MobCompat {
}
}
public static void setFrogVariant(final Entity entity, final String variant) {
if (VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_19_R01)) {
return;
}
if (entity instanceof Frog) {
((Frog) entity).setVariant(Frog.Variant.valueOf(variant));
}
}
public enum CatType {
// These are (loosely) Mojang names for the cats
SIAMESE("SIAMESE", "SIAMESE_CAT"),

View File

@ -197,6 +197,9 @@ public enum MobData {
CYAN_AXOLOTL("cyan", MobCompat.AXOLOTL, "axolotl:CYAN", true),
BLUE_AXOLOTL("blue", MobCompat.AXOLOTL, "axolotl:BLUE", true),
SCREAMING_GOAT("screaming", MobCompat.GOAT, Data.GOAT_SCREAMING, true),
TEMPERATE_FROG("temperate", MobCompat.FROG, "frog:TEMPERATE", true),
WARM_FROG("warm", MobCompat.FROG, "frog:WARM", true),
COLD_FROG("cold", MobCompat.FROG, "frog:COLD", true),
;
public static final Logger logger = Logger.getLogger("Essentials");
@ -407,6 +410,10 @@ public enum MobData {
MobCompat.setAxolotlVariant(spawned, split[1]);
break;
}
case "frog": {
MobCompat.setFrogVariant(spawned, split[1]);
break;
}
}
} else {
logger.warning("Unknown mob data type: " + this.toString());