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

Hello. I want to make jump boost boots. But I'm not going to use jumpboost effect. I want to give player extra force.
I tried to make it like this:

Quote
@Override
    public void inventoryTick(ItemStack pStack, Level pLevel, Entity pEntity, int pSlotId, boolean pIsSelected) {
        super.inventoryTick(pStack, pLevel, pEntity, pSlotId, pIsSelected);
        if(!pLevel.isClientSide) {
            if (pEntity instanceof Player player) {
                if (player.getItemBySlot(EquipmentSlot.FEET) == pStack) {

                    if (Minecraft.getInstance().options.keyJump.consumeClick() && player.onGround()) {
                        player.push(0.0,1.0,0.0);
                        player.sendSystemMessage(Component.literal("test" + count));
                        count++;


                    }


                }
            }
        }

    }

 

But when I jump "player.push" method doesn't always work but "sendSystemMessage" works absolutly fine.

What i did wrong?

From what I've found, you can only manipulate the player's motion on the client side. It's extremely annoying. If you know how to use packets, you can use packets to transfer the information from the server. Take a look at my implementation on GitHub here if you want. You'd want something similar to the way I've done the PlayerAddVelocityPacket. Unfortunately, packets are rather complex; I'd recommend you watch a few tutorials on them before even trying to work with them. Feel free to use my code as a reference, but please give attribution if you plan to directly copy it.

  • Author

Thanks a lot. But I found an information that "Minecraft.getInstance().options.keyJump.consumeClick()" and other keybinding methods don't work on the server. But how when all my method works? I placed "if(!pLevel.isClientSide)" statement in the top of all but it somehow do the "sendSystemMessage" method.

 

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.