#help-development
1 messages Ā· Page 1241 of 1
is it normal that I can do getAge() but not getMaximumAge ? š¤
"Cannot resolve method 'getMaximumAge' in 'Ageable'"
Ageable ageable = (Ageable) blockData;
int age = ageable.getAge(); // works
int maxAge = ageable.getMaximumAge(); // do not works
Make sure you have the right import
Oh yeah, it imported the entity one š
Thanks !!
Where didnt see it, can you make it a bit more obvious? xD
there you go
Is it possible to send a message to player if they are offline?
Saving it to a hashmap or something?
I mean who is it gonna get sent to if they're not online
Store the information of the player when they join and if they are offline do this?
You could just save the message to a hashmap to queue it up, wait for a player join, when they join you can send the message. I feel like there's usually a bigger purpose though and 100% a better way to tie it into the system that would execute it
Yeah I don't recommend using a hashmap if you plan on storing that message for long
Save it to an SQLite db or smth
When a player joins the server, save their data (UUID) to a YAML file. Check if they are online or offline. If they are online, send them the message. If they are offline, save their uuid to the YAML and then send the message to the player when they logon?
I assume that for any hardcoded message that needs to be sent to a player, it would be sent relatively soon. Otherwise an action or execution can be queued up differently
In this case, I'd recommend a DB
I'm guessing there is no need of hashmap if I am doing it this way? Just direct interaction with the flat file
Time to watch another kody simpson video 
how would i go about detecting if there is a structure at specific coordinates? since im assuming nesting if statments isnt the best way to do this
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getStructures(int,int)
why would you need nested if statements anyway?
i was refering to checking each block individually, mb i shouldve mentioned its a custom structure thats meant to be player made
wouldnt be made naturally
well, it really depends on what you consider to be a "structure" then
is a single block of cobblestone a structure?
is a dirt hut?
i mean its a specific build im gonna be checking for when a mob dies
You need some way to define the Size/location of the structure
As Emily said, is a single block placed by a player a structure?
no i would be checking for lets say a 3x3x3 cobblestone cube
it would always be the same
If you have to search for it within a specific range then use Chunksnapshot
do it Async
i dont think thats needed it would be at specific cords
if you know the coords then yes just a nested for loop
like when a mob dies (so some event listener) check for the cube right under it
if its a 3x3 its a bit harder as the mob could have been on any of the top 9 blocks
id want it to be only in the middle block or some other one
just the middle block
just the middle, then yes a simple nested for loop
so like just if(mob.y-1 == cobble && etc etc)?
if its always going ot be in teh middle one java for(x... { for(y... { for(z... { }}}
as you need to check all 27 blocks
alr thanks, just for my curiosity is there some library for this? like if the 'structure' was huge
and out of different blocks
then I'd say use teh Structure API as Emily also suggested
a Structure has a boundingbox you can check if you are within
Is there a way to detect if a player presses the L key and not have the advancements screen open?
I used protocollib but it only lasted for a millisecond because I closed all the screens
How do i set head texture in 1.21 (spigot) my old code throws error
public static ItemStack setTexture(ItemStack skull, String texture) {
if (skull == null || texture == null || texture.isEmpty()) return skull;
if (skull.getType() != Material.PLAYER_HEAD) return skull;
SkullMeta meta = (SkullMeta) skull.getItemMeta();
if (meta == null) return skull;
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", texture));
try {
Field profileField = meta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(meta, profile);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
skull.setItemMeta(meta);
return skull;
}```
https://paste.md-5.net/abizibaboh.cs
use the profile api
But it needs paper api
no?
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. Iāll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
spigot has a functional profile api
I will be doing a command system on anotations advise me on the way. Manual registration vs reflection
what better use
I made an annotation processor that creates a delegate Command impl for my commands and registers them to a service
so you use reflection?
well I use service loaders, which would qualify as reflection ig
hey guys, whats the best way to store data about broken/placed blocks by players?
I'm asking specifically about the part where subcommands will be registered in the commandExecutor impl
what
subcommands
right what about them
subcommands like /lp user meta
yea
Does anybody know how to create a item, that works like creative items, but In surival( Infinity uses). For example: A bonemeal, that you can place infinitely in surival?
right what about them
can u explain more?
i try undestand what be better: manual registation for api user or reflection and annotations
So if I use a comment, I get an item with mending 10 or something and I I place it in surival, it should come back, that you can place it again and this infinitely
do whatever you prefer
this plugin will be for people
i want find better choice
this will be mvc controller commands
but if this not metter i choice classic option
and use system like bukkit event handlers
do what ever you feel like you would want and use that
I just like ```kt
@AutoRegistered
public val TestCommand: Command = Command("test") {
executor { sendMessage(text("Hi!!!")) }
sub("one") {
val id by arg("id", stringParser())
playerExecutor { _ ->
sendMessage(text("id: $id"))
}
}
sub("two") {
val num by arg("number", integerParser())
executor {
sendMessage(text("number: $num"))
}
sub("three") {
executor { sendMessage(text("omg: $num")) }
}
}
}
?
Youād have to use events to prevent its consumption/give it back after each use
?paste
https://paste.md-5.net/fifamuniwa.xml
This is the pom file
there is a plugin which requires a MySQL database
so the host is just my domain right?
the ip?
it asks for host; database; username; password;
Yeah, the machine on which you host the mysql server
well i used just my domain and it didnt work
it says "Host (ip) is not allowed to connect to MySQL"
Try calling Class.forName("org.sqlite.JDBC"); before you use it
Im using LogBlock btw
Any idea why?
connect using localhost
yep strange
I tried it, but it didnāt work, so you have an example for a code?
what did you try and how did it not work
I used the BlockPlaceEvent to track the item which i placed, I made a message that appears if the block was placed, and a command to give the item back to the player, but only the message worked and the item wasnāt infinity usable
a command?
I mean a line of code, that gives the player that item that he placed
Show us your code and explain what you expect to happen
For that I need to turn on my pc, but I canāt do it rn. I want to create a custom item that can be placed while retaining its enchantments or other properties. However, after placing the item, it should return to my inventory, making it infinitely reusable.
Simply increasing the stack size by one within the event should work just fine
@EventHandler(ignoreCancelled=true)
public void onPlace(BlockPlaceEvent event) {
ItemStack item = event.getItemInHand();
item.setAmount(item.getAmount() + 1);
}
The amount will stay at 1 item? During the event
He means to increase it by 1 so when 1 is subtracted due to placement 1 is still left
1 - 1 = 1
Okay, I wil try that tomorrow, thank you guys

C# š«
Matches my wifes math when spending
unity drove me there
Sounds like you didnt run enough unit tests. Have you tried Preconditions by guava?
Its nice to throw exceptions early.
Donāt throw your wife
Wives don't accept external code
Ich habe etwas Ƥhnliches insgesamt 3 Stunden versucht( mit Hilfe von ki) jedoch ist sie zu Inkompetentšš¦š¦
bytecodewifecode-injection
You can, if you try to catch her afterwards 
make a child class
My class is sealed
Huh
How can I give myself an item with custom model data on 1.21.4?
I know that on newer version, it's using custom model data components but is it possible to use the old way? Like similar to /give @a netherite_sword{CustomModelData:1}
tbh you should be using item models now
e.g. /give @s stick{item_model="minecraft:iron_sword"}
just, the model can be anything if you provide it in a resource pack
What if I want to add support from 1.20 for example?
well the resource pack is gonna be different anyway as the format has changed
Woo pack overlays
at best what you can do is keep using the setCustomModelData(Integer) method
and work your updated resource pack around the updated format for that too
it's just pain
It's a pain I agree
But there's no way to give item with texture using custom model data number on 1.21.4?
There is
the format has changed, there is no "old way"
I believe itās using the integer value in custom model data
custom model data now is a list of floats, colors, and some other stuff
,
I mean using commands
the int would just be the first float in the list of floats
custom_model_data={floats:[1.0f]}
old cmd has effectively been replaced with item_model, new cmd works differently
Ah thereās only floats not ints
floats, flags, strings, colors
Thank you, will try that out.
god damn AMD and their servers that don't work
hm? What's wrong?
can't launch game because requires driver update
can't update driver because amd download server is down
truly the most desperate of situations
this is most saddening
How long has it been since youāve updated drivers 0_o
idk
When was the custom model data become components, is it 1.21.3 or 1.21.2?
.4
generally it doesn't matter, and it actually didn't matter until today because the game got an update and now it refuses to launch without a driver update, it worked yesterday
pft
What game smh
GTA infinite, because the next game never comes out
Just like the elder scrolls infinite
The V in GTA V was originally indicative of how many times they would release the game
I assume that applies to the elder scrolls V as well
Did you reload the pom
Oh yeah that fixed it, I forgot to delete this
thank you
Could someone point me in the right direction for correctly setting up NMS in eclipse? More specifically, is there a way I can add com.mojang.authlib to the project build path without maven? Are there any jar files built from BuildTools.jar that comes with the package?
is there a specific reason you don't want to use maven/gradle
because you ultimately should, it may be confusing at the beginning but you'll get the hang of it fast
Ngl, I'm just stuck in my ways. Is maven/gradle the only option?
not the only option, just the easiest
if you want to have NMS without a build system, you can probably take the server jar from the cache folder after running it once and use that
you won't have all the niceties like mojang mappings though so it'll be a bit rougher to work with
Trying to remap a spigot server for NMS development purposes (1.20.4).
java -jar SpecialSource.jar -m 1.20.4.txt -i paper-1.20.4.jar -o result.jar -live -reverse
Everything seems to work fine, but the output jar isn't remapped (or is but only partially). What can be the reason?
that isn't spigot but paper
they have a completely different remapping system, you should use theirs for their jars
Isn't the NMS mapping same for them
Otherwise NMS plugins wouldn't work for both spigot and paper at the same time
not quite, no
paper remaps things at runtime to keep them working when using spigot mappings
to begin with, the paper jar isn't even a minecraft server jar but a bootstrap so it wouldn't be the thing you want to be remapping
I'm remapping the correct jar tho
That's not the server jar itself
Decompiled
That's the library that goes in server/libraries and has both bukkit and nms stuff
that's the right jar, but I don't believe it'll just work if you pass it through special source
Normally I reference it and manually write NMS code pre-obfuscated but that's really messy and time comsuming
So
is there a particular reason you aren't just using paperweight
it should work just fine for 1.20.4
Not very familiar with it, let me check
?whereami
?nms
Ok that works
But can it be configured to remap for multiple versions at once
Like If I have an interface for each version 1.20.4, 1.20.5, etc
need separate modules pretty sure
Why when i connect to the server the chunk where i'am is triggered 2 time in the ChunkLoad event?
chat, imagine you're dealing with a language which, in essence is Java 7. Except String isnt actually java.util.String, but rather that with all the methods removed (except for length), so no; String.charAt(), String.getBytes, etc.
With that in mind, how could I convert a string to a char array?
doesn't String impl CharSequence or something
if you have no methods other than length you can't unless the language has some kind of pointers
what language anyway
Does it allow to get a char by accessing it like an array i.g string[0]
wait good point lemme see
If so, just iterate over it and copy to a char array
Nope
Its a java 8 interpreter running in JS.
do they just not have the stdlib or what
why do you even need to use this anyway
University.
thats all I'll say.
so limited
oh god
here's what the author said:
Believe it or not but it's built with ReactJS and Typescript. Not a line in Java. I built a custom compiler from Java to Javascript based on JavaAST. As a result we do not support full Java 8 specification but a pretty big part of it.
So yeah, its actually not java at all.
totally not cursed at all
did they provide you this or did you have to code this out
because that isn't a string if it only has a length field
I guess if you are to be parsing a contiguous memory segment, it could be a thing, but that would only be the case under constraints like char size not being an issue
provided, its a "lib"
how is char defined
given String is just a length field, creating a char array would essentially be just creating a slice from start of the currently read memory segment to the String's length field
Why are u using vscode?
thats clearly the biggest crime of all
I was wondering why we need a Listener interface for event listeners? It doesn't have any methods or fields it can pass. And needless to say, it guarantees that the class has @EventHandler anotations etc. The class is registered manually, not automatically.
what specific ?
Just a design choice; having a marker interface that is
lol
Like RandomAccess or CompletableFuture.AsynchronousCompletionTask
for beauty, huh?
Na not really
Thatās weird, I seem to find quite rigorous explanations on the Javadoc page for example
declaration: package: org.bukkit.event, interface: Listener
No I meant the built in ones
its in the browser.
the interface is a guarantee in of itself
it tells the developer the class contains event handlers
how does he guarantee it?
by making it a requirement on the registration
how such a requirement guarantees that the class contains @EventHandler methods and anotations
no need to talk about the visual aspect
it doesn't guarante that the class contains event handlers, it guarantees that its intention is to have them
so this just visual aspect
no, because you can act on that intent
.
it's not a guarantee
i.e., if it doesn't have event handlers, the registration system can decide to throw an exception to tell you there is no event handlers
do you know what the word āguaranteeā means?
let me ask you the same question, do you know?
the guarantee is on the intent of the developer, it tells the registration system that the class is meant to be used for a certain purpose
without it, you could just pass any class to the registration system, and it can't know for sure what you want to do with it
guarantee means that the result will always be what you expect to see, not an obligation to act.
I'm asking about the practicality of this interface
that's quite literally not the case, by definition
Well, then the word has several definitions
a guarantee is an assurance that certain intent will be held, however that doesn't imply the result willl be the same even if these guarantees are held, as it doesn't consider side-effects
the practicality is that you can define certain behaviors in the registration system by having the explicit intenet of the developer marked with the interface
i.e., if the top class is annotated with Listener, then all inner-classes will also be counted for event handlers
(that is an example of a behavior that could be decided upon that intent, not necessarily what happens)
the law isn't a guarantee then?
the law isn't a guarantee, no. Otherwise judges wouldn't be needed
Programmers strive to minimize the risk of errors in a program. The only purpose of an interface that I see is simply to warn the developer who is trying to create an event listener or just to visually indicate what kind of class it is.
If that's called a warranty, I don't know what to say.
I think you are misunderstanding who the interface is useful for
the interface serves little use to a plugin developer, as they only have the obligation to use it. The only practical use a plugin developer could find is that where they are developing a framework around the event system and implementing automatic event registration, as it helps to discard classes which are well, not listeners
the practicality here is for the registration system, which can make decisions based on the implementation of the interface
If an interface has no methods of its own, then it serves no real purpose. If this interface didn't exist, nothing would change.
now, could a different marker than an interface be used? Definitely, given event registration is manual
for listener class
I just explained the usage of the interface, it serves as a marker
marker this just visual aspect
from a profit standpoint, it doesn't make sense
mappings?
mappings
guys i forgot the bot command mapping
what that
?mappings
Compare different mappings with this website: https://mappings.dev/
oh here
it isn't if the registration system takes advantage of it, it would be if it was only there for plugin developers to differentiate between listeners and non-listeners
why this need if you can check annotations inside class
like @EventHandler
because that isn't enough when anonymous classes, inner classes, method-level classes exist
what difference does it make if the registration is manual. It's the developer's fault
registration is manual for classes, not for the methods so the line gets blurry
and what would that lead to for example?
the marker is there for the lack of explicit-ness with the registration, it could have been done differently but this si the way they decided to go about it
Okay, I'll take martker as a means of minimizing risk if the warranty isn't what I think it is.
but still, it's like it's got multiple definitions.
If predictability is minimization, fine. but on a percentage basis, it looks not very good
option
this is like @NotNull vs @NonNull from lombok
but if i want minimize risk i choice lombok
@EventHandler
public void onEventHandler(SomeEvent idk) {
class Idk {
public void somethingElse(SomeEvent passed) {
}
}
var test = new Idk(idk);
}
uh
i dont think compiler accept it
what happens here, does it register both methods since the top-level method has an @EventHandler annotation or or we register the top-level method only
it definitely will, that's just a method with a local class
listener will just invoke method
public abstract class EventDefiner {
@EventHandler
abstract void onEvent(SomeEvent idk);
}
public class SomeOtherClass extends EventDefiner {
@EventHandler
public void onEvent(SomeOtherEvent idk) {
}
}
what happens here
do I register both events, or only one if I had only passed SomeOtherClass to registerEvent
well listener manager should validate it
abstact class can impl interface
I mean, sure, we could put artificial limitations like not allowing @EventHandler on abstract methods, but this is what I am talking about here when I say it isn't enough
with Listener being a thing, the registration doesn't have to make guesses on what exactly the developer intended to do with these, as one would implement Listener and the other wouldn't
not necessarily what happens in real-life, as Listener doesn't get used as exhaustively of a check, but you get the point
wait, this example is not accurate because manual registration will forward the class object.
At the end of the day, I doubt itād have mattered much if we could just pass any object to a bukkit event executor as the ālistenerā
Like it really isnāt that deep, its a design choice that was made like what now? 10 years ago almost if not even more
nothing will change even if the abstract class has a marker
marker will not give protection against such a problem
And in some cases, it has drawbacks. For example, Serializable interface.
it definitely wasn't, I was just bored enough lol
I mean if you wanna havoc your own code so be it, worse comes to worst you can just retrieve the unsafe instance and fuck up whatever you want
Yes but everything has drawbacks
Zero cost abstractions are not a thing (imo)
in this case, it's bad.
What is?
Well, you say that like you're justifying the Serizable marker.
but it's more trouble than it's worth.
Bro, Serializable has been with us since java 1 literally, itās the worst example anyone can provide, your argument is flawed
lol
Fair, more so said it to ilmir
This is also a terrible example
not really
like in the real world you probably use checkers framework
yes really
You likely use the null checker from checkerās framework to prove your programās null safety
so this better then just marker
No its a different problem, marker is just a marker
Checkerās framework add null restricted types etc
I watching a youtube series made by Direwolf20 and from Lets play Season 5 - 1.4.6, there is this item that auto supply when he places a block such as cobblestone. I trying to create that using my portable chests but I don't know how to get the max stack size of a material like cobblestone is 64. I tried the following code and I not seeing anything if( inv.contains(item) && !player.getInventory().contains(new ItemStack(item.getType(),item.getMaxStackSize())) ) { player.sendMessage("Item Added x1"); return; }
Like a marker interface is just an empty interface, not a class (you lose multiple inheritance)
Yes there are cases where its used poorly
but most of those cases come from design choices back in the days when we didnāt know what was good, when you werenāt a developer even so
Isnāt that hidden behind a data component now?
But thereās probably some method in Material or ItemType to find the default max stack size I reckon ^^
I don't know what you mean by hidden but I cannot really show you what I mean because I watching it offline. yt-dlp but if you know how I can get the default stack size, that be helpful to make this auto supply
sounds like an antipaternity/paternity problem.
Itās not
I mean like donāt get me wrong, there are terrible choices everywhere, in bukkit, in the jdk etc, but its not like we can just flip the switch and change that right now when entire eco systems depend on these suboptimal choices
I mean, some places need antipatterns and some don't, no matter what society calls them. In the case of the markers, people were following a path they knew.
You donāt know what antipattern means then
an antipattern is a pattern that harms the architecture as I understand it.
so this is why call anti
This is what I was talking about.
https://web.archive.org/web/20180220043240/http://forestryforminecraft.info/other:backpacks
Material::getMaxStackSize exists
that method also exists on ItemType and ItemStack ^^
and even on the scary ItemMeta
I just noticed and I did not enable the auto supply so it was ignoring the chest item. Thanks for helping me. I will make sure I have the proper values set
I got another issue. I don't know if its how getMaxStackSize works but when I use +1 or -1 as shown below if( inv.contains(item) && !player.getInventory().contains(new ItemStack(item.getType(),item.getType().getMaxStackSize()+1)) ) { player.sendMessage("Item Added x1"); return; }The code does not really work, any fixes?
why are you adding 1 to the maximum limit
are u sure that is possible ?
(i don't know what im talking about)
You probably want containsAtLeast
Never seen someone philosophize about marker interfaces for hours
If inv contains item and player's inventory doesn'r contain the same item type but with stack size that is 1 above the limit:
send "Item Added x1" to player
Does that sound right to you?
Why would it be one above the limit
Material#getMaxStackSize+1
Why i ask you
I dont know
For the first call atleast.
Ask MrnateGeek
Ohh i thought u were the guy
Remember contain on an ItemStack looks for that exact item with the same stacksize too
Like I'm not sure what you're trying to achieve but I don't think you understand what you're doint tbh
Is it compared with equals or ==?
containsAtleast is what heād want to ignore things like amountleft
/ currentstacksize/amount
I guess?
But what is he trying to do
Check if a player has 2 stacks of an item?
And why is the result of the message "Item Added x1"
Cuz from what I see it seems like he's trying to modify an item stack in a condition
I think heās just trying to see if the current amount of said item is not currently full?
And that he has atleast one
Well, if its smth like that then this is done horribly...
On the direwolf20 Lets Play Season 5 - 1.4.6, you see a item from forestry I think its called that has these backpacks that keeps one stack of cobblestone for a example so I was trying to re-create that. I just used a timer and it works as shown on the Lets Play series
Okay?..
So like a bundle?
Or what
Sure?...
You see what I trying to do now?
Kinda?..
Let me look thru my HDD of direwolf20 showing it in action as well, just for you to compare to my plugin
Here is the link: https://youtube.com/watch?v=hM9P5PDS6VA . You have to scroll to at least 25:00 timestamp
Getting moved into a new home, and setting up some IC2 power production and machines
Keep up with my thread here: http://www.minecraftforum.net/topic/1513504-direwolf20s-modded-lets-play-series/
Facebook: http://www.facebook.com/Direwolf20
Follow me on Twitter: https://twitter.com/#!/Direwolf20
Join our IRC channel -- #Direwolf20 on espernet
While watching the ep, you see I have completed my goal
12 years ago
You right, its 12 years ago but it does show what I trying to create
is it possible to force-render a particle so that it is visible within entity/simulation distance instead of the 31 blocks particles are normally restricted to? i want to use them as indicators, like a false beacon beam, but projecting them towards players comes with its own issues
aka how the hell do i project a particle so a far away player can see it without having parallax issues?
wynncraft just uses croppy ass beacons for that
what about using a really stretched out display entity
About wynncraft, I wish I know how their waypoint system works
doesn't the force parameter work?
abuse perspective. render closer but smaller to indicate the path
Use the new model component instead for simple models
which is it?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/ItemMeta.html#setItemModel(org.bukkit.NamespacedKey)
Assuming you're on high enough version
in the future, speficy even the dot release
these things now change really often
1.21.4 has many more features than 1.21.1
thanks you
that's for item model
but im using custom_model_data
it isnt possible to use?
What are you trying to use the custom model data for
custom texture items
Yes, the better way is what I linked
i don't know how to use it on item model
It does not need to replace any item models/textures.
And even if you wanted to use CMD you'd have to change the item model definition.
There have been changes, look up how to make RP on wiki or ask for help in the Minecraft Commands Discord server.
Correct, you'd have to do that.
import org.bukkit.inventory.CustomModelDataComponent;
this is correct?
But again, for simple models (retextures) use the item model component.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/ItemMeta.html#getCustomModelDataComponent()
To retrieve/create new component
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
That doesn't seem to exist ?
What matters is that you learn this :)

oh
org.bukkit.inventory.meta.components.CustomModelDataComponent
my hero
Eclipse ?
In any case, IDE should autoimport that for you...
i have to write them
No
If that is the case then throw away that IDE, get IntelliJ
Or possibly correctly setup your project
Or idk, but you should not have to manually write imports...
Does your Eclipse not have any intellisense ?
yes, it has
Then trust it, if you did you would not have written this.
But again, eclipse should do that by itself...
Is anyone German, knowledgeable about coding and have a little time?
steve are you an eclipse user
Please English only
english only
I used to be many years ago
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
how i can instantiate the custom model data component?
i considered this but particles stay where they're spawned, so the moment you get at a distance particles dont render and you need to use this, you get a pretty bad parallax effect
i don't understand š
get it from the ItemMeta with the getCustomModelDataComponent() method
then, you can use the setFloats/Flags/Strings/Colors methods
and then, you use setCustomModelDataComponent on ItemMeta to set it back
what kind of cursed api is that
itemmeta api
i keep getting errors
what kind of errors? what's your code look like?
like how i need to instantiate it from the item meta?
you don't
you use the existing one
Do you know how to get itemMeta?
I'm not really sure what the issue is
You said you keep getting errors, what errors? what does your code look like?
secret
it no work
alex help it no worky
take away its unemployment benefits
thanks it worky now
?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! š
you need to put it in a variable
then modify that CMDC variable
and then call ItemMeta setCMDC using that same modified variable
example?
jetbrains academy is a great resource for learning basic java
Why is the "chunkload" event triggered twice for the chunk where I connect to the server?
for the same chunk?
yeah i log in the console all chunk that is loaded when i conect to the server and I just noticed that the chunk I am in when connecting is triggered twice by the "chunkload" event.
example of that?
i stored the itemMeta.getCustomModelDataComponent() in a variable
but how i modify it
i mean, with what function
then it was unloaded inbetween
Yeah that tells you what's wrong
yes the chunk is loaded and then unloaded and then reloaded but this happen only for the chunk where iāam when i connect and i dont understand why
taps sign
yes
Am I supposed to use List<String> lore = new Array<>();
For itemlore?
I don't think an array is a list
What's your goal
So ArrayList?
correct
Practice 
usually if sth needs a List<...>, and you don't have any reason to use sth else, you'd use an ArrayList, yes
sigma
Im building a BlockPopulator for a world in which I would like to generate terrain based on the way Minecraft generates its terrain for nether worlds. However, I am adding this BlockPopulataor to the BlockPopulator list for an overworld world. I want to copy nether generation under a certain y-level.
My current way of doing this was to get block data from a nether world in my populate method, but unfortunately, that is not thread safe, and it caused a lot of issues, so I'm looking for a more ideal and thread safe way of doing this.
hm? are you trying to do world gen in the block populator?
They're only intended for smaller amounts of blocks
Whats the correct code for this?
I mean we have zero context here
for all we know the correct code is to delete that line
See what it says to you lol
Well that's what I thought, but then md5 said it would work for this, so maybe he misunderstood me?
I could use a ChunkGenerator, but I still don't know how I would go about this
I fugged up
A question
Why does this command remove hearts instead of healing me?
I know setMaxHealt() is deprecated but I've read online that it still functions
all you are doing is setting max health. You do no healing
so anyone have an idear why ?
how do i do it then? I dont understand
How do i heal someone then
I just showed you
setHealth()?
yes
so setHealth(0, 20)?
just 20.0
and another question
or setHealth(player.getMaxHealth())
I mean it would probably work if you wanted it to
Just need to jump back to the main thread to get blocks
Since that's not thread safe
you should actually use Attributes to get teh true max health
yes thats what i did
at the beginning
but i also had the same problem
Btw Ive also made another plugin
WarpPlugin
but idk why i receive a strange error
aboyt PluginOptimalization idk
something like that
^ FreezeCommand
^ FreezeListener
This plugin must freeze a player when an Op does /freeze <player>
when i do it i receive the message, but it doesnt do anything to the affected player
how do i compare
== as its an instance
so
if (getFrom().getBlock() != getTo().getBlock())
Is it the same instance?
teleport the player to their getFrom
he only needs to compare if the block instance is different and teleport them to their from location
yes but i have 2 if statements that i would need to do if i remove the ||
no you woudl not, compare BLOCK not x/z
if (e.getFrom().getBlock() != e.getTo().getBlock()) {
e.getPlayer().teleport(e.getFrom());
}```
Top Ill try it out
and another thing
^ Feed Command
why do i get an External error?
You know the red error
what error?
after i send the command, i still get fed but i then receive a red error
An Exceptional
something like that
that is not a feed command
if args is 0, use arg 0?
args[0] is just /feed
sounds like your command setup is broken if the arg is the command
arg 0 would be feed if you typed /feed feed
/feed is just args[0] right?
BlockPopulators?
but why then if i wrote /ban then its just args[0]?
Im curious if there's a more ideal way of doing it than jumping back
/command i am an arg
the string is command
args is [i, am, an, arg]
because Idk how to do that
im doubting that
in your ban arg 0 is the p[layer you want to ban
If (args.lenght == 0) {
sender.sendMesssage("Specify a Player")
}```
you probably want to look at your indents too
then this just means the player is just submitting a command like /ban
correct
then args[0] is just the command
args being 0, means its just the command
no
u just said that
Anyone have an idear why the chunk where i connect get loaded -> unloaded and then loaded back ?
u said the same thing i said
^
by "just the command" i mean literally only /command
yes thats what i also mean
example again
/command argument
args length is 1, and args[0] = argument
arg length of zero means there are no args. the array is empty
Use the scheduler to jump and then block the populator thread until completion
so should i change it to 1?
?scheduling
you need to look at where you have your code to see whats running for what cause
Hm alright. Ima look into that, but do you know if there is anyway to hijack the normal generation?
a scheduler to jump? like a skipping rope with a metronome?
on a trampoline
bruh
You probably can but it would involve some NMS and probably wouldn't be that easy
but you can take a look at how the world gen works and see if there's a suitible place to modify it to work how you want it
I did, and it looks like it would be extremely difficult to do
I wish I could just have it run its generator as if it was making a nether world after it does the same for a
wait a minute
nah that wouldnt work nvm
If the populator works other than being thread safe, you should be able to just synchronize to main and block like lmdll suggested
Yes a blockpopulator will behave somewhat poorly vs a proper chunk generator, but it should be tolerable
hey, do someone know how to use custom model data for mobs, and where to find models ?
well, how the servers create custom mobs then ?
There are a couple tricks that can be used to get around that such as using Display Entities or Armor stands to show items with models
okay, do you have any ressources on how to do that ?
Which part? Making models?
@vagrant hornet welcome to the server š
thanks š
using them, I planned to find them online
To set the item model of an ItemStack (from it's ItemMeta) get the CustomModelDataComponent
and then set one of it's values so it corresponds to the model you want
this i know, but i talked about mobs x)
I mean you quite literally just put the item in the hand of an armor stand
or just set the item stack of the Display Entity
With Display Entities being the much better choice btw
It's possible to detect holding left click?
You can assume they're holding left click if they're mining a block
Other than that not really
Uhm.. it would work in adventure mode?
Not really since the player isn't breaking any blocks in adventure mode
ik
Unless you have an item that can do so ofc*
you can mine blocks in adventure mode with item that has nbt or something?
https://www.spigotmc.org/resources/elitemobs.40090/ just use elitemobs by @torn shuttle
yes
Oh really?
look at that stuff, pretty elite
So i could increase their hand reach to like 100 and make sure there are barriers around the map so the player is always "mining" a block but what if the player target is an entity?
or, looking downwards
Does someone got the litebans api cause Iām tryna make a punishment GUI so when clicking something in a GUI it runs a command but goes down an offence scale but donāt know fully what I need so yh any help would be appreciated
Unless Iām stupid from reading doesnāt seem like I can use it for what I want it for cause all I need the blocks to do when I click them is to run commands
damn look at how elite that is
crazy
the guy who made that must be really smart, and sexy too
I want to detect hold left click and the only way is to increase the player reach to like 100 and make sure there are barriers around the map so the player is always mining a block but what if the player target is an entity?
Not much you can do except place a block closer than that entity
How can i trace a line between 2 BlockDisplay ?
Depends on what you want to do with said line
just for debug purpose
Can i send u a screenshot of what i try to do ?
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
Those are just block displays
oh okay
Fake block or a real block?
if it isn't a big issue to switch the key, you can pretty easily tell whether right mouse button is held or not, since it will send a packet every tick it's held
left mouse is much harder
I would like to use left click because im making guns
and left click is for shooting
If i can't detect hold left click then i need to press left click everytime when i want to shoot
swap it around so right click is shooting
because i don't think the 'put fake blocks in front of entities' thing is going to work out
at least not very reliably
Fake block is better but will require more work
Also yeah just use right click for shooting?
Pretty much every server has the buttons flipped anyways
nope, i saw few servers that use left click for shoot
paper has Player::sendBlockChange for super easy fake blocks
but the problem is figuring out where to place them
Spigot has that too
problem is they go away when interacted with
So you need to handle that packet yourself
you'd not only have to ray trace the player's line of sight every tick and cover any entities with fake blocks, but also predict player movement and pre-emptively cover entities with fake blocks
too much work
and since this is a combat "muh pvp" situation, any inconsistency in this (single-fire because the block packet arrived too late, instead of burst) is going to result in butthurt
so i'd just go with rightclicks
i don't see the 'targeted block' highlight that appears when a block is within reach distance on those quartz blocks
they might be doing something else
That's removable
with a core shader
which they are using for those animations
not the same shader*
i think those animations should also be doable with display entities and billboarding
yeah those animations don't look like display entities either, but i think something similar could be done with them
idk i think using shaders for "no mods" things is kind of cheating imo
how can i muke such holograms
Displays
is it a new entity?
alr thanks
Could just be not overcomplicated by spawning an interaction entity
One that totally encompasses the player
Unsure if you can have it ride the player, but if you can, that probably makes it way smoother and doesn't require teleportation packets
is that going to work for left clicks?
Hm can they do left clicks?
Literally just an invisible entity with arbitrary size that listens for left and right clicks
That video sent above doesn't hold it down
but that's not gonna have the player reporting the button being held down, is it?
i'm pretty sure it does but i can't find the timestamp for it now
Canāt you use the Input system to detect if left click is held
Ah no that only has WASD sprint sneak and jump
Interaction entities seem to handle holding down the right mouse button, not the left mouse button. Just tested in game
even for right click there isn't really a "button held" and a "button released" event in the protocol, only a "button pressed" one sent every tick
Correct
same for left click except the client doesn't resend it every tick
except when mining blocks which actually sends start/stop mining packets
but that'd involve covering all interactable entities with invisible and non-collidable fake blocks and i'm not sure if that's tenable
that was the original idea; boost mining distance to say 100 and make sure the skybox is covered with barriers or whatnot
but if an entity steps into your line of sight, you're going to send a "punch that entity" packet instead of "mine that block" packet and it breaks down
and you most likely are gonna shoot at entities rather than blocks
The alternative is, yeah, having a fake block at least a couple blocks in front of the player and intercept the block break start packet, then wait for a block break stop packet
Shame youād see the block outline
Not in adventure mode
supposedly, if the dev's passive aggressive response is to be trusted, that's not how they do it
I don't know if the client will send a stop packet if the block is gone, it might send it when the cursor is let go
not sure if the client will send a start mining packet in adventure either
Will it even send a start packet in adventure mode
I don't know, man! D:
YEAH BUT I DON'T KNOW EVERYTHING

replicate all player and entity models with display entities so there are no entity hitboxes š¤”
also replicate all terrain and blocks with block displays so there is no selection outline for them, and have a 60 block diameter barrier sphere follow player around
I can hear the server fans from here
Can you please release watchdog source code
Bold of you to assume I even have it
Don't let watchdog read your kernel TCP settings tho
I used to cheat on hypixel with Feather Client and a forge mod client. Started to get suspicious Feather was sending my system information to hypixel.
Years ago tho trust
Banning rn
reawwy
Imagine telling a hypixel dev how you cheated is a crazy move 
I am trying to make it so I can control the speed at which blocks are mined by listening for block damage events and then sendBlockDamage() to the player. But I'm running into the issue of the client's mining making it spazz out between the 1 tick of block damage and what my plugin is trying to simulate.
Am I going about this the right way? Is there a way to stop the 1 tick of block damage from showing while the player is mining?
use the tool component
of course this only works for custom tools and the like, not mining by hand; but i assume that's what you're trying to do
the client going out of sync with the server is inevitable if you don't give it some way to predict the result, and so far the only way to do that is this
Okay that makes sense. Is there something to see how I implement this in code?
getItemMeta getTool set what you want on tool setTool setItemMeta
these were added in 1.21.4; what version are you building against?
oh. 1.20.4
yeah, no components at all on 1.20
1.21 was the component rework and 1.21.4 builds on it to add some more useful ones
Idk if y'all remember Cosmic Prisons, but I think they did this mining gimmick that I'm trying to do
Is there something else to do for this version?
i'd recommend updating to latest since that makes life generally easier, but apart from that, you could maybe apply invisible mining fatigue on the player to stop the breaking animation from progressing on the client end
it'll still be kind of janky, but perhaps better
this'll also prevent instabreaking blocks as you can e.g. smoothstone with efficiency V and haste, since that relies on clientside predictions that you'll throw out of whack with the mining fatigue
so things are updated to 1.21 and I'll be fine upgrading?
that depends 100% on your setup
my crystal ball is still in the repair shop so i regrettably can't tell what plugins you have to check if they've updated to 1.21.4
generally yes, most things have already updated to .4
even slimefun which took forever for whatever reason already has a .4 build
components were added in 1.20.5
i'd only expect major incompatibilities with plugins that are doing hacky nbt things, i.e. have pushed off updating to use pdc for like 10 years
Yeah bunch of weirdoes anyway
there's no way it has been already 10 years since PDC
5 I believe you, 10 makes me sad
...
ā¦
Does anyone have an idea of how I can prevent the ChunkLoadEvent from being triggered twice for the chunk Iām in when I connect ?
It shouldn't be being triggered twice unless it's loading twice
What's the issue exactly
That strange because i have just this:
public void onChunkLoad(ChunkLoadEvent event) {
Chunk chunk = event.getChunk();
if(chunk.getX() == -26 && chunk.getZ() == -1) {
System.out.println("Chunk loaded");
}
}
public void onChunkUnLoad(ChunkUnloadEvent event) {
Chunk chunk = event.getChunk();
if(chunk.getX() == -26 && chunk.getZ() == -1) {
System.out.println("Chunk unloaded");
}
}
``` -26 and -1 is the chunk where i connect
and my console print me this:
[06:48:59 INFO]: [LostEra-Utilitaires] [STDOUT] Chunk loaded
[06:48:59 INFO]: [LostEra-Utilitaires] [STDOUT] Chunk unloaded
[06:48:59 INFO]: [LostEra-Utilitaires] [STDOUT] Chunk loaded
So it's being unloaded
That what im trying to understand why its being unloaded ?
probably because the first load is a transient load to get the spawn position or something
why does this impact your plugin?
is this 1.21.4?
When a chunk is loaded, I check if there is a custom collector from my plugin, and if there is, I load the custom collector. However, if I connect to a chunk that has a custom collector, it gets loaded, unloaded (causing it to be saved in the database unnecessarily), and then reloaded again.
(also sanity check, is this on spigot or on paper)
why is that an issue?
That's not realy an issue, I was just wondering why the chunk is loaded twice for better understand.
Im not using the latest i will try with latest
interaction entities will detect if im holding left click?
I dont think so but try it and see
I am creating a GUI plugin, and I am using a compass as the item to open the GUI. I have named the compass "Game menu." At the same time, I am also using WorldEdit, but when I click on that compass, WorldEdit activates. I want the Game menu compass to not trigger WorldEdit. How should I write the processing in the GUI plugin to achieve this?
I cannot speak English, so I am using translation.
Would you be willing to disable that feature from WorldEdit?
I'm attempting to find good keybinds for items and all I know about for possible keybinds are
Space (jump)
F(swap)
Directions (wasd)
Q(drop)
Lmb (interact)
Rmb (interact)
Shift (sneak)
Ctrl (sprint)
Anyone know any others?
Disable it in WEs config
I would like to be able to use everything in world edit except the compass used to open the GUI, but when I asked about this on the world edit discord, I was told that this is something that needs to be done on the GUI plugin side.
Original text
thatās something that the gui plugin would have to do, worldedit wouldnāt be able to do that
the gui plugin needs to listen before worldedit, and cancel the event when itās intending to handle it
unless the other plugin does that, worldedit has no way to know itās wanting to show a gui
Disable it in WEs config like rad said
you can disable that specific thing
Solved. Thank you
Location endLocation = event.getTo();
Location from = event.getFrom();
endLocation.setX(from.getX());
endLocation.setZ(from.getZ());```
I have this in an on move event, but it allows players to move very slowly still. Anyone can explain?
Cancelling the event is a bit jittery
I prefer setting movement speed and jump strength to 0
Don't think this is better pretty sure it's the same
If you want to cancel movement use potion effects on top of it
Then just set movement speed to 0
Nah attributes are the way now
but I only want it if the end location is outside of a bounding box
Then use the event to check that and change it back to normal
ill try
kekw
Or close all tickets as "Intended Features" š
Nanana, close them as "User Error"
I like that idea xD
I wish my plugin had this much attention
wontfix
and then when I got it I probably wish it werent so like you do now
I mean VeinMiner is fairly popular but my support server is relatively quiet. The occasional person coming in once a month or so asking how permissions work or their config not working how they expect, and that's about it
If you have a fairly straight-forward, out-the-box working plugin that really doesn't need configuration, you're not burdened by support
yeah fair
Something like Magma's plugins don't really meet that definition I'm afraid 
what if they just wan an exe
but if its things like minigames or like faction plugin 1246472 then yeah I guess there would be more to support
That's why I gravitated towards simple and easy to understand mechanic plugins
yeah I wanna make plugins like that too, but I aint got no ideas that havent been done to death yet
lmao, "its in python, there is no exe file"
I mean... I made a vein miner plugin
You can make a plugin that's been done before, you just have to do it better
right thats true
just pull a cmarco
which is?
say that god wants you to use this plugin š
lmao
based
I guess i just need ideas of plugins to make then and dont be such a b about it
maybe ill ask daddy gpt
not sure if that's something he's done but seems like something he would
I considered a long time making a firework plugin where you could define custom firework shapes and whatnot. I think there are a few out there that just make images, but none that make animated shapes
Ones that actually look like vanilla fireworks
Would need to be configurable out the wazoo though so lol
okay well so I did think about making a particle plugin that just works but turns out java particle system is asinine so its really hard to make anything of value
im currently making this and it involves alot of maths
XD
guys
is there anyway to register existed entity Attbrutes generic attack damage for animal mob like pig?
cuz animal mob don't have Attbrutes of generic attack already
when i use normal set it just error
i am making a backend in spring, and i am using postgres and flyway, anyone ever tried using it? i am having a problem where my application never loads because flyway says it is not compatible with any version of postgres when on the documentation it says it is up to latest.
Those mobs don't attack
Subject: Minecraft Developer Needed for XrossHearts
Hey! Iām Hamzacross100, owner of XrossHearts. Weāre looking for a passionate Minecraft developer to help with custom plugins, server setup, and ongoing development.
What We Offer:
Dev Rank on the server
Credit & Exposure in the community
Future profit share if the server generates revenue
Full ownership of your work
If you're interested in helping us grow and want to be part of an exciting project, DM me directly!
Best,
Hamzacross100
Owner of XrossHearts
yea i know so i wonder is there anyway register attbrutes for them
so i can add pathfinder for them attack
with nms probably
Subject: Minecraft Developer Needed for XrossHearts
Hey! Iām Hamzacross100, owner of XrossHearts. Weāre looking for a passionate Minecraft developer to help with custom plugins, server setup, and ongoing development.
What We Offer:
Dev Rank on the server
Credit & Exposure in the community
Future profit share if the server generates revenue
Full ownership of your work
If you're interested in helping us grow and want to be part of an exciting project, DM me directly!
Best,
Hamzacross100
Owner of XrossHearts
bro shut the fuck up
please stop
I get exposure!!!!! oh wow
java
AttributeMapBase attributeMapBase = ((CraftLivingEntity)entity).getHandle().getAttributeMap();
Map<AttributeBase, AttributeModifiable> map = (Map<AttributeBase, AttributeModifiable>)attributeField.get(attributeMapBase);
AttributeBase attributeBase = CraftAttributeMap.toMinecraft(attribute);
AttributeModifiable attributeModifiable = new AttributeModifiable(attributeBase, AttributeModifiable::getAttribute);
map.put(attributeBase, attributeModifiable);
this code used to work but after update to 1.20.4 it uhhh change everything i guese
45$ /hr and I got you
I was going to redirect you to the services webpage but now I'm mad
I'll do $120 an hour just for you
30 $/hours i bet

