#help-development
1 messages · Page 977 of 1
It'll be under assets/textures/entity/trident.png or something like that
I know where it is but idk where to find the thing to edit it
I don't know what you mean
You can only override the one texture by replacing it with a texture pack
How are you doing choco?
Yes. You've already overridden it. That's literally all you can do
You would need to make a resource pack that has the /assets/textures/entity/trident.png texture to override that one
Open it in your image editor of choice, edit to your heart's content, save as new file, setup a resource pack
tfw you use a java version that actually assigns an amount of memory that is based on how much memory your pc has
specifically, 25%
💀
tfw you don’t have hardcoded values in your startup command
name?
https://gist.github.com/Geolykt/7a31413afb387bcde59fc11eef809949 what exactly is the bug within this code? More specifically the code is hitting the retry limit in production (which is a GraalVM JVM, so it could be caused by that but I'd not instantly go to blame it)
? why are you making new entity dimensions
hitboxes
Ah I see it, if (softRecord2 != null) { is an inadequate check as I'd also need to check whether the SoftReference was freed
reflection to make new instance of private constructor >>>
bad pratice? Never heard of that
yipee
ty
There you go. Glad we got that figured out :p
if (softRecord2 != null && (cRecord = (softRecord = softRecord2).get()) != null) { that may be the worst code I've ever written
what was the mapping website again
thats why I added a toggling feature to my 96^64 particle spawning method :p
x)
View mod dependencies; Search up mappings; All on your web browser instead!
this one has been updated
great method, 10/10
a bit tricky but does the work
also a bit tricky but does the work
Looks like an english assignment from 4 years ago
can somoene link me the website with the thing
actually that is easily explained by the fact that it is the wrong "fix" (actually making everything worse) lol.
Good thing eclipse's null analysis kicked in
I got it, the mappings website
ty
thankfully i dont have to work with 1.20.5
im scared for the nbt changes
no ?mappings smh
That one doesn't seem to support Spigot's mappings, which is annoying
yeah, but for 1.20.5, Mojang Mappings are better?
I have nothing with spigot, it's pretty cool renaming ONLY classes
looks like IT DOESN'T WORKS
were is this class...
true
why...
well, my code is bad lol
"my code"
Yes, I agree, I'm just saying that you can't compare mappings like you can with cephx's mappings website
We still have some remnants of CraftBukkit mappings in source
"our code" 🇷🇺
Wait until you see my new fork that runs mojmap at runtime and access transforms everything to public non-final
10/10
yeah, this one is MUCH better
tell me when you bring that to life, can be interesting
Ignite
the last thing I have to wait in my entire life is for cephx to update his mappings...
It has access wideners too :)
It's used to change the visibility of methods/fields/classes
oh I see
like widen access
like with mixin then
I'm not english native, so a bit too complicated word and I'm lost
yeah I see. thank you 😄
WHAT
?
Yeah but you still have to write code for that, terrible!
lol
smh just provide a widen all things file
can you make spigot plugin dev like Scratch please?
so no need to "code"
for those nostalgic persons who thinks that "coding with complicated words and types" is the future
GPTSpigot
I asked ChatGPT about spigot one time.
only one time.
because it was the "too much" time
oh...
Yeah it exists
ExcelBukkit
Is there a way to induce the overcast of setStorm without making it actually storm
Desert biome?
Yeah, biome is really the only way
Erm I can't force biomes in this case
https://gyazo.com/b14f3de344fe4ab2ca86127a4e7a9445
What do we think of this? (cherry leaves are the only particle I can think of)
@lost matrix I'm gonna start coming up with a proper nice redis-backed database system tomorrow
I figured you might want to guide it a little bit
So stick around
👀
Ouh sounds fun
Main requirements I'm gonna mandate:
- Support for all kinds of relational and non-relational databases, with support for custom queries regardless of type
- Codec system for non-relational database
- Redisson instead of jedis even though I hate dependencies
- Optional redis middle layer for caching results and improving latency, as well as locking.
I have a boss that spawns in an arena which players can then view health with a command, an instance of the entity is saved by LivingEntity reference in a class, the issue is when the chunk gets unloaded it becomes messed up and starts referencing an invisible entity (assuming the one that unloaded and doesnt update to the new replacement) how can i get around that
https://prnt.sc/lX-J4N37MMGi can i have some help here can some one say me the placeholder command here like i give 15k to buy the kit and the message i add in deluxemenu send the new balance
(- $15,000 1x tier 1 kit (the balance i have 23,000 befor the buy and the 8k after the buy)
Both would be better than one.
Hello! Follow up to my earlier JIRA. sendSignChange() no longer throws an exception but now seems to have no effect
I'll file a new one. Using the same code as last time, no exception but nothing seems to happen. Same code works as expected on 1.20.4
make sure you include what event or how you're doing it. I did see some glitchiness, but I put it down to the interact event causing a block update
md_5, I also updated the plugin that tests the issue
The plugin is BlobRP, but it depends on BlobLib. I uploaded both jars
Sorry for requiring both jars, I was on a rush 😬
🤔
The request is to create a 1 class plugin which clearly shows the issue.
If you don't do it, someone else will have to in order to find the issue and test it
We don't know if it's a bug in spigot or your thousands of lines plugin with no instructions
See release announcement
I built NMS using the --remapped flag but still the methods are like a, b, c, d
hey I have a question, can someone tell me why you can still take items from the GUI xD the console gives me no error at all :/ https://mclo.gs/TGE017W
Java: 17, MC: 1.19.4
?gui
I just uploaded a one class plugin
Also the source
Thanks
"MUSHROOM_COW" has been replaced with "MOOSHROOM"?
Yes?
Not all methods are remapped and from what I know sometimes you need to specify you wanna be using a remapped jar
which packet can I send to change player's lives to hardcore while he is still in game?
why if i try cancel async bukkitSholderTask this always return error in disable method - https://paste.md-5.net/uquciwaguw.java
@mellow edge ClientboundLoginPacket is the packet
I had a similar issue before, please ping me if you find a solution
while in-game I can send this packet?
I found the problem. It is not possible to start an asynchronous thread before turning off the plugin, strangely enough
i don't know, change world maybe?
fake change*
maybe
but this was indeed the only packet that contains hardcore from what I saw in protocol wiki
I also don't think anyone will need a new task for something while disabling
why doesn't ChunkSnapshot save chest data??
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
like that?
Im kinda stuck rn. Im trying to make a gui open up when I enter a portal. (Not a Random TP location or Nether)
public void onPortal(PlayerPortalEvent event) {
if(event.getCause() == TeleportCause.Nether_PORTAL) {
event.setCancelled(true);
event.getPlayer().openInventory(portalGui.getInv());
players.add(event.getPlayer().getUniqueId());
}
}
@EventHandler
public void OnInventoryClose(InventoryCloseEvent e){
players.remove(e.getPlayer().getUniqueId());
}
}
My guess is that the client will forcibly close any gui if the player is in a portal.
you'll need a repo to pull the dependency from unless it's internal
I could make one out of water but what do i put for the event.
i downloaded the repo, how can i implement it?
I don't think it has any methods for tile data?
i mean blockData not save chest data if this chest?
yes
Does someone know the unicode of this?
I want to put it in a message in my plugin if there isnt any player nearby
But i cant find it anywhere
Nvm finally found it 🎉
✗
x
Press ✗ to doubt
y
y not
Probably a y with a shifted and scaled \
lol
How can I run some code every game tick?
?scheduling
Is there a way to get the blocks a player's hitbox is colliding with so I don't have to do this 💀
https://pastes.dev/sCKYDpSazQ
brother in christ 😭
use a 3-dimensional for loop to iterate over every block from start to end of the bounding box and get all the blocks in there
use a set because you'll get dups
go at 0.49 block increments to make sure you get all of the blocks
You can surely write this without getting dupes
Player#getBoundingBox
maybe
I've always been searching for Player#hitbox
kek
public List<Block> getIntersectingBlocks(Player player) {
World world = player.getWorld();
BoundingBox box = player.getBoundingBox();
int minX = (int) Math.floor(box.getMinX());
int minY = (int) Math.floor(box.getMinY());
int minZ = (int) Math.floor(box.getMinZ());
int maxX = (int) Math.ceil(box.getMaxX());
int maxY = (int) Math.ceil(box.getMaxY());
int maxZ = (int) Math.ceil(box.getMaxZ());
List<Block> blocks = new ArrayList<>();
for (int x = minX; x < maxX; x++) {
for (int y = minY; y < maxY; y++) {
for (int z = minZ; z < maxZ; z++) {
blocks.add(world.getBlockAt(x, y, z));
}
}
}
return blocks;
}
Try this. Didnt test.
1s
only works when I tp myself 0.0001 inside the block, because the hitbox probably never touches the block it needs a bit of margin for error
Then just call box = box.expand(0.001)
Works perfectly thank you 🤝
way better than my 106 lines..
in 1.20.5: NMS' ItemStack#save(...) method now requires a HolderLookup.Provider as parameter instead of a CompoundTag - does anyone know how to acquire one?
yeah I've been searching but couldn't find anything yet lol
I have problem do you know why i cant do commands
when i type /kill sd
it shows
An internal error occured while attempting to tab-complete
?stacktrace
We cannot help without the full stacktrace; Please paste it here: https://paste.md-5.net
You cant use this command because an internal error occured while it attempted to tab-complete
how to fix
Fix the error
how do i find the error
Is there any error in the server console ?
this is in console
Update/Remove Essentials
Hi! I have a 1.19.4 server with ViaVersion to allow players from newer versions to connect. As I have a RPG server, I require a texture pack to be sent to players on join (I sent it with Player#setResourcePack(url, hash, force)). The issue arises when a 1.20.4 player joins into the server, for some reason, if they join with the "Server Resource Pack" option set to "Prompt", the resource pack is sent correctly and they can apply it by accepting it, however, if they join with the option set to "Enabled", they don't recieve texture pack requests. This is strange as this doesn't happen with 1.19.4 players.
Does someone know why could this happen? Could this be a ViaVersion problem, or a 1.20 client problem?
My plugin is developed with the 1.19.4 API
Tested with 1.20.4 and 1.19.4 Vanilla (may also happen with 1.20-1.20.3 versions aswell)
RegistryAccess extends HolderLookup.Provider, you can acquire it from the server/level/entity
generally "see how the game calls it" is a good approach when working with nms
hm I don't find anything useful inside those two to get a Stream (or whatever) of RegistryLookup(s)
it returns a RegistryAccess.Frozen which extends RegistryAccess which extends HolderLookup.Provider, which is the parameter of ItemStack#save
hm yeah thx but how am I supposed to get an ItemStack as CompoundTag? I mean sure, I can just throw the RegistryAccess into nms ItemStack#save, but - I just need it as compoundtag or sth else that I can easily turn into a String and load it back
it returns a Tag
Damn i‘m blind. Thx
?learn-java
btw is there now a way to make items glow without hacking custom enchantments into the registry? did I dream this, or did they add some dummy enchantment or sth like that?
(and without adding unbreaking + itemflag or other hacks ofc)
there is a data component for that, yeah
enchantment_glint or w/e
/give has cool autocompletions now for the component names
thanks!
last question: There used to be (NMS) ItemStack.of(CompoundTag), any replacement for that? The method is now gone completely
enchantment_glint_override
great, thx
:<
hm guess I'll just switch to JsonConfigurationSerialization for this
then it won't match the "vanilla builtin snbt" but at least it's working
aren't there api methods for snbt?
or, well, not snbt anymore :^) given that the output/input of those are now component strings
I'm currently stuck here
@Override
public String itemStackToJson(@NotNull final org.bukkit.inventory.ItemStack itemStack) {
ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
RegistryAccess access = NMS.getServer().registryAccess();
Tag tag = nmsItemStack.save(access);
return tag.getAsString();
}
@Override
public org.bukkit.inventory.ItemStack itemStackFromJson(@NotNull String json) throws Exception {
final CompoundTag compoundTag = TagParser.parseTag(json);
final ItemStack nmsItemStack = // ?;
return CraftItemStack.asBukkitCopy(nmsItemStack);
}
I know that ItemMeta.getAsString() exists but it returns sth else than the compoundTag.getAsString() and I need to parse the result of that
you'd do the reverse of ItemStack#save, so something like ItemStack.CODEC.decode(...)
yeah I thought that too but no clue how to turn the CompoundTag into thise Dynamic thingy
whatever #save does but the other way around
ItemStack.CODEC.decode(provider.createSerializationContext(NbtOps.INSTANCE), tag).getOrThrow()
the registry thing is probably important :d
oh man it does work fine... except that the serialized and deserialized items are not equal lmao
[16:02:44] [Server thread/ERROR]: Itemstacks are not equal:
ItemStack{WOODEN_SWORD x 2, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"","extra":[{"text":"JeffLib NMSTest Item","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"red","bold":false}]}, PublicBukkitValues={
"jefflib-nmstest-plugin:prevent-stacking": "c4094d98-7efb-42e3-a41e-03648ee0633b"
}}}
vs
ItemStack{WOODEN_SWORD x 2, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"","extra":[{"text":"JeffLib NMSTest Item","obfuscated":false,"italic":false,"underlined":false,"strikethrough":false,"color":"red","bold":false}]}, PublicBukkitValues={
"jefflib-nmstest-plugin:prevent-stacking": "c4094d98-7efb-42e3-a41e-03648ee0633b"
}, custom=H4sIAAAAAAAA/wXBQQ7CIBAF0FmaLnsGE1eTUCG1dekJXLkH/DQjlDQyeH7fG4gGGp89FImPnrPoy5eOdqLLBykVCVz3pmjKR+mb1PvxxQ9VuamPWepG5+jM6t7rwjekwO4Ky95NYGNntwBmtjYQ/QG4oqUjagAAAA==}}
It adds the stupid "custom=..." part when deserializing it
the output of itemStackToJson is {components:{"minecraft:custom_data":{PublicBukkitValues:{"jefflib-nmstest-plugin:prevent-stacking":"c4094d98-7efb-42e3-a41e-03648ee0633b"}},"minecraft:custom_name":'{"extra":[{"bold":false,"color":"red","italic":false,"obfuscated":false,"strikethrough":false,"text":"JeffLib NMSTest Item","underlined":false}],"text":""}'},count:2,id:"minecraft:wooden_sword"}
"prevent-stacking" is for test purposes only i suppose ^^
the whole itemstack is for testing
I know that I can prevent stacking with 1.20.5, but that's not my issue
A bit more colors and a white background and your IDE looks like eclipse
I wonder where that "custom..." part is coming from - is that from bukkit/craftbukkit or from NMS itself?
looks like it just appended a "custom" tag with some Base64 stuff in it
the custom_data data component? or what?
I gotta go to the store now, when I come back I'll check whether the NMS itemstacks are equal (so ignoring CraftItemStack.asBukkitCopy)
that is where vanilla now stores "unknown" data as straight up nbt
and is where the pdc is stored
that is 100% intentional
but the again-serialized deserialized data is exactly the same as the original serialized, except with the appended custom part
so I wonder what that "custom, unknown data" is supposed to be
Decoding this just shows some gibberish
shouldn't the "custom" part either be included in the original ItemStack.toString(), or not show up in both?
the NMS itemstacks seem to be equal, seems to only happen after calling CraftItemStack.asBukkitCopy
[16:13:18] [Server thread/INFO]: {components:{"minecraft:custom_data":{PublicBukkitValues:{"jefflib-nmstest-plugin:prevent-stacking":"6bfb6302-c3f9-4f25-aab5-04923057b5a5"}},"minecraft:custom_name":'{"extra":[{"bold":false,"color":"red","italic":false,"obfuscated":false,"strikethrough":false,"text":"JeffLib NMSTest Item","underlined":false}],"text":""}'},count:2,id:"minecraft:wooden_sword"}
[16:13:18] [Server thread/INFO]: {components:{"minecraft:custom_data":{PublicBukkitValues:{"jefflib-nmstest-plugin:prevent-stacking":"6bfb6302-c3f9-4f25-aab5-04923057b5a5"}},"minecraft:custom_name":'{"extra":[{"bold":false,"color":"red","italic":false,"obfuscated":false,"strikethrough":false,"text":"JeffLib NMSTest Item","underlined":false}],"text":""}'},count:2,id:"minecraft:wooden_sword"}
NMS itemstacks / compound tags are the same (first line is serialized item (itemstack -> compound tag -> getAsString), second line is turning it back into a compound tag, then itemstack, then compound tag -> getAsString again), so it must be sth wrong in CraftItemStack.asBukkitCopy
are you toString'ing the bukkit IS?
customTag seems to be where the pdc is serialized to (the custom_data component), it doesn't seem like it removes the pdc from it when obtaining it, so the pdc is basically serialized twice? once as snbt, twice as base64'd nbt
but if it contains any other non-pdc data it will be stored there

I found this plugin
https://github.com/bartenbach/FoundDiamonds
It works on 1.20.4 but I need to figure out how to modify it to work with deepslate diamond ore.
When I try to add deepslate_diamond_ore to the config nothing happens
The repo is pretty old so I doubt the original creator is going to be adding said functionality anytime soon
I guess so
long long time ago
I would mod it myself but idk anything about making or editing plugins haha
Do you get any of those messages for deepslate diamonds?
You need to get one of those two messages when you enable the plugin.
Check which one it is
Maybe compiling it with a bumped spigot version would work? It's coded against 1.13.2. Though if you're running a proper version then the implementation of Material should work properly... Idrk I'd compile against 1.20.4 or whatever you're using and see then
where would I look for this?
In your console or log file
Why does one use sout and the other uses logger 🤔
im assuming there is not a way to check of AttemptTameEvent?
At the end, sout is redirected to Logger#info
AttemptTameEvent?
is that a thing?
no
Then just check PlayerInteractEvent with necessary conditions
fair enough
PlayerInteractAtEntityEvent?
Welp... time for you to rewrite this plugin. Should be done in an hour or so if you have experience.
hmm is there a website full of tamable entites and their required items?
I have literally no experience
I write HTML which isn't even a programming language
In that case you might want to look for a newer version of this
minecraft.wiki probably has all you need
I've spent the last 3 days trying to find one
but to no avail
do I just copy that line of text and replace DIAMOND_ORE with DEEPSLATE_DIAMOND_ORE
and rebuild it?
might want to check for ||
I'm not getting this for staff or admin purposes
I want all players to see a simple message showing how many diamonds they found
makes it easier to know if there are adjacent diamonds
I just need to edit the plugin I already have and add deepslate functionality
As far as i can tell, the plugin should work with deepslate ores if you just throw them in the config
I did that
still doesn't work
I assume because it was built with a version of spigot where deepslate wasn't even a concept yet
how do i set the owner of an ocelot
not always the case if the plugin was programmed in a certain way
You're using Spigot 1.20.4 on your server, its implementation of Material should recognize deepslate perfectly fine
Check if the entity is an instance of Tameable, if so, cast and set the owner
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Tameable.html
declaration: package: org.bukkit.entity, interface: Tameable
well it doesn't so
so why does Ocelot not extend Tameable
Depends if it's (the plugin) running in legacy mode
what
not having it's api version set
Oh I see
that used to be the case like 7 years ago
^^
until they added cats as a separate entity, they spawn in villages now and those can be tamed
And now ocelots do… nothing
yall remember the release of 1.13 it was wild
Poor things got done dirty
meow
nice docs
#JusticeForOcelots
Works for me
yes I removed all of the other blocks from the config because I just want diamond ore
the problem is there is no deepslate
when I add deepslate
nothing happens
I'm assuming the plugin doesn't know what deepslate diamond ore even is
that asterisk looking sus
pretty sure legacy plugins can't get new materials from valueOf etc
only the LEGACY_* ones
Ocelots are just cats but they tame humans instead of being tamed
Why not
because
this is frustrating qwq
easy fix
Dis why you add api version
It should be an easy fix, just compile with 1.20.4 as version
idk how to compile plugins that's the problem
open .jar
Just dig into the jar file and change its plugin.yml
^^
There are quite a few more issues
Well fuck
and then delete the META-INF folder uh oh wrong thing
Or change spigot src to auto-detect api version 😈
tf is a SensibleTrapBlock
Anywhere without indentation
I think api-version: 1.13 should be fine
Put it at the 8th line
If it doesn't work, then it's because I'm dumb, and you should try using 1.20 instead. But I'm pretty sure 1.13 just works magically most often
It does, setting upper version is usually because you are using API which was added after 1.13
There you go. Fixed it for 1.20
For legacy material support is just fine
Pro-tip: don't download .jar files from strangers, unless they're smile or optic
how do NBTTAGS work in 1.16.5+? like changing armorToughness for an armor piece etc
fr??
yes? lol
uploading and starting server now
Items or entities?
In spigot you never tinker with the nbt tags manually. Simply use the ItemMeta methods.
items
I wonder what kind of world we would be in if API's weren't a thing
yeah thats what im using and im trying to update my 1.12.2 plugin to newer versions
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
CTRL F "attribute"
alright thanks man doing this really sucked in legacy versions
bruh
it still doesn't work
😭
When do we get a howoldisminecraft.com/<anyversion>
Do you get the materials in console?
Please ensure the spelling: DEEPSLATE_DIAMOND_ORE
Did you get my fixed jar?
it's literally the one you sent to me
I misspelled it
I went in and fixed it now it shows in console
lets see if it works in game
😄
tysm
yay
yes, the result from above is Bukkit's ItemStack#toString after I checked that they're not equal
I wonder if it works for ancient debris as well
Works for every block in the game
Cool pfp btw
thanks

Uhh I have no idea if this works but you can try it out
can i change this property of an item on my plugin?
That just looks like a lore entry
this is the name of the propierty?
idk what this is supposed to mean...
I added some attribute to armor but it take a way default MC armor attribute is that intended? How can I prevent that?
whats the best way of setting block in a bigger area at once?
like say a 50x50x25 area
yes, you would need to account for that
Material has a getDefaultAttributes method
thanks that ezy fix I will just loop true them and add it to armor.
How do I give myself an amethyst shard with custom model data?
Make itemstack
get meta
setCustomModelData
set meta
add item to player inventory
code
ItemStack is = new ItemStack(Material.YOURMAT)
I don't code 😭
first step
Sounds like you are in the wrong channel then 
Can I not just run a command to give myself an amethyst shard with custom model data? 😭
You maybe can, but that sounds like it's under #help-server 's jurisdiction
k
looks like is not that ezy lol. when I applied attribute before the default ones was gone now its saying is have them
I need a mysql pioneer to help me with this structure
anyone willing to sacrifice themselves
Serialize everything into a giant blob and have only two columns: Id and blob
is there a god dam example of setting blocks with worldedit api (not 1.8)
but where is setting blocks
but hate to break it but that is not api thats general worldedit commands thats my problem
I was on that website to
you send the link to the normal thing
also still it doesnt explain how to get a area xyz to x2, y2, z2 and set the block inside of there
I just skimmed the api right now. It has everything you need.
The selection is a Region on which you apply a single block pattern.
Let me see if i can write a simple example real quick...
Why is this not working?
System.out.println("attributes: " + helmet.getType().getDefaultAttributeModifiers(EquipmentSlot.HEAD));
AttributeModifier healthModifier = new AttributeModifier(MaskManager.HEALTH_ATTRIBUTE_UUID, "mask_health", effectValue*2, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HEAD);
helmetMeta.addAttributeModifier(Attribute.GENERIC_MAX_HEALTH, healthModifier);
helmet.setItemMeta(helmetMeta);
System.out.println("attributes set: " + helmet.getItemMeta().getAttributeModifiers());
ItemMeta meta = helmet.getItemMeta();
helmet.getType().getDefaultAttributeModifiers(EquipmentSlot.HEAD).entries().forEach(entry -> meta.addAttributeModifier(entry.getKey(), entry.getValue()));
helmet.setItemMeta(meta);
When I will not aply default attribues only my healthModifier it will not give armor to player only healths.
PotionEffectType.HARM is actually strenght?
isn't that harming potions?
i think strenght is STRENGHT
INCREASE_DAMAGE
There you go
public void fillWithBlock(Location cornerA, Location cornerB, BlockData blockData) {
World world = BukkitAdapter.adapt(cornerA.getWorld());
BlockVector3 vecA = BlockVector3.at(cornerA.getX(), cornerA.getY(), cornerA.getZ());
BlockVector3 vecB = BlockVector3.at(cornerB.getX(), cornerB.getY(), cornerB.getZ());
Region region = new CuboidRegion(vecA, vecB);
try (EditSession editSession = WorldEdit.getInstance().newEditSessionBuilder().world(world).maxBlocks(1000).build()) {
try {
editSession.setBlocks(region, BukkitAdapter.adapt(blockData));
} catch (MaxChangedBlocksException e) {
throw new RuntimeException(e);
}
}
}
Let me know if this works
welll thats what I have now but eg I cant give it a pattern bc it doesnt take the values anyone that the api said I needed and also ClipBoard#fill is not a valid method
declaration: package: org.bukkit.potion, class: PotionEffectType
in the javadocs HARM doesn't appear, so you if you are in an outdated version you should check the javadocs from that version
What are you creating this new EditSession for, if you just get the session from the Player again
What is your endgoal. Do you want to replace a players clipboard with a random pattern or do you simply want to fill an area with random blocks, based on a players selection.
can u make custom colored spawn eggs
I'm using 1.20.1
so ye
It's "outdated"
Doesnt sound recent to me. 1.20.5 has been out for a while.
ETA on 1.20.6 pls or riot
I want to fill a area (the players selected) with a random pattern of stone and coal for now
?
then check the docs .-. because there is not "HARM" as you were saying lol
With a resource pack
goddamn it
yeahhhh
minecraft should make it colorable tbh
why you mad?
💀
minecraft should do a lot of things but we got lucky with all the itemstack updates with 1.20.5 so I assume we'll get there one day
💀
Ok this was a bit tricky to figure out. The documentation is kinda bad.
public void fillWithBlock(Location cornerA, Location cornerB) {
World world = BukkitAdapter.adapt(cornerA.getWorld());
BlockVector3 vecA = BlockVector3.at(cornerA.getX(), cornerA.getY(), cornerA.getZ());
BlockVector3 vecB = BlockVector3.at(cornerB.getX(), cornerB.getY(), cornerB.getZ());
Region region = new CuboidRegion(vecA, vecB);
RandomPattern randomPattern = new RandomPattern();
Pattern coalOre = new TypeApplyingPattern(world, BukkitAdapter.adapt(Material.COAL_ORE.createBlockData()));
Pattern stone = new TypeApplyingPattern(world, BukkitAdapter.adapt(Material.STONE.createBlockData()));
randomPattern.add(coalOre, 0.5);
randomPattern.add(stone, 0.5);
try (EditSession editSession = WorldEdit.getInstance().newEditSession(world)) {
try {
editSession.setBlocks(region, randomPattern);
} catch (MaxChangedBlocksException e) {
throw new RuntimeException(e);
}
}
}
I just eyeballed this one. Tell me if it works.
Would it be a good decision to only support the latest Spigot version for a plugin?
Would I be losing a lot of users?
no
No to which question
Should probably run backwards compat up to like 1.14 imo
the one you asked 🙂
yep works thanks and I know this Is very much spoon fed but I apprectiate it bc to be real this documention I just didnt understandt it
There are two
It's a pain. I was thinking to just throw those away
#1, and to #2 probably? it's hard to say with that one considering if you run back to 1.14 your plugins will still probably work
I'm currently supporting 1.19+ and I'm seeing that in perspective, my plugin will be working much better and with cleaner code if I support the current latest version (1.20.5 only)
And given that API changes are always happening it's sometimes painful to support non-latest versions
I think there are a few dividing points which had major API changes that are really just too useful to throw away.
So 1.8 - 1.12 | 1.13 - 1.16/17 | 1.17 - 1.20.4 | 1.20.5+
I would pick one of those regions for supporting a plugin
E.g. when they break up Material I'll probably drop the previous versions
Yeah but you know people and their "stuck with ancient concepts" ie: 1.8 pvp
I love 1.8 pvp and I have a very big private plugin for 1.8 😄
But for this particular pluginn
1.20.5+ is just looking very bright
Yep that makes sense
If it needs to be using the new stuff from 1.20.5 then sure
Otherwise just keep it pre 1.20.5 for now
It would be good to do that
should be able to just do
RandomPattern pattern = new ...;
pattern.add(BlockTypes.COAL_ORE.getDefaultState(), 0.5);
// etc
And wait til we get even more api updates
1.20.5 - some version is gonna be a hotspot for plugin support thats for sure
And tbh I'm gonna spend like 2-3 more months working on this update anyway so maybe something else comes out in the meantime
So yeah I guess I'm switching to 1.20.5+
Ty 🙂
No worries
Ah BlockState implements Pattern
yeah it's pretty nifty
Would you guys be upset if I sent 4 clips
I never went too deep into worldedit bc i hate 3rd party plugins
Depends on the clips
Geez the BuildTools GUI takes its sweet time to load up
mc clips, just need notes on the visuals for the seasons
Im gonna walk by doggo now anyways. Do what you must.
SPAM! Ban this guy!
Not the embeds though that's a wall 💀
D:
Pet the doggo
Man I don't have anything other than gyazo for clips lol
Remove the embeds though 🙏
Show me how D:
There... should be an "X"?
I like them. Summer is a bit barren tho
breh you want people to just click on links
Yes
fine
They are all gonna have multiple visual effects, heavy season conditions / light, etc. summer is gonna be the most barren for visuals tbf, I planned on having some sort of like sweating and if you get hot enough sometimes you'll catch on fire, etc... but that's more to come when I get the temperature system written
Autumn particles are only spawned when you're under a tree as well
The visuals for autumn are gonna be a bit more chaotic as it were, I want to re-render the world around them (more or less) sending fake blocks everywhere to make the season appear as if it's actually active as opposed to relying on particles
When in a runnable that ever 5 ticks I do Enitity.isOnGround()
I'm having the issue with dolphins flailing on the ground and keep jumping up and thus never meeting the condition
Well I would but the server this is getting written for has custom biomes induced by a datapack so I'm not sure forcing biomes really helps in this case?
Also considering this, is there a way to give a sort of overcast / fog visual?
Without having to set the world to storming
Can I like mask the biome as it were?
?
Do you have any suggestions for like biomes -> seasons?
Like "fake" change the biome for the player currently within that chunk
Hi all! Please tell me how to make a fake online in the list of servers?
Do you have an example of this?
@valid burrow lets move here
?paste the full class, removing any login info
so should i just delete the line
no replace the string
just show the whole class for now
?paste the error and the MySQL class
preferably on seperate pastes
yes 2s
the error:https://paste.md-5.net/uyefejilez.md
https://pastebin.com/gZwuBYje the mysql class
idk why but the paste tool didnt work for the class
this is being set as soon as you create the class which is happening before you init the connection
create the instance of mysql after you create the data source
why was it working before then?
no idea
ok i tried creating a new instance of mysql after the initConnection method is called
i still have the same error
perhaps i should just use something else than hikari for db queries xd
Is it possible to get all the players who currently have a specific gui opened?
(instead of going over every player)
i'll try that, thx
putting this on the catbase
Hello, quick question. I´ve satarted developing a plugin on 1.20.5 with a very simple custom inventory that i think should work in any other version, but now im getting an error involving clientbound packets.
Exact Error: Internal Exception: io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:container_set_slot'
Is there a knonw fix for this or should I report it on the Bug Tracker?
What is output of /version
[22:01:35] [Server thread/INFO]: This server is running CraftBukkit version 4096-Spigot-b698b49-8d3e67d (MC: 1.20.5) (Implementing API version 1.20.5-R0.1-SNAPSHOT)
[22:01:35] [Server thread/INFO]: Checking version, please wait...
[22:01:36] [Thread-8/INFO]: You are 11 version(s) behind
With that 11 posterior versions, I guess i should update to the most recent version right?
but its the same API version as the plugin
replace the jar
Oh coll you have put me down a rabbithole and I cannot climb out
o.O
Packets are quite in depth D:
whre I can look for the most recent BUkkit versions?
?bt
you have to build it yourself due to copyright issues
so basiccally installing "another" server?
wouldn't call it that
It's more like
just remove the old jar and add the new one
the backend of the server ig?
I thought he meant like the server jar
yeah
This is why we love PacketEvents
That's what I am using
packetevents my beloved ❤️
but its basically running BuildTools again
love you retro
yeah
ok
that's exactly what it's doing
So is it a bad thing to make a packetcontainer method for each of my seasons, and call those methods anytime needed to manipulate the terrain / environment?
public static void modifyBiomeColors(){
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(
new PacketAdapter(seasons, PacketType.Play.Server.MAP_CHUNK) {
@Override
public void onPacketSending(PacketEvent event) {
event.setCancelled(true);
SeasonsList.Seasons currentSeason = SeasonsManager.getInstance().getCurrentSeason();
Player player = event.getPlayer();
switch (currentSeason){
case SPRING:
manager.sendServerPacket(player, springPacket(player));
break;
case SUMMER:
manager.sendServerPacket(player, summerPacket(player));
break;
case AUTUMN:
manager.sendServerPacket(player, autumnPacket(player));
break;
case WINTER:
manager.sendServerPacket(player, winterPacket(player));
break;
}
}
}
);
}```
Depends what it does
would there be more benefits to moving all the data logic into annotations instead of objects and classes?
like spring
For winter/autumn, it's going to send fake blocks to better visualize that it's winter / autumn. ie: Winter = snowy blocks, leaves with snow, etc : autumn = multiple colors for tree leaves, better particle visuals (if it's possible to make something better than cherry leaves anyway)
I haven't thought of much other effects other than perhaps an overcast or fog of sorts
Hey guys
Why does it expect a “;”
If I already wrote a bracket
And, the s stands for string
I followed a tutorial
What’s the problem with this
you forgot the variable name
Where
for(String NAME : ... )
you're missing the NAME
in your case, probably "s" (bad name, btw)
Oh
should rather call it "key"
that should be fixed once you change String : homeConfig... to String s : homeConfig...
the error message is just confusing
Yeah it's getting confused because the syntax is wrong
Ok I repaired it and as u said it automatically corrected itself
Thx <33
Another problem tho
What’s the problem with this? I think it’s maybe I didn’t register the class in the main class?
It’s this the issue?
No, you didnt implement onCommand method
Just hover over it and it should give you an option to implement the missing method
Hover over the class name and click on „implement methods“
Where
o
lowercase the O in on
Line 20 looking at your error message
Hawk eye
Thx guys <333
Did you rename your existing method or click on „implement methods“ though?
No
I just corrected the typo and every error disappeared
how can I get the actuall name of an Item with the translateKey?
You can get default stuff
I'd still just use translatable components
like everywhere
they're annoying as hell to get
Yea probably
weird
It's a mix
You need to open a big ass .json that tells you where things are at
And then you open up the file in winrar
What is the purpose of the HumanEntity class? Is a HumanEntity always a Player? I see that the Player is supposedly the only implemented HumanEntity class/interface. Can I suppose HumanEntity is always a Player or not?
An NPC can also be a Human entity
What is an 'NPC'? A fake player, like in the Citizens plugin?
In the current context of the game
I know. But what is an 'NPC'?
A HumanEntity is always a player
So the HumanEntity class exists to split logic out of the Player class for more structure/organization of the code, is that right?
It exists because Mojang has an equivalent class
Are you copying these question from ChatGPT or smth??
iirc HumanEntity is equal to Mojang's Player while Player is equal to ServerPlayer
Bukkit / NMS ServerPlayer
How can I "get" a chest to which a sign is attached?
Get which face the sign is attached to and then offset by that
sounds like a lonely journey
steve wandering the world just looking for signs
is it a sign? is it a chest? is it a chest with a sign?
They should add a Chest Sign
Signcraft
What about a sign boat
Im just imagining a massive sign post on the back of a boat rn
someone hire this man
Somebody should add a method to serialize the Inventory :-:
You can
I commiting arson
BukkitObjectInput/OutputStream
it's literally just a worse version of everything
What else am I gonna use :c
It looks fine in chat, but in the actual file, it just dies :(
idk yaml? the amount of people that base64 a BukkitObjectOutputStream only to put it in a yaml config....
itemstack alreayd has a .serialize method, so all you need to do is serialize each item in the invnentry
Yea but thats breaking for sum reason
Nice xd
your serialise method should be Map<String, Object>
then just let bukkit handle it
I need to know where in the inventory the item was tho
Could add that to the map
Thats why i had <Object, Integer>
Why not store it in the String Object map
wdym?
backwards at the very least
That should work
import java.util.LinkedHashMap;
import java.util.Map;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class InvTest implements ConfigurationSerializable
{
private final ItemStack[] inventory;
public InvTest(Inventory inventory)
{
this.inventory = inventory.getContents();
}
public InvTest(Map<String, Object> obj)
{
this.inventory = new ItemStack[ (Integer) obj.get( "size" ) ];
Map<String, Object> items = (Map) obj.get( "items" );
for ( Map.Entry<String, Object> item : items.entrySet() )
{
inventory[Integer.parseInt( item.getKey() )] = (ItemStack) item.getValue();
}
}
@Override
public Map<String, Object> serialize()
{
Map<String, Object> result = new LinkedHashMap<>();
Map<String, Object> items = new LinkedHashMap<>();
for ( int i = 0; i < inventory.length; i++ )
{
ItemStack item = inventory[i];
if ( item != null )
{
items.put( Integer.toString( i ), item );
}
}
result.put( "size", inventory.length );
result.put( "items", items );
return result;
}
}
untested and garbage
Whats the point of using a linked hash map against a normal hashmap?
Maintains order
Good to know, does it have any down sides, like requiring more processing power?
then you can do stuff like conf.set( "kit.items", invTest);
just make your whole Kit class ConfigurationSerializable really
https://paste.md-5.net/rucucanale.cs
Ok well here goes, my last 2 hours have just been fiddling with this packet manipulation class for autumn effects... am I on the right track or completely lost?
Well it reduces cache locality. So if you do not iterate over it there will be an impact on performance
Furthermore it requires more memory to maintain, but that is the same problem worded differently
What are these magical bytes you are adding for leaves
Supposed to be colors haha
I don't really understand how to manipulate these packets man
I didn't think so
Hang on let me do some digging
Ah I knew I was completely lost
?paste
No I'm trying to recreate a plugin. Basically you put a sign on a chest, right click it with an item, then it sets up a shop for that item
Ayy it works, unlike my shit show
Kinda ugly but it shows how to use the wrapper for the packet at least
Oh
just listen for the blockplace
or interact
Right... I assumed I was just doing meaningless work trying to figure something out lol
The wrapper stuff makes things much easier
There is no 'SighPlacedOnChest' event is there?
Since you don't have to deal with the encoding on the packet, PacketEvents takes care of that for you
No need to get agressive
Oh that would have been so awesome before I spent the time on this ahaha
Live & learn D:
@EventHandler
public void onBlockPlaceEvent(BlockPlaceEvent event){
if(event.getBlock().getType() != Material.YOUR_SIGN) return;
if(event.getClickedBlock().getType() != Material.YOUR_CHEST) return;
Bukkit.getConsoleSender().sendMessage("Hooray, Ive just made a SignPlaceOnChestEvent")
}
been using the Minecraft Development plugin in IntelliJ and it's not updated to include 1.20.5 yet, and I know that it's out and ready to be used, could someone help me set up a project using it? I'm impatient and wanna mess around with the new features
did that already
Are you on gradle or maven?
For maven, find your pom.xml
For gradle, find you build.gradle
ive changed the maven dependency to 1.20.5-R0.1-SNAPSHOT already but the new attributes arent showing up
reload gradle
or whatever you're using
Does it work?
I'm not sure if the wrapper exists anymore, I can't seem to find it
What version
Using latest https://github.com/dmulloy2/ProtocolLib/
Should I be using retrooper's?
You can use either, it is ultimately your choice
Read above, the wrapper I'm trying to find doesn't exist in dmulloy's
(I think, I cannot find it)
no idea then
I did specifically say PacketEvents
So I was referring to PacketEvents
Protocollibs wrappers are old and minimal to begin with
Gotcha, didnt realize packetEvents was a lib
How do I get a pottioneffecttype in 1.20.5?
Same way you did in 1.20.4
?
valueOf doesn't work
@Deprecated
@Contract("null -> null")
@Nullable
public static PotionEffectType getByKey(@Nullable NamespacedKey key) {
return key == null ? null : (PotionEffectType)Registry.EFFECT.get(key);
}```
getByKey is deprecated
It does but the names have been changed
registry
So yeah use the registry
coll i got a drill today
so you say?
That doesn’t look like a library though
black and decker
Is that the actual name
it was the cheapest trustable brand
The problem with drills is the drill bits
we got a 109 bit set too
Like seriously all the drill bit at our big box hardware store are shit
one of these
If you're just drilling wood they're probably ok
its got just about everything
But anything else, good luck
Just a bit of oil on the end of the bit if you gotta drill through metal should be fine 😄
What if I have to drill through the fabric of space
tough
Interesting, I'll remember that. Although dunno how much it'll help with shit bits
Thanks for the tip
Shit bits are gonna be an issue but a bit of oil helps most other cases + wont deform the bit as much
Lotta bits man
Get pure titanium diamond tipped bits
$160 a bit
How can I detect if server is running 1.20.5 or up?
Like, what's the correct way of doing it?
Bukkit#getVersion was it
1 sec
public static String getServerVersion() {
String version = Bukkit.getServer().getBukkitVersion();
if (version.contains("-")) {
return version.substring(0, version.indexOf('-'));
}
return version;
}```
Tis what I use
?xy
what would be the best method of editing the same attribute modifier object in multiple modifier collections? would prefer to keep it to one loop
hello, when pinging my server from the server list, i get this error: https://paste.md-5.net/oxahodiyeh.php
i made sure protocollib gets loaded before my plugin, the plugin is installed on the server with version 5.2.0 (same in the code).
here is the class where the error triggers: https://paste.md-5.net/yidujugezo.cs
I'm not sure I understand what your goal is
if i verify w forums can i send images here
cuz i have code that works for what i want it to do but its not ideal
Question is a bit tricky. Generally if you edit an object, and it is part of multiple collections, then you dont need to iterate anything because its still the same
object in every collection. However changes to AttributeModifiers are not always reflected automatically in game. ItemStacks are an example for this.
You would have to re-apply the modifier after changing it.
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
pretty sure attribute modifiers are immutable
You are shading ProtocolLib. Set the scope to provided in your pom
AttributeModifier a = new AttributeModifier("scalecmd", (scale-1) * -1, AttributeModifier.Operation.ADD_SCALAR);
AttributeModifier aInvert = new AttributeModifier("scalecmd", (scale - 1) * -1, AttributeModifier.Operation.ADD_SCALAR);
for(AttributeModifier i : Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_SCALE)).getModifiers()) {
if (i.getName().equals("scalecmd")) {
player.getAttribute(Attribute.GENERIC_SCALE).removeModifier(i);
player.getAttribute(Attribute.GENERIC_JUMP_STRENGTH).removeModifier(i);
player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).removeModifier(i);
player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).removeModifier(i);
player.getAttribute(Attribute.PLAYER_ENTITY_INTERACTION_RANGE).removeModifier(i);
player.getAttribute(Attribute.GENERIC_STEP_HEIGHT).removeModifier(i);
player.getAttribute(Attribute.GENERIC_SAFE_FALL_DISTANCE).removeModifier(i);
break;
}
}
for(AttributeModifier i : Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_FALL_DAMAGE_MULTIPLIER)).getModifiers()) {
if (i.getName().equals("scalecmd")) {
player.getAttribute(Attribute.GENERIC_FALL_DAMAGE_MULTIPLIER).removeModifier(i);
break;
}
}
player.getAttribute(Attribute.GENERIC_SCALE).addModifier(a);
player.getAttribute(Attribute.GENERIC_JUMP_STRENGTH).addModifier(a);
player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).addModifier(a);
player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).addModifier(a);
player.getAttribute(Attribute.PLAYER_ENTITY_INTERACTION_RANGE).addModifier(a);
player.getAttribute(Attribute.GENERIC_STEP_HEIGHT).addModifier(a);
player.getAttribute(Attribute.GENERIC_SAFE_FALL_DISTANCE).addModifier(a);
player.getAttribute(Attribute.GENERIC_FALL_DAMAGE_MULTIPLIER).addModifier(aInvert);
}```
i just set it now, ill see if it works
i just noticed some errors oops
yep, its not null anymore, thanks
i have tested it and that code does work for what i want it to do
but i feel like its not ideal
You can loop over a set of attributes
Either the entire values array (I think it’s an enum?) or your own collection
I dont even understand the general logic of that code...
Looks like they want to remove the modifier from a bunch of attributes
And then add a new one
remove and replace ye
But they check for modifiers on one attribute, and then proceed to throw modifiers on unrelated attributes if the former contained a certain modifier...
if i can just edit the object across all the collections thatd be better
I would just have a set of attributes you care about and then loop over that
Presumably they assume the other ones will always have it too, which is interesting
theyre all the same modifier
the attribute modifiers are all the exact same object with the same name
Even if they do have a modifier with the same name and uuid, idk if they implement .equals
The ones you add are, but they won’t be the same object when you want to remove them later
yes, which is why i iterate through looking for the name i set, then take that object and remove it
when the for each hits the object with the "scalecmd" name it'll stop and delete the object from all the collections
I would create a Set of Attributes that are affected, then iterate over all of them, and simply remove then add the modifier to them.
private static final Set<Attribute> SCALE_ATTRIBUTES = Set.of(
Attribute.GENERIC_SCALE,
Attribute.GENERIC_JUMP_STRENGTH,
Attribute.GENERIC_MOVEMENT_SPEED,
Attribute.PLAYER_BLOCK_INTERACTION_RANGE,
Attribute.PLAYER_ENTITY_INTERACTION_RANGE,
Attribute.GENERIC_STEP_HEIGHT,
Attribute.GENERIC_SAFE_FALL_DISTANCE
);
private static final String SCALE_MOD_NAME = "scalecmd";
public void changeScaleAttributes(Player player, double scale) {
double scalar = (scale - 1) * -1;
AttributeModifier.Operation operation = AttributeModifier.Operation.ADD_SCALAR;
AttributeModifier mod = new AttributeModifier(SCALE_MOD_NAME, scalar, operation);
SCALE_ATTRIBUTES.forEach(attribute -> {
AttributeInstance instance = player.getAttribute(attribute);
instance.removeModifier(mod);
instance.addModifier(mod);
});
}
There is no real harm in simply calling removeModifier no matter what.
so basically this is just the same thing as what i did but rewritten to be less cluttered and awful?
Im still mad at the ADD_SCALAR name for this operation...
It multiplies a scalar to the value
ADD_NUMBER adds a number where ADD has an arithmetic meaning.
ADD_SCALAR multiplies a number where ADD has a semantic meaning.
Its confusing af
"Im adding this scalar to a matrix" technically makes sense, but 'add' doesnt mean '+' in that scenario.
I just checked the wiki
Explanation there is better for my smooth brain :p
For every modifier, multiplies the current value of the attribute by (1 + x), where x is the amount of the particular modifier. Functions the same as Operation 1 if there is only a single modifier with operation 1 or 2. However, for multiple modifiers it multiplies the modifiers rather than adding them. For example, modifying an attribute with {Amount:2,Operation:2} and {Amount:4,Operation:2} with a Base of 3 results in 45 (3 * (1 + 2) * (1 + 4) = 45).
Send. My brain is smoother if this is a contest btw.
This is for MULTIPLY_SCALAR_1, right?
Not ADD_SCALAR
