#help-development
1 messages · Page 826 of 1
Spigot simply doesnt support it.
Event is abstract and i think you can only listen to concrete implementations
IJ is being nice
whats the maven settings to install something to .m2 inclusive javadocs? just 'install'?
I thought you were still trying to get the spigot javadoc jar working
hm
would <goal> jar </goal> work u think?
defuq
it generates a @param for <T>, but its not showing up in the javadoc
the other params are
https://pastebin.com/TyDprG2T
https://pastebin.com/Fs8P34q1
have this to classes. i cant understand why does decrementTierParameter and setCurrentTierParameter not working?
ModifierTier modifierTier = unbreakingModifier.getTier();
modifierTier.decrementTierParameter();
unbreakingModifier.setTier(modifierTier);```
What is that anyway
- Use primitives for your ints unless you need nullability.
- Never create a getter or setter for your maps/sets/lists or other collections
- Explain how you determine if those dont work
in this part of code i have print after .decrementTierParameter() and before
and they output equal values
Show the code you used for testing
@EventHandler
public void onItemDamage(PlayerItemDamageEvent e){
ItemStack itemStack = e.getItem();
if(!hasItemModifier(itemStack, Modifiers.UNBREAKING)) return;
AbstractModifier unbreakingModifier = AbstractModifier.modifierFromItem(itemStack, Modifiers.UNBREAKING);
if(unbreakingModifier.getTier().getCurrentTierParameter() == 0) return;
e.setCancelled(true);
System.out.println(unbreakingModifier.getTier().getCurrentTierParameter());
ModifierTier modifierTier = unbreakingModifier.getTier();
System.out.println(modifierTier.getCurrentTierParameter());
modifierTier.decrementTierParameter();
System.out.println(modifierTier.getCurrentTierParameter());
unbreakingModifier.setTier(modifierTier);
System.out.println(unbreakingModifier.getTier().getCurrentTierParameter());
createItemWithModifier(itemStack, unbreakingModifier);
}```
Could you comment the output after your sysouts?
wym?
ModifierTier modifierTier = unbreakingModifier.getTier();
System.out.println(modifierTier.getCurrentTierParameter()); // 1
show the output
If your output is
ModifierTier modifierTier = unbreakingModifier.getTier();
System.out.println(modifierTier.getCurrentTierParameter()); // 50
modifierTier.decrementTierParameter();
System.out.println(modifierTier.getCurrentTierParameter()); // 50
While ModifierTier#decrementTierParameter() is
public void decrementTierParameter(){
this.currentTierParameter--;
}
then you are not using the code you've sent us. (Or your jvm is broken)
wtf
not using the code?
i will check
okay
i dont uderstand how
but i check in the method
public void decrementTierParameter(){
System.out.println(this.currentTierParameter);
this.currentTierParameter--;
System.out.println(this.currentTierParameter);
}```
Also, why do hell you want tiers for unbreakable flag?
and its working in this method
I believe it's because this.currentTierParameter is refering to a different object than the one returned by getCurrentTierParameter
make getCurrentTierParameter return your field instead and It might work as you intend
oh god...
what in the fook
I thought you had a simple getter for the field
whered u find this
?tas
❓
I want to store a bunch of booleans in a PDC. Which of those options is better:
- converting the booleans into an int/long
- making a boolean array PDC type that does it for me
its the same thing, just in the PDC type then?
aka 'add powers of 2'
ive a list of those up to 2 bil
iirc adding and bit & takes 1 operation each, so it should be faster than bit shifting it by 0<n<32
You can use EnumSet, that's internally just a bitmap
ye but can u store that in a PDC
Oh, no idea
Alternatively you can use BitSet, which you can convert to byte arrays and vice versa, which is a nice wrapper for setting the bits
And for the position use enum#ordinal()
ordinal changes if the implementation does
im not gonna use that
hm issue, I cant seem to get the EnumSet class i need for a custom PDC type
the issue being that i cannot just use EnumSet because this only works with a very specific Enum
you gotta do some ugly casting
i... cant figure out how
the autocomplete aint helping
i only need it for the complext type method thingy too :/
I think you do
(Class<EnumSet<Type>>) (Object) EnumSet.class
or something along thje lines
you don't need to use it
no
its there to create new data containers
if your data type serialises to a nested PDC
ah no i dont
its enum <-> int
cuz an enum basically is just a boolean
i just want to do it in a way that doenst break when i add a new value to the enum
that would be a long[] then
i mean
it wont have that many entries
the reason im using int is to keep the actual PDC entry short
i want to keep it readable when readout using /data get
31 values should be enough
uh
how do i create an empty enumSet
iirc it's EnumSet.noneOf
ye that did it
Okey
Pretty sure .3 was also fully replaced
why can't i use this here? It doesnt work with new, nor with adding the <int, enumset>
it needs to be an instance iirc
an instance of the pdc type
the data type interface uses all instances
hm
I just make mine singletons
I'd rather not have a singletron with a conversion method this size
Hello i am trying to change the yaw and pitch of a player. The problem is that the player is teleported on the center of a block when the pitch and yaw is modified. Is there a way to modify pitch and yaw without change the player's position ?
EnumSet also uses ordinal
wat
wait i dont care
the implmentation wont change while the code is running
if it does not my problem
float pitch = (float) (p.getLocation().getPitch() + (Math.random() - 0.5) * inaccuracyAmount);
float yaw = (float) (p.getLocation().getYaw() + (Math.random() - 0.5) * inaccuracyAmount);
Location l = p.getLocation();
l.setYaw(yaw);
l.setPitch(pitch);
p.teleport(l);
It doesn't, ordinal is just the index of your enums, with the top one being 0
anyone know how to install 1.20.2 nms?
?nms
everythign is jeff here aint it
yup
i got the PDC explanation from one of his posts too
run buildtools with --rev 1.20.2
in the intellij terminal?
id recommened in a different folder
wdym
you need to downloads buildtools first
?bt or get the gui in #1117702470139904020
where do i put the .jar
id recommened a new folder inside downloads and run it there
i put it in my idea projects
i would avoid against doing it inside your project as it will contain all of bukkit, craftbukkit and spigot and probably all of mc source and you dont want to put that on git
all mb
I have 2 questions, the first is how does EulerAngle work? If I try to rotate the head of the armor stand using
armorStand.setHeadPose(new EulerAngle(0,1,0));
The head of the armor stand turns to 57.29578f, and the second question is, how to know in which direction the player is facing? It's hard for me to figure out how to use player.getLocation().getDirection() to find out which direction of the world (north/south/west/east) a player is facing
is that good?
do i make the scope as system?
leave scope as provided
yep thats correct
correct as well
then why is that erroring
reload maven
wait wtf?
is that from reloading maven
yes
question if I compile plugin and target java 17
```<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version> <!-- Use the latest version available -->
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>```
will that plugin be able to run on 1.8
?paste your pom.xml;
servers
no
no
thats java 8 only
So tu run plugins on old server I need to compile plugins with java 8
nothig above
?paste
java 11 works but not everyone will be running it
if anything i recommened not having all updats for like 1.18+ and having an old download ver that has the main features
how does EulerAngle work? If I try to rotate the head of the armor stand using
armorStand.setHeadPose(new EulerAngle(0,1,0));
The head of the armor stand turns to 57.29578f
@remote swallow https://paste.md-5.net/obanazeqok.xml thats my pom.xml
I complile jar with dependancies on Scope- compiled
and they are not addded to jar
if u wanna see
maven shade plugin added?
so I was thinking maybe problem is in java
remove this and reload maven
oh
wait will they not be addded with maven compiler plugin
nope, add shade plugin
check the jar exists at C:\Users\USER\.m2\repository\org\spigotmc\spigot\1.20.2-R0.1-SNAPSHOT should be called spigot-1.20-2.R0.1-SNAPSHOT-remapped-mojang.jar
one more
I am running multi modular configuration
can shade plugin be in ProxyManagerModule
and dependancies listed as scope compiled in Bungee and Veleociy module
or that will not work
if it all compiles to 1 jar it should™️ work
well I got weird problem
like from some reason when I do it that way Transitive dependancies are added to my uber jar
the jar doesnt exist properly, run buildtools again
same command as before
im guessing another module depends on the manager module then?
well not what I did is this
https://pastebin.com/qsdPrQGq
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
and nothig depends on ProxyManager
alright time for my god complex to be replaced by imposter syndrome cuz im about to test my code
wish me luck
Could you help me pls? How to get the side that player is mostly looking at? For example (West/East/North/South)
get eye direction and do math
i'm too stupid..
well you get Player#getEyeLocation().getDirection() check what its facing is
eg
you just figure out which segment its in, 4 or 8 depending on how accurate you want
dont think you need to
just grab the pitch and be like if(<45°) elif(<135°) elif... adjusted for the 2Pi thing
is it possible to apply a potion effect to a player that the player cannot see in the top right?
well
if the particles are invisible so is the symbol in the top right
the thign in the inventory you cant get rid of
using the api at least
so i could get rid of it without modding ?
i thought the icon still showed for that
so no particle = no icon?
oh there is an icon param
But getDirection is returning float
declaration: package: org.bukkit.potion, class: PotionEffect
thats pretty cool
get direction returns a vector
thanks
adjusted for the two pi thing
the direction yaw is in radians, not degrees
oh.. A vector, yeah
also if you have a vector
you can just flatten the y part of it and check which values larger than the other
yeah you dont really need a y for this
ye just grab the vectors x and z and compare em
i believe the vectors are normalized so whichever vector has the larger absolute value gives you if it's north/south or east/west, and if the larger absolute value is positive/negative gives you which of those it is
idk if they're normalized on get, might be best to nromalize anyway
i know thats not actually related but its much easier to see on normalized vectors
not required, its just easier to visualize in ur mind
normalizing will remove some accuracy but i dont that might accuracy would be needed formost stuff
i made something like this
double x = player.getLocation().getDirection().getX();
double z = player.getLocation().getDirection().getZ();
if (Math.abs(x) > Math.abs(z)) {
if (x > 0) {
player.sendMessage("West");
} else {
player.sendMessage("East");
}
} else {
if (z > 0) {
player.sendMessage("South");
} else {
player.sendMessage("North");
}
}
?tas also i mean i would normalize the vector but sure
If multiple potion effects are supported, is there a proper way of removing a potion effect of a given type without removing all effects of that type?
Bukkit.createInventory
Thanks
if (event instanceof EntityDamageByEntityEvent == false) {
}
``` does this look good or bad compared to the (!(instanceof))
(!(instanceof))
why i get error?
To me this looks kinda bad
k
lol
I just saw someone on stackoverflow say that
You're writing too much chars
How do you compile?
i try

if i do compile get the same error
if(!(e instanceof EntityDamageByEntityEvent)){/*logic*/}
yes
Let me ask differently.
What steps do you take to start your compilation.
clean, install, compile, mvn clean package -U, packege
what in the
??
why do you run install, compile and clean package and package
all you need is mvn clean package
you dont even really need that
ah
even mvn package is good
but i use mvn clean package
just mvn package, only clean when needed
yep
yes but the problem is another, not the package
Did you added hikari to deps?
Show your maven log
Do your project has multi modules?
yes
When you run any maven goal, then it gets thrown right into your face...
?paste
What is the purpose of the first conditional statement?
so like
if I wanted to add logic of an entitydamageevent, and I also want to add logic for entitydamagebyentityevent
hikari config has java 11 compiled but your project uses java 8
Did you add the dep into root or module
i dont want both events to be triggered
how i can adjust it?
You can listen to just the EntityDamageEvent and check if its an instanceof EntityDamageByEntityEvent
Either use an older HikariCP version or update your project to use java 11+ instead of 8
What mappings are usually used nowadays? Mojang or spigot?
Mojang is more convenient
Spigot mappings got dropped
oh they did?
spigot internals still use obsfucated/spigot but most people use mojang now
got it, thanks
?nms
If I created an inventory and made it open when I click on a block, then when I reload the server, the inventory will disappear, right? Then I need to store it in the PersistentDataContainer?
you shouldnt ever be reloading production servers, ideally not even dev servers so you shouldnt need to keep track of that
if you want to preserve changes you need to store it somewhere
also i dont think invs have pdc
if it's always the same, don't
I mean, save inventory in pdc of the block
I use customblockdata
dependency
It's a bit hard because if I need to add a plugin or something like that to the server, then every inventory of the block will disappear
Just dont reload. 👍 (seriously)
And for restarts you need to save your data in any persistent medium. PDC could be one.
On that note, how do I (conceptually) create custom entity AI with packets?
if anything the data should be stored across restarts
@lost matrix tnx
whats good youtuber to learn java?
Thats a bit weird. Why wouldnt you just use minecrafts classes in the first place?
You pretty much have to reinvent the wheel when using AI on virtual entities.
I looked it up online and apparently I had to use NMS? How can I set an entity's path and pathfinding otherwise?
You cant set anything like that with packets.
Packets are used to notify a client that something on the server has changed.
Like the position of an entity.
AI runs entirely on the server and the client has no idea about what an entity is thinking.
So extening an NMS class and then actually spawning the entity in a world is the way to go for custom AI.
I hate ClientboundBlockChangeAckPacket
or whatever it's called
that shit screwed me over for a week
the change ack packet!:!??!
mhm
whatever
"ClientboundBlockChangedAckPacket"
that fucker
why tf did mojang decide to create that packet...
Thanks, and why do I have to extend the NMS class?
I think if everything was properly coded, packets and other bullshit wouldn't even exist
mojang 😣
Yeah the client would just use magic to sync with the server
What is syncing between the client and the server?
Because it allows you to overwrite methods, effectively changing the behavior because your methods get called instead of the parent ones.
packets... wouldn't exist??
how are you sending the data without packets
Just use quantum entangled states 🙂
hard line copper from server in germany to player in aus
fr, what did they think back then?
Noobs creating the internet-
So true tbh packets are dumb we should get rid of them
we should just have the cables in space
fr
Honestly this spex guy is right let's delete the internet
Fuck packets this is all mojangs fault
☕ 🚬
I think you need a little networking in your life spexx just the basics buddy then we'll be square
im drinking packets of coffee right now we dont need them
tldr
dont go to big forums
"buddy" please dont call me that I feel like you're gonna dm me any second and offer me your only fans
im scared
he hasnt sent me his onlyfans yet
I got better things to do with my life than that buddy in good
i thnk ur safe
hes too busy with a gf and a cat
God would respond but you seem to not be a fan of packets so he can't send the message to you
lasagna
pork with bean sprouts
A help development question
how do i make a project with spigot and mc creator with nms so i can make a full network server with bedwars, hypixel skyblock and wool wars all custom coded with double the amount of stuff hypixel has
in 1.4 with java 17 and using pdc i saw its really good
you arent remapping most likely
?nms follow this tutorial for nms
Sounds like you compiled with the wrong mappings
?paste teh full error
you probably shaded protocolLib into your jar
?paste it
that looks correct
whats wrong with the imports
if thats the compiled jar those arent getting remapped
We can't tell you've nto posted the full error
Does anyone have experience with custom skills (like fishing, mining, trading) etc and have a solid way for a message to be sent when the skill is leveled up? Mine just simply isn't working
i just read this pom and why is the compiler plugin outputand source set to 15, also you probably just need to do a clean package
what steps do you take to package
is that Eclipse?
^^
ah
that should have mvn prefixed
you were compiling with intellij instead of maven
easy way to tell, use the maven window on teh right
@remote swallow when you gonna update your PR
either create a new run config that has clean package as run and swap to it then use that or just run the clean task and swap back to just base package config
because you still arent remapping
you need to run the clean task
This is the first time I create a multi-instance bw plugin, how can I manage the availability and type of bedwars? With MySql?
emm, i update this
Sr.Developer i put Jr.Dev
nono
update shaded plugin
It's the last one
your maven shade plugin has 3.5.1?
what method names are too long
doesnt sound native
bug the developer of the lib
bin ich also wie soll ich java lernen?
?learnjava is probably the best i know of anyway
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
ok
good for you
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I don’t wanna :(
I got weird problem my transitive dependencies end up in my uber jar
I am listing specific dependancies for Module1 and Module2 and MasterModule should shade there dependancies but it ends up grabing there transative dependancies
If your Master shades in a Module, then it obviously needs to grab the transitive dependencies as well.
Otherwise they are not on the classpath on runtime...
should I then shade each module seperatly
and then add shaded jar as dependancies in Master module
I dont understand what that means. You cant really shade modules simultaneously.
A master module in maven doesnt result in any compilation. It is used for common configuration of your sub-modules.
is it possible to make inedible items edible without nms?
here
to be clear more ProxyManager has those two as depndancies
not If I go in bungeeproxy and addd dependancis and shade configuration there
only those dependasies are added and not there transative stuff
but if I move shade configuration to ProxyManager pom then I am getting jar like 5 mb
full of junk
if I do each module seperatly problem is not apearing
I have never seen a master module with source code. That just doesnt make sense to me...
there is nothing in src
that is POM configuration
to be more clear
proxy is parent to those 3 inside if it
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
proxy - pom
and proxy parent is BeastTokens
I think I made my life complicatedd
with no reason
and I need to rethink it
xd
so basiavly in proxy I am adding some shared dependancies which can be used by BC, VP and ProxyManager
Ok so dependencies declared in your parent pom, will be added to each child module.
And what specifically is your problem with this setup?
so I don't need to add them to each moddule
here
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
this is ProxyModule Pom
but when thing get shaded with it
then I get junk jar
What is "ProxyModule"??
how to i check if an entity is passenger and if gets the entity is riding
I dont see a module named "ProxyModule"
well ProxyManager has BungeeProxy and VelocityProxy as dependancies
and then it run shadding
it is ProxyManager
Entity#getVehicel()
Ah ok
I think I broke whole think made it over complicated
thx
I wanted it to be simpler but I just f... up everything
how can i make an entity not make a sound when its hit
or in general disable an entites sound would be even better
So ProxyManager depends on BuneeProxy and VelocityProxy and selects an implementation on runtime, based on the detected proxy.
Now try to explain again what the problem is...
Entity#setSilent(boolean)
thxxxx
Eh sure
i have jdk 17, but i also have 21, i need to download 1.18.2 from BuildTools, how do i run it with 17 instead of 21
specify the path to the java 17 java.exe
#1117702470139904020 message you can just use the gui too
it auto manages java versions for you
@remote swallow yet another BTGui win
bnerd
how
no love for the gui 🥲
yup
or the jar whatever fancies you
nothing fancies me
what java command do you have to do to open the gui with the jar?
just click it to run
oh
you might have to ignore windows smartscan
can you display a fake damage animation for an entity?
when i clicked it it just executed it with no gui and downloaded some version
huh did you download the jar file or the exe
i clicked on both, the jar file did that and the exe just showed the logo then didn't open
brub sorry its still in dev lol
ok
how about this one 🥲 I patched that bug I'm pretty sure
if not I'll show you the command line way
well, I don't know windows
can i do java --jar BuildTools.jar gui?
but I'll try
nah It should just open when you double click teh jar
yeah its just running
🥲
worked, just gotta see if it will download
wtf those are the only versions i HAVE
@river oracle i downloaded JDK 17 ffrom here, https://www.oracle.com/java/technologies/downloads/, where is the java file located?
in the gui check something for me
Press Debug Info
then copy and paste that into a paste for me
?paste
thats using java 8
Options > Click Override Java Detect > Click Detect and Choose java 17
GUI is only detecting 8 installed though
Debug Panel only shows that
yeah
ohh
@wide cipher tell me the location of your java 17 install please
that's a bug but for now you'll need to manually set the path
where it is on windows I have no clue I've been on linux too long now
C:\Program Files\Java\jdk-17
you can set the GUI's path to that manually
its just a bit of work to navigate there
it wants a file, what file do i put it as, folders don't count
Hi!
would anyone know how to tell if a player is facing the X or Z axis?
java.exe in bin
ok
when i spawn directional particle, what are the offset parameters doing?
how can I display an entity damage effect to a player?
when i select that and go back to compile it, it resets back to the one it detects
there might be a way with packets
idk ive never used it
i've tried it but it doesnt seem to work
yeah so prob use packets
what's the remapped packet name in 1.20?
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
this is why we need to open a beta before release 🥲 so many bugs to fix we can't find
anyways you can still run regular BT with that java relase just copy and paste the path to the java.exe file
and run the whatever/path/to/java/17/bin/java.exe BuildTools.jar --rev 1.18.2
should work
ok
i did this C:\Program Files\Java\jdk-17\bin\java.exe C:\Users\MYNAME\Downloads\BuildTools.jar --rev 1.18.2 but it said bash: C:Program: command not found
""
idk windows command line so can't help there
spaces in path
do i just get rid of them?
like "C:\Program Files\Java\jdk-17\bin\java.exe"
doing this "C:\Program Files\Java\jdk-17\bin\java.exe" BuildTools.jar --rev 1.18.2 getting this ```Error: Could not find or load main class BuildTools.jar
Caused by: java.lang.ClassNotFoundException: BuildTools.jar
oh
yep thanks
only works if the buildtools.jar is where you are running this command
Hey guys! I recently switched from windows to linux to continue programming my spigot plugins. I unpacked the BuildTools.jar with the terminal and got 1.19.2.jar but the problem is that once I upload the jar into eclipse(programming software) importing the libraries wont work
Welcome to linux 🤓
When I hover over „JavaPlugin” it says „cannot resolve type”
And the imports cant be recognised either
Any ideas?
I had to do this, my programming laptop is so slow 😭😭
have you installed java?
Yes
In fact I got the 17 jdk
@umbral ridge are u able to help me?
Maybe I show u my screen or something
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Whats that?
get the jar file and import it in eclipse by changing the build path
I recently switched from Eclipse to JetbrainsIDE so I know a little about it
did you add it to the build path
I tried both but sticked to eclipse
Could you just help me on a call man
I added it to external libraries
I can't call im not home
why not use maven?
Oh alr
It's in \Spigot\Spigot-API\target
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
btw Eclipse is weird with javadoc, I used to just import a javadoc jar and it worked fine. If you'll need it, you can get it here https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/
Should give netbeans a try
I think its nice because its still updated
Netbeans best beans
i hate the netbeans codestyle it puts on java
but its the like c++ or c# format not java
if ( isBad ( thisFormatting ) )
{
}
You can just change it
Believe it has some other defaults you can select from
yeah well md didnt so now i will hate netbeans
Hello,
Does anyone here know how to register custom entities using 1.20.2 NMS Version? And how to spawn them?
Why would you want to do that? There's possibly a better way to accomplish what you are trying to do
But generally it's the same as in the older versions
theres about a milllion reasons to do this
im sure if he knows nms he also knows if he should use it or not
does calling an empty method does something with the perfomance in any way?
why in the world would you call an empty method, though?
that wasnt the question
the performance impact is negligible, but you're still placing the method parameters on stack temporarily if nothing else
yeah, that's why I asked my own. You can ask questions but we can't?
🤔
What if your plugin doesn’t have an onDisable implemention
Then spigot calls an empty method!
ok
im using interfaces with methods, many objects need a few methods some dont need all of them, but they still are the same kind of object
Every time i put a wolf on an entity it starts atacking the entity how can i stop that
you're fine
turn of ai
no i need the ai
cancel entity damage evnet?
then i guess you gotta figure it out yourself
optimize when you need to, premature optimization is not as good as identifying and alleviating hot traces 🤷
take a guess what channel this is
Those poor sheep/skeletons
but those are the only 2 ways?
Imagine if humans had bears stacked on their heads
i strongly disbelieve that
Idk rip out half their ai goals
i mean yeah but that will like
5x it
im soon gonna be out of the 32b integer limit
It's not
nice christmas hat md
I never in my life time had to create a custom entity using NMS. And if you think there are a million reasons, then you are DEFINITELY doing something wrong
Gotta have that performance
Spending hours over hours creating unmaintanable code for 1 less ns/tick, lets goo
Not sure what crazy code ur writing
I recently made a custom NMS entity that basically does no ticking at all, it’s only a few methods
marcely how would you create only client side entities then?
That's probably the least problematic you could do with them, but I have been thinking of custom AIs or copy pastes of the tick methods, which were quite common with 1.8
Yes, that's why there aren't a million reasons
You create a new instance of the NMS entity and send it to the client via a packet
while building the multimodule project it said it couldn't find org.spigotmc:minecraft-server:1.20-R0.1-SNAPSHOT:txt:maps-mojang even though that's what the tutorial said to do
ok
is there a way to generate like 100x100 blocks of world
then make it like start to disintegrate sorta at the edges to close in
sorta like a world border closing in\
world being vanilla world gen
Custom world generator
i have my own chunk generator
can I just generate 6x6 chunks and leave everything else as void?
<remappedDependencies>org.spigotmc:minecraft-server:1.20.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies> it can't find this
even though i did the buildtools
did you run buildtools with --rev 1.20.1 and --remapped
yes
what's the api's for builds, releases, and versions?
hm??
the endpoints
reload maven
i need this, but for spigot
oh that doesnt exist
we have buildtools
okay
just run it every like 3 days and you have the jar
The magic of compile if changed
how come you can directly download paper but you have to use buildtools for spigot?
just curious
paper uses binary patches at runtime and thats a legal grayzone
spigot wont enter it
check the jar exists C:\Users\USER\.m2\repository\org\spigotmc\spigot\1.20.1-R0.1-SNAPSHOT
that one exists, go back 2 folders and check the jar exists in org\spigotmc\minecraft-server\1.20.1-R0.1-SNAPSHOT
i cant see the name of the 1 jar in there
wdym?
i cant see if the jar has -remapped-mojang on it
its cut off
im gonna guess you probably need to run buildtools agin
should be
it still doesn't say -remapped-mojang
did it complete fully
i just checked and remapped deps isnt even meant to have mc server
?nms
how do you do it
copy the special source plugin on the link and change the versions
thats how i got it
this does not come up in it anywhere
i just changed version
no
wait
im confused, how did i get to that?
no clue
new error
this?
Yes that
new error
fixed
how can i use the multi module plugin in my plugin? @remote swallow
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 th...
thats what i was looking at, it doesn't say how to put it into your actual plugin
setHealth. No source though
it uses the ideals of your making a new project
also designed for libs so you just have to rework it a bit
so do i just put it in the dependencies of the actual project?
like i want to make the spigot dependency have the right version, how would i do that? <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot</artifactId> <version>1.20.2-R0.1-SNAPSHOT</version> <scope>provided</scope> <classifier>remapped-mojang</classifier> </dependency>
Every time I've used that
It's just been super complicated to make a system for that
like spawn prot and all that
Just emulate a damage event
i got the dependency in but i can't access any of the things like getNMSHandler(), @remote swallow how do i do this? also want to thank you for all the help you've been so far
You mean getHandler?
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 th...
hi, i have a noMethodError, i don't need help fixing it, i just want to know what .fQ does with NMS java.lang.NoSuchMethodError: 'com.mojang.authlib.GameProfile net.minecraft.server.level.EntityPlayer.fQ()'
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
does worldborder.getSize() show current size
like including transition
if it was halfway through a transition from like 100 to 20 blocks would that say 60
I doubt it. My guess is the size change is client side
does spigot have api for the tick command yet
weird, its not there
make sure you check the correct version
yeah, looks like its probably the respawnAngle method
these 6 chunks will be a custom generator
also how do i change world minimum height to 0
only at creation
how do i regenerate a chunk using a different chunk generator
is that possible
like start the world with a void chunk gen then after that randomly generate 6x6 chunks in centre using a different one
6x6 != 6 sir
i already have my biome provider and chunk generator and stuff
yeah typo
in your ChunkGenerator you could detect your 6x6 and alter the generation in those chunks
All of this, just to change a players skin?
its to change a player's skin, but its only visible to certain player's
so it has to be done with packeys
packets
and if you don't respawn them it won't update
unless you know an easier way
Probably. But porting this to reflections is pretty much doing the same, but instead of
calling methods and constructors directly, you would call them via reflections and use Object for everything.
What is your reasoning behind using reflections instead of lets say ProtocolLib.
i don't know how to do this with protocollib
i have not really used protocolLib bedore
Hm. You need to be careful with reflections because they can be very slow if not used correctly.
Caching is quite important here.
is ProtocolLib better than reflections in this case?
if so, how would i do it?
if this is the case you are better off using packets only then
thats what im doing, i just need more info to properly set the skin
I believe we have api for setting the player skin
ProtocolLib is usually more maintainable than using reflections as the internals are abstracted away.
Its not as abstract as spigot, but you get a decent version stability.
and the rest can be done with packets for the players you only want it shown to
setting skin is not in spigot
yeah, PlayerProfile, but im not sure how to do it like this ``` public static void setSkin(ServerPlayer player, String[] skin) {
String texture = skin[0];
String signature = skin[1];
player.getGameProfile().getProperties().removeAll("textures");
player.getGameProfile().getProperties().put("textures", new Property("textures", texture, signature));
}```
PlayerProfile#getTextures#setSkin(url)
yes, but that doesn;t actually change the skin for any clients
thats fine
it will still show for the player it is being changed on
that's why you have to send packets for the client to update the skin
they want to only show updated skin to certain players anyways
how would i do this using PlayerProfile?
This is 1.20.4 but not tested https://paste.md-5.net/efixerefut.java
what the code is from
mine
i mean that that is what i got the code from
workd
tho i need to make it not version dependent
I updated it for 1.20.4 yesterday
well i guess im using an older version
you either have to do the version specific stuff yourself, or leave that to ProtocolLib
Mine avoids Version specifics in Bukkit but you can;t really avoid it in NMS
Implementing an interface without abstract methods? 
which is why you'd have to do that part with ProtoclLib and leve them to update
and hope their updates don't screw up your stuff anyways
the problem is, idk how to use protocolLib
Multiversion API```javapublic interface Skins {
/**
* Set a new skin on the Player and update all clients.
*
* @param player the Player to have his skin changed.
* @param skin a String[] skin to apply.
*/
public void changeSkin(Player player, String[] skin);
/**
* Change a Players name.
* This name is transient. It will be reset if you change the players skin.
*
* @param player the Player who's name we will change.
* @param newName the new name for this Player.
*/
public void changeName(Player player, String newName);
}```

does anyone know how to do it with ProtocolLib
Where override annotation
Its not actually production code. just reference so I can see NMS changes in each version
However abstraact on an interface is not required as its implicit
it's not needed technically
the implementation "should" be override though
can as well leave public away then 🙂
help
I like Picard I need to finish watching Star Trek Picard
Not Trek
Hello, I have a problem. When someone toy connects to the server and then immediately kicked out. A meme in the console says An error occurred when enabling the resourcepack. Please contact admins or disable resourcepacks. And I tried disabling ItemsAdder.jarr and it works fine. And when I turn it on and the others won't connect and does anyone know
Does someone know why this doesn't open a book (without having a book in your inventory)? It should open it using NMS.
public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "Only players can use this command.");
return false;
}
Player player = (Player) sender;
Profile profile = ProfileManager.getProfile(player);
// Create a writable book
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) book.getItemMeta();
bookMeta.setTitle("Achievements");
bookMeta.setAuthor(player.getName());
// Add a cover page
bookMeta.addPage(ChatColor.BOLD + "Achievements\n\n" + ChatColor.RESET + "Click through the pages to view your achievements.");
// Automatically categorize and generate pages based on achievements
for (AchievementsEnum achievementsEnum : AchievementsEnum.values()) {
generateCategoryPage(bookMeta, achievementsEnum, profile);
}
// Set the book meta and open the book
book.setItemMeta(bookMeta);
((org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) player).getHandle().openBook(CraftItemStack.asNMSCopy(book));
return true;
}```
Why are u using nms
There is api for it
Player#openBook
On 1.8 there isn't
1.8 moment
Why the nms doesn't open the book tho? Is there something I'm doing wrong?
iirc it needs to be in the player's selected slot and delayed by a tick
at least that's how i remember doing it back then
can i set durability of the block?
for example set grass to be as durable as obsidian?
no
ok
so its not possible to change the block below player to other without changing durability?
yo how do i make mobs drop custom items
i mean like what if its a custom item with names etc
its still an ItemStack
ah
are enchants stored in nbt
i mean where are enchants usually stored
its stored in itemmeta
i see
is the name of the item
also stored there
and the type?
like is it a grassblock
also stored there
yea
type is an enum
search for ItemMeta and see the functions
okok will do thanks
and ItemStack clasz
@EventHandler(
priority = EventPriority.HIGH
)
public void onPlayerFish(PlayerFishEvent e) {
if (!e.isCancelled()) {
if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer().has(HypixelCustomItems.getPlugin().getItemKey(), PersistentDataType.STRING)) {
CustomItem customItem = HypixelCustomItems.getPlugin().getItem((String)e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer().get(HypixelCustomItems.getPlugin().getItemKey(), PersistentDataType.STRING));
if (customItem.getSkillRequirement() != null && customItem.getSkillRequirementAmount() != 0 && HypixelCustomItems.getSkillCore().getPlayer(e.getPlayer().getUniqueId()).getSkillWithString(customItem.getSkillRequirement()).getLevel() <= customItem.getSkillRequirementAmount() - 1) {
e.setCancelled(true);
return;
}
if (e.getState() != State.CAUGHT_FISH) {
return;
}
HypixelCustomItems.getPlugin().getItem((String)e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer().get(HypixelCustomItems.getPlugin().getItemKey(), PersistentDataType.STRING)).onCatchFish(e);
}
}
}```
why is this executing the CustomItem#onCatchFish(e); event though my skill level is 1
please i need help
ok
read the entire thing pls
get has something that says
"If the Object does not exist but a default value has been specified, this will return the default value. If the Object does not exist and no default value was specified, this will return null."
how do i set default value
on it
addDefault
Pretty sure you gotta add it every time the plugin runs tho
I prefer just using the get methods that let you pass a default directly
Hi, wondering if there's a Developer who would be willing to add a handful of missing advancement types and a reset players advancements command to this plugin https://www.spigotmc.org/resources/custom-advancements.91167/ I'm not wealthy but i can see what i can do to compensate your time. I'm not the owner of the plugin but the owner has said they're happy for someone to do so.
?services ideally
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Asking for services on a channel where a lot of the traffic is beginners asking for help is a slightly bold move
first time i've been here and it does say in the header serious spigot and bungeecord developments help
maybe it needs to be a little more specific if it's not for what i'm seeking
fair enough but it doesn't exactly advertise that in the header, pointing out that it should if they don't want my type of enquiry here.
o i see
so it supports passing a default directly
No worries
?paste