Unicopia/src/main/java/com/minelittlepony/unicopia/UEntities.java

71 lines
4.5 KiB
Java
Raw Normal View History

2020-01-16 12:35:46 +01:00
package com.minelittlepony.unicopia;
2020-01-17 14:27:26 +01:00
import com.minelittlepony.unicopia.entity.ButterflyEntity;
import com.minelittlepony.unicopia.entity.CloudEntity;
2020-01-27 11:05:22 +01:00
import com.minelittlepony.unicopia.entity.ProjectileEntity;
2020-01-17 14:27:26 +01:00
import com.minelittlepony.unicopia.entity.ConstructionCloudEntity;
2020-01-27 11:05:22 +01:00
import com.minelittlepony.unicopia.entity.CuccoonEntity;
import com.minelittlepony.unicopia.entity.RacingCloudEntity;
2020-01-17 14:27:26 +01:00
import com.minelittlepony.unicopia.entity.RainbowEntity;
2020-01-27 11:05:22 +01:00
import com.minelittlepony.unicopia.entity.SpearEntity;
2020-01-16 12:35:46 +01:00
import com.minelittlepony.unicopia.entity.SpellcastEntity;
2020-01-17 14:27:26 +01:00
import com.minelittlepony.util.collection.ListHelper;
import com.minelittlepony.unicopia.entity.SpellbookEntity;
import com.minelittlepony.unicopia.entity.WildCloudEntity;
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;
public class UEntities {
2020-01-17 14:27:26 +01:00
public static final EntityType<SpellbookEntity> SPELLBOOK = register("spellbook", EntityType.Builder.create(SpellbookEntity::new, EntityCategory.MISC).setDimensions(0.6f, 0.6f));
public static final EntityType<SpellcastEntity> MAGIC_SPELL = register("magic_spell", EntityType.Builder.create(SpellcastEntity::new, EntityCategory.MISC).setDimensions(0.6F, 0.25F));
public static final EntityType<CloudEntity> CLOUD = register("cloud", EntityType.Builder.create(CloudEntity::new, EntityCategory.CREATURE));
public static final EntityType<WildCloudEntity> WILD_CLOUD = register("wild_cloud", EntityType.Builder.create(WildCloudEntity::new, EntityCategory.CREATURE));
2020-01-27 11:05:22 +01:00
public static final EntityType<RacingCloudEntity> RACING_CLOUD = register("racing_cloud", EntityType.Builder.create(RacingCloudEntity::new, EntityCategory.CREATURE));
2020-01-17 14:27:26 +01:00
public static final EntityType<ConstructionCloudEntity> CONSTRUCTION_CLOUD = register("construction_cloud", EntityType.Builder.create(ConstructionCloudEntity::new, EntityCategory.CREATURE));
2020-01-17 14:27:26 +01:00
public static final EntityType<RainbowEntity> RAINBOW = register("rainbow", EntityType.Builder.create(RainbowEntity::new, EntityCategory.AMBIENT));
public static final EntityType<RainbowEntity.Spawner> RAINBOW_SPAWNER = register("rainbow_spawner", EntityType.Builder.create(RainbowEntity.Spawner::new, EntityCategory.MISC));
2020-01-27 11:05:22 +01:00
public static final 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
public static final EntityType<ButterflyEntity> BUTTERFLY = register("butterfly", EntityType.Builder.create(ButterflyEntity::new, EntityCategory.AMBIENT));
2020-01-27 11:05:22 +01:00
public static final EntityType<ProjectileEntity> THROWN_ITEM = register("thrown_item", EntityType.Builder.create(ProjectileEntity::new, EntityCategory.MISC));
public static final 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
private static <T extends Entity> EntityType<T> register(String name, EntityType.Builder<T> builder) {
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
}
}