Posted June 22, 20169 yr 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
June 22, 20169 yr 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.
June 22, 20169 yr Author Was trying to use a loop to check if an area of blocks is flat and if a block is missing return an-ingame error message to the player. using the array to check number of blocks on the ground Lvl0Id = new int[24]; Developer of CampCraft
June 22, 20169 yr 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.
June 22, 20169 yr 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.
June 23, 20169 yr Author 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
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.