Rohzek Posted September 9, 2015 Share Posted September 9, 2015 More custom food errors... but this time only halfway related to the spoiling food... Namely those foods have messed up particles So this was interesting to try and snap a picture for but: The food particles don't look anything like ANY of the textures I have registered for this... Is there a easy way to fix or remove them? and more pressingly: My custom block/stem crops are crashing with: java.lang.NullPointerException: Exception ticking world ... at com.Rohzek.food.crop.BlockStem.updateTick(BlockStem.java:120) ... which is the spawn block in world under onupdate.. taken straight from the vanilla code for melons... Not sure whats wrong with it? public void updateTick(World world, int x, int y, int z, Random random) { super.updateTick(world, x, y, z, random); if (world.getBlockLightValue(x, y + 1, z) >= 9) { float f = this.func_149875_n(world, x, y, z); if (random.nextInt((int)(25.0F / f) + 1) == 0) { int l = world.getBlockMetadata(x, y, z); if (l < 7) { ++l; world.setBlockMetadataWithNotify(x, y, z, l, 2); } else { if (world.getBlock(x - 1, y, z) == this.block) { return; } if (world.getBlock(x + 1, y, z) == this.block) { return; } if (world.getBlock(x, y, z - 1) == this.block) { return; } if (world.getBlock(x, y, z + 1) == this.block) { return; } int i1 = random.nextInt(4); int j1 = x; int k1 = z; if (i1 == 0) { j1 = x - 1; } if (i1 == 1) { ++j1; } if (i1 == 2) { k1 = z - 1; } if (i1 == 3) { ++k1; } Block block = world.getBlock(j1, y - 1, k1); if (world.isAirBlock(j1, y, k1) && (block.canSustainPlant(world, j1, y - 1, k1, UP, this) || block == Blocks.dirt || block == Blocks.grass)) { world.setBlock(j1, y, k1, this.block); } } } } } Quote Developing the Spiral Power Mod . こんにちは!お元気ですか? Link to comment Share on other sites More sharing options...
jabelar Posted September 10, 2015 Share Posted September 10, 2015 Which line is 120 in your code? If you know that, then one of the things in that line must be null and you just need to think why it is null and fix that. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/ Link to comment Share on other sites More sharing options...
Rohzek Posted September 10, 2015 Author Share Posted September 10, 2015 I know that much. As I said (the quick buttons don't seem to be working right now so... improvise) "which is the spawn block in world under onupdate.. taken straight from the vanilla code for melons..." Line 120 is world.setBlock(j1, y, k1, this.block); but I can't even begin to imagine why that could be null. The stem works fine on it's own... as does the melon block... it's when it tries to spawn a melon that it breaks.. and the code is literally copy pasted from the vanilla code. I don't understand why it's not working. EDIT: Out of curiosity.. I just deleted that entire class and started over RE copypasta-ing and refactoring variables.... and this time it worked just fine.... I don't even know what was up but thats fixed. That just leaves the particles of my custom food being a weird color. Quote Developing the Spiral Power Mod . こんにちは!お元気ですか? Link to comment Share on other sites More sharing options...
Recommended Posts
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.