Posted June 7, 201411 yr How would I go about limiting the number of entities per chunk for my custom mobs.
June 8, 201411 yr Author What would I put for the first and second parameter, is it the entity I am checking for and the chunk or something?
June 8, 201411 yr Author I get an error under "getEntitiesWithinAABB" when using this.worldObj.getEntitiesWithinAABB(this, getBoundingBox()) >= 3
June 8, 201411 yr Author Okay sorry, it's just that there was no getEntitiesOfTypeWithinAABB method, and it only had 2 parameters so I have now done this and I have no errors but it crashes: private boolean entityLimit() { if(worldObj.getEntitiesWithinAABB(EntityBlockCoal.class, getBoundingBox()) != null) { return false; } return true; }
June 8, 201411 yr Author Oh, would I have to use the ChunkData event like this or something similar then get the chunk from it? @SubscribeEvent private void chunkDataEvent(ChunkDataEvent event) { event.getChunk(); }
June 8, 201411 yr Author I'm sorry about this, I'm just fairly new to modding still. I have changed it to this: private boolean entityLimit(World world) { if(world.getChunkFromBlockCoords(serverPosX, serverPosZ).worldObj.getEntitiesWithinAABB(EntityBlockCoal.class, getBoundingBox()) != null) { return false; } return true; }
June 8, 201411 yr Author Never mind then, I'm not understanding so am going to do some research and try again at a later date. Thanks for the help anyway. Edit: I got to this but I'm not sure what to do with the list, but its probably wrong anyway: if(Chunk.getEntitiesOfTypeWithinAAAB(EntityBlockCoal.class, getBoundingBox(), List, null) != null) { return false; } return true; }
June 8, 201411 yr Author Okay I have done that but I still get an error saying I need to cast the list. List entityList = new List(); if(Chunk.getEntitiesOfTypeWithinAAAB(EntityBlockCoal.class, getBoundingBox(), entityList, null)) { return false; }
June 8, 201411 yr Author I now get an error under: Chunk.getEntitiesOfTypeWithinAAAB(EntityBlockCoal.class, getBoundingBox(), entityList, null) With no suggestions.
June 8, 201411 yr Author world.getChunkFromBlockCoords(serverPosX, serverPosZ).getEntitiesOfTypeWithinAAAB(EntityBlockCoal.class, getBoundingBox(), entityList, null) So more something like that?
June 8, 201411 yr Author boundingBox.getBoundingBox(par0, par2, par4, par6, par8, par10) So I would use this then specify the size.
June 8, 201411 yr Sorry, it is saying I can't convert from void to boolean. qpwoeiruty, all of your questions in this thread seem to be from not understanding Java fully. It is okay that you're a beginning programmer (everyone has to start somewhere), but your questions really aren't about modding they are about Java. You didn't know how to call a method, you didn't know about static methods, you didn't know about casting, and now you don't know about return values. You should really just learn more Java. There are plenty of online references, but I also suggest having a very good book that is easy to read called: Java In Easy Steps. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.