Posted September 16, 201411 yr Hello everyone. So I a playing with block bounds again, but this time, instead of bounds larger than 1x1x1, I am trying to add bounding boxes to a cable I am working on, so I have it rendering and connecting, but the block bounds aren't updating, and this is because I haven't made it do so yet (because I don't know how to do this, hence why I am coming here). So I would like to ADD bounding boxes when it is connected, don't confuse this, I want to ADD boxes, not extend the existing box. like what Buildcraft pipes do, they add boxes, and don't just extend the box existing. Now I have come across a method called addCollisionBoxesToList(world, x, y, z, AABB, list, entity) {...} and have filled it out: public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB block, List list, Entity entity) { float px = 1/16; this.setBlockBounds(px*6-2, px*6-2, px*6-2, px*6-2, px*6-2, px*6-2); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof TileEntityCable) { TileEntityCable tileCable = (TileEntityCable) tileEntity; if (tileCable.connections[5] != null) { this.setBlockBounds(0.0F, 0.375F, 0.375F, 0.625F, 0.625F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } if (tileCable.connections[4] != null) { this.setBlockBounds(0.375F, 0.375F, 0.375F, 1.0F, 0.625F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } if (tileCable.connections[1] != null) { this.setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 0.625F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } if (tileCable.connections[0] != null) { this.setBlockBounds(0.375F, 0.375F, 0.375F, 0.625F, 1.0F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } if (tileCable.connections[2] != null) { this.setBlockBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } if (tileCable.connections[3] != null) { this.setBlockBounds(0.375F, 0.375F, 0.375F, 0.625F, 1.0F, 0.625F); super.addCollisionBoxesToList(world, x, y, z, block, list, entity); } } this.setBlockBounds(0.375F, 0.375F, 0.375F, 0.625F, 0.625F, 0.625F); } Now all this seems to do is set the collision boxes, not the actual bounds. so before this, I could clip through the sections of the cable without bounds, and the same with other entities, now with this, it seems to stop that, but still no bounding boxes. Also, just a little note, the "connections" is a ForgeDirection array in the tileentity used to store the connections. (0 = UP, 1 = DOWN, 2 = NORTH, 3 = SOUTH, 4 = EAST, 5 = WEST). The reason I want to do this, is because I would like to work my cables into forge multipart, so I can have a cable in the same block space as a multipart. So any help on the adding block bounds bit would be appreciated, I would also appreciate help with the multipart bit, but that isn't what this topic is about, and I haven't even got to starting that yet. Thanks I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
September 16, 201411 yr Author Update: I just discovered that it hasn't actually set the collision box, it was just my perspective, and so the existing bounds was still in my way. I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.
November 18, 201410 yr Hello I have been looking all over for this, I have been working with MCreator and Techne making a door. I don't know much java hardly only the basics and jumping in to MCreator was the best thing for me to do because I can learn most of the basic block code and such that was and its all generated but for I am becoming a bit more advanced and trying to learn more things, It took me 48 hours just to find what this post, will you help me? May I please ask to see the finished code, this would take a lot of stress of my solders. If you don't want to post it here you may email it to me at [email protected] Thank you for your time, NorthWestTrees
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.