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

Okay, I have a custom crop that I do something special when it finishes growing.  So in 1.7.10 I had a tile entity associated with the block and the tile entity checked for finished growing and performed the code.

 

The problem I'm having in 1.8 is that in the grow() method of my crop block class I use the setBlockState() method to update the growth.  This is copied from the vanilla BlockCrop.  However, I noticed that the tile entity gets recreated every time the setBlockState() method is called.  This is a problem since I have other fields in the tile entity that are supposed to be preserved over time.

 

I am determining that it is recreating a tile entity by putting a console statement in the createTileEntity() method in my block class.

 

The weird thing is that the Block code seems to be correct -- it checks for a TileEntity before creating it:

                if (block.hasTileEntity(p_177436_2_))
                {
                    tileentity = this.func_177424_a(p_177436_1_, Chunk.EnumCreateEntityType.CHECK);

                    if (tileentity == null)
                    {
                        tileentity = block.createTileEntity(this.worldObj, p_177436_2_);
                        this.worldObj.setTileEntity(p_177436_1_, tileentity);
                    }

                    if (tileentity != null)
                    {
                        tileentity.updateContainingBlockInfo();
                    }
                }

 

So my question is -- how can you change a block's state without regenerating the tile entity?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.