Posted February 2, 201411 yr Right now I have a custom mob that spawns during the night and doesn't despawn during the day, which is the way I want it. Problem is, more of the same mob continually spawn and soon take over an area. I'm using the method of Limiting spawns per Chunk to 1 and it only spawns in one at a time, but I'm still having this problem. How does vanilla minecraft keep mobs like cows and such from continually spawning in an area over time AND keeping the cows from despawning?
February 2, 201411 yr Override getCanSpawnHere() You can access the world with the entity's worldObj, posX, posY, and posZ (even though it hasn't spawned yet) and check to see if any more of your mob are in the area, and if so, return false. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 6, 201411 yr Author Nice. I saw that you had a similar post to this awhile back so I'm glad it was you that answered.
February 6, 201411 yr Author Alright....I have no idea how to do this. I know to check for Instance of ..., but I do not know how to check the area at all. I looked into the mob spawner code to see how it checks for mob count but I can't figure it out.
February 6, 201411 yr Alright....I have no idea how to do this. I know to check for Instance of ..., but I do not know how to check the area at all. I looked into the mob spawner code to see how it checks for mob count but I can't figure it out. this.worldObj You can access the world with the entity's worldObj, posX, posY, and posZ Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 6, 201411 yr Author Right, but do I need to check a block range? I see that one can check a block location and see what block it is for a spawn, but I'm assuming you need to broaden that range to check for other entities in the chunk or something.
February 6, 201411 yr Right, but do I need to check a block range? I see that one can check a block location and see what block it is for a spawn, but I'm assuming you need to broaden that range to check for other entities in the chunk or something. The world class can do all of that. world.getEntitiesInAABB() for instance. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 8, 201411 yr Author Alright so this is what I have so far, although I know it's probably wrong and I am missing the Pos X, Y, Z. @Override public boolean getCanSpawnHere() { float f = 8.0F; List list; int i; list = this.worldObj.getEntitiesWithinAABB(EntityForestWalker.class, this.boundingBox.expand((double)f, (double)f, (double)f)); if (list.size() > 0){ return false; } else { return true; } } I'm assuming it is something close to this?
February 8, 201411 yr You mean like this.posX? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 8, 201411 yr Author Yes. I am honestly at the boundaries of my knowledge in how to do things like this so I will probably need a little more help in figuring out how this works. The getEntitiesWithinAABB line is correct right? How do I write the other components of this in a workable fashion?
February 8, 201411 yr Well you could clone the mob's own bounding box and then use .expand() instead of creating a new AABB. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.