Jump to content

[Solved]Looking for help with updating mod to 1.8.9


tomtomtom09

Recommended Posts

This is the code causing me few problems:

Lvl0Id[count] = world.getBlockId(x, y, z);

                        count++;

 

 

int count = 0;
        int y = pos.getY() - 1;
        boolean Test = true;
            for (int x = pos.getX() + 3; x > pos.getX() - 4; x--)
            {
                for (int z = pos.getZ() - 2; z < pos.getZ() + 2; z++)
                {
                    if (x == pos.getX() + 3 && z == pos.getZ() - 2 || x == pos.getX() + 3 && z == pos.getZ() + 1 || x == pos.getX() - 3 && z == pos.getZ() - 2 || x == pos.getX() - 3 && z == pos.getZ() + 1)
                    {
                        continue;
                    } else
                    {
[b]Original code[/b]
                        Lvl0Id[count] = world.getBlockId(x, y, z);
                        count++;
[b]was experimenting with block states but couldn't return an int.[/b]
                        Lvl0Id[count] = state.getValue(x,y,z);
                        count++;

                        Lvl0Id[count] = worldIn.getBlockState(new BlockPos(x,y,z)).getBlock());
                        count++;
                        if (worldIn.isBlockFullCube(new BlockPos(x,y,z)))
                        {
                            continue;
                        } else
                        {
                            //Error = "error code here";
                            //Test = false;
                            continue;
                        }
                    }
                }
            }

 

 

Been awhile since I've done any modding, thought someone could help shine some light :)

Developer of CampCraft

Link to comment
Share on other sites

World#getBlockState

returns the current state of the block at the specified position.

 

Numeric block IDs are automatically assigned per-world and can change on world load. You should avoid using them if at all possible.

 

What are you actually trying to do? What is the

Lvl0Id

array for?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I don't understand why you need an array of block IDs, but you should probably replace it with an array of

Block

s (the block type) or

IBlockState

s (essentially a

Block

and metadata).

 

You can read more about block states here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

What version are you upgrading from? MC 1.6.2?

 

Why to 1.8.9? If upgrading, you should if possible aim for the latest MC version supported by Forge.

 

And what are the problems? Do you have a crash report or Forge log to post?

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

 

 

Thanks for the link, got code working :) when I first started coding was easier to check the block ids as mc didn't have many blocks, I've got the code checking the block material types which seems to be working fine now :)

 

 

 

Was upgrading from 1.5.2. Problem was I was checking for the block ids of a loop of blocks to check no blocks are missing but couldn't call the block id as we have blockstates now,

 

When I started few weeks ago wasn't a recommended 1.9 version and plan was to update to 1.8.9 then update to 1.9. Code shouldn't of changed to much between versions.

 

Developer of CampCraft

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.

Announcements



×
×
  • Create New...

Important Information

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