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

Ok so first of what i am trying to do.

I am trying to use the vanilla scoreboard to display information to a specific player. This is for a server side mod so i cant just access the scoreboard client side.

I have found a way to do this but its going to be a little tricky to implement so before i get started i want check if anyone knows a better way.

 

After digging through the scoreboard code i have found that i can do this using the following packets.

 

Sends the scoreboard objective to the client

S3BPacketScoreboardObjective(scoreObjective, 0)

Displays the objective in the sidebar

S3DPacketDisplayScoreboard(1, scoreObjective)

Updates a spacific score in the objecting.

S3CPacketUpdateScore(score, 0)

 

Working example

 

ServerScoreboard scoreboard = (ServerScoreboard) MinecraftServer.getServer().worldServerForDimension(0).getScoreboard();
ScoreObjective scoreObjective = scoreboard.getObjective("Test");
Score score = scoreboard.func_96529_a("brandon3055", scoreObjective);

player.playerNetServerHandler.sendPacket(new S3BPacketScoreboardObjective(scoreObjective, 0));
player.playerNetServerHandler.sendPacket(new S3DPacketDisplayScoreboard(1, scoreObjective));
player.playerNetServerHandler.sendPacket(new S3CPacketUpdateScore(score, 0));

 

 

The problem i encountered is if i use S3BPacketScoreboardObjective to add an objective that already exists or remove one that dose not exist it crashes the client.

This means i am going to have to come up with a tracking system to keep track of what objective each player currently has displayed and make sure i dont remove or add an objective that already exists. It would also have to keep track of when a player relogs.

 

 

Edit: On second thought i only need to send the player one objective which i can send on login. Then i can just change the name, contents and visibility of that objective as needed.

I am the author of Draconic Evolution

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.