package com.minelittlepony.unicopia; import com.minelittlepony.unicopia.entity.ButterflyEntity; import com.minelittlepony.unicopia.entity.CloudEntity; import com.minelittlepony.unicopia.entity.ProjectileEntity; import com.minelittlepony.unicopia.entity.ConstructionCloudEntity; import com.minelittlepony.unicopia.entity.CuccoonEntity; import com.minelittlepony.unicopia.entity.RacingCloudEntity; import com.minelittlepony.unicopia.entity.RainbowEntity; import com.minelittlepony.unicopia.entity.SpearEntity; import com.minelittlepony.unicopia.entity.SpellcastEntity; import com.minelittlepony.util.collection.ListHelper; import com.minelittlepony.unicopia.entity.SpellbookEntity; import com.minelittlepony.unicopia.entity.WildCloudEntity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityCategory; import net.minecraft.entity.EntityType; import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.EndBiome; import net.minecraft.world.biome.ForestBiome; import net.minecraft.world.biome.MountainsBiome; import net.minecraft.world.biome.NetherBiome; import net.minecraft.world.biome.OceanBiome; import net.minecraft.world.biome.PlainsBiome; import net.minecraft.world.biome.RiverBiome; public class UEntities { public static final EntityType SPELLBOOK = register("spellbook", EntityType.Builder.create(SpellbookEntity::new, EntityCategory.MISC).setDimensions(0.6f, 0.6f)); public static final EntityType MAGIC_SPELL = register("magic_spell", EntityType.Builder.create(SpellcastEntity::new, EntityCategory.MISC).setDimensions(0.6F, 0.25F)); public static final EntityType CLOUD = register("cloud", EntityType.Builder.create(CloudEntity::new, EntityCategory.CREATURE)); public static final EntityType WILD_CLOUD = register("wild_cloud", EntityType.Builder.create(WildCloudEntity::new, EntityCategory.CREATURE)); public static final EntityType RACING_CLOUD = register("racing_cloud", EntityType.Builder.create(RacingCloudEntity::new, EntityCategory.CREATURE)); public static final EntityType CONSTRUCTION_CLOUD = register("construction_cloud", EntityType.Builder.create(ConstructionCloudEntity::new, EntityCategory.CREATURE)); public static final EntityType RAINBOW = register("rainbow", EntityType.Builder.create(RainbowEntity::new, EntityCategory.AMBIENT)); public static final EntityType RAINBOW_SPAWNER = register("rainbow_spawner", EntityType.Builder.create(RainbowEntity.Spawner::new, EntityCategory.MISC)); public static final EntityType CUCCOON = register("cuccoon", EntityType.Builder.create(CuccoonEntity::new, EntityCategory.MISC).setDimensions(1.5F, 1.6F)); public static final EntityType BUTTERFLY = register("butterfly", EntityType.Builder.create(ButterflyEntity::new, EntityCategory.AMBIENT)); public static final EntityType THROWN_ITEM = register("thrown_item", EntityType.Builder.create(ProjectileEntity::new, EntityCategory.MISC)); public static final EntityType THROWN_SPEAR = register("thrown_spear", EntityType.Builder.create(SpearEntity::new, EntityCategory.MISC)); //builder.creature(CloudEntity.class, "cloud").withEgg(0x4169e1, 0x7fff00), //builder.creature(ButterflyEntity.class, "butterfly").withEgg(0x222200, 0xaaeeff), // builder.projectile(ProjectileEntity.class, "thrown_item", 100, 10), // builder.projectile(SpearEntity.class, "spear", 100, 10) private static EntityType register(String name, EntityType.Builder builder) { return Registry.register(Registry.ENTITY_TYPE, name, builder.build(name)); } static void bootstrap() { Registry.BIOME.forEach(biome -> { if (!(biome instanceof NetherBiome || biome instanceof EndBiome)) { ListHelper.addifAbsent(biome.getEntitySpawnList(EntityCategory.AMBIENT), biome instanceof OceanBiome ? WildCloudEntity.SPAWN_ENTRY_OCEAN : WildCloudEntity.SPAWN_ENTRY_LAND); ListHelper.addifAbsent(biome.getEntitySpawnList(EntityCategory.CREATURE), RainbowEntity.SPAWN_ENTRY); } if (biome instanceof PlainsBiome || biome instanceof RiverBiome || biome instanceof MountainsBiome || biome instanceof ForestBiome) { ListHelper.addifAbsent(biome.getEntitySpawnList(EntityCategory.AMBIENT), ButterflyEntity.SPAWN_ENTRY); } }); } }