2018-09-16 00:45:44 +02:00
|
|
|
package com.minelittlepony.unicopia;
|
|
|
|
|
2019-01-29 14:22:36 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
2018-09-16 00:45:44 +02:00
|
|
|
import com.minelittlepony.unicopia.entity.EntityCloud;
|
|
|
|
import com.minelittlepony.unicopia.entity.EntityConstructionCloud;
|
|
|
|
import com.minelittlepony.unicopia.entity.EntityRacingCloud;
|
2018-09-21 17:53:33 +02:00
|
|
|
import com.minelittlepony.unicopia.entity.EntitySpell;
|
2019-01-10 10:35:15 +01:00
|
|
|
import com.minelittlepony.unicopia.entity.EntitySpellbook;
|
2019-01-06 22:31:34 +01:00
|
|
|
import com.minelittlepony.unicopia.entity.EntityProjectile;
|
2018-09-16 00:45:44 +02:00
|
|
|
import com.minelittlepony.unicopia.entity.EntityWildCloud;
|
2019-01-30 11:26:00 +01:00
|
|
|
import com.minelittlepony.unicopia.forgebullshit.EntityType;
|
2018-09-16 00:45:44 +02:00
|
|
|
import com.minelittlepony.unicopia.render.RenderCloud;
|
2018-09-21 17:53:33 +02:00
|
|
|
import com.minelittlepony.unicopia.render.RenderGem;
|
2019-01-06 22:31:34 +01:00
|
|
|
import com.minelittlepony.unicopia.render.RenderProjectile;
|
2019-01-10 10:35:15 +01:00
|
|
|
import com.minelittlepony.unicopia.render.RenderSpellbook;
|
2018-09-16 00:45:44 +02:00
|
|
|
|
2019-01-29 14:22:36 +01:00
|
|
|
import net.minecraft.entity.EnumCreatureType;
|
|
|
|
import net.minecraft.world.biome.Biome;
|
|
|
|
import net.minecraft.world.biome.Biome.SpawnListEntry;
|
|
|
|
import net.minecraft.world.biome.BiomeEnd;
|
|
|
|
import net.minecraft.world.biome.BiomeHell;
|
|
|
|
import net.minecraftforge.common.BiomeManager;
|
2018-09-16 00:45:44 +02:00
|
|
|
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
|
|
|
import net.minecraftforge.fml.common.registry.EntityEntry;
|
|
|
|
import net.minecraftforge.registries.IForgeRegistry;
|
|
|
|
|
|
|
|
public class UEntities {
|
2018-09-21 17:53:33 +02:00
|
|
|
private static final int BRUSHES_ROYALBLUE = 0x4169E1;
|
|
|
|
private static final int BRUSHES_CHARTREUSE = 0x7FFF00;
|
2018-09-16 00:45:44 +02:00
|
|
|
|
|
|
|
static void init(IForgeRegistry<EntityEntry> registry) {
|
2019-01-30 11:26:00 +01:00
|
|
|
EntityType builder = EntityType.builder(Unicopia.MODID);
|
2019-01-06 22:31:34 +01:00
|
|
|
registry.registerAll(
|
2019-01-30 11:26:00 +01:00
|
|
|
builder.creature(EntityCloud.class, "cloud").withEgg(BRUSHES_ROYALBLUE, BRUSHES_CHARTREUSE),
|
|
|
|
builder.creature(EntityWildCloud.class, "wild_cloud"),
|
|
|
|
builder.creature(EntityRacingCloud.class, "racing_cloud"),
|
|
|
|
builder.creature(EntityConstructionCloud.class, "construction_cloud"),
|
|
|
|
builder.creature(EntitySpell.class, "magic_spell"),
|
|
|
|
builder.creature(EntitySpellbook.class, "spellbook"),
|
|
|
|
builder.projectile(EntityProjectile.class, "thrown_item", 10, 5)
|
2019-01-06 22:31:34 +01:00
|
|
|
);
|
2018-09-21 17:53:33 +02:00
|
|
|
}
|
2018-09-16 00:45:44 +02:00
|
|
|
|
2019-01-06 22:31:34 +01:00
|
|
|
static void preInit() {
|
|
|
|
RenderingRegistry.registerEntityRenderingHandler(EntityCloud.class, RenderCloud::new);
|
|
|
|
RenderingRegistry.registerEntityRenderingHandler(EntitySpell.class, RenderGem::new);
|
|
|
|
RenderingRegistry.registerEntityRenderingHandler(EntityProjectile.class, RenderProjectile::new);
|
2019-01-10 10:35:15 +01:00
|
|
|
RenderingRegistry.registerEntityRenderingHandler(EntitySpellbook.class, RenderSpellbook::new);
|
2019-01-06 22:31:34 +01:00
|
|
|
}
|
|
|
|
|
2019-01-29 14:22:36 +01:00
|
|
|
static void registerSpawnEntries(Biome biome) {
|
|
|
|
|
|
|
|
if (!(biome instanceof BiomeHell || biome instanceof BiomeEnd)) {
|
2019-01-29 16:56:16 +01:00
|
|
|
List<SpawnListEntry> entries = biome.getSpawnableList(EnumCreatureType.AMBIENT);
|
2019-01-29 14:22:36 +01:00
|
|
|
entries.stream().filter(p -> p.entityClass == EntityWildCloud.class).findFirst().orElseGet(() -> {
|
|
|
|
entries.add(
|
|
|
|
BiomeManager.oceanBiomes.contains(biome) ?
|
|
|
|
EntityWildCloud.SPAWN_ENTRY_LAND : EntityWildCloud.SPAWN_ENTRY_OCEAN
|
|
|
|
);
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2018-09-16 00:45:44 +02:00
|
|
|
}
|