#help-development
1 messages · Page 1268 of 1
so if any such recipe exists, i will recurse the process and rebuild the token key mappings for that subset of recipes
yea thats usually the way to go
u might be able to be a bit clever and do some (shorthand) trickery
looking at my old benchmark, it looks like all of the recipes at the time, except wooden slabs, wooden pressure plates, wooden gates, wooden doors, wooden stairs, boats, were found in a single lookup
some slabs and some stone stairs and walls also required a second lookup
in all these cases, since there aren't any material tags involved anymore, it degenerates just to effectively a lookup by material[] key
for shapeless recipes, everything was always resolved in a single lookup
i'm not sure if any shapeless recipe uses material tags
hm, what if we build a tree such that root contains every recipes, edges are materials (not tags) and the deeper you go - the more splits of original set of recipes from root happen (depth is index of item in grid from 1 to 9 which we observe to split at some vertex). since total splits are = amount of recipes (lets call it n). there will be O(n) vertices in tree. every vertex containing a set of O(n) recipes. Since we have material tags there will be multi-edges, considering that lets call maximum of materials a single ingredient can cover over all recipes = m. Then preprocess to build such tree is O(nn + nm) which should be pretty fast. Height of tree will be 9 or less. Since tree already uses O(nn) memory we can store O(k) array in every vertex where k - amount of materials in the game and array will be storing references to vertices we should go next with this material in a slot. Resulting preprocess is O(nn + nm + nk) but we always get the recipe from grid in 9 tree jumps which is O(1) and since we store O(k) array in every vertex jumps should be fast so it might actually be faster than 1 hashmap lookup (my intuition tells me 1 hashmap lookup is about 20 array lookups)
Why nerd talk @iron night ?
i mean im almost sure lookups are gonna be way faster. the only problem is preprocessing, im afraid it can take something like 10% of server bootup time which seems a lot
you dont have to read it if you dont want to
an issue with such a huge data structure becomes cache locality; hashing into a small hashmap can be faster than accessing a huge array (like a material enummap)
isnt getting ordinal of enum fast?
it is, it's essentially just a field read
well then i dont get you
but indexing into an array at a position that has to be fetched from main memory is slow
conversely a hashmap with a small table is more likely to already be in some cache tier in its entirety
still dont get it, isnt it just an ordinary array lookup by index?
whether that's actually slower or faster than computing the hashcode on it is anyone's guess really
well... a hashmap is an ordinary array, but we use the hash code of an object as the index
depends a bit on what we define as "lookup", but if it's map.get(), it's basically hashcode + array index for key & value, and comparing the keys
look i'm just saying that indexing into a lookup table of 1 million elements is probably slower than hashing into a hashmap of 16 elements
because as cpus have gotten faster and faster by orders of magnitude, memory hasn't gotten that much faster
there isnt array of 1mil elements, there is 1000 of arrays with length 1000 if this makes a diff
i dont know what for i said this
roughly the same thing but it all depends
benchmark it and we'll see
guesstimatine memory latency and how many clock cycles a hashcode is just piss in the wind at the end of the day
for the startup time issue, you could do it async in the background
start it in say plugin load and then block for the result in onenable
i mean im not implementing it, just was interested to share the algorithm i came up with
i didnt fully get how your solution works, is it heuristics?
it's uh
so the problem with material tags is that we have multiple keys that we want to map to a given value
the naïve solution to this is to just have a mapping for each key
but this breaks down when your key is a composite of multiple keys
take for example the furnace recipe, which accepts i think cobblestone, blackstone, and deepslate, and spans 8 slots (all except the center slot)
to produce all the for this, we'd need 3^8 mappings
its n^8 where n is matching materials yeah i get it
so instead of doing that, we have an intermediate step where we have 3 mappings for cobble, blackstone, and deepslate, and have them map into a "token key"
and then we compose those token keys into the recipe matrix query
so, no matter which type of stone you put in any of the slots, the token keys for each slot and hence the composite key of them will be the same, and we get the same result
for materials not part of any material tag, there is only 1 intermediate mapping, from that material to a "token key" unique to that material
while materials part of one or more material tags get mapped into the same "token key" as any other material in the tag
in this way we can map a very large amount of inputs to a single output
the downside is that some inputs which we don't want to map to that output will also be mapped to that output
taking the furnace example again, since both cobblestone and blackstone map to the same token key, then the composite key for both cobblestone slab and blackstone slab will be identical, so we can't tell those apart
so i iterate over all recipes, collect recipes like these into sets, and then i recurse the process for them by rebuilding the token mappings with only the material tags actually involved
since neither cobblestone slab nor blackstone slab uses any material tags in the recipe, there are no material tags in this context; every material will map to an unique token key, and we can now tell the two recipes apart
how do we understand whether should we map to cobble/black/deep token used in furnace recipe or unique token used in cobble slab if we dont know what we crafting yet
we first try the intermediate mappings that were created from every material tag
so when crafting a cobblestone slab, we first produce the composite key that maps to both cobble and blackstone slab
then we look at the result of that query; we see that it maps to multiple things
and then we repeat the process, but now we use the intermediate mappings created from every material tag in the cobble and blackstone slab recipes (i.e. none)
and then we get the cobblestone slab
it's essentially a tree, just 99% of the edges point at a leaf
for the ones that map into multiple recipes, there's a node and it recurses
okay, but what is there was recipe that requires #1 or #2 and recipe that requires #1 or #3. and we had 3 materials matching #1, #2 and #3 (9 total). what tokens will be created then?
can you give a more concrete example, i can't really see that working out
the problem is i cant give concrete example
i couldnt find recipes where such things happen
my question is does your algo absuses the fact that such things dont happen or can it solve them too
it'll only fail to converge if there are multiple recipes that could match a given input
e.g. if you define a recipe that accepts any of a single block and turns it into a button
and then you also define a recipe that accepts 2 of a single block and turns it onto a pressure plate
this will fail to converge
but the current nms recipe matcher will also give you a random one of the two
because it's ambiguous
such things actually dont happen, i just made up some non existent scenario
i did think about this at the time and i was going to write a third node type that just returns a random one if there's such an ambiguity, but it doesn't seem like vanilla has any, so i didn't bother
Hello! do you guys think its possible to optimize villagers by removing their awareness and AI, but keeping their panic brain activity?
off the top of my head i think that'll be difficult
or wait what.
what if there is a recipe that accepts 2 item 1 of which should be #1 (cobble/black/deep) or #2 (oak/birch) and second is just anything dirt for example
and second recipe that accepts 1 item that should be #1 (cobble/black/deep) or #3 (stone/basalt)
you map every item in grid to its token right?
what token cobble will be mapped to
i skimmed over this for sake of brevity, but the intermediate key mappings are per-slot
so in this case, although the intermediate key for the first slot will be the same for both of the inputs, the second slot will be different
recipe 1 item 1 - slot 1
recipe 1 item 2 - slot 2
recipe 2 item 1 - slot 1
yeah i think it would :/
so everything from #1 or #2 or #3 will be mapped to single token for slot 1?
none of those tags overlap, so each of tags 1 2 and 3 will map to an unique intermediate key
e,g, cobble,black,deep might map to token 0
oak,birch to token 1
stone,basalt to token 2
but then you will have to create key with token 0 and key with token 1 for recipe 1 which is bad?
recipe 1 is what again?
slot 1 - accepts cobble/black/deep or oak/birch, slot 2 - dirt
so youll have to create keys:
- slot 1: token 0, slot 2: dirt -> recipe 1
- slot 1: token 1, slot 2: dirt -> recipe 1
no?
that's not possible in the recipe matcher, you can't accept material tag 1 or material tag 2
what you can do is merge the material tags together and use it as a new material tag
so 1 recipechoice is only 1 material tag or what?
yeah
so what you're saying is that recipe 1 requires cobble/black/deep/oak/birch in slot 1
and oak/birch in slot 2
this means that for slot 1, all of cobble/black/deep/oak/birch will map to token 0
and if recipe 2 requires cobble/black/deep/stone/basalt in slot 1
and nothing in slot 2
then the recipes are discriminated by the virtue of there being nothing in slot 2 or not
but you map some token for slot 1?
same token whether or not there is anything in other slots, yes
but the composite keys will be 0,null if there is nothing in the second slot, and 0,? if there is something
so cobble/black/deep/oak/birch/stone/basalt -> token 0?
no because nothing in tag #3 (stone/basalt) overlaps with the other tag
stone/basalt will continue to map to token 1
if it were cobble/stone/basalt then they'd all be merged into one tag and be assigned token 0
okay okay. but if we say that #1 is (cobble/stone/deep/oak/birch) and #2 is (cobble/stone/deep/stone/basalt)
and recipe 1 is slot 1 - #1, slot 2 - dirt
and recipe 2 is slot 1 - #2, slot 2 - nothing
then cobble/stone/deep/oak/birch/stone/basalt all to token 0?
now #1 and #2 overlap
myeah
hm.
but if there:
recipe 1: slot 1 - #1 (stone/cobble)
recipe 2: slot 1 - #2(cobble/oak), slot 2 - dirt
recipe 3: slot 1 - #3(oak/birch)
#1 and #2 overlap, #2 and #3 overlap.
so stone/cobble/oak/birch all go to token 0?
if so, the same tokens will be generated if we put 1 stone in grid and 1 oak in grid, but they are different recipes
in the first iteration yes, inserting any of stone/cobble/oak/birch into the first slot will all be mapped to token 0
recipe 2 will be discriminated during first iteration by whether slot 2 has dirt in it or not
if it doesn't, we go to second iteration with only recipes 1 and 3
and now the only relevant tags are #1 and #3, which don't overlap
so in the second iteration we can discriminate between recipes 1 and 3
but you could make this a pathologic case by also adding cobble into tag #3
this'd mean that even in the second iteration, the tags have to be merged because they both contain cobble
and it'll fail to converge
in this case you can fall back to comparing the recipes one by one as vanilla does
but this is impossible, then putting cobble in grid matches 2 recipes, so everything is fine
this
yeah
that said the argument could be made that it should still work for e.g. when you put in stone and correctly match recipe 1, and for birch correctly match recipe 3, and only fail for cobble which could match either or
but i think defining overlapping recipes is probably programmer error anyway, so whatever
recipe 1: slot 1: b/c, slot 2: c/d
recipe 2: slot 1: a/b, slot 2: a/b
recipe 3: slot 1: c/d/e, slot 2: a/e
recipe 4: slot 1: d/e, slot 2: b/c
seems like in this example for every pair of recipes its impossible to put ingredients in a way so it matches multiple recipes, but at the same time all tags at slot 1 are merged and all tags at slot 2 are merged meaning we cant throw away any of recipes to go to the next iteration
this is example constructed by hand so its only 4 recipes but who know if there are such example but with 400 recipes, meaning we wont be able to throw any of them away and will still have to iterate through every of them which is O(n)
it definitely can degenerate like this, but i'm not sure how probable seeing something pathological like this in the wild would be
with some thought, the merging logic could probably be adjusted to prevent runaway merging like this with all the tags being merged, but it didn't show up in my tests so i didn't bother
Use ai to determine what the output should be based on the ingredients
It makes up something not in the game? Have it generate a sprite for it and then use that to serve a resource pack to the client for their new item
a youtube video
yup lol
you got a suggestion?
idk what this means
do you know anything about Java
Just use the minecraft development plugin which is on IJ
It does most of things for you
i was told not to
I really thought I was that outdated 😭
How come?
?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! 🎉
woah buddy
do any of those courses before starting
i would prefer someone helping me yes
a quick java course is going to help you understand what you're doing
@blazing ocean I thought it was okay for beginners?!
it really doesn't take that long, a few hours tops and you'll probably be good for the rest just by checking the wikis on the forums
Also stackoverflow 
the minecraft development plugin is good for fabric mods, but they haven't updated their bukkit plugin side of things in a while so it is kinda annoying
better to just not use it
im getting mixed answers
okay @blazing ocean , can you dm me if your free to tutor me
Just use google
nobody is going to personally tutor you for free, hence why I recommend just doing a course
Some of them mostly argue about using paper instead of spigot 😭
firstly, look for a video on setting up a project for spigot coding. then go ahead and research about what features you want
learning about java through some outdated spigot plugin development video 😭
for development, you need to get inn a habit of googling
all videos ive seen say to use the minecraft plugin
when someone is starting from nothing, its best to at least know that you need onEnable
and i was told by rad not to
when someone is starting from nothing, it's best that they start by learning the language constructs first rather than going straight into plugin development
Also, why is your package called org.example ?
using the spigot api is a lot easier to get started than straight java
good question
i dont know what to call it
I understand the need to try and do things heads-on, but sadly there are no good courses that are hyper-focused on both learning the language as well as plugin development in of itself so one has to go one step at the time, and the proper first step is learning the language. Otherwise they're just going to be stuck here asking inane questions for a good while before they actually get the hang of things
i dont own a domain or a website
i havent used github in years
isn't io.github free ?
dont need it, dont worry about it. you can name it whatever you want
yeah
sure
?conventions
try com.traders
I'm not sure how gradle works but in pom, you gotta change the groupId
And then the plugin.yml
dont know if it supports numbers tho, that could be why its underlined?
artifactId supports number iirc
its a red unerline with or without the 5
to the left is the package the Main is under also called traders?
package name can contain numbers
Sorry but theres going to be so many questions to be asked. It would be best to find a video online such as youtube which shows how to set up a project for spigot development. Everyone does things differently, so you may need to watch a couple.
i wouldnt mind that
all videos ive found tho are using the minecraft plugin plugin maker
which i was told not to do
eclipse or intellij is fine
that's because most videos are outdated, just do one of the courses
For sure, scroll through the videos and make sure the date is earlier than 3 years
they're gonna end up following mineacademy videos from youtube, and that never ends well
If you are still looking at this chat, watch the video first before copying. if you like the result then go back and follow it.
ugh this one uses intellij instead of gradle
https://www.youtube.com/watch?v=HqxcyK_YgOE
IJ build system?
Wouldn't expect that from kody simpson
or whatever his name was
they do compilation with maven in a different video
don't know why since 99% of the time you won't have to care about how the IDE-specific build system works but welp
why can't people make good tutorials for once
the video is great. go ahead and follow it. start again with a new project following the video. dont worry about the gradle and whatever, there is many ways of creating a plugin. For now, go the simple route with the video
I would if I had a good PC to film it but I fear I'd start using my processor as a stove if I were to record while coding in an IDE and also having a minecraft instance as well as a server running on the background
you're sending them in for a loop instead of just following the course which will get them a much more rounded education
I feel that they are a hands on learner, would prefer someone guiding as well. While a course could help, it may be a lot to take in at once. The spigot api is quite easy, with only a few lines of code
my dyslexic ass does like learning via trial and error
hands on learner just means someone who doesn't wanna spend the time to read, and that won't do when it comes to programming
you get to not read when you're proficient enough to not have to
hmm I have the resources to do so but I'm incredibly bad at teaching things lmao
That is totally fine. The hardest part here is going to be making sure that project is set up right. Watching the video carefully and doing research on google will help.
I understand the sentiment of trying to help, but sending them to the wolves and just expecting someone else to take the reigns after you leave them with half-directions is irresponsible at best
cool ill restart following the video
feels like your trying to start a fight ngl
I am not fighting them, however I am starting an argument since I feel strongly about the matter at hand. Unrelated to your situation as you've already decided what to do, though
you're free to continue with the video or whatever, hopefully that works out great for you
Sounds great! If you notice any errors, you can try typing that in google before coming here to ask. No matter how advanced you are in coding, you will always end up researching stuff
yee
ive had to alot when fixing plugins and stuff for the minecraft server im setting up
I did try to make an interactive tutorial/playground at one point, but I can't even begin to imagine just how much effort it'd be to emulate a minecraft server inside a site to do that
It's okay for beginners 
I guess with wasm being at the state it is now, maybe it'd be possible to just run it all on the client and hope for the best
We should ask md_5 to make tutorial vids ngl
I dont think there can be a perfect tutorial. People learn differently and perceive info uniquely. A teacher would have to make a couple videos of the same output but seperate methods
Some users have bad comprehension in text. While some have trouble following visuals and must read over and over.
theres no JavaPlugin
This is why you teach by common denominator
exactly
when i was in highschool i had a teacher who would sit down with me every other lunchtime and we would code snake game together
but we called it worm game and coloured it pink
if the bar for comprehension is low, then you must teach so that the level of comprehension doesn't matter
the code is fine, you may be missing the spigot api or a setup step.
i used the same spigot jar file as my minecraft server
i thought that was what i was ment to do
im dumb
sorry
That is not the one to use, there is a specific jar for development
you dont need to restart the project again, just need to setup that dependency
either would work, the one for development just doesn't contain the server code which generally you are wanting, but the server jar contains the api as well. Issue might be setting up the dependency properly so that the IDE can import properly
or the dependency is set properly just missing imports
can't tell from the picture alone other then missing imports
keep the project you have, just watch the video again looking for where he installs the development jar
ok
so uhh the link in the description in the video didnt take me to the page they got there pluginapi from
the plugin api comes from the buildtools. https://www.spigotmc.org/wiki/buildtools/
they could just download it too
spigotmc hosts the api jar
just not the server jar
link?
yes link would be helpfull
loopPlayer.stopSound("atlantis_sounds:music.crabe_event");
Why this isn't working ?
go with the one with the highest number at the end
so 32
the number at the end is the build number
yes
it might be better if you use maven build system to manage dependencies and to build
using that setting window you would need to use ant to build
not a problem for beginning or a small project
but once you need to start shading may be wise to switch to maven
you are doing great so far. after those settings are saved, is the red gone from the code?
it worked
spark your amazing
perfect! you are all setup!
continue that video, the project is fine so far.
and soon another MC Java developer will be born to wreck havoc in the world of plugins
In that code, you will need a function called onEnable be sure to look for that in the video. every plugin will need that
That will do! make sure to get the plugin.yml finished, the video might mention it - if not then watch a different one for creating a plugin.
yep thats the next step\
to be safe, you can always press CTRL+S
haha, good habit to have
time flies
get back to that video. you are doing good
you can be happy to know, you are not the oldest in this discord server
im sure theres someone 3x older
almost!
20 is not old gng
Man you almost fossil fuel at that point
that said, dont forget to take breaks, go outside. enjoy the time you have while you still have it
what? me?
Yea
So you a dinosaur?
gang... i was born in 09
Sounds like programming traps you in an depressing cage
Dayum I'm older than u tf
only if you allow it
dinosaur
Stfu
elgar is a dinosaur
What does that mean the cage or being older??
Should I kill him or what?
well if you arent making memories, that day is erased from your time, forgotten. you cant get that day back
well, can't say your freedom would last if you do this
but, the being caged unless someone is physically caging you then I guess that is a bit different
I mean that's only if they catch you, and as an experienced killer I'd know Abt that
The memories of the frigging stack overflow in line 133 in CustomItem.java?
Maybe, depends
The memories of a stackoverflow in my text builder
Are you a fan of killing?
some would say I am
Hehe, pain
if they could still talk that is
Hm I see
Ah yes
Many could account for my skills, if they weren't in my stomach._.
well fortunately as far as rations go I wasn't desperate enough for cannibalism
A bit of salt and pepper and some bbq sauce, and they taste fine
@wraith delta :)
I hope nobody ever does a background check on me and sees any of my messages
looking awesome! keep it up, dont forget to go outside tho! development will get you stuck!
Ayy is it simple homes or dream death
I've forgotten to go outside for the past 8 years what you gna do Abt it
how tf do i do that 😭
What do you wanna do
when player dies
says "You woke up from a Bad Dream"
i did as well, but im beginning to see how fast time flies and ive been doing a lot outside. just think, if your screen broke and you have nothing...
There are events
Look into those
You'd have to look if there's a specific one for player awake or smth
?eventapi
Respawn?
the PlayerDeathEvent happens too early
Oh frick my brain screwed me
I read woke up and thought they were talking Abt a sleeping related event
nah its not you, ive lost my mind trying to do stuff with PlayerDeathEvent and it not working, turning out that its just too early
Does player respawn still trigger if players dies, disconnects, and then rejoins?
Ye then u can u respawn without worry
Instant
yee that word
Just look into how an event listener is made and then adapt it for your use case!
pretty much yea, learn about the events. ideally start with PlayerJoinEvent that one is one of the easy ones and youll know it works
@EventHandler
public void testJoin(PlayerJoinEvent e)
{
Player p = e.getPlayer().getName();
p.sendMessage("welcome");
}
```should look similar to this
i copyed that in and it came up all red (yes ill edit it)
You'll need imports
Hover over such a red symbol and it should suggest importing it
after the imports, where it says Player p = event, change that to e. i wrote it in discord so didnt catch that mistake lol
for future reference tho in the function line after PlayerJoinEvent you can name it whatever you want instead of e
look at it again
There's probably some colourblind themes for IJ, and yes, it is red
Player p = e.getPlayer().getName(); the p is just a variable that you can name anything
I'd recommend learning java first
its the "event" part thats the mistake I had, it needs to match the word after PlayerJoinEvent
remove that getName
thats correct, but i wonder if they removed getname
its to get the username. maybe getUsername(); ?
why are you trying to assign a player to a username
yes that
?eventapi now read this
1am for me, i see what you mean now XD
thats alot of reading
also black text on white is so hard to read
but ill try look through it
you can use dark reader
it's a browser plugin that makes sites use dark mode (even if badly often times)
that's only for donators though right
is it?
because I do not have any other themes I can select
oh, darn
pay to win 😭
i do have donator tho, just didnt know that was a perk since its so long ago
if it makes you feel any better, its still hard to read the code in dark mode XD
it didnt say "Welcome To QuinsimeSMP"
Did u register it?
idk what that means
try delaying by 1 tick
Did you create a class for ur eventhandler or is it in ur main class
this is all the code lmao
Okay
Normally you would create a separate class for events which is called an event handler but to keep it simple let's keep it in the main class
you havnt implemented listener
You'll need to add implements Listener behind the extends JavaPlugin
im just gonna shut up, sry 🙂
xD
sry ive been learning java for 2 weeks and suddenly i think im an expert
i have no idea how to do that 🥰
Then in your onLoad() you needs to do smth like Bukkit.getServer().register listener or smth
Like George’s pic, add the implements Listener
And then register the event in the on enable
ima be real, if you ask chat gpt to code it you get pretty good code. then u can just learn from what it wrote
thats what im doing to learn
or just ask it to tell u how to fix errors
If you are logged in and using model 4o, yes it’s pretty good
I have some example code, but it uses a separate event handler class, and you'd need to ignore a bunch of jargon you don't need to know yet
rotten flesh to leather 👀
sorry im lost
i need to install... what exactly?
import org.bukkit.xxx
its not just that lol
You don't gotta install anything
bruh
Let's go through this step by step
ok :-)
bedless the 🐐
- Change the line where you have extends JavaPlugin to have implements Listener at the end before the bracket
- In your onLoad function add a line that registers your main class as an event listener
getServer().getPluginManager().registerEvents(this, this);
Yep
im stuck on step 2 😭
just past the code in your onLoad part
You see the ```java
public void onLoad(){
System.out.println("DreamDeath Now Running")
}
Replace it with
```java
public void onLoad(){
System.out.println("DreamDeath Now Running")
getServer().getPluginManager().registerEvents(this, this);
}
I'm on phone so formatting is gna be horrible
On enable soz
so this?
so build and run server
Yep
Ayy nice
In your player.sendMessage()
You can use ChatColor.RED
Or such
That's one way
where put ChatColor.RED
- player.sendMessage(ChatColor.RED + "Welcome Back")
- player.sendMessage(ChatColor.translateAlternateColorCodes('&', a "&cWelcome Back"))
- player.sendMessage("§cWelcome Back")
This is all out of memory so some method names might differ slightly
player.sendMessage is to the players istelf
If you wanna send to everybody then it's broadcast message or something getServer().broadcastMessage()
cool
Could anyone inform me how I could change the over head nametag of a player using ProtocolLib?
declaration: package: org.bukkit, class: Bukkit
ima grab food then come back and figure out how to do the death message
Ye, but imma go xD gotta work
thanks deus
np 
Have you tried using teams?
i have, but that seems to only add prefixes or change the colour, im trying to change the nametag entirely
i believe you need to send a player info packet
nvm it looks like that's only for tab list
yeah thats the same thing I was thinking :/, like it must be possible I just have no idea how it would be
I only know the old way
PacketPlayOutPlayerInfo with action REMOVE_PLAYER
PacketPlayOutPlayerInfo with action ADD_PLAYER with a different name (perhaps through reflecting on the packet data)
PacketPlayOutDestroyEntity to all players except you.
PacketPlayOutNamedEntitySpawn to all players except you
Legit why I made a custom stylesheet for SpigotMC smh
Hi guys, in my plugin i have regular world generation when generating a plot of land for the minigame.
I wanted to add also some sort of sky islands on top of the regular plot generation..
I thought about making my own world generator to make those sky islands but im not sure if thats making things too hard..
I want to add considerable variety to these sky islands so that every game can be unique in its pvp landscape.
I never dabbled with world generation before but im willing to sink in a month or two to learn enough to make smth like that... just asking if there might be an easier way
can someone help me finish this code?
``@EventHandler
public void onTeleport(PlayerTeleportEvent e) {
Player p = e.getPlayer();
p.playSound();
}``
i want it to play a pop sound anyone near the player can hear
?jd-s
?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html#ENTITY_CHICKEN_EGG
I believe this is the sound you're looking for
declaration: package: org.bukkit, interface: Sound
which play sound do i select
because i want it to play at the location the player leaves and the location the player goes to
look over the javadocs and find the one you want.
sorry i dont know how
any one of these methods should work just fine for what youre trying to achieve, if im correct each one does the same thing just using different infomation you give it
here ill give some example code in just a sec
thanks loaf
yes, they all do the same thing, but take different parameters, like sound as String or as Sound, optional SoundCategory, etc.
the more specific, the better
Heres a breakdown of some code that would work for what youre looking for
public void onTeleport(PlayerTeleportEvent e) {
Player p = e.getPlayer();
Location loc = p.getLocation(); // Gets the location of the player
World worl = loc.getWorld(); // Gets the world of which the location is in (e.g. overworld, nether, end)
worl.playSound(
loc, // Location of where the sound plays
Sound.ENTITY_CHICKEN_EGG, // What sound plays
1.0f, // Volume of the sound
1.0f // Pitch of the sound
);
}```
im pretty sure if you did that it would just play the sound to that player, not where they are
hmm okay
does this play globaly or just to players nearby the player who teleports, the players near the going to teleport location and the player who teleports themself?
it should just play at the location, so to all players who are near enough to hear the sound
at both locations?
the new and the old
im not sure how one would go about doing that honestly, but this code would only do it at the ending location
This code would achive what youre looking for to my understanding, though i havent tested it
public void onTeleport(PlayerTeleportEvent e) {
Location startingLoc = e.getFrom();
Location endingLoc = e.getTo();
endingLoc.getWorld().playSound(
startingLoc,
Sound.ENTITY_CHICKEN_EGG,
1.0f,
1.0f
);
startingLoc.getWorld().playSound(
endingLoc,
Sound.ENTITY_CHICKEN_EGG,
1.0f,
1.0f
);
}```
ill test it in a moment
my other question is will this work?
it will but at the end of the sendMessage line you have an unnecessary ();
you should only need one ; at the end of a line
alr 👍
glad to hear that 👍 I'd recommend looking up the basics of Java, its confusing as hell for a while but worth it if you want to do more complex stuff in the future
yee when i start to code my second plugin ill look into it
thanks alot loaf
np happy to help
LOL
can you spawn a dropped item suspended completely in place?
If you were to drop an item into a hole, as a player, and refilled the hole, the item would pop up. Is there a way to force an item to not do this?
To me that sounds a lot more like modding than plugin development, from my understanding plugins change how the server reacts to certain events, but mods change how the game works entirely
so it might be impossible with plugins, but im not 100% certain wither
either*
i just misspelled either 😭
cap
If you don't want the item to interact with anything use an ItemDisplay
gng 🥀
u my saviour
it will be immutable yeah?
wdym 'immutable'
probably could with an item display?
google immutable gng
I know what immutable means in the sense of a java object
I don't know what you mean in the sense of Item Display
I meant, immutable in the real world sense.
not going to be moved, subject to being picked up
yew, display entities only display. they can not be interacted with in any way without commands
Immutable means you can’t /mute them
Remove them when they hit a block with ProjectileHitEvent
is it getEntity()
?jd-s
k
Yes
works thanks
found an issue with the code
What's the issue?
apparently leaving a boat is considred teleporting
so the pop sound plays when you leave a boat
You'd want to check the teleport cause
wdym
When do you want it to trigger
``@EventHandler
public void onTeleport(PlayerTeleportEvent e) {
Location startingLoc = e.getFrom();
Location endingLoc = e.getTo();
endingLoc.getWorld().playSound(
startingLoc,
Sound.ENTITY_CHICKEN_EGG,
1.0f,
1.0f
);
startingLoc.getWorld().playSound(
endingLoc,
Sound.ENTITY_CHICKEN_EGG,
1.0f,
1.0f
);
}``
this is the code
would it be a simple line to add?
um
that code is fine if you are teleporting in the same world
but cross world it will play sounds in the wrong locations
we already have that
we have both
You mixed smth up there
You have to switch around the locs
Currently you play a sound at the starting location in the ending world and vice versa
but it still works?
only if in the same world
oh i get it now
just make it
startingLoc.getWorld(),playsound( startingLoc...
and
how do i change the max stack size of enchanted gaps to 16
endingLoc.getWorld(),playsound( endingLoc...
yep
okay easy enough
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
Vanilla has had it since 1.20.5
Not sure about API
Pretty sure the api has also had it since 1.20.5
What is a unique value that every skin has? So that I can check, for example, whether a player has exactly the one skin
the skin texture value
I have tried this, it is the same in a few places, but not in many others
Value 1:
ewogICJ0aW1lc3RhbXAiIDogMTc0NjQ0NjM0ODc0NSwKICAicHJvZmlsZUlkIiA6ICIyYzRlNWUyNjMzYWY0MjU4OWJlMGRkN2NjZDVjMzhlOCIsCiAgInByb2ZpbGVOYW1lIiA6ICJGZWRveCIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81ZmYxMTA3Zjg4NmNjODgwYWY5ZWVkMjJjM2UwYTRkMjdhZjM4NmM4NTA2ODBlYzExNDlmMzc1YTZlMmMwYTAxIiwKICAgICAgIm1ldGFkYXRhIiA6IHsKICAgICAgICAibW9kZWwiIDogInNsaW0iCiAgICAgIH0KICAgIH0KICB9Cn0=
Value 2:
ewogICJ0aW1lc3RhbXAiIDogMTc0NjQ0NjMwMTIwOCwKICAicHJvZmlsZUlkIiA6ICI0NjZhNmFlZDg0Mzc0MDcxOGRjNmE2OGRiMmZiM2M5ZCIsCiAgInByb2ZpbGVOYW1lIiA6ICJUaW1vbGlhU3BpZWxlciIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS82NTg0ZDEwNzE4NTRkMDY4NWY4ZmRkNDM3MTY3NGZmYjk1ZWNmYjA2ODEwMTQ1ZWEzODk1YTY0YzNiZmVlNzcwIiwKICAgICAgIm1ldGFkYXRhIiA6IHsKICAgICAgICAibW9kZWwiIDogInNsaW0iCiAgICAgIH0KICAgIH0KICB9Cn0=
well that's the skin texture encoded into b64 (iirc)
So it's not the value from textures?
Player skin textures are encrypted through mojang servers and (could) take factors including account id into the equation, so theres no guarantee two of the same skin pngs will result in the same skin texture value
extremely whack
damn
thats why inventive talent's MineSkin uses a bot account
the value in base64 is just an encoded web address
yeah it's a bit funky having to do that
the server never sees nor uses the texture itself. It just tells the client where to find the texture
I was thinking of integrating that into my NPC stuff for my game engine but kinda cba

well its a url wrapped in a bit of json
more like michaelsoft actually
I wonder if that url can be changed or if theres soem verification on client side
but yeah, profile Id and name are baked into the texture string
I thought the Skin Signature would at least be unique
truee I wonder whether the client verifies the signature
the signature checks the property value,
Can i ask here for resource pack problems and spawning?
Spawning?
hey how to repond to chargeback saying item not recieved. i dont have data because as soon as he raises chargeback, the resouce access is revoked by spigot. is there any way to prove it @vagrant stratus
This means that it is not possible to simply compare a skin without making 2 requests to the API and then comparing pixel by pixel?
I know a bit, whats the question
@drowsy helm
models/item not object, deepl problem
{id:"minecraft:paper",Count:1b,tag:{CustomModelData:10001,display:{Name:'{"text":"Test"}'} }
This is not the correct format for few versions now too
Do you have a json for the item in the items directory aswell?
You're running on outdated information
if mojang does not deduplicate skin URLs, yes
this one?
You do not need CMD for this simple thing, use the item model component instead
no need to override vanilla item model definitions
I would like to keep the original structure, but with a different modal ID I would like to get a different model. But somehow that doesn't work
I would highly suggest using item model component instead of custom model data for these simple models
It makes everything so much easier
And go through the vanilla changelog to see what changed or use wiki, stuff there is fairly well documented.
You can also take a look at how vanilla does stuff, either unpack the vanilla jar or look here
Ok it works but how can i spawn a armorstand with an item with a item_model?
What is the exact command?
use this https://mcstacker.net/1.21.4.php to generate the command
And if your problem is solved, please resolve the help request on the MCC discord server @ashen wren
But where do I set an item_model for summon? Sorry, the page is confusing for me.
On the right you select what component you want and then press + to add it
Then you can configure the component
This is the resulting command
/summon armor_stand ~ ~ ~ {HandItems:[{id:"minecraft:paper",count:1,components:{"minecraft:item_model":"my_custom_model"}},{}]}
yes, make the model itself bigger
or change display size in display properties
this
Oh!
You should be using Item Display Entities for this thing probably.
If the only thing you want to do is to show something.
I currently use armor stands. Can I also apply the model to a block that changes its model when placed, since item_model is different.
I do not fully understand what you're asking.
Item models and block models are different. But I believe the answer is no.
You do not have such freedom with block models as you have with item models.
So there is no way to do an override for blocks that I get a different model?
But how do I get it to look like a block that has been placed with items?
You can use blocks that have many different (or unused) states
Like noteblocks
But you can't have transparency with noteblocks and there's other issues..
Position it correctly.
So I would have to change the position in the hand so that it looks like a block has been placed?
Btw, are you making a plugin at all ?
Or just doing commands :D
Uhh it would be best if you did use the item display entity
It gives you much freedom in many things and is most performant TPS wise
Would like to make a plugin for this... I don't like ItemsAdder.
Do u mean item_display?
probably
[WARNING] 'dependencies.dependency.systemPath' for org.spigotmc:spigot:jar should not point at files within the project directory, ${basedir}/library/Spigot-1.16.5.jar will be unresolvable by dependent projects @ line 77, column 23
The more you know about spigot
I mean
pom
That's not how you depend on Spigot at all!
I forgot the command that tells you what to do
?maven
Yeah I know
or if you're trying to use NMS
Build tools
?nms
it takes like 2 minutes per version
yeah but if you are using a potato to run a server
if you are on windows, make sure to add build tools to the exclusion folder list
Then don't use a potato
a single version download takes more time than downloading gta 5

ill try using raddish next time 😔
I am using a potato and it doesn't take long
I mean, what are you downloading these versions for
if it is for NMS, all you have to do is run build tools, preferably with the --remapped flag so that it gets dumped into your local maven repository
Yeah
it wasn't a yes or no question lol
well then you don't have much of an option, it's either that or just invalidating their impl and using a reflection-based one for the time being
you could just forget about the versions you don't want to support by removing them modules from the pom
I don't think defender has ever detected it as malware for me, but then again I had defender disabled most of the time back when I had windows
it just slows down things like build tools a lot
I love false positive
Who uses winddos anyways lol
cause
dad has stored some important stuff
and he isn't here rn
ideally you'd have everything in a dev drive so that defender doesn't try to scan on every file creation but it all ends up the same
why windows defender so weird
it is the only thing anyone should use for virus detection
I use kasperky
I've used all AVs in teh past. personal and corporate and they are all bad
I find a lot of stuff will give false flags on some of the more “sketchy” stuff
kasp isn;t bad unless you are using it in a corporation install, then its a nightmare
Like they were paid to flag some of it
yep, I only use defender now and I've had no virus in 15 years
i remember i used to have some goofy ahh chinese av that flagged itself every hour
Lol
i don't remember what it was called, but it had a panda logo
then again I don;t download torrents or visit dosgy sites
and all the text was in chinese
Can u read chinese?
Smh
i thought about this a bit at work and i think this runs into the same problem as my approach, except this trades off worst-case time complexity for worst-case space complexity in the pathological cases
in the worst case this will degenerate to the same space complexity as the naïve hashmap solution, i.e. your tree structure will become untenable
the tree has a fixed depth of 9, but the degree is only limited by the number of materials in the game
suppose there are n materials in the game, and we start by defining n recipes that require an unique material in the first slot
the degree of your root node is now n
now suppose we define one additional recipe that also requires, say, dirt in the second slot
now we have n2 nodes but only n+1 recipes
now suppose we add a few more recipes that take a few different materials for slots 3 4 and 5, and the worst case is already larger than will fit in memory
why world.getUID() not world.getUUID()
Why the fuck am I everywhere?
Did you eat a granade ?
?ischocoreal
No, Choco is not real. I was not programmed to say this by Sam.
W sam move
single abstract method
I use the following:
The buyer purchased a digital product from me on SpigotMC.org, specifically the resource titled “<resource_title>” (Transaction ID: <transaction id>) The product is automatically delivered to the buyer's SpigotMC account immediately after purchase, allowing them to download the software directly from the website. Due to the nature of this transaction, as an intangible digital good, the item is non-refundable once accessed.
Link to the product: <link here>
I kindly request that this dispute be reviewed with consideration of the fact that the buyer has already received the digital product in full.
Thank you for your attention to this matter.
should work in your case
git pull does nothing?
Hi, i know 1.8 is an outdated version but is it possible to run it with JDK 21? The plugin ViaVersion requires JDK 21 and when I run with JDK 21 I get this error 100 times per second:
[18:54:19 WARN]: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.RuntimeException: Unable to access address of buffer
at io.netty.channel.epoll.Native.read(Native Method) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.doReadBytes(EpollSocketChannel.java:678) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:714) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe$3.run(EpollSocketChannel.java:755) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:268) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
at java.lang.Thread.run(Thread.java:1583) [?:?]
Paper doesn't maintain 1.8 versions
PandaSpigot I believe is one
but then again you really should update to 1.21.5
Thanks!
Well I want to but I want to have a pvp server and really need the old pvp mechanics
Idk but downgrading back to 1.8 seems the only feasible thing to do
You can disable the attack cooldown in modern versions
Oh thanks I didn't know!
bit more context ?
It suggests you run git pull
define "it"
scroll... up?
in the picture
if its a copy of the repo I'm assuming it's supposed to be up to date
how much do I have to scroll up ?
that depends on your screen resolution
You have not sent any pictures here for at least half a month
but if you just cloned, yes git pull will do nothing most likely
They were talking about ShadowOfHeavens image right above their message
Aaah sorry, I misunderstood
sorry
just found myself debugging code without bothering to look at the console for stacktraces
life is beautiful
kekw
fr?
run git status
you can't push?
well fetch first then
you can't push to a repo that has commits ahead of you
Force Push
Can you make entities glow hex color codes?
I have it working for normal ChatColor using scoreboard teams; it uses org.bukkit.ChatColor which doesn't implement hex, is there another way?
no
did you fetch
the only exception are display entities, but not otherwise
That's a minecraft limitation
why is she single 😢
making my second pluin, might need some help
ive made the base plugin but havent started the EXP spawning rule
how would i go about that
BlockBreakEvent or something
Depends on how you want it to work
uhh so
also hi olivo
i fixed the bug
anyways
summon exp orb with a value of 1exp point at the location a fully grown wheat/carrot/potato.etc is broken
So if you break that down you need to:
First check if it's a crop, then check it's age and if it's the max amount spawn an exp orb.
Convieniently Minecraft (and therefor Spigot) already comes with a tag for all crops; It's called Tag.CROPS.
To check the age of the crop you need to cast the blockdata to Ageable (make sure to get the right import, there's two of them)
Lastly spawning an exp orb can be done with World#spawn passing in ExperienceOrb.class as the entity class
Alternatively you could jus give the xp directly to the player
I recommend you take a look around the javadoc and get familiar with how it works
?jd-s
Right now's the time when the Javadoc is useful
theres no crops
If you look up the Tag class you can read about what methods are in it and what they do
Use the searchbar in the top right of the page
Hm? That's not quite what you need to do
A bit more than that
You want to check if the block that was broken is a crop
Tag.CROPS contains said crops so you need check of the block you broke is part of it
ohh so find if its a crop first then see if its RIPE
Yes
Not sure where you got that extra BlockBreakEvent from
Also you want to see if the tag contains the material of the broken block
Not if the type of crop is RIPE
i cant fucking do this 😭
RIPE is not a material it's a state that the crop can be in
Closer but not quite
You want the material of the block you broke
And see if that's part of the CROPS tag
Anyways I'm off to sleep now it's a bit late for me
oh shoot
i know what to do
okay ima stop untill someone can help me
im very lost
ping me if ya can help
You can start with something easier to get the logic down; like Scratch for example
After that I suggest looking at a couple Java tutorials
the kids website?
Yes
It is a useful tool to learn the logic required to break things down
This could help, it goes over the basics of Javas code, I wish I saw this before I started working on plugins 😭
It goes over most of what youll deal with in java
youre close but still not ther exactly
i watch yt video
then do this
}```
this is how if statments are structured, you need the () to hold what youre checking for, and usually {} for the code to execute
omg this is 6 years old
"code looking stuff"
dw unless youre watching a video specific to plugins then it being that old should be fine lol, im pretty sure java itself is like 30 years old now
thats close but you dont need the do(spawn), because you put the code in the {} just like how the event itself has them that you put the code in as well
so its more like this
if (Tag.CROPS.isTagged(Material.WHEAT)) {
// code here
}
yes before you execute a method (a method is just code that can be exucted whenever you call it) you need an object
I think you need a world object
so you spawn the entity in the correct world
yes you do, the event would allow you to return the block that broke, and therefor the location of it
here lemme write and example rq
also dont worry if you dont get it right away Java is hard to learn for the first time, it took me a while to fully understand 😭
// An object is usually not a literal object like how a block is or an item
// Its more so a container that can hold data, like this
String message = "broke a block!";
// Even though of course it's not something actually in the world, Java understands this as an object
// World, String, Player, are all different object types, and they hold different data and function differently
Block brokenBlock = event.getBlock(); // This gets the block object from the event, or the block that was broken
Location location = brokenBlock.getLocation(); // This gets the location of the block
World world = location.getWorld(); // This gets the world the location is in (e.g. overworld, nether, end)
world.spawnEntity(
location, // This is where the entity will spawn
EntityType.BAT // This is the type that will spawn
);
}```
to my understanding this should work
so what you have put will summon a bat
and Sting message = "Broke a block";
will say it in the console
so thats optinal
optional
its just an example of an object and isnt refranced anywhere else in the code
so if you removed it nothing will change
i copyed it in
but theres a red word
and also it wont check of it is fully grown right?
it shouldnt, I wouldnt exactly know how to either honsetly
im pretty sure that the event is set to e for you right?
oh yes change event to e
Then it's e.getBlock()
Also why create a string if you aren't passing it? or are you passing it?
i was just making an example of what an object is
Ageable and getBlockData
not sure
it looks not important
its not dw
also it works i just used the wrong event
youd need the BlockBreakEvent
Ageable ageable = (Ageable) block.getBlockData();
if (ageable.getAge() == 7) {
}
Something like this
why 7
ages for crops seemed to be saved as a integer, so 0 would be youngest I assume
also that is deprecated, so it could be removed from the API soon
