Posted March 6, 201510 yr I get an NPE on this: if(nextTube.straights != straights) why? [shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]
March 6, 201510 yr Author I should mention that this is in a tile entity, and is part of a linking system based off my power cables and plasma pipes in the main LabStuff mod. However, it works with two, but when you add a third, the game crashes [shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]
March 6, 201510 yr You get an NPE when something is null, in this case 'nextTube' is null, so when you try to access 'nextTube.straights', the game crashes. Why is 'nextTube' null? Should that ever be possible? If so, check for it. If not, check the rest of your logic. http://i.imgur.com/NdrFdld.png[/img]
March 6, 201510 yr Author I wouldn't think so. This is only called if their are adjacent tubes, and then I have this TileEntity posX = worldObj.getTileEntity(xCoord+1, yCoord, zCoord); TileEntity posZ = worldObj.getTileEntity(xCoord, yCoord, zCoord+1); TileEntity negX = worldObj.getTileEntity(xCoord-1, yCoord, zCoord); TileEntity negZ = worldObj.getTileEntity(xCoord, yCoord, zCoord-1); if(posX instanceof TileEntityAcceleratorTube && posX != null && !posX.equals(src)) return (TileEntityAcceleratorTube)posX; if(posZ instanceof TileEntityAcceleratorTube && posZ != null && !posZ.equals(src)) return (TileEntityAcceleratorTube)posZ; if(negX instanceof TileEntityAcceleratorTube && negX != null && !negX.equals(src)) return (TileEntityAcceleratorTube)negX; if(negZ instanceof TileEntityAcceleratorTube && negZ != null && !negZ.equals(src)) return (TileEntityAcceleratorTube)negZ; return null; to find the next block in the sequence.But this is, again, only run if their are adjaecent blocks. I pass in the parameters from my render, which figures out what kind of shape the tube is(straight on x,y, or z, corner, three way, four way, five way, all way, no way, one way), to my tile entity, it calculates what it is based on that(the render figures out whether there is a connection up, down, N,E,S,W), and updates the network accoridingly. If it's alone, it's invalid, and does nothing. [shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]
March 6, 201510 yr Author I lied, it can be null, nvm [shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]
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.