Posted February 8, 20205 yr As the title says, how would I go about checking the dimension and not just the biome from scratch ? I've had some users of my mod say a sky dimension was spawning my monsters in it because it used vanilla biomes in its generator, so I wanted to add a an additional check to my mob spawning conditions to make sure that its only the overworld/end/nether variants of the biomes and not random dimensions! My Entity Registration/Spawning Code public class ExplorerEntities { private static List<EntityType> entities = Lists.newArrayList(); private static List<Item> spawnEggs = Lists.newArrayList(); public static final EntityType<EnderreeperEntity> ENDERREEPER = createEntity(EnderreeperEntity.class, EnderreeperEntity::new, EntityClassification.MONSTER, "enderreeper", 0.6F, 1.99F, 3801171, 7078066); /* Unneeded Code Redacted */ @SubscribeEvent public static void registerEntities(RegistryEvent.Register<EntityType<?>> event) { for (EntityType entity : entities) { event.getRegistry().register(entity); } EntitySpawnPlacementRegistry.register(ENDERREEPER, EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, MonsterEntity::func_223325_c); private static void registerEntityWorldSpawn(EntityType<?> type, int weight, int minCount, int maxCount, Biome... biomes) { for(Biome biome : biomes) { if(biome != null) { biome.getSpawns(type.getClassification()).add(new Biome.SpawnListEntry(type, weight, minCount, maxCount)); } } } public static void registerEntityWorldSpawns() { if(EntityConfig.enderreeper_enabled.get()) { registerEntityWorldSpawn(ENDERREEPER, 5, 1, 2, Biomes.THE_END); registerEntityWorldSpawn(ENDERREEPER, 8, 1, 2, Biomes.END_BARRENS, Biomes.SMALL_END_ISLANDS, Biomes.END_HIGHLANDS, Biomes.END_MIDLANDS); } //&& DimensionType.getById(0) == DimensionType.OVERWORLD if(EntityConfig.enderreeper_overworld_spawn_enabled.get()) { EnderreeperEntity.addSpawn(); } if(EntityConfig.enderreeper_nether_spawn_enabled.get()) { registerEntityWorldSpawn(ENDERREEPER, 5, 1, 2, Biomes.NETHER); } } } My Enderreeper addSpawn() code: //==== Spawning ====// public static void addSpawn() { ForgeRegistries.BIOMES.getValues().stream().forEach(EnderreeperEntity::processSpawning); } private static void processSpawning(Biome biome) { if (biome != Biomes.MUSHROOM_FIELDS || biome != Biomes.MUSHROOM_FIELD_SHORE || biome != Biomes.NETHER) { biome.getSpawns(EntityClassification.MONSTER).add(new Biome.SpawnListEntry(ExplorerEntities.ENDERREEPER, 2, 1, 1)); } } How would I go about this? unfortunately i've been away from modding for a good few months and i'm rusty as hell, so any help regarding this would be massively appreciative! Many Thanks
February 8, 20205 yr How does vanilla do it for Zombie Pigmen? About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
February 9, 20205 yr Author The zombie pigmen are just spawned as a spawn condition on the nether biome, aren't they? I'm not having a problem spawning them in the dimension, its adding additional checks to make sure that it is a particular dimension, so my mobs don't randomly spawn in say, a birch forest biome on a sky island in the sky dimension mod. this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ZOMBIE_PIGMAN, 100, 4, 4)); I'm basically, trying to clean up some of the bugs in my 1.14 version to make it more polished before working on my 1.15 version, so hopefully, someone can help me figure this out Edited February 9, 20205 yr by Zathrox
February 12, 20205 yr On 2/8/2020 at 3:54 PM, Zathrox said: MonsterEntity::func_223325_c Check that method out, then write your own and replace this in the EntitySpawnPlacementRegistry call. Edited February 12, 20205 yr by Ugdhar
February 16, 20205 yr Author Thanks, that might actually work! Might be difficult for me to test but hopefully it works
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.