Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Finally updating mod from 1.7.10 ... realized I do not realize understand the metadata in the updateTick code to begin with....so not sure how to update that part of the code to 1.8

 

So, my original code in my custom BlockSeaweed class, I utilized BlockClay, and it checks for Blocks.water,

as follows:

    public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
        if (par1World.getBlock(par2, par3 + 1, par4) == Blocks.water) {
            int l;
            for (l = 1; par1World.getBlock(par2, par3 - l, par4) == this; ++l);
            if (l < 3) {
                int i1 = par1World.getBlockMetadata(par2, par3, par4);
                if (i1 == 15) {
                    par1World.setBlock(par2, par3 + 1, par4, this);
                    par1World.setBlockMetadataWithNotify(par2, par3, par4, 0, 4);
                } else {
                    par1World.setBlockMetadataWithNotify(par2, par3, par4, i1 + 1, 4);
                }
            }
        }
    }

 

In the code as I have it, i1 getsMetadata value of water, and if equals 15, then sets the block to my Block seaweed.

Could someone explain that? I know blocks have meta data 0-15 but why would check for that? 

 

The next two parts I don't know what the code is doing at all , not sure what the "4" is in either #setBlockMetadataWithNotify.

 

So, I have to update this to 1.8, so far, I have this but I'm stuck on the Metadata parts:

    public void updateTick(World worldIn, BlockPos blockPos, IBlockState state, Random random) {
//   	BlockPos blockPos = new BlockPos(blockPos.getX())
    	int yCheck = blockPos.getY() + 1;
    	BlockPos pos1 = new BlockPos(blockPos.getX(), yCheck, blockPos.getZ());
    	if (worldIn.getBlockState(pos1).getBlock() == Blocks.water) {

            int l;
            for (l = 1; worldIn.getBlockState(blockPos.down()).getBlock() == this; ++l);

           if (l < 3) {
            	
            	int i1 = worldIn.getBlockMetadata(x, y, z);


                if (i1 == 15) {

                    worldIn.setBlockState(blockPos.getX(), blockPos.getY() + 1, blockPos.getZ()).getBlock(), this);
                    worldIn.setBlockMetadataWithNotify(blockPos.getX(), blockPos.getY(), blockPos.getZ(), 0, 4);
                } else {
                    worldIn.setBlockMetadataWithNotify(blockPos.getX(), blockPos.getY(), blockPos.getZ(), i1 + 1, 4);
                }
            }
        }
    }

 

 

Looks like you copied the code from BlockReeds.

 

The code as you have it does not do what you say you think it does.  Check the block positions again:

"If the block above is water, then loop through the blocks below checking that they are the same block as this.  If there are less than 3 and the metadata of this block is 15, set the metadata to 0 and place this block above."

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

Looks like you copied the code from BlockReeds.

 

The code as you have it does not do what you say you think it does.  Check the block positions again:

"If the block above is water, then loop through the blocks below checking that they are the same block as this.  If there are less than 3 and the metadata of this block is 15, set the metadata to 0 and place this block above."

 

yes, I confess I did not understand it. .. why would metadata for water need to be 15 ..is that default for a block that has 16 ?

"meta:15" and "water" are not related here.

 

The metadata 15 check is "how long has the reeds/seaweed been growing." It's AGE.

Water is merely the "is there water above me?" check so that the seaweed doesn't grow up into air.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.