Jump to content

Custom Food and Crop Errors


Rohzek

Recommended Posts

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:

 

 

SR4MtTV.png

 

 

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);
                    }
                }
            }
        }
    }

 

Developing the Spiral Power Mod .

こんにちは!お元気ですか?

Link to comment
Share on other sites

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.

Developing the Spiral Power Mod .

こんにちは!お元気ですか?

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.