Posted January 29, 20205 yr for (Biome biome : ForgeRegistries.BIOMES) { biome.getSpawns(EntityClassification.CREATURE).clear(); biome.getSpawns(EntityClassification.CREATURE).add(new Biome.SpawnListEntry(EntityType.PIG, 1, 3, 5)); } I can clear all existing spawns from a biome using the clear method, which allows me to add a spawn exactly how I want, but then everything is gone. There are remove methods but they don't seem to be able to remove specific entities. Anyone know how to do this? Edited January 30, 20205 yr by MineModder2000
January 29, 20205 yr Author 2 minutes ago, diesieben07 said: Why not? Show what you tried. biome.getSpawns(EntityClassification.CREATURE).remove(EntityType.PIG);
January 29, 20205 yr Author 23 minutes ago, diesieben07 said: Biome#getSpawns returns a List<Biome.SpawnListEntry>. Removing "hello" from List(1, 2, 3) is still List(1, 2, 3). Yeah I had figured that out. I also just figured out how to remove the specific entity from the index ?
January 30, 20205 yr Author 4 hours ago, diesieben07 said: Indices? This is 2020. Use removeIf with a Predicate to tell the list which elements you want removed. I'm old school, but I guess I can learn new tricks ? PS : I just learned how to do it.
February 14, 20205 yr On 1/30/2020 at 1:32 AM, MineModder2000 said: I'm old school, but I guess I can learn new tricks ? PS : I just learned how to do it. I'm very new to modding and I can't seem to figure out how to do it... Maybe I'm being really stupid, but how did you do it? Edited February 14, 20205 yr by Xrated_junior
February 14, 20205 yr Author 8 hours ago, Xrated_junior said: I'm very new to modding and I can't seem to figure out how to do it... Maybe I'm being really stupid, but how did you do it? This should help : https://howtodoinjava.com/java8/lambda-expressions/
February 15, 20205 yr 13 hours ago, MineModder2000 said: This should help : https://howtodoinjava.com/java8/lambda-expressions/ Iterator<SpawnListEntry> biomeSpawns = biome.getSpawns(EntityClassification.CREATURE).iterator(); while(biomeSpawns.hasNext()) { SpawnListEntry entry = biomeSpawns.next(); if (entry.entityType == EntityType.PIG) { biomeSpawns.remove(); } } Thank you! I will definitely look at that. I did get it to work eventually. Don't know if it looks bad though...
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.