#help-development
1 messages Β· Page 1330 of 1
so it'd look a bit like
{
type: "PAPER"
amount: 1
components: {
use_actions: [
"open-embedded-contents"
],
embedded_contents: {
0: ...
1: ...
}
}
}
wtv
Ah, so more or less the data-driven plugin I linked above lol
(albeit probably better impl'd than ActionLib KEKW)
type shit
Eh, ActionLib only uses args cause I couldn't think of anything better for that thing & it's not like I have a large enough community to bug as there's no guarantee w/ this discord lmao
for the most part it's more or less how you're doing things though
// Creating actions
@ActionType(value = "name_of_action")
public class CustomAction extends AbstractAction {
public CustomAction(JavaPlugin plugin) {
super(plugin);
}
// Optional loadFromJson to load from the action's json object
@Override
public void execute(Player target, String[] args) {
// Execution code is here
}
}
// Registering actions
ActionRegistry.registerActionsFromPackage("com.example.package", javaPluginInstance);
// Using actions
ActionObjectManager manager = new ActionObjectManager();
JsonObject jsonObject = JsonParser.parseReader(new FileReader(file)).getAsJsonObject();
ActionObject newAction = new ActionObject(plugin, jsonObject);
manager.addActionObject(newAction);
ActionObject action = manager.getEnabledActionObjectByName(args[1]);
action.execute(target, Arrays.copyOfRange(args, 2, args.length));
ACTUALLY
bleh annotation driven
It works so π€·ββοΈ
Not like any of my stuff has a large enough community behind it to care KEKW
I dislike annotations in general
could be a nice way of auto-registering actions tho
hm
Yea, that's pretty much the only reason I use annotations lol
org.reflections & annotations
L
reflections lol, imagine not using service loading
This isn't a service though?
auto registration sounds a whole lot like service locating to me
and it solves that problem without whacky runtime reflection :D
They're not services though nor meant to be used that way.
In execution it's just ActionObject#run(Entity, String[]) calls
Which service then? Definitely not for Spigot's
wdym which service
got a baeldung article I can read?
jdk service loading api
they sure do
I'm still stuck in java 6
I think this was added in java 5 idk check the javadoc
java 6 lol
j.u.ServiceLoader I think
pretty extensive documentation
- Google autoservice, compile time safe !
how can i fix that, i use text displays and the shadow of the name is transparent. but i want it to be like the icon solid
I don't know
Only difference seems to be not having to use annotations in specific places, which is mostly irrelevant
also maintaining a services file? yikes
That wouldn't work w/ ActionLib lol
What's an action lib?
^
Oh
kekw
which is why autoservice exists
Eh not really worth the switch if it's just extra files in the end for the same thing reflections is doing
without the whole classpath scanning yuck
Eh it works so π€·ββοΈ
it's also one whole bundled dependency less if you care about jar size and startup speed
Not really, this is relatively quick
[org.reflections.Reflections] Reflections took 368 ms to scan 1 urls, producing 13 keys and 140 values
5ms for a plugin which implements ActionLib & adds its own actions too
I could also get around the file size via libraries
(also I'm pretty sure I'm the only one really using it, so it's not like I have to take into account many other devs using it, in which case there's still no issue with the implementation itself)
I am debating on if I want to rewrite all of the plugins I have as a major version bump or scraping them entirely & rewriting them from the ground up under my server though π€
Maybe if I do the second one as it'd be a clean slate and git/update history lol
@echo basalt for interactable items is this complete or is it missing anything besides some small QOL methods?
https://pastes.dev/so6VNVcYjt
uhhh
it's pretty basic yeah
I'd probably add some sort of command and not hold any direct references to the impl themselves
like /customitem get <name>
applying ids to nbt is internal logic and shouldn't be public
Yea, just focused on the actual API implementation. Command is just QOL in this case lol
i detest annotation driven frameworks
the only two valid use cases i've seen so far for annotations are static flow analysis at compiletime or before, or marking members/classes for transforming at runtime by something like asm
eh they'll be annotation driven for the foreseeable future lol
Afaik I'm the only one using any of the libraries I do have posted, so I'm just making them for my own needs lmao
e.g. for discovering classes at runtime, instead of an annotation, it's better to use an interface to do it
Not unless interfaces can allow the equivalent @ActionType(value = "name_of_action")
although, I have different annotations w/ different info iirc
properties aren't required for discovery
i dislike every framework that "discovers" classes
and interfaces can do properties through abstract methods instead
discovery has its place to reduce boilerplate a bit, but yeah, it can get iffy
The provided info is needed, as it's used for various different things
@Retention(RetentionPolicy.RUNTIME)
public @interface Metadata {
String name();
boolean requiresMinimumVersion() default false;
MinecraftVersion minimumVersion() default MinecraftVersion.v1_8_8;
}
This is also the most up-to-date version kekw
the only advantage an annotation has over an interface is that they aren't required to be present on the classpath at runtime
which isn't something you need for discovery either
at the end of the day an annotation is a very very boiled down interface
Automation is really the only way to go about it in my case, given the amount of stuff that gets registered unless I felt like manually registering every new addition, which is bleh lol
40 different classes
I haven't read what you've been talking about, I was talking about stuff like PlaceholderAPI extensions, or Spring Boot etc - where there is no proper entry point and it just scans the .jar and inits every class just to find out the annotations etc and I really find that messy lol
yeah that too
Really only way to go about it in my case. Directly or in-directly via something else lol
I much prefer having a plugin.yml or a manifest or whatever
there are also some funny plugins that do not register their own listeners manually but instead scan their own classes and simply register everything that implements Listener
that's also very weird imho
the number of times i have had velocity plugins break because i refactor a listener or something out of my main class, and then get some obtuse error like "can't register x for null: null has no container"
unless again, I want to write 40 different lines, and a new line for every addition.
Easier to just automate it
and then spend an hour debugging it, and realize i'm no longer passing my main class instance to some listener registration method, but the listener itself
also wtf is going on with velocity + floodgate
which of course fucking compiles because they didn't make plugin an interface, but an annotation
imagine using Object as the signature for plugin
This wouldn't really work in my case, unless it was just a list of classpaths which is worse than just automating it since you'd have to remember to add to the list π
what are you registering this many of, anyhow
yeah as said, I wasn't talking about the idea in general, but for stuff like PAPI extensions, velocity plugins, or spring boot applications, the idea is stupid imho
often, though not always, when i face a similar situation, i find it's better to replace classes with objects and construct®ister many objects of few classes instead of having many classes
eyeballing the readme it sort of looks doable, but i'll take your word for it
A README i haven't bothered updating in ages kekw
i do something a bit similar in a mythicmobs integration
this is why I hate spring boot - what even is happening, when, and where LMAO
I can grab example classes though rq
lord have mercy
spring boot is nice π
Those don't take into account extra config stuff either, like reqs and what not π
yeah but it also has many disadvantages
e.g. if you are me, and you have to review code from someone else, you ofc usually start checking out the entry point. In this applicaiton, there literally is none
No good way to really improve upon this, besides services I guess but that doesn't make enough of a different to bother rewriting the entire plugin to use them lol
i assume @SpringBootApplication is the entry point
yes obv
annotations are confusing tho which i agree
but what does happen after that?
that i don't know
the main method only calls runApplication on itself
i wanna practice spring boot
i could see this being decomposed to functions and typed config objects in place of jsonobjects, but that does have its own drawbacks; you can easily end up with a god class full of function bodies
Which is not worth it
yeah this is definitely a valid use case for discovery
^ told ya nerds
i've done the same in a custom enchantment plugin before
though i used an interface instead of an annotation
meh. annotation works well enough for a project I don't think anyone but me's using
yeah it's fine
~140 ms to read all the classes & only ~5 ms for the one plugin that i know uses it lol
my main issue with annotations is that since they have to support not being present at runtime, you can only use compile-time constant values for the properties
It's possible I could do the context object pattern instead in places instead of the current mess, but not really worth looking into
it's quite straight forward for configs at least
gson supports records out of the box
so instead of a JsonObject you can take your action specific config object, and gson will do its best to deserialize it from json
i'm gonna finish updating databases and learn spring boot
Not worth it, as these are user defined configs
e.g.
{
"name": "Adventure Mode",
"enabled": true,
"actions": [
{
"type": "set_gamemode",
"gamemode": "ADVENTURE"
}
]
}
this requires a type variable being present for the config type however, which isn't very easy with annotations but is trivial with interfaces
it's still worth it because it makes your own code cleaner
Hard-coding the actual actions & just calling them is better given the context of the entire library π
you'll get to use type-safe getters instead of manually parsing and asserting json properties
Ehhh debatable. Depends on how un-user friendly configuration becomes
especially given one config can have multiple wildly different actions within them
i did something very similar to this with the openai rest api
much like your actions array, the api returns and accepts an array of wildly different types, each with their own properties
That doesn't matter unless the user can configure things cleanly w/o having to learn & remember formatting which doesn't matter
i had a @Type(String type) annotation to populate and query the type property, to discover the concrete class to deserialize; then i left the deserialization completely up to gson
The configs are setup so even an idiot can make em
it would accept a construct basically the same as what you posted
and construct a List<Action> with one SetGamemodeAction with the gamemode enum property set to ADVENTURE
this is roughly what i assume you're doing as well, but it sounds like you're doing a good bit of it manually
specifically in your initConfig(JsonObject) method
I should really just push all of this to the repo, but going off how things normally are maintaining it isn't worth the time lmfao
e.g. I would do DropItemAction as
@Type("drop_item")
public record DropItemAction(int pickupDelay, DropItemAction.Hand hand) implements EntityAction {
enum Hand { MAIN_HAND, OFF_HAND }
@Override
public void runAction(Entity entity, String[] args) {
if (!(entity instanceof Player target)) {
return;
}
PlayerInventory inventory = target.getInventory();
ItemStack itemStack = hand == Hand.MAIN_HAND ? inventory.getItemInMainHand() : inventory.getItemInOffHand();
if (itemStack == null || itemStack.getType() == Material.AIR) {
return;
}
Item droppedItem = target.getWorld().dropItemNaturally(target.getLocation(), itemStack);
droppedItem.setPickupDelay(pickupDelay);
target.getInventory().remove(itemStack);
}
}
notice how all the config parsing boilerplate disappears, and you're left with purely the implementation of what you want to do
also now you can do (supposing EntityAction extends Action) List<Action> actions = GSON.fromJson(...)
Which only matters if the json itself isn't terrible
then just do something with it
i mean it simplifies your code tons
the config remains the same and you can even load it in from yaml
Doesn't really need to support anything more than json π€·ββοΈ
i will, as soon as i finish upgrading some databases
json is like all the disadvantages from bson with all the disadvantages from yaml
Eh. it's good enough lol
yeah but it's a pain to edit
skill issue
it's not ideal for user facing things, but it's the de-facto data interchange format for stuff like this
yeah I don't hate it, but it's really not very great
what you do is you have your yaml or toml or whatever the shit and you parse it into json, so your code only sees json
i definitely don't like yaml either though
i think the best spec i've seen to date is SimpleYaml, but that's a pythonoid-only concept
and we all know python people are not real programmers, so it doesn't count
Even if that were a slight improvement, it's not worth rewriting the entire plugin over lol
The code is already relatively fast, checked an older msg here and it was 368 ms to scan 1 url, producing 18 keys and 140 values for the main library
5 ms for the plugin implementing said library
although this bit from earlier is still relevant lol
i mean it wouldn't affect the parsing speed or performance or anything; i'm just saying it'd delegate that manual json parsing you're doing to the json parsing library, gson
making the code more concise and removing much of the boilerplate
eh still has to have user configuration ability somewhere, in which case I'm better off just parsing whatever that is. Which is exactly what I'm doing already
no no
the user configuration ability is the same and is unchanged
but instead of parsing the user config yourself, you give it to gson, and it gives you your typed ability objects
Does anyone know how to replace EntitiesLoadEvent in older versions?
ChunkLoadEvent and Chunk::getEntities
This doesn't work well.
in older versions, chunk and entity data were in the same container and were loaded at the same time
in modern versions, entities are stored separately, so an event for loading an "entity chunk" was introduced
oh
ChunkLoadEvent is the functional equivalent in old versions
So, when the entitiesloadevent doesn't exist, does this method work well?
it should be 1:1
you can think of the old ChunkLoadEvent as a load event for block data + entities
in modern versions, it's only for blocks; and the EntitiesLoadEvent is only for entities
only for blocks what?
a chest is a block entity
oh
meaning in modern versions, the ChunkLoadEvent doesn't guarantee that entities are loaded yet
only the EntitiesLoadedEvent does
What is only for blocks? u mean the chunkloadevent and getentities in the modern versions?
in modern versions, the ChunkLoadEvent guarantees that all block data and block entities are there, so you can do e.g. getBlock().getType() on a block in the chunk
but calling Chunk::getEntities or Location::getNearbyEntities might return nothing, as the entities might not be loaded yet
Yea, checked the rest of the impl & it'd require a lot of rewriting if I wanted to go about that method.
I think the way things are handled in general would need an (almost) complete rewrite lmao
that's how it often is
maybe do take a look at it in your next project if you end up doing something similar
(not doing it)
wdym
Probably wont kekw
Anything which requires data-driven actions just uses ActionLib w/ new actions registered to it
but tile entities should be loaded already in ChunkLoadEvent, don't they?
what is a tile entity btw?
another word for block entity
chests, barrels, furnaces etc
oh a block entity
different names to same thing
an inventory or any other state or data that doesn't fit in block properties
e.g. sign text
yeah or beacons
Only real way it'd get rewritten is if i pushed code & someone sat down and rewrote everything to be better or i rewrote everything from the ground up under my server groupId and what not lol
tell chatgpt to do it
If I have a listener with 5 listeners, but one listener is not present on the server because it uses an unsupported version, will 0 or 4 listeners be loaded?
listener as in EventHandler?
Nah. It can be too dumb
the 5 listeners are on the same class
event handlers require the event type to be present in the method signature
I think I ever tried at one point actually kekw
your class will load to fail because of a ClassNotFoundError or however it's called, usually
so if the event type is not found at runtime, loading that entire class will blow up with a ClassDefNotFoundException
fail to load*
kk
I usually only get a single-line error saying that it failed to register the event. Perhaps this is because paper have a try-catch block internally in the registerevent block
The question was whether this affected the entire class or just the event in question
if your class defines a method, and that method takes a parameter of a type that is not present at runtime, the whole class will fail to load
I find it strange because I'm almost 99% sure I don't saw ClassNotFoundException on this case
post code
Most likely outcome is i get around to it when i finish w/ the server stuff and just rewrite everything from the ground up, confusing everyone in the process π
do you have any example code? Because the registerEvents method takes an INSTANCE so I'm not sure how you'd even pass the instance when the class itself fails to load / init / instantiate
although I do too remember the specific error you mentioned
anyway, the proper way is to simply split up your listener and then only instantiate the ones you're sure will load
also yea, ChatGPT still sucks for this kekw
i ain't throwing money at OpenAI π
you can throw money at copilot instead, they offer codex 5.2 through their platform
ew no
it's a bit sketch however; i prefer using my homebrew agent instead
deepseek is surprisingly good nowadays, but still quite slow
I usually just wrap the listeners/hooks into interfaces like this and then have an implementation and a "NoOp" impl
glm5 also looks very very promising for its size
I did get something semi-competent from ChatGPT though. One moment lol
getting models to do code properly still takes some finesse and a good harness
If I'm not hallucinating, it was also in version 1.8
I just told it to throw all the code out and start from scratch, currently making a paste for thoughts & concerns KEKW
which event class are you talking about?
eh seems like it's just made things more complicated. nvm lmao
Any one. From what I remember, if I compile a plugin with a recent Spigot event that isn't in version 1.8, then it would only show a single-line error saying it couldn't register (without a classnotfoundexception)
interesting. no idea how that works
Perhaps a peculiarity of older Java versions, because I was probably running Java 8
probably they're doing some funny classloader shenenigans that checks for org.bukkit in the class loader
because it definitely wouldn't work for third party events
i can only attribute it to some weird paper/spigot asm nonsense
yeah
definitely spigot, not paper
paper likes to break stuff even inbetween versions
ChatGPT somehow made something worse than my current implementation KEKW
e.g. on paper: plugin on 1.21.11 build 10 works fine, 1.21.11 build 20 -> NoSuchMethod lol
they do break stuff even between minor versions, but hey, they come back 2 weeks later adding a rename rule to their asm nonsense to unbreak it
paper is a blessing and a curse, unfortunately their community is really toxic
Thankfully I can just fork & forget lmao
we did maintain a paper fork inbetween 1.21.8 and 1.21.11 to add a tiny async catcher in Entity#addAttribute (which they did officially add in 1.21.9) and it was a pain
whatever happened with aikar
aikar is a great dude
all i see him talking about on the paper discord now is steak
git remote -v
upstream https://github.com/PaperMC/Paper.git (fetch)
upstream no_push (push)
they ain't geting any PRs from me LOL
what does "is steak" mean? I'm not native english
is that some kind of idiom lol
No
steak is a kind of meat
^
that I do know
All they talk about is food
is means aikar is talking about a particular type of meat
oh you mean he's really talking aobut food lmao
Yes
myes
I though "is steak" means sth like "is goated" or sth haha
No, is is quite literal lol
i suspect he has ptsd from his timingsv2 being thrown in the bin and being replaced by a half-baked async profiler ui in spark
There are some things I want to add to the private fork actually but it's a pain rewriting them to fit within paper π
they used to have this triage team
you could throw garbage pr's at them and they'd fix the pr up
now you have to wait in line for 4 months to be told you have a comma in the wrong spot and to fix it
and then wait another 4 months for a new review
I remember when I once made a PR to spigot and then many paper fanboys showed up and claimed I stole everything from paper lol
it was some tiny thing about translation keys, I dont remember exactly
fork paper just to have faster response times /s
^
they told me the method names were bad so i changed them, currently i'm in the process of dying of old fucking age waiting for a re-review
do you guys think this server could handle 675 players split up into 9 servers? e.g. 75 players each, 9 instances
Really not difficult to fork /Paper either tbh
1.21.11, some kind of erm...
what is it called again
it's an event with a like 1000x1000 blocks area
i do have a couple of local patches, but i hate redoing them with every game update
about 400 mobs + 75 players per server
so i wish the paper guys would update them for me
mob arena! that was the name, I guess
If I wasn't already working on a private fork, I'd make a public one just so I could go through their issues & PRs and deal with everything lmao
75 players is a bit high for modern versions, but it's doable for survival servers
would be nice if there'd be an option to set entity-ticks to e.g. "only every 2nd tick"
so perhaps for mob arena as well
You could lobotomize most of the mob ai
can't do that, they're all mythic mobs
poor mobs
every instance will for sure almost completely eat up a thread
did this cpu have hyper threading?
i don't know, all I know is that it's the most expensive game server at OVH
mythic will probably eat up 3 more threads per instance with how fucking shit their code is
I remember there was a mob arena on minehut that had insanely laggy mobs
yeah
Itβs pretty easy to survive when the mobs are moving once every 3 seconds
only for bosses
one day mojang will give us better server-side customization π
i'd guesstimate you can get at least pretty close
you'll have 9 cores at almost 100% for sure plus 7 to spare for gc and async bullshit from mythic
if you have hyperthreading, there'll be more headroom
but you will definitely have to keep an eye on it and put some effort toward optimizing hotspots
we'll just see. We're expecting 675 players (who can participate) and when it lags, well then we'll just turn down the mob spawning rate
I mean thereβs also the async stuff from minecraft
Actually most of that is worldgen so it doesnβt really apply
it's just a tiny area of 1000x1000 blocks roughly
mostly chunk loading in this case, the arena is fairly small, probably shouldn't have a big impact
if needed you can preload the entire world
all chunks are preloaded with chunk tickets
Netty and chat still have their own threads tho
just make sure they're loaded at some low ticket level so they don't try ticking mobs or blocks
https://imgur.com/a/TfnlVnv Regarding older versions that don't have world#getEntity(uuid): if I have a guarantee that the chunk is loaded, is this slower than simply iterating through all the entities in the world?
chat is negligible, netty does handle some heavy lifting occasionally
how old is that version that World#getEntity(UUID) does not exist?
1.8 does not have World#getEntity(UUID)?!
nope
wtf
lol
I can make my own in chunkloadevent/unload xd
this is why we stay modern π
for best results do location::getNearbyEntities with a radius of 1 if the location is accurate
i did this plugin years ago
this way you only iterate over one chunk section, rather than a whole chunk
from my experience, that's pretty expensive
That's not the issue; it's purely about efficiency
I donβt think it had location.getNearbyEntities either
I remember it only being on entity back in the day
it's more efficient because you will only be looking at the entities in that chunk section, rather than the whole chunk
The method I described above works perfectly; however, I think it has more overhead if I have a guarantee that the chunk is loaded, and it's better to simply iterate through all the entities
i think it probably exists on World if not on Location even on 1.8
getnearbyentities exists yea
getChunk is a no-op for a loaded chunk
Why are you using 1.8 in the first place
this is a public plugin and i have 1.8 on my banner
so i don't want change lol
i alr did the code too and this was made years ago
are you using bStats or similar in your plugin?
chunk.getEntities will iterate over every entity in the entire chunk; location::getNearbyEntities will only iterate over every entity in the chunk section, which is far cheaper and more efficient
no
you should add it, and then check how many people actually use 1.8 in your plugin
I bet it's less than 1 %
Inb4 they didnβt even separate them into chunk sections in 1.8
i think that's been a thing since anvil
But I've already added the support; I find removing it, etc., more work than making that adjustment
1.8 is dead
which god knows when the fuck that was but before 1.8 i think
and i never heard about chunk sections
Personally, I only support the latest version
skill issue
allows me to rip out anything i feel like π
So, does Chunk have a child now?
has had since like beta
technically yes
a chunk is split into 16x16x16 sections
but you don't have to worry about that
entities are tracked on a per-section basis
and chunk section?
every chunk is or was pregnant = confirmed
is what i'm talking about
no
chunks split the world horizontally across the X and Z axes; chunk sections split a chunk vertically across the Y axis
oh
chunks go from bedrock to the sky
chunk sections are slices of the chunk, 16 blocks tall
u said "chunk" here
shouldn't be chunk section?
yes, a chunk is split to 16^3 chunk sections
this is what allowed the anvil world format to double the world height while halving memory usage; sections full of air aren't even loaded
^3?
16x16x16
oh yes
now to unload chunks which don't have mobs. peak efficiency π
i want async pathfinding, ai, and collisions
someone has already done pathfinding
collisions should be trivial enough
no, the most you get is a single new block to play with
Yeah thatβs probably not super hard to do
Just go for any promising 1.8 fork full async
Just update the mobs movement target when youβre done calculating
As long as it doesnβt take too long it wonβt be noticeable
the only part that requires any care or threading nonsense is ai goals like an enderman picking up a block, to make sure the block wasn't concurrently destroyed
Yeah collision would be the same
beyond that i don't really care if the drowned ai goal for going for turtle eggs sees stale data and pathfinds to an egg that was broken the same tick
Do you guys use Spigot or Paper on production servers?
or woe is me the collision logic is 1 tick behind the actual world state
paper for prod, spigot for development
paper of course, nobody uses spigot these days
we're all here because the paper community is toxic
albeit my server uses my paper fork for development
Me on my way to clip through a wall as a player builds it π
Who? The developers or servers owners or smth
I wouldn't go to their server even if they wern't toxic lmao
developers i mean ppl who ask on paper-dev
a little bit of both, mostly the not project manager developers
I only went recently cause i couldn't figure out paperweight, gave up, forked /Paper KEKW
cat is i think too busy having continuous mental breakdowns to have time to be toxic
icl in my experience the paper devs are hella chill, just spigot and paper have different goals i suppose and thus different people who contribute
the main guys are alright
Actually if collision was slightly delayed you could kill mobs by repeatedly building walls directly in front of them to make them take a tick of suffocation damage
Kek
it's the mid-tier devs that have their heads up their asses
i'd assume most of the time all the synchronization and other memory barriers happening would make the data visible to the collision thread within the tick, and while this could happen, it'd probably be pretty rare
idk i feel like that's common to most communities in various degrees, whats that other fork called that combines everything?
i heard people still use that
yea there should be enough mem barriers and flushes already
gotta make a plugin which combines every plugin, fr fr
Donβt underestimate the speedrunners
any%
iirc the palettedcontainer for holding block data for chunk sections even has synchronization
though the main thread only synchronizes over writes, not reads
so reading it async should be perfectly safe
btw don't you already have async pf algorithms and coll checks with folia?
i have no clue what folia is doing honestly
Actually, that reminds me. I do have a project that only exists just to make a project that uses as many maven libraries as possible @ivory sleet
Don't think I got that far in it though, mayhaps I'll re-setup WSL2 and try and stream it on this terrible laptop & internet lol
i haven't paid any attention to it at all
Doesnβt it only write to it from the main thread anyway
yeah, all writes are from the main thread
and well to some extent the chunk gen thread
unsure but quite possible
Does anyone have benchmarks of running Paper 1.21 with 50 players or smth on a weak CPU?
ayo why the crying?!
prob not
but the sync does mean that any async readers will see any writes by the main thread immediately
benchmarking 50 players on its own isnt helpful, it depends what the players are doing and where they are
more or less yea
it is a skyblock server so chunk loading/unloading will be very fast
and i'm using slime world manager
ive no clue abt slime world
Therefore, chunk loading will be performed in memory and not from disk
^^
Chunk loading is performed from memory, not from disk
on aswm
i think finding exisiting benchmarks might be even harder then
Yes, but if it runs on a normal server, then it will definitely run on an aswm server yk
I'd like to buy this. I don't know if it will be enough
more specs = more server instances if they don't take up much ram & cpu time
100 players would be great to start with. 2 instances of skyblock, 1 spawn instance (this spawn will have chunk loading because it will have an exploration world and will be normal paper), lobby and velocity
I don't know if this CPU will be capable of that xd
Heavy chunk loading/unloading will only occur in the spawn server
Then there are redstone systems, but I think that only affects TPS and not CPU usage, so the only concern would be the core frequency (and not the number of cores), but I don't think that's a problem
TPS is based on CPU usage
I say this because I think redstone systems don't have concurrent logic like chunk loading
Itβll still affect the usage of whatever the main thread is on
yes, but CPU usage during chunk loading affects CPU usage much more because it uses concurrent logic, unlike other Minecraft systems where everything is done on the main thread and therefore only affects the main thread, which I believe is the case with redstone
I assume this is a modern version of paper
yes
Otherwise I donβt think chunk loading is concurrent, only generation
I think in older versions the chunks were full sync
In newer versions, there are methods like getChunkAtAsync, teleportAsync, etc. Are these methods (or similar implementations) not used by internals?
internals i mean bukkit, paper, spigot layer etc
Those are paper only
The async in these methods refers to the chunk loading being done async, and the actual action e.g. teleportstion being deferred until the chunk loading is complete
The action itself and any access to the loaded chunk is still done sync
Oh, async is used correctly in this context
Because some methods have async in their name precisely because they only execute in a different thread
well, If anyone has any idea if it would be possible on this CPU or even more instances, I would be very grateful
specs: https://imgur.com/a/U6C36dh
100 players on one instance? not with 20 tps. if you split it up into several instances? no problem at all. bottleneck then would be RAM
50 players on one instance
was this on 1.8
i do see servers going up to 80ish
1.8 i can run 1000 players on a single instance on a shit cpu lol
but the margins are really low at that point
50 players should be fine but heavily depends on the gamemode - SMP? Or everyone in the same area? etc
with this specs?
don't know
it is box smp, basically modern skyblock
but have redstone
how about folia
should work unless people build lag machines / got a tons of entities etc
I'm really worried about CPU usage. My Intel Xeon-E3 1270 v6
4 c / 8 t
3.8 GHz / 4.2 GHz reached 30% usage in one process, and the chunks were loading very slowly. just 1 player
we're currently using an AMD EPYC 4464P for each citybuild and TPS only goes below 20 if there's > 70 players on one instance
world-instance-per-island and 50 islands per server-instance
if it's like skyblock, then why do you need to load chunks? doesn't every player have their own island complately loaded?
performance heavily depends on simulation-distance, and ram-usage heavily depends on view-distance
have a spawn instance with a world acting as resources world
to ppl can mining etc
https://prnt.sc/VhQQuBzb8AYN This processor's single-thread and multi-thread performance is much better
And how much are you paying for that CPU?
oh then I don't know
tbh not sure, company pays for it. But we're replacing the EPYCs with OVH's gameservers currently (Ryzen 9 9950X3D)
the ryzen 9 cost about 230β¬/month with 128gb ram
I'd much rather have 256GB each but they don't offer that in the datacenter where we need them D:
would be nice if it'd properly work
I didn't see that message. I think separate instances use far fewer resources
I created the box smp precisely because it's easier to create a cheap multi-server setup with an infrastructure that separates the boxes into different servers (unlike the donut smp where different processes operate within a single world, which implies higher processor usage)
folia is bugged as hell, and undocumented, and that is why I currently consider it to be shit
no clue, i've never used it
my only interaction with it is noticing towny switching to some nonsensical scheduler abstraction to support it
always sounded like snake oil to me honestly
yeah, that sums it up pretty well
the idea of folia is great though
I mean, it works, but it has some drawbacks
what kind of bugs are we talking about anyway
is it like plugin bugs or platform bugs
you seem to know sth about it, could you please elaborate the drawbacks?
i suspect most plugins that "support" folia just switch up their schedulers and don't bother to actually think about the threading model, and so end up buggy
that's definitely true, yes
du bist klog ja ja kek
ich bin jones
99% of the plugins
im not germany btw
i'm not swedish either
well, the api breakages for one, a handful of events are not fired because of missing proper asynchronous event bus, so plugins have to be very specifically tailored for folia and with thread safety in mind as a first, outside the api it also has to break some vanilla behaviours, many commands are disabled and other vanilla mechanisms like scoreboards, world border I believe, datapack functions etc etc etc
i can understand swedish
im actually danish
all of which is documented by the way
Not being German doesn't mean you don't know german btw
NEIN NEIN
imho the biggest issue with folia is that it doesn't take into account real usecases, e.g. it should in theory be great for citybuild servers, where everyone is spread out on the map so each plot, in theory, could be ticked independently. But what if there's some event at the spawn? ofc then everyone goes to spawn and then there's much more overhead. Take that into account including all the other stuff like "no docs", and it's just not worth it. We'd rather have 5 independent servers; spawn, north, east, south, west.
maybe in 5 years, folia will be great for our usecase. But today, it isn't (yet?)
i've always been of the mind that we should look into threading the server components rather than trying to do regionized ticking like folia
biggest mc server is using folia
so maybe is useful
duolingo told me
and it serves for real servers just fine
regionized ticking is the first thing that comes to mind, the endpoint of the "split it into many servers" via going back to the origin by "merge the servers into one", and i find the starting point to be folly to begin with
is this true ?
without knowing anything about the impl i'll concede that folia might be achievable with smaller diffs than threading the individual components, but i'm not sure if that's the case
well strictly speaking fewer jvm's means less overhead
The question of whether creating a skyblock like the Hypixel infrastructure (but in 1.21) is cheaper than Folia
tbh I haven't checked the docs since like 2 years ago, maybe that has improved. But what lacked back then was
- javadocs (which exist meanwhile)
- a proper explanation about what are the main differences, and what to keep in mind when switching from paper to folia
so yeah probably my info about folia are pretty outdated
But Folia probably does many things to ensure synchronization
i vaguely remember reading some folia doc on the paper website and it was an alright entry point into the concept
the api is no different than that of paper, so javadocs are not exclusively necessary, outside of, like.. deprecating the BukkitScheduler? which lmao
last time I checked the folia docs every second link led to a 404
but as said, that was 2 years ago
@slender elbow what's your opinion on this?
all that said i would much rather figure out threading e.g. the entity tick loop rather than trying to figure out regionized ticking
it would scale better i think and be more compatible with plugin expectations
hypixel is total shit anyway, unless you wanna stick to 1.8 blocks and wanna get messages about scam buying ingame currency
im on 1.21
Umm aktually
my message was not directed towards you
They are moving skyblock to run on 1.21 soonβ’
And I lost my Minecraft Premium account because of scams on donutsmp btw
(Parts of it already do)
omegalul
they also "killed minecraft" with hytale, didnt they?
lmao
I disagree with that. Can't they just make a new game now? lol
yeah but realistically, what folia does is more, well, realistic, you are essentially running multiple servers on one vm sharing the world, threading the singular server tick loop would be a whole other ordeal
Hytale is a new game?
like at that point it'd be cheaper to diy a server from scratch
Hey donβt forget Yogventures
i don't know, maybe i'm just uninformed, but the entity tick loop seems fairly readily threadable
they could have, but they chose to copy all the bad things from minecraft, and combine it with garry's mod. and what did it turn out to be? a ret**ded game that is just shit
ehhh
what is the bad things
if it was without absolutely shitting the bed on vanilla compat, it would've been done already
retardded* dont censor yourself. this is a free country.
i mean the world state is fairly safe to access async, and that's what 99% of entity ai is
ultra bad performance, for example. 50 players needing 50 GBs of ram server vise
only places i think might be complicated is stuff like endermen picking up blocks, which would change the world rather than reading it
you might be able to parallelize it however, but keep it in sync with the world ticking
but is this a minecraft-thing?
a la parallelstream
hm tbh, not really. minecraft was never that bad
so this is wrong xd
i mean
only if u have another bad things
yeah my comparison was wrong, but hytale still is shit
does the drowned really need to synchronously look at every block within a 20 block radius to see if there are any turtle eggs nearby?
π
oh and also it took them over 10 years to produce a game that has literally 0 content
hytale = noman's sky
i figure doing sorta sketchy async reads of the world would suffice just fine for that
hytale = KSP2
I'd like an opinion from a paper developer
hytale = Cities Skylines 2
it is absolutely essential to the functionality of the server /s
it's one of those games that took forever to deliver NOTHING
is this hytale?
kerbal space program 2 π€‘
no this is vanilla minecraft
the only saving grace is that it only does it once every few seconds
they learned their lesson from villagers searching 100000 blocks for job stations every tick
lol
Itβs a very important feature
that still pisses me off
Someone has to stomp those turtle eggs
1.15 the "performance update"
all they did was put a throttle on the villager ai goals
Tbf zombies looking for turtle eggs is probably the bigger issue
There are generally more zombies than drowned
do they? i thought only drowned look for them
Can't the paper fix these things?
good shit
well no, they can't really, not without changing how the game plays
zombies just want to smash the eggs
how do you find eggs without looking for them?
something something POI octree nonsense
one could record them while they're placed, and cache them
But there may be more performant solutions with the same result
I mean yeah the poi system already exists
unfortunately not even paper wants to fix all those shitty AI shenengigans
iirc the poi system is very rarely proactive, that is, some entity has to do the search once and then mark things as poi's; they won't be marked as poi's on block place or such
which means entities without a valid poi nearby will just continue re-searching the same area forever
I do not call myself smart but if I was the one who would have written that "ai code", I would have simply cached the last result and memorize which blocks are "wrong" and then not check them directly again next time
something something too much memory
copper golems remember up to 10 invalid chests and then forget them all
Could just store a few numbers
Ie store the x y and z of the last checked block and then start from there
the easiest and probably a sufficient optimization here, which iirc i suggested at paper, is to check the chunk section containsMaybeAny or whatever the fuck the method was called, which checks the palette
if the palette doesn't contain the turtle egg, no need to search the chunk section
if it does contain the egg, it gets poi'd and the search doesn't rerun any time soon
don't know if it ever got implemented; probably not
Ah yeah thatβs smart
Iβd be surprised if it doesnβt use a palette check already
they're too busy deprecating string color codes to do anything useful like this
In older versions of Bukkit, world#getEntity(uuid) is basically to create a map with chunkloadevent/unload and iterate through chunk #getEntities. Is this worthwhile?
Please don't judge me π
what
your question doesn't make much sense
https://imgur.com/a/DAXANwU if is it worth doing this to avoid a world#getentities foor loop to retrieve an entity by its UUID?
depends on how often you're calling it
like i said, getnearbyentities is pretty cheap if you already know where the entity is
and since you're on 1.8, you could just nms it and call the internal uuid -> entity map; not like it's going to break from updates
Can anyone take a look at my plugin
Maybe provide some additional context?
Drop the source code.
Why is it that on my server auto crafters just donβt work. Everytime I click a square to block it, it doesnβt work.
It goes back to all the squares being unblocked.
Are you in the right channel?
Are you asking here because you did something in your plugin to change autocrafters or UIs?
Itβs just a general question, but i think it is due to some sort of plugin
Wouldn't this be for #help-server then?
And shouldn't you provide maybe a list of plugins, from /pl
I couldnβt upload media here, but thanks Iβll use the other channel.
You can just copy and paste the output of /pl, a screenshot of it isnt needed.
And if you really want to upload media, verify
?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
!verify
Usage: !verify <forums username>
what if i have around 80 plugins π
put it in a paste then?
Hlo any one help me to make Minecraft plugin I don't have money π₯Ίπ
This plugin blue print
?services
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/
ah there you go
sure
just ?learnjava
or even better, learn kotlin
you probably shouldn't learn kotlin before learning java
kotlin has a lot of syntatic sugar and simplifications that you will understand much better and easier if you have worked with java before, and also, the java stdlib lol
Plus if you learn java first youβll see that itβs the one true language
And youll never want to learn anything else
does shell count
what about c π
Assembly or nothing π
nothing sounds better
jhon programming lang
lua π
you're talking about kotlin, right?
How does the API go about fixing typos in method names?
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/entity/Mannequin.java#92
Is this worth a PR or will this just exist forever?
Spigot does have some code rewriting abilities with ASM to fix compat issues
Could probably PR a fix and then write a method renamer to keep compat with plugins using the old name
Or just add a method with the correct name and deprecate the old one lol
I mean yeah that works too
better check no more typos https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/06106afa3ae66fd8699ddc35ec3b7e75dbf55cd3
does anyone know a way to remove a specific use from an area? Like the use of arrows, I want to remove arrows from a certain area, or at least the effect of a specific effect, like slow falling
md_5's Mixtape !!!
does someone have an idear how can i optimize this part ?
https://imgur.com/a/rSsow35
public ItemKeyLite(ItemStack item) {
this.type = item.getType();
int cmd = 0;
ItemMeta meta = item.getItemMeta();
if (meta != null && meta.hasCustomModelData()) {
cmd = meta.getCustomModelData();
}
this.customModelData = cmd;
this.key = item.getType().name() + ":" + cmd + ":" + Internals.nbt().get(item, "sell-price", PersistentDataType.STRING);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ItemKeyLite other)) return false;
return this.type == other.type && this.customModelData == other.customModelData && this.key.equals(other.key);
}
@Override
public int hashCode() {
return java.util.Objects.hash(type, customModelData, key);
}
Im using this to store my item for a virtual backpack in a map<ItemKeyLite, Long> but this is for a tycoon gamemode and everytime an item is added to the backpack this init a new ItemKeyLite obj
why dont you just serialize the item
your code doesn't seem particularly inefficient though
just weird
I want minecraft server developer
I want $1,000,000
Now thatβs just greedy
now kiss.
Hear me out, I want -1/12
team's display name is not visible in the actual nametag right?
it's just a name of a team
prefix and suffix are visible only?
do you know of any packet-level equipment filtering library/plugin? i need to add some item components to worn player equipment on a per-viewer basis, and would rather not roll my own solution for it
libsdisguises perhaps, it does have a mode to copy the player's skin and such and i'd only have to filter the armor manually
i did see someone posting about a library that did something like this, just for item lore in inventories instead
can't remember what it was called
I'm developing the Hypixel minion plugin, but I'm having a problem. The issue is that if I have two minions placed in the same chunk, and the time between actions is different for each, then if, for example, I move away from the chunk, the chunk will be unloaded, but since the time between actions is different, this might happen:
1: The chunk is unloaded and saved in memory that the cobblestone minion has cobblestone blocks to place on the ground;
2: The minion places the necessary blocks and therefore performs getBlock#setType, consequently loading the chunk;
3: The other combat minion performs its action and kills the mobs (the chunk is loaded at this point due to the loading at point 2);
4: The cobblestone minion sees that the chunk is loaded, so it performs getBlock lookups, etc. (and perhaps increases the time the chunk remains loaded; I don't know how the behavior of how long the chunk remains loaded works);
And it gets stuck in this loop where the chunk remains loaded even when no one is nearby. I believe that's what happens; correct me if I'm wrong about how chunk loading and unloading behavior works
Does anyone know how to solve this? I'd like the chunks to be unloaded as soon as the player moves away
check if the minion Entity::isValid before making it perform any action
if the chunk is unloaded, it will be invalid
I do that. The problem is that I need to set the stone block at point 2
I force chunk loading until the minion places all the blocks
then check if World::isChunkLoaded
and have it abort the action or something if it isn't
this is why minecraft chunk loading has separate load levels for block and entity ticking
This wouldn't solve the problem because I need to make the blocks be placed; what I need to do is, when the chunk is loaded, the cobblestone blocks should be loaded (and the action, instead of doing getBlock, should simply remove a value from memory)
I've thought of a solution now based on what you said
Instead of repeatedly using getBlock to place the block even after the chunk is unloaded, until all the blocks are filled, I simply increment the value in memory to indicate how many cobblestone blocks have been placed. Then, once the chunk is loaded, the blocks are placed where needed
did you guys use pragma before?
try (ResultSet result = sendQuerySync("SELECT * FROM pragma_table_info(\"" + table + "\") WHERE name = '" + column + "';")) {
return result != null && result.next();
} catch (SQLException exception) {
return false;
}
i tried everything and it queries nothing
this is another test
[15:14:04] [Server thread/INFO]: Running pragma:
[15:14:04] [Server thread/INFO]: Ending pragma:
first thing you shouldn't perform queries on the main thread
and maybe ; on SQL query prob is not needed
i'm trying to upgrade a database
hence the sync
i need pragma to get if it has a specific table and column name
but it's just empty
the file has names for both so it's very annoying
i could use select
Any one has any clue why windows termianl when you start 1.21 server wont accept commands
when you try to type in termianl some times accept keys some times not
on older version like 1.8.8 was that fine and I never had problems but this bug is present from like 1.16
haven't encountered this issue
skill issue
Remembered this.
Ended up implementing it privately as boolean LivingEntity#teleportToRandomLocationInBox(Location, int, int, int, bool)
& ignored the rest lol
bruh checking NMS to grab things to make public, EnderMan has a teleportTowards function but it's not implemented in a way I can just move it down to LivingEntity π
entity movement and ai are a shitshow
i can see why they've wanted to migrate into the "new" brain system for a long time
but honestly the impls in that system aren't much better
oh no, the only issue is teleportTowards is just
public boolean teleportTowards(Entity target) {
// Vec3 stuff here
return this.teleport(d1, d2, d3);
}
I can't do shit with this to move it up a class lmfao
Well, there are ways but they're not clean π
i think for a function like this reimplementing it would probably be better than trying to fix it 
yes but i'm trying to keep as little code duplicated as possible, especially when it's literally just a single class up from LivingEntity lol
Β―_(γ)_/Β―
can anyone help me with something
i'm new to plugin dev and i'm trying stuff out but there's something i don't understand
What do you need help with
i'm trying to make a plugin where beds explode in the overworld aswell but for some reason the explosion i create doesn't deal any damage
this is the code
wait i can't send piczs
uuuh
hold on
`package sleaky.pluginTries;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class PluginTries extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onBedClick(PlayerBedEnterEvent event) {
Player player = event.getPlayer();
Block bed = event.getBed();
Location loc = bed.getLocation();
loc.getWorld().createExplosion(loc, 14, true, true);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}`
lol i'll just look at how vanilla does it rq
i don't get what is wrong
this method wasn't working because it was try with resource and it was closing on return
so result set was always empty
the flip side of implicit execution of code
i also wish ResultSet#next would throw an exception when the underlying statement has been closed
but glad it's fixed now
fwiw, those result sets aren't really meant to be passed around
Ideally you process the result and shove the output into some record or something
a resultset lives within the scope of a statement, and a statement lives within the scope of a connection
which is why it all should be within a twr without escaping it and passing stuff around or returning etc, a sql query should be pretty much self-contained :d
wasnt there an option to fly while being crouched?
now if you try to crouch while mid air, your nametag shifts down, hence why it loses opacity, but player pose doesnt update
That changed a little bit ago iirc
per the resultset specification, it should, if it really isn't that sounds like a bug in the driver you're using :d
https://docs.oracle.com/en/java/javase/25/docs/api/java.sql/java/sql/ResultSet.html
A ResultSet object is automatically closed when the Statement object that generated it is closed
https://docs.oracle.com/en/java/javase/25/docs/api/java.sql/java/sql/ResultSet.html#next()
Throws:
SQLException - if [β¦] this method is called on a closed result set
anyone can tell me how to add itemcomponents with spigt api ?
for example I want to add Glid component to chestplate?
Oh wtf thatβs sick
Hi ^^. I get a question about uploading my plugin as premium resource. It is called "XTroll". Like its name says, it contains a certain methods to make jokes to players.
But in the "creating resource" screen it says "Malicious plugins of any description, including "pranks", "testing", "troll", "joke", and plugins that crash the client will get your account banned."
My plugin applies to that warning?
Yes I think by definition that plugin is malicious
but I would reconsider whether you even want that plugin to be premium. Why would someone want to pay money for this?
People do pay money for this
It's pretty common
There's free ones too with tons of features
^ people pay for all kinds of things
Does one of the methods crash the client? If so, not allowed. If not, then subject to normal rules
Nop. Just allowed methods
i saw that kind of a plugin before somewhere
cool stuff
skeppy
duplication with primitive composable abstractions leads to cleaner code in the end. prove me wrong
nonsense
DRY Exists for a Reason
it doesnt mean that you shouldnt do composition
you're not WinRAR or 7zip, you're not compressing things. just because something can be written in less code doesnt mean that it shouldnt be just composed out of different elements and duplicated across codebase
its better to do duplication with composition than making various different helper function variants all across the codebase
if it cannot be composed, only then it means that DRY should be applied
fad of the day
its better to duplicate this all over the codebase:
logInfo(createEvent(id, EventStatus.SUCCESS, EventType.AUTHENTICATION, details, Instant.now())
than writing:
logSuccessAuthEvent(id, details)
sure it saves a lot of writing, but its brittle and just pollutes your codebase with combinatorial variants of specific helper functions. Not only the first version is easier to change in case of change of the requirements but also requires less code to maintain at the cost of duplication. You can also easily search for such calls inside codebase way easier than searching specific variants of the helper functions all over codebase
ideally you would mix it with SRP
logSuccessEvent(createSuccessEvent(id, EventType.AUTHENTICATION, details))
DRY principle should not stand for do not repeat yourself, but for do not repeat knowledge. In my example there's knowledge that success events log in info level, failure in error level, that means you use abstractions with compositions for knowledge not for making your code shorter.
clean, simple readable code > by the books
who cares about practices and paradigms and following rules
just write code that works ez
PaperMC is that way
this has to be rage bait
thats a bit unnecesserily rude
was that against the rules
its just a meme nothing serious
even as a paper dev, spigot was an essential part of the plugin ecosystem and i love it
ofc but you should know these things to know when & where they can be broken lol
is it web scale though?
still is used by majority of plugins
its trusted, suuper rare breaking changes
spigot api is still my go-to
^ I develop all my public plugins on the spigot api. The only plugins which use paper's api are my own server's since I'm forking paper so I can easily deal with their dumb choices
true
they're prioritising innovation over compat. things will break when updating, in spigot they nearly never do even a little. depending on the usecase and preference one may be better than the other (but im biased) as said, spigots absolutely great
Nah, they make some dumb choices sometimes
Also true
Forked /Paper directly too so I can just remove patches as needed π
Haven't made any serious changes yet though. However, I did add public API for LivingEntity#randomTeleport since that should honestly be in spigot's api π
i think i actually remember that conversation of yours haha, and yes, absolutely should :)
Yea, 2024 lol
I'd PR it myself, but spigot's JIRA sucks cause of the info I have to hand over
and paper is just slow as hell
how do i remember this and not even remember what i did 5min ago π
It'd be nice for magic & stuff though π
absolutely π₯²
doesnt the chorus fruit do basically the same? so its just three different implementations of nearly identical code?
Nope, that does something different lol
ah, well
Enderman & the cat calls LivingEntity#randomTeleport directly
Enderman for its teleportation & the cat when getting a gift
What
?
Cats teleport randomly to get a gift?
Yea, one moment lol
i wonder why the chorus fruit doesnt do the same tbh, maybe theres some random mechanic i dont remember but for me logically calling it on the player would make sense
I mean, it might. I'll double check lol
iirc there was a chorus class which called a different class entirely
.-.
private void giveMorningGift() {
RandomSource random = this.cat.getRandom();
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
mutableBlockPos.set(this.cat.isLeashed() ? this.cat.getLeashHolder().blockPosition() : this.cat.blockPosition());
this.cat
.randomTeleport(
mutableBlockPos.getX() + random.nextInt(11) - 5,
mutableBlockPos.getY() + random.nextInt(5) - 2,
mutableBlockPos.getZ() + random.nextInt(11) - 5,
false
);
mutableBlockPos.set(this.cat.blockPosition());
// Dropping gift code
}
So the cat randomly teleports and then coughs up a gift
seems like it, yea
Hi, Iβm young and Iβm making a Paper SMP server.
I want a plugin where players choose a potion effect, and when someone kills them, the killer steals their effect.
I canβt pay, but can someone help me or tell me how to make it?
Minecraft version: (1.21.11)
We can help you make it by pointing you in the right direction
but we won't make it for you
if that's what you want checkout the services forum
?services
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/
oh
Sidenote; This is the Spigot discord, not the Paper one. So future Paper questions should be asked in the paper discord
ok
I would actually, but I'm busy double checking stuff lol
net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect
Called on consume
interesting..
if (entity instanceof Fox) {
soundEvent = SoundEvents.FOX_TELEPORT;
soundSource = SoundSource.NEUTRAL;
} else {
soundEvent = SoundEvents.CHORUS_FRUIT_TELEPORT;
soundSource = SoundSource.PLAYERS;
}
No idea when the fox is ever used though π€
I guess if it consumes a chorus fruit?
when they pick a food item up and are hurt, they can eat it, if its a chorus theyll teleport afaik
ah
Yea lmao
You would need to add a scoreboard with the display slot being under name
Though I don't think that can display arbitrary text, at least not that I can recall
i think it can now with the score renderers or whatever they were called
basically each score entry now has a name, an integer value, and an arbitrary text component
so you can e.g. have "playername 20 β₯οΈ" in the scoreboard
iirc you can completely get rid of the number so it just shows the arbitrary text component
Ah, yeah, forgot about number formats
this might be a bit irrelevant but iirc there are a lot of plugins that utilize passenger text displays and just hide the vanilla nametag, not sure if its a useful solution for u spexx but ye
that's i think the "standard" way of doing it
it's not as clean as the score, but using the score runs into compatibility issues with e.g. mcmmo that display custom scoreboards to players
not on paper since they now use the "carry passengers" or whatever the teleport flag is called, by default
on spigot you can still get around it by doing protocol fucknuggetry so the entity only exists on the client
be me, just constantly teleport display entity above player every tick LOL
could maybe set up to only tp on move event but it works
i think that works if you also copy the velocity so the client predicts its movement the same as the player's
but iirc i told someone to do that for this earlier, and they said it still lags behind a bit
could be user error however
I thought entity teleportation with a passenger was actually fixed in vanilla recently too
i'm not sure, it could be, but iirc the server refusing to teleport players with passengers was originally a spigot thing
Oh, well, get fuk'd idiot
nah i just let it lag behind lol
it looks fine honestly
Weird
if anything, extrapolating player movement should make it overshoot its new pos at worst, rather than under
unless theyre not even getting the movement vector correctly lol
is there a way to check if a block like a sign is being powered by redstone as if it were a redstone lamp or sm
isBlockIndirectlyPowered
A non-"redstone interfacable block" cannot have powered tag because its not apart of the data for that block. However isBlockIndirectlyPowered might return something?
i see, thanks
hey is paper remapped can cause plugin error?
maybe
Hi, Iβm trying to cancel all interactions with a specific item.
However, if the item is an experience bottle and I right-click in the air, my code doesnβt cancel it. What should I do?
@EventHandler
public void onCrystalItemInteract(PlayerInteractEvent event) {
if (!event.hasItem()) return;
ItemStack item = event.getItem();
if(item == null) return;
if(!Internals.nbt().has(item, "CRYSTAL_ITEM", PersistentDataType.STRING)) return;
event.setCancelled(true);
}
does it get called?