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 would like to make it so that if the player walks on farmland while wearing certain armor, that the farmland reverts to dirt, trampling the crops. I want something like onEntityWalking, but it looks like overriding the farmland block would be nigh impossible, because of all the places in the Minecraft code that refers to it via Blocks.FARMLAND rather than using instanceof. Another option would be to add an EntityWalkingEvent to Forge, but that may be overkill, plus it would require waiting however long it takes to get the PR approved and into Forge.

 

Am I missing other options?

I'd use the armor item's onArmorTick method.  That way you're not having to check the player's inventory all the time, even when they're not wearing armor.

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.

I'd use the armor item's onArmorTick method.  That way you're not having to check the player's inventory all the time, even when they're not wearing armor.

Ah yes, forgot that method existed (I need to go to sleep)  :( . Also assuming that this is your armor this way.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Hi

 

I'd use the armor item's onArmorTick method.  That way you're not having to check the player's inventory all the time, even when they're not wearing armor.

Ah yes, forgot that method existed (I need to go to sleep)  :( . Also assuming that this is your armor this way.

 

I have a vague recollection that method is client side only, i.e. it won't be any good for trampling farmland because that needs to occur on server side only.

 

Worth testing out, should only take a few minutes to code up.

 

Ah what the hell, I'll try it myself now.

[00:06:16] [Client thread/INFO]: [minecraftbyexample.testingarea.ItemArmorTickTest:onArmorTick:20]: onArmorTick:client
[00:06:16] [server thread/INFO]: [minecraftbyexample.testingarea.ItemArmorTickTest:onArmorTick:20]: onArmorTick:server
[00:06:16] [Client thread/INFO]: [minecraftbyexample.testingarea.ItemArmorTickTest:onArmorTick:20]: onArmorTick:client
[00:06:16] [server thread/INFO]: [minecraftbyexample.testingarea.ItemArmorTickTest:onArmorTick:20]: onArmorTick:server

Guess I was mistaken...

 

-TGG

 

 

 

 

 

 

  • Author

Thanks for the ideas, everyone. It looks like onArmorTick happens once for each piece of armor you're wearing, which is overkill for what I'm doing. OnPlayerTick it is! And I'll take a look at making a PR as well.

OnPlayerTick it is!

 

Which ticks even if you're not wearing the armor. Talk about overkill.

(do your armor tick in one of your armor items, like the boots)

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.

There are a few ways to fix this .

 

I'd personally only do it on armor tick on the boots. Then on boots side you can check if you also wearing a chestplate then increase the chance of trample or something like that.

 

Boots are what people use to connect to the ground so if you don't wanna trample at all walk bearfoot which nobody will do :D 

 

Another way to do this is to have some kind of player weight stat and whenever you add or remove armor (certain armors) you add or remove weight. or turn weight on and off.

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

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.