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've been quickly picking up coding skill over the last few weeks of intense modding and learning, but there's a lot of simple things that I simply haven't had occasion to stumble on yet.

For instance:
1 - Say I wanted a block to cause an effect if something walked on top of it, where would I start with this?

2 - How can one disable the ability to place a block on top of another particular block?

The general principles that diesieben07 is mentioning are:

 

1) If you want do to something in modding, start by looking at the closest things in vanilla minecraft and see how they accomplish it.

 

2) The approach you take often depends on whether you're making your entirely new thing (block, item, entity) or trying to change an existing one. For your own thing, you can often just extend classes, implement interfaces and override methods as you wish. For vanilla things you need to look for "hooks" such as:

a) Many classes have publicly accessible fields and methods. For example, entity AI is public so you can totally replace it if you wanted.

b) Forge has provided a lot of hooks, especially events but also registries and ore dictiionary, that allow you to intercept and replace vanilla behavior.

c) If you really don't have either of the above, you can use Java reflection to change the access scope of the vanilla fields and methods.

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

  • Author
11 hours ago, diesieben07 said:

Take a look at vanilla's magma block, which damages entities walking on it.

 

It depends. Is the block being placed added by your mod?

Oooo, that's right, I forgot about the Magma block.  Thank you!

 

And yes.

 

 

8 hours ago, jabelar said:

The general principles that diesieben07 is mentioning are:

 

1) If you want do to something in modding, start by looking at the closest things in vanilla minecraft and see how they accomplish it.

 

2) The approach you take often depends on whether you're making your entirely new thing (block, item, entity) or trying to change an existing one. For your own thing, you can often just extend classes, implement interfaces and override methods as you wish. For vanilla things you need to look for "hooks" such as:

a) Many classes have publicly accessible fields and methods. For example, entity AI is public so you can totally replace it if you wanted.

b) Forge has provided a lot of hooks, especially events but also registries and ore dictiionary, that allow you to intercept and replace vanilla behavior.

c) If you really don't have either of the above, you can use Java reflection to change the access scope of the vanilla fields and methods.

3

Well, this particular one is my own added block.  Reflection, I'll admit, have been a bit intimidating for me to consider at this point. I  know I have to look at it eventually, but not quite sure I'm there yet. I wasn't familiar with anything that behaved specifically the way I wanted in Vanilla, as you have to enter Cactus's bounding box before it'll damage you.  Magma, on the other hand, handles that nicely.

 

However, I'm not immediately familiar with anything that doesn't let you place a block on top of it either.

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.