Some merges by NotAlexNoyle
kek
This commit was merged in pull request #4.
This commit is contained in:
2 files changed
+46
-48
No files matched your search
@@ -32,7 +32,7 @@ class Events : Listener {
|
||||
return
|
||||
}
|
||||
|
||||
if (!(event.entity as Ageable).isAdult) {
|
||||
if (event.entity is Ageable && !(event.entity as Ageable).isAdult) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1171,83 +1171,79 @@ object Heads {
|
||||
}
|
||||
|
||||
fun toStringRepresentation(entity: Entity): String? {
|
||||
if (entity.type !in mobsWithVariants && entity.type != EntityType.CREEPER) {
|
||||
if (entity.type !in mobsWithVariants) {
|
||||
return entity.type.name
|
||||
}
|
||||
|
||||
when (entity.type) {
|
||||
EntityType.AXOLOTL -> {
|
||||
val axolotl = entity as Axolotl
|
||||
return "${entity.type.name} ${axolotl.variant}"
|
||||
return "${axolotl.variant} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.CAT -> {
|
||||
val cat = entity as Cat
|
||||
return "${entity.type.name} ${cat.catType}"
|
||||
}
|
||||
|
||||
EntityType.CREEPER -> {
|
||||
return "${entity.type.name} Charged"
|
||||
return "${cat.catType} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.HORSE -> {
|
||||
val horse = entity as Horse
|
||||
return "${entity.type.name} ${horse.color}"
|
||||
return "${horse.color} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.MUSHROOM_COW -> {
|
||||
val mooshroom = entity as MushroomCow
|
||||
return "${entity.type.name} ${mooshroom.variant}"
|
||||
return "${mooshroom.variant} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.PARROT -> {
|
||||
val parrot = entity as Parrot
|
||||
return "${entity.type.name} ${parrot.variant}"
|
||||
return "${parrot.variant} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.RABBIT -> {
|
||||
val rabbit = entity as Rabbit
|
||||
return "${entity.type.name} ${rabbit.rabbitType}"
|
||||
return "${rabbit.rabbitType} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.SHEEP -> {
|
||||
val sheep = entity as Sheep
|
||||
return "${entity.type.name} ${sheep.color}"
|
||||
return "${sheep.color} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.TROPICAL_FISH -> {
|
||||
val fish = entity as TropicalFish
|
||||
return "${entity.type.name} ${fish.bodyColor} ${fish.patternColor} ${fish.pattern}"
|
||||
return "${fish.bodyColor} ${fish.patternColor} ${fish.pattern} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.VILLAGER -> {
|
||||
val villager = entity as Villager
|
||||
return "${entity.type.name} ${villager.villagerType} ${villager.profession}"
|
||||
return "${villager.villagerType} ${villager.profession} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.FOX -> {
|
||||
val fox = entity as Fox
|
||||
return "${entity.type.name} ${fox.foxType}"
|
||||
return "${fox.foxType} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.LLAMA -> {
|
||||
val llama = entity as Llama
|
||||
return "${entity.type.name} ${llama.color}"
|
||||
return "${llama.color} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.PANDA -> {
|
||||
val panda = entity as Panda
|
||||
return "${entity.type.name} ${panda.mainGene}"
|
||||
return "${panda.mainGene} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.TRADER_LLAMA -> {
|
||||
val traderLlama = entity as TraderLlama
|
||||
return "${entity.type.name} ${traderLlama.color}"
|
||||
return "${traderLlama.color} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.ZOMBIE_VILLAGER -> {
|
||||
val zombieVillager = entity as ZombieVillager
|
||||
return "${entity.type.name} ${zombieVillager.villagerType} ${zombieVillager.villagerProfession}"
|
||||
return "${zombieVillager.villagerType} ${zombieVillager.villagerProfession} ${entity.type.name}"
|
||||
}
|
||||
|
||||
else -> {
|
||||
@@ -1259,7 +1255,7 @@ object Heads {
|
||||
fun getHeadUrlWithStringRepresentation(stringRepresentation: String): URL? {
|
||||
val split = stringRepresentation.split(" ")
|
||||
|
||||
val entityType = EntityType.valueOf(split[0])
|
||||
val entityType = EntityType.valueOf(split.last())
|
||||
|
||||
if (entityType !in mobsWithVariants) {
|
||||
return headIndex[entityType]
|
||||
@@ -1267,37 +1263,37 @@ object Heads {
|
||||
|
||||
when (entityType) {
|
||||
EntityType.AXOLOTL -> {
|
||||
return axolotlHeadIndex[Axolotl.Variant.valueOf(split[1])]
|
||||
return axolotlHeadIndex[Axolotl.Variant.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.CAT -> {
|
||||
return catHeadIndex[Cat.Type.valueOf(split[1])]
|
||||
return catHeadIndex[Cat.Type.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.HORSE -> {
|
||||
return horseHeadIndex[Horse.Color.valueOf(split[1])]
|
||||
return horseHeadIndex[Horse.Color.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.MUSHROOM_COW -> {
|
||||
return mooshroomHeadIndex[MushroomCow.Variant.valueOf(split[1])]
|
||||
return mooshroomHeadIndex[MushroomCow.Variant.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.PARROT -> {
|
||||
return parrotHeadIndex[Parrot.Variant.valueOf(split[1])]
|
||||
return parrotHeadIndex[Parrot.Variant.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.RABBIT -> {
|
||||
return rabbitHeadIndex[Rabbit.Type.valueOf(split[1])]
|
||||
return rabbitHeadIndex[Rabbit.Type.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.SHEEP -> {
|
||||
return sheepHeadIndex[DyeColor.valueOf(split[1])]
|
||||
return sheepHeadIndex[DyeColor.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.TROPICAL_FISH -> {
|
||||
val bodyColor = DyeColor.valueOf(split[1])
|
||||
val patternColor = DyeColor.valueOf(split[2])
|
||||
val pattern = TropicalFish.Pattern.valueOf(split[3])
|
||||
val bodyColor = DyeColor.valueOf(split[0])
|
||||
val patternColor = DyeColor.valueOf(split[1])
|
||||
val pattern = TropicalFish.Pattern.valueOf(split[2])
|
||||
val specialFishType = Fish.getSpecialFishType(bodyColor, patternColor, pattern)
|
||||
if (specialFishType == null) {
|
||||
return headIndex[entityType]
|
||||
@@ -1306,30 +1302,30 @@ object Heads {
|
||||
}
|
||||
|
||||
EntityType.VILLAGER -> {
|
||||
val villagerType = Villager.Type.valueOf(split[1])
|
||||
val profession = Villager.Profession.valueOf(split[2])
|
||||
val villagerType = Villager.Type.valueOf(split[0])
|
||||
val profession = Villager.Profession.valueOf(split[1])
|
||||
return villagerHeadIndex[Pair(villagerType, profession)]
|
||||
}
|
||||
|
||||
EntityType.FOX -> {
|
||||
return foxHeadIndex[Fox.Type.valueOf(split[1])]
|
||||
return foxHeadIndex[Fox.Type.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.LLAMA -> {
|
||||
return llamaHeadIndex[Llama.Color.valueOf(split[1])]
|
||||
return llamaHeadIndex[Llama.Color.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.PANDA -> {
|
||||
return pandaHeadIndex[Panda.Gene.valueOf(split[1])]
|
||||
return pandaHeadIndex[Panda.Gene.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.TRADER_LLAMA -> {
|
||||
return traderLlamaHeadIndex[Llama.Color.valueOf(split[1])]
|
||||
return traderLlamaHeadIndex[Llama.Color.valueOf(split[0])]
|
||||
}
|
||||
|
||||
EntityType.ZOMBIE_VILLAGER -> {
|
||||
val villagerType = Villager.Type.valueOf(split[1])
|
||||
val villagerProfession = Villager.Profession.valueOf(split[2])
|
||||
val villagerType = Villager.Type.valueOf(split[0])
|
||||
val villagerProfession = Villager.Profession.valueOf(split[1])
|
||||
return zombieVillagerHeadIndex[Pair(villagerType, villagerProfession)]
|
||||
}
|
||||
|
||||
@@ -1367,12 +1363,12 @@ object Heads {
|
||||
|
||||
EntityType.HORSE -> {
|
||||
val horse = entity as Horse
|
||||
name = "${entity.type.name} ${horse.color}"
|
||||
name = "${horse.color} ${entity.type.name}"
|
||||
}
|
||||
|
||||
EntityType.MUSHROOM_COW -> {
|
||||
val mooshroom = entity as MushroomCow
|
||||
name = "${entity.type.name} ${mooshroom.variant}"
|
||||
name = "${mooshroom.variant} Mooshroom"
|
||||
}
|
||||
|
||||
EntityType.PARROT -> {
|
||||
@@ -1450,16 +1446,18 @@ object Heads {
|
||||
fun getNameForEntity(stringRepresentation: String): String? {
|
||||
val split = stringRepresentation.split(" ")
|
||||
|
||||
val entityType = EntityType.valueOf(split[0])
|
||||
val entityType = EntityType.valueOf(split.last())
|
||||
|
||||
if (entityType != EntityType.TROPICAL_FISH && entityType != EntityType.VILLAGER && entityType != EntityType.ZOMBIE_VILLAGER) {
|
||||
return "${split.drop(1).joinToString(" ").titleCase()}${if (split.drop(1).isNotEmpty()) " " else ""}${split[0].titleCase()}"
|
||||
if (entityType != EntityType.TROPICAL_FISH && entityType != EntityType.VILLAGER && entityType != EntityType.ZOMBIE_VILLAGER && entityType != EntityType.MUSHROOM_COW) {
|
||||
return stringRepresentation.titleCase()
|
||||
}
|
||||
|
||||
if (entityType == EntityType.MUSHROOM_COW) {
|
||||
return stringRepresentation.replace("MUSHROOM_COW", "MOOSHROOM").titleCase()
|
||||
}
|
||||
|
||||
if (entityType == EntityType.VILLAGER || entityType == EntityType.ZOMBIE_VILLAGER) {
|
||||
return "${
|
||||
split.drop(1).joinToString(" ").replace("NONE", "UNEMPLOYED").titleCase()
|
||||
} ${split[0].titleCase()}"
|
||||
return stringRepresentation.replace("NONE", "UNEMPLOYED").titleCase()
|
||||
}
|
||||
|
||||
val bodyColor = DyeColor.valueOf(split[1])
|
||||
@@ -1467,6 +1465,6 @@ object Heads {
|
||||
val pattern = TropicalFish.Pattern.valueOf(split[3])
|
||||
val specialFishType = Fish.getSpecialFishType(bodyColor, patternColor, pattern)
|
||||
return specialFishType?.name?.titleCase()
|
||||
?: "${split.drop(1).joinToString(" ").titleCase()} ${split[0].titleCase()}"
|
||||
?: return stringRepresentation.titleCase()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user