#help-development
1 messages · Page 1068 of 1
what's the best way to store an inventory into a file?
It's annoying as all he'll
bro
As a list of item stacks
if its a yamlconfiguration, do a list<itemstack>
Use the internal byte serializarization mojang provides
i can just do that manually in recaf tho to edit the bytecode
That's true you could also make a tool with asm
To rewrite the imports
what about separation?
the item stacks need to be separated by something
Use air
Mojang knows about air spigot chooses to blissfully ignore it
I'm not sure I follow
then how do I write a serialized item list into a file?
I use internals
And go into bytes
But you can also just use config serialization api
so how would I do that?
ye
not even using DFU to serialise the NMS item stack smh
i used to base64 them but dunno if theres a better way than the obj outstream
internals
um
got stuck here
wait, is that possible?
converting a whole array, not just a singular serializable object?
why am I getting this error when trying to compile remapped server jar
Same, i thought thats only my problem 💀
are mojang servers having a skill issue or smth
I have the same error with my own nexus server since 2 hours, idk what the hell happend
i think you are supposed to write the length first
unless writeObject changed
Can you ping me if its working again? xD
maybe
imagine if mojang like took the mappings down or smth
cuz they did something similar with bedrock edition apperently
I think it's done automatically
dunno what they mean with the handle is then assigned
neither do I
nor do I know why the length is written after the contents
doesn't make sense for me
dunno where you even got that doc from, javadocs dont mention it
hi 🙂 how do I get the current spigot verison my server is running? e.g. spigot_1_21_R0 etc..
You put in the server folder
?bt
Do you mean something like Bukkit.getVersion()?
You should phrase your questions better
Bukkit.getServer().getVersion()
or smth
haha
It sounded like, how do I get a server software jar
idk how you got that but ok
oo yes thx
Because I just woke up
i love that spigot-developement is your go to morning routine
It’s not my fault as soon as my phone is on spigot notifications come flying in
I thought someone was dying here man
LOL
Just asking, is the buildtools working fine for you guys?
If i try 1.21, remapped, its not working because Artifact not found?
?paste log
i just did 1.21 remapped no issue
When?
literally two hours ago
Okay try again, since ~1 1/2 is not working, if its working fine okay, i can read the log its okay. Just saying he cant find it on minecraft-libraries, the other dude had the same problem xd
bump^
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.contents.PlainTextContents;
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import world.ntdi.api.nms.ChangePlayerNameService;
public class spigot_1_21_R0_1_SNAPSHOT implements ChangePlayerNameService {
@Override
public void updatePlayerUsername(String p_username, Player p_player) {
CraftPlayer craftPlayer = (CraftPlayer) p_player;
craftPlayer.getHandle().setCustomName(MutableComponent.create(PlainTextContents.create("Test")));
}
}
``` no errors in my intelliJ, but when I go to package my plugin,
not sure what I did
So I'm probably in the wrong place, as this isn't a question about plugins
I am a server developer for an old version of Minecraft. The wiki.vg has incomplete documentation for some of the old server structure so I'm running into issues with packet order and ID.
I am creating a server on limited hardware for 1.7.2 so I'm attempting to create a server that only has the basics (i know the computer cant handle max render, tons of players ect...) After finishing login success (packet id 0x02) I try to send the world spawn position (packet id 0x05) however I get a crash "Bad packet Id 05". I have tried several other packets with no success.
Is this likely an issue with the content of the packet, or its expecting a different packet id than what i have tried (0x03, 0x05, 0x00 keep alive).
Most issues i have seen online were due to mod or plugin conflicts but I'm trying to build for a vanilla friendly client.
Any help or direction would be immensely appreciated.
Is your intellij up to date
Hi, I would like to know how I can have the levels sorted in ascending order in the order? Because currently it's a bit random
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String msg, String[] args) {
List<String> completions = new ArrayList<>();
if (args.length == 1) {
if (sender instanceof Player player) {
int playerLevel = player.getLevel();
if (playerLevel > 0) {
for (int i = 1; i <= playerLevel; i++) {
completions.add(String.valueOf(i));
}
}
}
return completions;
}
return List.of();
}
yessir
Are you ensure you're using java 21
oh im on java 17
that would prob do it
i mean jdk 17 but
let me update everything
@river oracle changing project sdk from 17 -> 21 fixed it!!!
😄
Np
sort via Integer.parseInt & Integer::compareTo
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
Use #bot-commands
instead of flooding the channel with that everytime you want to check links
Love it
._.
...
Q: new to server. Is it ok to link question i have asked previously after ~15-20 min due to it being buried.
You can reply to your original with like a "bump" or something
so it doesn't get lost
If anyone could provide me with direction of where i should look that would be great
yeah ig
the old versions are incomplete
i have been following it for the last 2 weeks building my server. The new versions are better so I have been following that structure. Problem is too much has changed to apply that structure to old versions
?paste
?
This guys a troll
I mean not for nothing but why 1.7?
u lowkey stop crying i can text commands anywhere i want
dumb fk
...
bruh stfu
yup
kek
1.7.2 is after the netty rewrite. The server code is simpler and has less to manage while still being a "Modern" version. My goal is to create a server that is still minecraft but has the least number of features I need to manage
is that your best try?
@young knoll you wanna help out ❤️
also can we mute this fool
i'm sure coll agrees with them
nah we kick these
he's the typa guy for that
kek
They're all green tags right now so..
I certainly would not call 1.7 modern
1.7 is 10yrs old kekw
i know, i didnt want to do a prerelease version
he probably means that it's the oldest still sometimes used version
i could move up a few versions but dont want to have to deal with things like armor trim and other massive NBT stuff
Idk point is if wiki.vg doesn't have your packets then you might be kinda cooked until some 1.8 era chad comes along
thats what i was hoping for. The reason i didnt do 1.8.x was that i remember the old servers being finicky
Well post 1.13 we've got pdc so
protip for writing server: no version requirement but just huge switch statementd everywhere
kek
there is a vg page for it https://wiki.vg/index.php?title=Protocol&oldid=5486 but the problem is that it dosent say what order is required or what packet is in response to several versions
should i move to 1.13?
rust #[cfg] in shambles rn
i could rebuild my stuff in less than a day
pdc makes data management way easier, so I'd argue for yes, I'd still even argue for just the latest
I tried for recent versions the main issue is i have no idea how to work with the registers
The minecraft registries?
wrong word. let me find it in the wiki, gimme a sec
I don't remember if we're more modern now, but reflection and unfreeze registries then you can do what you need
its the "Known packs" and "Registry Data" that i was having issues with
btw im doing this in C
oh dear
so i have to translate every java thing
i have experience (low) in java but can read it. Im a ton better at C and C++
Well oop is oop so
I have the TCP stuff done and can save packets from the user, i get to "Loggin in" for the client after i send the login sucsess packet. My issues is what packet order i need.
i thought it was "Handshake stuff" -> "Set world spawn" -> "send world data" -> "spawn player" -> "Play logic"
It should say on the wiki, or was that the incomplete part?
for 1.7.x yes
erm
1.20.x is clear but i tried following that order (not using packets that dont exist in 1.7.x) but to no avail
Try the 1.8 format perhaps?
I'm not sure how much protocol changed between them but I can't imagine it to be enough to matter
Take that with a grain of salt
1.9.4 has entered the chat
i know that 1.9 does some wierd stuff hence me avoiding it
Yeah 1.9 was an odd time kek
ill try 1.8 logic and see what breaks
If anything it'd be pvp related aspects I'd think
So maybe writing for native 1.8 would be better?
Im not worried about pvp atm... If i can get it working, i can do a rebuild for 1.8 and just handle the changes
Fair enough
this has got to be the weirdest take ever
Yeah sorry
I wrote that right after taking my morning toke
Should think more before I speak for real
ye its
I have no idea why this is a weird take. what about 1.8 makes it odd
well when im talking about 1.7 it seems resonable
And wiki vg is incomplete so
ye
can I update entity locations in an async runnable? or does it have to stay sync
Sync iirc
kk ty
btw the reason im doing this is a bet between a friend and I. We are both using "Ancient/limited" hardware and have 4 months to build a working Minecraft server. Whoever's server can mine, craft, and build while using the least resources wins. Im writing it in C so i can try to keep it under 64kb of memory. I have the world (one chunk) player data and about half the server logic at 35kb. If i can fix my packet issue I should win.
This is why im using 1.7.x and keeping everything i can in C
Interesting bet
his server is currently at 800kb but he hasnt done his TCP stuff yet. he is doing it in C# so its easier for him but needs a ton more resources
@alpine urchin wanna give this guy some helpful insights perhaps?
Can't wait to see what this looks like when its done kek
barely playable but by definition its still minecraft
retro is doing something similar right now
Netty / something that I forgot only too
Hopefully he's not too busy and can help
I still have 1.5 months to finish and just need to fix my tcp logic. Unless my friend switches to C or rust i should be good
my tcp logic is in a massive switch statement right now (tcp packet index 1) then i handle the packet from there.
Im about ready to try every single possible packet and see what gives me a tcp return packet. Im using Wireshark to read what packets make it and what get dropped. If i could disable encryption on a normal client i would also be able to read the order
I have both a working java 1.7.2 server and a 1.7.2 client but cant figure out how to remove the encryption packet with IntelliJ
im too lazy to read all that
kek
wtf
(I already suggested a rather modern version)
Encountered error while processing failure consumer: java.lang.NoSuchMethodError: 'void net.md_5.bungee.protocol.packet.BossBar.setTitle(java.lang.String)
Any clue whats up, my plugin is trying to create a bossbar, this is bungee
I am now writing my server for 1.7.10
or 1.8.x if needed
i might have read it incorrectly but why would writing the server in C make the pvp better lol
do you have code
I don't think it's about the pvp, just in the sense that he was already writing protocol for 1.7.x, so I suggested 1.8 because perhaps the wiki isn't incomplete
Not super attached to 1.7.x. Current issue is after Login Sucsess packet the client is waiting for another packet but every packet i send is "Bad packet id XX"
I can post but more than half is in Hex
?paste
save button and send the link
question
possible answer
why are you writing an mc server in arduino
@meager hill are you running this on an mcu?
my exact thought
Have you tried sending https://wiki.vg/Protocol#Login_.28play.29 after your LoginSuccess packet
note that This (also known as Join Game) is then in the PLAY state
the bet is minimal hardware. i have external memory and the 64kb eeprom is where the world is saved
Im using offset hardcoded chunck data to populate the client side
currently reading
Make sure it's in the correct format for your version
I hope your version is 1.8 or newer
or 1.7.10 still doable
wiki.vg represents latest version
so not all fields will match with whatever you are targetting
Pretty easy change at this point. I have another file already made with that packet coded, i will import
what were you doing instead
that's the packet you must send after LoginSuccess
what version is that
1.7.10 or 1.8
shoot wrong one that was the 1.7.2, gimme a sec
just pick a version brother
which will you develop for
accounting for changes are simple later, but pick something first
Does your system account for connection states
well, that is the first packet in the PLAY state that you send
which means, the IDs reset
so account for that
elaborate
I keep track of the current connection and what the previous state was. If a client goes back a state i should be able to handle it as long as the logic dosent jump
like
mcedit
i need to debug
my .schem file
cuz worldedit is having a stroke saying it cant identify it
The schem file you created was created with the version of WE you're using correct?
I've some issues like this before
no
Try that
litematica
is there a way to upate npc's skin without adjusting the game profile textures? because if i change the texture of game profile, it will change for everyone
-e
im fucking stupid
im trying to save
a litematic schematic
like the preset
that isn't even loaded in
now it works
yeah no it still doesn't work
haha
its fucking world edit
ClipboardFormat clipboardFormat = ClipboardFormats.findByFile(schematicFile);
returns null
so i've changed it
to every single enum to test
and it wont work
and i've saved the schem using world edit, litematic and converted it to schem
im having a mid life crisis
learn abap and become and SAP Dev that should help
sorry for ping
Try searching by file name (string) btw, this is how I'm currently doing it and it works fine, I'm not sure why the file is returning null but idk try something like this I suppose?
Hmm
Ok then try to fix this
wdym
The file you're trying to use, was it created with the version of world edit you have on server & are depending on in your plugin?
it was created with world edit
and yeah im depending it
i also tried
7.3.0
and 7.3.4
still the same error
Ok so the schematic file you've created and are using was created using the same version of world edit that's on your server?
yes
Does anyone have the slighest clue how to send a bossbar on bungee, i've tried using the Packet and all i get it
Encountered error while processing failure consumer: java.lang.NoSuchMethodError: 'void net.md_5.bungee.protocol.packet.BossBar.setTitle(java.lang.String)'
Can I see how you paste the schamtic into the world?
// Closes automatically when in try block like this
try(EditSession editSession = createEditSession(location.getWorld())) {
ClipboardFormat clipboardFormat = ClipboardFormats.findByFile(schematicFile);
ClipboardReader clipboardReader = clipboardFormat.getReader(new FileInputStream(schematicFile));
Clipboard schematic = clipboardReader.read();
Operation operation = new ClipboardHolder(schematic)
.createPaste(editSession)
.to(BukkitAdapter.asBlockVector(location))
.build();
Operations.complete(operation);
}catch (final Throwable e) {
e.printStackTrace();
}
ClipboardFormat clipboardFormat = ClipboardFormats.findByFile(schematicFile);
is nullable
and thats causing all the issues
i've looked into the source and tested out all the enums
for it just in case it was broken or smth???
and it still doesn't work
litematica schematics are not compatible with worldedit afaik
yeah
i converted it afterwards
but even the .schem from the world edit isn't working
how are you saving it?
using world edit
i've tried downloading other schematics
and they dont work either
are you able to load and paste the schematics via commands?
then the problem is in your code
to see what its doing
it's open source lol
not really
if it works via commands then the schematics and worldedit are fine
there are 4 enums
and it finds it
through the file
which enum to use
so i manually
checked each enum and it still
isn't working
i mean
i can't see all of your code, but if it works with worldedit commands, then your code is wrong
clipboardFormat is null
it checks the format
like version of the schematic
and if it can't find a right version its null
file is not null and exists
how do you know it's null? are you getting an exception?
yes
stack trace
java.lang.NullPointerException: Cannot invoke "com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat.getReader(java.io.InputStream)" because "clipboardFormat" is null
and is the File pointing to the right file?
yes
it wouldn't say
clipboardFormat is null
if it didn't return null
the check throws an exception
yes, so maybe the file isn't pointing to the correct file, a file that is not a schematic or doesn't exist
thus it returns null
that does not mean that the file exists
print file.exists()? idk
its true
i have code that loads schematics and works fine ¯_(ツ)_/¯
classic
im just
making
a simple luckly block plugin
so i can practice yk
and i gotta deal w this
ok i give up for now
😿
whats wrong about Objects.requireNonNull()?
guess they are not really smart
that’s not how you judge people
glad im not torvalds
🤓
Is there a way to change a chest’s inventory size to something of size >=27?
Ik, itried it like this:
Inventory chestInv = Bukkit.createInventory(player, 5 * 9);
customChest.getBlockInventory().setContents(chestInv.getContents());
left some code out between the 2 lines where i add stuff to the chest
okay and whats the issue?
Got an "java.lang.IllegalArgumentException: Invalid inventory size (45); expected 27 or less" error
and which line causes that? according to the error?
your trying to set the contents of a larger container to a smaller chest
the setContents
if you want to change the size of a chest you have to handle the opening the inv, and saving the contents
jup basically
^
?
dont do that
can you elaborate a bit please?😬
listen to block place event and give the chest a pdc tag if its yours, listen to player click event and check pdc for if its your chest, if it is open an inv from the stored contents in the chest and save when it closes
How you gonna store 45 items in a 27 item inventory tho
Alter stack limits :p
What if I store 45 different items
cooked
well😂
how do you put a pdc on a block?
tile entities have pdc
Uhh aktually they are called block entities

armorStand#isValid can return false and the armorstand be spawned in the world?
did you check what its actually doing
it looks like the armorstand is in the world and this method is returning false
How are you gettint the entity instance
1sec
lol
yo
while you're here
can u help me
big time
🙏
With what
I'm saving it in Minion Object.
method on minion object:
public ArmorStand createOrMoveArmorStand(MinionPlot minionPlot, Location currentLocation, Location newLocation) {
if (armorStand != null && armorStand.isValid()) {
Location teleportLocation = getTeleportLocation(currentLocation, newLocation);
armorStand.teleport(teleportLocation);
return armorStand;
}
ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta itemMeta = (LeatherArmorMeta) chestplate.getItemMeta();
itemMeta.setColor(Color.LIME);
chestplate.setItemMeta(itemMeta);
ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS);
LeatherArmorMeta itemMeta1 = (LeatherArmorMeta) leggings.getItemMeta();
itemMeta1.setColor(Color.LIME);
leggings.setItemMeta(itemMeta1);
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
LeatherArmorMeta itemMeta2 = (LeatherArmorMeta) boots.getItemMeta();
itemMeta2.setColor(Color.LIME);
boots.setItemMeta(itemMeta2);
Location teleportLocation = getTeleportLocation(currentLocation, newLocation);
ArmorStand armorStand = (ArmorStand) MinionPlugin.PLOTWORLD.spawnEntity(teleportLocation, EntityType.ARMOR_STAND);
armorStand.setHeadPose(new EulerAngle(Math.toRadians(18), 0, 0));
armorStand.setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (byte) 3));
armorStand.setChestplate(chestplate);
armorStand.setLeggings(leggings);
armorStand.setBoots(boots);
armorStand.setItemInHand(minionPlot.getHandItem());
armorStand.setGravity(false);
armorStand.setBasePlate(false);
armorStand.setSmall(true);
armorStand.setCustomName("master-minions");
armorStand.setCustomNameVisible(false);
this.armorStand = armorStand;
return armorStand;
}
I have a feeling the chunk got unloaded and so that armor stand became a dead reference
but it shouldn't be
do you know what I can do then?
Track the entity uuid
Can’t say I’ve had issues using find by file before
Not the entity instance directly
well
Can you not just hardcode a format?
Are you providing a valid schematic
yes
world edit itself loads it
the file isn't null
it passes all of it
is there a way
to check the type
of the schematic
without going through hell
but this will be the same. I will get Entity by uuid and then Entity#isValid. If the chunk is unloaded it will return false even if the armorstand is there
Well yeah
If the chunk is unloaded the entity is unloaded
So you can’t do anything with it
Hello peoples, is there a way to remove the couldn't remove message from saveResource()?
Figured, thanks
When the chunk is unloaded, isn't it supposed to set the entity as invalid from that armorstand saved in memory?
confusing
please stop messaging every word, its very annoying
Well that's what happening? isValid is returning false when it was unloaded
And thus the instance is invalid
im not actually
lil bro
sounds like someone needs a nap.
No. The method is creating many armorstands instead of just teleporting the existing one because isValid is returning false even though the armorstand is in the world.
i just know it
do u mind accepting fq
You'd be in a grave, little boy.
Again the instance can become invalid
🤓
If the chunk is unloaded and loaded again
A new instance will represent the entity
And thus the old one will have isValid be false
do you mind accepting fq
Done
ty
how to get people to not help you:
of course
1 bit
because you're seemingly a pain in the ass to talk with
I mean, worldedit does have a discord
yeah im joining it right now
Presumably they might know more about their api
because some of you guys are fucking jerks
No, its because you ask for help and spam. When someone asks you to please stop spamming you attempt to bash. Earn respect kid, don't demand it.
When did i demand respect
i just wanted to fix this
i dont care about respect in a discord server
i treat everyone how they treat me
grow up
Please take your arguments elsewhere
@young knoll 🫡
What’s the best way to change the players overhead name to a hex color?
right now I’m limited to chatcolors by the teams api
thinking of maybe NMS
teams is the way ive done it
Pretty much all you can do with the vanilla name tag
Your best bet is to hide it and make your own with display entities
like armor stands?
wait i’m so out of the loop
what are display entities
Entities you use to Display things 🙂
I’m looking to get a sponge plugin ported into a spigot version, is this something that’s terribly difficult to do?
I don't think sponge is that different
and are you trying to port it to the same version?
hey, i have a database with player's stats in it, is it a bad idea to get the stat from the database everytime i wanna use the stat or is there a better way to do it?
Cache it
cache it
Generally when the player joins
how would i do it?
save the data on memory while you are accessing it/when the player is online
then when they leave, save it to database
also occasionally save it (every minute or so)
so like hashmap?
yeah, hashmap works
okay thank
What stats are you wanting to store? as Bukkit already has some stats
they're custom i dont think bukkit has them
do you need to access them when the player is offline?
not really just online so i think the solution above is fine
there are so many other factors that could contribute to this
Whats the best way to hide the player's nametag?
?pdc
wait so persistent dataholder is better than database?
If you store teh stats in PDC you can leave it upto Spigot to save/load them
will it be better performance than using a database with hashmap?
If you don;t need them when offline then yes PDC is perfect for storing stats
do you not plan on doing leaderboards etc?
like i wanna store player's skills levels in it then get the stat when breaking a block for example
ah yeah pdc is great for that
then PDC is perfect for your use case
okay
database is overkill
database for if you need access when teh player is not logged in
or across multiple servers
so if i wanna transfer the skills to other server would database be a better option?
yes
I would still consider caching from pdc if you are going to be accessing it a lot
Since it does a bit of work to translate to and from NBT
bumpppp
sendChat(player, String.format("&a%s &7Created.", home));
return;
}
sendChat(player, String.format("&a%s &7Updated.", home));```
Would a switch statement be better for this?
just for that? No
I’d like my NPCs to look at the closest player and then reset to default when no player is within the specific range, which solution is better…. 1. using player move event - update yaw/pitch and calculate who is closest
2. A loop calculating and updating every second
you can just do a loop and check by chunk
will be more efficient
Interesting how exactly would that work
Like loop NPC > Chunk then find the players?
yep
public static Entity[] getNearbyEntities(Location l, int radius) {
int chunkRadius = radius < 16 ? 1 : (radius - (radius % 16)) / 16;
HashSet<Entity> radiusEntities = new HashSet<>();
for (int chX = -chunkRadius; chX <= chunkRadius; chX++) {
for (int chZ = -chunkRadius; chZ <= chunkRadius; chZ++) {
int x = (int) l.getX(), y = (int) l.getY(), z = (int) l.getZ();
for (Entity e : new Location(l.getWorld(), x + (chX * 16), y, z
+ (chZ * 16)).getChunk().getEntities()) {
if (e.getLocation().distance(l) <= radius
&& e.getLocation().getBlock() != l.getBlock()) {
radiusEntities.add(e);
}
}
}
}
return radiusEntities.toArray(new Entity[radiusEntities.size()]);
}```
thats what I use
The plugin states it’s for most versions including the one im looking for (1.16.5)
This is my current way of handling this
public void onPlayerMoveNPCHandler(PlayerMoveEvent event) {
Player player = event.getPlayer();
if(!event.getFrom().getBlock().equals(event.getTo().getBlock()))
handleMoveIntoRange(player);
}
@EventHandler
public void onPlayerWorldNPCHandler(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
handleMoveIntoRange(player);
}
public void handleMoveIntoRange(Player player) {
Location loc = player.getLocation();
User user = Server.getUser(player);
for(NPC npc : NPCManager.getNPCs()) {
if(loc.getWorld().equals(npc.getLocation().getWorld())) {
double distance = loc.distance(npc.getLocation());
if(distance <= DISTANCE) {
if(!user.getShownNPCs().contains(npc))
npc.spawn(user);
if(distance < 10) {
npc.lookAtPlayer(user.getPlayer());
}
}else {
if(user.getShownNPCs().contains(npc))
npc.destroy(user);
}
}else {
if(user.getShownNPCs().contains(npc))
npc.destroy(user);
}
}
}```
looks good
it keeps yapping about heightmap or whatever (i changed the build limit using a datapack)
i did manually change the datapack so i mightve broken somethign
{
"ultrawarm": false,
"natural": true,
"piglin_safe": false,
"respawn_anchor_works": false,
"bed_works": true,
"has_raids": true,
"has_skylight": true,
"has_ceiling": false,
"coordinate_scale": 1,
"ambient_light": 0,
"logical_height": 1088,
"effects": "minecraft:overworld",
"infiniburn": "#minecraft:infiniburn_overworld",
"min_y": -512,
"height": 1088,
"monster_spawn_light_level": {
"type": "minecraft:uniform",
"value": {
"min_inclusive": 0,
"max_inclusive": 7
}
},
"monster_spawn_block_light_limit": 0
}```
Which datapack did you change?
You can make it more efficient by 1. using a repeating task instead of listening to every player‘s movement and 2. use distanceSquared()
some crappy one i found on planetmc
What about trying 1024 first?
?
Max height
I'm not sure but for some time the max height was 1088 blocks
i fixed it
i jsut had to change the height and logical height to fit the new negative y
Oh
I'm still not familiar with datapacks but I feel I should learn
Especially for the world gen
this is my first time even using a datapack
Can someone tell me if my code would work?
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class NoDamagePlugin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
// Register the event listener
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
// Cancel the event if the entity is a player
if (event.getEntity() instanceof org.bukkit.entity.Player) {
event.setCancelled(true);
}
}
}
Only trying it will tell you if it works tho
oh ok
i'd love it if u change org.bukkit.entity.Player to Player and import it
cuz that's triggering me rn
You've inspired me now to use full references to anything and everything in my plugin now
public class NoDamagePlugin extends org.bukkit.plugin.java.JavaPlugin implements org.bukkit.event.Listener {
@Override
public void onEnable() {
// Register the event listener
getServer().getPluginManager().registerEvents(this, this);
}
@org.bukkit.event.EventHandler
public void onEntityDamage(org.bukkit.event.entity.EntityDamageEvent event) {
// Cancel the event if the entity is a player
if (event.getEntity() instanceof org.bukkit.entity.Player) {
event.setCancelled(true);
}
}
}
so elegant
PLEASE step on a lego brick
Oh my holy god this is beautiful
:-:
abbev must be holding u hostage to say that
But if you decide to update a package and it renames one single package... You are immediately in the coffin
no sane person would say that
yall dont do that too
craftbukkit:
always gotta do a ctrl-shift-r when using CB without paper (they removed that version package name thing 🙏)
The only good thing paper did
they use mojmaps at runtime too
Ik
But that's kinda shit because paper is now cvn basically, remapping plugins at runtime
but that also makes it harder to use yarn maps
nah, we just remap to spigot and paper does its job to remap to mojmaps
and then we profit
Whats the smartest way to make a functional block like to right click and then a gui opens and then to also save it
a functional block? like a furnace?
No like I right click a eg sea lantern and then a gui opens
Can someone help me? my eclipse isnt launching because it says I need JDK 21 but I have JDK 22
PlayerInteractEvent?
install jdk 21
The block doesnt matter either.
Save what? The GUI layout?
Yes I know that but how to check if that’s the correct block like just do a list with locations or what?
No that that’s a block you can interact with
list of materials? or block pdc
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
i tried it with jdk 21 but it didnt work thats why i tried jdk 22
if it tells you to use jdk21, use jdk21 lol
that's about as much as i can tell you about eclipse
@peak depot anyways this is pretty simple, idk about Blcoks but I did this with Items before.
Hang on I can show you what it may look like
with items you can just pdc it
🤷
o right
no just compile it yourself
use IJ lol
my free trial expired
use community edition
ok
hello, I'm new to plugin creation, and I've developed a The Towers plugin to play with my friends. It's a bit of a lot to ask, I think, but I was wondering if someone with a bit of experience could give me some advice on the architecture of my plugin. I have a basic knowledge of Java, but I think my plugin could be greatly optimized. What's more, as it's a mini-game plugin, I wanted to know if there were some ways of doing things that were more widespread than others. Thanks for your help!
Go for it
Feel free to share your project on a github repo and share the link here. Many will love to leave some critics !
thanks !
?codereview time perhaps ?
#1100941063058894868 is the place for code reviews. Remember to read the pinned message!
sure i'll post it there
btw whats "The Towers"?
Like a city generation?
no like the mini game
it's pretty old and i wanted to play with friends so i coded it
Tower? Never heard of it
https://www.youtube.com/watch?v=tmNF6_V8h7E&t=1084s&ab_channel=Aypierre
it's a pretty basic mini game, and I added some custom items to make the game funnier
yes
?paste
thats just wrong
Seems like you didn't read the update notice telling in bold to install a required eclipse plugin otherwise it won't start. In that case, just reinstall eclipse - especially the portable eclipse installs are rather easy to uninstall and install (that is, there is no installation process)
anyone have project ideas
Recreate the chisel & bits mod
use block displays for that
I used chisel mod all the time
you look goofy
back in the day
wdym, it would be interesting to see how you would tackle the performance issue and the UV mapping issue :)
The hitboxes would probably be scaled down shulkers with some "culling"
Sounds fun!
make a minecraft launcher in c
profile and version management n all
ms auth :kappa:
he does c++ a lot so wouldn't surprise me
i suck at ui
im the guy who would have a launcher powered by a game engine ahh
exactly :) so make it in c
because it's a challenge
making ui is already enough of a challenge
do it all in asm if you want a challenge
make it portable with WASM 🧌
just use js
this looks a bit.. empty or is it just me?
oooo i like that hunger bar
how did you do that
just font magic and aligning maths nothing fancy
oh thats simple
something in the middle could work
yeah not sure what tbh
i feel like the hearts could be a bar instead
put your face there
no
anyone use modrinth executable?
the player will be able to get really big health
oh
and i feel 10 hearts won't be able to accurately display it
wif some math
yeah i tried that aswell, looked eh
i would slap the text onto some background tho
it's what i always do
and make it a bit more inwards
not at the edged there
#general message
2 years ago lel
and had a darker background before but idk looks funky with it on both sides
shift it further to the right, that heart being at the very left looks shit
should be more towards the center
make the background shorter too
only a bit of padding
das too much
and remove that xp level
make it display your social security number
send me over yours to make sure it displays properly
I dont have an SSN 😦
no problem, ssn doesn't exist here
neither lol
Just hid the default hearts and used unicode to replace it lol
but how'd you hide them
by replacing their unicode to a 0 width space?
Did u use nms or something? @drowsy helm
Nah just resource pack
oh really now
I thought they were unicode for some reason
yeah I guess that tracks
Can u guys give me a idea for plugin. Im stuck
just too used to working with fonts at this point
if you don't have a good idea for a plugin don't make a plugin
But i want to 😭
Ask chat gpt
then spend a longer amount of time thinking what would be a good plugin
İ did he said make heal plugin 💀
Feed plugin
I alr make these 5 yr ago
Lmao
I don't understand people who can't come up with projects
I cant
I can only focus if it’s a really large projecty
I literally do this more than full time and have done so for years and the amount of projects I want to do has only ever gone up
There's so many ideas that haven't been explored
they pop up so much faster than I can work on anything
Make a harry potter plugin
Lmaooo
Or lord of the rings
I thought devs were creative 😵💫
Make a herobrine plugin
bud
Well I'm halfway with making a spell plugin lol
you need to pay more attention
I could probably spend the next 20 years working just off the backlog of ideas I've already had and not even be halfway through executing them
True
fun ones too
I've got so many half finished plugins
I'm still planning to make an infinite city plugin
I don't have half finished plugins
Some of which actually had a decent amount of code
I stopped because the scope was getting too big
I do them in full almost every single time
I have MANY ideas but I'm better at procrastinating
I have more than 100 projects and half of them are not finished frfr
I started a nation plugin, got the claim land sorted, started adding upgrades to my nations, then added achievements, and it just kept growing
you people need to learn some focus and self-control
I love maven more
Very true, my current plugin is a spell plugin, quite a lot of the core is done, but I want all the spells editable by admins in game
This is my first project with gradle and it’s a lot better for multi module
that reminds me of why I even opened this chat
And you dont need to mvn install for internal modules
what is the more convenient way of doing a shared internal library for something like a shared utils bunch of classes
the thing that comes to mind is shading such a project in but that's a little bit of a hassle
is there a more convenient solution
I mean if it’s utils shading isnt that bignof a deal
Unless you want to host the module on a repo then dl it with lib loader
I would have to
since these are open source
hence the hassle
are there any other potential solutions
Only problem with shading is differing class parhs
If you plan on having classes being shared between plugins using the utils
If that makes sense
chatgpt is saying something about git submodule, what's that
that sounds interesting
I ran into an issue today where I have. PlayerData class in my commons module and since both my plugins were shading it, it was a different PlayerData and couldnt be interchanged
how do i make elytra boosting faster
hm that's interesting
shouldn't really be a problem for my use case because I was only planning to do self-contained utilities with no cross-communication but I can see how that's something you can accidentally write yourself into
as an example one thing I would really like to dissociate is the logic for handling commands and handling config files
I have a whole infrastructure for both and I just kinda keep copying some core classes around
which ain't great
I think that would be fine to shade
why does teleportation break with I add a passenger to a player?
break?
Like it no longer works? When I comment out the code of adding a text entity as a passenger to the player, i get no issue teleporting the player, but uncommenting out the code of spawning the text display entity and adding it as a passenger, teleportation ceases to work
You have to dismount before tleport. I thought it did it automatically
The passangers?
yes
alr thx
mount again after
mhm
is it possible to hide a text display from only one player?
OMG! how did I not see this earlier
ElgarL you a real one
is there an event for when the player changes their perspective?
like F5?
not that I know of. There may be a packet though
Will look into nms then, thanks!
?
it's clientside
remind me real quick, if I'm just making a lib there's no reason why I should have that in a plugin format right
there's no reason to have a plugin.yml
or even a resources folder
nope
just shade it ™️
that is the plan
the other options do not spark joy
none of these options spark joy
if I were a crazier person I might be tempted to literally just symlink the files in
hey, i have a playerdata class that i store memory in it, is there a way that i can access it from a different plugin or how else would i do that
create an API for access
i need good combat log for my smp
it's coming together
all these different plugins and systems
the prophecy is starting to get fulfilled
Does anyone understand why I'm receiving this error? For context, I recently switched from 1.20.2 to 1.20.6, I didn't believe there were any code-breaking changes and everything seems to be fine except this. Any explanation? https://pastebin.com/GQBhhHeX
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
is there some api thing that tells me when a mob starts charging an attack like a bow shot or trident pull
Hey guys, what would happen for me to get this error?