#help-development

1 messages · Page 1190 of 1

chrome beacon
#

Also It's a bit annoying asking for code snippets

#

We do need all the relevant code here

sly topaz
#

I mean, it can't be helped, it isn't like they don't want to share the code, it is that they can't

#

best we can do is recommend ways for them to debug it rather than asking for small bits really, but I am curious as to where this is pointing to so I ask lol

chrome beacon
#

I'll get some sleep now cause 1am troubleshooting isn't going to help anyone

#

Hope you guys can solve the issue

#

Do use the debugger it's the easiest way to track down the issue

#

instead of going through line by line manually and make simple reading mistakes like I just did 💀

proper cobalt
sly topaz
#

you still haven't changed the method signature

#

change it to public @NotNull EnumMap<DataTypeImpl, AbstractDataType> toEnumMap()

proper cobalt
#

ight i did

#

lemme see if it works

#

?paste

undone axleBOT
sly topaz
#

well now the error points to toEnumMap

#

what is this.getMap again?

proper cobalt
#

so the class extends DataMapManager

#

of DataMapManager<@NotNull DataTypeImpl, @NotNull AbstractDataType>

sly topaz
#

at com.himerarp.computer3.pc.impl.component.storage.StorageData.toEnumMap(StorageData.java:33) what is this line also, just to know where exactly the cast is happening

proper cobalt
#

enumMap.put(entry.getKey(), entry.getValue());

#

line 33

sly topaz
#

well that doesn't make any sense

#

why would it be trying to cast it to a float there if the enum map is indeed AbstractDataType

proper cobalt
#

mad confusing bro

glossy basalt
#

is spigot breaking api or something, i cant do /skulls with essential x

rough ibex
#

why can you not?

glossy basalt
#

wel i can

#

but it gives alex head

#

or steve

rough ibex
#

did you update essentials x

glossy basalt
#

how do i see what version i am using

#

am on aternos

#

nvm i found

#

i am on most recent yes

chrome beacon
chrome beacon
#

Also you're probably just on the stable build. There's probably a newer dev build

wet breach
#

might be wise to see what the IDE thinks the method is coming from

#

however, I think I might know the issue though

wet breach
proper cobalt
#

17

wet breach
#

what version is that lib compiled with?

proper cobalt
#

17

cosmic elk
#

can anyone help with this?

proper cobalt
#

we are on java 17 - paper 1.19.4

wet breach
#

is that lib yours?

proper cobalt
#

yeah

wet breach
#

if both projects are yours then I think it might just be an IJ issue

proper cobalt
#

IJ issue?

#

its runtime not compile time

wet breach
#

and issues from compiling don't affect runtime?

proper cobalt
#

i guess they do but what can IJ be doing

wet breach
#

IJ does quite a bit of its own stuff

proper cobalt
#

mm i see

wet breach
#

I would try clearing caches, and restarting IJ and then try re-compiling with a clean build

#

to just make sure its not the IDE doing weird things

proper cobalt
#

alright ill give it a go

chrome beacon
#

Gradle is compiling

#

Not Intellij

#

They're not using Artifacts

wet breach
#

it doesn't matter, IJ does its own stuff when it comes to those plugins etc. Unless you specify a very specific compiler to be used the one from the IDE will be used

chrome beacon
#

Plugins don't touch the compiler

#

That would be a real bad idea

wet breach
#

no

#

how do you think annotations work?

proper cobalt
#

aight its re-indexing n shi

wet breach
#

they are not magic and have to be intercepted either before or after the compiler depending on what it does 🙂

chrome beacon
wet breach
#

either way, it touches the compiling portion where you said it doesn't

chrome beacon
#

And not in Intellij settings

wet breach
#

not sure what settings has to do with this

#

anyways I am not going to argue anymore, unless you can specifically prove to me that nothing in IJ ever touches the compiler I simply am going to ignore what you are saying

chrome beacon
#

You can see the command it runs to start the process

wet breach
#

and no I am not talking about stuff in settings. If you don't specify a compiler for gradle or maven plugins to use, they will default to whatever the IDE provides

chrome beacon
#

Yes I never said it won't

#

I said that Intellij doesn't inject stuff in to the pipeline

wet breach
#

ok, IJ's compiler isn't vanilla Java compiler

proper cobalt
#

aight i invalidated chaches n all that same error tho

chrome beacon
#

It doesn't ship with one

wet breach
#

It has its own o.O

chrome beacon
#

Are you thinking of Eclipse

kind hatch
#

You can also change anything in the settings or in the respective dependency manager file.

wet breach
#

and no

chrome beacon
#

Jetbrains do have their own

wet breach
proper cobalt
wet breach
#

something has to be changing your source code somewhere because it doesn't just magically require a float when you created the method in the lib to not accept a float

chrome beacon
#

They are using Lombok

#

So annotations do exist

wet breach
#

so....it could be the annotation processor screwing it up

#

in that case, either make sure your annotation processor is updated version or trying removing the annotation stuff

proper cobalt
#

i mean i have lombok

#

thats abt it

#

not in that class tho

#
@Getter
@Setter
@AllArgsConstructor
public abstract class AbstractDataType {
    private final DataTypeImpl dataType;
    private final int multiplier;
    private float amount;
}
#

could it be here

wet breach
#

this is one of the reasons I don't like using annotations lol

kind hatch
#

What version are you compiling against?

sly topaz
#

this isn't an annotations issue

#

it is just the data being passed being the wrong type, however we don't know where it comes from since we can't see the code

#

though I guess if they had delombok setup the stack trace would be more useful

kind hatch
#

If they are trying to compile against 1.21.4, then they shouldn’t be using enummaps.

Stuff was getting changed over to individual classes and registry shiz

wet breach
sly topaz
#

so it is alright

kind hatch
#

Ah

wet breach
sly topaz
#

well, anything above 1.14 anyway

wet breach
#

at least that is what the stack trace shows the version of them using anyways

sly topaz
#

I don't think we can help you with this one tbh john

wet breach
#

can't say they are indeed compiling for that since I don't know their build setup 😛

sly topaz
#

it is matter of sitting down and looking at what the debugger tells you

proper cobalt
#

can also screenshare if u want

wet breach
#

like tell it to open the class the method originates from

#

I don't use IJ so not sure if that is possible. On Netbeans I could do that

sly topaz
sly topaz
kind hatch
proper cobalt
wet breach
proper cobalt
#

IJ isnt saying any problems

sly topaz
sly topaz
#

that was just them forgetting to change the method signature, they fixed it afterwards

wet breach
#

ah

wet breach
proper cobalt
#

that was WAY after

#

it was originally a run time bug

kind hatch
#

What’s the current error?

proper cobalt
#

same as the original

#

no progress

kind hatch
#

What is the original error? I joined late to this convo

sly topaz
kind hatch
#

Class cast exception.
Where is the code responsible?

sly topaz
#

this is the code responsible (taken from #help-development message):

    @Override
    public @NotNull ItemStack getItemStack() {
        ItemStack itemStack = super.getItemStack();
        itemStack.editMeta(meta -> StorageKey.DATA.set(meta, this.data.toEnumMap()));
        return itemStack;
    }
kind hatch
#

It’s still the same error tho?

proper cobalt
#

thanks for filling him in javier

#

🙏

wet breach
#

somewhere they are using an incorrect generic type that only throws a warning in compiling but in runtime errors out

sly topaz
#
    @RequiredArgsConstructor
    @Getter
    public enum StorageKey implements IPDCKey {
        DATA("data", DataType.asEnumMap(DataTypeImpl.class, DataType.FLOAT));

        private final @NotNull String key;
        private final @NotNull PersistentDataType<?, ?> type;
        private final @NotNull RPComputer3 instance = RPComputer3.instance;
    }

and this is StorageKey.DATA

wet breach
#

well, there is one instance of where its requiring a float

sly topaz
#

finally, I believe this is the set method:

    default <T> void set(@Nullable PersistentDataHolder holder, T value) {
        if (holder != null) {
            PersistentDataType<Object, T> type = this.getType();
            holder.getPersistentDataContainer().set(this.getNamespace(), type, value);
        }
    }
kind hatch
#

Hmmm, it’s times like these it would probably help if I knew/used Lombok

wet breach
#

so, its possible that float is being inputted but they are trying to grab it out as something else that isn't compatible

wet breach
proper cobalt
wet breach
young knoll
#

Tbf it can do a lot more than getters and setters

#

But things just get more hacky the deeper you go

wet breach
#

lol

proper cobalt
proper cobalt
sly topaz
kind hatch
#

Is this a custom data type for the PDC?

sly topaz
#

the PDT comes from MoreDataTypes lib

proper cobalt
proper cobalt
wet breach
proper cobalt
#

how is it that tho

wet breach
#

Ah so we should have Alex here then

proper cobalt
#

i dont think thats the problem tho

sly topaz
#

it could be I am reading this function signature wrong, but this:
DataType.asEnumMap(DataTypeImpl.class, DataType.FLOAT)
would indeed return MapDataType<EnumMap<DataTypeImpl, Float>, DataTypeImpl, Float> if we look at this method signature

static <E extends Enum<E>, V> MapDataType<EnumMap<E, V>, E, V> asEnumMap(@NotNull Class<E> enumClazz, @NotNull PersistentDataType<?, V> valueType) {
        return asGenericMap(() -> {
            return new EnumMap(enumClazz);
        }, asEnum(enumClazz), valueType);
    }
wet breach
young knoll
#

That’s a lot of EVs

sly topaz
#

but maybe that's just how the thing is serialized so idk honestly

young knoll
#

It’s like Pokémon up in here

proper cobalt
#

huh

#

how would that cause my casting problem

#

man im cooked

#

this makes 0 sense

sly topaz
#

what happens if you change it to a normal map instead of an enum map

proper cobalt
#

let me show u how it was before

#

it used to be like that and it worked

#

old enum ^

kind hatch
#

New enum?

sly topaz
#

so you just changed the name

wet breach
#

PersistentDataType was also changed too

proper cobalt
proper cobalt
sly topaz
wet breach
#

ah

sly topaz
sly topaz
short pilot
#

hey fellas, in spigot 1.20 and onwards how do you create custom mobs?

#

i'm trying to make a simple zombie but using old docs is outdated idk what the entity classes are now

#

for example

chrome beacon
#

?mappings

undone axleBOT
chrome beacon
#

?nms

kind hatch
#

Remapped names are now common

proper cobalt
#

aight wait

short pilot
#

is creating custom mobs still the same as before?

chrome beacon
#

Yeah

short pilot
#

also im wondering if you can set aggression to entities not defined in default vanilla behavior

#

ie iron golem attacking players normally

kind hatch
#

Depends on how far back you are lol

wet breach
# sly topaz

which of his libs are we using here? Can't seem to find it on his github lol

chrome beacon
short pilot
short pilot
#

hm do any of you have modern examples of custom mob code

wet breach
orchid iron
chrome beacon
#

Check mappings site to convert

short pilot
#

ok

#

ERM

#

how do i use the mapping sites

kind hatch
#

Select the version your are developing for and use the search box to type in the old names.

short pilot
#

i see

wet breach
short pilot
#

so entityZombie is now under package net.minecraft.world.entity.monster.EntityZombie ?

sly topaz
proper cobalt
wet breach
#

right....another thing we need to be shown

sly topaz
#

let's make a thread

proper cobalt
#

yeah that would be useful

chrome beacon
short pilot
#

so to get the minecraft packages i have to run buildtools right

#

oh

chrome beacon
#

?nms

chrome beacon
#

^ to get Minecraft package and such

kind hatch
short pilot
#

or best practice

chrome beacon
#

BuildTools you mean?

#

Or the mappings?

short pilot
#

actually both, why isnt the minecraft included by default

chrome beacon
#

Copyright law

short pilot
#

i guess im used to seeing it for modding

#

oh

chrome beacon
#

Can't distribute Mojangs code

short pilot
#

i see

chrome beacon
#

As for the mappings you'll have a real bad time without them

short pilot
#

i thought buildtools was for setting up spigot servers too right

kind hatch
#

It is

chrome beacon
#

Everything except class/package names will be obfuscated

kind hatch
#

Multipurpose

short pilot
#

i see

wet breach
#

buildtools does indeed download the minecraft.jar though and then modifies it to its needs and then bukkit and spigot are built against it

short pilot
#

i c

#

having trouble with buildtools, do i run it in my plugin's root directory?

#

the wiki suggests its own folder

wet breach
#

I personally use gitbash to run buildtools

#

and yeah have it in its own directory because its going to create files and directories in the place it is ran from

short pilot
#

ok

#

how do i add it as a dependency

sly topaz
sly topaz
#

the remapped flag or what?

#

if you are on windows, you can just use the exe and it'll be a checkbox in the gui

#

if you are not on windows, then you'll have to run it from the terminal

short pilot
#

how to add as a dependency

#

i ran with the flag already

sly topaz
#

?nms

sly topaz
short pilot
#

wait so if i use gradle i cant use the buildtools gui or anything?

#
plugins {
    id 'java'
    id("io.github.patrick.remapper") version "1.4.2"
}

group = 'io.github.derec4'
version = '0.0.0.1'

repositories {
    mavenCentral()
    mavenLocal()
    maven {
        name = "spigotmc-repo"
        url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
    }
    maven {
        name = "sonatype"
        url = "https://oss.sonatype.org/content/groups/public/"
    }
}

dependencies {
    compileOnly("org.spigotmc:spigot-api:1.21.4-R0.1-SNAPSHOT")
    compileOnly("org.spigotmc:spigot:1.21.4-R0.1-SNAPSHOT:remapped-mojang")
}
..........
short pilot
#

is initPathfinder not a thing anymore?

sly topaz
sly topaz
short pilot
#

i see

#
    @Override
    protected void registerGoals() {
        super.registerGoals();
        // Add custom goals here
        this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, .../

    }

}
#

i tried registerGoals

sly topaz
#

this mentions you have to do it in the constructor apparently

short pilot
#

oh what

#

im so confused haha

#

how do i make my entity not target players if it is a zombie?

sly topaz
short pilot
#

hm how does the goal class work

#

public class CustomWitherSkeleton extends WitherSkeleton {
    public CustomWitherSkeleton(EntityType<? extends WitherSkeleton> entitytypes, Level world) {
        super(entitytypes, world);

        this.collides = false;
        this.setInvulnerable(false);
        this.setCanPickUpLoot(false);
        this.setAggressive(false);
        this.setCustomNameVisible(true);
        this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Sheep.class, true));
    }

    @Override
    protected void registerGoals() {
//        super.registerGoals(); Sets default mob logic

    }

}
#

so now i made a custom skeleton mob

#

how do i register it?

lilac dagger
#

Add it to the world

#

level().addentity

#

Or something like this

#

level().addFreshEntity(this, SpawnReason.CUSTOM);

#

This being the custom entity

drowsy helm
#
double angle = context.angle;

            // Calculate new armor stand position
            double x = RADIUS * Math.cos(angle);
            double z = RADIUS * Math.sin(angle);


            Location newLocation = location.clone();
            newLocation.setYaw(0);
            newLocation.setPitch(0);
            context.setOffset(new Vector3f((float)x, 0, (float)z));



            // Calculate tangent vector
            Vector3f tangent = new Vector3f(
                    (float) (-RADIUS * Math.sin(angle)), // Tangent X
                    0f,                                // Tangent Y
                    (float) (RADIUS * Math.cos(angle))  // Tangent Z
            );
            tangent.normalize();
            // Up vector
            Vector3f up = new Vector3f(0, 1, 0);

            Quaternionf quaternion = new Quaternionf();
            quaternion.lookAlong(tangent, up);
            context.setRightRotation(quaternion);



            // Increment angle
            angle += Math.toRadians(5); // Adjust the step size for rotation speed
            if (angle >= 2 * Math.PI) {
                angle = 0; // Reset angle to avoid precision loss over time
            }
            context.setAngle(angle);
            context.updateConfig();
            entity.setConfiguration();

Can any smart math person tell me why my projectile is facing the wrong way? I am using interpolation now so I feel that might be part of the issue?

short pilot
#

or do i spawn it in using normal code

#

like a command or trigger

lilac dagger
lilac dagger
drowsy helm
lilac dagger
#

i dunno, not that good at math yet

drowsy helm
#

quaternions are just confusing tbh

#

i had it working perfectly with atan2

lilac dagger
#

a atan2 does this while

drowsy helm
#
            double atanAngle = Math.atan2(context.getOffset().z(), context.getOffset().x()); 

            Vector3f tangent = new Vector3f(
                    (float) (Math.sin(atanAngle)), // Tangent X
                    0f,                                // Tangent Y
                    (float) (Math.cos(atanAngle))  // Tangent Z
            );

This seems to work peroperly

#

just oeriented backwards lol

lilac dagger
#

can i see?

#

maybe i get an idea of how you want it to revolve it

drowsy helm
#

I think its just a matter of flipping values somewhere

lilac dagger
#

ohh

#

yeah

drowsy helm
#

sweet got it working, just have to flip both x and z

#

ty for brain food

lilac dagger
#

i didn't do anything

#

you did it all yourself

#

;D

short pilot
lilac dagger
#

not really

#

only if you just want to add them to a world

drowsy helm
#

but if you don't register them, they wont save properly in the chunk

short pilot
#

oop

#

ok so uh

#

what do i use to register them that'll have them savedf

lilac dagger
#

as far as i know if you add them to the world they'll be saved to the chunk, there's a method you have to override to prevent them from being saved

short pilot
#

oh

#

do you know which it is?

drowsy helm
#

look at 3ricL's comment

#

but this is for 1.18 non remapped so you'll have to figure it out for remapped

lilac dagger
#

there are a lot of methods to go through but i could take a look

#

i see this method in Entity

#

not sure if this is it

#

you can try to overwrite it and see if it's still spawned after a server restart

short pilot
#

would this be overriding the mob's class?

#

in the entity itself

sonic goblet
#

Providing you’re using the code you provided you’d be overriding the method for your CustomWitherSkeleton entity (Which extends WitherSkeleton)

#

And you do that in the class yes

tiny tangle
#

bump

mortal vortex
#

What error are you getting, you never specified? it helps me get to an answer quicker without having to run any code myself. @tiny tangle

#

Also cant you use scheduleSyncRepeatingTask instead of just a runnable?

blazing ocean
#

looks like gpt

mortal vortex
#

Could be

mortal vortex
#

isnt it provided as a method under Server?

mortal vortex
buoyant viper
mortal vortex
#

and its also literally in spigot too, but paper was the first result

#

same same

mortal vortex
#

oh what its not

buoyant viper
#

naur

mortal vortex
#

welp,

buoyant viper
#

spigot doesnt really expose tps stuff i think

#

but that might be for the like weird new tick command or whatever

mortal vortex
#

ohh no u can average

#

or is that too much?

buoyant viper
#

i think getTickTimes might also be a paper method 😭

#

altho ig if hes working w paper like u said, might as well use paper api

mortal vortex
#

I always just use Paper

#

but I find this community much chiller

pliant topaz
mortal vortex
#

Yep

pliant topaz
#

you could get the current tick rate every tick and every second or so do avg tickrate / 1000

#

But that would be a very rounded average i suppose

buoyant viper
tiny tangle
# mortal vortex Hi

im not getting any error, what im trying its to measure the server mspt , but I dont know if the code above its the right approach, and I do not know how to proper measure it.

mortal vortex
#

im using a simple method, but cannot use paper and bukkit api same time getting error

tiny tangle
#

i was using tabstps and the mspt that the plugin shows, and what I did on the code that I posted, when comparting the amount of the output , I suppose mine its giving wrong value amount.

sonic goblet
#

I’m all for DIY but just checking you know about the Spark plugin right?

tiny tangle
#
            @Override
            public void run() {
                long currentTime = System.nanoTime();
                long timeTakenForTick = currentTime - lastTickTime;  // Time in nanoseconds
                lastTickTime = currentTime;
                mspt = timeTakenForTick / 1_000_000.0; // Convert to milliseconds```
upper hazel
#

What addModifier does something besides opiations with meanings do?

hushed spindle
#

is ItemMeta#setCustomModelData() going to be deprecated now that custommodeldatacomponent is a thing

hushed spindle
upper hazel
hushed spindle
sonic goblet
upper hazel
hushed spindle
#

it doesnt make sense

#

try word it differently

upper hazel
#

addModifier do smth else besides operation with value?

hushed spindle
#

why are you asking

#

i still dont know what you mean, what problem are you facing

upper hazel
hushed spindle
#

ah, you want to know how modifiers work

#

alright

upper hazel
#

yes

#

I thought maybe they were doing something else besides just typing in values.

hushed spindle
#

so, an AttributeInstance is basically just your stat value of whatever stat you want to have, take ATTACK_DAMAGE for example

attributemodifiers modify the base value of that stat. modifying the base damage directly is not a good idea because you can't properly undo those modifications

if you were to modify the max health of a spider for example by using AttributeInstance#setBaseValue, and let's say that for whatever reason you wanted to undo those changes, you can't just set it back to whatever AttributeInstance#getDefaultValue() is. Because for MAX_HEALTH, that's always 20, and spiders don't have 20 max health by default.
it's also better because other plugins might want to do the same thing, and by modifying the base stat directly you're interfering with them.

attributemodifiers are the recommended way to modify stats because you can easily add and remove them whenever needed.
if you want someone to have a couple extra points of attack damage, you use an attributemodifier with the ADD_NUMBER mode.
if you want someone to deal a percentage more damage with their attacks, you use ADD_SCALAR.
MULTIPLY_SCALAR_1 does basically what ADD_SCALAR does, but much stronger. it's a bit difficult to explain but having several MULTIPLY_SCALAR_1 modifiers exponentially increases your stat values

tiny tangle
# sonic goblet <@668112681437364234> this was for you

uhm, i know spark, but I wish to have own plugin to meausre only that , because i need to add other functions for a certain user case. I read the tabtps github files, but there was so many files that i dont know here to look it, very spread and i got more confuse.

hushed spindle
#

attributes and modifiers are not intuitive, i don't blame you for being confused. but you should always add attribute modifiers instead of modifying the base stat value directly

short pilot
#

hwy guys how do you spawn a custom mob you made using a command?

#

like assuming a template command is made

#

how do i spawn the mob

hushed spindle
#

you use World#spawn and pass whatever class your custom mob has to it

short pilot
#

what's this addFreshEntity i see

#
            World world = player.getWorld();
            CustomWitherSkeleton customWitherSkeleton = new CustomWitherSkeleton(EntityType.WITHER_SKELETON, world);
            customWitherSkeleton.setPos(location.getX(), location.getY(), location.getZ());
            world.addEntity(customWitherSkeleton);
#

so im trying to spawn it like this but it's not recognizing the Wither Skeleton as a mob

upper hazel
hushed spindle
upper hazel
#

baseValue and value

hushed spindle
#

baseValue and value are separate from eachother

#

getValue() represents the stat value after all calculations, getBaseValue() only returns the value before calculations

#

the calculations are the attributemodifiers

#

like, lets take an example of having an attack damage of 1
if you have 3 attributemodifiers in this instance,

  • ADD_NUMBER 5
  • ADD_SCALAR 0.5
  • ADD_SCALAR 0.5

then getValue() returns (1 + 5) * (1 + 0.5 + 0.5), which is 12
getBaseValue() will still return 1

upper hazel
#

all modifiers connected with each other?

#

why exists argument like uuid and string

#

if i getting attribute from player

#

oh

#

i see

hushed spindle
#

yeah all modifiers are connected like that

#

uuids and names are just useful for identifying these modifiers

upper hazel
#

what if i want SET value

hushed spindle
#

i think they are indexed by uuid, so if you add a modifier with the uuid of an existing modifier it overrides the previous

#

you dont want a set value

upper hazel
#

but i need synchronize

hushed spindle
#

with what

upper hazel
#

with custom attributes

hushed spindle
#

in what way

#

you know players have a base damage of 1 so if you want to set it to 6 so bad you add 5

#

with an add_number modifier

upper hazel
#

sec

#

i creating basic plugin with roles

#

race

#

and types

#

and i have formula

#

i not can just add or remove

#

looks like I'm gonna have to flip the formula

#

oh nuh

#

i find easly path

short pilot
young knoll
#

You’ll need to use the NMS version of the world to add the entity

upper hazel
#

Is it worth adding to the api the ability to change parameters by a third-party plugin if these parameters are updated and reset on reboot and depend on the config?

sonic goblet
quaint mantle
#

Is there way to get line of ConfigurationSection?

young knoll
#

Wdym a line

quaint mantle
#
a: # 0
 b: # 1
   c: # 2
#

Like this

chrome beacon
#

hm? but why

tiny tangle
quaint mantle
worldly ingot
#

No there's no way to get the line unless you search for it yourself. Just the path should be sufficient though, no?

#

YAML is structured so you can print out the path to the option that's misconfigured

devout tangle
#

hey, i got this code to place blocks beneth me but it just doesnt place the blocks and the locations are the right ones

          ArrayList<Location> cloud = new ArrayList<>();

            for (double i = player.getX()-2; i < player.getX()+2; i++) {
                for (double j = player.getZ()-2; j < player.getZ()+2; j++) {
                    cloud.add(new Location(player.getWorld(), i, j, player.getLocation().getY()-1));
                    System.out.println(i + " " + j + " " + (player.getLocation().getY() - 1) + " ");
                }
            }

            for (Location location : cloud) {
                location.getBlock().setType(Material.WHITE_WOOL);
            }
echo basalt
#

you got the Y and Z axis flipped

eternal oxide
#

^ in new Location

wooden frost
#

Is it possible to send multiple text components(one string, to clickables) in a single message?

blazing ocean
#

i mean

#

just append them

wooden frost
#

yeah

#

right

#

ij

#

ok

#

stupid question srry

tiny tangle
#

does doing bump is it considering be spam?

rough ibex
#

does doing be what huh

#

What do you need help with

chrome beacon
eternal oxide
#

No, so long as its not too frequent

chrome beacon
#

^^

tiny tangle
#

merely only with bukkit

#
            @Override
            public void run() {
                long currentTime = System.nanoTime();
                long timeTakenForTick = currentTime - lastTickTime;  // Time in nanoseconds
                lastTickTime = currentTime;
                mspt = timeTakenForTick / 1_000_000.0; // Convert to milliseconds```
eternal oxide
#

what is yoru issue? You might want to use millis over nano as nano call is more expensive

#

and as you only want mspt it should be fine

tiny tangle
#

uhm, the issue its that the mpts that the tabtps its showing with that small function , both given values isnt the same

#

so i was wondering how to measure properly to give me the same value as the taptps shows, because i only want that function to be used with other experimental things.

eternal oxide
#

tps is not mspt

tiny tangle
#

i mean, the tabtps plugin

#

it has tps and mpst bar that shows both values on screen

eternal oxide
#

and you are assuming theirs is correct while yours is not?

#

mspt is as accurate as you are going to get it. Your code is fine. Any difference would be in their code

tiny tangle
#

probably, their github has many files many implementations i got lost on it, so probably i was wrong doing something or missing putting something

#

oh

#

its weird

#

because uhm as example, i was getting around 15 to 20 mpst with that plugin with constant update, as mine its giving 45 to 55

#

so i was kinda confused

eternal oxide
#

are you sure you and they are talking about the saem thing?

#

mspt is milliseconds per tick

#

tps is ticks per second

tiny tangle
#

yeah, my tps its stable at 20 , im not trying to get tps value

eternal oxide
#

the mspt will vary greatly depending on what is actually happening

#

on average it should be close to 50

#

are you sure the plugin is not showing you how many millis the tick took, not the time of each tick?

#

that may be a confusing statement

tiny tangle
#

if i could send a picture

eternal oxide
#

The work processed ina tick may not use up the whole 50ms

tiny tangle
#

to show

eternal oxide
#

it sounds to me like the plugin is showing how many ms was taken to process each tick

tiny tangle
#

uhm oh probably make sense, i mean i cannot differenciate the calculations

eternal oxide
#

Your code tells how long each tick is, which will always be very close to 50, unless overloaded

tiny tangle
#

im getting around 45 to 55 , but with the plugin its showing around 10 to 25 depends on the entities thats on the over the world

#

probably the plugin as you said its using other calculation formula

eternal oxide
#

45-55 sounds fine for teh time of a tick

#

if their value increases with more entities then its showing how long the tick took to process

#

the closer it gets to 50 would indicate getting close to an overload

tiny tangle
#

ok, i probably stick what you said hahah its giving me a bit crazy i will asume that the amount of 45 to 55 its fine

#

haha

#

so next step its to lower that amount so its gets better for performance?

eternal oxide
#

with their plugin, yes lower is better. Less load

#

with yours it should always be around 50 unless overloaded. less work will not lower yours

#

To accurately calculate teh load on the server you need a tick start time and a tick end time.

tiny tangle
#

uhm thats sounds kinda complex, what im trying to accomplish its to have a function reference over the average mpts value , then trying to "attempt" lower it to probe some experimental stuff to get some improvement % , but doing mine it seems

eternal oxide
#

two start times only tells you if its doing too much, it can;t tell you how little it is doing

#

you need to measure the start/end of the tick, which you can;t do in a scheduler

tiny tangle
#

ouch

#

make sense

#

bad thing its im trying to work "attempt" to do for hybrid server in mind, cannot use paper api and bukkit same time.

#

doing two start times probably dont help me go more further :C

eternal oxide
#

nope

tiny tangle
#

🤧 ☠️

#

hahaha

#

im glad to ask

#

i mean

#

thanks

eternal oxide
#

paper has extra events for tick start/end so its simpler for this kind of thing. Spigot does not. You'd have to implement your own

devout tangle
tiny tangle
#

can i ask

#

if and entity as example villager or animals etc , having modify their tick rate to near 0 , is it good for the server?

chrome beacon
#

Entities already tick every tick

#

and what do you mean by near 0

tiny tangle
#

i mean as for example the farmcontrol plugin, its like having many entities in one place, they move to much /tick rate very high?

#

does it reduce the tick rate near 0 to reduce all the movement to make these entities dont move like a near freeze state, being same as to have lower the tick rate?

thorny vortex
#

could someone help me with something possibly?

#

@EventHandler
public void onSilverFishAttackEvent(EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}

        if ((event.getEntity() instanceof Player)) {
            if ((event.getEntity().getLastDamageCause().getEntityType() == EntityType.SILVERFISH)) {
                event.getDamager().getType();
            event.setCancelled(true);
            EntityDamageEvent xd = event.getEntity().getLastDamageCause();
            ((Player) event.getEntity()).damage(20);
            event.getEntity().setLastDamageCause(xd);


        }
    }
}

}

#

I'm making a plugin. I want it to change the damage of a (Specific) mob. Example: I spawn a Silverfish instead of it doing its default attack damage I want it to do damage (4) when attacking player. This is what I have so far

eternal oxide
#

Don;t cancel the event, just setDamage

thorny vortex
#

so like this

#

@EventHandler
public void onSilverFishAttackEvent(EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}

        if ((event.getEntity() instanceof Player)) {
            if ((event.getEntity().getLastDamageCause().getEntityType() == EntityType.SILVERFISH)) {
                event.getDamager().getType()
            EntityDamageEvent xd = event.getEntity().getLastDamageCause();
            ((Player) event.getEntity()).damage(20);
            event.getEntity().setLastDamageCause(xd);


        }
    }
}

}

eternal oxide
#

no

kind patrol
#

Is there a good way to use brigadier with spigot, or should I just resort to paper?

thorny vortex
#

Im sorry very new this one the next step for me to go down just trying to learn new this this one might be a ltitle hard for me

eternal oxide
#

literally event.setDamage(xx)

chrome beacon
thorny vortex
#

@EventHandler
public void onSilverFishAttackEvent(EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}

        if ((event.getEntity() instanceof Player)) {
            if ((event.getEntity().getLastDamageCause().getEntityType() == EntityType.SILVERFISH)) {
                event.setDamage(20);
#

like that?

eternal oxide
#

yes

thorny vortex
#

code was fine but now when i spawn a silver fish it dose defualt attack damage?

#

i set it to 20 but dose nothign diffrent

eternal oxide
#

don't check LastDamageCause

#

its not happened yet

thorny vortex
#

just delete that then?

eternal oxide
#

getDamageSource and getEntityType is what you want

thorny vortex
#

Im sorry im very new to this

#

if (Player instanceof Silverfish?

eternal oxide
#

if(event.getEntity().getType() ==

thorny vortex
#

@EventHandler
public void onSilverFishAttackEvent(EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}

        if ((event.getEntity() instanceof Player)) {
            if ((event.getEntity().getLastDamageCause().getEntityType() == EntityType.SILVERFISH)) {
                event.setDamage(20);
eternal oxide
#

or event.getEntityType() ==

thorny vortex
#

if ((event.getEntity() instanceof Player)) {
if ((event.getEntity().getLastDamageCause().getEntityType() == EntityType.SILVERFISH)) {
event.setDamage(20);

#

my bad

#

if ((event.getEntity() instanceof Player)) {
if ((event.getEntityType() == EntityType.SILVERFISH)) {
event.setDamage(20);

eternal oxide
#

I said don;t use getLastDamageCause. Your damage has not happened yet

thorny vortex
#

I removed that

eternal oxide
#

the Entity in teh event is refering to who is going to be damaged. So in this case a Player

thorny vortex
#

@EventHandler
public void onSilverFishAttackEvent(EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}

        if ((event.getEntity() instanceof Player)) {
            if ((event.getEntityType() == EntityType.SILVERFISH)) {
                event.setDamage(20);
eternal oxide
#

getDamageSource().getDirectEntity() would be the silverfish

thorny vortex
#

Im lost

eternal oxide
#

if (event.getEntityType() == Player && event.getDamageSource().getDirectEntity() == SilverFish)

#

pseudo. fix where needed

thorny vortex
#

codes showing errors

eternal oxide
#

I said it was pseudo code

#

Its basic java to fix those errors

#

hover over each and see what it suggests

thorny vortex
#

im still learning basic java

#

@EventHandler
public void onSilverFishAttackEvent(EntityDamageByEntityEvent event) {
if (event.isCancelled()) {
return;
}
if (event.getEntityType() == EntityType.PLAYER && event.getDamager().getType() == EntityType.SILVERFISH)
event.setDamage(20);

            }
    }
#

I was able to get it to work thank you so much @E I really appricate it

eternal oxide
#

looks good

thorny vortex
#

Sorry im a little slow

#

learner

#

thanks for being patient and taking time!

#

been typing to fix this for 2 days haha

thorny vortex
#

anyone have a way of when i break a diamond block it drops a specific item with a specific chance of getting that item so far i have it to when a diamond is broken it spawns a NetherStar and a diamond but i want it to be rare chance of dropping the netherstar so its dose not always give one how would i do that?

#

@EventHandler
private void onDiamondBreak(BlockBreakEvent e) {
Block b = e.getBlock();
Player p = e.getPlayer();
if (p.getGameMode() == GameMode.SURVIVAL) {
if (b.getType() == Material.DIAMOND_ORE) {
e.setCancelled(true);
b.setType(Material.AIR);
b.getWorld().dropItem(b.getLocation(), new ItemStack(Material.NETHER_STAR, 1));
b.getWorld().dropItem(b.getLocation(), new ItemStack(Material.DIAMOND, 1));

#

how would i set a chance of getting the NETHER_STAR

rough sorrel
#

can someone help?

sullen marlin
#

random.nextFloat() < chance

rough sorrel
#

i cant figure out the code to change the hologram display of my crazy crates plugin

drowsy helm
#

Or are you trying to override it

rough sorrel
#

no i just gfound it

#

i just had to turn holograms toggle to false

quaint mantle
rough sorrel
#

i didnt sdee it before

rough sorrel
#

and found it luckilly

#

thx anywys

cedar flint
#

Does anyone know how Attributes work? I just tried doing to most simple form:

player.getAttribute(Attribute.ARMOR).setBaseValue(5.0);

but i still get an error that basicly saids attributes dont exist, like huh??

 Class org.bukkit.attribute.Attribute does not have member field 'org.bukkit.attribute.Attribute ARMOR'
chrome beacon
#

What version are you compiling against

cedar flint
#

Spigot 1.21

chrome beacon
#

.0?

cedar flint
#

Yes, just base 1.21 release

chrome beacon
#

It's GENERIC_ARMOR in 1.21

sly topaz
#

you should use the latest version available if you're already compiling against 1.21 tbh

cedar flint
chrome beacon
#

You've messed up your dependencies

cedar flint
#

Amazing

chrome beacon
#

How are you compiling the project

cedar flint
#

As in... building it...? Sorry trying to understand what you mean, not an expert xd.

chrome beacon
#

yes

cedar flint
#

For the project creation I used the Minecraft Development plugin for Intellij which was at that time only on 1.21 max, then I just hit build and put in my localhost plugin folder. I dont know how to get your answer sorry

chrome beacon
#

Does your project contain a pom.xml or a build.gradle(.kts)

cedar flint
#

Yes it contains a pom.xml

chrome beacon
#

Could you send it's contents

#

?paste

undone axleBOT
cedar flint
#

pasted it... i think?

chrome beacon
#

Now send the link

cedar flint
#

like so?

chrome beacon
#

The project is set to use 1.21.3

cedar flint
#

I see at the bottem with dependencies that it saids 1.21.3 is that the issue?

#

yes

#

ehm

#

Thanks a lot already btw

chrome beacon
#

Switch back to using ARMOR

#

also I suggest updating to .4

#

Simply change the number and click the little maven reload icon in the top right

cedar flint
#

Alright its loading

chrome beacon
#

When it's done open the maven tab on the right and find package under lifecycle

#

double click that to build

cedar flint
#

alr

#

done

chrome beacon
#

Now your plugin jar should be in your target folder

#

Also make sure that you run the plugin on a 1.21.4 server

#

to ensure it will work correctly

cedar flint
#

Yes il update. Thanks a lot

sly topaz
#

you mean 1.21.4

blazing ocean
#

1.20.4 🔫

chrome beacon
#

yes

blazing ocean
#

olivo when spring 🔫

chrome beacon
#

I keep writing/reading 1.20 💀

sly topaz
#

tbf so few time has passed since 1.20.4 that it doesn't seem right to write out 1.21.4 already lol

blazing ocean
#

?howold 1.21.4

undone axleBOT
sullen marlin
#

?1.8

undone axleBOT
blazing ocean
#

?howold 1.8.8

undone axleBOT
glossy laurel
#

how do I make lore not in italics with minimessage

nova notch
#
blazing ocean
#

<!i>

cedar flint
# chrome beacon Now your plugin jar should be in your target folder

Yes. I noticed paper doesnt have fully released 1.21.4 yet so just to be sure I downgraded the plugin again to 1.21.3 and setup a paper 1.21.3 server. Now the issue is that when I try to build instead of compiling into a jar file now it just idk how to put this ehh downloads the project folder into the target file.

chrome beacon
#

Also I don't quite understand your issue

cedar flint
#

idk, normally I hit build and the jar file updates/appears where it is suppost too, but after i downgraded from 1.21.4 to 1.21.3 again using the same method it just doesnt output a jar file, but the project itself(folders, classes, etc)

chrome beacon
#

Did you run package

cedar flint
#

after changing it back to 1.21.3 yes

chrome beacon
#

Could you show what it's outputting in an image

cedar flint
cedar flint
#

for example

chrome beacon
#

where is that screenshot taken

cedar flint
#

from file explorer

#

windows 11

#

i mean the issue is half fixed, i get my jar file at least so if you have anything more important to do please dont bother helping xd. Thanks anyway tho

chrome beacon
cedar flint
# chrome beacon where is that screenshot taken

oh sorry im retarted, please dont take the file explorer comment as an offense, didnt mean it like that i swear xd. It was from my plugins folder. There a new folder called production was created and clicking through the files gets me there

#

Thanks for all the help, problem solved itself. Doesnt happen anymore. Really thank you, would have never come up with this. (Edit: nv issue came back xd, not the greatest issue so its fine)

earnest girder
#

How can I get the moisture level of a block in PlayerInteractEvent? I am trying to cast event#getClickedBlock to Farmland but I am getting this error: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_21_R1.block.CraftBlock cannot be cast to class org.bukkit.block.data.type.Farmland (org.bukkit.craftbukkit.v1_21_R1.block.CraftBlock and org.bukkit.block.data.type.Farmland are in unnamed module of loader java.net.URLClassLoader

chrome beacon
#

Farmland is blockdata

earnest girder
#

so I cast event#getClickedBlock#getBlockData to Farmland?

chrome beacon
#

Yes

deep herald
#

for playing sounds, is it pitch then volume, or volume then pitch

chrome beacon
chrome beacon
#

You really should use your IDE for that

rough ibex
#

hover over the method

#

it will show you the docs

chrome beacon
#

^^

deep herald
chrome beacon
rough ibex
#

also paper

#

but regardless

chrome beacon
#

Open maven/gradle tab

#

And click download sources and docs

#

Should fetch them for you

deep herald
chrome beacon
#

Above that

#

It's a little download icon

deep herald
#

ah

deep herald
#

or there be exploits

rough ibex
#

regardless

deep herald
#

ok thx u

short pilot
#

does anyone have experience using the mythicmobs api?

#

i'm trying to make an existing mob spawn and set it to a custom faction for various player factions in my world

#

idk if that is possible though since it seems like each mob only has one faction assignable

short pilot
#

does anyone know why version.set in my build.gradle isn't recognized? I'm trying to follow the blogpost about using mojang remap

thorny vortex
#

So i wrote up some code but I want it so when player mines Diamond ore it gives them a chance of getting "Nether-Star" I Want to rename it to something else like "GOD STAR" and change the lore to "Sell in shop for cash" I have everthing done already just need help changing the name and lore when item is recived. this is what i got so far

short pilot
#

can anyone explain the difference between groovy and kotlin in context of gradle ? It appears my buildscript is using groovy

young knoll
#

Just different languages

#

That have different syntax

short pilot
short pilot
thorny vortex
#

like just staight paste it in the chat?

short pilot
young knoll
#

Kotlin is the standard now

thorny vortex
#

private final List<ItemStack> items = Arrays.asList(new ItemStack(Material.NETHER_STAR, 1), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR));
@EventHandler
private void onDiamondBreak(BlockBreakEvent e) {
Block b = e.getBlock();
Player p = e.getPlayer();
if (p.getGameMode() == GameMode.SURVIVAL) {
if (b.getType() == Material.DIAMOND_ORE) {
e.setCancelled(true);
b.setType(Material.AIR);
Player player = e.getPlayer();
player.getInventory().addItem(items.get(ThreadLocalRandom.current().nextInt(items.size())));
b.getWorld().dropItem(b.getLocation(), new ItemStack(Material.DIAMOND, 1));

sly topaz
short pilot
#

format it

sly topaz
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
short pilot
#

like this


temp = null;
sly topaz
#

you can just use the command for that explanation 😛

young knoll
#

That is

thorny vortex
#
public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
Becomes: ```java
public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
Becomes: private final List<ItemStack> items = Arrays.asList(new ItemStack(Material.NETHER_STAR, 1), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR));
    @EventHandler
    private void onDiamondBreak(BlockBreakEvent e) {
        Block b = e.getBlock();
        Player p = e.getPlayer();
        if (p.getGameMode() == GameMode.SURVIVAL) {
            if (b.getType() == Material.DIAMOND_ORE) {
                e.setCancelled(true);
                b.setType(Material.AIR);
                Player player = e.getPlayer();
                player.getInventory().addItem(items.get(ThreadLocalRandom.current().nextInt(items.size())));
                b.getWorld().dropItem(b.getLocation(), new ItemStack(Material.DIAMOND, 1));
young knoll
#

Certainly some code

short pilot
#

leetcode vibes

young knoll
#

I like the list that’s full of hot air

short pilot
#
private final List<ItemStack> items = Arrays.asList(new ItemStack(Material.NETHER_STAR, 1), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR));
    @EventHandler
    private void onDiamondBreak(BlockBreakEvent e) {
        Block b = e.getBlock();
        Player p = e.getPlayer();
        if (p.getGameMode() == GameMode.SURVIVAL) {
            if (b.getType() == Material.DIAMOND_ORE) {
                e.setCancelled(true);
                b.setType(Material.AIR);
                Player player = e.getPlayer();
                player.getInventory().addItem(items.get(ThreadLocalRandom.current().nextInt(items.size())));
                b.getWorld().dropItem(b.getLocation(), new ItemStack(Material.DIAMOND, 1));
thorny vortex
#

thank you i cant figure out how to do that i guess haha

short pilot
sly topaz
#

well, to the question, what is this code supposed to do

short pilot
#

on block break he wants to drop diamond it appears or give a wither star he said

#

\nether star*

thorny vortex
#

So i wrote up some code but I want it so when player mines Diamond ore it gives them a chance of getting "Nether-Star" I Want to rename it to something else like "GOD STAR" and change the lore to "Sell in shop for cash" I have everthing done already just need help changing the name and lore when item is recived. this is what i got so far

short pilot
#

i think you need to make the nether star object first (item or something) and then change its name, before giving it to the player inventory

thorny vortex
#

It is a object already in the game

short pilot
thorny vortex
#

it works when i break a block i recive the nether star i just want it to be chaged to a diffrent name

short pilot
thorny vortex
#

ive never done that before

#

im just learning 5th day in

short pilot
#

like

ItemStack netherStar = new ItemStack(Material.NETHER_STAR);
#

or something

thorny vortex
#

just throw that in the code?

short pilot
#

and then change its name from there and you can do

player.getInventory().addItem(netherStar);

or something

warm mica
#

is there like an easy way to create nms patches for spigot that just works without hassle on windows

thorny vortex
#

dereC4 could you call me rq i can share screen?

short pilot
#

uh ok

sly topaz
warm mica
#

without all mingw crap? tried to use the one built into git and it didn't work. at that point i lost the motivation

sly topaz
#
private static final ItemStack CUSTOM_ITEM = new ItemStack(Material.NETHER_STAR, 1);

static {
  var meta = CUSTOM_ITEM.getItemMeta();
  meta.setDisplayName(ChatColor.GOLD + "GOD STAR");
  meta.setLore(List.of(ChatColor.GREEN + "Sell in shop for cash"));
  CUSTOM_ITEM.setItemMeta(meta);
}

@EventHandler
public void onDiamondBreak(BlockBreakEvent event) {
  var block = event.getBlock();
  var player = event.getPlayer();

  if (player.getGameMode() == GameMode.SURVIVAL && block.getType() == Material.DIAMOND_ORE) {
    /* Is there any reason to cancel really? Uncomment it if you believe so
    event.setCancelled(true);
    block.setType(Material.AIR);
    block.getWorld().dropItem(block.getLocation(), new ItemStack(Material.DIAMOND, 1));
    */
    if (ThreadLocalRandom.current().nextDouble() < 12.5 / 100) { // 12.5% chance
      player.getInventory().addItem(CUSTOM_ITEM);
    }
  }
}

@thorny vortex

short pilot
#

horray i just helped him with understanding Math.random

sly topaz
#

I don't normally spoonfed people but I don't really have the patience to explain what is wrong with their original code lol, I'd rather they just look at the differences

young knoll
#

Since they just drop the Diamond anyway there is no reason to cancel

sly topaz
short pilot
#

i think the main thing was that the list of air was trying to simuate probability but there's no need since you can just pick a random number and give the item based on the results

sly topaz
#

maybe they had a reason for that

young knoll
#

It breaks fortune

#

That’s about it

short pilot
#

and you dont actually need the list, you can just give each item individually esp since you want to have a custom name/item lore for the Nether Star

young knoll
#

Shout out to weighted randoms

short pilot
#

so complicated for just two items 🥺

#

ok so my turn

#

i made a custom wither skeleton mob, how do i spawn it into my world through say any placeholder event

#

right now it's meant to just stand there

sly topaz
#

you just get the world handle and then do addFreshEntity on it

smoky anchor
young knoll
#

Level#addFreshEntity

short pilot
#

what's the difference between the addEntity and addFreshEntity

young knoll
#

Is addEntity even a thing

sly topaz
#

was going to say

short pilot
#

nvm looks like it is for the World itself but not handler

smoky anchor
# sly topaz why not

If you spawned two items and modified one of them, the second one could get modified as well.
I think it was something like this, someone please correct me, its late and I can barely function.

young knoll
#

Pretty sure drop item makes a clone

smoky anchor
#

He adds it directly to the inventory

short pilot
#

i can barely function is relatable 😭😭

cosmic elk
#

does anyone have any insight on how I could possibly remove a player UUID from the 'rewarded_players' in a trial vault? (i tried to upload a picture i couldnt though)

sly topaz
#

if it ultimately is, then just cloning the item each time it is added should do

smoky anchor
#

Alright then, good to know

sly topaz
#

good catch still, I had to open the spigot repo to check if it makes a copy because that could totally happen lol

young knoll
#

You’ll have to use NMS

sly topaz
#

don't know who was the person who asked about the countdown, but there's likely a better way to do that countdown lol

cosmic elk
sly topaz
#
private record CountdownStep(String message, float exp, int level) {}

private static final CountdownStep[] STEPS = {
        new CountdownStep("§c§l1", 0.33f, 1),
        new CountdownStep("§e§l2", 0.5f, 2),
        new CountdownStep("§a§l3", 1.0f, 3)
};
private void startCountdown(Player player, NPC npc, AttackDifficulty currentDifficulty) {
    int[] countdown = {STEPS.length};
    Bukkit.getScheduler().runTaskTimer(Clutches.getInstance(), task -> {
            countdown[0]--;
            if (countdown[0] >= 0) {
                var step = STEPS[countdown[0]];
                ServerApi.getInstance().getService(ITitleService.class).sendSubTitle(player, step.message(), 1, 20, 1);
                player.setExp(step.exp());
                player.setLevel(step.level());
           } else {
             executeHit(player, npc, currentDifficulty);
             task.cancel();
           }
        }
    }, 0L, 20L);
}
short pilot
#

where shoudl i set output directory for my buildtools (im trying to get remapped)

young knoll
#

Doesn’t really matter

#

The remapped sources get installed to your mavenLocal

short pilot
#

ok

grizzled bridge
#

Hey, am I losing my mind? Some classes just seem to not exist? Like for example EntityType

#

Cannot resolve symbol 'EntityType'

#

And when i go into my external libraries folder, I only find a EntityType.class file not the standard java file

young knoll
#

Update IntelliJ

grizzled bridge
#

It’s on the latest version

#

I’m using Java 23

#

And I have the latest gradle version as well if that matters

grizzled bridge
young knoll
#

Old versions had problems with enums and java 21+

grizzled bridge
#

Thanks! I’ll lyk if it worked

fossil ridge
#

How do I check when a player is close to the border? I thought about checking that x/z equals 30m/-30m but that is extremely inaccurate because the player is not bound to go in one direction but instead they can go to the side / reach the intersection of corners

#

Maybe I can make a bounding box with 29999995 blocks (like a square) and check if the player is outside of that bounding box? Like a reverse world border? There has to be a better way..

river oracle
#

its not very intensive, it does what you want and its simple

fossil ridge
#

okay, just thought there was a better way. thank you!

grizzled bridge
sly topaz
grizzled bridge
short pilot
#

so from what I've read

#

you're not supposed to do anything in registerGoals with custom entities and NPCs? You have to register them in the constructor?

sonic goblet
sly topaz
#

if you do want the default goals and also want to add your own, then you just override it, call super.registerGoals and then register your own goal

short pilot
#

by leaving the register goals empty i see

#

so we override it and implement nothing

#

is there any guide for goals in spigot like there is for databases/commands

#

or any good posts

sonic goblet
# short pilot how do you remove default goals?

I keep a list of all the names of goals I want to remove then after spawning I get the GoalSelector of the entity and remove the goal(s) if found. I will mention that my usecase for this is very specific so depending on what you're trying to do this method might not work

grizzled bridge
#
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001989313d8, pid=89433, tid=39683
#
# JRE version: Java(TM) SE Runtime Environment (23.0.1+11) (build 23.0.1+11-39)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.0.1+11-39, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# C  [libsystem_platform.dylib+0x13d8]  _platform_strcmp+0x8
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/craftinators/Desktop/Barium/run/hs_err_pid89433.log
[37.940s][warning][os] Loading hsdis library failed
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

> Task :runServer FAILED

I keep getting this crash whenever I try and run my server?

sly topaz
short pilot
#

hey fellas is there a better way to do this spawning for my custom mob (idk if it even works yet)

                    Location location = player.getLocation();
                    ServerLevel world = (ServerLevel) ((ServerPlayer) player).getCommandSenderWorld();
                    CustomWitherSkeleton customWitherSkeleton = new CustomWitherSkeleton(world);
blazing ocean
#

are you using jetbrains runtime?

grizzled bridge
blazing ocean
#

probably is

grizzled bridge
blazing ocean
#

that's unrelated

#

oh you're using hotspot

grizzled bridge
#

lol oops

blazing ocean
#

try something like temurin 21

#

or adoptium/coretto/whatever

grizzled bridge
#

Also, java 21 did work!

blazing ocean
grizzled bridge
#

what do you think caused the issue for java 23

blazing ocean
#

¯_(ツ)_/¯

grizzled bridge
#

fair inflatable

blazing ocean
#

java 23 doesn't work well with MC, especially paper

sonic goblet
#

Off the top of my head the method is like #addFreshEntity or something. I think someone sent the method name to you yesterday

sly topaz
#

because if you don't, you might not need a custom entity at all

sonic goblet
short pilot
short pilot
#

set by constructor

sonic goblet
short pilot
#

it's just that that is a lot of casting

#

lmao ur pfp is like doof from phineas and ferb

#

with squidward

sonic goblet
#

And yes lol

short pilot
#

ok

quaint mantle
#

Its possible to display blocks in any hologram (armor stand name)???

smoky anchor
#

Name can only display text, but you could use a resourcepack with custom font.

#

(Also, if you're on newer versions, you should be using Text Display instead of armor stand)

quaint mantle
#

And how they do this?

#

Like the apple there

smoky anchor
#

This is something a bit different.
Depending on version, this either uses Item Display or just armor stand holding an item.

#

This way it's basically impossible to show an item within the text.
Players can have resourcepack that changes the scale of text and your item would not be aligned correctly then.

quaint mantle
#

I'll use text displays then

#

thanks!

tiny tangle
#

people saying dont recommend using armor stands because lag and its buggy not safe?

smoky anchor
#

I don't understand the "buggy not safe"
But it is true that Display entities perform better than Armor Stands.

tiny tangle
#

not sure if theres a guide to use the holograms plugin their api to make custom display plugin

tiny tangle
smoky anchor
#

Yes, they are much better

tiny tangle
#

but to manage display entities can be some complex, mine one, the text still being displayed behind walls or if distance was a bit far, the text still there

#

:C

smoky anchor
#

It's really not complex.
Look at wiki (or docs) to see what properties the display entities have.

blazing ocean
#

Display entities are enough.

tiny tangle
#

yeah, i just started so make sense using simple methods

#

does anyone knows a github opensource to know how to stackmobs

#

mine one its using like not efficient method :C , cannot figure it out how to do it properly, im just remove the entities to be stacked then making a single entitiy with "imaginary" stack amount, then uppon killed re spawn a new one .

chrome beacon
#

That's how you do it

tiny tangle
#

oh?

#

really

#

?

#

omg

#

jsadhajsdh

chrome beacon
#

Just don't use the entity name to detect your entities

blazing ocean
#

PDC or UUID

tiny tangle
#

🤪 , the issue that i have its like, whenever I reset the server to shutdown then turn on, the "imaginary" stack amount got reset to 1

chrome beacon
#

and mark your entity in the spawn method consumer so it's easy for others to track

blazing ocean
#

olivo

blazing ocean
#

when spring 🙏🔫

tiny tangle
#

I glad to ask, what its PDC

blazing ocean
#

?pdc

tiny tangle
#

oh

#

this is

#

new for me , thanks a lot

#

im seeing that , to prevent that if player set a custon tag with 99999 amount, it will set the entitty to be 99999 amount xD

#

im so much afraid that uppon dead of that entity , the server will kabom

chrome beacon
#

You don't respawn all the entities on death

#

you just spawn one with the tag and it's value lowered

tiny tangle
#

ah, haha ok

#

yeah, thats makes sense

#

well i dont have the kill all stack at once function yet, but nice to know it

thin isle
#

Why does my world not load using Bukkit.getServer().createWorld(new WorldCreator("worldName"));?

eternal oxide
#

when are you calling that code?

thin isle
#

its called when someone uses a specific command

eternal oxide
#

So long as the code is not called async it will work fine

thin isle
#

why cant i send images

eternal oxide
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

thin isle
#

its stops after "Preparing start region for level 1 (Seed: ...)

undone axleBOT
#

Usage: !verify <forums username>

thin isle
eternal oxide
#

that log doesn't look like a spigot log

eternal oxide
#

also you called it testWorld but it's trying to gen level 1?

thin isle
#

the world itself is called "test" but the "testworld" string has a different meaning for me

eternal oxide
#

?paste the relevant code

undone axleBOT
thin isle
eternal oxide
#

does the server actually crash at that point?

thin isle
#

it does not crash

#

it just stops to load the world

eternal oxide
#

so everything else continues to work?

thin isle
#

yes

eternal oxide
#

try delaying your teleport as you are on 1.8

#

also confirm your spawn location is valid

thin isle
#

it does not even tp the player, I have to run the command twice to get tpd

eternal oxide
#

yes, delay the tp

thin isle
eternal oxide
#

likely your spawn location is null

#

check its valid. sysout

thin isle
#
        String[] split = location.split(",");
        String worldName = split[0].split(":")[1];
        double x = Double.parseDouble(split[1].split(":")[1]);
        double y = Double.parseDouble(split[2].split(":")[1]);
        double z = Double.parseDouble(split[3].split(":")[1]);
        float yaw = Float.parseFloat(split[4].split(":")[1]);
        float pitch = Float.parseFloat(split[5].split(":")[1]);

        return new Location(Bukkit.getWorld(worldName), x, y, z, yaw, pitch);
    }```

I think I have to load the world before I return the location right?
eternal oxide
#

when you call that your world does not exist

thin isle
#

the file exists, but the world is not loaded at this point

thin isle
#

ok yeah thank you i fixed this problem

grave depot
#

?screen

#

?sc

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
__**Admin:**__

selfrole Add or remove a selfrole from yourself.

__**Cleanup:**__

cleanup Base command for deleting messages.

__**Core:**__

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

__**Downloader:**__

findcog Find which cog a command comes from.

__**Mod:**__

names Show previous usernames, global display names, and server...
userinfo Show information about a member.

__**ModLog:**__

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

__**Permissions:**__

permissions Command permission management tools.

smoky anchor
undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

grave depot
#

thanks haha

#

Hey guys, how could i get all the blocks of a players own field in a map.. this field is in any map different and there is only one main point (that is the beehive a player can claim). Any ideas how i could do that? https://prnt.sc/bLUYiu1CceMd
I would need all the blocks their location stored in a list or map, within the wooden blocks.. only problem is that in any server the cords are different so how could i do that?

rough ibex
#

Are you asking about getting the blocks in a volume?

grave depot
#

One second!

#

As you can see their are 2 bee hives and 2 fields, when a player claims beehive 1, i need to get the block locations of field 1 and not 2

indigo grotto
#

Heya are we allowed to look for developers in this channel or in general?

grave depot
#

how could i do that?

blazing ocean
undone axleBOT
rough ibex
grave depot
#

what do you mean with boundingbox?

river oracle
#

?jd-s

undone axleBOT
grave depot
#

oh wow

#

so what i coùld do is look around the hive in a radius of lets say 5 blocks for a water source, add the boundingbox to the water source (the location) and expand the boundingbox by 1 in every direction, that way the boundingbox is like a 3x3?

manic delta
#

how does plugins like ItemsAdder recognize from what spigot acoount the plugin came from? any idea?

river oracle
#

like when you boot up the plugin? I'd assume they do some matching from ID to nonce

river oracle
#

spigot gives replacements in premium plugins

#

that are unique to each account

manic delta
#

where i can find that

#

🤔

#

i have a premium one

manic delta
#

thank you

earnest girder
#

is it possible to make a player hold a regular item the way they hold a loaded crossbow? (with both hands)

shadow night
#

It probably is

glossy laurel
#

Guys, my plugin is printing "null" when I execute a command but idk where from, help 😭

ivory sleet
#

got any code?

quaint mantle
glossy laurel
#

looked for all printing methods I knew and found nothing

chrome beacon
#

Because you're inverting the value of stepIndex

fleet pier
#

bruh