#help-development

1 messages · Page 464 of 1

true perch
#

What is the most efficient way to load data from a user friendly configuration file to the server's memory?

young knoll
#

YamlConfiguration.loadConfiguration

rare rover
#

okay so, i'm working on an SQLite database for my plugin and i was wondering if i should store all the information in a Map instead of retreving the playerdata everytime the player joins. And if i dont do that how would i make leaderboards since it wouldn't be stored on a map therefore cannot sort without retreving all the data again which doesn't seem like the best way. But if i make it all load onto a Map it'll use up alot of ram

#

i need someones opinion

young knoll
#

Load player data when they join

#

Use a query to make a leaderboard

#

You can cache said leaderboard and refresh it regularly if you wish

rare rover
#

okay, you are referring to putting it into a Map / TreeMap for top 10 players

#

correct?

#

and make it update every like 5 minutes or so

young knoll
#

Mhm

rare rover
#

okay, thank you. I will work on that

humble tulip
#

Is it possible to put components on itemstack lores and if it is, do translatable components work in lore?

young knoll
#

Not yet

#

Not with the api anyway

humble tulip
young knoll
#

Yes

true perch
#

I'm trying to save a list of Enum names to a config file. Not sure how to do it. Here's what I have:

config.set("Attributes", itemData.getAttributes());```Here's what it does:```java
Attributes:
- !!me.combatborn.realms.mechanics.realmitem.ItemAttributes {}
- !!me.combatborn.realms.mechanics.realmitem.ItemAttributes {}
- !!me.combatborn.realms.mechanics.realmitem.ItemAttributes {}```
#

Any suggestions?

#

Thank you

regal scaffold
young knoll
#

Hopefully that api will come through soon

humble tulip
young knoll
#

I can’t really give much direct advice without the code in front of me

#

But you should be able to convert bungee components into their minecraft counterparts, and then work with them directly with the NMS version of an ItemStack

regal scaffold
#

Any ACF tryhard online again?

#

Is it possible to hide a subcommand in autocomplete, like when a player starts typing a subcommand it doesn't show in the list

#

So a "hidden" but available command

echo granite
#

It's annotation whose name I forgot

#

go to the wiki, they have an Annotations section

regal scaffold
#

Oh I will look in the docs

#

Thanks!

wise mesa
#

can I register a service provider during onLoad

#

or do i need to wait until onEnable

#

i want other plugins to be able to load my service during on load

lost matrix
#

What Nat told you is poop. Just use "@nothing" as second completion parameter.
So

@CommandCompletion("@contacts @nothing")

And dont use a String... at the end.
Just use a String. The last String can contain spaces on default.

@Subcommand("text")
@Description("Text a contact.")
@CommandCompletion("@contacts @nothing")
public void onTextCommand(Player sender, String phoneNickname, String message) {}

The phoneNickname is single on default and message will contain the rest of your input

regal scaffold
#

Oh

#

Thanks smile

young knoll
#

💀

regal scaffold
#

Will do the changes right now

#

I have a question

#

I know that UUID doesn't have a serializable option

#

So I'm pretty sure using UUID.toString() is the best way

#

Would it be worth making a class that extends UUID and implement Serializable into that

humble tulip
#

You can serialize uuid to 2 longs

regal scaffold
#

To straight up serialize it instead of toString

lost matrix
regal scaffold
#

Is that the best aproach?

#

Like, efficiency wise?

humble tulip
#

Yes

regal scaffold
#

Is it that much better than just a String?

young knoll
#

Yes

lost matrix
#

Depends on how you define good for your serialisation

#

For readability its horrible

regal scaffold
#

Wait so you're saying on a big program, storing UUID as 2 longs would be noticeably better than 1 string? performance wise

#

I can imagine having to split it into 2 longs is.... tough for the eyes

lost matrix
#

And for performance it depends on your persistency system. How good can you handle 128bit numbers

humble tulip
#

If your program serializes and deserializes them a lot

regal scaffold
#

Alright I see, thanks for the clarification

#

I wonder if 128bits is too much

humble tulip
#

??

regal scaffold
#

And could probably have a custom UUID which is just 64bits

humble tulip
#

You can

regal scaffold
#

128 seems overkill

humble tulip
#

Just let the first long be 0

young knoll
#

How many uuids are you storing

humble tulip
#

Technically

lost matrix
#

If your serialisation system relies on reading two strings and parsing them into two longs then
the performance might be not too far off from just storing a single String.

hybrid spoke
#

what even are 'yall on about

rough ibex
#

uuids

hybrid spoke
#

just convert the uuid to a string and get the bytes

#

done

lost matrix
#

With 64bit you couldnt even create enough minecraft accounts for 1/4th of the human population

regal scaffold
#

But

#

Will your java plugin

#

Really need to create

lost matrix
young knoll
#

128 bits is nothing

hybrid spoke
#

also possible but in the end of the day it doesnt really matter

regal scaffold
#

5.3 x 10^36 possible choices

hybrid spoke
#

you have to deconstruct and construct it again anyways

#

both ways are fast

echo basalt
regal scaffold
#

tf really

hybrid spoke
#

if you aren't gonna do it multiple million times at once its wayne what method you choose

rough ibex
#

is this a microoptimization

hybrid spoke
#

yes it is

rough ibex
#

(maybe)

young knoll
#

What’s that like 8k uuids in a megabyte

regal scaffold
#

1,099,511,627,776

echo basalt
#

if you have 1 billion unique users

#

that's like 16gb

regal scaffold
#

Are you really gonna need that many

#

unique identifiers

hybrid spoke
young knoll
#

Yes

echo basalt
#

you can get a 240gb ssd for 15$

regal scaffold
#

1,073,741,824

echo basalt
#

that's about 1$ / billion uuids

rough ibex
#

what a deal

regal scaffold
#

1,099,511,627,776 > 128bit
1,073,741,824 > 64bit

#

128bit is not 1bil. it's 1tril

young knoll
#

It’s more than that

regal scaffold
#

No?

#

16^10

#

Oh wait

#

it's not ^10

humble tulip
#

2^128

echo basalt
#

what you on about

#

2 ^ 128

hybrid spoke
#

are we topic hopping or what are we on about rn

regal scaffold
#

Didn't we just say it was hex

young knoll
#

128 bits, each bit has 2 states

#

2 ^ 128

regal scaffold
#

3.4028237e+38 -> 2^128
1.8446744e+19 -> 2^64
4294967296 -> 2^32

#

That definately seems overkill for... anything

#

But I guess I'm wrong

young knoll
#

I’m sure people said that about ipv4 too

humble tulip
#

That's what we thought with ipv4

#

LOL

young knoll
#

UUIDs are meant to be universally unique

humble tulip
#

Same thing

regal scaffold
#

Not even close

#

IPV4 was like 4.3 bil

#

Total

young knoll
#

So I don’t want any uuid collisions with any aliens out there

rough ibex
#

"Nobody will ever need more than 640k RAM"

regal scaffold
#

You can't compare 4.3bil with 3.4028237e+38

hybrid spoke
young knoll
#

Keep in mind every entity you spawn in minecraft has a uuid

echo basalt
#

you'd need 2^65 exabytes to store all the uuids that could ever exist

young knoll
#

Granted those really only need to be unique across one minecraft server

#

But still

regal scaffold
#

340,282,370,000,000,000,000,000,000,000,000

#

That's the actual number

hybrid spoke
#

keep in mind that UUIDs aren't only used for minecraft

regal scaffold
#

vs 4,300,000,000

#

Yes but

#

We're a minecraft community

river oracle
#

Just don't use uuid if you think it's overkill

#

Your issue

young knoll
#

Still less than the number of ways to shuffle a deck of cards

hybrid spoke
#

yeah stay native

regal scaffold
#

We were just talking about micro optimizations

humble tulip
#

Use int or sumn

young knoll
#

Use a byte

hybrid spoke
#

better go machine code

young knoll
#

256 options, take it or leave it

regal scaffold
#

Cause instead of storing a UUID as 2 longs, you can most likely get away with just as 1

hybrid spoke
#

or write it on paper

regal scaffold
#

I think assembly is indeed the better choice here

hybrid spoke
#

no its not

rough ibex
#

aren't UUIDs like impossible to collide because the first part is timebased

hybrid spoke
#

they can collide

rough ibex
#

in what scenarios

hybrid spoke
#

if you create enough at the same time

#

like 1 bil within a ns or smth

regal scaffold
#

lol

hybrid spoke
#

ah per second

rough ibex
#

"Thus, the probability to find a duplicate within 103 trillion version-4 UUIDs is one in a billion. "

regal scaffold
#
section .data
uuid db 0x10, 0x00, 0x00, 0x00, \
     0x00, 0x00, 0x40, 0x00, \
     0x80, 0x00, 0x00, 0x00, \
     0x00, 0x00, 0x00, 0x00

section .text
global _start

_start:
    ; Call getrandom() to generate 16 random bytes
    ; into the "uuid" buffer
    mov rax, 318 ; getrandom system call number
    mov rdi, uuid
    mov rsi, 16
    mov rdx, 0
    syscall

    ; Set the UUID version to 1 (time-based)
    mov byte [uuid + 6], 0x10

    ; Set the UUID variant to the RFC 4122 variant
    mov byte [uuid + 8], byte [uuid + 8] & 0xbf | 0x80

    ; Call uuid_generate_time_safe() to convert the
    ; random bytes into a time-based UUID
    push rax
    lea rdi, [uuid]
    call uuid_generate_time_safe
    pop rax

    ; Print the UUID in hexadecimal format
    mov rdi, uuid
    mov rsi, 36
    lea rdx, [uuid_str]
    call uuid_unparse_lower

    ; Print the UUID string to stdout
    mov rax, 1
    mov rdi, 1
    mov rsi, uuid_str
    mov rdx, 36
    syscall

    ; Exit
    mov rax, 60
    xor rdi, rdi
    syscall

section .bss
uuid_str resb 37
#

This is the way

rough ibex
#

gotcha

young knoll
#

Did you write that

regal scaffold
#

Of course not

hybrid spoke
#

chatgpt ftw

regal scaffold
#

TLDR of micro optimization

#

Just use UUID

#

I'm curious if it actually wrote it correctly lol

young knoll
#

¯_(ツ)_/¯

#

Anyone have NASM installed

regal scaffold
wet breach
regal scaffold
#

Does anyone have an example implementation of a command that has a [NEXT PAGE] when there's too much stuff to display in 1

humble tulip
#

Yes

#

?paste

undone axleBOT
humble tulip
regal scaffold
#

Interesting

#

Thanks!

#

And last question for the night

#

Lets say I want to store a simple "date" in a object that gets written to a file:

DD-MM-YYYY-TIME

#
dateTimeFormatter.format(LocalDateTime.now())
#

I assume this is not serializable

young knoll
#

It should be possible to just store it as a timestamp

regal scaffold
#

OH!@

#

Yes!

young knoll
#

Provided you don’t need to go earlier than 1970

regal scaffold
#

Current so nop

#

Thanks

#

How do I get the timestamp

lost matrix
#

SImplest way is System.currentTimeMillis()

regal scaffold
#

I need something more readable

lost matrix
#

Well then you cant use a timespamp

regal scaffold
#

Could I just store it as a string?

lost matrix
#

Use Instant now = Instant.now()
It can be serialized pretty easily

regal scaffold
#

idk how hard it would be to convert it back

#

Oh

#

Ok

#
        map.put("timeSent", timeSent.toString());
#
        Instant timeSent = Instant.parse((String) map.get("timeSent"));
#

Logically makes sense I wonder how the format is

young knoll
#

Shouldn’t be too hard to format System.currentTimeMills into something readable

regal scaffold
#

Any preferred collection system to be able to sort Collection<Object> by a field inside the object?

young knoll
#

DateTimeFormater should work

regal scaffold
young knoll
#

You serialize the milliseconds

#

And then format it for display

regal scaffold
#

I think if I make my Object implement Comparable<Object>

lost matrix
#

You have to serialize the Instant using the DateTimeFormatter#ISO_INSTANT
If you want to parse it again

lost matrix
# regal scaffold Ohhh ok ok
    Instant now = Instant.now();
    DateTimeFormatter formatter = DateTimeFormatter.ISO_INSTANT;
    String serialized = formatter.format(now);
    
    Instant deserialized = Instant.parse(serialized);
regal scaffold
#

Now that, is really cool

#

I like that

young knoll
#

If you’re able to keep it stored internally as a long I’d do that

#

And then parse it when displaying it to players

regal scaffold
#

Indeed

#

Pretty slick

#

Any preferred collection system to be able to sort Collection<Object> by a field inside the object?

#

Like lets say I want to keep the list organized

young knoll
#

Do you want it to automatically sort

regal scaffold
#

Sorted by, what we just did, date

lost matrix
regal scaffold
#

Yes!!! I forgot about those, I couldn't remember the name

lost matrix
#

You just need to pass a Comparator to the constructor

regal scaffold
#
    @Override
    public int compareTo(Text other) {
        return this.timeSent.compareTo(other.timeSent);
    }
#

Are you sure I can't just implement Comparable<Text>?

lost matrix
#
  public static class SomeClass {
    private final long timestamp;

    public SomeClass(long timestamp) {
      this.timestamp = timestamp;
    }
    
    public long getTimestamp() {
      return timestamp;
    }
  }
  
  private final TreeSet<SomeClass> sorted = new TreeSet<>(Comparator.comparingLong(SomeClass::getTimestamp));
lost matrix
regal scaffold
#

Sickkk

#

Is Set<?> serializable

#

How can I know if it is

#

I want to be able to stop asking

#

Looking at the javadocs is there any way to tell?

young knoll
#

Serializable to what

#

ConfigurationSerializable?

regal scaffold
#

YAMLConfiguration

#

Yes

young knoll
#

I don’t believe set is

#

List is

regal scaffold
#

But how can I know without having to ask each time, there's got to be somewhere to look

#

And if it's not... annoying

#

?jd-s

undone axleBOT
lost matrix
#

Try it out. Havent used spigots serialization in a while.
If not then try adding set.toArray()

regal scaffold
#

There's really no way to know looking at docs/implementation?

young knoll
#

Well classes will implement ConfigurationSerializable

#

But obviously java classes don’t have that

regal scaffold
#

Why does List do it then

#

?stash

undone axleBOT
lost matrix
#

Other than that Map and List are natively representable in yaml

young knoll
#

Spigot handles various objects from the standard java library

#

I’m not sure if they are listed anywhere

young knoll
#

So if it’s a Bukkit object check for the interface

#

If it’s a standard java object then yeah, idk

#

I do know all primitives work, as well as lists and arrays

#

I’m sure there is more

regal scaffold
#

set.toArray will do

#

If I'm doing toArray to serialize

#

What am I deserializing to

lost matrix
#

List and then passing it to the TreeSet i guess

regal scaffold
#

toArray does a list?

#

So confusing...

lost matrix
#

There is no diff between array and list in yaml

regal scaffold
#

Oh

#
            Set<Text> phoneTexts = new TreeSet<Text>((List<Text>) phoneData.get("phoneTexts"));
#

Jesus lol

lost matrix
#

Call getList

regal scaffold
#

It did not like that

high igloo
#

hello, is there a way to set the light level without using light blocks

regal scaffold
#

Oh wait I still need to cast

young knoll
#

Not with the api

lost matrix
regal scaffold
#

Does it even matter then?

#

I'm brain melted for tonight

#

I need sleep

#

Thanks for the help

#

I can say tho

#

It worked

#

Like a charm

#

Jesus

#

That is so damn cool

young knoll
#

What

#

You can index any java array like that

regal scaffold
#

Opinions on Adventure?

young knoll
#

Alone it’s not much different than bungee components

#

But if you use minimessage to parse stuff it can be quite useful

regal scaffold
#

I searched on how to do BaseComponents with config files and the first answer was using Adventure was a good option

buoyant viper
#

adventure probably is the better option bc u can use minimessage for some cool parsing

#

like clickable text and hover stuff

#

all stuff u can do with Spigots components too, but no built-in parser :v

torn oyster
#

how do i delete a world

#

after unloading it

#

i call bukkit#unloadworld(world, false)

#

and listen for worldunloadevent and delete the folder when done

#

it doesn't work on restart

final monolith
#

What's the PacketPlayOutTitle packet in bukkit 1.17+?

#

wanna send some titles

kind hatch
#

ClientboundSetTitlesAnimationPacket

#

ClientboundSetTitleTextPacket

final monolith
#

Thanks ❤️

static ingot
#
@Override
public void onEnable() {
  // ...
  ItemStack other = new ItemStack(Material.DIAMOND_SWORD);
  ItemMeta meta = other.getItemMeta();
  meta.addEnchant(Enchantment.DAMAGE_ALL, 5, true);
  meta.addEnchant(Enchantment.FIRE_ASPECT, 2, true);
  meta.addEnchant(Enchantment.SWEEPING_EDGE, 3, true);
  meta.addEnchant(Enchantment.DURABILITY, 10, false);
  other.setItemMeta(meta);
  Map<String, Object> serialized = other.serialize();
  serialized.computeIfPresent("meta", ($, meta1) -> {
    ConfigurationSerialization.deserializeObject(meta.serialize(), ItemMeta.class));
  }
  System.out.println(ItemStack.deserialize(serialized));
}```
Why does serialized ItemMeta not serialize back properly via ConfigurationSerialization? Result:
```[Server thread/INFO]: Expected: ItemStack{DIAMOND_SWORD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, enchants={DAMAGE_ALL=5, FIRE_ASPECT=2, SWEEPING_EDGE=3}}}
[Server thread/INFO]: Actual: ItemStack{DIAMOND_SWORD x 1}```
this is on 1.19.4
#

Figured out the issue, the format of serialized ItemStacks must have changed at some point

#

item meta used to be under the key "meta", now it's "UNSPECIFIC_META"

sullen marlin
#

?jd-s

undone axleBOT
sullen marlin
static ingot
#

It serializes back correctly after changing it to that ¯_(ツ)_/¯

#

I'm only using the #serialize methods

quiet ice
#

Are you using spigot spigot or something else?

#

If I had to guess different servers could produce different outputs

static ingot
#

It's Spigot. 1.19.4. lol

#

not any fork

quiet ice
#

strange

lost matrix
static ingot
#

though i just realized i was printing the string value of the item stacks rather than the serialized maps after all, lol

#

I'm still looking into it more

lost matrix
#

Have you tried simply throwing the map into gson?

static ingot
#

err. personally, no. but afaik that would throw errors because ItemMeta is just an interface

#

Unless I'm misunderstanding what you mean

lost matrix
#

Does the serialized ItemStack have to be readable?

#

Or is it only for persistence

static ingot
#

Readability is preferred since it's part of the main config

lost matrix
#

Then you should not use json...

static ingot
#

¯_(ツ)_/¯

valid solstice
#

I can't see my arms, hotbar, and others when i do Player#setGameMode(GameMode.SPECTATOR). How do i make them visible while in spectator

icy beacon
#

That's the normal behavior of spectator mode, and pretty sure it's clientside

valid solstice
#

oh so how about hypixel? how do they do that?

lost matrix
valid solstice
lost matrix
#

Nobody can answer that for you.
But the spigot way is just Player#hidePlayer(Player)

valid solstice
#

oh so i hide one player to another player

quiet ice
#

I'd not recommend that route though unless performance is important

quaint mantle
#

hey guys

quiet ice
#

hello there

quaint mantle
#

can somone tell me how to check blockstate ? (i wanna know if a furnace is lit or not)

i tried e.getBlock().getState()
but when i do BlockState. there is no block State To compare

#

Is there a way to do it without nms and packet?

quiet ice
#

Cast it to the block state you want it to be

#

?jd-s

undone axleBOT
quiet ice
#

So ((org.bukkit.block.Furnace) e.getBlock().getState()).getBurnTime() > 0

quaint mantle
#

oh lol i was trying to cast BlockState. itself , thx a lot mate <.3

quaint mantle
#

quick questoin
I have 2 types of a block in my plugin when i they both are supossed to triggera diffrent listeners. Whats the best identifier to set for the listeners to regonize them

rotund ravine
#

What type of blocks

quaint mantle
#

Barrels

lost matrix
#

In this specific case you could store data in the PDC of the barrels

quaint mantle
#

oke

#

hey guys, can someone tell why when i cast a block when i call its method its doesn't return anything ? i mean

why this work

but this one doesn't
Bukkit.getServer().getPlayerExact("__Mental_").sendMessage(((org.bukkit.block.Furnace)e.getBlock()).getWorld().toString());

lost matrix
#

This throws an exception

#

You can cast Block to Furnace

pine forge
#

Hey, ive never really understood how these namespaced keys work when im creating a recipe or using the persitentdatacontainer on items.

Is it valid to use NamespacedKey.minecraft("recipe_name") or should you use new NamespacedKey(this, "recipe_name") (or "item_name")?
What is the difference?

rotund ravine
#

One adds minecraft as the namespace the other uses your plugins name.

pine forge
#

Okay but what actually is a namespace and is it recommended add stuff to minecraft's namespace?

rotund ravine
#

It is not

#

minecraft:xxxx
yourplugin:xxxx it’s a way to easily differentiate keys.

pine forge
#

okay, why are you not supposed to add stuff to minecraft's namespace?

rotund ravine
#

Because it’s not yours

#

Simply said.

pine forge
#

okay

lost matrix
#

You should not add keys to any other namespaces than your own in general

pine forge
#

shouldnt the method be deprecated then or something?

rotund ravine
#

It’s not an old festure

lost matrix
#

It has its use cases if you want to create namespaced keys for minecraft resources

rotund ravine
#

It’s useful when you know what to use it for.

pine forge
#

examples?

lost matrix
#

vanilla recipes

quaint mantle
# lost matrix You can cast Block to Furnace

can you explain more ? i should throw what exception ? and is this a proper way to do it ? i wanna check if a furnace is lit or not by casting it to furnace and the get the burn time

lost matrix
#

Cast the BlockState of a Block to Furnace and check

quaint mantle
#

thx mate

quick sail
#

if im making an RPG plugin, I obviously need to hold some additional variables that "belong" to the player object. My solution to this is basically creating a PluginPlayer class that holds my additional data. Of course then I need a way to get a PluginPlayer from a player since all bukkit api gives me are regular Player objects so I store a map of UUID - pluginplayer pairs for all currently online players and pass that in to whatever needs it. Am I on the right track with this or is there a more elegant solution I'm missing.

#

im a bit of an amateur

lost matrix
#

This sounds like the proper approach. A manager class which holds a Map<UUID, RPGPlayer>.

quick sail
#

should my "RPGPlayer" hold a copy of the Player object too? That was my original plan but I feel its not needed at all

lost matrix
#

please make agility less grindy if you implement it btw

lost matrix
quick sail
#

that was what I figured, would you care to explain why not to hold live objects

#

doesnt need to be basic explanation or anything

#

I like to learn

remote swallow
#

for context the player one is invalid as soon as they logout

ivory sleet
#

they're fragile

quick sail
#

that could be handled

lost matrix
#

It easily leaks memory by preventing the garbage collector from collecting it

ivory sleet
#

these objects usually have a lot of state

quick sail
#

that makes sense

ivory sleet
#

yes you can always handle a Map<Player,V>

#

but is it a good approach?

tardy delta
#

WeakMap

ivory sleet
#

which is works but is still gc dependent

tardy delta
#

it will get gced, the question is when

lost matrix
#

Has anyone here sent custom advancement messages? Im a bit lost.

#
  public static void sendAdvancement(Player player, ItemStack icon, Component title, FrameType frameType) {
    DisplayInfo displayInfo = new DisplayInfo(icon, title, Component.literal(""), null, frameType, true, true, false);

    Criterion criterion = new Criterion(new NotifyTrigger());

    AdvancementRewards rewards = AdvancementRewards.EMPTY;
    String[][] requirements = {{criterionId}};
    Advancement advancement = new Advancement(identifier, null, displayInfo, rewards, Map.of(criterionId, criterion), requirements);

    AdvancementProgress progress = new AdvancementProgress();
    progress.update(Map.of(criterionId, criterion), requirements);
    progress.grantProgress(criterionId);

    ClientboundUpdateAdvancementsPacket packet = new ClientboundUpdateAdvancementsPacket(true, List.of(advancement), Set.of(), Map.of(identifier, progress));

    ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection;
    connection.send(packet);
    connection.send(removePacket);
  }
remote swallow
#

for a toast message? or just a custom advancement

lost matrix
#

Just the toast message on the top right corner

tardy delta
#

doesnt alex have a lib for those toast messages

lost matrix
#

So adding an advancement and then instantly completing it

ivory sleet
#

and debugging where u use epsilon for instance

tardy delta
#

hmm?

#

to check for integrity for example?

lost matrix
remote swallow
#

one moment

ivory sleet
#

well epsilon is a special type of gc that doesnt really free memory

remote swallow
tardy delta
#

ah

ivory sleet
#

and problem with weakhashmap is also that it just doesnt prevent gc, like assuming gc doesnt sweep for a while (which can be the case for some gcs wherre it doesnt happen for a longer time), then the object can be strongly reclaimable also

lost matrix
opal juniper
#

roasted

#

ive defo seen it done tho... hmm

humble tulip
tardy delta
#

yes?

ivory sleet
#

for some time yes

humble tulip
#

Until cancellation?

tardy delta
#

as long as they are scheduled ig

ivory sleet
#

ye minion

quick sail
#

Do any of you guys have a good reference that goes in depth on the garbage collector

humble tulip
#

So i can put bukkittasks in a weakhashset to cancel the ones that haven't been cancelled?

quick sail
#

I have a rough idea but my brain doesnt work unless I fully understand things

lost matrix
#

Else they would just vanish into oblivion

lost matrix
quick sail
#

I wish it was so easy

ivory sleet
#

there are like 7 gcs in total

#

and so many options

#

like jvm flags

quick sail
#

yeah i know

#

but like, I need to understand

humble tulip
#

So what i really wanna know is if it's psossible for currently shceduled tasks to be gced

#

You said bukkit keeps a reference so i assume it isn't

tardy delta
#

should look into those different types of gc

#

i only know minor and major 💀

ivory sleet
#

other ones are redundant for u rn i think

quick sail
#

I guess I'm just trying to understand what the inherent flaw would be with storing references to player objects in regards to the garbage collector

#

that storing references to "RPGPlayer" objects wouldnt have also

tardy delta
#

ZGC performs all expensive work concurrently, without stopping the execution of application threads for more than 10ms 10ms 😳

ivory sleet
#

its configurable but ye

final monolith
#

As i know, the default bukkit api doesnt supports

#

Title creation with base components

wet breach
quick sail
#

Okay I think I got you, to clarify if I create an RPGPlayer object when a player joins, I'd have the same exact issue if I didn't clean it up on disconnect

wet breach
#

But so as long a single reference is held the gc cant collect it and dispose of it

wet breach
quick sail
#

or is that still me misunderstanding

#

okay yeah that I think makes sense

quaint mantle
#

is a barrel a tile entity?

#

was like a 10 second search nvmö

rotund ravine
#

Should be

#

?jd-s

undone axleBOT
rotund ravine
#

Any block storing data is a tilentity

wet breach
wet breach
# quick sail okay yeah that I think makes sense

Feel free to ask more questions. Plenty of us here who are well versed. You can store a player object reference just really need to be careful and since it is easy to lose track where you have references, it is the reason we always recommend not storing the player object and instead uuid since that is still unique and can be used to obtain a valid player object if it is needed

quick sail
#

Yeah I've already decided I'm going to go the UUID route, just makes more sense in every way.

#

I'm mostly self-learning to code and really trying to focus on doing things the right way

wet breach
#

Well at least you are smart enough to actually seek out those who may know the answer instead of just assuming lol

rotund ravine
#

And asking in a coherent and polite way

wet breach
#

And that too

quaint mantle
#

how do i set a block with a pdc

#

or well a tile entity

regal scaffold
rotund ravine
#

?pdc

rotund ravine
#

Not sure if this mentions it

quaint mantle
#

i find nothing online about it what so ever

#

nvm its in there

buoyant viper
sullen marlin
#

Json format, same as /tellraw is always an option

quaint mantle
#

i think im gonna go insane

#

why is this so complicated

#

nothing makes sense

#

pls help

tender shard
#

?blockpdc

undone axleBOT
regal scaffold
#

Alright thanks

lost matrix
# tender shard for blocks you can use CUstomBlockData

Yo alex, maybe you got an idea what im missing here. Im trying to send a toast message by simply adding it, sending
a completed progress in the same packet and sending a removal packet afterwards.

  public static void sendAdvancement(Player player, ItemStack icon, Component title, FrameType frameType) {
    DisplayInfo displayInfo = new DisplayInfo(icon, title, Component.literal(""), null, frameType, true, true, false);

    Criterion criterion = new Criterion();

    AdvancementRewards rewards = AdvancementRewards.EMPTY;
    String[][] requirements = {{criterionId}};
    Advancement advancement = new Advancement(identifier, null, displayInfo, rewards, Map.of(criterionId, criterion), requirements);

    AdvancementProgress progress = new AdvancementProgress();
    progress.update(Map.of(criterionId, criterion), requirements);
    progress.grantProgress(criterionId);

    List<Advancement> advancements = List.of(advancement);
    Map<ResourceLocation, AdvancementProgress> progressMap = Map.of(identifier, progress);
    ClientboundUpdateAdvancementsPacket packet = new ClientboundUpdateAdvancementsPacket(true, advancements, Set.of(), progressMap);

    ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection;
    connection.send(packet);
    //connection.send(removePacket);
  }

The advancement is there but i dont get a toast (presumably because the progress is not properly completed)

quaint mantle
#

Hey, been a while since I've done anything Minecraft related, I can't seem to build my plugin using the shade:shade goal, saying Failed to create shaded artifact, project main artifact does not exist.

I'm not sure what could cause this, any info would be greatly appreciated

quiet ice
#

Use package instead

quaint mantle
#

That doesn't put all the libraries in, right?

quiet ice
#

Assuming you have set up the maven-shade-plugin correctly

#

send the pom

quaint mantle
#

Sent you a friend request

echo basalt
#

what if you add a trigger to your criterion

quaint mantle
#

If I run package -f pom.xml i'll run into ClassNotFound exceptions

quiet ice
#

what the friggn hell

granite owl
#

can anyone confirm that the JNI's jni.h header wrongly includes the jni_md.h file under the windows 64 bit version of literally any jdk version? xD

quiet ice
#

The JNI header has traditionally been broken. So could be.

granite owl
#

xD

wet breach
#

you need to include the appropriate directory which is platform dependent

granite owl
#

from my jdk, the jni_md.h is under the win32 sub directory and the jni.h

#include "jni_md.h" without the sub dir

#

and this is since jdk 9 or so

wet breach
#

include the appropriate directory....

#

which again is platform dependent hence why it isn't there automatically

granite owl
wet breach
#

if you don't want to bother with compiling it yourself then get a precompiled binary

quiet ice
#

It's a header ... you don't compile a header

wet breach
quiet ice
#

I'd just edit the header so it works and if it works it works

granite owl
#

xD

wet breach
#

its safe to edit the header since it is platform dependent anyways

#

that is, whatever it is you are targeting that binary will only work for that platform or similar possibly

granite owl
#

also i installed it from the PUBLIC jdk installer, and the header is licensed as confidential lmao ive already reported this to oracle a year ago with the jdk 18 and they still didnt fix it

quiet ice
#

I mean with JDK 18 you probably want to use panama instead

granite owl
#

17*

#

but still

#

how can it happen that they publically release something marked as strictly propritary and confidential

wet breach
#

because header is only needed for compiling it isn't strictly needed depending on what you are doing

echo basalt
#

@lost matrix why are you setting the clearCurrent field to true? that resets advancements

#

might be why

granite owl
granite owl
wet breach
#

and that means it can't have something proprietary?

granite owl
#

no but its not marked as confidential and NDA'd

#

xD

wet breach
#

individual files can have their own licenses attributed to them that is separate from the entire project

lost matrix
lost matrix
#

Makes no sense, but thanks for the input

granite owl
echo basalt
#

I'm magical

#

my thought was like

#

you're setting the data and wiping it all away

quiet ice
lost matrix
echo basalt
#

well you're wiping away all the progress

#

because advancements are only registered once

wet breach
granite owl
granite owl
wet breach
summer scroll
#

I tried to give spawner with different entity but it will turn into a pig spawner when I placed it down even If I try to give myself an iron golem spawner.

    public static ItemStack createMobSpawner(EntityType type, int amount) {
        ItemStack stack = new ItemStack(Material.SPAWNER, Math.max(amount, 1));
        BlockStateMeta bsm = (BlockStateMeta) stack.getItemMeta();
        CreatureSpawner cs = (CreatureSpawner) bsm.getBlockState();

        cs.setSpawnedType(type);
        bsm.setDisplayName(SodeSpawners.color("{type} Spawner"
                .replace("{type}", SodeSpawners.capitalizeFully(type.name().replace("_", " ")))));
        bsm.setBlockState(cs);
        stack.setItemMeta(bsm);
        return stack;
    }
granite owl
summer scroll
#

Oh really? I didn't know about that lmao.

granite owl
#

otherwise its always defaulting to a pig spawner with empty metadata

summer scroll
#

What would you suggest If I want to give players sheep spawner for example?

granite owl
#

that u cancel the event

#

and place it with ur plugin

#

thats what i do

summer scroll
#

But I'm op and it still turns into a pig.

young knoll
#

Manually add the data from the ItemStack to the placed blockstate with the place event

granite owl
#

then ur format is broken

#

somehow

granite owl
#

that would prevent the block from getting removed and re-placed

summer scroll
#

Alright, I'll do that, thanks guys!

granite owl
#

also @summer scroll try using an online spawner generator that creates a give command just to verify it works at all xD

#

then u know that something in ur format went wrong

young knoll
#

You would also have to copy the data into an item in the break event

#

Assuming you want to pick them up with silktouch or whatnot

summer scroll
#

Yeah, I'll remember that.

granite owl
#

that i did with cancelling the drops and instead dropping the spawner block if the item is a pickaxe with silk touch

#

i mean thats how i made spawners mine-able

#

in the blockbreak event i think

young knoll
#

I wonder if you took every spigot plugin ever made

#

What event is used the most

lost matrix
#

You mean as in declared the most or used most amount of times during runtime

quaint mantle
#

interesting

young knoll
#

Declared the most

quaint mantle
#

i think he mean in declared

#

brock break ?

lost matrix
#

Declared i would say InventoryClickEvent

quaint mantle
granite owl
#

onCommand

#

🐒

lost matrix
#

Because everyone want to add guis nowadays

quaint mantle
#

or intract

#

interact*

#

bruh im so bad

lost matrix
#

@austere cove ban pls

young knoll
#

Yeah inv click seems reasonable

remote swallow
#

you know what we can do

#

make optic run a server with all spigot plugins and run spark

granite owl
#

tbh im astounded by how many times i asked how to write my own command completer and ppl told me it doesnt work

#

when i finally learned how to dig trough apis and their docs

young knoll
#

As for called the most during runtime imma guess block physics

granite owl
#

theres literally onTabComplete as member of JavaPlugin

remote swallow
lost matrix
#

Who told you that it doesnt work?
Sounds like someone who has no idea about Spigot.

granite owl
lost matrix
granite owl
#

as in having a class inherit BukkitCommand and register that?

remote swallow
#

command class extends/implements TabExecutor and you can do it there

echo basalt
remote swallow
granite owl
#

why cant i just have one main onTabComplete and switch trough the command.Name().toLowerCase()

in java strings in switches are hashed anyways

remote swallow
#

you can, nothing stops you

river oracle
granite owl
#

as such there shouldnt be a performance penalty

remote swallow
#

its just not recommeneded

#

and can get long as hell

river oracle
remote swallow
#

is 7smile having a stroke

granite owl
#

xD

#

before i actually write my plugins i first need to finish my importer for my ini parser (the jni thing) xD

#

and probably need to find a dedicated server provider since every mc provider is not all too keen of allowing me to use binaries

echo basalt
#

just rent a vps

lost matrix
granite owl
#

its not a terrible format lol

#

its a simple format

#

a simple format for simple config files

echo basalt
#

this is micro optimization at its worst

#

you can do byte parsing in java, manually

#

basic readInt readWhatever, there's no need for jni

granite owl
#

my parser is written to be loaded in various languages, ive finished my c, c++ static and dynamic importers

#

working on the c# and java rn

#

and more to come at time

quiet ice
lost matrix
#

The performance is more limited by your hard drive than the language for file IO

granite owl
#

its written in c++ with all the neccesseary memory management and error handling incl. handling bad allocs internally

#

its not running on asm speed lvls anyways

lost matrix
#

Meh. If you really like tinkering with that then go ahead.
But there is nothing to gain but trouble with this.

granite owl
#

like i said one lib can be loaded from various languages

#

one code base for multiple langs

quiet ice
#

I always wanted to write a machine code generator lib in java.
Should do it for maximum speed (Yes - nasm exists; but why not generate those executables at runtime?).

granite owl
#

its for me in the first place

#

if ppl think its a terrible product honestly idm ill release it under the MIT license and while its ofc good to listen to critics

#

in the end its free

lost matrix
granite owl
#

so if ppl dislike it its not like id lose money since i didnt ask for anything in the first place 😛

quiet ice
#

I'm talking about implementing a machinecode assembler in java

#

probably already exists though

granite owl
#

why exactly

#

would u want to write a compiler in java

quiet ice
#

Not compiler - assembler.

lost matrix
#

A compiler i would understand

granite owl
#

i dont think its even possible with pure java

#

iirc ghidras GUI is in java and the decompiler/compiler and disassembler are in C++

lost matrix
#

Fun fact: The java compiler (javac) is written in java

tardy delta
#

me who wanted to create some custom bytecode interpreter in java :(

quiet ice
granite owl
quiet ice
#

I mean it is just writing a file

#

How hard can it be (outside of reading a LOT of documentation)

next plume
#

You can write an assembler in any language.
I wrote a disassembler in Ada once.

granite owl
#

the hardest will be to read trough the standards how to format ur binaries so that the machine instructions can be read and then u need to have an engine that translates the developers nonsense in primitive usually cisc instructions

tardy delta
#

isnt that just the job of a parser?

quiet ice
#

The binary formatting/packaging will be the biggest pain

granite owl
#

so u need to understand how languages in general work on a basic level

lost matrix
#

Its all just GOTO in the end kappa

quiet ice
#

Jars are so much simpler on that front

granite owl
#

java bytecode will prob be alot easier since oracle could basically define their own instruction set

quiet ice
#

Java bytecode is incredibly easy

granite owl
#

its still terrible to read imo🤣

quiet ice
#

But I've been extensively working with it for the past two years so ...

lost matrix
#

jvm

wet breach
#

lets see how long it takes them to learn that JNI doesn't get optimized by JIT or anything else in Java

granite owl
#

i like that jar files always include a copy of the source code by default

#

alongside the bytecode

#

🤣

granite owl
#

ya eclipse

#

though i switched to intellij recently

lost matrix
granite owl
#

since my eclipse broke upon trying to update it

quiet ice
#

I just delete the eclipse install folder and start from scratch if there is a serious fault

tardy delta
#

eclipse moment

paper venture
#

I have an entity, I want to deal damage considering entity's armor, how should I do it? Yes there is a formula on wiki, but is there a way without manually calculating this damage?

glossy venture
quiet ice
#

But I have only encountered such a scenario once (which was a CDT install so not that important anyways)

lost matrix
granite owl
#

the moment i dumped eclipse was when i installed the 2023 version and got a warning that there are unsigned dependencies from google and oracle and i must allow to install from unknown sources in order to install eclips

#

that was my fk it moment

quiet ice
#

I mean coredumps are powerful given that they include the entire state of the machine at the time it crashed.
But you need to correct tooling for it

quaint mantle
#

does this even work? im tryna find out if my mistake is in creating or reading the pdc

quiet ice
paper venture
lost matrix
paper venture
#

If I'm not mistaken it does...

granite owl
lost matrix
lost matrix
#

Listen to the EntityDamageEvent, get the final damage and cancel the knockback then

granite owl
#
  • my prof suggested intellij anyways for this semester so whatever
#

🤣

lost matrix
#

Then you got an up-to date prof.

#

Fk frostalf sniped me

#

Was about to bring up Netbeans

granite owl
#

xD

granite owl
#

i got a university license for clion and intellij

quiet ice
#

Are you deep in writing maven plugins or something else?

granite owl
#

so i was like sure whatever

hazy parrot
#

Currently working with netbeans at class, this autocompletion is awful

wet breach
granite owl
wet breach
#

bloated?

granite owl
#

external 3rd party apis

#

like it has so many settings

hazy parrot
#

Why would you auto update libraries lol

wet breach
#

you do realize maven at its core is slim, it only bloats the more plugins you decide to toss into the pom

quiet ice
#

Wait until you see make

granite owl
hazy parrot
#

Gl when getting breaking change in minor update

granite owl
#

xD well the ide will show me where

wet breach
#

not if you are using JNI

floral drum
quiet ice
floral drum
wet breach
#

I get the feeling you been waiting this entire time to finally use that

floral drum
#

nah I use it often

wet breach
floral drum
#

pycharm!

granite owl
floral drum
#

or whatever its called

tardy delta
#

atleast college is up to date and not using java 8 anymore

#

we are on 17 now

floral drum
#

woo 17

tardy delta
#

im actually on 19 but nobody cares

quiet ice
wet breach
granite owl
#

our prof said he doesnt care which jdk we use since we work with the basic features only that exist since java 9 or so

floral drum
#

we love virtual threads!!

tardy delta
#

we were using bluej in the first semester so its a good improvement

granite owl
#

so im using the jdk 20

#

🐒

wet breach
#

however, java 17 has unix sockets

#

so that is a plus to use that

tardy delta
quiet ice
#

The biggest thing about modern java is that classloaders have names

granite owl
#

as long as java doesnt change like .NET 6+

#

where the main class and namespace are hidden

#

and make it look like u code in the global scope

tardy delta
#

java modules :)

granite owl
#

🤣

tardy delta
#

then realizing it fucks with your reflection

quiet ice
granite owl
#

;-;

wet breach
granite owl
#

well i mean a plugin is ofc different to a java program

quiet ice
#

Project leyden might be fun for modders and valhalla might brick quite a few libs depending on how it is implemented and other things

granite owl
#

when ive written a plugin api in c++ for a different project i adapted bukkits mechanics

#

idk if that was so smart tho

#

plugins as .dll

wet breach
#

it wasn't

granite owl
#

xD

wet breach
#

there is a lot of things in bukkit that were designed purposely flawed

granite owl
#

yea i figured

quiet ice
#

Bukkit's event bus isn't that great I have to admit

granite owl
#

thats why i changed from a pure event driven system

#

to utilizing an entry point

wet breach
#

well event driven system is more ideal

granite owl
#

i mean i used both

quiet ice
wet breach
#

since most of everything is derived from player input whether directly or indirectly

granite owl
#

well i mean if u view a dlls entry point as onLoad

#

it could prob be seen as an event

#

but its more versatile

wet breach
#

well the only alternative that could work is a subscribing system

tardy delta
#

isnt that the bukkit way?

granite owl
#

i think

paper venture
#

is jump effect the only way to prevent player from jumping?

wet breach
#

no, bukkit is events and it will send out an event regardless of who is listening

granite owl
#

i did use events tho

#

i let the plugins notify the loader to add their function pointer to an array that was then being iterated

#

or remove their function pointer

#

to unregister the plugins event

tardy delta
#

in a subscription system, if you sent an event and there are no listeners, isnt the event discared too?

quiet ice
#

That sounds more like C than C++

granite owl
#

in which i adapted bukkits mechanics

#

on how to do things

quiet ice
#

Yes but using function pointers and storing them in arrays sounds very C.

wet breach
granite owl
#

i did iterate the array in assembly

#

im not gonna elaborate why tho

#

🤣

tardy delta
#

i have no idea what the dif is actually

granite owl
#

u cant iterate c++ objects in inline assembly

#

but u can iterate primitive C arrays by index

tardy delta
#

i did some array iterating stuff in my weird language thing

granite owl
#

so the overlaying system was c++ with a mix of c and assembly to iterate the registered events

tardy delta
#

its kinda weird tho

granite owl
#

whats that

quaint mantle
#

so what is the problem now the creation or the listener

tardy delta
#

wanted to make some kind of assembly/ bytecode looking like lang but i regret making the syntax look like that

granite owl
#

basically if u wanna iterate an arrays entires on byte level u do ```txt
(startingAddress + (index * sizeof(array data type)))

tardy delta
#

thats what i did

quaint mantle
#

another dumb quastion but how i can run a bukkit command in a async event ?

i tried

Bukkit.getScheduler().callSyncMethod(Mco.getPluign(),() -> p.getWorld().spawnEntity(p.getLocation(), EntityType.CAT));
#

and

#
new BukkitRunnable() {
            @Override
            public void run() {
                p.getWorld().spawnEntity(p.getLocation(),EntityType.CAT);              
            }
        };
#

but none of them worked

tardy delta
#

i only fucked up at the sizeof(type), it worked before but then i decided to change the impl and it didnt longer work :(

chrome beacon
#

?scheduling

undone axleBOT
tardy delta
#

uh oh manually instantiating bukkitrunnables

quaint mantle
#

anyone know how i can find out of my barrel creation actually added the pdc

tardy delta
#

🩴

#

here it is

hazy parrot
quaint mantle
#

well whats the easiest way

chrome beacon
#

It would probably show up in the data command

granite owl
#

btw when did vanilla mc add the feature of adding a teams prefix and suffix

opal juniper
granite owl
#

no i mean via a vanilla team command

chrome beacon
#

ah 1.13 is the earliest I can find on the wiki

opal juniper
#

also it is better practice to store NamespaceKeys as like a static thing somewhere

wet breach
granite owl
#

thats still along time ago xD

wet breach
#

nothing too hard there

quaint mantle
# opal juniper what isnt working

well nothing is really. the block does get created but my listener doesnt cast ig(onbreak). I dont know if the listener is wrong or the commannd doesnt add the pdc

granite owl
#

isnt the loop counter in the cx register?

#

🤔

#

iirc cx is both loop counter and return value

opal juniper
granite owl
#

whereas ax and bx are arithmetik and boolean logic

#

and dx is universal

left depot
#

How to add custom ID's to blocks, (Im working on a miner robot system) so that players can upgrade their miner robot lvl etc?

chrome beacon
#

It doesn't change

opal juniper
#

i said that

opal juniper
#

is your listener running?

granite owl
quaint mantle
wet breach
granite owl
#

check if its 0

#

jump if not equal loop1

wet breach
#

why check if its 0?

opal juniper
wet breach
#

we wouldn't be iterating if it was 0

granite owl
#

ur using a decrementing loop dont u?

wet breach
#

that isn't a decrementing loop

granite owl
quaint mantle
granite owl
#

then compare ax to 0

opal juniper
left depot
undone axleBOT
wet breach
left depot
#

so how should i do that?

quaint mantle
granite owl
wet breach
#

what I posted is correct

granite owl
#

also im pretty sure the loop counter is in cx

#

it is if ur using a 2.nd label u didnt show here

wet breach
#

cx can hold the counter

#

its not the only register that could

#

or can

granite owl
#

i swear it was such a pain in my ass when i started

#

and had a corrupted stack

#

cause i didnt know cx stores the return value

#

🤣

wet breach
#

EAX, EBX, ECX, EDX, ESI, and EDI these registers are safe to use without restoring them to original values

granite owl
#

stolen bytes cough

opal juniper
#

i would reccommend attaching a debugger

wet breach
#

no doesn't depends. C++ or C has no expectation that those registers will ever remain the same or should be reverted

#

however those are not the only registers you could use

#

just those are the guaranteed safe ones

quaint mantle
granite owl
#

funny to even find someone who digged trough assembly nowadays

opal juniper
#

ok. still, use a debugger

granite owl
wet breach
granite owl
wet breach
#

AX is 16bit

#

order from greatest to least, EAX, AH, AL, AX

granite owl
#

from chatgpt

wet breach
#

AH and AL are technically part of AX

granite owl
#

for 64bit register

wet breach
#

but you can split AX to get AH and AL

granite owl
#
In x64 assembly, registers are 64 bits wide, and they are denoted with a "R" followed by a number. Here are some examples of x64 registers:

RAX
RBX
RCX
RDX
RSI
RDI
RBP
RSP
#

R prefix

#

idk if gpt is right but i doubt its wrong with such a standard

tardy delta
#

64 bit counter kek

#

i asked it assembly and it told me weird stuff so idk

wet breach
#

it is better to use 32bit sets unless you need 64bit

granite owl
#

i want 2^256 gold in my game

#

🐒

#

i think thats the main reason why most mmos use copper silver gold for currencies tbh

#

xD

tardy delta
#

wait we are still using the x86 instruction set today right?

granite owl
#

depends

wet breach
#

yes

tardy delta
#

i clearly didnt learn 64 bit registers exxisted then

granite owl
#

on the target system u compile it for

#

the architecture

#

but just because u compile for 64bit it doesnt mean u everything must be 64bit

#

but for example pointers will be

quaint mantle
tardy delta
#

ok i was confusing things

wet breach
granite owl
#

^^

#

🤣

#

star chitizen

tardy delta
#

storing addresses in ints 🤓

#

thats what i did

granite owl
#

🤣

wet breach
tardy delta
#

but i was only allocating 64 bytes for my program so no problemos

granite owl
#

thats what i do to store my pointers on javas end

wet breach
#

so it is valid to still learn x86 but worth to also learn AMD_64

granite owl
#

i mean

tardy delta
#

and arm is another thing then

granite owl
#

theres hardly much difference between learning the difference between 16bit to 32bit

#

and 32 to 64

#

its just larger

wet breach
#

there is a big difference

granite owl
#

as in being able to address more memory etc?

#

larger numbers

#

etc etc

tardy delta
#

instruction encoding?

wet breach
#

while yes larger numbers, there is still major differences especially in how things are done

granite owl
#

or wdym

tardy delta
#

oh god dont tell me my brother is going with the vacuum cleaner through his ps3

#

man never heard of discharge

granite owl
#

did he wash it appropiately before

#

under the shower?

tardy delta
#

he cleaned it with water

granite owl
#

🐒

tardy delta
#

dont ask me what that dude is doing

granite owl
#

imean u can clean it with watee

tardy delta
#

controller was laying outside and in the meanwhile it rained 💀

chrome beacon
granite owl
#

technically u can

#

🤣

chrome beacon
#

The PC is going strong after 10 years

tardy delta
#

brrrrr

left depot
#
Block block = event.getBlock();
block.setType(Material.AIR);
block.getWorld().dropItemNaturally(block.getLocation(), new ItemStack(Material.PURPUR_BLOCK, 1));
event.setCancelled(true);

how to add a custom name to this blockdrop?

tardy delta
#

my laptop is already slow asf and i only got it half a year

#

imma reinstall windows ig

granite owl
#

i did clean my old pc once with a vacuum cleaner, afterwards it had random bsod's due to i presume a static discharge from the cleaner to the hardware. lesson learned but i was just dumb and like 15 back then xD

tardy delta
#

lmao

#

i had a bsod when discord crashed

granite owl
#

now to even open my pc casing

left depot
#

#general

granite owl
#

i put it and hardware it and myself to the heading pipe

tardy delta
#

💀

granite owl
#

and put it on a esd protection mat

left depot
tardy delta
#

oh man he removed the backside of it and is going though the ventilator with the vacuum cleaner

#

gotta make sure its clean 💀

granite owl
haughty storm
#

How can I save the mobdata of an entity and spawn an entity with the same data?

granite owl
wet breach
left depot
haughty storm
tardy delta
#

no clue, he got it second hand so it wont be the best quality at least

granite owl
tardy delta
#

stop thinking in c++

#

🤓

granite owl
#

and thats hardly easier

#

but idk how mobs are stored exactly as that prob involves alot of nms too

twilit roost
#

Bullet extends Snowball
[NMS]

    int postDeathTicks = 0;
    @Override
    public void tick() {
        if (shotFrom == null) {
            super.tick();
        }else {
            double distanceTraveled = shotFrom.distanceTo(this.position());
            if (distanceTraveled >= maxDistance) {
                postDeathTicks++;
                this.setDeltaMovement(0,-1,0);

                if(postDeathTicks >= 50){
                    this.remove(RemovalReason.DISCARDED);
                }
            }else {
                super.tick();
            }
        }
    }

Im trying to achieve Bullet drop, but instead of it going down, it just starts teleporting around before removal

granite owl
#

because u set it by -1

#

u need to deltatime the movement

#

otherwise if it teleports randomly around then theres another problem idk there yet

twilit roost
#

how do I delta time it
and I thought -1 on Y would make it down

granite owl
#

by measuring the real world elapsed time and multiply that by the movement?

quaint mantle
# quaint mantle ``` new BukkitRunnable() { @Override public void run() {...

can someone give me a quick example of how to run a bukkit method in a async event ? i tried everything but it just dosent work

Bukkit.getScheduler().runTaskAsynchronously(Mco.getPluign(), new Runnable(){
            @Override
            public void run() {
                p.getWorld().spawnEntity(p.getLocation(), EntityType.CAT);                
            }
        });

i wanna summon a mob on chat event

tardy delta
#

go back sync

#

with another scheduler call