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

1 minute ago, Zanckor said:

So, i need to call this custom packet on ServerTickEvent, but this dont will lag player?

you can regenderate your Ki on server and client, if the Ki is fully regenderate on server send a Packet to the client which makes sure the values are the same
but this means you have to check whenever the client whats to call a action if the Ki value does match with the server on

and yeah you should avoid sending Packets each tick

  • Author

Wait a second xD, so, i need to put my regen code on server side, and then sync it from server to client, arent?

But, I still dont know how to put this code on server side, i mean, if i put it on ServerTickEvent i cant put (Player player = e.getPlayer), so, how server know to which player is this info

30 minutes ago, Zanckor said:

But, I still dont know how to put this code on server side, i mean, if i put it on ServerTickEvent i cant put (Player player = e.getPlayer), so, how server know to which player is this info

check if the player of the Event is an instance of ServerPlayer

  • Author

Okay, so, i should do something like, if(player instanceof ServerPlayer){ RegenCode } and, if(player instanceof Player) { RegenCode }, but when, on server side, Current Ki is full, 0, or whatever i want, send a packet to check if both values are the same, and if not change client value

 

Edit: Okay, i realized that its better just make it server side, and whenever i need to use it, like, before attacking with ki, send a packet to sync it

Edited by Zanckor

1 hour ago, Zanckor said:

Okay, so, i should do something like, if(player instanceof ServerPlayer){ RegenCode } and, if(player instanceof Player) { RegenCode }, but when, on server side, Current Ki is full, 0, or whatever i want, send a packet to check if both values are the same, and if not change client value

Edit: Okay, i realized that its better just make it server side, and whenever i need to use it, like, before attacking with ki, send a packet to sync it

logic like this should always be done on server and only sync it to the client if it is necessary

  • Author

Look, with this code is already working without packets, at least on singleplayer, that should work on multiplayer too?

Is regenerating and working with other methods

 

https://ibb.co/B3NXYGx

Edited by Zanckor

  • Author
30 minutes ago, Luis_ST said:

should work, you can test it via running the runServer gradle task

So, why should i send packets if it works now?

 

1 hour ago, Zanckor said:

So, why should i send packets if it works now?

you now do it fully server side you don't need any Packets,
unless you need the Ki value on the client

  • 2 weeks later...

you sending the Packet from client to sever, this means you can not do this in your handle method

Player player = (Player) Minecraft.getInstance().getCameraEntity();

you should use the player from the Context (Context#getSender)

why did you return a boolean from the handle method?

  • Author
9 minutes ago, Luis_ST said:

why did you return a boolean from the handle method?

I've seen it on another packet, so i thougth it should be a boolean method, but can it be public void handle?

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.