2020-04-15 14:22:03 +02:00
|
|
|
package com.minelittlepony.unicopia;
|
2018-09-16 00:45:44 +02:00
|
|
|
|
2020-04-15 14:22:03 +02:00
|
|
|
import com.minelittlepony.unicopia.entity.ButterflyEntity;
|
|
|
|
import com.minelittlepony.unicopia.entity.CloudEntity;
|
|
|
|
import com.minelittlepony.unicopia.entity.ConstructionCloudEntity;
|
|
|
|
import com.minelittlepony.unicopia.entity.CuccoonEntity;
|
|
|
|
import com.minelittlepony.unicopia.entity.ProjectileEntity;
|
|
|
|
import com.minelittlepony.unicopia.entity.RacingCloudEntity;
|
|
|
|
import com.minelittlepony.unicopia.entity.RainbowEntity;
|
|
|
|
import com.minelittlepony.unicopia.entity.SpearEntity;
|
|
|
|
import com.minelittlepony.unicopia.entity.SpellbookEntity;
|
|
|
|
import com.minelittlepony.unicopia.entity.SpellcastEntity;
|
|
|
|
import com.minelittlepony.unicopia.entity.WildCloudEntity;
|
|
|
|
import com.minelittlepony.unicopia.util.collection.ListHelper;
|
2018-09-16 00:45:44 +02:00
|
|
|
|
2020-01-17 14:27:26 +01:00
|
|
|
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;
|
2018-09-16 00:45:44 +02:00
|
|
|
|
2020-04-15 12:37:14 +02:00
|
|
|
public interface UEntities {
|
|
|
|
EntityType<SpellbookEntity> SPELLBOOK = register("spellbook", EntityType.Builder.create(SpellbookEntity::new, EntityCategory.MISC).setDimensions(0.6f, 0.6f));
|
|
|
|
EntityType<SpellcastEntity> MAGIC_SPELL = register("magic_spell", EntityType.Builder.create(SpellcastEntity::new, EntityCategory.MISC).setDimensions(0.6F, 0.25F));
|
|
|
|
EntityType<CloudEntity> CLOUD = register("cloud", EntityType.Builder.create(CloudEntity::new, EntityCategory.CREATURE));
|
|
|
|
EntityType<WildCloudEntity> WILD_CLOUD = register("wild_cloud", EntityType.Builder.create(WildCloudEntity::new, EntityCategory.CREATURE));
|
|
|
|
EntityType<RacingCloudEntity> RACING_CLOUD = register("racing_cloud", EntityType.Builder.create(RacingCloudEntity::new, EntityCategory.CREATURE));
|
|
|
|
EntityType<ConstructionCloudEntity> CONSTRUCTION_CLOUD = register("construction_cloud", EntityType.Builder.create(ConstructionCloudEntity::new, EntityCategory.CREATURE));
|
2018-09-16 00:45:44 +02:00
|
|
|
|
2020-04-15 12:37:14 +02:00
|
|
|
EntityType<RainbowEntity> RAINBOW = register("rainbow", EntityType.Builder.create(RainbowEntity::new, EntityCategory.AMBIENT));
|
|
|
|
EntityType<RainbowEntity.Spawner> RAINBOW_SPAWNER = register("rainbow_spawner", EntityType.Builder.create(RainbowEntity.Spawner::new, EntityCategory.MISC));
|
2018-09-16 00:45:44 +02:00
|
|
|
|
2020-04-15 12:37:14 +02:00
|
|
|
EntityType<CuccoonEntity> CUCCOON = register("cuccoon", EntityType.Builder.create(CuccoonEntity::new, EntityCategory.MISC).setDimensions(1.5F, 1.6F));
|
2020-01-17 14:27:26 +01:00
|
|
|
|
2020-04-15 12:37:14 +02:00
|
|
|
EntityType<ButterflyEntity> BUTTERFLY = register("butterfly", EntityType.Builder.create(ButterflyEntity::new, EntityCategory.AMBIENT));
|
2019-01-06 22:31:34 +01:00
|
|
|
|
2020-04-15 12:37:14 +02:00
|
|
|
EntityType<ProjectileEntity> THROWN_ITEM = register("thrown_item", EntityType.Builder.create(ProjectileEntity::new, EntityCategory.MISC));
|
|
|
|
EntityType<SpearEntity> THROWN_SPEAR = register("thrown_spear", EntityType.Builder.create(SpearEntity::new, EntityCategory.MISC));
|
2019-02-04 14:25:12 +01:00
|
|
|
|
2020-01-17 14:27:26 +01:00
|
|
|
//builder.creature(CloudEntity.class, "cloud").withEgg(0x4169e1, 0x7fff00),
|
|
|
|
//builder.creature(ButterflyEntity.class, "butterfly").withEgg(0x222200, 0xaaeeff),
|
2020-01-27 11:05:22 +01:00
|
|
|
// builder.projectile(ProjectileEntity.class, "thrown_item", 100, 10),
|
|
|
|
// builder.projectile(SpearEntity.class, "spear", 100, 10)
|
2020-01-17 14:27:26 +01:00
|
|
|
|
2020-04-15 12:37:14 +02:00
|
|
|
static <T extends Entity> EntityType<T> register(String name, EntityType.Builder<T> builder) {
|
2020-01-17 14:27:26 +01:00
|
|
|
return Registry.register(Registry.ENTITY_TYPE, name, builder.build(name));
|
|
|
|
}
|
2019-03-21 16:03:59 +01:00
|
|
|
|
2020-01-17 14:27:26 +01:00
|
|
|
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);
|
|
|
|
}
|
2019-03-21 16:03:59 +01:00
|
|
|
|
2020-01-17 14:27:26 +01:00
|
|
|
if (biome instanceof PlainsBiome
|
|
|
|
|| biome instanceof RiverBiome
|
|
|
|
|| biome instanceof MountainsBiome
|
|
|
|
|| biome instanceof ForestBiome) {
|
|
|
|
ListHelper.addifAbsent(biome.getEntitySpawnList(EntityCategory.AMBIENT), ButterflyEntity.SPAWN_ENTRY);
|
|
|
|
}
|
|
|
|
});
|
2019-01-29 14:22:36 +01:00
|
|
|
}
|
2018-09-16 00:45:44 +02:00
|
|
|
}
|