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

I have an Block that extends BlockCrops. Is it very hard to check the dimension, say "world.provider.getDimensionID" and if it's not in, say, the nether, make it drop as if it was killed by the player?

Could someone help me with this?

“Since when did you start modding?”

“Last night"

Hi

 

It's not difficult.

 

BlockLeaves does something similar if the leaves are unsupported.

 

in updateTick:

 

if (!par1World.isRemote) --> this.removeLeaves

 

this.removeLeaves:     

        this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);

        par1World.setBlockToAir(par2, par3, par4);

 

And also need to set

        this.setTickRandomly(true);

in the constructor, so that updateTick gets called occasionally.

 

-TGG

 

  • Author

I’m fairly new to modding, could you please explain to me more thoroughly?

I have a basic tick handler, but I do not know what to do from there.

“Since when did you start modding?”

“Last night"

Hi

 

Thanks EP :-)

 

// Im not quite sure why you only would want this to get done on the server side

// Since we need the visual as well?

 

I think the vanilla code does that because changing the block and dropping the item on the server automatically syncs with the clients, so it's not necessary to do it on the client as well.  Sometimes it is important to do something on the server only, otherwise you get "ghost" items on the client, but in this case I think the setBlock and Drop methods check for that.  So I reckon it would probably work fine either way.

 

-TGG

  • Author

It works. Thanks, I now know how to do this stuff. This is also how minecraft Grass spreads, right? On random tick?

“Since when did you start modding?”

“Last night"

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.