
SamTebbs33
Forge Modder-
Posts
79 -
Joined
-
Last visited
Everything posted by SamTebbs33
-
Hi, how would I search for dropped items in a radius around a coordinate? I tried: public static ArrayList<EntityItem> getEntityItemsInRadius(World world, double x, double y, double z, int radius){ List list = world.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1.0D, y + 1.0D, z + 1.0D).expand(radius, radius, radius), IEntitySelector.selectInventories); ArrayList<EntityItem> result = new ArrayList<EntityItem>(); for(int k = 0; k < list.size(); k++){ if(list.get(k) instanceof EntityItem){ result.add((EntityItem) list.get(k)); } } return result; } but the length of the returned array list is always 0 even if I drop an item within the radius.
-
Equivalent of Thread.sleep() that won't upset minecraft.
SamTebbs33 replied to SamTebbs33's topic in Modder Support
Thanks guys. I'll just increment a variable each tick using the onUpdate() method and check that in the AI. -
Equivalent of Thread.sleep() that won't upset minecraft.
SamTebbs33 posted a topic in Modder Support
I need to wait a certain number of milliseconds between executing parts of my mob AI, I would obviously use multithreading or just simply Thread.sleep() in my own program, but will that throw minecraft off? Or is there a method minecraft uses to wait a certain amount of time when executing its code? -
You know, you can use the *public void updateScreen()* in GuiContainer to update your Gui
-
Hi! I'm making a mob which moves to a certain location, breaks a block and returns to it's original location. This is repeated for every block of that type in the area. I've already got a for loop to account for each block, but how would I go about moving the entity to the location of the block and then checking if it has done so? I have tried using a while loop and checking if the entity's position is close to the block's, but that crashed the game... Here's the method I'm using to move the entity: public void moveEntityTo(int x, int y, int z){ this.getNavigator().tryMoveToXYZ(x, y, z, 0.3D); } All of my source code is here: https://github.com/VivaDaylight3/myrmecology Thanks!
-
Thanks! I'll try that. I could get the closest one.
-
Hi, I'm making a mob which searches all blocks in a radius from its position. If any of the blocks are of a certain block ,it approaches the block and does something. However, I'm having real trouble figuring out a way of making a method which searches all blocks in a radius from a coordinate and returns an array of those blocks, does anyone have any idea on how this could be done? An example method name would be getBlocksInRadius(World world, int x, int y, int z, int radius) Thanks in advance!
-
[SMP][API]Myrmecology - Capture, breed and enslave ants!
SamTebbs33 replied to SamTebbs33's topic in Mods
Sounds good! What does your bug mod do? I've been working on a wiki which is located at our GitHub repo, all of the links are in the main Minecraft Forums post. -
Hi! I'm trying to make one of my entities spawn when right clicking with an item. For some very weird reason I'm getting the following output to the console without me calling System.out.println() !!! public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (par3World.isRemote || par1ItemStack.getItemDamage() != Metadata.getMetaWorker()) { return true; } par4 += Facing.offsetsXForSide[par7]; par5 += Facing.offsetsYForSide[par7]; par6 += Facing.offsetsZForSide[par7]; Entity ant = new EntityAntForest(par3World); Environment.spawnEntity(par3World, ant, par4, par5, par6); return true; } public static Entity spawnEntity(World par0World, Entity entity, double par2, double par4, double par6){ for (int j = 0; j < 1; ++j) { if (entity != null && entity instanceof EntityLivingBase) { EntityLiving entityliving = (EntityLiving)entity; entity.setLocationAndAngles(par2, par4, par6, MathHelper.wrapAngleTo180_float(par0World.rand.nextFloat() * 360.0F), 0.0F); entityliving.rotationYawHead = entityliving.rotationYaw; entityliving.renderYawOffset = entityliving.rotationYaw; par0World.spawnEntityInWorld(entity); entityliving.playLivingSound(); } } return entity; } Output: 2013-10-17 17:40:11 [iNFO] [sTDOUT] spawnCreature 2013-10-17 17:40:11 [iNFO] [sTDOUT] has entity 2013-10-17 17:40:11 [iNFO] [sTDOUT] entity == null I used to print these to the console but for some reason it's still happening even after I removed the lines that were printing to the console, what could be wrong? P.S the mod isn't spawning even if it was before... My source code is here btw: https://github.com/VivaDaylight3/myrmecology
-
Using coloured Icon overlays like vanilla spawn eggs
SamTebbs33 replied to SamTebbs33's topic in Modder Support
Thanks! I'll give a try -
Hi! I would like to use coloured image overlays for an item just like the vanilla spawn eggs do. For example, I'd have one texture which is the base texture and another which is the overlay. I would like to be able to make both colourable, just like the vanilla spawn eggs. How would I achieve this? Thanks in advance
-
Myrmecology is a mod that adds many species of ants to the vanilla game. You can capture, breed and enslave them! We offer a simple-to-use API for other modders to add more ants, hills and much more! Here is the mod's MinecraftForums thread where all downloads and info is listed: http://www.minecraftforum.net/topic/1960672-forgeapi164-myrmecology-v010-capture-breed-and-enslave-ants/page__hl__%20myrmecology I haven't given much info here since I would like to stick to only having to maintain one thread.
-
I recomend you re-download the latest recommended version and install it, there might have been a problem with the installation.
-
Weird errors when updating to forge 1.6.4-9.11.1.916
SamTebbs33 replied to SamTebbs33's topic in Modder Support
Bump -
Weird errors when updating to forge 1.6.4-9.11.1.916
SamTebbs33 replied to SamTebbs33's topic in Modder Support
Thanks! That fixed one of the errors! However I'm getting another error in the AccessTransformer class, I can't figure out how to fix it as I've referenced the latest version (4.1) of the asm-all library http://i1059.photobucket.com/albums/t425/CascadeRP/2013-10-08074036am_zpsd498cf01.png[/img] -
When updating to the recommended update here: http://www.minecraftforge.net/forum/index.php/topic,5.0.html I'm getting some weird errors in Eclipse, there's an exclamation mark next to the Minecraft project but it has no errors, there is also an error symbol by my mod's project but there aren't any errors in my packages. What could be the problem? Here's an image: http://i1059.photobucket.com/albums/t425/CascadeRP/2013-10-06092846pm_zpsbe6865db.png[/img] Here's the error I get when running the shown run configuration: Exception in thread "main" java.lang.NoClassDefFoundError: net/minecraft/launchwrapper/Launch Caused by: java.lang.ClassNotFoundException: net.minecraft.launchwrapper.Launch at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
-
Minecraft will not provide an NBT mapping for tile entities unless you register them, you do this by calling the following method from your mod's main class: GameRegistry.registerTileEntity(TileEntity.class, "block's unlocalised name"); Where TileEntity.class is the .class file of your tile entity. I hope this works for you!
-
What dev environment are you using? If you're using the advanced environmnet (shown by Pahimar here: ), you will need to designate the directory above your assets folder as a source folder.
-
For some reason, the getItem() part of the following code is returning null, does anyone know why that could be? I made sure that it was that part by separating it from this.getQueen(), the crash report said that it was the line where getItem() was which was causing the problem. The item is an instance of ItemAnt so that's not the problem ItemStack result = this.getQueen(); result.setItemDamage(Metadata.getMetaLarva()); result.stackSize = ((ItemAnt) this.getQueen().getItem()).getFertility(); GetQueen(): private ItemStack getQueen() { if (this.getContents()[getQueenSlot()] != null) { if (this.getContents()[getQueenSlot()].getItem() instanceof ItemAnt && this.getContents()[getQueenSlot()].getItemDamage() == Metadata .getMetaQueen()) { return this.getContents()[getQueenSlot()]; } } return null; } Thanks in advance. P.S It's being used in the updateEntity() method in a tile entity.
-
ItemStack Gui NBT isn't saving after GUI close
SamTebbs33 replied to SamTebbs33's topic in Modder Support
Thank you for the help! That must be the problem, would I have to send some kind of packet to the server to allow the GUI to modify NBT data? -
Hi, I'm making an item which opens up a GUI when right-clicked. When a certain item is placed in a slot in the itemstack's container, a key's value is set to true in the itemstack's nbt. The only problem is that the nbt doesn't seem to be saving on GUI close, it does however save while the GUI is open. I have ensured that the relevant nbt keys are created in the onCreate method in net.minecraft.item.Item. I have another item which uses nbt but not with a GUI and that works fine. Does anyone know how I would go about fixing it? P.S I haven't shown my source code as I'm a bit reluctant to make it public at the moment, if you need to see it, please PM me. Thanks in advance
-
I'm doing the same kind of thing and I have no idea how to get ItemStack containers to save NBT data
-
Thanks guys, both of your replies have been helpful
-
Hi, is it possible to draw strings on a GUI in colours different from the standard grey?
-
Thanks! I can't believe I didn't find that!