MineModder2000 Posted January 29, 2020 Posted January 29, 2020 (edited) 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, 2020 by MineModder2000 Quote
MineModder2000 Posted January 29, 2020 Author Posted January 29, 2020 2 minutes ago, diesieben07 said: Why not? Show what you tried. biome.getSpawns(EntityClassification.CREATURE).remove(EntityType.PIG); Quote
MineModder2000 Posted January 29, 2020 Author Posted January 29, 2020 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 ? Quote
MineModder2000 Posted January 30, 2020 Author Posted January 30, 2020 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. Quote
Xrated_junior Posted February 14, 2020 Posted February 14, 2020 (edited) 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, 2020 by Xrated_junior Quote
MineModder2000 Posted February 14, 2020 Author Posted February 14, 2020 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/ Quote
Xrated_junior Posted February 15, 2020 Posted February 15, 2020 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... Quote
Xrated_junior Posted February 18, 2020 Posted February 18, 2020 Ahhh okay, Thank you very much for your help! 1 Quote
Recommended Posts
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.