#help-development
1 messages ¡ Page 1336 of 1
myes
ah yeah i saw..
thanks for opinion
I'll make some small fixes they are easy..
and in my opinion.. LOL there is nothing much to event in scoreboard therefore every server has the same
i kind of don't like it as a concept honestly, it just gets in your face with things you already know or could easily check with a command
i'd rather throw balance and such on the tab footer
and use the sidebar for something like a quest tracker
I see..
interesting
But me personally checking everything by command is kinda annoying
as a player
however this has some practical difficulties because it seems every server on the earth has a sidebar that shows the exact same things, so players are ad-conditioned to not look at it
i had this case where a player was asking "why is my balance not going up when i sell things"
exactly
đ
it turned out they were looking at the $200 quest reward in the "rewards" section of the sidebar
which, mind you, had a big bold all caps QUEST title
you probably already know your rank if you play; money, ping, server date + time, other good-things-to-know go best on tab
much faster than a command and isn't bolted to your face all the time
but yk im addicted to look my tab and scoreboard constantly
u can remove scoreboard tbh if u dont like
many client has those options
and even i hav that option too
using /scoreboard
i suppose, it just seems like a waste of effort and space
depends
but it's the way everyone does it so i guess most people are going to end up doing it like that
it only takes 1 hour
How often did you update the balance?
i mean the issue was that the number they were looking at ($200) wasn't their balance, but the quest reward
oh
they were so conditioned to "sidebar shows my money" that they completely disregarded the parts that read QUEST and "do this and that" and "rewards" and only saw the $200
yeah like everyone calls photocopy a xerox
so i have this slight and ambient animosity towards servers and people using sidebars for this decorative useless stuff, because it's trained my new players to not look at the best quest-tracking hud in the game that i did spent a decent bit of effort on
just like ads
therefore i give your screenshots -10000 points
https://imgur.com/a/dhXQ5Gj The alignment problem also occurs with the default font
myeah, you'll want to create your own monospaced font with the glyphs of your choice in it
or do padding, but that's a bit unreliable if the player's resourcepack overrides the default font
I don't think anyone cares about that
basically what emily said
tons of things are clientside and bound to packets and events that aren't strictly for sounds
e.g. the block break effect which fires the breaking particles will also fire a sound, you can't cancel just the sound part without cancelling also the particles part
u can override sounds
not delete them
in sounds.json
Not ideal but its the only way to affect client-side sounds
that could maybe work; then add your own matching sounds in the pack and have them play manually
you mean in resourcepack?
yeah
well but I need to modify the sounds dependant on server-side information
so static modifications don't fit for me
Minecraft has 3 different packets for playing sounds...
do this
u can modify most of minecraft sounds using it
basically blanket disable all sounds and then manually play only the sounds you want
I tried hooking those
like half of the effects weren't affected
I want the sounds to be hearable, I am basically adjusting the volume of individual sounds based on some additional information
yeah because of what emily said
but all of the sounds may be affected
The resource pack trick is really your only option for those remaining ones... ig
https://imgur.com/a/QboaPqG Isn't the logic backwards? From what I understand, if the sender has permission and sends a message with a click_action, then anyone who reads the message and clicks will execute that command. But if the admin has permission, shouldn't it be the other way around?
wdym? It says "allowByDefault", looks good to me. Except for the fact that permissions already have "by default" builtin
oh now I see it. Yeah it's indeed inversed
The inside of the if/else blocks should be other way around, yes
What I understood was that if the sender has a permission, when they send messages they cannot send click hovers, etc
exactly
as a quick you could "reverse" the permission, e.g. give it to default group, and deny it for admin group
yeah all husk plugins are kinda dead, they're only held together by community PRs
I'm using husk homes and husk sync
they are good right?
Not really. HuskSync used to crash our farmworlds once in a time until I submitted a PR. map sync is also still broken, I'll make a PR for that soon
shit
Oh and attributes like max health are also not properly synced, I got an open PR about that
HuskHomes idk, never used it
Do you think that synchronizing them isn't the best approach?
Or they just made a mistake
They should definitely be synced, it's just that the implementation was bad
But I mean, the way they synchronize data between servers, do you think that's a good approach?
https://github.com/WiIIiam278/HuskSync/pull/650
oh looks like it got merged, nice
Please do this đ
dupes đŻ
yeah I'll do that on monday I guess
alr thanks
dupes seem to have been fixed by someone else's PR
But the approach they use to synchronize data between servers, do you think they do it well?
This is the PR that fixed dupe bugs https://github.com/WiIIiam278/HuskSync/pull/614
yeah in general it's a good plugin
the only issue is that important issues kinda stay ignored for months until somebody else fixes them
i see
qq if i store data in a shulkerbox pdc, does it get transmitted to any player opening it/picking it up?
I don't think it'll automatically transfer to the block when placed
Type parameter is being used within permitted classes
so why its being flagged as not used
tested this a while ago; duplicated itself somehow
its used for switch pattern matching
na just means it isnt used in said class anywhere (and u could hypothetically be able to omit it and just define type constructors on the subtypes)
been a thing for a very long time
and u could hypothetically be able to omit it and just define type constructors on the subtypes
wdym? if you omit it, then you cant pattern match against generic type parameters
final var result = Password.fromString("dovidas");
if (result instanceof ValidationSuccessResult<Password, CharSequence> success) {
success.value()
}
this wont work if you omit generic params from the result class
and if you add them it allows even if they're different classes (i guess sealed classes infer that information, very neat)
its kinda misleading that those parameters are greyed out even if they're kinda used by classes
i love this feature
your example would be much better if you didn't use var here
since it completely depends on result being of a type with type parameters A and B, and your switch case pattern having a type that extends that type with matching type parameters
it's not about sealed classes specifically, this works with any class hierarchy with passed-down type parameters
e.g. it's safe to cast Collection<String> to List<String>
actually i can omit generic type parameters if i use destructuring of record
final var result = Password.fromString("dovidas");
if (result instanceof ValidationSuccessResult(Password password)) {
System.out.println(password.asString());
} else {
System.out.println(result);
}
because List<T> extends Collection<T>
meaning the type parameter can already be inferred from the type you're casting
arent generic type parameters erased at runtime?
sometimes this might not work though, especially with upcasting
and it sees that List<T> extends Collection<T>
and it sees that the T's are the same
and therefore it decides that since T is already known at compile time and the bounds are the same, it boils down to just a regular runtime cast where the type parameter can be ignored
it's still "unsafe" and "unchecked" in the sense that if you use evil hacks to put an Integer in your Collection<String>, it won't throw a classcast exception when you try casting the collection to List<String>
but that's just how all typed shit works
i think i changed my mind about lombok tbh
maybe its kinda ok to use it, since then you dont have to worry of breaking something later on with getters or object equality
less code = stable code
iguess
because historically we didn't really program against a DOP approach, but yes for phantom types its fine
there are certain annot libs that u ideally wna use to annotate said type params to communicate its a phantom type
(that will also make that warning go away)
but also you may be able to at runtime verify and/or perform casts on type constructions before that instanceof branch depending on how fromString is type parameterized
<Password,CharSequence>fromString(...) for example
pov i just realized you can have format on save on intellij
i missed that from vscode
nice to see that intellij has it
it would be nice if it would arrange annotations too
maybe the format code options are in a separate place
IJ does have a lot of format options
is it just me or intellij doesnt seem to work properly with github organizations
i get push errors
but when i use CLI it works flawlessly
repository not found
means either it doesn't exist or you don't have access to it
yea but why does cli work
you've set up auth for it
you need to configure a token into intellj itself in the "github users" section
dunno, i don't think it does
it's always asked for either login credentials or a token for me
you just generate them once and then that's it lol
ubuntu@sigma:~/ansible$ cat ssh_keys.yml
---
- name: Manage SSH authorized_keys
hosts: all
become: true
gather_facts: false
vars_files:
- group_vars/all/ssh_access.yml
tasks:
- name: system -> ubuntu @ all
ansible.builtin.authorized_key:
user: ubuntu
key: "{{ item }}"
state: present
manage_dir: true
loop: "{{ ssh_access.system | default([]) }}"
- name: system -> mc @ mc
ansible.builtin.authorized_key:
user: mc
key: "{{ item }}"
state: present
manage_dir: true
loop: "{{ ssh_access.system | default([]) }}"
when: "'mc' in group_names"
- name: admin -> ubuntu @ all
ansible.builtin.authorized_key:
user: ubuntu
key: "{{ item }}"
state: present
manage_dir: true
loop: "{{ ssh_access.admin | default([]) }}"
- name: admin -> mc @ mc
ansible.builtin.authorized_key:
user: mc
key: "{{ item }}"
state: present
manage_dir: true
loop: "{{ ssh_access.admin | default([]) }}"
when: "'mc' in group_names"
- name: operator -> mc @ mc
ansible.builtin.authorized_key:
user: mc
key: "{{ item }}"
state: present
manage_dir: true
loop: "{{ ssh_access.operator | default([]) }}"
when: "'mc' in group_names"
- name: dev -> mc @ dev
ansible.builtin.authorized_key:
user: mc
key: "{{ item }}"
state: present
manage_dir: true
loop: "{{ ssh_access.dev | default([]) }}"
when: "'dev' in group_names"
ubuntu@sigma:~/ansible$
not the most perfekt playbook, but better than nothing
looks like github's workflow config
Looks painful is what it looks like
ah yes
java' ahhh gui
we're speedrunning epilepsy seizures with this one
this is why we need native wayland support on Java
Hi, what event do I need to hook to track arrow entity movement (shot by player)? There is EntityMoveEvent but I think it only track LivingEntity which arrow is not. Thanks
Will spigot be ditching it's custom names/mappings in favor of mojang names for 26.1?
I really hope so. It'll make developing for Paper & Spigot much easier if they are both using the same NMS names.
When I type /rtp, I'm teleported to a pre-generated chunk, but the processor usage jumps to 30%. Aren't those values ââhigh? My CPU is an i5-13500
how many attempts
to /rtp
Running the client on that pc too?
Also how are you measuring that
Like you really should take a look at timings instead
30% of one core?
you do realize your cpu has 14 cores right?
14? Thatâs an odd amount
6 performant cores and 8 efficient cores
i was about to say, im guessing its P and E cores
I have 8 cores and 16 threads
wassup nerrrds
this is normal, chunk loading is also very expensive
if you want more details, profile it with spark
"cpu goes up" is not a very good benchmark of anything
indeed, considering cpu goes up when anything is processing
Plus, is the entire area pregenerated or only the single chunk you teleport into?
Otherwise the game still needs to generate chunks around it up to the view distance
from what we talked last time, the idea is to pregenerate the whole area up to like 8 chunks away or so
Well, is the view distance > 8 :p
could be, iirc he has some kind of per-player viewdistance thing where it could be arbitrarily far for some players, and we ended up at 8 chunks being a good compromise between overpreparation and being prepared enough
Clearly we need chunky but it slowly pre-generates the world as people play
yeah
no. the client is on my pc
and the server is on my dedicated server
am i blind? i can't seem to see the protocol for older versions https://minecraft.wiki/w/Java_Edition_protocol
just 1
i5-13500 have a very good single core performance
the single core performance is better than i9-9900k for example
https://minecraft.wiki/w/Minecraft_Wiki:Projects/wiki.vg_merge/Protocol_History is this everything?
and its the same price
no
yeah prolly its i5-13500HX or H
Im asking how many attempts it takes for plugin
what is max attempt set
u can see in config
13000 series cpus? Pfft
view-distance is 10
is this bad?
nah its latest..
They made their own rtp with pre cached locations
So it doesnât need multiple attempts
oh isee
didnt saw propely then
The RTP plugin is mine. The plugin checks at each tick if the buffer size has space for a location (by default the buffer stores 100 valid locations) - in this case, since the buffer is full, the overhead of the /rtp I'm talking about is only to load chunks and perhaps generate chunks to fill the buffer since it was emptied (generate partially because the generation is not done completely)
MSPT also went up to 41.9
uhmm..
I mean itâll still have to generate extra chunks up to the view distance of 10
If you load chunks on the main thread it will always spike your CPU... Push it to the background threads...
Plus it has to load all the chunks
yea
This is inevitable
You could pregen the extra 2 chunk radius and see if it makes much difference
What you can do is load chunks async, but the loading is still done on the main thread
alr i'll test
Though seeing as the mspt stays below 50 it seems to be doing fine
But 40 is close to 50
you use world.getChunkAtAsync() to handle the chunk loading and generation for your buffer on the worker threads....
How can I do this with Spark? Do I type spark profiler stop right after typing /rtp just once?
Chunk loading is still done on the main thread no?
Start it (on all threads) rtp, stop it, link the report here
I think moonrise can load chunks fully async
Donât quote me on that though
(Moonrise is the chunk system paper uses)
no
In modern PaperMC...the heavy computing for chunk generation (terrain math) and chunk loading (reading from disk) happens on background worker threads...
wdym on all threads? how can i do that?
I use getChunkAtChunk and even then the mspt goes up to 40
The default 5ms interval is useless
I mean, itâs below 50 so it really doesnât matter
You load the single chunk you are teleporting to async, and the scheduler likely handles loading the rest while trying to keep the mspt under 50
You don't want your baseline at 0 players be 40mspt
I mean, the game suddenly has to load what, 400 chunks
ur using .get() or .join() right after calling the chunk?
Let's see a spark profile, anything without a profiler report is useless guesswork
If there is a sync load or if the scheduler is working as intended, the report will reveal all
If you see the mspt spike over 50 then Iâd be concerned, but it getting close to 50 likely means the chunk system is using as much extra time as it can each tick without dropping the tps
No. I'm not doing that
i'll do the spark profile
Itâs a shame vanilla canât do fully async generation and loading
It shouldnât be too hard to do all the work on separate threads and then just push the final chunk into the chunk map
Spark profile is def good here.. let us know what profile shows
lol.. If two background threads try to update the exact same chunk border at the exact same millisecon.. the server crashes
true multithreading projects like folia took years....
https://spark.lucko.me/sY9OB84dZ9 /spark profiler start --thread * --interval 0.1
I did it this way. The MSPT is high because it was during server initialization
I typed that command after server had finished initialization, but for some reason the startup mspt appears
Wait for a while forthe jit and other shit to warm up
I had waited for the MSPT to went down and the CPU usage to drop to 0%, but yes, I'll do it again
It still hasn't gone down xd
MSPT went up to 100 this time
use.. /spark profiler start --clear then /rtp then immediately /spark profiler stop
can I do that? /spark profiler start --thread * --interval 0.1 --clear
go with /spark profiler start --clear
can't wait to test this out đ
the main thread is 100% getting blocked ig.
Int Spark link, open up the Server thread drop down and just follow the highest percentagas
MSPT is still at 105, but now it has increased to 33 https://spark.lucko.me/WHTUhHt7cW
and CPU usage went up to 20% (it was previously at 0%)
Sometimes CPU usage goes up to 30%, and MSPT once went up to 105, as I showed in the other Spark profile
A spike to 105 MSPT means the main thread totally froze for over 2 ticks lol...
expand the Server thread at the top, and just follow the highest percentage numbers down the tree...
Its almost hasto be a method like getChunkAt() or similar loops or a block checking loop that is forcing the main thread to do the work..
could also use the --ticks-over flag to only record the lagging ticks
^^
I'm not blocking getChunkAtAsync or anything
Autocomplete doesn't have that
this isn't with --thread *
this only shows the main thread
https://spark.lucko.me/CnJOytFPLh see this
it's --only-ticks-over iirc
https://spark.lucko.me/ZTdR4oVxlt i did /spark tps and just showed mspt on 30 (not on 103)
And why did the MSPT increased to 100?
it didn't, not on average at least, that was a spike; there's no way to know whether it was related
if you're trying to profile mspt spikes, use the --only-ticks-over parameter
just this paramter or with the other ones?
with the other ones
only increased to 26 MSPT and 23% cpu usage
from what I have seen on /spark tps
but profile is sayying max MSPT is 86
god only knows what it's doing
i think the numbers are just fucked
spark says the highest tick time was 80ms
and has recorded one tick exceeding the 25ms threshold
but for that one tick, it only has 9ms worth of samples for the main thread
either way, it doesn't seem to be directly caused by anything your plugin is doing; at worst it's the scheduler
let's see your rtp code again and see what you actually do when a player teleports; do you just player.teleportAsync?
I don't really think you're lagging
The server is probably running perfectly fine
The high tick can happen right after startup
if he's doing what we're telling him to do, the profiler is only on for when he does /rtp specifically
so it wouldn't include startup ticks
Guys
and the server is of course running fine since from what i see it's a test server with like one player on
What should I code?
the question is whether this will make that 80mspt spike go up to 200mspt on a production server
have u considered fking around and finding out
alternative suggestion: look at the packet class in a Fabric or Forge decompiled project workspace
or Spigot even if ur working on the server
altho most if not all of those packets are shared code between platforms (client/server) iirc
yes of course
1 second
saving this website
these are all for finding the rtp pos, no? where's the code that teleports you to it; that's what we're benchmarking here
oh yes mybad
looks fine, it's pretty much just teleportAsync
what might be happening is the mspt spiking because there's a vacancy in the buffer and your rtp finding logic kicks in
to benchmark that you'll want to profile the buffer being populated over the course of a longer period of time than just a few ticks
Is it normal for CPU usage to increase to 30%?
I thought that would be cheap work for the i5-13500
impossible to say
but if it really is the rtp finder logic, that will involve lots of world generation
which is very expensive
lots of very expensive things = higher cpu usage
Even so, I have 12 cores. 30% of 12 cores is 3,6 cores
I don't know how I can benchmark buffer filling
Because what's probably causing the high mspt is getChunkAtAsync, etc., and it's not possible to know how long it takes to load the chunk
you let it run without any stops and you spark profile it with --thread *
iirc the default chunkgen thread count is 4, so that checks out
im with default config yea
What I find strange is that if I walk through a map that has never been generated before, the CPU usage stays at 20% and the MSPT at 25
remember my pyramid example
on really mspt reach sometimes 100
generating a bunch of locations faraway from already generated stuff is much more expensive than incrementally expanding an already generated area
oh yea
chunk-system:
io-threads: -1
worker-threads: -1
is this?
maybe, i don't remember
chunk-system: #
io-threads: -1#
Sets the number of threads to be used for read and write operations with chunks. If any value below zero is set, only one thread will be used.
worker-threads: -1#
Sets the number of threads to be used for parallel chunk generation. If a value below zero is set, the server will automatically determine the optimal number of threads based on the available physical CPU cores (not logical cores). For systems with 3 or fewer physical cores, only 1 thread will be used. In all other cases, the number of threads is capped at half of the physical cores.
This doesn't say what happens if I set it to -1. Maybe it's based on the physical cores
oh below zero
So the paper is showing 6 threads since I have 12 cores... maybe it would be better to use something like 3 threads
I think half is too much
doesn't really matter if you have enough compute on your machine
I want CPU for the other servers
Is someone really good at coding I need help with a plugin i've made
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
oh yeah, 100%, im totally the greatest
for legal reasons- dont quote me on that
I can't just tell the exact problemo, because it's an private plugin i've been working on since days and I just need help with an bug I can't get away
If I have a registered event handler for BlockBreakEvent, and call player.breakBlock(block), will the event handler finish executing before player.breakBlock(block); finishes?
Also, can multiple BlockBreakEvents be fired when I call player.breakBlock(block) in the case of a player breaking a cactus or scaffolding, where there is a cascading effect?
yes and yes
thank you
however i'm not certain if that happens with cactus specifically
some plants break a tick later
others break instantly
or cactus, i'd tryitandsee
For the ones that break instantly, will the cascading BlockBreakEvents be cancelled if the source/triggering BlockBreakEvent is cancelled?
they won't fire to begin with if you cancel the initial blockbreakevent, as the "side effects" are calculated after the event completes
If you can't tell us the problem... how are we going to help you
that makes sense, thank you
I can tell the problem in dm, because here it would be too much and complex to explain
I mean it would be the same amount of info to explain here and in dm
i don't know if anybody here is particularly interested in doing stuff in dm's
You're likely going to get better help from multiple people by just asking here
I don't think anyone is going to try and steal this genius award-winning private plugin idea if it's so coveted
^
We're devs. We can just join the server for like a few minutes and go off that
your code is useless to us lol
^ Can almost guarantee their idea was already done too lol
question, how do you check the content length of a packet?
i use this approach
i put it into a temp bytebuffer and read the bytes, send that and then append buffer to out
unless you have a way to calculate it ahead of time, this is an alright way of doing it
true
a hack i like to do is write 5 zero bytes to the buffer where the length varint is going to be, then write the contents, and then go back and write the varint over those 5 bytes
hello, i need a free minecraft config developer for my minecraft server. i am searching since 2 months now and i really need help. if anyone can help me please contact me
lol
ARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.google.common.util.concurrent.Abs
tractFuture$UnsafeAtomicHelper (file:/root/minecraft/proxy/velocity.jar)
WARNING: Please consider reporting this to the maintainers of class com.google.common.util.concurren
t.AbstractFuture$UnsafeAtomicHelper
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
how can I fix this?
I'm using java 25
its just a warning, u can ignore it for now
this graph confuses me
What makes it terminally deprecated
i'm gonna assume:
length of compressed
length of decompressed
packet id
packet data
the first varint is the length of the packet on the wire
the second varint is the length of the uncompressed packet data
so like i said
and apply compress/decompress if size of the compressed is bigger than the threshold i have from a previous packet sent by the server
apply decompression if the second number != 0
hm?
see the last column of the 5th row
0 to indicate uncompressed
second number is 0 iff the data is not compressed
yeah so instead of decompressed length no?
if it's compressed, then the second number is the uncompressed length
the first number is used to determine how much to read from the wire
yeah that i got
the second number is used to determine how large of a buffer needs to get allocated for the uncompressed data; if it's zero, the first number is used instead
well, minus 1 byte since the 0 data length varint isn't part of it
is the uncompressed length varint compressed too?
it doesn't feel like it at least
i think i get it
they drew the line wrong
these 2 always are uncompressed and trigger for both sizes
okay, i'm done
time to test
nope
something is wrong
i think the first varint can become 0
no it's correct
it can't be because you don't know whether the data is compressed or not until you read it, so you can only assume it to be uncompressed
all bytes following the second number are going to be compressed iff the second number != 0
otherwise, they're all uncompressed
import java.io.*;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.util.Arrays;
public class TcpReceiver {
public static byte[] receiveData(Socket socket) throws IOException {
InputStream is = socket.getInputStream();
// 1. Read the 4-byte length header
byte[] lengthBytes = new byte[4];
int bytesRead = is.read(lengthBytes);
if (bytesRead != 4) {
// Handle error: unexpected stream termination
throw new IOException("Failed to read complete length header");
}
// 2. Convert the byte array to an integer to get the expected payload size
int expectedLength = ByteBuffer.wrap(lengthBytes).getInt();
// 3. Read the rest of the data into a buffer
byte[] data = new byte[expectedLength];
int totalBytesRead = 0;
while (totalBytesRead < expectedLength) {
bytesRead = is.read(data, totalBytesRead, expectedLength - totalBytesRead);
if (bytesRead == -1) {
// Handle error: stream ended prematurely
throw new IOException("Stream ended before all data was received");
}
totalBytesRead += bytesRead;
}
return data;
}
}
this assumes the packet follows the typical standard of putting the length of data in the beginning of the packet
ik that's for fr33style, but it's insightful for a project i had also began with networking, thanks
well this could've been a gelah instead of a table tbf
at least it helped someone lol
one of the things I like about Java is handling packets is quite easy
convinced me that i should, in fact, probably append my packets data length to its header spec
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.io.IOException;
public class UdpReceiver {
public static void main(String[] args) {
try {
DatagramSocket ds = new DatagramSocket(12345); // Listen on port 12345
byte[] buffer = new byte[1024]; // Pre-allocate a buffer
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
ds.receive(packet); // This method blocks until a packet is received
// Get the actual length of the received data
int actualLength = packet.getLength();
System.out.println("Received packet length: " + actualLength + " bytes");
// Access the actual data using the offset and length
byte[] actualData = new byte[actualLength];
System.arraycopy(packet.getData(), packet.getOffset(), actualData, 0, actualLength);
// Note: A simpler way to get the data as a new array is:
// byte[] actualData = Arrays.copyOf(packet.getData(), packet.getLength());
ds.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Here is for UDP to compliment the TCP version
now howd you know i was working with UDP đ¤¨
im still at the spec-ing stage really so and dealing with the potential for adding packet fragmentation to allow for larger transfers of data
and peer management
kinda just recreating ENet i guess but worse
don't worry about packet fragmentation. Just worry about the size of what a packet could be and try to fit your data in that. network stuff will handle fragmenting packets automatically
1500 bytes is typically the standard on most networking equipment before it will start chopping packets automatically
yes, for now im making sure that i dont cross like a 1024 byte threshold on the arbitrary data length, and the header is only a few more bytes rn
so staying well under 1500mtu
this is where compression comes in handy, because if you are at 1600 bytes you could use compression to bring it below 1500 so it stays as a single packet. Network stuff will pad out packets to their max length hence compression is not handy for anything below that
ill look into it this evening potentially
here in the next decade we probably won't need compression anymore
and will start to become a thing of the past lol
since you are working with UDP, make sure you are listening for these packets on a different thread from the main, because the method to listen for UDP blocks
just so you don't accidentally start blocking your main thread lol
i think id have to do a separate thread regardless of udp or tcp no?
accept() just blocks for both iirc
there is something with NIO DatagramChannel that i believe lets u accept() non-blocking though
but processing networking on separate thread was my plan anyway
TCP doesn't always block
it will block, on sending or if connection has not been established
the sending only blocks if the queue or buffer is full
tcp is a stream if that helps because a connection has to be established. UDP no connection is established and packets are just sent to the destination.
ye
Right now i'm trying to emulate the minecraft protocol
You could look at Minestom for how they decode packets
I kinda got it
I just need to fix the packet decompression
The rest is just looking into protocol wiki api
The decompression logic is wrong and it's stuck at registry data
I see
I'll fix it when i get to pc
đĽł
took way too many classes to do it
keep alive, teleport and send message/execute command packets left
teleport done
this is amazing
it's not even that hard to do đ
waow :3
this is out of date
yeah
is it 21?
in hex?
just fyi, an id of 21 would mask bits 0,2,4
and ignores 1,3,4,6,7
got to love bitmasking
i'll check the source of the server for the id
1.7 â 1.8 â 0x00
1.21 â 1.21.1 â 0x26
1.21.2 â 1.21.4 â 0x27
1.21.5 â 1.21.7 â 0x26
1.21.9+ â 0x2B
make it up to date... its a wiki.. smh
well yeah of course, after i find the correct value
nvm
that's player loaded
which is correct in the wiki
wait
maybe i have to send the keep alive
nope, the sv
both client and server send keep alives
well what I sent is up to date and confirmed
oh i think i got it
keep alive is part of configuration
the id is correct
but i have to set to configuration protocols
okay, i found the packet to switch strategy back to configuration
jeez, this is gonna end me
good thing i had the protocols stage implemented
doesn't the data generator include packet IDs?
or, it used to and it no longer does? i can't remember which one it was
no it doesn't
i'm confused on one thing
both configuration and play have keep alive packets added
it does generate them
I'm certain it does
./generated/reports/packets.json
yeah
hmm
p neat
where's this?
the data generator
you need the --reports flag
https://minecraft.wiki/w/Tutorial:Running_the_data_generator
java -DbundlerMainClass=net.minecraft.data.Main -jar server.jar --reports
oh sick
hmm
i managed to get these actually
but they aren't called not sure why
43 and 27
i substracted start from end
. which leads me back to this
neither 0x04 nor 0x1B is called
and nor a start configuration packet is sent that switches to configuration
i might've missed something else
wait nvm
i should really try to utilize records more
wtf
and 1B for serverbound
this is such yandere dev vibes
this is how the id is obtained đ
đ
i didn't know that you can generate the ids
yay
inversed packet id it was
because clientboundkeepalive and serverboundkeepalive have different id
so 2B for clientbound and 1B for serverbound đ
you were right ^
but only for clientbound
indeed, which is why I said both client and server have them
I assumed you wanted the one the server sent
since the one coming from the client is easy to figure out?
you made a client?
anyways, both I suppose were easy to figure out if you just tossed up wireshark on 127.0.0.1 and bounded the client and server to the loopback as well
i just join a player to a server and make him say stuff or execute commands
wouldn't it all be a byte mess?
disable compression and security as well would remove a bunch more stuff as well
wireshark can inspect packets
i just have this nice hook
more so if there is no encryption which you can disable
it does the uncompression and everything
you can just disable compression on the server
well, i just have it already with the sys out đ
i don't need wire shark if i have it built in and picking packet id specifically
guess you know for future reference that you can just remove a bunch of clutter in terms of debugging packets
wireshark in this instance would allow you to see what both are sending and receiving at the same time
since both client and server can be ran on the same system and bounded to the loopback, it removes any outside interference. More so if we are disabling online mode and compression
We love type erasure
We also love runtime exceptions with immutable collections instead of separate interface contract without add() methods
i wonder is there any lib which provides java's collection but with immutability in mind at compile time?
Not really. Only library I've used that does immutability well was JOML
They have read-only parent types
Jetbrains annotations do have @Unmodifiable and @UnmodifiableView though which help a little
Java's collections with immutability at compile time
that is called kotlin
Touche
kotlin feels like c++ to me. language crammed full of syntax sugar features which can be used to easily shoot yourself to the foot
all i want is bug prone type safety with java's explicit syntax
also we love how you cant use generics with exceptions
sure you can, it just doesn't work very well
checker's framework allows u to write various proofs for ur java programs
non-nullability and immutability proofs
basically at compile time
i havent seen good ide support for it
but i dont know a single person who likes checkers, people only use it if they are forced to lol
the ide support is decent
but it can be slow at times since it deals with its own generation
either way, there are decent tools for this; that is prove correctness in different aspects, just that nobody likes to use them because they often become a distraction to most people who just wanna write and create things
this is also quite contradictory, there will be parts of ur program where u have to do runtime evaluations, java is still an imperative language
if u want to reason about types in higher order, use kotlin, or even better, move to a functional language
there are only a few cases where i'd want more robust statical analysis, and that's mostly for very complicated threading stuff, which doesn't seem to exist for java
project valhalla tries to fix this tho
still praying for native non null type support
fix is the wrong choice of word
i don't like any of the proposed approaches
generics are already a mess, adding a second dimension of nullability to it is going to make it even worse
value types come with weird nonsensical limitations that bleed out into reference types
every day you complain about java yet refuse to use anything else beyond judging the book by its cover
I wonder
is java really the best solution to your problems out there and yet falls so short?
I'm not complaining im just questioning it. There's not a single programming language that's perfect
long live yaml
but either way, you don't seem to be looking for perfection though dovidas, rather total correctness in ur programs, and there are very good languages that allow you to elegantly reason about/prove correctness if that's what you're after, java is not one of them
I must say your criticisms about java are very valid
but that is kind of the problem, java is not the solution you are actually looking for, those exist elsewhere and are quite elegant
Itâs called assembly
?paste
Looking to paste something? Try a code block or one of the following websites:
- https://pastes.dev/
- https://sourceb.in/
- https://mclo.gs/ (best for server logs)
okay, i managed to read the text directly from nbt for my bot
đ
i don't need adventure api
almost done
bot creator for 1.21.11 works perfectly
just nbt and netty as dependencies
does anyone know if i have to do anything else to support batching?
i miss a chat packet for some reason
i think i got it đ
yeah perfect
it was an issue with the the compression
not a bundling thing
this took way too long đ
but it works perfectly
Will this go opensource?
yeah
Allows you to join bots onto your server for testing purposes - Fr33styler/BotCreator
it'll come here
right now it's using mcprotocollib
but i can only support a version at a time with it
hence why i wanted to go full custom
nice
for whatever reason all the projects doing this are in javascript or god forbid python
it'll be good to have one written in java for better integration with plugins
i blame mineflayer
couldve used this a few days ago lowk
lol
it's really cool, i use it to test minigames đ
i wouldn't mind shading it into my ai moderator plugin to fuck with players some more
i've been planning on something such as this for a while, but creating a headless client has always been too much effort for me
it's still very basic
i hope you don't mind đ
I'll make a bot-creator-api package and a bot-creator-gui
i'll make sure to upload it to jitpack
Hi, is there any ready-to-use spigot api that get an equivalent spawn egg from EntityType or I have to map it manually? Thanks.
did anything change with nms? cant seem to get the mojang mappings from the repo
or is this the wrong version
There's no mappings anymore, Mojang stopped obfuscation
would it now just be mojang instead of remapped-mojang?
It would be nothing
Neither. Just compile spigot, use org.spigot:spigot and don't include it in your compiled jar
wait does this mean nms users dont necessarily need to update every release any more??
my lord about time
Not 100% of the time but yea, mostly the case
that's so convenient, i didnt realize the deobfuscation would impact me
It is convenient enough i've bumped my lowest supported version to 26.1 kekw
No obf doesn't fix Mojang doing breaking changes on minor releases
So for the most part you will ideally maintain NMS for all versions
... that you wanna support
Yea, but in this case it's just checking if a certain method or class exists.
Which is already done for regular multi-version support lol
No need to multi-module or anything of the sort for 26.1+
now im running into a different issue that i didn't before
Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.15.0:compile failed: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.15.0 or one of its dependencies could not be resolved
Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.codehaus.plexus:plexus-java:jar:1.5.2 has not been downloaded from it before.
i don't use plexus and i'm not in offline mode
search results didn't explain the issue very far, anyone know what could be going on?
not a spigot issue, but share your pom
sorry, i thought we could come here with development issues of any kind
any specific pom? i have a lot of modules
?paste
Looking to paste something? Try a code block or one of the following websites:
- https://pastes.dev/
- https://sourceb.in/
- https://mclo.gs/ (best for server logs)
try running maven again with -U ?
same result
are you using intelliJ?
yes
-go to File -settings -on search box top left type 'maven'. -click on maven option -see if work offline box is checked. if yes then uncheck it
i did check that, its not checked
ok then try this
go to C:\Users\(windows user here)\.m2
delete
maven-metadata*.xml and _*.repositories
i should delete the repositories folder?
there's no maven-metadata though
uh rather this is what i got
they are probably hidden
on the top go to view and there should be somewhere where you can have it show hidden files
i have that checked
interesting it must be in intelliJ directory somewhere then
i believe maven is packaged in with intellij right? i dont think i ever really directly installed it
It should be yes
you can try clearing the repository directory if you want too
if you don't want to delete you can just move it to somewhere else
i can rename the folder rq see if that works
that should work too
what do you use? eclipse?
Netbeans
ok so manually inserting the dependencies it complained about fixed the problem
love it when intellij is being quirky
lol
right so now im wondering if you guys think this is a bukkit bug or not
i'm iterating through a server's recipes with Server#recipeIterator() and at some point during an iterator.next() call an error is thrown saying that a method DyeRecipe#toBukkitRecipe() was called and is abstract
i look at DyeRecipe and see no implementation of toBukkitRecipe() in it or its super classes (DyeRecipe extends NormalCraftingRecipe which implements CraftingRecipe which extends Recipe<CraftingInput>). Recipe<CraftingInput> defines a method toBukkitRecipe() but this is not implemented in any of those classes resulting in the following error
basically im asking if this is anything i can fix because i dont see this being an issue of my plugin
DyeRecipe i believe is new in 26.1?
cool cool
why is it not allowed to cast List<Integer> -> List<String> or whatever BUT List<Integer> -> List<?> -> List<String> works
it works but it's unsafe and will cause things to explode at runtime
this is basically the generics version of casting Integer to Object and then to String
it works, but you have to tell the compiler "trust me bro" in the Object -> String step
runtime however will not only trust but also verify, and it will blow up with a ClassCastException
One of the most C-like things you can do in Java. Forcing a cast that makes no sense 
but because of type erasure, this (runtime exception) won't happen when you cast the collection; only once you try taking a String out of it and it gives you an Integer
then why is the first way not allowed?
should learn about generics and type erasure
because it won't work
the second way also won't work
because one is checked at compile time and the other at runtime
but you are bypassing the type system to trick the compiler into letting you do it
therefore anything checked at runtime will allow you to compile even if it will not work
ah okay
List<Integer> intList = new ArrayList<>();
List<String> stringList = (casting to List<? then to List<String>)```
but wont it work if the list is empty and we will lose the first refference so no one will do intList.add(1) and then try to stringList.get()
yes
it's the same object and the runtime won't know the difference
yeah okay thankss
because of type erasure, the runtime will only do the cast when you get() from it
Integer i = coll.get(0) will blow up if the 0th item in coll is actually a String and not an Integer
yeah
so it will "work" but only if you don't use generics for what they're supposed to be used for
an interesting case in theory but not something you should end up doing in practice
yeah, i mean for making serialization library its kinda tricky and i think ill need to trust other methods (which are written by me) that they return the right type , and cant really verify it
yeah i will
Should I add an API to my plugin? it backports Sulfur Cubes, which aren't even out yet to 1.8, I see it creates many possibilities for endless mini-games, but because I coded in such a way for high performance, a custom Bukkit event for example may cause performance issues
You'll be fine. But really...? lol
what's a sulfur cube
to be released entity
1.8 players will go to such great lengths to use a vanilla feature that was added 10 years in the future
They must be impatient as hell lol
or that
is that one of the 100 useless dumb baby mobs added in 28.135 or whatever the current version scheme is
Nah, it's actually useful
26.1, but no, this will be a 26.2 feature
Its actually useful as
A sulfur cube is a passive mob that spawns only in sulfur caves and has the ability to absorb full blocks. When a sulfur cube has a block absorbed, it does not take damage from player attacks and can be launched like the block it absorbed based on its unique properties.
That's why I made a plugin for it in 1.8
Depending on the absorbed block, the sulfur cube will have different properties when hit. Properties that are known so far include:
Material Effect
Ice Slippery
(Low friction)
Logs Bouncy
(Low gravity)
Wool Light
(Low gravity, low fall speed)
Iron Block Heavy
(High gravity, high fall speed)
Stone Stays Low
(Little to no bounce)
it's a football?
Literally didn't have to backport it, not that it's a proper backport anyways. Not like the code's gonna be the same lol
But the thing is I used SoA ECS (contiguous memory to increase cpu cache hits and auto-vectorization from JIT) so an OOP event will slow it down
you put a block in it and kick it around?
That sounds like a you problem. We're not gonna help you
more or less, yea.
lol
And Bukkit just creates new objects every tick, thus increasing stuttering and slowdowns
Skill issue
iunno man
you'll have to figure it out yourself, or wait for the entity to release & backport it then
we're not gonna help you regardless lol
i don't know if you need to reimplement the football mob in assembly with 512 bit wide vectorized collision physics
either way, if you're worried about performance, you know what they say
benchmark it or go home
^
in regards to your event question, tryitandsee and benchmark it
my other plugin which backports bubble columns, can create millions of them and still only use 3.5ms of a tick
We're not gonna bother helping. You're on your own.
We can't even tell you if your backport is as efficient as the modern code lol
And you know this how? The mob ain't even released yet
Damn we got a time traveler fr fr
bubble columns are literally water, no? same physics as with flowing water; entities check if they're in water, if it has an impulse, and then applies that impulse to the mob
you can have a world entirely made of bubble columns and it won't make a difference
Probably talking about the particles
Because Minecraft's codebase is OOP, they don't use arrays but create super classes that also increase indirection
okay and?
It's slow
skill issue on your part
That's why it is so stuttery
remake minecraft from scratch then
lol
I did
no, not at all
meh
but
the server performing poorly is definitely not caused by "oop indirection"
that might be like 0.1% of it (moreso in the renderer perhaps) but not at all measurably significant
you're getting a bit lost in the weeds here
If you keep creating objects per tick, the GC has to clean hundreds of thousands to millions of objects scattered in the heap
thus it uses up cpu time to do so
yes, and that's exactly what it was built to do
and slows the game/server
we have things like gzgc nowadays
where95% of the work happens off the business threads
and generational garbage collectors explicitly target the problem of short lived, frequent allocations
You're stuck on 1.8 & backporting. It's gonna be worse for you as you're missing many optimizations and rewrites lol
Yes they did improve the code but the Entity class is still one giant class
doesn't really mean anything performance wise
It's hard for them to rewrite
inheritance vs composition
It isn't but it's not the most optimal
They don't need most optimal lol
not to mention that you're invariably going to have a massive amount of indirection in the engine regardless of paradigm, especially in a sandbox game where the terrain is liable to change
You want it, but they don't need it
they do when its the largest game and continuous complaining of performance
Vulkan is not going to magically fix it
And i doubt rewriting the entity system to be ECS will either
they're working with decades of poorly written code lol
And if they're not already doing so, using MultiDrawIndirect in OpenGL that's already 99% of Vulkan
myeah i don't really see the idea behind the vulkan switch
macos
Yes but ECS means easier and faster updates
and yes the renderer is terrible and there are many many things that could be done to improve it
OpenGL's getting deprecated or something iirc
Yes stupid apple
Sounds like they're not having issues with updates with how things currently are lol
mactoids can go pound sand
they just refuse to let opengl 4.3 which has mdi run on their devices
Pretty sure a multi-billion $ company with decades of experience knows what they're doing lol
well
Walled-garden
they certainly do
but the suits up top are telling them to make 1000 useless baby mobs per version
If they thought ECS was worth doing, they'd be working towards that
probably not worth the rewriting effort
yes yes I know
exactly, so it's not worth bringing up lol
but obviously they know the performance gains
from ecs? there are none
Irrelevant as well, as it's also a completely different programming language too lol
It's not worth comparing unless it was more 1:1
they don't care about performance anyhow, just look at the new Brain vs the old ai goals system
Depends, Array of Structures, not really much performance gains, but a sparse and dense set (SoA) adds heaps of performance
what they're optimizing for is ease of maintenance and the ability to shit out 1000 baby mobs per version
nonsense, has nothing to do with rewriting entities/blocks to run as ecs
I'm like 99% sure Enium heard something and never bothered actually doing massive benchmarks with different implementations
It's not nonsense, I use it in my game engine, it uses like 1% of the cpu
have you ever even looked at a spark report
"ruh roh memory locality" is not the issue here
Explain the frequent stuttering then
define stuttering
frequent pauses in frames
are we talking about the client or the server; the tick loop or the rendering pipeline?
im talking about the client right now
if you're talking about the rendering pipeline, it stutters because it's fucking shit
ECS & How minecraft are doing it both have their pros & cons.
It's not worth switching unless the difference of switching to ECS is worth it, which so far it does not seem that way.
Hell, I wouldn't even have issues updating Minecraft with new things
there are a million and one things you could do to improve the rendering pipeline
many of them aren't even major changes
just look at shit like sodium
It's not the rendering pipeline, as minecraft grew, more and more objects are created
throwing ecs at it is like the least relevant proposition possible
on 1.8 it runs smooth, not much stuttering, on the latest version it runs like shit
"muh objects" no, that's not relevant
What even is a good AI impl for what they need?
^ Modern PCs are fast af yo
have you profiled the garbage collector, my guy?
have you even tried anything other than g1gc?
This is the same mindset as "let's just slap on DLSS" and pray it runs well
gasp, a game gets more computationally expensive as it adds more features!
No, sounds like vcs2 just has more experience than you lol
although since you're on 1.8 i bet you're still running the psgc đ¤Ą
Minecraft's allocation rate is 150 MiB/s, my engine is 0.0MiB/s, no stuttering, volumetric clouds, physically-based sky, pbr materials, vsm shadows
The older AI Goal system seems more or less good enough, even for modern games tbf đ¤
written in Java 8
allocation-caused stuttering on the cpu end is easily profilable and noticeable, and we have very mature tools and architecture to detect, profile, debug, and resolve them
and no, it's not caused by just spawning a million objects
more objects does not necessarily mean things stutter or even consume much in terms of compute
modern garbage collectors are exceptionally efficient at doing allocations and disposing short-lived objects
Then tell me, why are there no AAA game engines written in Java if memory pressure is not an issue
The only real way to tell if it would make a difference is gasp modifying the client to use ECS and doing benchmarking. Who wants to waste time decompiling & rewriting the client just to do a proper bench mark
so we're goal post moving?
So we agree that object allocation IS an issue
The language doesn't mean much, there are multiple games written in Java
none of them are AAA in visual fidelity
Because they don't need to be AAA in visual fidelity
Not at all
Ugh I give up, keep doing what you're doing
did you know most of netflix's backend is written in java
now what memory pressure does have an impact on is worst-case latency, as older gc's have been stop-the-world, but modern gc's like gzgc are specifically designed to have low pause times
Like.. if Java was the problem, we wouldn't have such major projects using it lol
so it's not from nowhere that things like renderers which are sensitive to worst-case latency might avoid java, but it's also a solved problem
it will work if you design for it and make it work
and no, you don't need ecs or native memory vectorization nonsense for it
I literally created a world firstly with my SoA ECS plugin, placed 1m bubble columns, TPS sat at ~19.98TPS, the plugin consumed 0.35ms of a tick, did the same with real bubble columns (not even 30,000 placed) and MSPT went through the roof at 150MS! the tick took 150% longer
tell me where SoA ECS is not useful
lol
you're comparing apples and oranges here
Now you're saying they're bad
like we've said several times, mojang doesn't optimize for performance
Jesus I am talking to a 10 year old
you optimize for performance
That's relatively new