Jump to content

NooterDooter

Members
  • Posts

    1
  • Joined

  • Last visited

NooterDooter's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Been hopping around the forums lately and can't really get a concrete answer on how to make your custom entity spawn in a particular biome. The code I have registers the entity placement using EntitySpawnPlacementRegistry.register() and adds a new SpawnListEntry to all biomes, for testing purposes, and is then put in a FMLCommonSetupEvent event. However, when I launch the game, I see no entities spawn even though I have it to where it should spawn in all biomes. Below is the code that I have. Also please excuse any bad formatting All help is appreciated! Note: The SpawnListEntry I used uses the same values that a Minecraft Sheep does besides the entity of course. EventSpawnRocky.java public class EventSpawnRocky { @SubscribeEvent public static void spawnRocky(FMLCommonSetupEvent event) { DeferredWorkQueue.runLater(new Runnable() { @Override public void run() { ForgeRegistries.BIOMES.getValues().stream() .forEach( biome -> { List<Biome.SpawnListEntry> creatures = biome.getSpawns(EntityClassification.CREATURE); creatures.add(new SpawnListEntry(ModEntities.rocky, 12, 4, 4)); }); }} ); } } MainModClass - Things we care about in setup_common, which is a FMLCommonSetupEvent DeferredWorkQueue.runLater(new Runnable() { @Override public void run() { EntitySpawnPlacementRegistry.register(ModEntities.rocky, EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, EntityRocky::spawnConditions); } }); and MinecraftForge.EVENT_BUS.register(EventSpawnRocky.class); spawnConditions from EntityRocky.java - I have it returning true for now. public static boolean spawnConditions(EntityType<EntityRocky> rocky, IWorld world, SpawnReason reason, BlockPos blockPos, Random rand) { return true; }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.