#help-development
1 messages · Page 1251 of 1
plugin.getCommand("delmap").setExecutor(this);
you're not gonna believe this
you are trying to get the command named delmap
but your plugin.yml has no such command
your plugin.yml does, indeed, not have a delmap command
woah
who wouldve guessed that, i sure as hell didnt
so... add a delmap command to your plugin.yml
ok
you guys thought i was a liar
no
no-one said that
or a troll
but you keeping information from us does not help us help you
because you were being an absolute fucking clown
I said I believed you were a troll as you refused to find the error we needed
hiding information = no bueno
i gave u the info as much i understood what u guys wanted
💀
im not hiding info im trying to undertsand what u guys are asking for me
we were very clear that the error you were sending wasn't the right one
and that there is another error in the log
at the very top of the log
which there was
and that is why you were being a clown
i weirdly remember saying latest.log about 10 times
the "log" refers to the entire log
and yes, we told you to look at latest.log, as in the file, specifically
that is nowhere near unclear
and for future reference, dont call someone a troll if he says he doesnt get what u guys are saying
you were absolutely acting as if you were a troll
i was acting as someone being lost
maybe not intentionally, but we can't know that
then why assume?
love the fact it took like an hour to resolve 1 very small and easy to fix issue
we assume because you were being inconceivably daft
I was trying to understand you
omg darthmango
Let's end this debate at this point since it doesn't lead to anything
sure, it's fine, though in the future it may be more productive to ask questions rather than say "i've already done it"
e.g. "what do you guys mean by log, i already sent it"
Funny enough i thought u guys meant the paste site
bc that was the latest.log file
of the error
what about this
can i get spawner itemstack with custom entity or i need to set the entitytype after a player place it
i was searching on spigot but I didn't find anything about that, only with blocks placed
it's available as blockstatemeta iirc
as are all other tile entities; chests and the like
how you'd create a spawner tilestate to attach to the meta without like placing a physical block in the world and getting its state, i'm not sure; maybe there is a factory somewhere
I just want to do a /give spawner ZOMBIE %player%
i made it
thank you vcs2
what language is this
Kotlin
what IDE are you using? (I figured it out on IntelliJ)
Is there a way to get player input like playerinputevent but outside the event?
Listen to it and pass the event to a method
ye
Player#getInput iirc
really?
well i dont care actually
is a client issue
The background
i like it actually
I’m sure you do lol
what extension for the file icons?
I think I found it
you found what
i dont remember
let me see
atom material icons
Yes?
You have a class called Isometric_GM and a method called tick, but you're referencing that method as though it's static, but it's not. It's an instance method
You either need a new instance, or, which I'd argue is the better approach, have your Isometric_GM class implement Runnable and replace your tick() method with run(), then you can pass in new Isometric_GM() directly
oh
this::tick is fine
Because it is not static
Isometric_GM is not this
You referencing an instance method
yes..
Doesn’t mean it’s an instance method in the current class
Then it is better as Choco suggested.
how do I implement multiple
I'm already implementing Listener
How’d you get the background
Comma
IntelliJ settings > Appearance > UI Options: Background Image... You got it from there
implements X, Y, Z
Omg ty
np, literally learnt how to do it like 20minutes ago myself xD
oh lol I tried earlier but it didn't work cuz I was missing "this" argument and I mistook it for smth else 🤦
I used build tools to create obf mapped spigot but I don't know what folder its in.
It should have moved it to maven repo. However you should also have jars in the buildtools directory. 2 new ones.
your local maven repo, normally <yourUserFolder>/.m2/repository/org/spigotmc/...
usually you don't need to know where exactly that file is though because you'd also use maven or gradle or whatever to "use it"
Is there any way?
in creative mode all you can tell is that the client has set a block to a slot
so you could just purge all NBT in the event
That event is called when the player puts a creative item in their inventory, so right? It wouldn't apply in this case right
why wouldnt it
I'll check how it works, I'll be right back
is creative inventory handled server-side nowadays?
No
have you never heard the expression "the client is always right"?
just ignore the client giving itself an item that shouldnt ever exist
:<
How do I force the player into specating an entity? (I know how to make them spectate, but how do I keep them there?)
yup
prob with that is that the player will still exit it for a split second
it's doable cuz some srvs do it
Oh I see. How is it suppose to be put in in the pom.xml?
Cause I am doing this.
that's not what the version is
its, eg, 1.21.5-R0.1-SNAPSHOT
look in the folder to see the versions available
run buildtools
you didn't run BT
did not for 1.21.5
Do I need that to get the mappings for 1.21.4-R0.1-SNAPSHOT?
latest is .5
Am I suppose to build in the directory or should it automatically put it there?
It didnt for me. But is the obsucatued mapped code located in org.spigot.spigot or
As you have been told more than once, RUN buildtools for the version you want. If you want remapped add -remapped
?nms
I did run buildtools with --remapped I just didn't know the location and the spigot documentation is vague and dosen't say nothing about this besides run buildtools but not where the jar is located or maven implementation.
you don;t need the jar yourself when using remapped
it gets installed to your local maven
I got that part. You said its get installed to your local maven yes. But nowhere in org.spigotmc.spigot shows that jar even though I have ran it with remapped on it thats what Im saying. Maybe some file location issue
the xml you posted has no scope so you didn;t follow the tutorial
Well I am now.
also Spigot is lite on nms as its not actually Spigot
Spigot is just the API NMS is minecraft code
https://paste.md-5.net/guvahitusu.xml
This should be correct?
I did (still getting "Unresolved dependency: 'org.spigotmc
1.21.5-R0.1-SNAPSHOT'"
java -jar BuildTools.jar --rev 1.21.5 --remapped
looks fine. What IDE?
Intellji
?paste your pom
pom.xml right there
looks fine to me
when I look in my .m2 I dont see that 1.21.5 there so is that the issue Im quite stumbled
How I not seeing any effects? if( hopper.isSetTeleport() ) { if( player.teleport(hopper.getTeleport().add(0.5,0.25,0.5)) ) { player.sendMessage("You have teleported"); player.getWorld().spawnParticle(Particle.FIREWORK,player.getEyeLocation(), 10, 0.2, 0.2, 0.2, 0.1); } }
The effect is probably in your head
How can I see that because when I try to see this like in 3rd person view, I don't notice anything?
You should offset the location
I tried, I cannot get the numbers correct
Hey fellas, I'm trying to make the player sitting on an entity using reflection that supports 1.8.8-1.21.5 but for some reason net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity class doesn't exist on 1.21.4. If someone knows the correct mappings. I've checked on mappings.dev but it doesn't seem to work. this is my code:
why are you using nms to spawn a bat?
To make player sit on an entity and so they can't dismount
and I don't want to use bukkit events for it. It's just not smooth
not smooth?
Yeah I made it so when user dismounts I just mount him back on the entity 1 tick later
but when user actually rotates the rotation is weird
when it's an actual server-side entity
sounds odd
Do you know how to fix this tho? Like what are the correct mappings for modern versions?
?mappings
Compare different mappings with this website: https://mappings.dev/
So I should use net.minecraft.network.protocol.game.ClientboundAddEntityPacket ornet.minecraft.network.protocol.game.PacketPlayOutSpawnEntity
So this could code should work?
try {
spawnPacketClass = Class.forName("net.minecraft.network.protocol.game.ClientboundAddEntityPacket");
} catch (ClassNotFoundException e) {
spawnPacketClass = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity");
}
spawnConstructor = spawnPacketClass
.getConstructor(Class.forName("net.minecraft.world.entity.EntityLiving"));
spawnPacket = spawnConstructor.newInstance(bat);```
try it and see. I don;t use reflection for it can;t tell you
yes, teams
Soo make 1 team and add everyone to it? and just hide the name for team?
yup
teams are persistent right... ive never used teams
on player join, add the player to the team? the best way to add players to the team?
Team#addPlayer or something
how do you create a team?
i wanna create it in the game so i can just add players to it onjoin
/team
XD
Hello, is there a gradle equivalent for this tutorial ?
https://blog.jeff-media.com/maven-multi-module-setup-for-supporting-different-nms-versions/
Hi there! Today I’m going to explain how to setup a multi-module project using maven to support different NMS versions. Important notes about this tutorial: Every step will have detailled screenshots using IntelliJ. I explicitly chose not to include everything as copy/pastable source code, but normal screenshots (you can click on them to show ...
I mean you'd just do the same things but using gradle
it looks a bit tricky
there's things that are weird
like, wtf
It's a gradle thing where it can't find them or smth use findProject(":nms:ver")?.projectDir = ...
found, it was configuration
but at least I can sync
now I need to make it build lol
I mean it depends on where the remap configuration comes from and what it does
because it might do weird resolver shit
because I can tell you that subprojects like that will always resolve when the configuration is implemented properly
I'm checking the patrick's remapper configuration
or I'll use shadowjar one
looks like I don't need a configuration
well by default implementation adds to the runtime and compile classpath configurations
I am trying to implement custom font into bar, it doesnt work for me, can someone help me please?
you're sending the json string, not the component
?components you do not need to format the components yourself lol
For hoverable, clickable, hex colored, or otherwise complex text, use the component API. Documentation can be found here:
https://www.spigotmc.org/wiki/the-chat-component-api/
So, here's my main build.gradle.kts : https://paste.md-5.net/orugolujot.gradle.kts
Now, it correctly remaps subprojects using patrick's remapper (those in nmsVersions), but the final jar build shadows the results of the shadowJar (or jar ?) task, not the remap task one...
here's nms modules build.gradle.kts : https://paste.md-5.net/tajerefina.gradle.kts
I have no idea what you mean
maybe the logs will be easier to understand : https://paste.md-5.net/voxoreleri.shell
main build task executes at first...
explain what you want it to do and how it's currently behaving
I want the main build to shade all remapped subprojects nms modules, but for now it generates remapped subprojects after the main build task finished
so it doesn't shade correctly
I want to do a multimodules nms project for gradle
could just add a dependency to remap the other projects to another shadow task
like creating a dist module ?
no, I'm saying you could make a shadow task that depends on the other projects remap takss
okay I'll try that, thanks
using this ?
https://gradleup.com/shadow/custom-tasks/
Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries
idk just create a task inheriting from ShadowJar
okay, so that
haven't looked at that page
it was fucking laborious :```kts
tasks.compileJava {
subprojects.forEach {
if(usesReobfuscatedJar(it)) {
dependsOn(it.tasks.remap)
} else if(it.name != "NMS") {
dependsOn(it.tasks.build)
}
}
}
tasks.assemble {
dependsOn(tasks.shadowJar)
}```
horse.getInventory().setSaddle(item) seem to be broken in 1.21.5 (worked in 1.21.4 and older versions). Does anyone know if this method has been moved/changed to something else?
CraftBukkit version 4460-Spigot-b4e69d9-6b8999d (MC: 1.21.5) (Implementing API version 1.21.5-R0.1-SNAPSHOT)
Stracktrace:
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/java.util.Arrays$ArrayList.set(Arrays.java:4232) ~[?:?]
at net.minecraft.core.NonNullList.set(SourceFile:54) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4460-Spigot-b4e69d9-6b8999d]
at net.minecraft.world.InventorySubcontainer.a(InventorySubcontainer.java:198) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4460-Spigot-b4e69d9-6b8999d]
at org.bukkit.craftbukkit.v1_21_R4.inventory.CraftInventory.setItem(CraftInventory.java:101) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4460-Spigot-b4e69d9-6b8999d]
at org.bukkit.craftbukkit.v1_21_R4.inventory.CraftInventoryAbstractHorse.setSaddle(CraftInventoryAbstractHorse.java:20) ~[spigot-1.21.5-R0.1-SNAPSHOT.jar:4460-Spigot-b4e69d9-6b8999d]
at se.file14.procosmetics.cosmetic.mount.type.InfernalHorror.onMountEquip(InfernalHorror.java:39) ~[?:?]
what does getSize on the inventory return?
that method is just a convenience method for inventory.setItem(0, item) but if it is throwing out of bounds exception with length 0 then that means the inventory has no slots
It returns 0, therefore the ArrayIndexOutOfBoundsException is thrown
is the horse in an unloaded chunk or something of the sort
because I can't think of any cases where the inventory would be of size 0
gonna look at the source I guess
Ok so block dust particles changed from 1.20 to 1.21 and I'm having a hard time figuring out exactly what Spigot wants now. Error is
data (class org.bukkit.craftbukkit.v1_21_R1.block.data.CraftBlockData) should be class org.bukkit.Particle$DustOptions
How exactly do I get an instance of Dust Options? Not seeing it in the docs.
My line of code in question is as follows: java loc.getWorld().spawnParticle(Particle.DUST, loc.getX(), loc.getY()+0.1, loc.getZ(), 24, 0.5, 0, 0.5, 0, Material.COARSE_DIRT.createBlockData());
DustOptions is a subclass of the Particle enum
Yeah, got that here https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Particle.DustOptions.html
declaration: package: org.bukkit, enum: Particle, class: DustOptions
I don't think you're looking for the DUST particle if you are trying to display block particles
try BLOCK_CRUMBLE or BLOCK particles
the description of the constant should tell you which data type it expects
Ah, ok. I tried BLOCK_CRUMBLE but it doesn't exist in 1.21 and apparently DUST is no longer applied to blocks.
there's FALLING_DUST which also takes BlockData so may as well try that, I don't remember which one was the block particles one
Thanks alot, BLOCK seems to be what I was after
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Particle.html#BLOCK_CRUMBLE BLOCK_CRUMBLE definitely exists tho
declaration: package: org.bukkit, enum: Particle
well, glad you got it working anyway
that could be the case, there was a list where it mentions what the equivalent particles are in the new names but I don't remember where it was anymore
okay after investigating a bit, yeah, horse inventories are completely broken
from the looks of it, saddles might be part of the entity equipment now rather than their inventories which are completely useless now for normal horses (not for chested ones)
you can try horse.getEquipment().setItem(EquipmentSlot.SADDLE, item) instead
how can i find if an itemframe is at a block location?
World#getNearbyEntities
thank you!
Hey! I noticed a problem on spigot 1.21.5 with lore. Basically I don't see item's lore in menu (lore set using ItemMeta#setLore(List<String>)). Does anyone has this problem too?
Did you forget to set the item meta back on to the item
Nope, everything worked on older versions. It happens only on 1.21.5
how do you show a scoreboard on a side?
just set the display slot as the sidebar?
I mean, you do need an objective to display, yes
check if the item's hide lore flag is enabled for whatever reason
Thanks! It worked. It seems that our menu implementation was adding all itemflags to item. Spigot 1.21.5 added like 80+ flags and adding them caused that problem 
I'll look into it but usually good to open a bug report if it broke during an update, it's the API, and it's not mentioned in the changelog
it's just the horse inventory being useless for normal horses
since everything that used to be there is now in the entity equipment
probably would be good to make it work again by just making it call the respective entity equipment methods but also deprecate it
yeah
what is the most optimal way to make a custom entity return to a set point, after it is no longer in combat?
is there a reason you're using the obfuscated methods?
?xy
is this uh for me?
yes
for both really lol
well look
im not a coder
im helping my friend fix a plugin he owns
its a popular one
from what version to what version
the method was changed in 1.21.5
1.21.4 to 1.21.5
and from which object is that method being called
f(NBTTagCompound) is the method
yeah but from what class
im not a coder in java 😭
EntityLiving.f(NBTTagCompound),
this?
Could not pass event PlayerInteractEntityEvent to plugin name
org.bukkit.event.EventException: null
would be helpful to know what the code is meant to be doing
seems to now be called h instead of f
source?
I just looked at the name from the old mappings and then looked at the new ones
Why are you using unmapped
?mappings
Compare different mappings with this website: https://mappings.dev/
they aren't a developer
right, pass that question to the dev then
they're just trying to fix a plugin that probably has been abandoned or something
They said it's their friend
not at all
its actually famous and still used
if it hasn't been abandoned then why are you trying to fix it yourself
im not
which plugin to begin with
dev is also trying to fix it
you probbaly used the plugin
i dont know if i should say ,plugin owner might not be supportive about it
why are you glazing a plugin name lol
Could any1 look at my code rq and tell me if there is ANYTHING that could make my RAM spike up like idk? bc I got huge RAM issues rn and idk anymore...
Link would be here: https://github.com/Emn4tor/Waystonez
Contribute to Emn4tor/Waystonez development by creating an account on GitHub.
lmao, okay. If it isn't abandoned then ask them to come here and ask the questions themselves
he was looking at other resources
ClickVillagers, im looking into a fix and i guess @tribal sky is trying to help me fix the issue, i didnt know they asked here also lol
well, back to the original problem then: is there a particular reason you are using obfuscated names?
Never heard of that plugin
but yeah this ^^
search up viillager handling plugoin
num1 search
or even just villager plugin
not quite, just how i set up nms in the beginning
why do you even need nms
^ I was about to ask
good question lol, I don't think there's anything about villagers that isn't already handled by the API
to write an entity's entire nbt data to a string
for what purpose?
you can use EntitySnapshot for that I believe
to store it on an itemstack, and retrieve the entity later
Yeah use an EntitySnapshot
lemme read the docs
No need for NMS here
does EntitySnapshot work with Nbt in the background or? Bc i also need to decode the Nbt data and create a villager from it
EntitySnapshot has a method to spawn an entity from it
also if you just want to put it on a spawn egg that's doable as well
Since the spawn egg can directly spawn your entity
If you really want to store it as a string there are methods for that as well
private static final NamespacedKey VILLAGER_KEY = new NamespacedKey(MyPlugin.instance(), "villager");
// Storing
var snapshot = villager.createSnapshot().getAsString();
var meta = someItem.getItemMeta();
meta.getPersistentDataContainer().set(VILLAGER_KEY, PersistentDataType.STRING, snapshot);
someItem.setItemMeta(meta);
// Spawning
var snapshot = someItem.getItemMeta().getPersistentDataContainer().get(VILLAGER_KEY, PersistentDataType.STRING);
Bukkit.getEntityFactory().createEntitySnapshot(snapshot).createEntity(someLocation);
that's how you'd use it
declaration: package: org.bukkit.inventory.meta, interface: SpawnEggMeta
that'd only work if they're using a spawn egg for it tho
I see, is this also available on api version 1.20?
yes, it's been there for a while now
That's true
don't remember which version it was introduced though, let me check
cant seem to find it for 1.20
Seems to be added in 1.21
it was added in 1.20.2
oof, i need to support 1.20+
are there any other ways than NMS then if i want to support 1.20 as well?
Or use nms just for those versions specifically
Use nms for 1.20(.1) and EntitySnapshot in 1.20.2+
its also important that it works with nbt, so that it works after updating from previous versions
idk how EntitySnapshot exactly works
actually, the EntitySnapshot class exists since 1.20.2 but the EntityFactory was added in 1.20.5
it's pretty much the same thing you were doing but with the API
Ive fixed this btw
ah i see
i think i'd still prefer nms at this point tho
...
I mean, you'd have to deal with maintaining that over versions
so you want to do this every single update?
rather than just have your plugin not need updates
you'll have to use NMS for the versions where the API didn't exist, but you're better off using the API in the versions where it does exist
i mean i guess this is doable
and for the versions where you have to use NMS, use a remapping plugin so you can use the mojang-mapped names instead
?nms
you can check out that guide for reference
is there any kind of licensing issue with using remapped names?
nope
Im so confused why this is an issue discussion even?
take all your existing code, stop making changes to it
Thanks! 😎
and then where you were previously going to put (if 1.21.5) nms(); just put (if 1.21.5) api();
oh and do proper nms detection
otherwise you'll have people complaining when your plugin won't work on Paper
(if 1.21.5) nms(); my favourite
oh it is both a plugin and a mod
i mean, different codebases
reminds me of
wdym
if you mean package relocation i already check for that
hm? not in the code on Github 🤷♂️
https://docs.papermc.io/paper/dev/internals#reflection this is the recommended way to do that
I mean, what they do works, just not ideal lol
hey if it works it works right xD
yeah the reccomended way makes way more sense
eh, I doubt that'll ever not be the case, either way works, one is just less pretty to look at
if you want to get onto the nitty-gritty, then it would be less performant to depend on the exception being thrown as exceptions are expensive, but it isn't like this is a performance-sensitive method anyway
yeah i mean it only gets run once in the static block
ok, EntitySnapshot doesnt seem to be compatible with older versions on its own (as in it cant parse pure Nbt) probably the entity id data is missing
does somebody know how i can copy the data of a block and the block from a location to a location. for example chest contents or sign text
doesn't getAsString just return the entity nbt minus the entity id
Get the BlockState and set it to a different location
do you mean plus?
could you please provide code im new too bukkit
I mean EntitySnapshot#getAsString, or does that include the entity id for some reason?
See https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/BlockState.html#copy(org.bukkit.Location)
and the update method on it
declaration: package: org.bukkit.block, interface: BlockState
Do note that not all blocks have a block state (chests and signs do though)
it does include the id, but the previous versions don't (at least not in the way that EntitySnapshot wants, theyre included in a custom key)
why does it even include the id, it's spawning a new entity so it should just discard it
can you test whether EntityFactory cares whether there's an id or not in the nbt
i dont mean the uuid, i mean the entity id (i.e: minecraft:villager)
ah I thought you were talking about the network id of the entity
hey guys just checking up is it all going well?
is ```
currentBlock.setType(topBlock.getType());
topBlock.getState().copy(currentBlock.getLocation());
we're sorting the details out right now
good!
couldn't you just add the id yourself? Since it should just be villager anyway
unless you are storing different types of entities
yeah, i already previously stored the entity type (either villager or zombie villager) in a custom nbt key, i could just append it to the nbt
you don't have to set the type, just call update after copy
is there an nbt parser available in spigot?
I mean, there is Gson
uhm what update function
you could probably just use that lol
BlockState#update
can it parse nbts?
so ```
topBlock.getState().copy(currentBlock.getLocation());
topBlock.getState().update();
I don't remember whether NBT differs in any way from JSON now, I think it doesn't anymore?
i think it differs quite a bit no?
you want to call it on the BlockState returned by the copy method
keys dont need quotes in NBT, but they do in json for a start
block.getState().copy(...).update()
i mean i could just try to hack it and try to modify the string
yeah but the nbt returned by the methods usually enforce quotes
idk how sensable that is though
It's close but there are differences
eh, it should be fine™
Hence the name Mojangson
this is returned by EntitySnapshot:
{AbsorptionAmount:0.0f,Age:0,AgeLocked:0b,Air:300s,Brain:{memories:{"minecraft:home":{value:{dimension:"minecraft:overworld",pos:[I;-772,64,-257]}}}},Bukkit.Aware:1b,Bukkit.updateLevel:2,CanPickUpLoot:1b,DeathTime:0s,FallFlying:0b,Fire:-1s,FoodLevel:0b,ForcedAge:0,Gossips:[],Health:20.0f,HurtByTimestamp:15,HurtTime:0s,Inventory:[],Invulnerable:0b,LastGossipDecay:4473005L,LastRestock:0L,LeftHanded:0b,Motion:[0.0d,-0.0784000015258789d,0.0d],OnGround:1b,PersistenceRequired:0b,PortalCooldown:0,RestocksToday:0,Rotation:[143.17049f,12.191358f],Spigot.ticksLived:49,VillagerData:{level:1,profession:"minecraft:none",type:"minecraft:desert"},Xp:0,attributes:[{base:20.0d,id:"minecraft:max_health"},{base:16.0d,id:"minecraft:follow_range",modifiers:[{amount:0.023075759650816374d,id:"minecraft:random_spawn_bonus",operation:"add_multiplied_base"}]},{base:0.5d,id:"minecraft:movement_speed"}],fall_distance:0.0d,id:"minecraft:villager"}```
wonder if gson has any issue with it
seems too not work
can you give us an example of what your previous format looked like?
origin.getState().copy(currentBlock.getLocation()).update();
uno secundo
that's weird, maybe you need to force it
do update(true)
Did you set the block at that location first
the file name lmao
lol
this is truly one of the fixes of all time
String nbt = data.get(NBT_KEY, PersistentDataType.STRING);
if (!nbt.contains("id:\"minecraft:villager\"")) {
nbt = nbt.substring(0, nbt.length() - 1);
nbt = nbt.concat(",id:\"minecraft:villager\"}");
}
won't this fail for zombie villagers tho
y'all still working?
that's how development goes usually
well chat
make a plugin for me 🤑
villager discounts apply for all that's it
Who do they normally apply for
yeah was just for testing
static {
try {
Class.forName(NMSUtils.cbClass("entity.EntitySnapshot"));
Class.forName(NMSUtils.cbClass("entity.EntityFactory"));
isEntitySnapshotSupported = true;
} catch (ClassNotFoundException exception) {
isEntitySnapshotSupported = false;
}
}
This doesnt work for some reason
i hate the indentation ffs
lock in
I might try to get in java
is it similar to python more or web development
define web development
web development can be a gazillion languages too lol
different language
nope
I can't explain 😭
List<T> e = new ArrayList<>();
like is the indention needed
no
almost every language has both*
good i hate it
if you don't use indentation, your code will just be unreadable
You should really just read java code and see how it works
do i need intellja wtv or does vs studio work fine
@sly topaz uhh there is an issue with either the serialization or just the way EntitySnapshot works itself
Recommend Intellij
but vscode works
vsc has java support but it's not very good
pythonoid detected
after picking up a villager the enchantment meta is gone
okay where do i learn from any good sources?
?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! 🎉
damn for web development there was courses by meta
Okay
i think like, all metas are just gone
is it learning java or specifically something in java
can you print the entity snapshot string and check if that data is there
will do in a sec
var nbt = data.get(NBT_KEY, PersistentDataType.STRING);
var type = data.get(TYPE_KEY, PersistentDataType.STRING);
if (type != null) {
var entityType = type == VillagerType.ZOMBIE ? "minecraft:zombie_villager" : "minecraft:villager"; // would probably be better to put the id as a param of the enum constant
nbt = nbt.substring(0, nbt.length() - 1).concat(",id:\"" + entityType + "\"}");
}
this is how I'd go about the entity id btw
now that I think about it, you could just get the TYPE_KEY lol
the issue only comes with fabric items which use EntityType
this is what im doing atm:
@Override
public Entity readAndSpawnAt(String string, EntityType type, Location location) {
// Check for possibly missing type data in the string
String typeData = "id:\"" + type.getKey() + "\"";
if (!string.contains(typeData)) {
StringBuilder builder = new StringBuilder(string);
builder.setCharAt(builder.length() - 1, ',');
builder.append(typeData);
builder.append("}");
string = builder.toString();
}
EntitySnapshot entitySnapshot = Bukkit.getEntityFactory().createEntitySnapshot(string);
return entitySnapshot.createEntity(location);
}
if you just append the typeData, it'd be wrong
how so?
oh nvm, I read that wrong
if you already know the entity type beforehand, then that should work fine, yeah
well the data is definitely there
(in this case the bow should have unbreaking)
can you try a summon with that nbt
I want to make sure the nbt isn't malfored for some reason
yep
is this good
I just generated it with mcstacker so I don't know if it is any good lol
i got [00:11:57] Unable to summon entity due to duplicate UUIDs
as the command block output
wait lemme randomize sth
My brain aint computing rn could you tell me if this looks like it would work?
@EventHandler
public void playerInput(PlayerInputEvent e) {
Player p = e.getPlayer();
if (p.getCurrentInput().isForward() != e.getInput().isForward() && p.getCurrentInput().isForward()) {
playerKeyPress.computeIfAbsent(p, k -> new ArrayList<>()).add(KeyCodes.W);
} else {
playerKeyPress.computeIfAbsent(p, k -> new ArrayList<>()).remove(KeyCodes.W);
}
}
ArrayList<Player> playersInIsometric;
HashMap<Player, ArrayList<KeyCodes>> playerKeyPress;
theres also an error log
the else block will also run if the forward input didn't change, e.g. i keep pressing forward but i also press right
oh true thx
its better if you learn a bit of java first imo
alr is this better?
@EventHandler
public void playerInput(PlayerInputEvent e) {
Player p = e.getPlayer();
if (p.getCurrentInput().isForward() != e.getInput().isForward() && p.getCurrentInput().isForward()) {
playerKeyPress.computeIfAbsent(p, k -> new ArrayList<>()).add(KeyCodes.W);
} else if (p.getCurrentInput().isForward() != e.getInput().isForward() && !p.getCurrentInput().isForward()) {
playerKeyPress.computeIfAbsent(p, k -> new ArrayList<>()).remove(KeyCodes.W);
}
}
where did you learn from
i just read the docs/oracle java tutorials
alr ty
i'm not exactly sure what you're tryingt o achieve with the map that wouldn't be achieved with simply storing or just accessing the player's current input
I'm trying to get a cleaner way of accessing if the player is pressing the key or not (like that I can easily access it for whatever)
I need to get keyup or keydown
yes
oh wait
if it's true, it's pressed; if it's false, it isn't
i thought you needed the change that method from f to h 😭
okay, that nbt is definitely malformed
damn
use the data command to print the entity's nbt and compare it with whatever entity snapshot returns
Also is there a reason youre using a list?
thats what i was doing rn
I was using a hashmap to store each players current input
send the nbt from data here if you can, so I can also compare it lol
components:{"minecraft:enchantments":{levels:{"minecraft:silk_touch":1,"minecraft:unbreaking":2}this formatting is definitely weird, don't know where it is coming from
I'm gonna sleep now goodnight and i hope to see the plugin fixed tomorrow 🙏
gn o/
Well, from what I can tell you should use a HashSet instead
you don't need that even
as in: HashMap<Player, HashSet<KeyCode>>
ik
you can access the player's current input by.. accessing the player's current input :pepelaugh:
I think he is talking in the theoretical or for the future
true true
hmm maybe
here is the nbt data from ingame
oh wait
thats for another villager
heres the EntitySnapshot's nbt for the same villager
okay I am confused, while the nbt from my command was malformed, these two are the exact same
i think the issue is then probably in the Bukkit.getEntityFactory().createEntitySnapshot(string);
I don't see any reason these should fail to spawn with proper enchantments
I checked it, all it does is load the entity
where did you check it? (im lazy to compile it)
nvm i already have it compiled
thanks
yeah it looks fine ngl
what could we do in this case? :p
oh wait
tf
its working
at least that one villager
I found a post to create custom enchantments https://www.spigotmc.org/threads/1-21-3-register-custom-enchantments-with-nms.651347/.
Although, I was getting issues with it even working. I was wondering if using a datapack for the enchantments then would there be a way to edit what the enchant does in spigot?
I believe you can check if an item has custom enchantments, yeah
You’d check the namespaced key
I was staring at the codecs like a maniac to check whether there was some data loss somewhere along the run, as all it does for creating is calling the load method on nms.Entity
so the enchantments part is wrong i think
it has a levels key instead of the enchantments
I don't get where that levels key is coming from because from the entity snapshot and data command comparison you sent earlier, that isn't there
this only happens when im trying to spawn in a villager that was picked up on a previous version of the plugin (aka its nbt is given by Entity.f or whatever the obf. name is)
so you mean, items that already had a villager stored in them from a previous version?
yep
how can I get Math in java?
if that's the case, then it must be the fact that the nbt format changed and since you don't apply datafixerupper to your nbt, it didn't upgrade as it should have
yeah probably an import issue
@young knoll sorry for the ping, but I think you had a class which dealt with saving and loading entities while applying DFU properly?
do you know the import?
it says on top
^^
oh thx
the issue is most likely an odd pair of parenthesis
worked 👍
yeah that might be the issue
do you think there is a way to apply the dfu?
there is a way to do that, I just don't remember how lol
Hey, i got a question about the customModelData. Since minecraft changed something about the customModelData in the new version(s), has this changed something about the way to use it in my plugin? Im using this code to set the modelData from the config.yml:
itemMeta.setCustomModelData(customModelData);
But is this still a valid way due to the changes?
I have to cook dinner but once I finish I can look into that properly
thanks! imma go to bed then, its 1 am for me 😔
Yes it's still valid
found it, but you can just check it out when you wake up lol
Thank you!
Under the hood it just converts that int to a float
But i think it can also be a string
Yes
So i will just be convertet to a string?
No
So?
since you don't have a data version, you'll have to look them up here: https://minecraft.wiki/w/Data_version#Java_Edition
now I wonder, since EntitySnapshot doesn't save data version, and createEntity also doesn't apply DFU, it probably breaks the same way
thanks
?
How does it work with a string?
💀
https://minecraft.wiki/w/Data_component_format/custom_model_data
The data components accepts float, strings or booleans
oh and colors
the thing is, in this case even if i use nms, it will still break
since the whole data format is different
at least i think
Oh, ok thanks!
F, should probably open a bug/PR for that
Will do
idk if you read the whole thing but what would you suggest to do in this case :p
where do I put my external jar files within my gradle project, in order to use Path.of?
I'm trying to use the experimental stuff
public class APILoader implements PluginLoader {
@Override
public void classloader(PluginClasspathBuilder classpathBuilder) {
classpathBuilder.addLibrary(new JarLibrary(Path.of("libs", "DecentHolograms-2.8.16.jar")));
}
}
but keep getting this error when running my server: [17:01:18 ERROR]: [DirectoryProviderSource] Error loading plugin: Could not find library at libs\DecentHolograms-2.8.16.jar
I've created this folder inside the root repository folder. I've also place the plugin within my plugins. IK Path.of was introduced in JDK 11, but I'm not sure how this works when your project gets compiled to a jar file, and have to rely on relativeness.
i mean in the worst worst case i could warn players that updating to 1.21.5 would break previously picked up villagers, but that is far from ideal :/
you need to run the upgrade methods on the data
but dont i need to know the previous version for that?
your fault for using NMS (although I acknowledge the API apparently has the same issue)
yes
do note that you have to apply the VILLAGER_TRADE data fixer, not the item stack one
you can just say you upgrade from whatever version that nbt was valid in, probably 1.20 or something
That's the Paper API
I suggest you head over to the Paper discord
forgive me for i have sinned
but to be fair, EntitySnapshot wasnt even an option when i was trying to find a way to do this
(at least for the api version i was looking at)
Mmm yeah I didn’t really think about DFU when making snapshots
Do serialized items go through DFU these days?
in fairness the docs do say it shouldnt be relied upon as serializable 😉
but yeah we should look at adding versioning to snapshots (and also the equivelant methods @worldly ingot added for items or blocks or whatever)
dont i also have to detect in this case that the nbt is outdated? otherwise it would try to convert every nbt
idk if thats an issue though
just add data version to your PDC so that you can check whether it is new or not
I honestly doubt that is the case lol, I'll check later when making the bug report
makes sense
also, the plugin was supporting 1.20-1.21.4, do you think i should call dfu from 1.21.4 or 1.20?
idk which one makes more sense
from 1.20 since anyone upgrading from that version will have issues otherwise
it'll apply more data fixers than necessary but it's a one time thing so eh
I wonder what will happen if the data is newer though
it should properly ignore the data fixers it can't apply
I'll test it later when I finish cooking
Give me a ping when you're done so I find the result tomorrow :)
also, what if i just try to manipulate the string myself?
{components:{"minecraft:enchantments":{levels:{"minecraft:unbreaking":1}}} -> {"minecraft:enchantments":{"minecraft:fortune":3}}
this seems to be the breaking change so
I mean, there's nothing stopping you from doing that
I would personally do that as well so that you don't have to deal with nms in the code that is supposed to be full API lol
that said, unless the API is fixed in this version, you'll have to deal with DFU for future versions
:/
i think ill look into it tmr
its best to save the data version now though, in case its needed later
regardless of what i do
oh shi 💀
ItemFactory#createItemStack() and ItemMeta#getAsString()? Because I'm fairly certain I specifically noted in the Javadocs that they're not meant for serialization, only for user-input and configuration
For this very reason. Because they don't go through the DFU
Those entity snapshots were also only really meant as a way to pass an entity template into a spawner configuration, so same thing there. I don't think it needs a version. They were never meant for serialization
So I'm making the player a spectator of an armorstand but when I move (tp) the armorStand the player does not follow...
configuration sounds a whole lot like serialization :p
I'm even making the player a specator every time I tp the armor stand
Absolutely not
I meant like being able to configure an item in a config.yml similar to how you would write a /give command. Because people kept making these stupid convoluted YML item parsers instead of using the SNBT format Mojang already has built-in for their commands
It's up to server owners to keep their config.ymls up to date much like they keep their command blocks up to date
Bold of you to assume they have command blocks
I'M DRAWING A COMPARISON
OMG
HOW MANY COMMAND BLOCKS DOES HYPIXEL USE HUH
WHOLE SERVER IS DONE WITH COMMAND BLOCKS
really?
Knew it
I thought they mostly used plugins
can any1 help?
you have to unmount the player from the armorstand, then teleport
the easiest way to do this is to have a new armorstand at the destination before hand, and then you teleport and mount player to new armorstand, delete old one
ah
what about velocity?
if I use velocity it'll work
i disagree
in fact
I wholeheartedly disagree
words simply lack the ability to express my disagreement
That's why you contribute to Paper and I don't really contribute anywhere anymore 
your mother
wtf
Was pretty funny
what is this chat 😂
if where you want it to go is a short distance sure
Damn, doesn't even do any work at hypixel anymore
Anywhere public*
Damn doesn't even update his component pr
I gave up
Fair
😂
#help-development is the second #general fr 💀. #help-server is too serious don't like that place
Why isn't this working?
ArmorStand playerAS = playersArmorStand.get(p);
Location asLoc = playerAS.getLocation();
float yaw = asLoc.getYaw();
double radians = Math.toRadians(yaw);
double forwardX = Math.sin(radians);
double forwardZ = Math.cos(radians);
double rightX = -Math.cos(radians);
double rightZ = Math.sin(radians);
double leftX = Math.cos(radians);
double leftZ = -Math.sin(radians);
double backwardX = -forwardX;
double backwardZ = -forwardZ;
Vector velocityRight = new Vector(rightX * asMovementSpeed, 0, rightZ * asMovementSpeed);
Vector velocityLeft = new Vector(leftX * asMovementSpeed, 0, leftZ * asMovementSpeed);
Vector velocityForward = new Vector(forwardX * asMovementSpeed, 0, forwardZ * asMovementSpeed);
Vector velocityBackward = new Vector(backwardX * asMovementSpeed, 0, backwardZ * asMovementSpeed);
if (player.getCurrentInput().isForward()) {
playerAS.setVelocity(velocityForward);
}
if (player.getCurrentInput().isBackward()) {
playerAS.setVelocity(velocityBackward);
}
if (player.getCurrentInput().isLeft()) {
playerAS.setVelocity(velocityLeft);
}
if (player.getCurrentInput().isRight()) {
playerAS.setVelocity(velocityRight);
}
fr 😂
can any1 help?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
what are you trying to achieve
the armor stand isn't moving when I press wasd
also what is p
it's supposed to move when one of those keys are pressed with velocity but its not
in this context
player
either asMovementSpeed is too low or zero or the current input isn't working properly. What have you done to try and debug it
well I used to tp it to move it instead of using velocity and that worked so its not the input
also I'm assuming
playersArmorStand.get(p);
is a hash map which means you are using a player as a key, which is a big nono
why?
using player as a key causes data leaks. Use UUID
just print velocity to console and see if the output looks normal
hmm is this too small?
[22:18:43 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:43 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:43 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:43 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:43 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:44 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:44 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:44 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:44 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:44 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:44 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:44 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:44 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:45 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:45 INFO]: 0.7156892555090487,0.0,0.6984188496517714
[22:18:45 INFO]: 0.7156892555090487,0.0,0.6984188496517714
(of values)
bigger values but still wont move a pixel
is the gravity on the armour stand disabled?
thats the only other thing i can think of
yep
easy but overlooked solution 🙄🤦
given velocity is physics
yup cool thx
seems like it
indeed it is
in spigot all you need is gravity, couldn't tell you what would happen in paper
ye
is there a comparison of how much velocity I need to move said distance?
like .5 for one block smth
aprox
I HAVE A PROBLEM!
FIRST:
so umm disabling the gravity works, but it means the armorstand wont stay in the air... which is a problem...
Second:
My player does not follow the armorstand... (they are spectating the AS)
oh so you want to control the armor stand while spectating it
yup
sry I didn't mention that
but like I mean when a mob walks around you follow so whats the difference here?
Anyone know what event I can listen to in ProtocolLib to intercept and modify messages sent by server to player?
this?
Like when player type /essentials version. the server send plugin messages to the player via sendMessage()
i want to intercept that event and change the message
I saw premium plugin done that but i'm not sure how
?
might be this one. will play around. thanks guys
its not plugin message
looks at link i sent
plugin message is for client channel messaging
can any1 help on this or is this undoable? or too complex...
-
I dont think you can make velocity work without gravity. You can either try display entity interpolation or just manually calculating velocity then update every tick (will be choppy)
-
Are you unmounting it or something?
it should follow naturally
it should, it doesn't
I'm not unmounting it
I stay mounted I'm stuck in it but remain at the original position when I exit the armorstand I tp to it's latest location
my alt sees the armorstand move away but I stay there
at the end of testing
I kill the armor stand or go into creative
sending a vid one sec
here
dont know why it does this but yeah
that argument really only works in principle because in practice, we all know people are using these utiltiies for serialization
one may argue that it is misuse, but is it really? Considering it is the only sensible way to serialize these objects, be it in a configuration or whatever other type of data storage
if it were the case that the server platform had to provide their own upgrading system, I can understand, but vanilla provides it for people to use, so I realistically see no reason to not take advantage of it and make people's lives easier
as you can see in the vid I exit the armor stand by killing it at the end
its not going to follow exactly especially if you are flying and in creative
Does anyone know how to set the tick of a falling sand block? (I just got into plugin making so sorry if it is a stupid question.)
What do you mean?
so I made falling sand that I don't want to despawn, the reason I won't use block displays is because they have no collision, but I don't like how they time out after 600 ticks, is there some way to stop that or at least reset the timer.
is it not possible?
Or even how to detect left click on falling sand as it seems that also doesn't work.
setTicksLived maybe
I tried that already and all it does it freeze it in place and doesn't let it do anything.
dont think theres any way to do this
but can definitely do work arounds with invis entities
aww... ok, thanks
So annoying, server got killed
Is it possible to create a decently big character that'd still get affected by color codes, with a texture pack?
They do?
they do
wait sorry, I shall wait until you guys are done with that.
Or make a thread
Does anyone know how to detect a hit on a falling sand block or is that not possible?
InteractAtEntityEvent?
Does that work for a hit though as it seems to only work on a right click.
"physical" interact is an option
oh, ok, thank you!
Can you give a riding entity an offset/translation?
is it considered bad practice to have a game instance be a listener and register/unregister it at its lifecycle phases? I know it's usually discouraged to register listeners at runtime but it would seem annoying to implement a seperate listener for all game instances and all I need
its not so much the registering, but the unregistering which would be the issue
can you not have some sort of proxy listener to pass it through to?
well that's what I was saying, it's annoying to have to do that for each event I need
because I'm not gonna implement that for each event there is
well, I could write some script that would generate such an interface but that's also really annoying
yeah just heaps of boilerplate
i mean as long as you handle unregistering properly it's not inherently that bad
so that's kinda a lot
why?
I now have 4600 more lines of code in my project
thanks
Hello which is the best version to make my server actually thx you
latest
not always
dude 💀
sub sections 🙏
XD
does java have smth like
"hello {0} im from {1}".format("user1", "abc")
like python natively
you have String.format
String.format("This is %s, and it's year %s", "spigot", "2025");
ahh alright makes sense
python also has the same format but it i was superseded by this
Or "".formatted if on newer java versions
events can be unregistered and registered at runtime and all it does is cause the handler lists to be re-baked, i.e. flattened into an array; not something you want to do every few ticks but for something with as long of a lifecycle as a minigame or whatever this is, it should be fine
just remember to actually unregister it or you'll be accumulating bogus event handlers and leaking memory
for more oop style event listening, i'd recommend having the object your game lifecycle is bound to to implement Listener but declare any event handlers, and subscribe to events with
PluginManager::registerEvent(
@NotNull Class<? extends Event> event,
@NotNull Listener listener,
@NotNull EventPriority priority,
@NotNull EventExecutor executor,
@NotNull Plugin plugin)
where EventExecutor is a functional interface which is typically just passed a method reference to what your @EventHandler method would be
once the game is done call HandlerList::unregisterAll(Listener)
I ended up with this fuckery https://github.com/radstevee/axi/blob/master/core/src/main/kotlin/net/radstevee/axi/event/Handleable.kt but it's kinda nice to use actually
I'm probably gonna change it in the future to one listener per instance to support priorities and such
Wait why is there one per event 💀
Could you not just have a generic method
then what if you wanna handle multiple events
It should, the plugin sets you to spectator first...
should probably make sure they are not in creative and flying first
there are just some things the server won't do on its own, such as removing flying
oh really
You call that method multiple times?
Have it like a register event method
oh I meant on the instance-side
well that could work but needs actual registration
just register them individually with generics
see my message above
have a nice wrapper over this method in your minigame object that checks for the lifecycle
I thought he meant like a fun <T : Event> handle(event: T)
e.g.
this.listenTo(PlayerMoveEvent.class, (event) -> doSomething());
still dont work after removing fly
I'm just not a fan of having to register everything manually
or
this.listenTo(PlayerMoveEvent.class, this::onMove);
private final void onMove(PlayerMoveEvent e) {
//do something
}
if you think about it, writing a method call and passing it a lambda isn't much different from implementing and annotating a method
same amount of boilerplate
yeah I'm aware, but for my implementation, you just register one singular listener that listens to all events and calls them for the provided handleables
hmmm interesting
