#help-development

1 messages Β· Page 1296 of 1

mortal hare
#

well i need to thank that guy for my whole career and uni degree

#

that i built out of anger to his ego πŸ˜„

bold nebula
#

prob in 2020 u couldnt do much with skript

mortal hare
#

you could, i've use skReflect or smth like that

#

where you can create custom skript expressions with bukkit api and java classes

bold nebula
#

potion?

lilac dagger
#

negative speed maybe

#

it changes the camera fov

bold nebula
#

well they use that i think but its not only this

lilac dagger
#

it does look like it

bold nebula
#

but the player head is moving

#

so its not that

lilac dagger
#

hmm

bold nebula
#

.

lilac dagger
#

maybe it's a few degress movement

smoky anchor
#

That mod did not log every packet

bold nebula
#

why its so hard

smoky anchor
#

go to config and disable ignore player move I think

bold nebula
#

alr

lilac dagger
#

few degrees movement

#

rather say minutes

warped cradle
#

How do people make queue systems

#

like what if i wanna make a minigame

#

set spwans

#

and it makes a queue

#

u join and then it tp's u to a new world

worldly ingot
#

That depends on how you want a queue system to work. If you want to queue in lobby, you can communicate with a Redis server and store a list of players in queue. Once you reach a certain size, spin up a server and throw them into a game. Or if you're doing a single-server setup, you can do the same thing but you can just do everything in-memory instead of in Redis (cause it's all on one server anyways) then throw them into a world.

#

Alternatively, if you want to queue in game, put them into the world immediately and wait until the world has x amount of players

lilac dagger
#

a waiting lobby phase/state is all you need

grand flint
#

nah id trust choco with all my servers

#

this guy made 85% of hypixel by himself

lean pumice
#

heyyy, the getKeys is a thing that is cached or it load all the keys at the moment?

#

i use nbt-api

slender elbow
#

given that itemstacks no longer are stored as raw nbt anymore, it will get serialized to nbt each time

#

also why are you casting to HashSet lol

#

just use the returned Set?

mortal hare
#

?paste

undone axleBOT
mortal hare
#

how do you call this design pattern where you control the instantiation of certain types of objects in centralized way (just like value objects), but you implement interfaces for them only to be used from outside project's scope (lets say public api)?

#

and in implementation you use the concrete classes for safety against leaky third party implementations and to centralize certain logic with smart constructors

acoustic galleon
#

How can I have a Java project where one module is Java 21 and the other is Java 8? Is it possible?

grand flint
#

what do you need it for

acoustic galleon
#

multi version plugin

mortal hare
grand flint
#

yeah gradle would be to go for anything like that

acoustic galleon
mortal hare
#

you can have it technically by shading both subprojects into one

#

but im not sure how to do this

#

since JRE is backwards compatible with previous bytecode instructions compiled in older JRE's

acoustic galleon
#

if i compile my plugin on java 21 ill cant run on java 8 server

mortal hare
#

iirc

eternal oxide
#

?multimodule

#

if I remember there is a ? for it

#

?multiversion

grand flint
#

?1.8

undone axleBOT
acoustic galleon
#

im talking about java 8

#

not 1.8

grand flint
#

aint java 8 for 1.8 πŸ™

acoustic galleon
#

and other versions?

#

like 1.9

#

1.10

#

1.11

mortal hare
acoustic galleon
#

1.12

#

1.13

#

1.14

#

1.15

#

1.16

#

and yes

#

finish here

mortal hare
#

1.16 uses 17

acoustic galleon
#

i can use java8 plugin on 1.16 server

eternal oxide
#

possibly

acoustic galleon
eternal oxide
#

yes

acoustic galleon
#

this is maven 😦

eternal oxide
#

maven is the chosen build system for Spigot

acoustic galleon
#

im doing the same thing on gradle

#

but no working

#

how send screenshots here

eternal oxide
#

what EXACTLY are you trying to do? A simple java 8 plugin will run fine under java 21

grand flint
eternal oxide
#

?img

undone axleBOT
#

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

acoustic galleon
eternal oxide
#

you can not build against bukkit 1.17 using java 8

acoustic galleon
#

i need have my plugin running on java 8

grand flint
#

no he is saying

#

u cant use the 1.17 bukkit api

#

with java 8

#

u need to use 1.16 or any other supported api

acoustic galleon
#

then how multi version plugins works

eternal oxide
#

yes, but you can not build in a single jar against all Spigot API versions without using modules

acoustic galleon
eternal oxide
#

if you are building under java 8 and want to to run on a spigot 1.8 server you can only build against the spigot 1.8 API

acoustic galleon
#

ik

#

and im already doing this

#

the problem is java version on compilling my project bro

#

not this

eternal oxide
#

java version and spigot versions are different

acoustic galleon
#

BRO IK

eternal oxide
#

you can NOT reference 1.17 Spigot in a 1.8 plugin

acoustic galleon
#

i know lol

#

and im not doing this

#

my plugin is 1.8-1.21

#

and im already using submodules

eternal oxide
#

your build error says you are

acoustic galleon
#

i just use for example 1.15 spigot api on 1.15 server version

acoustic galleon
#

ur reading wrong

eternal oxide
acoustic galleon
#

my build error is saying i cant compile 1.17 api bc it is modern java

eternal oxide
#

referencing 1.17 bukkit using java 8

acoustic galleon
#

exactly

#

how plugins are 1.8-1.21

#

and uspports java 8

#

?

eternal oxide
#

I just said you can't do that

acoustic galleon
#

u can

#

LPX are 1.8-1.21

#

and supports java 8

#

for example

#

TAB is 1.8-1.21

#

and supports java 8

eternal oxide
#

thats not what I'm saying

acoustic galleon
#

then what are u sayin

eternal oxide
#

they use modules or reflection to support other version of the spigot API

grand flint
acoustic galleon
#

and isnt working

eternal oxide
#

YOU are using java 8 for bukkit 1.17, which you can not do

acoustic galleon
#

but im using modules

eternal oxide
#

incorrectly

acoustic galleon
#

why incorrect?

eternal oxide
#

your error tells you that you are doing it incorrectly

#

I use mavan so can;t tell you what is wrong with yoru gradle, but it is wrong

acoustic galleon
#

im using modules

#

but I don't understand how a . jar will have classes compiled in Java 8 and other classes in Java 21

#

this is possible?

eternal oxide
#

yes

#

each module builds itself, then shadowJar puts them all together

acoustic galleon
#

u know what should i put here?

eternal oxide
#

I don't gradle sorry

kind hatch
acoustic galleon
kind hatch
#

I did a quick search for gradle and it seems like you'd want to use compatibility flags in your build.gradle file.

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

This is similar to how maven does it.

acoustic galleon
#

they didnt put anything

#

and they are 1.8-1.21 plugin

#

and running on java 8

#

Could not determine the dependencies of task ':bukkit:shadowJar'.

Could not resolve all dependencies for configuration ':bukkit:runtimeClasspath'.
Could not resolve project :bukkit:v1_17_R1.
Required by:
project :bukkit
Dependency resolution is looking for a library compatible with JVM runtime version 8, but 'project :bukkit:v1_17_R1' is only compatible with JVM runtime version 22 or newer.

#

I put what you said in the main build.gradle.kts in the bukkit module and then in the bukkit submodule which would be versions 1.8, 1.9 etc. I put java 22 in the build.gradle.kts of the minecraft version 1.17 and this happens

quasi gulch
#

Is the a way to know if the PlayerInteractEvent results in opening a block / interacting with the block or just interaction with the item in hand while looking at a block?

bold nebula
#

Maybe they are editing the packets sent by the server?

lilac dagger
#

did you try editing the pitch by a few minutes?

#

just the pitch

bold nebula
lilac dagger
#

change it in craft player

bold nebula
#

It's the same thing

lilac dagger
#

it's not

#

server knows of the change

#

it shouldn't jitter

bold nebula
grand flint
#

just try to use the resourcepack that the server ur on uses

#

with the same packets

#

its probs shaders to get it that smooth

#

i dont think u can make it without jittering fully server sided

bold nebula
#

player head

#

^

grand flint
#

no it probs moves it server sided

#

but shaders smoothen it

smoky anchor
#

IF it were shaders, I'd expect them to "pass" a variable to the shader to enable/disable this in some way
Should be really easy to check if they are using shaders tho, extract the RP

smoky anchor
#

ye, just some form of teleportation

bold nebula
#

but which one?

smoky anchor
#

instead of some api method, just do /tp :D

#

again, the mod does not log every packet, only some of them

bold nebula
smoky anchor
#

relative and set is the same ?

bold nebula
#

i tried everything i swear

#

relative flags

#

yes

smoky anchor
#

what server is it

bold nebula
smoky anchor
#

gimme a bit

smoky anchor
#

ok, I created logs that should tell you what they're doing
logs that start with "SC: " are I think sent from client
Idunno, I just used what that packet logger used but instead of custom formatting per packet, I just used reflection
All packets here were logged only when I held RMB - I was shooting

#

Anyways, these ones may be the info you want

#

how do you send this packet via api/skript ? I have no clue

#

@bold nebula

bold nebula
#

i will figure it out

#

thanks for your time

smoky anchor
#

Oh and if you do, do tag me
I am curious lul

bold nebula
#

alr

potent laurel
#

hi im neww

worthy yarrow
#

Hello neww I'm NuclearKat

grand flint
#

hi neww

#

u said hi in every channel apart from the channel u should say hi in neww

potent laurel
#

lol mb

#

so like im bored and stuff

thorn isle
#

uh huh

potent laurel
#

uh huh indeed

mortal vortex
potent laurel
#

bruh

#

so like anybody got problems wit their minecraft servers cuz i can help

worthy yarrow
#

I have so many issues with my server

mortal vortex
#

I have issues with life, can you help?

#

Mainly tummy aches

grand flint
#

i need someone to run it

grand flint
potent laurel
#

u need someone to run ur server?

grand flint
#

ye

potent laurel
#

what type of server?

grand flint
#

survival

potent laurel
#

how many people?

#

(usually online)

grand flint
#

15-20 usually

#

but like u gotta set it up πŸ™

potent laurel
#

ok are you looking for a basic survival server on java ?

grand flint
#

nah

#

its w custom items

potent laurel
#

so like a mod pack?

grand flint
#

just dm me

potent laurel
#

ok fase just gimme a minute

grand flint
#

im not interested thank youi

potent laurel
#

bruh

worthy yarrow
thorn isle
#

i'm interested in free money

potent laurel
#

same

grand flint
#

im interested in

#

idk

potent laurel
#

anyways i got a plane ride so bye

worthy yarrow
#

So in CraftItemEvent, when you .setCancelled(true) or .setResult(Result.DENY), the outcome is the same correct? The cancellation of the event that is

placid estuary
#

how would i go about creating custom advancements?

placid estuary
#

thanks

potent crescent
#

I'm bored and want to create a new plugin, but I have no ideas.

#

Does anyone have an idea I can implement?

young knoll
#

Make the create mod into a plugin

buoyant viper
worldly ingot
potent crescent
buoyant viper
#

with configurable terrain damage or purely cosmetic explosion effect

young knoll
#

Why would I send a request by email

potent crescent
potent crescent
buoyant viper
#

if u eat a cookie, u explode and die instantly

potent crescent
#

just?

buoyant viper
#

and u can configure whether or not this explosion is only cosmetic (just particle effects), or an explosion that also damages terrain

young knoll
#

Instructions unclear

buoyant viper
#

i was getting there

young knoll
#

Ate explosion, turned into a cookie

buoyant viper
#

based on an old recommendation someone had told me when i asked a similar question bc i was out of ideas lol

#

it had something to do with cookies and dying

potent crescent
#

wich version?

buoyant viper
#

like which mc version?

potent crescent
#

ye

buoyant viper
#

events for item consume are like as old as time in spigot so it shouldnt really matter

#

same for explosions i think

#

ideally latest stable 😎

potent crescent
#

test the plugin

#

i tested the plugin in 1.12.2 its work fine i think it shouklld be work to laster version

#

well give me 5min i found a proplem

dry forum
#
    @EventHandler
    public void onBlockPlace(BlockPlaceEvent event) {```

how can i get the itemstack of what was placed
dry forum
#

oh i thought that was for after they placed

potent crescent
mortal vortex
#

idek if SlimeFun but that with custom models sounds like bliss

torn shuttle
#

man oh man I wish I was just working on my own game

#

I am getting mighty tired of this whole juggling 5 different projects and dealing with multiversion nms bs

daring ice
#

can anyone help with an issue i have for a plugin/project i am making?

winter jungle
#

Someone here has a method to center a gui title?

sonic geyser
#

can anyone help me with particle making for my mc server

    trigger:
        set {_gold} to amount of gold ingot in player's inventory
        if {_gold} <= 0:
            send "&cYou have no gold ingots to convert."
            stop
        remove {_gold} of gold ingot from player's inventory
        add {_gold} to {goldcoins::%uuid of player%}
        send "&aConverted %{_gold}% gold ingots into coins!"

or can anyone add a /ah and /ah sell (amount) to this

sonic geyser
mortal vortex
#

rip bro

#

I cant lie, I dont really know Skript. but i think they have a dedicated server?

mortal vortex
sonic geyser
mortal vortex
#

What do you mean?

#

specifically what is "one"? A plugin?

sonic geyser
#

TheGoldEconomy

sonic geyser
mortal vortex
#

i dont understand what ur saying

#

im asking, if you've attempted to make this plugin in java directly

thorn isle
#

if you can learn skript you can learn java

#

what ends up stopping many prospective programmers to ever come out of the skript bubble is that they have "a java at home" in the form of skript, so they're far less motivated to actually try and learn anything new

#

it is for this reason that i sort of frown upon skript

#

even if it is in principle a good gateway drug of sorts to programming

nova notch
#

skript is honestly harder to learn than java with the amount of random bullshit

mellow edge
#

Hello, I wonder why there is no BlockState#isLiquid method?

#

I need to check if a block was liquid on BlockPlaceEvent.

eternal oxide
#

liquid is derived from a bucket empty event

thorn isle
#

i think he wants to know whether the block state replaced by the placed block was liquid

pseudo hazel
#

like placing a block in the water

thorn isle
#

you should be able to get the type of the blockstate and then call isLiquid on it or something

eternal oxide
#

there is no blockplaceevent for liquid though

thorn isle
#

the placed block isn't a liquid

#

the replaced block is a liquid

#

e.g. you place a dirt block in a lake

#

or that's what i assume what he wants, dunno

eternal oxide
#

ah he's wantign to test the original block state

thorn isle
#

it's no wonder nobody maintains nocheatplus

#

the codebase is unmaintainable

mellow edge
thorn isle
#

a million hardcoded block collision shapes and all nms access is done through obfuscated reflection

#

you'll also want to check for bubble column

#

that is distinct from water

mellow edge
#

true

eternal oxide
#

I guess you could just check if it was AIR. if not it was a liquid.

#

I don;t know of any other blocks that could exist there in a place event. Possibly crops?

thorn isle
#

anything that instabreaks, like tallgrass, maybe

pseudo hazel
#

nom solid blocks

potent crescent
grand flint
potent crescent
#

alr thankss

#

i cant change the name right ?

grand flint
#

u can

#

its on that same section

#

update resource or something

#

not post upsare

#

edit resource

potent crescent
#

theres no cahnge name

#

change

#

ahhhhh

#

ok ok

#

thanks

thorn isle
#

did you set a discord invite as the source code link

potent crescent
#

no lol

chrome beacon
#

you did ...

mortal vortex
grand flint
#

LMAO

#

poor dude when he accidentally writes a 4000 line mistake

cinder abyss
#

Hello, what's the best way to compare mc versions ?

chrome beacon
#

What do you want to compare

cinder abyss
#

I want to reimplement EntityRemoveEvent for before 1.20.4, and I think the best way is extending the base EntityRemoveEvent for calling it in 1.20.4+ or in the other case, making a custom EntityRemoveEvent.

thorn isle
#

if you want the code to run on servers running a version that don't have the entity remove event, you can't extend the entity remove event

#

because that class won't exist at runtime and class linking will fail for any class trying to extend/implement a class that doesn't exist

cinder abyss
#

I'll try to see the best way of doing it, for now the thing I would need to is comparing versions

#

And I've got some problems with my old system, maybe something also supporting snapshots could be useful, for weird server implementations

eternal oxide
#

no clue what you are saying but checking if a class exists is simple. no need for a version check

thorn isle
#

if all you need to do is check whether the event class exists, yes, that is the ideal approach

cinder abyss
#

oh yeah forgot about Class#forName 😭

#

my bad

#

Thanks for remembering me how to code in java x)

potent crescent
#

ohhh i did πŸ˜‚

#

@thorn isle i was want do the link in support link but by mistake i pot it there

#

lol

#

i will never add more src πŸ˜‚ I will learn on GitHub. Then I will publish src

potent crescent
pure dagger
#
@EventHandler(priority = EventPriority.HIGHEST)

i dont wanna do anything if the event is cancelled. do i have to check if event.isCancelled() and return.. or do cancelled events not get passed?

thorn isle
#

see the other parameter for the annotation, ignoreCancelled

#

the default value means that your listener will receive cancelled events

#

the non-default value will cause the cancelled events to be ignored by your listener

pure dagger
#

okay thanks. so i have 1 listener which checks for EntityDamageEntityEvent, and if they're 2 players, it gives them antilogout for 30seconds. and in another plugin i sometimes cancell the event if 2 players are from the same clan
so what values do i set in these plugins?

should i do: antilogout - highest
clans - lowers ?

#

or like maybe antilogout - highest
clans - normal
like how do i pick

thorn isle
#

MONITOR fires last and LOWEST fires first

#

the higher the priority the later it fires

pure dagger
#

yeah but there are values between

#

so which one...

thorn isle
#

well

#

the higher the priority

#

the later it fires

#

so to fire after another listener, your priority needs to be higher than that other listener's priority

#

lowest -> low -> normal -> high -> highest -> monitor

eternal oxide
#

If you want a plugin to cancel the event and prevent the second plugin seeing it, you need to cancel at a low priority

pure dagger
#

ok i just cared about other plugins too

thorn isle
#

impossible to know without knowing what those other plugins listen at

pure dagger
#

i guess ill do highest and lowest

thorn isle
#

the priority system is kind of half baked

pure dagger
thorn isle
#

generally speaking i guess regular listeners fire at normal, protection plugins usually at low

eternal oxide
#

probably a good idea to avoind lowest and highest as those are mostly used by service plugins like permissions

thorn isle
#

myeah

pure dagger
#

yeeea

#

thats why im asking

thorn isle
#

monitor is for when you don't change anything about the event

pure dagger
#

so high and low, or hight and normal

thorn isle
#

so if your listener is read-only, use monitor

pure dagger
#

actually

#

idont change event in antilogout

thorn isle
#

what does antilogout do in this context

#

if it fucks with the player's inventory or something, that kind of counts as changing the event

pure dagger
#
@EventHandler
    public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
        if (!(event.getEntity() instanceof Player victim)) return;
        if (!(event.getDamager() instanceof Player damager)) return;

        antiLogout.addAntiLogout(victim);
        antiLogout.addAntiLogout(damager);
    }
#

no

#

its just

#

saving the player to a map

#

and displaying text

#

to them

thorn isle
#

yeah monitor is fine

pure dagger
#

thanks

#

so i guess ill keep the clans

#

one

#

at.... low

thorn isle
#

what does that do

pure dagger
#

just cancel the event if players are in the same clan

thorn isle
#

that's sort of a protection plugin, i'd say low is about right for that

#

doesn't really matter whether it's worldguard or clans or whatever other no-pvp plugin that ends up cancelling it

pure dagger
#

okayy thannks

thorn isle
#

i'd expect stuff like custom damage listeners to run at normal or maybe high, so you want to fire before those to make sure they see you cancelled the event

pseudo hazel
#

low priority gets the event last right?

pure dagger
#

no

#

first

#

highest ss later

mellow edge
#

yeah this is messed up, in APIs like NeoForge I think LOW is the last, however in spigot LOW means the higher priorty

pure dagger
#

cause it can override so its higher priority

worldly ingot
#

LOWEST, then LOW, then NORMAL, then HIGH, then HIGHEST, then MONITOR

thorn isle
#

it does make sense yeah, think about it as who gets the "last word" on what happens

worldly ingot
#

Lowest first first because higher priority events can alter the state of the event

thorn isle
#

the later you fire the more decisions you can override

pure dagger
pseudo hazel
#

ah oof I reverse psycho'd myself

thorn isle
#

now what actually makes no sense and is objectively shit is the naming of ignoreCancelled

worldly ingot
#

If I set the join message to "blah" in lowest, then I, as a higher priority listener, can overwrite "blah" to then be "hello!"

#

You can blame md_5 for that one Kappa

pseudo hazel
#

I thought highest prio meant first but lowest actual control over the outcome

pure dagger
mellow edge
pure dagger
#

coool

#

wasnt the priority thing just a number before?

#

not an enu

#

m

worldly ingot
thorn isle
#

should've been a double 🀑

worldly ingot
#

For that granular control

thorn isle
#

it's kind of clownish but it would mean that you can squeeze in between whichever pair of listeners you have to

pseudo hazel
#

just listen to the event on all priorities and check if it changes after each one

thorn isle
#

which is sometimes an issue

worldly ingot
#

Or you can be a menace and schedule your events at priorioty 1.00000000000001

thorn isle
#

well, user error

#

ideally i suppose we would use named eventhandler registrations, sort of like the netty pipeline, and make in-code declarations about what we want to run before/after; with detection for circular dependencies

#

but that's borderline impossible with annotations

pure dagger
worldly ingot
#

That would have been my suggestion if I were to rewrite it :p I think Fabric does this with event phases or something

thorn isle
#

i'm sure we could jerryrig that double priority into it while maintaining legacy priority compat

mellow edge
#

doesn't fabric provide callbacks

pseudo hazel
#

yeah

mellow edge
#

ohh maybe you meant they have multiple stages for the same event

pseudo hazel
#

but those callbacks can be called in phases or whatever

#

the fact that its callbacks doesnt change anything about the priority system

pure dagger
#

so wasn't it a number instead of enum before?

worldly ingot
#

In Bukkit? I don't believe so

#

It's been an enum for as long as I can remember

pure dagger
#

oki

acoustic galleon
#

Does v1_19_R3 depend on the version? If it is 1.19.1 1.19.2 etc? Or is v1_19_R3 for any version of 1.19?

mellow edge
#

it is for a specific release of 1.19

worldly ingot
#

Server revisions are incremented when there are significant internal server changes

#

It's a reminder to developers to update their references to server internals between versions. Their bumping criteria is largely arbitrary though

pure dagger
#

new to using this thing... should i just upload it through the website or somehow else, and how to not add the target dir, cause someone 8 months ago told me not to

oblique furnace
#

How do I make my code a .jar?

gray saddle
#

is there an event for when an entity collides into a block?

pseudo hazel
pure dagger
gray saddle
#

for example a log

pure dagger
#

i dont think thats an event

#

but

#

i dont know

pseudo hazel
#

iirc there is only playerMoveEvent for players

gray saddle
#

hmm ok

pseudo hazel
#

which just fires whenever the player moves

#

but

oblique furnace
pseudo hazel
#

?xy

undone axleBOT
pseudo hazel
#

under here

oblique furnace
#

No, the jar fileπŸ˜…

gray saddle
pseudo hazel
#

oh

gray saddle
#

but ill try sumthin real quick

pseudo hazel
#

it will be in build/libs or something by default

oblique furnace
#

ok, thanks

pseudo hazel
#

<folder with the build.gradle file>/build/libs

wooden bay
#

Add a .gitignore to ignore the target folder
You can use a template for it

wooden bay
pure dagger
#

thanks

cinder abyss
#

Hello, how can I store an inventory in a PDC ?

#

all the content and datas

summer scroll
cinder abyss
#

thanks !

acoustic galleon
#

what is paperweight.paperDevBundle(version) on gradle

chrome beacon
#

That's the paper dev bundle version

cinder abyss
#

(AHHHH SOMEONE SAID PAPER πŸ—£οΈ )

chrome beacon
eternal oxide
#

I'm here with my pitchfork

chrome beacon
#

and yeah

#

?whereami

acoustic galleon
thorn isle
#

Read the userdev guide or ask on their discord

acoustic galleon
#

im muted there

grand flint
#

W

acoustic galleon
#

bc i was doign 1.17 plugin

chrome beacon
#

doubt that was the reason

#

ah you kept asking even after being told it's not supported

acoustic galleon
#

ye

thorn isle
#

make a discord alt and dodge the ban, that's what the rest of us (probably like 20% of paper userbase) do

#

or like you could try appealing the ban but glhf

grand flint
#

discord bans are ip bans

#

(from experience) sad

acoustic galleon
#

sorry
give me 1 day just pls

#

i alr tried

#

xd

#

im muted for 7 days

#

someone want ask for me there? xd

thorn isle
# grand flint discord bans are ip bans

yeah you'll have to either get a dynamic ip from your isp, or use a vpn; and sooner or later you'll have to start using burner SMS services, i recommend onlinesim

grand flint
#

thanks

#

ran out of mine

nova notch
#

this might be controversial but just don't get banned

#

ur banned for a reason

acoustic galleon
#

You've been banned.
Reason
During a timeout for repeated outdated support requests, user continued to hassle staff in DM for support with outdated versions
Punishment: 687e97cd8aa5eb733c9ba76c

#

now im banned

#

magiciana
[DNZN]
β€” 16:50
sorry
give me 1 day just pls
magiciana
[DNZN]
β€” 20:33
i nheed helppp
Imagem
i alr added paperweight

#

i send this to a staff xd

nova notch
#

well that's your problem now deal with it yourself

tropic knoll
#

Please do not bother other Discords with complaints about our bans. We have an appeal system. Also, please stop DMing me for support we already said wouldn't be provided. 😞

acoustic galleon
#

where can i do appeal'

thorn isle
#

this is the only reason why paper doesn't have a 100% market share yet

#

it's only 80% because 20% of the bukkit ecosystem is banned from their discord

fickle mantle
#

how do I open a working anvil inventory?

cinder abyss
#

Hello, how can I simulate correct lightning (like blocks) for ItemDisplay when there is a light source other than the sky ?
The ItemDisplay is the darkest bone block, and the real bone block is the other one

The second picture is my light reproduction without the light source, and it's pretty accurate

Here's how I calculate the light :```java
// Precise lightning: check the light level of the block in all cartesian directions
byte maxLight = 0;
for (BlockFace blockFace : BlockFace.values()) {
if(!blockFace.isCartesian()) {
continue;
}

byte actualLight = block.getRelative(blockFace).getLightFromSky();
if(actualLight > maxLight) {
    maxLight = actualLight;
}

}
this.spawnedDisplay.setBrightness(new Display.Brightness(block.getLightFromBlocks(), maxLight));```
Also, I think I don't really spot the difference between blockLight and skyLight for the ItemDisplay Brightness, if someone could explain it, I would be very grateful. Thanks in advance.

thorn isle
#

set sky light to the actual light from the sky and block light to the actual light from blocks

#

they both are used for the color blending operation

#

beyond that, the difference you see is just ambient occlusion being absent for the display entity

#

or smooth lighting

cinder abyss
#

do you know how I can simulate actual vanilla client lightning ?

thorn isle
#

it's a bit difficult and somewhat impossible because as said there's no smooth lighting or ambient occlusion for display entities, and vanilla lighting is per block face while for display entities it controls the light for the entire model

#

is there a solid block in the space the display entity is in?

thorn isle
#

that means the light from blocks at that location is zero

#

shove the block light get into that cartesian direction loop

#

and similarly take the maximum

cinder abyss
thorn isle
#

if you want more accurate per-face lighting, spawn 6 block displays, one for each face, and use the scale transform to flatten them so they're 2d planes; and then do the light get's per-face and apply them to that face only

thorn isle
#

because block is a solid block

#

look at the adjacent blocks

#

just as you do with skylight

cinder abyss
#

I see, thanks

cinder abyss
left jay
#

can someone explain how my updateusableweaponname is hitting its null error when an item should def have it's key?

cinder abyss
#

thanks for your help !

cinder abyss
#

it's more accurate

fickle mantle
#

how do I open a working anvil inventory?

slender elbow
#

MenuType.ANVIL.idkidk(player)

agile river
#

Hi! I'm working on a Minecraft plugin where I want to display a custom model on an armor stand's head using CustomModelData.
This is my gold_ingot.json file in my resource pack:

{
  "parent": "item/generated",
  "textures": {
    "layer0": "item/gold_ingot"
  },
  "overrides": [
    { "predicate": { "custom_model_data": 1 }, "model": "item/gold_bar" },
    { "predicate": { "custom_model_data": 2 }, "model": "item/vault1" },
    { "predicate": { "custom_model_data": 3 }, "model": "item/vault2" },
    { "predicate": { "custom_model_data": 4 }, "model": "item/vault3" },
    { "predicate": { "custom_model_data": 5 }, "model": "item/vault4" }
  ]
}```
In my plugin, I'm creating an ItemStack like this:

```java
ItemStack item = new ItemStack(Material.GOLD_INGOT);
ItemMeta meta = item.getItemMeta();
meta.setCustomModelData(2);
item.setItemMeta(meta);

armorStand.setHelmet(item);```

But when I run the plugin, the armor stand just shows the regular gold ingot β€” not the custom model from vault1.json.

What am I doing wrong?
How do I properly display a custom item model (from my resource pack) as the helmet on an armor stand?
eternal night
#

what version?

agile river
#

1.21+

eternal night
#

specific version pls

agile river
#

1.21.4

thorn isle
#

this changed considerably in 1.21.4

eternal night
#

Yea

grand flint
#

this isnt 2018

#
  1. custom model datas arent numbers anymore
#

u provide the model id

#

like mymodel:fire_sword

#
  1. use display entities
agile river
#

Oh okay, I'm still pretty new to all this so I was just experimenting with armor stands.
Right now, I have a custom model on an item, and I'm rotating the armor stand's head by 90 degrees when you click it kind of like a simple animation.
But now I understand that in 1.21.4, you don't use numeric custom_model_data anymore, and instead use model names like mymodel:fire_sword. So I’ll need to switch to that format.
Do display entities also support this kind of setup? Like, can you rotate them the same way you would rotate an armor stand’s head? Just wondering if they work the same for animation-like effects.

thorn isle
#

they use a slightly different notation for the rotation

#

armor stands use euler angles

#

display entities use transformation matrices, which are more powerful (they can scale and shear in addition to just rotate) but a bit more complicated to deal with

#

you can provide the rotations as quaternions, for which fairly well-defined utilities exist to translate between euler angle, axis angle, and quaternion

fickle mantle
agile river
#

Okay tysm, but is it even possible to get custom model data onto an armor stand using the new method? And if so, how would you do that, or is it only possible with display entities?

thorn isle
#

yes

#

there are text displays, item displays, and block displays

#

for custom models you want the item display

#

which is functionally identical to an armor stand wearing an item on its head, but without the hitbox and other undesired things that an armorstand comes with

#

as in using the api you just shove an itemstack on it, same stack as you would equip on the armor stand

#

as for what metadata you put in the itemstack and how you do it and how you make that work with your resourcepack depends a bit on whether you're using paper or spigot

agile river
#

spigot

thorn isle
#

for the resourcepack side, the format is quite different in .4 than it was before, i'd recommend reading the minecraftwiki to get a grasp of what the data looks like now, and then maybe ask in some vanilla/datapack discord about how to write a resourcepack for that version, and then ask here or at paper how you'd get the data you need to get on the item

agile river
#

Okay, it seems complicated but I will do my best, thank you very much. ❀️

tacit coral
#

Anyone know how to create entity metadata packets in 1.21.5? Getting an error with this

#
            this.entityMetadata = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_METADATA);
            this.entityMetadata.getIntegers().write(0, target.getEntityId());

            WrappedDataWatcher watcher = new WrappedDataWatcher();
            WrappedDataWatcher.WrappedDataWatcherObject wObj = new WrappedDataWatcher.WrappedDataWatcherObject(17, WrappedDataWatcher.Registry.get((Type) Byte.class));
            watcher.setObject(wObj, (byte)127);
            this.entityMetadata.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects()); ```
tacit coral
#

I read you have to use the metadata packet to get the skin layer visibile

echo basalt
#

.

tacit coral
echo basalt
#

I mean a list of data values

#

they're different

tacit coral
#

ok so this would be valid for 1.21?

echo basalt
#

Yup

pure dagger
#

ok so i went to the "git" tab in intellij, i clicked some 'create local repository' thing, and now its all red and i dont really want to know how that works, just how to cancel that for now lol 😭

echo basalt
#

delete .git folder

pure dagger
#

where is that?

#

oh i found that

#

now do i ignore this

#

before, there was 'version control' now its written 'git'... why??

buoyant viper
#

intellij is anti-mercurial /j

chrome beacon
#

I just have all the version control plugins disabled

#

I manage git via cmd when I need it

pine forge
#

I am getting these errors from my plugin whenever the server closes and i want to know if anybody knows of a way to fix them

I am running a websocket connection with socket.io and disconnecting from it in onDisable

pure dagger
buoyant viper
#

mercurial is another form of VCS

#

(i think)

sly topaz
#

also, obligatory

#

?whereami

pure dagger
sly topaz
#

their git integration is definitely better than the mercurial one, but the mercurial integration is fine on its own

fresh timber
#

How can I set the scale of an nms text display -- I am taking a bukkit text display entity and creating an nms copy of it with different text so I can refresh entity data with that nms display and make it show different text :)

#

like per player text practically using packets but I just need to be able to set the scale of the nms display

young knoll
#

It’s part of the transformation matrix

fresh timber
#

how can I use that?

chrome beacon
#

with the set transformation method

sly topaz
#

display entities are dirt cheap so having many of them doesn't really affect anything, and it is easier to manage

fresh timber
#

I don't like hiding a ton of entities

sly topaz
fresh timber
#

it gets annoying

sly topaz
#
TextDisplay display = someWorld.spawn(player.getLocation(), TextDisplay.class, display -> {
    display.setVisibleByDefault(false);
    // configure display
}
player.showEntity(MyPlugin.instance(), display);
#

just like that, you have per-player displays

#

but if you insist on doing it the way you're doing right now, make sure to listen to the entity metadata packet and apply your changes there, otherwise they're going to get reverted when if they leave the chunk (aka untrack the entity)

fresh timber
#

but then I gotta run like a billion bukkit runnables for each one which seems hard to manage tbh

fresh timber
sly topaz
sly topaz
fresh timber
#

I update them

#

regularly

sly topaz
#

you mean like, in order to know which display to set when setting the text/transformation?

#

you can do it in a single runnable, you'd just have to have a Map<UUID, UUID>

fresh timber
#

cus there's like a hundred displays per player

sly topaz
#

sure, that works too, or you could use Guava's Multimap as well

#

I would go one step further and just make a HologramInfo record which holds the text display's uuid (or a WeakReference<TextDisplay>, either way works probably) and other information like update time

fresh timber
#

well let's see how hard it is to reload after this, rn it takes about 2 ms to reload displays

sly topaz
fresh timber
cinder abyss
sly topaz
fresh timber
#

like say I wanted to update the player's text display that is for their money named "money" I could call updatedisplay(map.get(playeruuid).get("money"))

#

updatedisplay will, well, update the display

sly topaz
#

I don't know which is the better option tbh, it may not matter either way

#

I was going to say that you could just iterate through the values but either way works

#

ah, but don't put the entity on the map, if you're going to do that then use a WeakHashMap or just use the UUID instead

fresh timber
#

why?

young knoll
#

Memory leaks

#

Keeping the entity refrence around after the entity unloads

fresh timber
#

ok well ig I'll just call getentity then on the uuid

sly topaz
#

it shouldn't happen if you make sure to remove the entity whenever it is dead and/or invalidated, but most people don't bother with that

fresh timber
#

I mean yeah I'll just .remove() it when the player leaves or server shuts down

sly topaz
#

I guess since these are text displays, it should be fine like that

#

I am now curious which collection would have better performance, a nested map or a guava Table in this scenario

#

the Table has better semantics for this kind of thing but I don't know if it'd beat the nested map performance wise. Not that it would matter that much for this scenario where there is just about a hundred elements per column

tacit coral
fresh timber
#

does PluginDisableEvent run for your own plugin in your plugin?

sly topaz
fresh timber
#

Yes, it does btw

    @EventHandler
    public void onStop(PluginDisableEvent event) {

        Bukkit.broadcast(mm("<red>PLUGIN SHUTDOWN EVENT EXECUTED"));
    }

In onEnable()

        Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
            getServer().getPluginManager().disablePlugin(this);
        }, 20 * 10);
sly topaz
#

honestly I forgot that event exists lol

fresh timber
#

I use it in my classes cus its so annoying to cram it all into main class onDisable

#

makes a giant main class

fresh timber
#

almost to the microsecond

sly topaz
fresh timber
#

like to reload all of the players text displays it takes 2200 microseconds again

sly topaz
#

the Table thing or using multiple entities that are hidden by default instead of an entity that you modify their entity metadata

fresh timber
#

yes

sly topaz
#

welp, I told you they're dirt cheap lol

fresh timber
#

true but now I'm also realizing this is overall pretty expensive, like if I had 100 players online just the displays alone would be taking up 20% of the miliseconds we have per second, and thats if there is only 20 displays

#

I will prob get to 50+ displays in future

#

but maybe thats just my hardware

#

cus rn I'm localhosting

#

so we'll see

#

server is on 7th gen intel soooo

sly topaz
#

The more it scales, the more the jvm will try to optimize hot paths too so it might not be all that bad

#

Then again, at 100 players everything starts becoming an issue

fresh timber
#

yeah we'll see, if I need to I can just increase the time

sly topaz
#

Servers nowadays are barely able to hold 50 with good performance

fresh timber
#

yeah thats why I made my server with the ability to do lobbies in mind

#

in case I need to I can do that

sly topaz
#

It’s mostly why projects like Folia and MultiPaper are becoming popular, the vanilla server just doesn’t scale

fresh timber
#

also my server is very customized but requires like 0 chunk gen and 0 entity spawning

#

so should be able to handle a decent amount on good hardware

pastel axle
#

Am I reading correctly that to use chat components in the bossbar, the most common solution at the moment is adventure?

buoyant viper
pastel axle
#

I'd assume the PR needs rebasing and reviewing πŸ˜›

worthy yarrow
buoyant viper
worthy yarrow
#

Like I said, at least it’s neat

hushed spindle
#

is it possible to create a map item with a set destination? wanting to remake villager trades but i cant really remake the cartographer without their special maps

mortal vortex
#

Yeahp.

#

I think even commands allow it too which is nice.

hushed spindle
#

i mean with spigot

mortal vortex
#

Yeah yeah 1 sec

#

I think you'd just create a new filled map item stack, you can cast item meta to MapMeta, then there should a getter and setter for "view" or something. Or you can create a new with Bukkit.createMap. Either way you'll want a MapView object... and I think you're smart enough to figure it out from there (just read the javadoc).

Theres also #addRenderer which should allow you to set those banner icons? iunno the implementation of that but I think you can write text on the map too with MapCanvas

#

@hushed spindle

hushed spindle
#

i dont see a way to add a structure destination to this, or would i need to figure out where certain structures are another way?

mortal vortex
#

wait

hushed spindle
#

i know you can make a map for a certain location, thats not the issue, i want one of those exploration maps that people can buy from cartographers that leads them to a generated structure

thorn isle
#

i have no clue how those maps work internally or even ingame since i've never used them

mortal vortex
#

You'll need to use NMS, i had a look.

thorn isle
#

but you could maybe find a structure using the whatever method lets you do that on World iirc, and then set a marker on the map for that position

mortal vortex
#

StructureSearchResult will provide you the structure. As I mentioned you can use MapView to add a custom render for a banner marker and give it text, but you cant use the icons like the "red x" for treasure or woodland mansion icon.

hushed spindle
#

im ok with using nms, where should i look?

thorn isle
#

using nms generally involves looking around for yourself

hushed spindle
#

yea but since they just said they looked before..

thorn isle
#

map related classes are a good place to start but you probably knew that already

mortal vortex
#

You can add these markers (and text) to an image, with the location of a structure. WITHOUT NMS. But you wont be able to add those custom icons.

#

StructureSearchResult result = player.getWorld().locateNearestStructure(...) will give you a structure, then you can just make a banner for it.

hushed spindle
#

so a good approach would be to grab the location with a structure search result and use spigot again to make the actual map for it

mortal vortex
#

Yeah

hushed spindle
#

sick

#

thank you so much

mortal vortex
#

skibidi toilet.

hushed spindle
#

very sigma rizz of you my lord

mortal vortex
#

sigma sigma boy sigma boy

thorn isle
#

that's kind of odd, i'd assume the cross treasure icon would be treated the same internally as these other map markers

#

are treasure maps handled somehow specially internally?

mortal vortex
#

mate, I'd have no clue

#

I just read the MapMeta and MapRenderer. I cant see anywhere that you could cast a StructureSearchResult

thorn isle
#

it looks like the MapCursor Type enum does include a red cross icon

#

so at least the marker should be doable

mortal vortex
#

That should, I think you can change its color too.

#

But... others... idk

#

@hushed spindle okay nvm @thorn isle was right

#

I didnt open the MapCursor.Type enum because i thought that would just be the banners.

#

You can do literally everything

hushed spindle
#

even better

#

thank you sigma skibidi ohio fanum tax males

mortal vortex
#

so: #locateNearestStructure from World > grab location > new marker > marker enum to the type of structure > render it > return MapView > get MapMeta > apply to itemstack

mortal vortex
thorn isle
#
        public MerchantOffer getOffer(Entity trader, RandomSource random) {
            if (trader.level() instanceof ServerLevel serverLevel) {
                if (!serverLevel.paperConfig().environment.treasureMaps.enabled) return null; // Paper - Configurable cartographer treasure maps
                BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, trader.blockPosition(), 100, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredVillager); // Paper - Configurable cartographer treasure maps
                if (blockPos != null) {
                    ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true);
                    MapItem.renderBiomePreviewMap(serverLevel, itemStack);
                    MapItemSavedData.addTargetDecoration(itemStack, blockPos, "+", this.destinationType);
                    itemStack.set(DataComponents.ITEM_NAME, Component.translatable(this.displayName));
                    return new MerchantOffer(
                        new ItemCost(Items.EMERALD, this.emeraldCost), Optional.of(new ItemCost(Items.COMPASS)), itemStack, this.maxUses, this.villagerXp, 0.2F
                    );
                } else {
                    return null;
                }
            } else {
                return null;
            }
        }
#

all of this should be doable over the api, except maybe for that renderBiomePreviewMap call

#

without it, the map will appear either blank or filled

mortal vortex
#

vcs, your profile picture looks like the narrator from spongebob cosplaying as an extremist

thorn isle
#

it's one of the guys in my unit from back when i was in the military

mortal vortex
#

How many iraqis you smoke?

thorn isle
#

he had catastrophic eye problems in one eye so he had to use an eyepatch over his better eye for a while

#

we didn't have any of course so we cobbled one together from bootlaces and a cloth from a rifle cleaning kit

mortal vortex
#

ohhh thats why it looks so goofy

#

and the keffiyeh?

thorn isle
#

just for the picture

#

doesn't look like the api exposes the preview render call

mortal vortex
#

where were you stationed?

#

mayb random lol

thorn isle
#

public ItemStack createExplorerMap(World world, Location location, StructureType structureType, int radius, boolean findUnexplored) {
there's this on CraftServer for creating an explorer map, but it'll try actually searching for a structure; you can't the mark to an arbitrary position

#

i'm not sure if you could maybe manually place a structure there and then use this to generate a map for it

#

alternatively you could copy paste the actual preview render method from nms and put it in your own map renderer

#

it's around 100 lines of nested x y z biome check loops

#

should be fairly straight forward with a bit of elbow grease

pine forge
mortal vortex
#

i thought it made sense?

torn shuttle
#

woo

#

I did it

#

the models plugin is now full async

#

0.01% server use bby

cinder abyss
drowsy helm
#

can you not just serialise the contents

#

also does it give an error on crash?

cinder abyss
cinder abyss
drowsy helm
cinder abyss
thorn isle
#

you definitely don't want to store an inventory full of shulker boxes in a pdc of any kind

cinder abyss
thorn isle
#

what are you even trying to do

drowsy helm
#

also trying to serialise an inventory holder won't really work

cinder abyss
cinder abyss
thorn isle
#

store the inventory in a file or something

pseudo hazel
thorn isle
#

not in a pdc

cinder abyss
#

then, how can I store not in a pdc please ?

#

with NBTAPI ?

drowsy helm
#

i dont really see anything wrong with using pdc

thorn isle
#

not in nbt either

pseudo hazel
#

then how?

drowsy helm
#

tile entities are stored in the same fashion

thorn isle
#

only on disk

pseudo hazel
#

actual chests are stored with nbt in the level dat im pretty sure

#

wdym

thorn isle
#

yes, on disk

cinder abyss
pseudo hazel
#

thats what the persistent in pdc is for

thorn isle
#

the difference is that the pdc is stored in nbt which is in memory also

#

for tile entities, the nbt stays on disk and it gets parsed into a proper object model to be stored in memory

#

i.e. a list of ItemStacks

pseudo hazel
#

whats the difference here

thorn isle
#

nbt is far less space efficient

pseudo hazel
#

i meant what is the difference between what you explained and how paulem wants to do it

thorn isle
#

from what i understood, he wants to keep the data in the pdc of the entity

cinder abyss
#

I can change if needed

thorn isle
#

this is ass because an inventory full of shulkers is going to be HUGE when represented as nbt

cinder abyss
#

but I don't want it to be stored in a file in plugin data folder

thorn isle
#

it being HUGE is not as much of a problem for tile entities like chests because again, the nbt is only for disk storage, it doesn't stay resident in memory

#

but for pdc, the raw pdc data is in memory as nbt, so it's HUGE and it's in memory and that's a bad combination

pseudo hazel
#

but its the same data

cinder abyss
thorn isle
#

attach an id to the entity and use that id to locate a file on disk

pseudo hazel
#

by caching it in a list the rest of the time

thorn isle
#

the pdc is still going to be in memory unless you delete the entity/pdc entry, but then it's no longer persistent

pseudo hazel
#

and how does using an entity id fix that

thorn isle
#

because then the data is on disk in a file and not in a pdc in memory

#

only the id/pointer used to locate the file is in a pdc in memory

pseudo hazel
#

but how do you load it into the class then

thorn isle
#

what

pseudo hazel
#

how do you get the items into your entity when you load it

#

without the pdc staying in memory

thorn isle
#

the pdc stays in memory, but it is no longer an issue because it is not HUGE, because an id is not HUGE

cinder abyss
pseudo hazel
#

what do you mean

thorn isle
#

you look at the id in the pdc when the entity loads, and you use the id to locate a file on disk, and you load the data from disk

#

the HUGE stays on disk

pseudo hazel
#

yes

drowsy helm
#

πŸ’€

pseudo hazel
#

but you loading the data from a file puts that files data into memory?

thorn isle
#

yes

pseudo hazel
#

so

thorn isle
#

but what you have to understand here, like i've said many times, is that not all storage formats for data are equal

#

nbt in base64 is HUGE

#

ItemStack is less huge

pseudo hazel
#

sure

thorn isle
#

so you load it in memory as itemstacks

pseudo hazel
#

how do you do that

cinder abyss
thorn isle
#

any way you want; the way he's doing is fine, except i would probably use a file input stream rather than a byte array input stream

pine forge
#

How can i block the main thread in my onDisable to ensure that everything shuts down correctly?

thorn isle
#

the problem with his approach is that the huge 2 megabyte string is in a pdc and not in a file

mortal vortex
#

"uhh whats memory" codingjesus interview question.

pseudo hazel
#

xD

cinder abyss
#

hum

pseudo hazel
#

but what if you wanted it to be in the level dat

thorn isle
#

now i vaguely recall that last you brought this up, you had a solid block occupying the same space as the display?

cinder abyss
#

I'd better write everything in the file and load it at start if I use plugin datafolder

cinder abyss
#

the display is 0.0005f taller πŸ€“

thorn isle
#

what you could do is place a shulker in that space instead and use that to hold the inventory; when clicking the entity, get the inventory of the shulker and open it for the player

#

this does limit you to the 3 row inventory however, and it won't be per-player if you want that

cinder abyss
#

and I want my inventory to do the size I want

thorn isle
#

i don't think the opening animation will play if you open the inventory manually

cinder abyss
thorn isle
#

but yeah, if the size is an issue you'll just have to take the file route

cinder abyss
#

hum then the problem is for the inventory size so yeah

thorn isle
#

storing it in a pdc could be fine if you're sure nothing massive gets put into it

#

like shulkers or written books

cinder abyss
pseudo hazel
#

or make your own pdcdatatype thats a list of itemstacks

#

and the problem is gone

cinder abyss
pseudo hazel
#

just guessing

thorn isle
#

that won't work

pseudo hazel
#

but that depends on how the custom pdc types work

thorn isle
#

it's stored as raw nbt under the hood

pseudo hazel
#

how so

thorn isle
#

and every time you do get() or set(), your custom datatype is used to convert it from the complex type to the primitive type

cinder abyss
#

what if I split itemstack datas in chunks of pdc ? x)

thorn isle
#

for example if you put his code in a pdc data type, every time he'd get an item it'd cause a base64 string to be deserialized into a new itemstack; and that base64 string would still remain in memory

cinder abyss
#

what is actually crashing, the pdc size being high or the global pdc size supported by the ItemDisplay ?

pseudo hazel
#

thats dumb

thorn isle
#

it's convenient but quite expensive and not particularly efficient

pseudo hazel
#

I guess thats just an issue with how its implemented then ig

thorn isle
cinder abyss
thorn isle
pseudo hazel
#

fair enough

cinder abyss
#

wtf it don't print errors anymore

#

but it still doesn't work

#

I'll do something horrible but I don't have choice

#
[12:37:07 ERROR]: Failed to write NBT String
java.io.UTFDataFormatException: encoded string (rO0ABXNy...EAfgAq
) too long: 130528 bytes
    at java.base/java.io.DataOutputStream.writeUTF(DataOutputStream.java:363) ~[?:?]
    at java.base/java.io.DataOutputStream.writeUTF(DataOutputStream.java:327) ~[?:?]
    at net.minecraft.util.DelegateDataOutput.writeUTF(DelegateDataOutput.java:80) ~[server-1.21.8.jar:1.21.8-11-a5f2f61]
    at net.minecraft.nbt.NbtIo$StringFallbackDataOutput.writeUTF(NbtIo.java:215) ~[server-1.21.8.jar:1.21.8-11-a5f2f61]
    at net.minecraft.nbt.StringTag.write(StringTag.java:66) ~[server-1.21.8.jar:1.21.8-11-a5f2f61]
    at net.minecraft.nbt.CompoundTag.writeNamedTag(CompoundTag.java:436) ~[server-1.21.8.jar:1.21.8-11-a5f2f61]
    at net.minecraft.nbt.CompoundTag.write(CompoundTag.java:181) ~[server-1.21.8.jar:1.21.8-11-a5f2f61]
    at net.minecraft.nbt.CompoundTag.writeNamedTag(CompoundTag.java:436) ~[server-1.21.8.jar:1.21.8-11-a5f2f61]```
#

when saving

thorn isle
#

too long: 130528 bytes

#

there are limits to what nbt can store

cinder abyss
cinder abyss
thorn isle
#

your entire data is one huge string

#

a base64 string

pseudo hazel
#

how did you get it to save that though

cinder abyss
cinder abyss
#

peak dev

pseudo hazel
#

oh nvm this is saving where it goes wrong

#

well, what is this data

#

like what do the contents look like

cinder abyss
thorn isle
#

or well more accurately i guess this is a limitation in the java dataoutputstream

pseudo hazel
#

no i mean the contents of the container in game

thorn isle
#

it limits utf8 strings to 65535 bytes

cinder abyss
#

(64*1024) -1

#

exactly

pseudo hazel
#

I wouldnt store it as a single string probably then

thorn isle
cinder abyss
#

I think what I can do is writing the amount of chunks in a integer pdc, and then loading each chunks from their base key_chunkIndex

pseudo hazel
#

why not chunk it per item

#

instead of arbitrary string cuts

cinder abyss
pseudo hazel
#

idk

#

it doesnt really change the amount of data, just the way its stored

cinder abyss
#

and there's still space in each pdc

pseudo hazel
#

I would try using a list of serialized bytes (itemstacks) and see if that works

#

pdc is limited by your server memory I guess

thorn isle
#

i guess if i really had to store a huge list of items in a pdc without nms, i probably would use the paper serializeAsJson methods and then map the json object to a pdc; in that way there's no intermediate string or base64 encoding and the data gets saved as optimally as is possible to encode it in a pdc

#

with access to nms, i'd serialize to nbt via nms and store it directly in the custom_data component next to the pdc

pseudo hazel
#

id say serializeAsBytes is pretty optimal for most stacks

thorn isle
#

that serializes it to nbt and then writes the nbt as a binary stream into bytes

pseudo hazel
#

if you have nms I would just put it in the level dat just like actual chests, if thats possible

#

but its more complicated

thorn isle
#

a custom tile entity would be ideal yes

#

i don't have much experience with those but they're sort of doable afaik

cinder abyss
#

Humm interesting

cinder abyss
pseudo hazel
#

the limit is your memory

woeful hollow
#

From which version is this supported in plugin.yml ?

thorn isle
#

there are some limits to it still, like if you go over the maximum size of data in a chunk you'll get problems, but at that point it's not much different from regular chests and containers

thorn isle
#

and the raw data is still always in memory as long as the chunk is loaded, so memory-wise it's far less efficient than a regular container

#

so keep an eye on resource usage as you place them; i definitely wouldn't let players create these things without restrictions, for example

cinder abyss
#

I think I've found

#

the way to do it, in one string

#

it works

#

god damn

#
private static byte[] compress(byte[] data) throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try (java.util.zip.DeflaterOutputStream dos = new java.util.zip.DeflaterOutputStream(bos)) {
        dos.write(data);
    }
    return bos.toByteArray();
}

private static byte[] decompress(byte[] data) throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try (java.util.zip.InflaterInputStream iis = new java.util.zip.InflaterInputStream(new ByteArrayInputStream(data))) {
        byte[] buffer = new byte[1024];
        int len;
        while ((len = iis.read(buffer)) > 0) {
            bos.write(buffer, 0, len);
        }
    }
    return bos.toByteArray();
}```
What do you think of compressing with something like ZLib ?
pseudo hazel
#

but if you have nms isnt it possible to make it work like the vanilla chests and have no memory lingering that you dont need?

thorn isle
#

with a custom tile entity, yeah

#

but it isn't really worth the effort

#

having a pointer to a file in the pdc is much easier and about as reliable

young knoll
cinder abyss
thorn isle
#

depends

#

you could load it when the chunk or entity loads

#

you could load it when it's first interacted with and needed

cinder abyss
#

then do I unload it ?

thorn isle
#

depends

#

i'd probably unload it on chunk unload, but save it whenever the inventory is closed, to make sure i don't miss any changes

cinder abyss
#

and if it's a pdc, does it unload with chunks ?

#

like, when using ZLib for compresson, I'm now at 1977 bytes

thorn isle
#

yes, the pdc is attached to an entity/chunk/world and whenever what it's attached is unloaded the pdc itself is also unloaded

cinder abyss
#

so maybe that's the best way ?

#

What do you think ?

thorn isle
#

personally i would still use a pointer to a file but this should probably be fine

cinder abyss
#

It's actually very small when stored, and it unloads automatically, and I prefer it that storing in datafolder

cinder abyss
thorn isle
#

there are still some difficulties with this approach, especially around parsing/saving it asynchronously which can become an issue if there are a lot of these and they have large contents, but for a basic approach this will be fine

cinder abyss
#

I take notes about that, thanks !

#

thanks a lot for your help πŸ˜„

thorn isle
#

πŸ‘

mortal vortex
#

Does the client send the server information on their FOV? Im just thinking because there is a noticeable difference in how the creaking mob attacks you at 30FOV and 100FOV.

sly topaz
sly topaz
smoky anchor
#

creaking does not respect the players FOV
iirc this was reported as a bug and resolved as WAI

#

Clientbound
I don't think the server has any way of knowing that setting

pine forge
# sly topaz what do you have on your onDisable right now
 public Future<Boolean> disconnect() {
        return EXECUTOR.submit(() -> {
            SOCKET.disconnect();
            while(SOCKET.connected()) {}
            return true;
        });
    }```

```java
// onDisable:
        try {
            Future<Boolean> future = adapterManager.stop(); // -> calls disconnect()
            if(future != null) future.get(5, TimeUnit.SECONDS);
        }
        catch(InterruptedException | ExecutionException | TimeoutException e) {
            e.printStackTrace();
        }```

Im doing this now which seems to work
#

it just waits until the socket.connected() variable is set to false

#

not sure if thats best practice to do it like that but the library doesnt seem to offer a bettter solution

sly topaz
#

which library is it?

pine forge
#

socket.io-client java

#

as im comunicating with a js service which also uses socket.io

sly topaz
#

seems like you just have to close the thread pool executor as well

slender elbow
#

his ass is NOT Thread.onSpinWait()ing and Thread.yield()ing :Sadge:

sly topaz
#

so, if you follow that, it should all work out