Skip to content

Commit

Permalink
dev5.1 Hotfix
Browse files Browse the repository at this point in the history
Fixed:
- Parrots spawn again
- Axolot-Variants work now
- Mooshrooms spawn again (and types work)
- Probably fixed UUID Error in 1.12
  • Loading branch information
Jakllp committed Aug 25, 2021
1 parent c5cb6ac commit 348b0b7
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class MonsterExperience {
mobExp.put("CHICKEN", new MonsterExperience(1., 3., "CHICKEN"));
mobExp.put("SQUID", new MonsterExperience(1., 3., "SQUID"));
mobExp.put("SHEEP", new MonsterExperience(1., 3., "SHEEP"));
mobExp.put("GOAT", new MonsterExperience(1., 3., "GOAT"));
mobExp.put("OCELOT", new MonsterExperience(1., 3., "OCELOT"));
mobExp.put("MUSHROOM_COW", new MonsterExperience(1., 3., "MUSHROOM_COW"));
mobExp.put("VILLAGER", new MonsterExperience(0., "VILLAGER"));
Expand Down Expand Up @@ -103,6 +104,7 @@ public class MonsterExperience {
mobExp.put("TRADER_LLAMA", new MonsterExperience(1, 3, "TRADER_LLAMA"));
mobExp.put("WANDERING_TRADER", new MonsterExperience(1, 2, "WANDERING_TRADER"));
mobExp.put("BEE", new MonsterExperience(1, 3, "BEE"));
mobExp.put("AXOLOTL", new MonsterExperience(1, 3, "AXOLOTL"));
mobExp.put("ZOMBIFIED_PIGLIN", new MonsterExperience(5, "ZOMBIFIED_PIGLIN"));
mobExp.put("HOGLIN", new MonsterExperience(5, "HOGLIN"));
mobExp.put("ZOGLIN", new MonsterExperience(5, "ZOGLIN"));
Expand Down
2 changes: 1 addition & 1 deletion modules/MyPet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<groupId>de.keyle</groupId>
<artifactId>mypet</artifactId>
<version>3.12-dev5</version>
<version>3.12-dev5.1</version>
<packaging>jar</packaging>
<name>MyPet</name>
<url>https://www.spigotmc.org/resources/mypet.12725/</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class CommandOptionCreate implements CommandOptionTabCompleter {

petTypeOptionMap.put("axolotl", new CommandOptionCreator()
.add("baby")
.add("type:")
.add("variant:")
.get());

petTypeOptionMap.put("bee", new CommandOptionCreator()
Expand Down Expand Up @@ -539,6 +539,8 @@ public static void createInfo(MyPetType petType, String[] args, TagCompound comp
}
compound.getCompoundData().put("Variant", new TagInt(variant));
} else if (petType == MyPetType.Parrot) {
compound.getCompoundData().put("Variant", new TagInt(variant));
} else if (petType == MyPetType.Axolotl) {
compound.getCompoundData().put("Variant", new TagInt(variant));
} else if (petType == MyPetType.TropicalFish) {
compound.getCompoundData().put("Variant", new TagInt(variant));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class MyAxolotl extends MyPet implements de.Keyle.MyPet.api.entity.types.MyAxolotl {

protected boolean isBaby = false;
protected int axolotlType = 1;
protected int axolotlType = 0;

public MyAxolotl(MyPetPlayer petOwner) {
super(petOwner);
Expand Down Expand Up @@ -86,6 +86,13 @@ public void setBaby(boolean flag) {

@Override
public String toString() {
return "MyAxolotl{owner=" + getOwner().getName() + ", name=" + ChatColor.stripColor(petName) + ", exp=" + experience.getExp() + "/" + experience.getRequiredExp() + ", lv=" + experience.getLevel() + ", status=" + status.name() + ", skilltree=" + (skilltree != null ? skilltree.getName() : "-") + ", worldgroup=" + worldGroup + ", baby=" + isBaby() + "}";
return "MyAxolotl{owner=" + getOwner().getName() +
", name=" + ChatColor.stripColor(petName) +
", exp=" + experience.getExp() + "/" + experience.getRequiredExp() +
", lv=" + experience.getLevel() +
", status=" + status.name() +
", skilltree=" + (skilltree != null ? skilltree.getName() : "-") +
", worldgroup=" + worldGroup +
", baby=" + isBaby() + "}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.List;
import java.util.UUID;

public abstract class EntityMyPet extends EntityCreature implements IAnimal, MyPetMinecraftEntity {

Expand Down Expand Up @@ -1270,4 +1271,9 @@ public DamageSource ce() {
}
return source;
}

@Override
public UUID getUniqueID() {
return this.uniqueID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class EntityRegistry extends de.Keyle.MyPet.api.entity.EntityRegistry {
BiMap<MyPetType, Class<? extends EntityMyPet>> entityClasses = HashBiMap.create();
Map<MyPetType, EntityType> entityTypes = new HashMap<>();

protected void registerEntityType(MyPetType petType, String key, DefaultedRegistry<EntityType<?>> entityRegistry) { //TODO 2021/08/19 The only thing left: They need to follow the player
protected void registerEntityType(MyPetType petType, String key, DefaultedRegistry<EntityType<?>> entityRegistry) {
EntityType<? extends LivingEntity> types = (EntityType<? extends LivingEntity>) entityRegistry.get(new ResourceLocation(key));
entityTypes.put(petType, types);
registerDefaultAttributes(entityTypes.get(petType), types);
Expand Down Expand Up @@ -148,8 +148,6 @@ public DefaultedRegistry<EntityType<?>> getRegistry(DefaultedRegistry registryMa
}

protected void overwriteEntityID(EntityType types, int id, DefaultedRegistry<EntityType<?>> entityRegistry) {


try {
Field bgF = MappedRegistry.class.getDeclaredField("bw"); //TODO Might fail.
bgF.setAccessible(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import net.minecraft.world.entity.animal.Dolphin;
import net.minecraft.world.entity.animal.Fox;
import net.minecraft.world.entity.animal.IronGolem;
import net.minecraft.world.entity.animal.MushroomCow;
import net.minecraft.world.entity.animal.Ocelot;
import net.minecraft.world.entity.animal.Panda;
import net.minecraft.world.entity.animal.Parrot;
Expand Down Expand Up @@ -105,80 +106,80 @@ public class MyAttributeDefaults {
static {
defaultAttribute
.putFast(EntityType.ARMOR_STAND, ArmorStand.createLivingAttributes().build()) //Armor-Stand
.putFast(EntityType.AXOLOTL, Axolotl.createAttributes().build()) //Axolotl
.putFast(EntityType.BAT, Bat.createAttributes().build()) //Bat
.putFast(EntityType.BEE, Bee.createAttributes().build()) //Bee
.putFast(EntityType.BLAZE, Blaze.createAttributes().build()) //Blaze
.putFast(EntityType.CAT, Cat.createAttributes().build()) //Cat
.putFast(EntityType.CAVE_SPIDER, CaveSpider.createAttributes().build()) //CaveSpider
.putFast(EntityType.CHICKEN, Chicken.createAttributes().build()) //Chicken
.putFast(EntityType.COD, Cod.createAttributes().build()) //Cod
.putFast(EntityType.COW, Cow.createAttributes().build()) //Cow
.putFast(EntityType.CREEPER, Creeper.createAttributes().build()) //Creeper
.putFast(EntityType.DOLPHIN, Dolphin.createAttributes().build()) //Dolphin
.putFast(EntityType.DONKEY, Donkey.createLivingAttributes().build()) //Donkey
.putFast(EntityType.ZOMBIE, Zombie.createAttributes().build()) //Drowned
.putFast(EntityType.ELDER_GUARDIAN, ElderGuardian.createAttributes().build()) //Elder Guardian
.putFast(EntityType.ENDERMAN, EnderMan.createAttributes().build()) //Enderman
.putFast(EntityType.ENDERMITE, Endermite.createAttributes().build()) //Endermite
.putFast(EntityType.ENDER_DRAGON, EnderDragon.createAttributes().build()) //Ender Dragon
.putFast(EntityType.EVOKER, Evoker.createAttributes().build()) //Evoker
.putFast(EntityType.FOX, Fox.createAttributes().build()) //Fox
.putFast(EntityType.GHAST, Ghast.createAttributes().build()) //Ghast
.putFast(EntityType.GIANT, Giant.createAttributes().build()) //Giant
.putFast(EntityType.GUARDIAN, Guardian.createAttributes().build()) //Guardian
.putFast(EntityType.GOAT, Goat.createAttributes().build()) //Goat
.putFast(EntityType.AXOLOTL, Axolotl.createAttributes().build()) //Axolotl
.putFast(EntityType.BAT, Bat.createAttributes().build()) //Bat
.putFast(EntityType.BEE, Bee.createAttributes().build()) //Bee
.putFast(EntityType.BLAZE, Blaze.createAttributes().build()) //Blaze
.putFast(EntityType.CAT, Cat.createAttributes().build()) //Cat
.putFast(EntityType.CAVE_SPIDER, CaveSpider.createAttributes().build()) //CaveSpider
.putFast(EntityType.CHICKEN, Chicken.createAttributes().build()) //Chicken
.putFast(EntityType.COD, Cod.createAttributes().build()) //Cod
.putFast(EntityType.COW, Cow.createAttributes().build()) //Cow
.putFast(EntityType.CREEPER, Creeper.createAttributes().build()) //Creeper
.putFast(EntityType.DOLPHIN, Dolphin.createAttributes().build()) //Dolphin
.putFast(EntityType.DONKEY, Donkey.createLivingAttributes().build()) //Donkey
.putFast(EntityType.ZOMBIE, Zombie.createAttributes().build()) //Drowned
.putFast(EntityType.ELDER_GUARDIAN, ElderGuardian.createAttributes().build()) //Elder Guardian
.putFast(EntityType.ENDERMAN, EnderMan.createAttributes().build()) //Enderman
.putFast(EntityType.ENDERMITE, Endermite.createAttributes().build()) //Endermite
.putFast(EntityType.ENDER_DRAGON, EnderDragon.createAttributes().build()) //Ender Dragon
.putFast(EntityType.EVOKER, Evoker.createAttributes().build()) //Evoker
.putFast(EntityType.FOX, Fox.createAttributes().build()) //Fox
.putFast(EntityType.GHAST, Ghast.createAttributes().build()) //Ghast
.putFast(EntityType.GIANT, Giant.createAttributes().build()) //Giant
.putFast(EntityType.GUARDIAN, Guardian.createAttributes().build()) //Guardian
.putFast(EntityType.GOAT, Goat.createAttributes().build()) //Goat
.putFast(EntityType.GLOW_SQUID, GlowSquid.createAttributes().build()) //GlowSquid
.putFast(EntityType.HOGLIN, Hoglin.createAttributes().build()) //Hoglin
.putFast(EntityType.HORSE, Horse.createBaseHorseAttributes().build()) //Horse
.putFast(EntityType.HUSK, Husk.createAttributes().build()) //Husk
.putFast(EntityType.ILLUSIONER, Illusioner.createAttributes().build()) //Illusioner
.putFast(EntityType.IRON_GOLEM, IronGolem.createAttributes().build()) //Iron Golem
.putFast(EntityType.LLAMA, Llama.createAttributes().build()) //Llama
.putFast(EntityType.MAGMA_CUBE, MagmaCube.createAttributes().build()) //Magma Cube
.putFast(EntityType.COW, Cow.createAttributes().build()) //Mooshroom
.putFast(EntityType.MULE, Mule.createLivingAttributes().build()) //Mule
.putFast(EntityType.OCELOT, Ocelot.createAttributes().build()) //Ocelot
.putFast(EntityType.PANDA, Panda.createAttributes().build()) //Panda
.putFast(EntityType.PARROT, Parrot.createAttributes().build()) //Parrot
.putFast(EntityType.PHANTOM, Phantom.createLivingAttributes().build()) //Phantom
.putFast(EntityType.PIG, Pig.createAttributes().build()) //Pig
.putFast(EntityType.PIGLIN, Piglin.createAttributes().build()) //Piglin
.putFast(EntityType.PIGLIN_BRUTE, PiglinBrute.createAttributes().build()) //Piglin Brute
.putFast(EntityType.PILLAGER, Pillager.createAttributes().build()) //Pillager
.putFast(EntityType.PLAYER, Player.createAttributes().build()) //Player
.putFast(EntityType.POLAR_BEAR, PolarBear.createAttributes().build()) //PolarBear
.putFast(EntityType.PUFFERFISH, Pufferfish.createAttributes().build()) //Pufferfish
.putFast(EntityType.RABBIT, Rabbit.createAttributes().build()) //Rabbit
.putFast(EntityType.RAVAGER, Ravager.createAttributes().build()) //Ravager
.putFast(EntityType.SALMON, Salmon.createAttributes().build()) //Salmon
.putFast(EntityType.SHEEP, Sheep.createAttributes().build()) //Sheep
.putFast(EntityType.SHULKER, Shulker.createAttributes().build()) //Shulker
.putFast(EntityType.SILVERFISH, Silverfish.createAttributes().build()) //Silverfish
.putFast(EntityType.SKELETON, Skeleton.createAttributes().build()) //Skeleton
.putFast(EntityType.SKELETON_HORSE, SkeletonHorse.createAttributes().build()) //Skeleton Horse
.putFast(EntityType.SLIME, Slime.createLivingAttributes().build()) //Slime
.putFast(EntityType.SNOW_GOLEM, SnowGolem.createAttributes().build()) //Snow Golem
.putFast(EntityType.SPIDER, Spider.createAttributes().build()) //Spider
.putFast(EntityType.SQUID, Squid.createAttributes().build()) //Squid
.putFast(EntityType.STRAY, Stray.createAttributes().build()) //Stray
.putFast(EntityType.STRIDER, Strider.createAttributes().build()) //Strider
.putFast(EntityType.HOGLIN, Hoglin.createAttributes().build()) //Hoglin
.putFast(EntityType.HORSE, Horse.createBaseHorseAttributes().build()) //Horse
.putFast(EntityType.HUSK, Husk.createAttributes().build()) //Husk
.putFast(EntityType.ILLUSIONER, Illusioner.createAttributes().build()) //Illusioner
.putFast(EntityType.IRON_GOLEM, IronGolem.createAttributes().build()) //Iron Golem
.putFast(EntityType.LLAMA, Llama.createAttributes().build()) //Llama
.putFast(EntityType.MAGMA_CUBE, MagmaCube.createAttributes().build()) //Magma Cube
.putFast(EntityType.MOOSHROOM, MushroomCow.createAttributes().build()) //Mooshroom
.putFast(EntityType.MULE, Mule.createLivingAttributes().build()) //Mule
.putFast(EntityType.OCELOT, Ocelot.createAttributes().build()) //Ocelot
.putFast(EntityType.PANDA, Panda.createAttributes().build()) //Panda
.putFast(EntityType.PARROT, Parrot.createAttributes().build()) //Parrot
.putFast(EntityType.PHANTOM, Phantom.createLivingAttributes().build()) //Phantom
.putFast(EntityType.PIG, Pig.createAttributes().build()) //Pig
.putFast(EntityType.PIGLIN, Piglin.createAttributes().build()) //Piglin
.putFast(EntityType.PIGLIN_BRUTE, PiglinBrute.createAttributes().build()) //Piglin Brute
.putFast(EntityType.PILLAGER, Pillager.createAttributes().build()) //Pillager
.putFast(EntityType.PLAYER, Player.createAttributes().build()) //Player
.putFast(EntityType.POLAR_BEAR, PolarBear.createAttributes().build()) //PolarBear
.putFast(EntityType.PUFFERFISH, Pufferfish.createAttributes().build()) //Pufferfish
.putFast(EntityType.RABBIT, Rabbit.createAttributes().build()) //Rabbit
.putFast(EntityType.RAVAGER, Ravager.createAttributes().build()) //Ravager
.putFast(EntityType.SALMON, Salmon.createAttributes().build()) //Salmon
.putFast(EntityType.SHEEP, Sheep.createAttributes().build()) //Sheep
.putFast(EntityType.SHULKER, Shulker.createAttributes().build()) //Shulker
.putFast(EntityType.SILVERFISH, Silverfish.createAttributes().build()) //Silverfish
.putFast(EntityType.SKELETON, Skeleton.createAttributes().build()) //Skeleton
.putFast(EntityType.SKELETON_HORSE, SkeletonHorse.createAttributes().build()) //Skeleton Horse
.putFast(EntityType.SLIME, Slime.createLivingAttributes().build()) //Slime
.putFast(EntityType.SNOW_GOLEM, SnowGolem.createAttributes().build()) //Snow Golem
.putFast(EntityType.SPIDER, Spider.createAttributes().build()) //Spider
.putFast(EntityType.SQUID, Squid.createAttributes().build()) //Squid
.putFast(EntityType.STRAY, Stray.createAttributes().build()) //Stray
.putFast(EntityType.STRIDER, Strider.createAttributes().build()) //Strider
.putFast(EntityType.TRADER_LLAMA, TraderLlama.createAttributes().build()) //Trader_Llama
.putFast(EntityType.TROPICAL_FISH, TropicalFish.createAttributes().build()) //Tropical Fish
.putFast(EntityType.TURTLE, Turtle.createAttributes().build()) //Turtle
.putFast(EntityType.VEX, Vex.createAttributes().build()) //Vex
.putFast(EntityType.VILLAGER, Villager.createAttributes().build()) //Villager
.putFast(EntityType.VINDICATOR, Vindicator.createAttributes().build()) //Vindicator
.putFast(EntityType.WANDERING_TRADER, WanderingTrader.createLivingAttributes().build()) //Wandering Trader
.putFast(EntityType.WITCH, Witch.createAttributes().build()) //Witch
.putFast(EntityType.WITHER, WitherBoss.createAttributes().build()) //Wither
.putFast(EntityType.WITHER_SKELETON, WitherSkeleton.createAttributes().build()) //Wither Skeleton
.putFast(EntityType.WOLF, Wolf.createAttributes().build()) //Wolf
.putFast(EntityType.ZOGLIN, Zoglin.createAttributes().build()) //Zoglin
.putFast(EntityType.ZOMBIE, Zombie.createAttributes().build()) //Zombie
.putFast(EntityType.ZOMBIE_HORSE, ZombieHorse.createAttributes().build()) //Zombie Horse
.putFast(EntityType.ZOMBIE_VILLAGER, ZombieVillager.createAttributes().build()) //Zombie Villager
.putFast(EntityType.ZOMBIFIED_PIGLIN, ZombifiedPiglin.createAttributes().build()); //Zombie Piglin
.putFast(EntityType.TURTLE, Turtle.createAttributes().build()) //Turtle
.putFast(EntityType.VEX, Vex.createAttributes().build()) //Vex
.putFast(EntityType.VILLAGER, Villager.createAttributes().build()) //Villager
.putFast(EntityType.VINDICATOR, Vindicator.createAttributes().build()) //Vindicator
.putFast(EntityType.WANDERING_TRADER, WanderingTrader.createLivingAttributes().build()) //Wandering Trader
.putFast(EntityType.WITCH, Witch.createAttributes().build()) //Witch
.putFast(EntityType.WITHER, WitherBoss.createAttributes().build()) //Wither
.putFast(EntityType.WITHER_SKELETON, WitherSkeleton.createAttributes().build()) //Wither Skeleton
.putFast(EntityType.WOLF, Wolf.createAttributes().build()) //Wolf
.putFast(EntityType.ZOGLIN, Zoglin.createAttributes().build()) //Zoglin
.putFast(EntityType.ZOMBIE, Zombie.createAttributes().build()) //Zombie
.putFast(EntityType.ZOMBIE_HORSE, ZombieHorse.createAttributes().build()) //Zombie Horse
.putFast(EntityType.ZOMBIE_VILLAGER, ZombieVillager.createAttributes().build()) //Zombie Villager
.putFast(EntityType.ZOMBIFIED_PIGLIN, ZombifiedPiglin.createAttributes().build()); //Zombie Piglin

}

Expand Down
Loading

0 comments on commit 348b0b7

Please sign in to comment.