#help-development

1 messages · Page 999 of 1

blazing ocean
#

it provides you with a hash - but you have to reupload it for changes, gives you a different url

tall saffron
#

but it says i need a mcmeta

#

and i have one

blazing ocean
#

server.properties

dire marsh
#

make sure pack.mcmeta is at the root of your .zip

blazing ocean
#

oh yeah

#

i thought they meant to put it in their server config

dire marsh
#

also please provide a hash

#

it's super bad user experience not to

blazing ocean
#

also, if you're doing that - just scrap doing it via plugin, and rather do it via the server.properties

tall saffron
#

i zipped it wrong lol

blazing ocean
#

personally i use my custom cdn, or just a file host and upload my pack there, then hash it on server load

tall saffron
#

like it was inside the zip a folder then the resource pack

tall saffron
#

I will do the hash manually as if i update the resource pack i will also have to publish it anyway 🤷‍♂️

harsh ruin
#

Quick question, does this check if the held item is null?

dire marsh
#

your ide is warning you, hover over it

hazy parrot
#

If its null, calling equals on it will throw npe

dire marsh
#

not just that, they're calling gettype on what might be null

tall saffron
#

How do i put the hash in my code?

hazy parrot
#

What

tall saffron
#
@EventHandler
    public void playerEntered(PlayerJoinEvent event){
        Player player = event.getPlayer();

        String texturePack = "https://download.mc-packs.net/pack/63af22dfb70aab544ae338f8687bf17d8423761a.zip";

        player.setResourcePack(texturePack,63af22dfb70aab544ae338f8687bf17d8423761a, "Please download this resourcepack for Legendary Swords to work!", true);
    }```
blazing ocean
#

string

tall saffron
#

oh yeah and .getbytes

#

Thanks allot

blazing ocean
#

although having a plugin depend on its own pack can cause all sorts of issues

#

like pack conflicts, as it overwrites the server pack

#

version issues

harsh ruin
blazing ocean
harsh ruin
#

.isEmpty()?

dire marsh
tall saffron
glad prawn
tall saffron
#

I think making the server owner put manually the resource pack as the server resource pack is a bit much

harsh ruin
#

Thanks for helping though

tall saffron
#

Also it tells me my hash has to be 20 bytes and i think the mcpack.net generated is like 40

dire marsh
#

that method is weird from what i remember

warm mica
brittle geyser
#

I broke intellij and now i cant push files into github.
What i should do?

wet breach
dapper flower
brittle geyser
dapper flower
#

did you try forking something? maybe a merge conflict? does it say "failed to push unreleated histories" or smth

dapper flower
#

"it broke" is a bit too generic

dapper flower
#

study how merge and rebase work with git and you should be fine

blazing ocean
sterile token
#

Hii, what wrong with my method? Sections are not being created and i dont understand why

@Override
    public void set(String path, Object value) {
        if (path == null || path.isEmpty()) return;
        int index = path.indexOf(".");
        if (index != -1) {
            Object object = this.values.get(path.substring(0, index));
            //if (!(object instanceof ConfigSection)) return;
            newSection(path.substring(0, index)).set(path.substring(index + 1), value);
            System.out.println("section= " + path.substring(0, index) + " created");
            return;
        }
        if (value == null) {
            this.values.remove(path);
            return;
        }
        if (value instanceof Map) {
            //
            return;
        }
        System.out.println("route=" + path + " created");
        this.values.put(path, value);
    }```
wet breach
#

you are trying to store an object without serializing it

sterile token
wet breach
#

ok but your example is using two strings

#

not a string and an object

sterile token
#

what? Im confused sorry

#

the problem is that the section system does not work, because when you indicate a set a route within a section, it does not create the section or parent section nor the route within that section. Do I explain better now?

#

That is exactly the issue Frost

brittle geyser
#

Section is map i think

sterile token
hushed spindle
#

what was the link to spigots patch changes again

#

need to know what Particle.REDSTONE has been replaced with

wet breach
sterile token
# brittle geyser what u want to code?

a section-based configuration system. It allows the creation of configuration values, configuration sections, and configuration settings. Like the spigot system does, but I do it because I need it to be platform independent (works no matter if I use Spigot or Bungeecord api).

wet breach
#

because here in this method you are using generics and you can't expect generics to magically work

sterile token
hushed spindle
#

anyone know what Particle.REDSTONE was replaced with in 1.20.5

chrome beacon
#

?jd-s

undone axleBOT
hushed spindle
#

is it just DUST now or what

chrome beacon
#

yes

hushed spindle
#

ah cool

chrome beacon
#

or DUST_COLOR_TRANSITION if you want it to be changing colors

hushed spindle
#

ooo fancy

charred blaze
#

then what is it

sterile token
hushed spindle
#

im confused what happened with the explosion particle type, there were previously 3 different sizes for explosion and now theres just EXPLOSION and EXPLOSION_EMITTER

#

what do you do to control the size of it

#

no datatype is documented for it

brittle geyser
#

Why .gitignore is not working

valid burrow
#

hard to tell without your gitignore

#

lmao

chrome beacon
#

you need to git rm them

brittle geyser
#
# Gradle
.gradle/
/.gradle
**/gradle/
**/build/
!src/**/build/
chrome beacon
charred blaze
#

hey the spawned item sometimes changes direction of rotation

frail pilot
charred blaze
frail pilot
#

Depends x)

#

Depends of your studies and your country I guess

short drift
#

Is it possible to define custom translation strings in the language files? Eg.
"custom.potatoes.in.farmland": "Potatoes growing in farmland. "

#

I tried

var inspectionText = new TextComponent(new TranslatableComponent(translationString));

But it didn't work.

frail pilot
#

Maybe with a ressource pack

short drift
#

Well, yes. I tried it with a resource pack.

charred blaze
#

i mean it changes rotation direction

#

and in a few moments it changes back

frail pilot
#

Elgar used 181 degrees to make it rotate

#

Might be because of that

blazing ocean
#

don't explicitly create a text component

sour mountain
#

I'm making a plugin that uses money so players can hold money and send money and stuff, what would be the best way to store how much money each player has? I was just going to use a variable but all the variables in the plugin reset when I reload the plugin and I need it to remember how much money everyone has

charred blaze
#

or?

frail pilot
#

I fairly don't know

#

The whole thing is a bit messy

short drift
blazing ocean
blazing ocean
frail pilot
#

Afaik, it's a linear interpolation between the previous matrix and the new one

#

Try 179 degrees maybe

#

Might fix it

short drift
#

Mind you it's a completely custom string and not part of Minecraft.

blazing ocean
#

i think only adding it to en_us is enough

#

how are you sending it?

short drift
blazing ocean
#

to the player

short drift
#

player.spigot().sendMessage(inspectionText);

tardy delta
blazing ocean
#

that looks fine

short drift
tardy delta
#

never heard of

blazing ocean
charred blaze
charred blaze
blazing ocean
short drift
#

Ok, so doing:

var inspectionText = new TranslatableComponent("custom.potatoes.in.farmland");

Should work in theory?

blazing ocean
#

yes

#

the issue should be on your pack side

short drift
#

Oh. So I might need to move that into its own namespace?

blazing ocean
#

try it, just going through mypack atm

short drift
#

Do they need to be prefixed, eg. mynamespace:custom.potatoes.in.farmland?

blazing ocean
#

nope

frail pilot
storm crystal
#

I have a question about PDUs

#

if I want to ensure that they are applied

charred blaze
storm crystal
#

Id have to pass ItemMeta meta to them, not ItemStack item and take meta from that stack, right?

frail pilot
# charred blaze ok

I think the "cleanest" way to do it is:

  • rotate is up to 179 degree
  • reset the transformation by applying without interpolation the default one
  • Repeat the process
short drift
# blazing ocean nope

Okay, I tried moving them to their own namespace. But that made no difference. How would it find it in the correct namespace without prefixing it with the namespace, though?

short drift
#

I tried prefixing it, but that didn't work either.

frail pilot
#

Nope

short drift
#

All the default Minecraft translations work, though, with TranslatableComponent.

blazing ocean
lilac dagger
#

can you teleport block displays?

#

i'm considering using block displays instead of falling blocks for hide and seek

sterile token
#

Could someone link me about new things called translatable i wanna learn about them. Tahnks

frail pilot
charred blaze
# frail pilot Nope

so what do you mean by "reset the transformation by applying without interpolation the default one"

frail pilot
#

Each time in the runnable

#

You first apply the default transformation after setting the interpolation duration to zero

#

Then you call inside the runnable scheduler.runTask()

#

With the previous scheduler inside

#

To do it on the next tick

kindred sentinel
#

is there any way to get body's rotation?

charred blaze
frail pilot
#

No

#

Duration

charred blaze
#

but i need the duration to be set to some value

#

the rotation speed

frail pilot
#

To apply the default transformation instantly

#

Yeah

#

Wait I'm playing valorant I anwser you after the game x)

charred blaze
#

oh ok

#

code currently looks like this

quaint mantle
#

hi guys is there any bug with spigot plugin in 1.20,5?

chrome beacon
#

(and ask a question that makes more sense)

valid burrow
#

is there an event for when a villager cancels the breeding process or villager breeding in general

frail pilot
#
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
  entity.setInterpolationDuration(0);
  entity.setTransformation(defaultTransformation);
  Bukkit.runTask(plugin, () -> {
    /* insert the content of the previous runnable */
  });
}, speed);
#

Something like that

charred blaze
#

like this?

frail pilot
#

Yes

charred blaze
#

ok lemme analyze this code a sec

sterile token
#

not realted but why for rotations you use radians? is it for something special

charred blaze
#

can we reset the transformation once current rotation ends instead?

charred blaze
frail pilot
#

It will just be harder with the code

charred blaze
#

ok ill test this one

restive mango
#

How do you check if an EntityType would implement the Mob interface?

#

Without actually creating an instance of an entity of that entity type

charred blaze
#

another question. is this the part that does the actual rotation quaternion.rotateY((float) Math.toRadians(179))); or is this the one? new Quaternionf(0,0,0,1);

frail pilot
#

The first one

frail pilot
#

The second is useless it's overwritten

charred blaze
#

so i was just wasting time trying to understand Quaternions?

#

xd

frail pilot
#

x)

chrome beacon
#

They're still useful to understand

#

:)

valid burrow
restive mango
nova quail
#

how to get string from messages.yml file?

chrome beacon
#

?configs

undone axleBOT
charred blaze
#

i didnt say i understood it xd

nova quail
charred blaze
#

(i couldnt)

charred blaze
tardy delta
frail pilot
charred blaze
#

ok i can wait

restive mango
#

you're going to find this dumb, but how do I work with that?

#

like

#

im just confused how to figure out of 'java.lang.Class<capture<? extends org.bukkit.entity.Entity>' is of the Mob class

#

do i try to cast it?

ivory sleet
#

Mob.class.isAssignableFrom(otherClass) iirc.

restive mango
#

oh thanks

ivory sleet
#

could be the other way around, i never remember the order

restive mango
#

ill find out soon enuff

#

!

ivory sleet
#

!!!

tardy delta
#

should be called isAssignableWith

sturdy heron
sterile token
sturdy heron
#

everywhere

alpine urchin
#

have you not heard of radians?

sterile token
eternal oxide
#

I'll check

alpine urchin
sterile token
alpine urchin
eternal oxide
#

Nope no overlap

sterile token
#

Whats the difference between isSet and contains? Specific when working with spigot yaml api - Thanks

tardy delta
sterile token
#

im banned from spigot again

#

it seems that spigot anti proxy are working better now

#

either that or my proxy is working for the trash

ivory sleet
brittle geyser
#

What is it???

private static final CachedValue<BetterGUI> INSTANCE_CACHE = CachedValue.of(() -> (BetterGUI)JavaPlugin.getPlugin(BetterGUI.class));
public static BetterGUI getInstance() {
    return (BetterGUI)INSTANCE_CACHE.get();
  }
ivory sleet
#

a circle with a radius of 1 is interesting because it holds a lot of mathematical properties, relations and discoveries

ivory sleet
#

But rather useless

#

They probably wanted to erase the generic type, thus having some sort of dynamic/lazy resource loader

tardy delta
sterile token
eternal oxide
sterile token
ivory sleet
#

well degrees is not as mathematically convenient

charred blaze
#

so i should increase it?

eternal oxide
#

just quat.rotateY((float) Math.round(Math.toRadians(180))))); // right rotation will fix it

charred blaze
#

ok ill test it

sterile token
eternal oxide
#

annoying FP errors

charred blaze
#

yea it works

#

thank you

#

will test other axis now

eternal oxide
#

-180 = clockwise rotation

charred blaze
#

ok

#

is there direct method to make this display fly up and down like the dropped item does?

eternal oxide
#

you could add a sin of its rotation

#

to its height

#

or position

#

not sure how though

charred blaze
#

i could do it with some runnable?

eternal oxide
#

not really

frail pilot
#

Just add a translation to the transformation

eternal oxide
#

as its dependant upon the translation

charred blaze
#

can i just teleport the display up and down

#

something like that

#

with delay

eternal oxide
#

no

#

god no

charred blaze
#

why

eternal oxide
#

while it might work, it would be defeating the whole purpose of translations/transformations

#

let me have a think

charred blaze
#

well i didn't know you could make objects move with that other than rotating them

frail pilot
#

Just add a translation

#

And multiply by -1 each iteration

charred blaze
#

whats translation

frail pilot
#

In the transformation

#

newTransformation.getTranslation().set(0, 1, 0);

charred blaze
#

i mean

#

what is this

#

what can i do with it

eternal oxide
#

its the vector passed in the constructor

frail pilot
#

Translation is just ... a translation

#

You set it

#

It will go from the original point

charred blaze
frail pilot
#

To the point + specified vector

#

Oh

#

Let me grab the wikipedia page x)

charred blaze
#

and 0, 1, 0 would do one block above the original location right?

#

how would that create hovering effect?

frail pilot
#

Yep

charred blaze
#

aaaaa

#

i learned this in school

#

but in other language

#

xd

#

mb

frail pilot
#

x)

charred blaze
#

wow now it makes sense

frail pilot
#

First you set translation to (0, 0.5, 0)

#

It travels up

#

Then the next iteration of the runnable

#

You set translation to (0, 0, 0)

#

It will travel down

#

Boom

#

Hovering effect

charred blaze
#

wouldnt it just teleport 0.5 up and then -0.5 ?

#

oh i have duration

frail pilot
#

Nop

#

yep

#

x)

charred blaze
#

ok will try thanks

#

like this?

#

is there a better way to do this?

frail pilot
#

Hmmm

#

Something like that

glad prawn
#

eh why boolean array

frail pilot
#

You should move up in the lambda

#

To avoid using an array

#

But for testing it's fine

charred blaze
#

in the first lambda?

#

it still gives error

glad prawn
#

is it used in outer lambda?

charred blaze
#

no

glad prawn
#

then u got the answer

charred blaze
#

he said avoiding using an array

#

you still need an array inside the lambda

eternal oxide
#

I got it floating, but it's not really fast enough

#

as it takes half a rotation to reach it's apex

charred blaze
#

what if someone needs different speeds for floating/rotating?

frail pilot
#
new Runnable () {
private boolean up;
void run() {
  /* content of the lambda */
}
}
eternal oxide
frail pilot
#

You can adjust it by doing a ratio between the rotation and the translation

#

And add to the angle

frail pilot
#

Yeah

#

Basically the rotation will always be the same

#

You have an angle

charred blaze
#

"ratio between the rotation and the translation"

#

how

frail pilot
#

Yeah it's confusing

#

Give me 5 min, I'm coding that

charred blaze
#

so if rotation speed is 5s

#

and user input for floating speed is x s

#

mhmmmmmmm

eternal oxide
#

looks like MC reaches its apex in 45 degrees

charred blaze
#

MC?

eternal oxide
#

Minecraft bounce on dropped objects

charred blaze
#

45 degree of what

eternal oxide
#

rotation

charred blaze
#

some sin cos?

#

this float thing looks like this

storm crystal
#

How can I refactor this code to work properly with setting up PersistentDataType?

eternal oxide
charred blaze
#

so what does it use

charred blaze
sullen marlin
glad prawn
storm crystal
#

I dont understand how to do it at all

#

throwing one word answer isnt really helping

brittle geyser
#

I need expression that will split my string correctly.
My string: {123:5123, LoL:[aboba, test, jmot], kapa:[opa, shopa, koka], lel:[test, boba, iba]}
Result would be: 123:5123 LoL:[aboba, test, jmot] kapa:[opa, shopa, koka] lel:[test, boba, iba]

glad prawn
sullen marlin
brittle geyser
#

My expression that not works rn "(?<=^|,)\s*(?:\{([^:]+):([^,\]]+)}|([^:]+):\[([^]]+)])"
Result: 123:5123, ,

glad prawn
#

Ah he doesn't know how to use generics.

brittle geyser
sullen marlin
#

Map and array from where

#

Where did this string come from

brittle geyser
#

from string in chat, player will text it

sullen marlin
#

Use yaml or json

#

Your string looks close enough to valid yaml

brittle geyser
#

i know, but i convert string into boolean, int and other data types

#

How i can convert string into map with yaml

sullen marlin
#

Use SnakeYaml or gson. This needs a parser not a regex

brittle geyser
#
private Object convert(String message) {
        if (message.equals("null")) {
            return null;
        }
        if (message.startsWith("{") && message.endsWith("}")) {
            Map<String, Object> objectMap = new HashMap<>();
            String[] split = message.substring(1, message.length() - 1)
                                    .split("(?<=^|,)\\s*(?:\\{([^:]+):([^,\\]]+)}|([^:]+):\\[([^]]+)])");
            plugin.getLOGGER().info("Splited: " + Arrays.toString(split));
            for (String messages : split) {
                String[] splitted = messages.split(":");
                objectMap.put(splitted[0], convert(splitted[1]));
            }
            return objectMap;
        }
        if (message.startsWith("[") && message.endsWith("]")) {
            ArrayList<Object> objects = new ArrayList<>();
            for (String messages : message.substring(1, message.length() - 1).split(", ")) {
                objects.add(convert(messages));
            }
            return objects;
        }
        if ((message.startsWith("\"") && message.endsWith("\"")) || (message.startsWith("'") && message.endsWith("'"))) {
            return message.substring(1, message.length() - 1);
        }
        if (NumberUtils.isNumber(message)) {
            return NumberUtils.createNumber(message);
        }
        if (message.equalsIgnoreCase("true")) {
            return true;
        }
        if (message.equalsIgnoreCase("false")) {
            return false;
        }
        return message;
    }
storm crystal
#

I have no idea how to specify data type of persistent data type

#

I cant figure out what T and Z stand for

remote swallow
#

t and z are generics

glad prawn
#

<T, Z> PersistentDataType<T, Z>

hazy parrot
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

frail pilot
# charred blaze "ratio between the rotation and the translation"
final ItemDisplay display = player.getWorld().spawn(player.getLocation(), ItemDisplay.class);
display.setItemStack(new ItemStack(Material.CHEST));

final Vector3f floating = new Vector3f(0f, 0.4f, 0f);
final Transformation transformation = display.getTransformation();
final int numberOfTicksForHalfHover = 5;
final float angleForHalfHover = 1.5f;

Bukkit.getScheduler().runTaskTimer(this, new Runnable() {

    @Override
    public void run(){
        display.setInterpolationDelay(0);
        display.setInterpolationDuration(numberOfTicksForHalfHover);
        transformation.getTranslation().set(floating);
        floating.mul(-1);
        transformation.getLeftRotation().rotateY(angleForHalfHover);
        display.setTransformation(transformation);
    }
}, 2L, numberOfTicksForHalfHover);
eternal oxide
#

MC applies a sin to the translation

#

to smooth the transition between up and down

frail pilot
#

Oo

#

Well

#

Transformation are using linear interpolation

eternal oxide
#

I've been playing with it but its not so easy

frail pilot
#

Too bad

twilit creek
#

Hey, is it possible to use custom fonts in inventory names? Like with the AdventureAPI? (Component.text(<text>).font(Key.key(<key>));)

frail pilot
#

If you want to control the mvt that much, teleport the entity, it will be way easier x)

#

Or use the transform every tick

#

Does not matter

eternal oxide
#

nah I'm only playing around as the issue interested me

#

transform every 45 degrees is what MC does

frail pilot
#

Yeah but the interpolation is not the same

#

I guess

eternal oxide
#

but theres no way to apply a sin wave to the transformation

frail pilot
#

Yeah

storm crystal
#

I fixed problems with generic method syntax but I still have no idea how to retrieve specific enum from PersistentDataType, I read up documentation on it and still have no clue what to do

glad prawn
#

bro

sullen marlin
#

this helper method should've even be necessary because your keys should be constants

eternal oxide
#

yeah with no sin wave teh bounce looks bad

frail pilot
#

:x

eternal oxide
#

teleport is the only option for a smooth bounce

frail pilot
#

You can apply the transformation every tick with no delay

#

It avoid teleporting it

#

As you need to apply the rotation anyway

eternal oxide
#

you could but that would be more load

frail pilot
#

Hmmm

#

Sure ?

eternal oxide
#

could become really bad with many entities

frail pilot
#

I mean, if you teleport it or transform it every tick it does not matter

storm crystal
sullen marlin
#

just copy the method in the documentation

#

<P, C> C getPDC .... PersistentDataType<P,C> type

#

but as I said, this method doesn't need to exist because your keys should be constants

sullen marlin
#

you just put your key name in a field as a Namespacedkey and this method is one line...

#

I think you need to learn more java

storm crystal
#

like that?

sullen marlin
#

what did I say about P and C

storm crystal
sterile token
#

I really recommend learning about generics because i dont think you are understand correctly

sullen marlin
#

Type Parameters:
P - the generic type of the stored primitive
C - the generic type of the eventually created complex object

#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

sullen marlin
#

or just follow alex's tutorial

#

?pdc

storm crystal
#

P and C are types stored and outputted and I want to store and retrieve same type T that I specify

remote swallow
#

P and C are nothing specific, they are just a placeholder

storm crystal
#

do I create two enums for keys and types now

echo basalt
#

damn he got learnjava'd by md

sullen marlin
#

or: Why you should NEVER use NBT tags again! Spigot 1.14.1 added the biggest improvement that (in my opinion) ever made it into the Bukkit API: The Persistent Data Container (PDC). It can be used to store custom data on Entities, TileEntities, and ItemStacks. Using a bit of math, it can also be used to...

#

folow a tutorial // learn java

#

you keep saying the word enum without knowing what it means

echo basalt
#
public static final Map<String, PersistentDataType<?, ?>> PDC_MAPPINGS = Map.of(
  "Integer", PersistentDataType.INTEGER,
  "String", PersistentDataType.STRING
);

public static final PersistentDataType<String, Object> JSON_CONVERTER = ...; // Make your own impl
#

:)

#

gson encode that bitch

storm crystal
#

is this possible to make switch statement based on parameter T?

#

like it's type?

echo basalt
#

Sounds like you need to learn java

sterile token
echo basalt
#

why does that hand emoji look like it's gonna do something suggestive

storm crystal
#

I tried reading into Spigot's api, Oracle documentation into generic and looking at examples of generic methods, but I dont understand whats the deal with PersistentDataType

young knoll
#

Isn’t switching on the type gonna be a thing

#

Forgot the fancy JEP name for it

eternal night
#

pattern matching?

sullen marlin
young knoll
glass mauve
storm crystal
sullen marlin
#

<P, C> C getPDC .... PersistentDataType<P,C> type

storm crystal
#

well <T, T> would not always work

#

but it works for data types I am interested in

storm crystal
sullen marlin
#

it is the method signature you need, fill in the dots with your other stuff

#

it declares a method with two type variables P,C; returns C; and has an argument of PersistentDataType<P,C>

#

ask chatgpt or something

#

you need to learn more java

storm crystal
#

wouldnt I need key and metadata too in arguments?

glass mauve
sullen marlin
#

it is the method signature you need, fill in the dots with your other stuff

#

why am I just repeating myself

glad prawn
#

😭

storm crystal
#

I didnt totally get what other stuff is supposed to mean

#

or how to copy method signature from this section

glad prawn
#

for real bro

sullen marlin
#

this is how you copy things (ctrl+c, ctrl+v)

glass mauve
#

genius

glad prawn
#

lol

storm crystal
#

Its not 1:1 copy from what you sent, I thought that by "copied straight from" you meant that what you processed is explicitly written somewhere and I got confused

#

I dont understand the part about my keys being constants, how should I declare them?

sullen marlin
#

static final NamespacedKey MY_PDC_KEY = ...

quiet ice
#

I'd say it is irrelevant - unless you wish to call the method, then it is something else. Should be reading this convo a bit better I guess

storm crystal
#

but as far as I am concerned I should avoid using strings as much as possible

sullen marlin
#

peppering random strings in your code is not a good design

storm crystal
#

so calling keys with fromString method isnt advised in general?

remote swallow
#

calling keys fromString is fine, just randomly putting that in your code isnt

#

eg having 1 NamespacedKey.fromString in a constants class is fine, but calling it 900 times all over the place isnt

storm crystal
#

but should I hardcode an array of keynames and then loop over it to initialize them or would it there be a much better way to create constants?

young knoll
#

Use the constructor that takes two strings

glass mauve
#

im kinda out of context, but enums?

young knoll
#

Or use a static reference to your plugin I guess

storm crystal
#

why two strings in specific?

eternal oxide
#

Whats my mistake? I tried simplifying and it now rotates really fast, accellerating and slowing down. I see a pattern to the acceleration.```java
ItemDisplay entity = player.getWorld().spawn(player.getEyeLocation().add(player.getEyeLocation().getDirection().multiply(3)), ItemDisplay.class);
entity.setItemStack(new ItemStack(Material.ACACIA_BOAT));
entity.setInterpolationDelay(0);
entity.setInterpolationDuration(1);

    Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {

        int angle = 0;

        @Override
        public void run() {

            float rotation = (float) Math.round(Math.toRadians(angle));

            Transformation transform = entity.getTransformation();
            transform.getRightRotation().rotateY(rotation);
            entity.setTransformation(transform);

            angle += 1;
            if (angle > 360) angle = 0;
            if (angle < 0) angle = 360;
        }

    }, 2, 1);```
storm crystal
young knoll
#

You keep rotating it by angle, but angle keeps increasing

eternal oxide
#

yes

young knoll
#

So you rotate it 1 degree, then 2, then 3, etc

eternal oxide
#

ah I see

#

thanks

#

I only need the incrementing angle for the sin

#

I thought it was absolute rotation not relative

#

seems that wasn;t it. it no longer rotates at all

storm crystal
#

okay, so I want to utilize enums to store my statistics anyways, so I was thinking about implementing them into key names, so that I could iterate over enums and create keys on server enable, should I make Data Access Object class for them and store in something such as list?

eternal oxide
#

it is absolute rotation

#

its a rotate to specified radian

young knoll
#

It shouldn’t be

#

Afaik

eternal oxide
#

if I rotate to 1, it will point in one specific direction. if I rotate 180 it points the opposite

young knoll
#

Huh

#

The javadocs suggest it should mutate the current values

remote swallow
#

who keeps crashing my discord

eternal oxide
#

me!

remote swallow
#

smh

storm crystal
#

okay, does this make a proper use of generic methods?

#

if so then I only have to figure out way to create keys

eternal oxide
#

however, that shoudl have worked passing in a toRadians of 1

#

creating a new Transformation object every time works, but using teh current one seems to mess me up

storm crystal
#

do I make something like that and then iterate over it in a method to create keys?

glad prawn
#

create a class, dont use enum

storm crystal
storm crystal
#

no wait I could use NamespacedKey[] Keys and just use enums with bitwise OR to find them

storm crystal
#

what if I wanted to have, let's say, 70 keys

sullen marlin
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

sullen marlin
#

we're really not getting anywhere here

young knoll
#

An enum would be the same

#

70 fields vs 70 enum constants

storm crystal
#

enums would be used to determine what index of array it is

glad prawn
storm crystal
#

lets say I'd have a 6 bit number, 3 higher bits would be used to determine Elemental damage types, 3 low bits would be used to determine stat flavor, I'd have space for 8 of each since thats how many different numbers I can store in 3 bit numbers, using OR bitwise operator would allow me to store those keys in very nicely put spots, I'd only have to set up enum values corresponding to those binary numbers in decimal format

#

in that case it'd be 16 constants in enum at worst

#

which I'd be using not only for indexing stored keys but also statistics, so it wouldnt go to waste

young knoll
#

That’s quite over engineered for something like this

#

Storing a few extra bytes isn’t going to matter

storm crystal
#

I'd use that type of indexing all over my plugin for retrieving enemy statistics, weapon statistics, player base statistics, changing or applying PDCs

#

and I could make a general way to index it properly

#

for keys I'd just have to get that enum and lowercase it with method

young knoll
#

I’d just make a custom type adapter that can read and write all the data you need for an item as one object

storm crystal
#

to each their own I guess

#

I could just do something like keys[FIRE | DAMAGE_RESISTANCE] or enemyStats[ICE | RESISTANCE_REDUCTION] utilizing the same structure, so I think it'd be neat

torn shuttle
#

damn it I got another 1-star review from a false positive virus on spigot

quaint mantle
eternal oxide
#

yeah really annoying

torn shuttle
#

I think I might know what you did wrong there

eternal oxide
#

it does all kinds of wierd things, speeding up, slowing down

torn shuttle
#

yeah it's up to how you're resetting, also are you reading its current rotation?

eternal oxide
#

It works perfectly if I create a new Transformation each time

torn shuttle
#

yeah you are

#

and due to the interpolation you are probably getting the drag effect that I had trouble with working on fmm

#

possibly

eternal oxide
#

if I get teh current Quaternion it goes bad

#

I was just hoping to simplify by using teh current values

torn shuttle
#

wait what

#

rotate Y rotates by an amount

#

it doesn't set the rotation

#

you're doing it wrong

#

you probably don't even need a reset in the first place

eternal oxide
#

yes but if you get right quat and rotateY by toRadians(1) it doesn;t rotate at all

torn shuttle
#

did you round the 1

#

because you might've rounded it to 0

eternal oxide
#

after, yes

#

ah true

torn shuttle
#

and by might I mean you definitely did

eternal oxide
#

I rounded because before toRadians was too inaccurate to rotate teh same direction reliably

torn shuttle
#

I don't even know what that means nor do I really want to spend time thinking about it

eternal oxide
#

if you use toRadians(180) you can easily get a rounding error, as such when you do the next translation it would go clockwise not anti

torn shuttle
#

then use math.pi

#

2pi is 360

eternal oxide
#

nope Math.PI suffers the same issue

#

reversing

#

but rounding does fix it using toRadians

torn shuttle
#

what do you mean by reversing

eternal oxide
#

spins left then right, random direction due to fp math

#

this value works final float direction = (float) Math.round(Math.toRadians(-180));

#

without the round it behaves teh same as Math.PI, random rotation direction

torn shuttle
eternal oxide
#

?paste

undone axleBOT
eternal oxide
#

a continuously rotating ItemDisplay

#

replace direction with Math.PI and the rotation randomly reverses

#

I was attempting to use the existing quat values on teh object to rotate every tick so I could add a Math.sin bounce to it

#

via the Translation vector

#

however getLeftQuaternion().rotateY(Math.toRadians(1)) does not rotate at all

young knoll
#

Joml has its own math class

#

With its own toRadians

eternal oxide
#

I'll give it a try later.

eternal oxide
pearl forge
humble tulip
#

@pearl forge what's your command registered as?

pearl forge
#

sorry im stupid

eternal oxide
#

Thats wierd, Minecrafts spinning item animation is noy syncronized to ticks

worthy yarrow
#

Hey elgarl are you in the review mega thread?

eternal oxide
#

nope

#

to be honest I've never looked at it

worthy yarrow
#

and BukkitScheduler::runTaskTimer(lambda) instead of new BukkitRunnable::runTaskTimer

Do you by chance have an example of this way I could have a look at?

obsidian wolf
#

Does anyone know how to add cooldowns for custom items like chorus fruits or swords where you right click them and it gives effects?

#

I can show you what I mean, I’ve tried many tutorials, and looked all through forums, anyone know?

eternal oxide
#
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
//do code here.
}, delay, repeatSpeed);```
worthy yarrow
#

That's it

#

sigh

#

Thank you haha

obsidian wolf
#

oh

#

nvm

worthy yarrow
#

Lambdas always give me the jitters

young knoll
#

?cooldowns

undone axleBOT
obsidian wolf
# young knoll ?cooldowns

Is there a better way to explain it, because I’ve tried a lot of things and even tried this already it rlly doesn’t work

#

my sword is when i right click it gives me speed3, but if I hold right click I just keep speed 3 forever

eternal oxide
#

It seems the Minecraft rotation animation on dropped items is very close to 2.9 degrees per tick. It's not quite 3

young knoll
#

The wiki page is pretty in depth

#

Explaining how timestamps work

obsidian wolf
#

alright ima try it and update you

#

I think I did the same thing but on another website idk

#

give me a couple minutes

mystic pike
#

How would I go about making a new entry to Itemstack.r (PatchedDataComponentMap object) in 1.20.5 whereas previously using NBTTagCompound for versions 1.20.3 and below.
Would I have to create a new implementation of DataComponentType<T> and if I do, how would I do that?

worthy yarrow
#

So this:

Bukkit.getScheduler().runTaskTimer(seasons, () -> {
            for (Player player : Bukkit.getOnlinePlayers()){
                temperatureCache.computeIfAbsent(player.getUniqueId(), uuid -> {
                   double defaultTemp = temperatureSystem.getDefaultTemperature(seasonsManager.getCurrentSeason());
                   emitTemperatureChange(player, defaultTemp, defaultTemp);
                   return defaultTemp;
                });
                double currentTemp = temperatureSystem.calculatePlayerTemperature(player.getWorld().getBiome(player.getLocation()), seasonsManager.getCurrentSeason(), player);
                temperatureCache.put(player.getUniqueId(), currentTemp);
            }
        }, 0, 100);

as opposed to this:

        temperatureCacheTask = new BukkitRunnable() {
            @Override
            public void run(){
                for (Player player : Bukkit.getOnlinePlayers()){
                    temperatureCache.computeIfAbsent(player.getUniqueId(), uuid -> {
                        double defaultTemp = temperatureSystem.getDefaultTemperature(seasonsManager.getCurrentSeason());
                        emitTemperatureChange(player, defaultTemp, defaultTemp);
                        return defaultTemp;
                    });

                    double currentTemp = temperatureSystem.calculatePlayerTemperature(player.getWorld().getBiome(player.getLocation()), seasonsManager.getCurrentSeason(), player);
                    temperatureCache.put(player.getUniqueId(), currentTemp);
                }
            }
        }.runTaskTimer(seasons, 5, 100);

To avoid overuse of anonymous methods?

young knoll
#

You may want a method reference with that much code

worthy yarrow
#

public void startTemperatureCacheTask(){

i didn't include it in those pastes

#

It starts onEnable

sullen marlin
#

both seem fine to me

#

potatoe potato

worthy yarrow
#

I like the first way, a bit less bloated

glad prawn
#

lambda 🤑

eternal oxide
sullen marlin
#

looks pretty simple

#

nice job

eternal oxide
#

Just have to remember to use import org.joml.Math;

worthy yarrow
#

put it in the paste and bookmark the tab

eternal oxide
worthy yarrow
#

Haha no worries

#

Thank you btw!

worldly ingot
#

If you make a new data component type, you're going to have to register it to a frozen registry, and then you have undefined behaviour with the client. You're probably just wanting custom data, so Bukkit has API for this. The PDC

mystic pike
worldly ingot
#

Why are you insistent on using internals for this?

mystic pike
#

Not really insistent.

#

Just wondering now.

worldly ingot
#

It's new. I haven't looked too much into how it's implemented but there is a data component that's just an arbitrary map of NBT data for item stacks

mystic pike
#

Also for the reason that the vars I get passed in looks like this

    public net.minecraft.world.item.ItemStack applyTag(@NotNull net.minecraft.world.item.ItemStack itemStack, NBTTagCompound tag) {
        // todo - fix this
        // itemStack.c(tag);
        return itemStack;
    }
slender elbow
#

itemstacks don't hold NBT anymore in memory, they have a component map, a component describing stuff like enchantments, lore, potion contents etc
mojang was aware people stored non-vanilla tags in item NBT, and so they moved all foreign tags to this "custom_data" component, it holds a tag where all non-vanilla data should go

#

you are not meant to implement data components or types yourself

worthy yarrow
#
private void emitTemperatureChange(Player player, double oldTemp, double tempTarget) {
        Bukkit.getScheduler().runTaskTimer(seasons, () -> {
            double updatedTemp = oldTemp;
            double increment = (tempTarget > oldTemp) ? 1.0 : -1.0;
            temperatureEffects.displayTemperature(player, updatedTemp);
            updatedTemp += increment;

            if (increment > 0 && updatedTemp >= tempTarget || increment < 0 && updatedTemp <= tempTarget){
                temperatureEffects.displayTemperature(player, tempTarget);
            }
        }, 0, 10);
    }```

I'm thinking it's fine for this to run constantly, though when a new temperature would need to be emitted how do I cancel this task?
#

and/or assign a task id

worldly ingot
#

Store that somewhere, wherever you need to

sterile token
#

Okay definitly this is not normal, like this i have around 5k lines with the same text:

com.fasterxml.jackson.databind.JsonMappingException: Document nesting depth (1001) exceeds the maximum allowed (1000, from `StreamWriteConstraints.getMaxNestingDepth()`) (through reference chain: dev.alex.net.library.config.utilities.ConfigData["section"]->dev.alex.net.library.config.section.MemorySection["parent"]->dev.alex.net.library.config.files.YamlHandler["values"]->java.util.LinkedHashMap["section"]->dev.alex.net.library.config.section.MemorySection["parent"]->dev.alex.net.library.config.files.YamlHandler["values"]->java.util.LinkedHashMap["section"]->dev.alex.net.library.config.section.MemorySection["parent"]->dev.alex.net.library.config.files.YamlHandler["values"]->java.util.LinkedHashMap["section"]->dev.alex.net.library.config.section.MemorySection["parent"]->dev.alex.net.library.config.files.YamlHandler["values"]->java.util.LinkedHashMap["section"]->dev.alex.net.library.config.section.MemorySection["parent"]->dev.alex.net.library.config.files.YamlHandler["values"]->java.util.LinkedHashMap["section"]->dev.alex.net.library.config.section
echo basalt
#

I wonder if config sections contain their parent

sterile token
#

okayy

#

look this

#

something is getting weird

#

😂

#

lmao something cause an infinite loop or somthing similar

#

okay @echo basalt from what i read is caused because of Circular References

echo basalt
#

Yeah that's where I was getting at

sterile token
#

oh right

#

could you explain more about it pelase

#

sorry for tagging also

echo basalt
#

No worries

#

In short let's say A points to B

#

And B points back to A

#

What happens if you try to encode either?

sterile token
#

right i now understand the concept

echo basalt
#

It says "A[value = B[value = A...]]"

sterile token
#

but why would be caused? there i will need to get an idea why getting caused

#

let me send you my codes

#

there are all the code im using for what im coding

echo basalt
#

Yeah it's the parent thing

#

make it transient

sterile token
#

oh right

#

same issue tho

echo basalt
#

Hm

#

Any reason why you need a getParent?

sterile token
echo basalt
#

Yeah but why

sterile token
#

what do you mean by "why"

#

I mean would sections work without a getParent() ?

echo basalt
#

Yeah

sterile token
#

ohh lamoo, how would it be so?

echo basalt
#

Same shit

#

It's just a map wrapper

sterile token
#

but i use getParent() for creating the paths

echo basalt
#

Or you can just create the path in the parent and inject it in the constructor

sterile token
echo basalt
#

You really like to overcomplicate things

#

I have my own config system that looks a bit like spigot's / yours

sterile token
#

oh

#

getting nearer!!

echo basalt
#
public interface ConfigurationProvider {

  ConfigurationSection load(File file);
  void writeTo(ConfigurationSection section, File file);

}
public interface ConfigurationSection {

  String getName();
  String getFullPath();

  <T> T getObject(String path, Class<T> type);
  <T> T getObject(String path, T def);

  Object getObject(String path);
  
  String getString(String path);
  String getString(String path, String def);

  ..
}
public class MemoryConfigurationSection implements ConfigurationSection {

  private final String fullPath;
  private final Map<String, Object> backbone;

  public MemoryConfigurationSection(String fullPath, Map<String, Object> backbone) {
    this.backbone = new LinkedHashMap<>(backbone);
    this.fullPath = fullPath;
  }

  @Override
  public String getName() {
    int lastIndex = this.fullPath.lastIndexOf(".");
    return this.fullPath.substring(Math.max(0, lastIndex));
  }

  ...
}
sterile token
#

oh okay

compact arch
#

Hello!

I wasn't able to find any information about this in any of the forums on SpigotMC.
So I turned to this discord chat.

Essentially I took over maintenance of a plugin, but as far as I and the previous owner/maintainer are aware, there isn't any way to give me access to the SpigotMC resource.
Is this correct? Is there any process where this can be done in any way?

Thanks!
(Wasn't able to verify because apparently bot is rate limited)

rotund ravine
#

Try ur luck here

#

?support

undone axleBOT
sullen marlin
#

12.2.3

slender elbow
#

192.168.1.14

rotund ravine
obsidian wolf
#

I have 2 questions.

  1. How do you add a cooldown for a chorus fruit? So you can’t eat it (while on cooldown)
  2. Is it possible to add a custom texture to a sword using lore? Like instead of custom model data it’s lore? If anyone needs screenshots or any extra information, please; ask.
echo basalt
#

You might be able to get away with the second one with optifine, not sure

#

For the first one there's Player#setCooldown pretty sure

obsidian wolf
echo basalt
#

In which case just use model data ???

obsidian wolf
#

I’m tryna make it so everyone sees the texture pack ofc, I was just wondering if it was possible to use lore instead of custom model data

echo basalt
#

That's literally why it was made

worthy yarrow
obsidian wolf
#

like no other way

echo basalt
worthy yarrow
#

Yeah I'll make it known to keep it relatively low, also i think I'm cooked...

echo basalt
#

If it's bigger than like 32 I'd start making chunk snapshots and processing async

#

This is basically a light engine

worthy yarrow
#
private double calculateDistanceEffect(double distance) {
        double maxDistance = seasons.getConfig().getInt("season.util.heat_detection_radius");
        return Math.max(0, 1 - distance / maxDistance);

Why am I making a new double for max distance when I'm setting it to the same as distance

obsidian wolf
worthy yarrow
#
  • clean
#

I wonder how fast you would have this project completed illusion, I've been working on it for nearly 3 weeks lol

echo basalt
#

Well yeah this is basically a light engine so you can just hijack one and change stuff

echo basalt
#

I worked on a bedrock modelengine thing for work yesterday

#

Took me about 2 hours

#

(geyser's API is dogshit)

worthy yarrow
#

geyser is relatively new aint it?

echo basalt
#

Been around for a couple years

worthy yarrow
#

I suppose it depends more on the dev or just actual dogshit?

echo basalt
#

Bedrock has a system to send animations on entities

#

It also allows you to register custom entity types on the resourcepack

#

there's no wrapper for anything

#

They use the animation packet about once in a huge switch statement for offhand swing

#

I had to do some packet magic :)

worthy yarrow
#

Oh boy I'm sure I'll come across packet magic later on when I try to do fake biomes for overcasts, fog, etc

echo basalt
#

Basically I made a system to wrap custom entities :)

worthy yarrow
#

Autumn colors for trees and what not as well

echo basalt
#

It's in kotlin because I was forced to :(

worthy yarrow
#

Damn kt

echo basalt
#

Basically the end goal is to make your own entity types, wrap entities and override animations

#

¯_(ツ)_/¯

worthy yarrow
#

Where do the animations come from?

echo basalt
#

They're also defined in the resourcepack

#

Imagine you're making a custom zombie

worthy yarrow
#

wait

echo basalt
#

You spawn a zombie, wrap it as a modeled entity and override the attack animation to scratch the player, for example

#

3 lines of code and that's about it

worthy yarrow
echo basalt
#

Nah this is a whole different game

#

You have to play with packets :)

worthy yarrow
#

D:

#

So sad

echo basalt
#

But yeah the new api at work looks a bit like this :)

public void modelZombie(Zombie zombie) {
  ModeledEntity modeled = modeledEntityTracker.getOrCreate(zombie, "custom_zombie");
  
  Animation animation = new Animation("animation.zombie.attack");
  modeled.getAnimationController().play(animation);

  modeled.getAnimationController().addProcessor((context) -> {
    context.setAnimation(animation);
  }, "animation.attack"); // Optional
}
#

I might make a premium plugin that ports modelengine bbmodels to bedrock not sure

worthy yarrow
#

That sounds really useful

nova notch
worthy yarrow
#

If only I ever messed with meg maybe I'd be building a premium plugin too lol

obsidian wolf
#

but that seems like a bad idea anyway

nova notch
#

...so if it has that lore then give it the corresponding model data

obsidian wolf
#

he just wanted to practice his coding and honestly I was just wondering

nova notch
#

well as far as im aware that definitely is not possible at least without mods

obsidian wolf
worthy yarrow
#

@echo basalt do you wanna look at the seasons project by chance?

obsidian wolf
#

idk how tf he did it

#

anyway

#

I gtg sleep

echo basalt
#

eh no

worthy yarrow
#

ahaha I knew it

#

Worth a try

nova notch
obsidian wolf
#

defo won’t happen again ofc

#

but he just wanted to find out how lore works

nova notch
#

ok cool

echo basalt
#

@torn shuttle What can you tell me about bbmodel files?

torn shuttle
#

they will surprise you in ways that are !!fun!!

#

like how animation keys are not, in fact, stored linearly in time

sullen marlin
#

Everyone chill until exponential time

torn shuttle
#

nah they're just not ordered by time, they're ordered by date of creation in the program

#

which you would think is a bit of a weird way of storing data but whatever

blazing ocean
#

💀

worthy yarrow
#

I need a "cooldown" project of sorts, any ideas?

clear elm
#

can some1 give me an command cooldown

charred blaze
eternal oxide
#

thats just a counter used to calculate the up/down sin wave

charred blaze
#

why is it called angle then?

#

angle of what

eternal oxide
#

I could probably have used teh ticksLived value of the entity for that, but the math woul dnot have been so clean

charred blaze
#

sin(angle)?

eternal oxide
#

when an item bounces up/down it doesn't instantly change from traveling down to up. it's a smooth transition. it follows a sin curve.

#

in Minecraft thats double the rotational angle.

charred blaze
#

ahh

#

so its some sort of proportion between rotation angle and hover?

eternal oxide
#

not really. it's just the angle doubled to produce a sin wave. you can see it in game when an item bounce slows at its apex

grim parcel
#

Hey guys, I have a problem, when I listen to the PluginMessageEvent(Bungee), I find that some information is output like
proxy.console.sendMessage(TextComponent(event.tag + " -> " + event.data))
minecraft:brand -> [B@4c8d14c2
if I register a custom channel, may hackers send custom messages to use it?
proxy.registerChannel("custom:channel")

charred blaze
#
                    angle %= 360;
                }```
so here you are just adding 2x of 2.87 till you get to 360 or more and then make angle division remainder of 360?
eternal oxide
#

yes

#

If you look at a sin wave...

#

thats the path the entity follows (up/down)

charred blaze
#

so 2.87 is just a 0.5x number of how many it increases each time in angle?

eternal oxide
#

but a straight sin is too slow. it bounces at double that speed

charred blaze
#

aham so you increase angle 2.87x2 on each task

eternal oxide
#

well 2.87 is a magic number. MC doesnt actually match its animations to sync with the server ticks

charred blaze
#

ok

young knoll
clear elm
#

how can i do an command cooldown

acoustic pendant
#

Hey, I have this code for creating a world

acoustic pendant
#

how can i solve this?

grim parcel
charred blaze
#

which part is stepSize here?

eternal oxide
#

its teh degrees rotated in 1 tick of the server (blue line)

charred blaze
#

also if we are not modifying stepSize why dont we keep Math.toRadians(stepSIze) outside of the runnable?

eternal oxide
#

you can

lilac dagger
#

probably the angle?

#

or the red radius

#

most likely the angle

charred blaze
#

so we convert angle stepSize in scale of radians. radian is approx. 57 so 2.87 will be 2.87 / 57 radians right?

#

and we do that because rotateY method requires radians instead of angle

eternal oxide
#

yes

lilac dagger
#

radians is just values of pi

young knoll
charred blaze
#

mhm ok

lilac dagger
#

not sure if it's 57, i think 4pi is the fourth quadrant?

charred blaze
#

(R / 2PiR) * 360

eternal oxide
#

2PI is a full circle, so 360 degrees

charred blaze
lilac dagger
#

oh yeah

grim parcel
# young knoll I believe that’s an outgoing channel

I wrote a fabricmod. When it tries to send clientPlayNetworking.send(Identifier("BungeeCord", ""), packetBuf), the client crashes because the name is capitalized.

What I'm confused about now is if I want to use a plugin channel, is it safe to use "BungeeCord", or is it equally safe to use a custom channel "custom:channel"

charred blaze
#

yea its 57

eternal oxide
#

just use teh math not magic (hard coded) numbers

clear elm
#

how can i do this sign on keyboard: '

eternal oxide
#

teh stepSize is purely to sync the animation speed to server ticks

lilac dagger
#

yeah, usually it's best to have the above an not 57

charred blaze
#

Math.cos(Math.toRadians(angle))/10 why

lilac dagger
#

the compiler will most likely simplify it

charred blaze
#

i thought we were using sin

wet breach
eternal oxide
#

sin is for the up/down translation

charred blaze
#

oh its simmilar

eternal oxide
#

cos is just teh inverse of sin

wet breach
#

like yin and yang

wet breach
#

otherwise yes, it will simplify some of it

#

the only thing to worry about is rounding

#

usually for such math you would ensure that doesn't happen by having some cut off point

spice burrow
charred blaze
#

this is supposed to be less laggy than rotating items with armorstands right?

eternal oxide
#

yes

short drift
eternal oxide
#

as it uses Transformations

short drift
#

What am I doing wrong?
custom.potatoes.in.farmland is my own custom entry.

charred blaze
young knoll
#

Are you sending the component properly

short drift
#
player.sendMessage(translationString + suffixGrowthMessage);
#

Yes, I think so.

young knoll
#

No

#

Player#spigot#sendMessage

charred blaze
#

which one is pitch?

short drift
#

Oh, I see where I went wrong! I've been focused on .. I'll show you.

young knoll
#

Pitch is up/down

charred blaze
#

which number is pitch

short drift
charred blaze
#

oh ill figure that out

young knoll
#

Well, look up and down, what changes

short drift
#

I've been focused on the line above that I didn't notice it was actually using the one at the bottom!

#

Thanks @young knoll !

lilac dagger
#

is there a guava map that has a value view as keys?

#

i think i saw it somewhere, forgot where exactly

wet breach
lilac dagger
#

i'll try, thank you

grim parcel
trail coral
#

bungee is safe

grim parcel
#

Even if this channel is registered through Bungee? proxy.registerChannel("custom:channel")

#

and Bukkit
server.messenger.registerOutgoingPluginChannel(this, "custom:channel") server.messenger.registerIncomingPluginChannel(this, "custom:channel", this)

charred blaze
#

Does itemdisplays have ClickEvent or something?

eternal oxide
#

no

#

no hit box

charred blaze
#

:(

#

so how do i do it? spawn an armorstand on same location?

eternal oxide
#

what exactly are you trying to do?

charred blaze
#

click commands on item displays

#

ItemDisplay is an entity

#

so PlayerInteractEntityEvent should work right?

eternal oxide
#

no

#

it needs a hitbox to interact

charred blaze
#

will test it a sec

#

yea it doessnt work

#

:(

#

so what should i spawn

#

armorstand?

eternal oxide
#

No idea. AS or a no AI slime as a passenger

charred blaze
#

oh

#

slime is actually a good idea

#

how many sizes do a slime have?

eternal oxide
#

no clue

charred blaze
#

3

spice burrow
eternal oxide
#

it looks to be a path issue

#

delete everything and start fresh. No space in your folder name

spice burrow
twilit creek
#

Hello, is there a way to use something like Components with Font Options in inventories? Like i have a ASCII Char that is in a Texturepack a GUI and it is defined under fonts/inventories.json and i want to display the ASCII Char in the Font in a GUI.

frail pilot
sullen marlin
eternal oxide
frail pilot
eternal oxide
#

2.87 degrees was as close as I could get to match the animation speed

cyan swift
#

How do I start a project for the version 1.20.6?

spice burrow
short drift
#
[13:13:49] [Server thread/INFO]: TranslatableComponent(format=%(?:(\d+)\$)?([A-Za-z%]|$), translate=custom.potatoes.in.farmland, with=[TextComponent{text=. , BaseComponent(style=net.md_5.bungee.api.chat.ComponentStyle@3d3af72, insertion=null, extra=null, clickEvent=null, hoverEvent=null, reset=false)}, TranslatableComponent(format=%(?:(\d+)\$)?([A-Za-z%]|$), translate=custom.ageable.almost_ripe, with=null, fallback=null), TextComponent{text=., BaseComponent(style=net.md_5.bungee.api.chat.ComponentStyle@3d3af72, insertion=null, extra=null, clickEvent=null, hoverEvent=null, reset=false)}], fallback=null)

So this is the TranslatableComponent when I print it out. Looks OK to me.

#

But when I do:

player.spigot().sendMessage(inspectionText);
#

I only get the first element out.

#

Do I need to do something extra... ?

wet breach
#

probably would help to show code?

short drift
#
            TranslatableComponent inspectionText = new TranslatableComponent("custom.potatoes.in.farmland");
            inspectionText.addWith(". ");

            // Check if it can be cast as Ageable.
            if (!(clickedBlock.getBlockData() instanceof Ageable ageable)) {
                System.out.println("Block data is not Ageable!");
                player.spigot().sendMessage(inspectionText);
                return;
            }

            // Check if it's fully grown.
            TranslatableComponent suffixGrowthMessage;
            var maxAge = ageable.getMaximumAge();
            var age = ageable.getAge();
            System.out.println("Block data is Ageable. Age: " + age + " Max age: " + maxAge);
            System.out.println(inspectionText);
            if (age == maxAge) {
                suffixGrowthMessage = new TranslatableComponent("custom.ageable.ripe");
            } else if (age == maxAge - 1) {
                suffixGrowthMessage = new TranslatableComponent("custom.ageable.almost_ripe");
            } else if (age == 0) {
                suffixGrowthMessage = new TranslatableComponent("custom.ageable.recently_planted");
            } else if (age == 1) {
                suffixGrowthMessage = new TranslatableComponent("custom.ageable.sprouting");
            } else {
                suffixGrowthMessage = new TranslatableComponent("custom.ageable.not_fully_mature");
            }
            System.out.println(suffixGrowthMessage);

            inspectionText.addWith(suffixGrowthMessage);
            inspectionText.addWith(".");

            System.out.println(inspectionText);
            player.spigot().sendMessage(inspectionText);
#

So, like I explained the ispectionText seems to contain all the elements that it should contain.

#

But when I do:

player.spigot().sendMessage(inspectionText);
#

It only prints the first element out.

#

So that would be the custom.potatoes.in.farmland

quaint mantle
#

May I ask how .sendTitle works? I noticed it had s and s1 will it display a message like this?
TEST
TEST
or do I need to add \n?

quaint mantle
#

I'm guessing S is the title and S1 is the subtitle?

shadow night
#

Likely

#

If s is the first and s1 is the second then yes

wet breach
chrome beacon
#

I recommend you read it

wet breach
#

I mean, it is the thing that is in translate, I don't imagine translatable would affect all the other settings?

short drift
# wet breach that is what you set it to o.O

Yes. That's the first element. But if you read the code a bit further you should see that I'm combining it with suffixGrowthMessage and the rest which is shown in the raw message I printed out. It's all there.

wet breach
#

if your goal is to send all of the string I imagine you would need to send it differently

wet breach
#

well, does it need to be a translatable component, not entirely sure what that is exactly and would have to look

short drift
#

Right so what I'm doing in practice is I take two translations from the resource pack.
I smash them together. And I add also some formatting like ". " etc.

chrome beacon
#

Are we sure that addWith mutates the component

short drift
#

And then I try to send the built message.

wet breach
#

Olivo beat me to it

short drift
#

It doesn't seem to explicitly say that I need to do anything extra.

wet breach
#

anyways, while it makes sense what you are doing, do you still need to send it as a translatable at the end?

short drift
#

I think the example it has is exactly what I have done.

short drift
#

Would that be TextComponent ?

wet breach
#

Yes

short drift
#

So using a StringBuilder or something?

#

And then

player.spigot().sendMessage(new TextComponent(messageBuilder.toString()));

#

?

shadow night
#

What are you even trying to achieve

wet breach
#

also it seems you misinterpreted the addWith

short drift
shadow night
short drift
shadow night
#

Why do you need a translatable component and stuff

short drift
#

I mean this example seemed simple enough.

#

But that doesn't seem to work like that.