#help-development

1 messages · Page 428 of 1

icy beacon
#

?

#

1.16.5 unmapped

quaint mantle
#

Yes

icy beacon
#

?

#

oh it's you

quaint mantle
#

О

tardy delta
#

why is entity ai not in the api 🤔

icy beacon
#

i have no idea 😭

#

this is basically the last thing i need to get working before the plugin is complete

#

i was thinking of manually checking the entities' positions every tick

#

and making them run away

#

but that feels heavy

#

no?

sly venture
#

how to use TextDisplay?

#

org.bukkit.entity.TextDisplay;

icy beacon
#

i guess spawn one like you normally would spawn an entity

#

and then do what you please

sly venture
#

ok thanks

icy beacon
#

tried doing it

sly venture
#

This is how it works! Let me know if there's a better way!

icy beacon
#

looks good to me 🙂

sly venture
icy beacon
#

alex, maybe you know?

icy beacon
#

i'm currently looking through tweakin' source code trying to figure out what sachin did lol

tender shard
#

I#d extend the existing goal, then print out stuff in canUse(), tick() etc and see whether / when it actually runs

icy beacon
#

oh maybe

#

yeah sachin does extend it too

tender shard
icy beacon
#
public class FleePathfinder<T extends EntityLiving> extends PathfinderGoalAvoidTarget<T> {
  public FleePathfinder(EntityCreature var0, Class<T> var1, float var2, double var3, double var5) {
    super(var0, var1, var2, var3, var5);
  }

  @Override
  public boolean a() {
    System.out.println("Can Use called");
    return super.a();
  }

  @Override
  public void e() {
    System.out.println("Tick called");
    super.e();
  }
}

gonna try this

tender shard
#

also check what super.a() returns

icy beacon
#

true

#

sure

#

on second thought i think that it's indeed the correct behavior

#

just ambigious naming

#

it does avoid the player entity for some time

#

idk

#

i'll test anyway

tender shard
#

if another goal is still running and returns "canContinueToUse" or what's it called, then it continues to use the already running goal, even when that has a lower priority

icy beacon
#

can a priority be negative?

tender shard
#

idk

icy beacon
#

i'll test too ig

#

because i'm currently using 0

#

for this

#

and yeah it never outputs Tick called

icy beacon
tender shard
#

e.g. the pig at the end, it's a MoveToBLockGoal, and it also takes 1-2 seconds before it starts to use that goal, that's normal. only thing to prevent this is probably to get rid of all other goals, and only add them back once your goal has started to run

icy beacon
#

hmm

#

only thing to prevent this is probably to get rid of all other goals, and only add them back once your goal has started to run

#

I could do that indeed

#

remove all the goals but store them, give it an avoid goal, then readd the goals

ocean hollow
#

how to check is block generated?

icy beacon
#
  public static void addRunAwayPathfinder(final EntityCreature entity) {
    final List<PathfinderGoalWrapped> goals = entity.goalSelector.d().collect(Collectors.toList());
    goals.forEach(goal -> entity.goalSelector.a(goal));

    entity.goalSelector.a(0, new FleePathfinder<>(entity, EntityPlayer.class, 3, 1.2D, 1.5D));
    entity.goalSelector.a(1, new PathfinderGoalPanic(entity, 1.55D));

    goals.forEach(goal -> entity.goalSelector.a(goal.h(), goal));
  }

this might work

#

any tips to improve this before i go and test?

halcyon hemlock
#

Just try it and debug lol

icy beacon
#

still outputs false 😦

icy beacon
#

not like i was gonna do that

halcyon hemlock
#

Ill help when i get home im in gym rn

icy beacon
#

alrighty

#

have a nice workout

remote swallow
tender shard
#

?paste

undone axleBOT
tender shard
#

and then just add it to some entity:

    public void addGoal(Creature creature) {
        AvoidPlayerGoal avoidGoal = new AvoidPlayerGoal(creature, 20);
        EntityUtils.getGoalSelector(creature).addGoal(avoidGoal, 0);
    }
icy beacon
#

hmmmm

#

let me take a look

ocean hollow
#

How to check is block generated?

icy beacon
#

I can't seem to find CustomGoal anywhere in NMS, is it jefflib?

#

oh yeah it is

icy beacon
#

wow

#

jefflib has like literally everything

eternal oxide
#

Its not got a kitchen sink!

icy beacon
#

you sure?

#

you didn't look well enough

icy beacon
#

i'll investigate now

remote swallow
#

have you considered telling it not to crash

icy beacon
#

my bad

young knoll
#

Man now I want to add goal api to spigot

icy beacon
#

i'll do that now

remote swallow
#

do it

icy beacon
#
@Override
  public void tick() {
    getNavigation().moveTo((BlockVector) RandomPos.getPosAway(
        (Creature) getBukkitEntity(),
        10,
        10,
        nearbyPlayer.getLocation().toVector()),
      1);
  }
#

so apparently this was null

remote swallow
icy beacon
#

and it crashed the entire server

#

nms is so cool

young knoll
tender shard
#

that's how the vanilla goals do it too iirc

remote swallow
tender shard
#

in your custom goal

icy beacon
#

ah

#

alr

young knoll
remote swallow
#

no it was smooth before that

icy beacon
#

?paste

undone axleBOT
icy beacon
#

or should i also generate it in tick()

#

i'll go test it

tender shard
#

canUse() -> check if a player is nearby, then return true
start() -> nothing
tick() -> check if we got a destination location, if yes move towards there, if no get a new target location (RandomPos)
canContinueToUse() -> check if player is still nearby

icy beacon
#

oh alr

#

jefflib is like a fresh grasp of air for this project

#

damn

#

note to self - always use remapped from the beginning and never use nms for under 1.18

#

xD

tender shard
#

don't forget to add the <filters> to maven-shade-plugin if you use minimizeJar

icy beacon
#

i don't minimize, it's fine

tender shard
#

1.17 also has remapped

icy beacon
#

oh

#

thought it was 1.18+

tender shard
#

1.17+ it is

icy beacon
#

ok it crashed but this time it was my mistake i think

#

yeah it's on my behalf

#

oh i just realized

#

i want it to always be active, so that the pig always goes away from players that appear nearby

#

so should i set canContinueToUse to true

#

instead of a player proximity check

#

and then just do checks to make sure to do nothing if there's no player nearby

#

yeah i'll do that i think

icy beacon
#

it'll just keep running away

#

what else could i do

remote swallow
#

sleep

icy beacon
#

i have a lesson of english in 4 minutes

remote swallow
#

sleep anyway

icy beacon
#

nah i skipped two this month already

#

and i only have 4 per month

#

i think i have an idea

young knoll
#

Tbf a custom pathfinding ai doesn’t seem too difficult actually

icy beacon
#

i have yet to create a single ai, period

#

but a pathfinding ai sounds fun

#

though i'll probably eat my words

young knoll
#

You just need an interface with the methods and then a class that can hold said interface and delegate the methods

terse ore
#

skript has an in-built pathfinding method, you could check the source code

icy beacon
#

skr*pt

terse ore
tardy delta
#

skript 💀

icy beacon
#

alr i'll head off for my english lesson and test my code 1.5 hours later

terse ore
#

when I switched to Java I checked it's source code to see how to do some stuff

young knoll
#

Granted that’s just for adding new goals

#

You’d have to do something so the existing goals are abstracted somehow

#

I guess you’d want an implementation similar to BlockPopulators in world

vocal cloud
#

Explain why you'd need to do that? There might be a better method

#

You could store the code to run as a runnable alongside a completable future and cancel the future and immediately run the runnable code

#

I'm talking about the future you get back when you schedule something

#

Cancel it and run the code you had queued inside of it

ivory sleet
#

you can derive a scheduled executor service thread pool impl and create some sort of cancellable class that it returns

quaint mantle
#

is there a method to change the colour of water in a cauldron

ivory sleet
#

think u need nms for that

quaint mantle
#

I’m using NMS in my project

frank kettle
#

"Give me code"

chrome beacon
#

The color of the water depends on the biome that the cauldron is in

#

So what you need to do is set the biome where the cauldron is

quaint mantle
remote swallow
#

thats bedrock

chrome beacon
#

^^

quaint mantle
#

Is it not Java too

remote swallow
#

sadly not

chrome beacon
#

No it's bedrock only

icy beacon
#

@tender shard sorry for pinging you, but could you take a look? i can't get it to work no matter what i do: i want the goal to always be active and it is, it always says "ticked", but for some reason the pig does not care and stands in place
https://paste.md-5.net/layuqusuva.java

quaint mantle
#

Damn that’s crazy

icy beacon
#

fixing minor stuff

#

the code is quite scuffed though lol

#

i'll need to measure the perf

quaint mantle
#

nah I needed vanilla

indigo frost
#

hi, in my plugin, how would I be able to get the amount of players within a certain distance of a block?

indigo frost
#

ah ty

quaint mantle
#

hlo

#

How to fix raid is not working properly in my server evokers and witch are not spawning

kind hatch
quaint mantle
#

ohk thanks

icy beacon
#

mobs with custom PathfinderGoalMeleeAttack don't cause EntityDamageByEntityEvent???

#

what the fuck

regal scaffold
#

Does bukkit#getScheduler#runTask run every 1T

icy beacon
#

runTaskTimer does i think

kind hatch
#

You specify how often it runs

icy beacon
#

with 1L

kind hatch
#

Yes it's in ticks

regal scaffold
#

Not in runTask

icy beacon
#

as an arg

#

runTask is run once afaik

regal scaffold
#

Are you sure?

icy beacon
#

try it and see?

remote swallow
#

yeah

icy beacon
#

why don't you just use runTaskTimer

regal scaffold
#

I did which is why I'm confused

kind hatch
#

Oh wait, yea. runTaskTimer is what you want.

remote swallow
#

runTask runs the consumer the next tick

regal scaffold
#

I will, was just wondering what the default was

kind hatch
#

I don't think there is a default considering it asks you for a period parameter.

icy beacon
#

i have a custom pig that attacks me but apparently edbee is not called

icy beacon
#
@EventHandler
  public void onAnimalDamagePlayer(final EntityDamageByEntityEvent event) {
    System.out.println(1);
    ...
  }
regal scaffold
#

This doesn't even run multiple times just once like it was said above

icy beacon
#

1 is never outputted

regal scaffold
#

So now figuring out why it's getting run non-stop

kind hatch
icy beacon
#

do you have any idea how i can do that? my pig indeed attacks, and she lands quite a punch

kind hatch
#

I meant it might not send an event since normally they don't attack at all.

icy beacon
#

i guess, but in that case how'd i detect when it hits so that i can send an event?

#

it's an nms pig, do you want to see the code?

#

though this is sufficient i think

      this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
      this.goalSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityPlayer.class, true, false));
kind hatch
#

You might be able to call the event with PluginManager#callEvent()

icy beacon
#

yeah but when

kind hatch
#

Maybe on the EntityTargetEvent

icy beacon
#

hmm

#

perhaps

#

but wouldn't that only be called when the pig finds a target?

#

aka once\

kind hatch
#

What do the boolean values represent in those goals?

icy beacon
#

pretty sure it's like "can detect through walls" and something else

#

one sec

#

false - mustReach
true - mustSee

kind hatch
#

What about the normal EntityDamageEvent?

icy beacon
#

hm

#

one sec

#

i do need to have the damager present though

#

but maybe i'll find a workaround

noble crown
#

hi, is it possible to move display entity smoothly?

for (int i = 0; i < 9; i++)
            Bukkit.getScheduler().runTaskLater(plugin, () -> entity.teleport(entity.getLocation().clone().add(0, 0.2, 0)), 1);

^ worked well on armorstands, but not on block display entity

icy beacon
#

to move an entity smoothly i think you need to use NMS, but I really hope there's a better way

#

unless you just move it very slowly per tick

kind hatch
noble crown
#

it's an old code

#

but i can try it

regal scaffold
#

How can I set a mob to not be collidable. As in, I don't want the player to be able to push it around but yes to hit it

kind hatch
regal scaffold
#

If I extend EntitySmile for example

icy beacon
#

not called

#

i'll go have dinner and think about what i can do here

#

if you have any ideas please suggest them

regal scaffold
#

Pretty sure it can be done using team scoreboards but it's not working correctly

#
    public static Team getCollisionDisabler() {

        Scoreboard defaultBoard = Bukkit.getScoreboardManager().getMainScoreboard();

        if (defaultBoard.getTeam("collide-disabler") != null) return defaultBoard.getTeam("collide-disabler");

        Team team = defaultBoard.registerNewTeam("collide-disabler");

        team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);

        return team;

    }
noble crown
kind hatch
sick edge
#

Hi, is there any easy way to get a list of all the in survival obtainable items?
My first idea is getting all the Material values and filtering with isItem and then removing all the creative items 🤔

kind hatch
regal scaffold
noble crown
regal scaffold
#
  public Ball(Game game) {

    super(EntityTypes.aD, ((CraftWorld) game.getCourt().getWorld()).getHandle());

    Location spawn = game.getCourt().getBallSpawnLocation(game.getTurn());

    setLocation(spawn.getX(), spawn.getY(), spawn.getZ(), spawn.getYaw(), spawn.getPitch());
    setInvulnerable(true);
#

Can I just get the instance of LivingEntity from (LivingEntity) getBukkitEntity();

kind hatch
#

Is that NMS?

regal scaffold
#

Yeah

kind hatch
#

Any reason you can't just use the Slime class?

regal scaffold
#

Ummmm

noble crown
#

i mean, how can i move it smoothly with nms

regal scaffold
#

What if I say it's not NMS then

#

Can it be done without it?

kind hatch
#

Probably, but it depends on what you're trying to do. Unless you stated that earlier in which case I missed it.

regal scaffold
#

How can I set a mob to not be collidable. As in, I don't want the player to be able to push it around but yes to hit it

#

Specifically, a slime which is a "ball"

#
    LivingEntity bukkitEntity = (LivingEntity) getBukkitEntity();
    bukkitEntity.setCollidable(false);
kind hatch
#

I got that part. I'm asking what your plugin does that requires you to use NMS.

regal scaffold
#

Heavily doubt that works

#

It doesn't require nms

#

I rather not use it if possible

kind hatch
#

Then why are you using it now?

regal scaffold
#

Yeah I shouldn't be, changing craftworld

kind hatch
sick edge
young knoll
#

A lot of blocks are also items

sick edge
young knoll
#

Yes all blocks have a Material associated with them

sick edge
#

My list is made up of materials

young knoll
#

If they didn’t spigot would implode

halcyon hemlock
#

hi guys

dusty sphinx
#

Does craftbukkit make any changes to the server beyond those absolutely necessary to implement the Bukkit api, or are those changes deferred to spigot-server

kind hatch
sick edge
kind hatch
#

Oh wait, I misread it.

#

My bad

sick edge
#

all good 😅

regal scaffold
#

If I want to make a mob be pushed in a specific direction

#

Can't I just use Slime#setVelocity(velocity);

eternal oxide
#

using velocity can work on a mob, but you risk the next tick it's AI cancelling whatever you did

dusty sphinx
regal scaffold
#

I cancelled AI

#

That's why it doesn't move

eternal oxide
#

No AI = no Gravity

regal scaffold
#

How can I cancel it's AI but still have it move

#

It's pathfinding, more like

eternal oxide
#

you'd have to apply your own AI

regal scaffold
#

And make it null

#

Or like, empty

#

Gotcha gotcha

dusty sphinx
kind hatch
#

By default, it uses it's own obfuscated ones. If you use the mojang mappings, you get the ones made by... well... mojang.

dusty sphinx
#

i mean that makes sense

#

so CraftBukkit has it's own set of mappings?

eternal oxide
#

pretty sure Spigot mostly uses Mojang mappings now

dusty sphinx
#

so like

remote swallow
#

for classes they have their mappings

#

but fields are all still obsfucated

eternal oxide
#

thats no mappings

remote swallow
#

arent class names obsfucated?

#

i thought they were

eternal oxide
#

.a .b .c is obfuscated (no mappings)

dusty sphinx
#

https://linkie.shedaniel.me I'm trying to use this website to help transcribe a fabric mixin into a bukkit mod but I'm not sure which one is Bukkit

young knoll
eternal oxide
dusty sphinx
#

Oh shit awesome

#

Thanks

#

So like

#

The craftbukkit patches which mappping set do they use on that website

remote swallow
#

by default it would be spigot mappings

eternal oxide
#

depends on version but Spigot

dusty sphinx
#

does this website have a way to compare the Yarn mappings and the Spigot mappinsg

kind hatch
vital sandal
#

what that has a blue name :l?

remote swallow
#

its got changes that arent committed to its repo

vital sandal
#

oh

quaint mantle
#

How to fix raid is not working properly in my server evokers and witch are not spawning also i set difficulty to hard

icy beacon
#

where do you even get them from and why

dusty sphinx
#

arbitary I assume

#

they are fine i guess

young knoll
#

They are mappings from the fabric team

icy beacon
#

ty

ocean hollow
#

How to convert PlayerInventory to json for MySQL?

tender shard
#

why json?

#

you can turn ItemStacks into byte[]s using BukkitObjectInput/OutputStreams

ocean hollow
#

better in bytes, right?

tender shard
#

yes

#

json is unneccessary overhead

twilit roost
#

Anyone familiar with ZeroMQ?
I'm loosing my mind over it

ivory sleet
#

Ye

#

Used it once

twilit roost
#

im trying to send data from Bungee to Spigot 🔄
Current setup is DEALER - DEALER
can't send from nor side

ivory sleet
#

How does code look?

#

And what library

twilit roost
#

I wrote thru their docs and used parts of their code

#

maybe trying to use one socket?
cuz I don't want to deal with multiple sockets

icy beacon
#

uhh

ivory sleet
#

I didnt touch jero

icy beacon
#

entities' (like pigs) uuids are unique, right?

ivory sleet
#

But let me see

icy beacon
#

i'm dumbfounded

ivory sleet
#

Yes

#

That is correct

icy beacon
#

i'm very confused as to what's going on in my code then

#

hm

ivory sleet
#

UUID does stand for (universal sometimes) unique identifier

icy beacon
#

yeah i know

#

but i had no other options

#

like

#

i don't know why else things are happening\

ivory sleet
#

@twilit roost does bungee run the server

#

?

#

And backends become clients?

twilit roost
#

yep
imma send u where I took that

ivory sleet
#

The normal approach afaik is for u to have one socket per backend

#

And then let everything go through bungee

twilit roost
#
halcyon hemlock
#

Hey guys, I'm trying to use FAWE(FastAsyncWorldEdit), and I've encountered an issue. I know this is the spigot server, but since it's a spigot server might as well.
I'm trying to rotate a schematic and then get the blocks. but the clipboard itself isn't rotated. how can I get the rotated blocks?

icy beacon
#

if i don't modify a list, it shouldn't magically get cleared, right?

#

yeah i'm just asking stupid questions because i'm questioning my sanity atm

twilit roost
icy beacon
#

i feel like i started coding 2 days ago

#

for some reason after an animal dies, the list is cleared

#

and it never happened before

#

plugin.drops

#

actually the issue seems to be deeper, i'd have to explain my entire plugin to get someone's help so i'll just try to investigate on my own

#

i'm just slowly going insane because of too many hours put into this

#

probably some blunder

pseudo hazel
#

i cant find plugin.drops

icy beacon
remote swallow
#

using intellij?

young knoll
#

Debug all the things

#

All the sysouts

icy beacon
#

i am

#

i'm adding even more debugs as we speak actually

remote swallow
#

control + shift + f

#

search for plugin.drops

icy beacon
#

i did

#

and there's nothing

#

that could be the suspect

#

which is what upsets me

young knoll
#

Sounds like a public field

pseudo hazel
#

well if thats right then you have no issue 😄

icy beacon
#

half of what i use in my plugin class is getters

#

the other half is public field

#

why? fuck knows

#

but i found the suspect

pseudo hazel
#

this is why you shouldve cared

icy beacon
#
final List<AnimalDataHolder.Drop> currentValue = plugin.currentlyDropping.get(entity.getUniqueId());
currentValue.remove(drop);

apparently this deleted a value from plugin.drops as well???

young knoll
#

This is why we encapsulate

icy beacon
#

i guess yeah

#

i've probably gone insane after fucking with nms for so long

#

won't touch development with a 5-foot pole for like a week after i finish this

#

ok so

#

final List<AnimalDataHolder.Drop> currentValue = new ArrayList<>(plugin.currentlyDropping.get(entity.getUniqueId()));

#

this works

#

😭

#

sorta maybe kinda makes sense

#

but i don't want it to

young knoll
#

That creates a new list with a copy of the contents

icy beacon
#

yeah

young knoll
#

Where as the first one assigns them both to point to the same contents

desert loom
icy beacon
#

no they are not lol

#

why would they

icy beacon
#

that was an oversight

desert loom
#

I don't know. I can't think of why a separate list would update otherwise

icy beacon
#

let's forget that this discussion existed because i'm going to bed with hopes to not wake up again

#

cya

remote swallow
#

but money

tender shard
#

i usually have good coding ideas while sleeping

icy beacon
#

just a few touches to finish the plugin

#

but i'm not gonna do it today

young knoll
#

Smh delivering code with bad encapsulation

icy beacon
icy beacon
#

at first it has to work

#

then it will become clean

remote swallow
young knoll
#

People

#

Scary

remote swallow
#

make scarlet talk then

tardy delta
#

clean code

icy beacon
#

I think your code is about to fall down

#

it's inclined towards the left side

tardy delta
#

its from smth i forked

icy beacon
#

not guilty then

tardy delta
#

that dude probably doesnt know encapsulation is a thing

icy beacon
#

xd

tardy delta
young knoll
#

oh no

tardy delta
#

wait wha

#

man was too lazy to type File?

#

looks even worse than craftbukkit code

terse ore
#

fi

winged anvil
#

naming is hard

pseudo hazel
#

must be documented by someone else

#

surely the person who wrote the classes called Fi didnt write an entire paragraph explaining what it does

remote swallow
#

bet he just copied the File class

#

and changed it for Fi

tardy delta
#

its a file wrapper

tawny remnant
green falcon
#

Does spigot lazy-load worlds? in a plugin, if I have a world named "foo" and I don't call Bukkit.getWorld("foo") can I perform file operations then call Bukkit.getWorld("foo")?

quaint mantle
#

not load it.

tawny remnant
remote swallow
#

ouch

#

early returns

#

pls

#

but they arent in the active list

#

pr set

#

or

tawny remnant
#

why isnt your name pink anymore

remote swallow
#

my nitro ran out

tawny remnant
#

so how do i fix my thing

#

i dont get your answer

remote swallow
#

they arent in the list/set you have of active

tawny remnant
#

but how is it possible

remote swallow
#

you dont add them to it?

tawny remnant
#

i think i do

#

this works fine

remote swallow
#

sout the list before the if

tawny remnant
#

if where

#

the 3rd one?

remote swallow
#

yes

tawny remnant
#

ok

#

doesnt add it

#

the command

#

should i do it with hashmap isntead?

remote swallow
#

do you get the messages from the commnad

tawny remnant
#

yes

remote swallow
#

sysout the map after you send the "you have to kil X"

#

list not map

#

also where is the list and are you using the same instance of it

tawny remnant
#

you mean after the command?

remote swallow
#

after you send t he "quest started" message sys out the list

#

before that, where are these 2 methods

#

and where is thee list

tawny remnant
#

it does send my uuid

tawny remnant
remote swallow
#

are you modifying that list in the class or a new one

tawny remnant
#

is Main class

#

should i move the commands to the second class?

sick edge
#

How much more efficient is it to just create a huge list with all wanted materials vs to filter through all values of the Material class (Getting rid of maybe 50 items) 🤔 (The list is static)

remote swallow
tawny remnant
#

There are 2 classes Main and EndermanQuest. The list is created in EndermanQuest class, the commands in Main

hazy parrot
remote swallow
tawny remnant
hazy parrot
tardy delta
#

ahh cmon

indigo frost
#

how do i put text colors with hex codes instead of using § in the text?

quaint mantle
#

ChatColor#translatealternatecolorcodes

indigo frost
#

but then what do I input as the values?

hazy parrot
#

'&' and you text

quaint mantle
#

ChatColor.translateAlternateColorCodes(&, "your text")

tardy delta
#

bruh man does this for a few thousand blocks

#

atleast load it from a json file lol

tender shard
tardy delta
#

6000 lines of horror

indigo frost
#

what format does it need to be in?

tender shard
#

&x&f&f&0&0&0&0

#

would be ff0000

indigo frost
#

ah ok so I put & before each one

quaint mantle
#

oh the &

calm robin
#

&

tender shard
#

#123456 = &x &1 &2 &3 &4 &5 &6 (without the spaces, ofc)

indigo frost
#

it's not working

remote swallow
#

ChatColor.translateAlternateColorCodes('&', "stuff")

undone axleBOT
indigo frost
#

i already know java, its just the spigot API

#

i put exactly what you guys told me to

quaint mantle
icy beacon
#

oh my god

#

why do people always come for the advice yet think that they know better in that regard

remote swallow
icy beacon
#

^

indigo frost
#

i put it in a string, didn't work

remote swallow
#

so you check the method args?

young knoll
#

The method takes a char and then a string

#

Give it that

remote swallow
#

hovering over the method in intellij shows the args it wants

icy beacon
#

shh don't say anything he knows java

indigo frost
#

i've done all that

hazy parrot
indigo frost
#

i got it

young knoll
#

I mean that is basically what ever mods code looks like

vital sandal
tardy delta
#

ugh everything is public

vital sandal
#

in AnvilMenu or ContainerAnvil what is that int value represents ?

pseudo hazel
#

the only int I can think of is cost

vital sandal
sage patio
#

which line?

#

:I

#

PlayerDeathEvent

pseudo hazel
#

well maybe if you didnt crop it we could atually read what it said

pseudo hazel
#

wdym you didnt crop it

sage patio
#

oh i got what you mean

#

everytime i was an error details was under that

pseudo hazel
#

do you have any listeners for playerDeathevent?

sage patio
#

yes

#

d u want my code?

pseudo hazel
#

yes

sage patio
#
public void onPlayerDeath(PlayerDeathEvent event) {

        String item = "Dast";
        String killer;
        String victim = event.getEntity().getName();
        String deathMessage;

        if (event.getEntity().getKiller() != null) {
            killer = event.getEntity().getKiller().getName();
        } else {
            killer = null;
        }

        if (killer != null) {
            if (event.getEntity().getKiller().getInventory().getItemInMainHand() != null) {
                item = event.getEntity().getKiller().getInventory().getItemInMainHand().getItemMeta().getDisplayName();
            }
            deathMessage = Utils.getColorizedConfig("Death-Message-Normal")
                    .replace("%VICTOM%", victim)
                    .replace("%KILLER%", killer)
                    .replace("%ITEM%", item);
        } else {
            deathMessage = Utils.getColorizedConfig("Death-Message-NoKiller")
                    .replace("%VICTIM%", victim);
        }

        event.setDeathMessage(Utils.colorize(deathMessage));

    }
eternal oxide
#

also Paper, does it happen when running Spigot?

sage patio
#

String item = "Dast"; means Hand

vital sandal
#

what is PacketPlayOutOpenWindow in mojang mapping ?

eternal oxide
#

item in hand can be AIR which has no meta

sage patio
#

same while i test it with hand or items

#

with hand ^

sage patio
remote swallow
#

whats line 26 of player death listener

sage patio
#

item = event.getEntity().getKiller().getInventory().getItemInMainHand().getItemMeta().getDisplayName();

#

because its air right

remote swallow
#

it doesnt have a display name

sage patio
#

but why gives error while i'm killing someone with items?

eternal oxide
#

that item can be null or AIR. meta can be null as can display name

remote swallow
#

unless an item is renamed it has no display name

eternal oxide
#

you need better tests

pseudo hazel
#

and checking items basde on their names isnt optimial

#

consider using pdc for this kinda thing

#

?pdc

sage patio
#
if ((event.getEntity().getKiller().getInventory().getItemInMainHand() != null) &&
                    (event.getEntity().getKiller().getInventory().getItemInMainHand().getType() != Material.AIR)) {
                item = event.getEntity().getKiller().getInventory().getItemInMainHand().getItemMeta().getDisplayName();
            }
#

lemme test this

remote swallow
#

you want to check if it has a display name

#

and you can cache the item after the null check

#

before it actually

eternal oxide
#
ItemStack weapon = event.getEntity().getKiller().getInventory().getItemInMainHand();
if (weapon != null...```
remote swallow
#

^^

smoky oak
#

is there an equivalent to Block::isFunctional()

#

ie

#

crafting station & anything with inventory

eternal oxide
#

instancof InventoryHolder

smoky oak
#

does that also hold true for crafting tables?

#

my goal is to fire my event if and only if that right click wouldnt do anything else normally

#

item in hand is set

#

so i want to exclude everything you can interact with like chests, stations, buttons...

eternal oxide
#

BlockData instanceof shoudl work

#

Or teh snapshot I forget which it will be

smoky oak
#

ill just try this

#

if(event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getBlockData() instanceof InventoryHolder)

eternal oxide
#

looks good

#

won;t work on jukeboxes

#

those are a bitch

smoky oak
#

eh good enough lol

#

the most important part is inventory blocks

#

you know

#

so the event doesnt fire while im tryin to put an item into an inventory

tardy delta
#

Floor::init hmm

#

lets init the floor

round finch
#

thanks now i wanna kermit Minecraft Steve OOF Damage Sound Effect on minecraft

tardy delta
round finch
#

why it looking kinda cursed idk thb

round finch
#

wtf is node

smoky oak
#

query

eternal oxide
quiet ice
smoky oak
#

wasnt fourteenth the guy to advocate for the

if(NOT THIS) return
#

style

quiet ice
#

The coding style they use is a bit strange tbh

smoky oak
eternal oxide
#

you can check either

tardy delta
#

they seem to have never heard of encapsulation

smoky oak
#

whats that

quiet ice
#

Encapsulation in what sense?

#

You are probably not talking about JPMS I guess

tardy delta
#

well almost every field is public

quiet ice
#

Ah that

#

If I recall correctly their engine (Arc) doesn't do that sometimes and it can be a pain in the but to find a workaround

#

Especially since Mindustry is "moddable" I guess they just made all fields public so modders have an easier time

tardy delta
#

uh oh

#

i was thinking of changing it a bit cuz why not

smoky oak
#

oh no

#

wait is mindustry open source

tardy delta
smoky oak
#

that answers that question

#

is modding forking the github or actually writing a proper mod?

quiet ice
#

Writing a proper mod

#

I'm not too sure how the modding api works, but it seems to be there

#

There was a guy over at the fabric discords that used fabric to mod mindustry but I believe by now there is a proper API built-in

tardy delta
#

i have nothing better to do so ill probably make a fork of it 🤓

smoky oak
#

huh

#

i recall whoever made space engineers saying their api had roughly ten times more endpoints than the game called

#

its basically a massive blank slate

quaint mantle
#

if i have an interface and one of my classes implement that interface, do i need to use override all the methods from the interface in the class which im implementing the interface in

lost matrix
smoky oak
#

abstract interfaces can but dont need to implement methods

#

every class using that abstract interface has to implement all abstract methods of that interface

#

so

lost matrix
#

interfaces are always abstract

smoky oak
#

ah fair

lost matrix
#

And all methods in interfaces are abstract

smoky oak
#
abstract class example(){
  abstract void a()  
  void b(){return;}
}

if you extend this u only need to implement method a

quaint mantle
smoky oak
#

since b has a method body

lost matrix
quaint mantle
#

what would be the best way of doing this

tardy delta
tender shard
lost matrix
quiet ice
#

(That is a consumer)

quaint mantle
#

would that work

tardy delta
#

and its java 16 iirc

#

17

warm mica
#

that naming schemes gives me cancer

lost matrix
#
public interface SomeInterface {
  
  // Needs to be implemented
  String createName();
  
  // Does not need to be implemented
  default void printName() {
    String name = createName();
    System.out.println(name);
  }
  
}
quiet ice
tardy delta
#

if(state.rules.sector.planet.allowWaveSimulation){ this is worse than nms

lost matrix
dusty sphinx
#

is the bukkit api (org.bukkit:bukkit) no longer published for the newest minecraft versions?

remote swallow
#

last version was 1.14.3

dusty sphinx
#

it looks like the latest version is 1.15.2

remote swallow
#

oh yeah

#

most people use spigot

dusty sphinx
#

yes

remote swallow
#

i dont think anyone uses bukkit anymore

smoky oak
#

wait

eternal oxide
smoky oak
#

is abstracct class just a interface you extend

#

instead of implement

lost matrix
#

This was stopped because of

#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

quiet ice
#

I believe it was stopped before that

lost matrix
#

looks like it

quiet ice
#

Bootstrap jars are a thing since 1.18

lost matrix
#

Hm i thought this was a 1.16 measure

quiet ice
#

The bukkit artifact only is gone because craftbukkit is on it's way out

vital sandal
quiet ice
#

But things take an enormous while over at spigot so of course the transition is not completed even today

vital sandal
#

there is no TextComponent in 1.19?

young knoll
#

What do you mean on its way out

dusty sphinx
#

in gradle

#

spigot 1.19.4

lost matrix
#

Or just the api

dusty sphinx
#

no no no absolutely no NMS

young knoll
#

compileOnly("org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT")

dusty sphinx
#

I am using a non-traditional (not craftbukkit) implementation of bukkit

lost matrix
#

Well with only the api you can just depend on it as always

dusty sphinx
#

ok

#

I'll do that instead

quiet ice
#

Spigot is basically bukkit

dusty sphinx
#

I'm aware

quiet ice
#

There are next to no differences

dusty sphinx
#

But since it's a non-standard implementation I just wanted to use bukkit

lost matrix
#

Oh what? Custom bukkit impl?
I think you have to run buildtools and see which jar you need to depend on as File

quiet ice
#

Chances are your non-tradiitonal implementation is using the paper api though

dusty sphinx
quiet ice
#

Ah.

Then I'd recommend implementing the paper api regardless.

lost matrix
#

Well then why do you need to depend on bukkit?

dusty sphinx
#

I didn't want to go through the trouble of adding the additional spigot methods at this time

dusty sphinx
quiet ice
#

There are no non-spigot bukkit implementations that don't use paper as a base

young knoll
#

Another fabric hybrid

dusty sphinx
#

God no

#

I hate all of the fabric hybrids that exist

quiet ice
river oracle
quiet ice
dusty sphinx
#

💀

#

It's real bad

river oracle
#

I think I have a good idea

quiet ice
dusty sphinx
river oracle
#

What if we just left spigot and fabric forge separated

dusty sphinx
#

Great idea

#

unfortunately: I get paid by the hour

quiet ice
young knoll
#

But then how will people run their pixelmon server with essentials on it

river oracle
river oracle
quiet ice
#

How good is it though?

young knoll
#

It has homes and warps

#

What else do you need

quiet ice
#

An economy???

young knoll
#

Back in my day

#

We traded items

#

Also pixelmon has a money system anyway

quiet ice
#

Back in my day we just used vault

dusty sphinx
#

out of curiosity what does the craftbukkit bootstrap jar include that the api doesn't

#

like the JDBC driver classes

quiet ice
#

the maven resolver

#

uh, probably apache commons

#

?stash just look at the stash

undone axleBOT
dusty sphinx
#

I'm looking at it

#

there is just like

#

a sea of dependencies and the comments in the POM don't help much

#

i think this stuff

#

although that doesn't include the jdbc classes... strange

#

Oh wait

quiet ice
dusty sphinx
#

i didn't know bitbucket had line highlighting until just now 😳

quiet ice
#

Probably jline too

dusty sphinx
#

I think I see it

quiet ice
#

Uh - just use everything there

#

Except perhaps test classes

dusty sphinx
#

I'm not going to depend on the mojang stuff

#

Yeah I get it

#

I found the JDBC driver classes

winged anvil
#

i love factories

#

goated design pattern

tardy delta
#

AbstractFactoryFactory

winged anvil
#

exactly

tender shard
winged anvil
#

how did i know

#

ur ass was gonna send a gh link

river oracle
smoky oak
#

can you be for once not the center of the discussion alex

tender shard
#

Only if you comment about the label I used in the static init block

round finch
#

lmao

#

i repeatly seeing jeff posts

#

ironically funny

river oracle
#

whats with all the alex hate :(

round finch
#

where?

tender shard
#

Nobody hates me, i am fabulous r_fabulous

compact haven
#

no one hates him

#

I can confirm

river oracle
#

I do 😈

compact haven
#

ur irrelevant in Alex’s eyes

river oracle
#

have you guys heard of this funny little haxe language

#

it is very neat for the one thing I use it for

quiet ice
#

And not much more?

river oracle
#

I hate lua

tender shard
#

yeah lua is such a pain

river oracle
#

haxe has nice syntax features and it can compile into lua

#

what more could I ask for

halcyon hemlock
#

lua the boblox lang?

tender shard
#

lua is used in many games, yeah

#

I also use it for my adventure games and it's total shit

river oracle
#

you can also expose native code from a language you are targeting

#

its really neat

tardy delta
tender shard
#
luaStart("ExitMenu") 

function openEsc()
  --escMenu_HideInterfaces = game.HideInterfaces
  escMenu_HideCursor = game.HideCursor
  game.HideCursor = false
  --game.HideInterfaces = true
end

function closeEsc()
  game.HideCursor = escMenu_HideCursor
  --game.HideInterfaces = escMenu_HideInterfaces
end

-- [[
function openExitMenu()

  if((not Scenes["pippen_wohnzimmer"].Objects["pos_start"].Conditions["intro_played"].Value) and (not Debug)) then
    print("Cannot go to exit menu before intro is finished")
    return
  end

  print("Opening exit menu")
  isInExitMenu = true
  hideInterfaces = game.HideInterfaces
  game.HideInterfaces = true
  --char = game.CharacterLinks["Watzmann_Couch_Pippen"]
  scene = game.CurrentScene
  --charScene = char.Scene
  --pos = char.Position
  print("isInExitMenu = true ")
  
  changeScene("_Escape_Menu", 3, 500)
  
end

function closeExitMenu()
  print("Closing exit menu")
  print("isInExitMenu = false")
  isInExitMenu = false
  game.CurrentScene = scene
  --char.Scene = charScene
  --char.Position = pos
  --char.Direction = 90
  game.HideInterfaces = hideInterfaces
end
--]]--

luaEnd("ExitMenu")

you can see my lua skill is bad from all the commented out stuff

river oracle
#

haxe looks beautiful

#

you should try it lol 🤷🏽‍♂️

tender shard
#

the engine I use only supports lua so I am stuck with that

river oracle
#

and than compile into lua

tender shard
#

i don't think visionaire studio would support that

round finch
#

oh my gosh what language is that?

river oracle
#

I forked this project cuz I'm going to improve it, but I really like how it looks and works compared to lua (shit lang)

tender shard
round finch
#

the code

river oracle
#

lua (shit lang)

#

the indexes start at one 😭

#

just be normal

round finch
#

kinda doesn't make sense

#

why start with something

#

like 1

river oracle
#

because most people count like that and lua is the normie language

tender shard
#

after all it's called index, not offset

river oracle
round finch
#

are we talking about array index?

river oracle
#

all indexes

#

in lua start at 1

#

in most other languages it starts at 0

round finch
#

what about int?

quiet ice
#

array index

round finch
#

also starts at 1?

quiet ice
#

int starts at the value you set it

river oracle
#

if you don't set it its nil I'm pretty sure

#

idk I try to stay away from lua

quiet ice
#

It's a dynamically typed language so I don't think there is a type default

round finch
river oracle
#

lua is dynamic

quiet ice
#

but java is statically typed

smoky oak
#

i mean lua can be typed faster than java cuz lua doesnt have all those { } && || everywhere

river oracle
round finch
#

what is dynamic types?

smoky oak
#

java:

#

int a, strinb b

#

lua:

river oracle
#

if typing speed was all that matters everyone would use python becaues its fast as fuck to type

smoky oak
#

variable a, variable b

quiet ice
tender shard
#

no builtin ThreadAnvilChunkStorage? what a shitty language

river oracle
#

fr

#

haxe has ThreadAnvilChunkStorage ofc

#

ofc

round finch
quiet ice
#

no

round finch
#

or compile

quiet ice
#

Remember that python is AOT compiled if you use cpython

round finch
#

idk i'm not a python dev

#

i'm kinda not liking it

quiet ice
#

Generally you'll be using the "JIT"-compiled python variant which is slower yes

#

Though the JIT compilation of python can't be compared to java's hotspot

round finch
#

should i use my time on python?

pseudo hazel
#

no its slow af

quiet ice
#

Or you just don't waste your time on this discord

#

python aint that slow

pseudo hazel
#

that would help too

#

i guess its good for protyping certain things sure

quiet ice
#

Like unless you are writing time-critical code it is discardable

round finch
#

i'm litterally ADD in a nutshell who can blame me

#

i waste time on different things

#

but i might cancel discord subscription

#

at next payment

pseudo hazel
#

what for

round finch
#

ANYWAY...
quick question
how can you get the possible safe enchantments on a item

young knoll
#

I believe you would just loop all enchants

smoky oak
#

heres the stupid solution

#

call for every enchantment the method to enchant an item

#

it fails if you cannot

round finch
#

making an enchant plugin
so i dont want people to enchant flame on their sword

#

because that would be dumb

tender shard
#

remember that extending Enchantment isn't something you're supposed to do, you should rather just apply a PDC tag to identify your custom enchantments

round finch
#

i hate the limt of Minecraft vanilla
fx not being able to enchant my armor with all the prots

quiet ice
#

let's be real: Noone does this

tender shard
#

I do that, I only extend Enchantment to get the glow effect

quiet ice
#

And then there are stupid plugins (looking at you, slimefun) that don't provide the necessary API to provide support for the new enchantments

tender shard
#

oh slimefun....

round finch
#

for me i dont think that is needed here

quiet ice
#

And no, open source does not work.

round finch
#

anvil god armor lets go

#

i'm gonna try what @young knoll sent me
gonna be fun

torn shuttle
#

do ender crystals throw a death event?

tardy delta
#

anyone knows what cleanup code in intellij does?

tawny remnant
tardy delta
#

oh god this gonna take a few minutes

tardy delta
#

read your errors

#

💀 hows that standard json

hazy parrot
tawny remnant
#

So is there any way you can help?

hazy parrot
#

spamming across multiple channels is not a way to go

small timber
#
     MerchantRecipe recipe1 = new MerchantRecipe(new ItemStack(Material.EMERALD, 1), new ItemStack(Material.CARROT, 8));
#

why does this throw an error?

hazy parrot
quiet ice
#

There are many very lenient parsers out there

small timber
#

it says required type int provided type itemstack

small timber
#

how

#

i did itemstack, int

#

in both

tardy delta
#

uhh wtf is tagalog

remote swallow
tardy delta
small timber
#

how does this work

#

wait ill read the doc

remote swallow
#

it should be ```java
new MerchantRecipe(new ItemStack(Material.Emerald, 9), 16)

small timber
#

so the result is 9 emeralds right?

remote swallow
#

no idea

#

havent checked docs

tardy delta
#

10 minutes since i clicked "push" now

#

mf intellij decided to analyse the code

sterile token
#

Why configuration serializable is tring to serialize a int to a long?

#

When im telling to save it as long value?

tardy delta
sterile token
quaint mantle
#

is there an enum of every block

pseudo hazel
#

Material

#

and then check if its a block

quiet ice
#

there is the material enum, but you'd need to filter out all non-blocks

pseudo hazel
#

like isBlock or something

quiet ice
#

And even then you have issues with things technically being blocks but not really

quaint mantle
#

nah i need just every wooden block

#

im in the material enum but theres isnt a name for all blocks

tardy delta
#

youll have to filter on Material.values()

remote swallow
#

isnt there a Tag for it

quaint mantle
#

oh ok

sullen marlin
#

You can't have one material represent all blocks

#

How would that work?

remote swallow
sullen marlin
#

World#setBlock(Material.ALL_BLOCKS)?

quiet ice
#

Yeah, use a tag

young knoll
#

Yes

#

I want to make a block every block

quaint mantle
remote swallow
#

tags

quaint mantle
#

hold on

tardy delta
#

github rendering my push go brr

young knoll
#

Material has the name of every material

tardy delta
quaint mantle
#

how about this

#
    if(material.isBlock()) {
        String blockName = material.name();
        // print them or smth
    }
}```
remote swallow
tardy delta
#

i dont even know what a wooden block is smh

#

planks?

quaint mantle
#

every single block

young knoll
#

Logs or planks

quaint mantle
#

that is wooden

#

fences