#help-development

1 messages · Page 1680 of 1

waxen plinth
#

Case sensitivity is specific to strings

patent horizon
#

yeah

waxen plinth
#

If you want to check that, you should store the values in a set

patent horizon
#

it's a list of strings

waxen plinth
#

And call toLowerCase() before inserting, and also before checking contains

#

HashSets are ideal for this

patent horizon
#

ok awesome

opal juniper
#

i guess it just assumes that the dev knows cause they put it there

waxen plinth
#

But keep in mind they are unordered, cannot contain duplicates, and cannot be indexed

waxen plinth
#

To my knowledge it loads everything in at once when you load config and keeps it in memory

#

It must make the distinction when it's loading

opal juniper
#

oh yea true

waxen plinth
#

The easiest way is probably to store it in a long, and if it's with int bounds then you convert it to int

opal juniper
#

makes sense

floral pewter
#

Hey. I've been getting strange runtime errors related to PathfinderGoals ever since the update to 1.17, I believe it has to do with obfuscation maps having missed something since I've seen issues like https://github.com/PaperMC/paperweight/issues/24. This is the problematic code I'm running inside a custom Villager class:

    @Override
    protected Brain<?> makeBrain(Dynamic<?> dynamic) {
        //Initialise the brain with our own custom goals
        Brain<net.minecraft.world.entity.npc.Villager> brain = this.brainProvider().makeBrain(dynamic);

        this.goalSelector.addGoal(0, new FloatGoal(this));
        this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D));
        this.goalSelector.addGoal(2, new WaterAvoidingRandomStrollGoal(this, 1.0D));
        this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 6.0F));
        this.goalSelector.addGoal(4, new RandomLookAroundGoal(this));

        return brain;
    }
#

The error I'm getting is

java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.ai.navigation.NavigationAbstract.d(boolean)" because the return value of "net.minecraft.world.entity.EntityInsentient.getNavigation()" is null
    at net.minecraft.world.entity.ai.goal.PathfinderGoalFloat.<init>(PathfinderGoalFloat.java:14) ~[patched_1.17.1.jar:git-Paper-249]
sullen marlin
#

You're not using spigot

floral pewter
#

The goals in question are taken down from the chicken class, so they work internally

#

I've tried with spigot as well. Give me a second and I'll get the error from that as well

#

The error returned by Spigot remains the same.

java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.ai.navigation.NavigationAbstract.d(boolean)" because the return value of "net.minecraft.world.entity.EntityInsentient.getNavigation()" is null
    at net.minecraft.world.entity.ai.goal.PathfinderGoalFloat.<init>(SourceFile:14) ~[spigot.jar:3236-Spigot-6c1c1b2-6719d1f]
sullen marlin
#

You should probably be initialising goals in the goal initialisation method, not the brain one

floral pewter
#

I'll have a crack at that

floral pewter
#

Changing the base entity to chicken/pig made it work

#

Now I have to figure out how to emulate goal behaviour with activities

#

Thanks for your help!

patent horizon
#

how do i use functions across different classes without making them static

ivory sleet
#

inject instances

#

?di

undone axleBOT
ivory sleet
#

yeah check out that one

chrome beacon
#

You cannot modify a list that you're looping

#

Loop a copy

vague oracle
#

Could be a dumb question but, which is better to do a bungee command or a server side command?

For example a command to change the MOTD on redis so it doesn't really matter, just which one is the better practice?

chrome beacon
#

Break exists the loop

#

Try it and see

chrome beacon
vague oracle
#

event.getResponse().setDescriptionComponent(new TextComponent(Chat.colour(bungee.getApi().getMOTD()))); Is how it works, it was an example command. I was just asking is it better to put a command in the bungee plugin or a server plugin

chrome beacon
#

The one best suited for the command is what you should use

#

As I said for MOTD a bungee command would be better

atomic gyro
#

I'm having issues with the Loot Table / Loot Tables API in Spigot. Anybody know how I can convert a LootTables to a LootTable?

eternal oxide
#

LootTables.ZOMBIE.getLootTable()

atomic gyro
#

oh its that easy. thank you!

#

is it possible to set a default loot context? null would throw an error, but I'd like to define it without any modifiers.

eternal oxide
#

What do you mean?

#

You can specify the LootContext by calling LootTable.fillInventory

atomic gyro
#

Yes, but how would I specify it? On the JavaDoc, it's got a bunch of getter methods but I can't seem to figure out how to set a default.

eternal oxide
#

what do you mean "specify it"?

#

it has a builder

atomic gyro
#

Oh, how do I use the builder?

#

Never had to work with one before.

atomic gyro
#

Will do, thanks.

eternal oxide
#

Its teh same as all builders Builder(Location) .killer(killer) .etc .build();

atomic gyro
#

Thank you, I'll be using it soon.

#

When using .getLootTable(), does it return a memory address or the proper json file?

#

Since it's getting a key, would it be the file location of the loot table? (eg; data/loottables/whatever)

eternal oxide
#

it returns a LootTable Object

atomic gyro
#

Is there any method of reading a LootTable object?
For example, if I wanted to list the possible contents of a loot table as Strings, is there a method of converting the LootTable object into a readable state?

eternal oxide
atomic gyro
#

I'll have to do a bit more reading. I appreciate your help!

proud basin
#

can someone confirm for me that this is red 0xFF0000

paper viper
#

yes

proud basin
#

hm weird

eternal oxide
#

RGB

quaint mantle
#

how can i get a block entity that's already placed and get the contents? like an item frame with a stick

eternal oxide
#

Entity != Block.

proud basin
#

so if I used 0xFF0000 it should turn out red

quaint mantle
#

I can't remember what they're called so i meant like block entities like item frames and paintings

eternal oxide
#

if you only have the location World#getNearByEntities

quaint mantle
#

ohh ok, but then how would i get the item that's in the frame?

quaint mantle
#

oh, thank you!

proud basin
#

Elgar please explain to my why it's not giving me red

quaint mantle
#

Does anyone know how to import an entire function?

paper viper
#

static imports?

eternal oxide
quaint mantle
#

i`m using eclipse for example

proud basin
#

mc

olive valve
#

hello! how can i it so i can have two command arguements. like args[0] and args[1] bc i made a command with two arguements but it only ran args[0], can anyone help??

eternal oxide
#

unless you are using something which only supports the fixed MC colour pallet

proud basin
#

all I know is that it doesn

#

't show up

#

oh wait

#

I know

quaint mantle
#

do i get it like this? ItemFrame frame = (ItemFrame) world.getNearbyEntities(new Location(world, 0, 40, 0), 0, 40, 0); something about it feels wrong though

#

like the two sets of coordinates

eternal oxide
#

second is not cords, they are distances

olive valve
#

hello! how can i it so i can have two command arguements. like args[0] and args[1] bc i made a command with two arguements but it only ran args[0], can anyone help??

eternal oxide
#

It returns a collection, so no casting it to an ItemFrame

proud basin
#

ok idk

#

elgar

#

I thought maybe GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); would help it but no

proud basin
eternal oxide
#

MC is 6 xx,xx,xx RGB

#

oh so not MC, its is GL

proud basin
#

no

eternal oxide
#

you just posted above GL code

proud basin
#

yeah

#

but its not

eternal oxide
#

a glColor4 which has an alpha channel

proud basin
#

I just wanted to see if that would fix it

quaint mantle
#

How do I import all this automatically into intellij?
This image is from the eclipse to show as an example. I write switch and use Ctrl+Space and it imports everything.

#

i don't think that you're thinking of the same import i'm thinking of..

quaint mantle
#

without having to write everything down.

#

i'm not too sure if eclipse has them but maybe use a plugin for that if it does, also, i think importing would be pulling classes to use elsewhere in your project using import

proud basin
#

so

quaint mantle
#

oh wait i thought they meant eclipse oops

proud basin
#

whats the other issue

#

any other color that has 9 characters work

eternal oxide
#

9 characters?

olive valve
#

hello! how can i it so i can have two command arguements. like args[0] and args[1] bc i made a command with two arguements but it only ran args[0], can anyone help??

proud basin
#

yeah

#

like 0f0f0f0f0f0f0f

eternal oxide
#

what are you using this in?

#

as thats not a valid MC color

proud basin
#

yes it is

#

0x90000000 this works

eternal oxide
#

that is not a Minecraft color. Its hex and will probably display something but MC is 3 Hex codes

proud basin
#

it is

#

it does display

#

but red doesn't

eternal oxide
#

You are throwing values in there but its nto correct

proud basin
#

hiow

#

0xb02e26

#

doesn't work

eternal oxide
#

then you are not using MC color codes

proud basin
#

im not using spigot

#

opengl

olive valve
#

hello! how can i it so i can have two command arguements. like args[0] and args[1] bc i made a command with two arguements but it only ran args[0], can anyone help??

eternal oxide
#

I'm going to stop helping you if you keep telling me one thing and then changing your mind.

quaint mantle
proud basin
#

im working with forge man

eternal oxide
proud basin
#

so

#

open gl

eternal night
#

A natural assumption in the spigot development help channel

eternal oxide
#

I specifically asked earlier if you were using MC colors or GL

olive valve
eternal oxide
#

are you testing your args.length?

olive valve
eternal oxide
#

Do you check there are 2 args in teh command that was entered?

#

if(args.length == 2)

olive valve
#

ohhhhh right.. thanks for helping me

eternal oxide
proud basin
#
public static void drawRoundedRect(int x, int y, int width, int height, float radius, int color) {
        float f1 = (color >> 24 & 0xFF) / 255.0F;
        float f2 = (color >> 16 & 0xFF) / 255.0F;
        float f3 = (color >> 8 & 0xFF) / 255.0F;
        float f4 = (color & 0xFF) / 255.0F;
        GlStateManager.color(f2, f3, f4, f1);
        drawRoundedRect(x, y, width, height, radius);
    }
eternal oxide
#

wierd ordering.

#

but it has 4 entries which means it has an alpha channel

#

f1 "should" be the alpha. 0.0 would be opaque (visible)

#

GlStateManager.color(255.0, 0.0, 0.0, 0.0); - red

proud basin
#

yea

#

I wanna use hex though

eternal oxide
#

from a quick glance at that math it seems to be reversed

#

so 0x00FF0000

#

Not really awake but try 0xFF00

proud basin
#

nope

eternal oxide
#

what did FF00 do?

proud basin
#

invisible

eternal oxide
#

what about 00FF?

#

is this your method, or one you've taken from Forge?

#

Because that math looks so wrong

proud basin
#

mine

#

forge doesn't have this

#

otherwise I would of used it

eternal oxide
#
public static void drawRoundedRect(int x, int y, int width, int height, float radius, int color) {
        float f1 = (color >> 24 & 0xFF);
        float f2 = (color >> 16 & 0xFF);
        float f3 = (color >> 8 & 0xFF)
        float f4 = (color & 0xFF);
        GlStateManager.color(f2, f3, f4, f1);
        drawRoundedRect(x, y, width, height, radius);
    }```This should accept 0xFF0000
patent horizon
#

how can i set an entity's health in the EntityDamageEvent ?

eternal oxide
#

setHealth(Double)

patent horizon
#

sethealth isn't an available thing

eternal oxide
#

on an Entity it is

#

so long as that Entity is Damageable

patent horizon
#

would i have to check if the entity is damageable before setting health then?

patent horizon
#

idk but intellij says it cant resolve method "setHealth" in "Entity"

#
    @EventHandler
    public void onDamage(EntityDamageEvent event) {
        if (event.getEntityType() == EntityType.PLAYER) {
            if (event.getEntity().getWorld() == Bukkit.getWorld("lobby")) {
                event.setCancelled(true);
                event.getEntity().setHealth();
            }
        }
    }```
proud basin
#

also didn't work

eternal oxide
patent horizon
#

yeah uh

eternal oxide
patent horizon
#

in morons terms?

#

im pretty new to java

proud basin
eternal oxide
#

if (e instanceof Damageable) ((Damageable)e).setHealth(...)

patent horizon
#

does e = event or entity

eternal oxide
#

entity

eternal oxide
#

how are you calling it with other colors and its correct?

proud basin
#

DrawUtils.drawRoundedRect(this.x, this.y, this.x + this.width, this.y + this.height, 1, this.color);

#

yes

eternal oxide
#

Oh ok, still not awake. I forget its floats. 1.0 is max, thats why its divided

#

So GlStateManager.color(1.0, 0.0, 0.0, 0.0); should produce red

#

the method is accepting ARGB

#

which means I don;t see why its not working with 0xFF0000

proud basin
#

yeah

#

weird

#

What's another red

eternal oxide
#

like 0x7EFF0000 should be a faded red

proud basin
#

that works

#

do you know a shaded white?

eternal oxide
#

try 0xFFFF0000

#

that should be a transparent red

#

if not they have teh alpha inverted

proud basin
#

that is def not transparent

#

that is full on red

eternal oxide
#

then you have to provide an alpha of 1.0, so FF

proud basin
#

weird

eternal oxide
#

0x ARGB or 0xFF + R + G + B

proud basin
#

also do you know why I am missing the music assets?

proud basin
eternal oxide
#

you just have to prefix any RGB with FF

proud basin
#

float f1 = (color >> 24 & 0xFF) / 255.0F;

#

see

eternal oxide
#

yes, but you have to provide that in your hex

proud basin
#

yea

eternal oxide
#

as its inverted

#

1.0 is giving you full opacity

proud basin
eternal oxide
#

no clue. Didn;t really know what you are doing

proud basin
#

cmon

#

why not you should know

eternal oxide
#

Somethinh like skinning a client using Forge

proud basin
#

no

#

also it's kinda dumb on how ugly a custom font is when you are full screened

eternal oxide
#

they are taken from bitmaps so don;t scale well

proud basin
#

I can see that

#

I can't find a shaded white you got one?

#

google is pretty useless right now

eternal oxide
#

FFFFFF is full white, so add whatever alpha youwant on the beginning

proud basin
#

4?

eternal oxide
#

if you want full on white yes 0xFFFFFFFF

proud basin
#

what if I don't

eternal oxide
#

white is the presence of all colours, black is the absence of all

proud basin
#

shaded

waxen plinth
#

Anything where the R, G, and B components are equal will be grayscale

eternal oxide
#

so to move it towards grey reduce all three colours evenly

proud basin
#

F0FFFF

eternal oxide
#

keep your Apha FF

#

0xFF | AB | AB | AB

#

remember its ARGB, so you only adjust RGB

proud basin
#

Is there like a color picker for shades?

#

I won't remember this

eternal oxide
proud basin
#

ok

#

will try

quaint mantle
#

anyone know how to rotate falling blocks left-right

proud basin
#

velo?

eternal oxide
#

setRotation

quaint mantle
#

@eternal oxide did not know that existed

#

thanks

#

is there a way to have them inherently turn around by themselves with NMS

#

or am i just going to have to resort to a scheduler

eternal oxide
#

FallingBlocks have no AI so you would have to do it manually

quaint mantle
#

i see, thank you

proud basin
#

What's more efficientRuntime.getRuntime().exit(); or System.exit(0);

eternal oxide
#

if you don;t care about file locks or corrupting data the first, if you want a clean exit the second

proud basin
#

ok cool

eternal oxide
#

The first will exit instantly. It will not wait for anything to finish

proud basin
#

Sounds like task manager end button

eternal oxide
#

worse

proud basin
#

how could it be worse

eternal oxide
#

If you use it you better not want to open that application again

#

odds are 50/50

#

its great if you are running docker or somethign and just want a quick exit

proud basin
#

kinda wanna test it

eternal oxide
#

it will attempt a clean exit

#

so long as your code supports save on exit

quaint mantle
#

How to play a sound when the player hits someone with an arrow?

eternal oxide
#

as in a fired arrow?

#

or a left click hit?

quaint mantle
eternal oxide
#

ProjectileHitEvent call a Player.playSound or World.playSound

atomic gyro
#

Can I call files from the minecraft.jar if I have the Key/Namespaced Key for them?

ivory sleet
#

wym

atomic gyro
#

I'm trying to call a loot table so I can read the items in it as Strings, and so far I've used

LootTables.ZOMBIE.getLootTable().toString()``` to get the Key for it. Can I access the loot table as a String/JSON file using this key?
worldly ingot
#

That's not exposed in the API. Shouldn't really be accessing the JSON file for it. No reason to

atomic gyro
#

How else can I view the contents of the loot table?

atomic gyro
sullen marlin
#

Loot tables are random and depend on various things

#

Its content isn't a simple concept

#

You could fill a dummy inventory and check its contents that way

#

But again, contents can change

atomic gyro
#

I thought loot tables had values in them, back when I tried doing datapacks/custom entities using command blocks.

#

It usually has multiple items, then a weight and drop count. The game then uses that table to determine the loot with a random seed. I was hoping to read the file that contained the weights and drop counts.

#

Something like this.

sullen marlin
#

Why?

#

?xy

undone axleBOT
atomic gyro
#

I'm currently trying to make a plugin that can read loot tables on the server by using /command (loot table name here) to view the loot table in an easier fashion, using inventories to display the items with names and lore based on their weights and drop chances overall.

#

Most of it should be if statements, math, and for loops, but this is the part that is really getting me tripped up.

sullen marlin
#

I think you'll find it more involved than you expect, there's a lot of different functions

#

But you'd have to read the file from the jar

#

Same way you read any file in a jar, getResourceAsStream

atomic gyro
#

Thank you, that really helps.

#

I'll be sure to mess with it more tomorrow and to read up on the JavaDoc.

#

If all goes well, hopefully some actual progress can be made :)

atomic gyro
quaint mantle
#

does anyone know hwo to set an NMS falling block's type

worldly ingot
#

afaik you can't change it once it's been spawned

#

Thus why the API doesn't support it

quaint mantle
#

ive actually got smth

#

might work

#

ill post it if it does 🙂

waxen plinth
#

Why are you spawning it with NMS?

#

Just spawn it with World#spawnFallingBlock

#

And if you really need NMS, you can just get the entity's NMS handle after you spawn it with the spigot API

quaint mantle
#

@waxen plinth i want it to be immune to being moved

#

if im not wrong if you spawn it in normally and set it to nogravity its still affected by explosions and what not

#
        super(((CraftWorld) loc.getWorld()).getHandle(), loc.getX(), loc.getY(), loc.getZ(), iBlockData);
        WorldServer craftWorld = ((CraftWorld) loc.getWorld()).getHandle();
        this.setPosition(loc.getX(), loc.getY(), loc.getZ());
        craftWorld.addEntity(this);
    }```
#

ive got this but it just despawns instantly

waxen plinth
#

I don't see why you would need NMS for that at all

quaint mantle
#

why wouldnt i need nms for that

waxen plinth
#

Because you can set the velocity of an entity

quaint mantle
#

is there something in spigot that prevents any sort of movement

waxen plinth
#

You could just literally set its velocity to 0 every tick

quaint mantle
#

yes but if it gets hit by a powerful explosion i dont want it to move at all

#

i would rather not use a scheduler every tick for it 🙂

waxen plinth
#

How do you expect to do it with nms

quaint mantle
#

just cancel the movement

waxen plinth
#

You could set it to be riding an invincible marker armor stand with noAI and no gravity

quaint mantle
#

yeah

#

but armour stands have a hitbox which is quite annoying

waxen plinth
#

Marker armor stands do not have a hitbox

quaint mantle
#

marker armor stands?

#

i dont think ive heard of them before

waxen plinth
#

You can call setMarker(true) on an armor stand

#

It makes it invisible and have no hitbox

quaint mantle
#

i did not know that was a thing

#

since when was that added in

waxen plinth
#

1.9 I think?

quaint mantle
#

wow

#

ok ill give it a shot that sounds good then

quaint mantle
#

im not sure if im doing it wrong or if they just cant be moved

stone sinew
#

Just clearing something up. Setting an armor stand as a marker still has a hitbox. It's just 1 pixel and doesn't get touched by anything.

quaint mantle
#

really

#

so can it still be affected by explosions?

stone sinew
#

Shouldn't be able to as it's just a "marker"

#

But if you show hitboxes using f3+b you can still see its hitbox

quaint mantle
#

ill take a look

#

more important im trying to rotate it

#

but it wont work 😦

#
        this.stand.setRotation(this.stand.getLocation().getPitch() + pitch, this.stand.getLocation().getYaw() + yaw);
    }```
stone sinew
#

Need to teleport

waxen plinth
#

Marker stands do not move

quaint mantle
#

oh really

waxen plinth
#

Why would they

#

They're meant to be markers

#

As in, mark this location

#

It doesn't move, it can't be interacted with

#

Why would you need to rotate it?

quaint mantle
#

looks ugly just floating there as an indicator

waxen plinth
#

It's a marker...

#

It's invisible

#

Or at least it should be

sullen marlin
#

well ordinary falling blocks definitely can't rotate

quaint mantle
#

md5!

waxen plinth
#

I don't remember, but you can definitely set the stand to be invisible if it's not invisible already

sullen marlin
#

armor stands can on the other hand, so it seems like your initial idea wouldn't work anyway

quaint mantle
#

yeah i learned they cant move just now

waxen plinth
#

I don't get what you're trying to do

stone sinew
#

Why don't you just remove the entity from the explosion damage event?

waxen plinth
#

Make a falling block that can't move... but also moves?

quaint mantle
#

@stone sinew could do, was just trying to see if it could be done easier

stone sinew
quaint mantle
#

yea, like just make it so it cant move from external forces but can rotate, but i guess now that ive tried it ive learned that wont work

quaint mantle
waxen plinth
#

Yeah falling blocks can't rotate but you can set falling sand as the head item of an armor stand

#

I'm not sure if armor displays on marker armor stands

#

But at the very least you can still make them invisible

quaint mantle
#

ohhh TRUE

waxen plinth
#

To my knowledge you can also make minecarts that hold blocks with an offset

quaint mantle
#

i think you can yeah

stone sinew
waxen plinth
sullen marlin
quaint mantle
#

setDerailedVelocityMod() probs

sullen marlin
#
setDisplayBlockData​(BlockData blockData)
Sets the display block for this minecart.
void
setDisplayBlockOffset​(int offset)
Sets the offset of the display block.
waxen plinth
#

Oh perfect

quaint mantle
#

gonna do that now tbh

waxen plinth
#

That sounds like exactly what you need

quaint mantle
#

hide the minecart and the block will still be visible i assume

#

my whole idea has been transformed into something better 😅

waxen plinth
#

Not sure if the invisibility potion effect applies to minecarts

#

But if nothing else works you could always have them be under bedrock with a high offset on the block they're displaying

quaint mantle
#

this game is so intricate

echo basalt
#

How can I detect when a player adds a new item to their offhand?

#

Like from the inventory or something

#

Preferably getting the old item too

sullen marlin
#

look at the inventory events'

echo basalt
#

ugh

#

Okay

quaint mantle
#

it seems materialdata is deprecated in many ways

#

is there a new way to create material data

#

trying to do
this.cart.setDisplayBlock(type.getData());
(cart is minecart entity and type is Material)

echo basalt
#

basically this

#

should help

quaint mantle
#

tells me to cast it to materialdata but its deprecated

#

i guess thats just the way to go

echo basalt
#

might be version dependent

eternal oxide
#

there are two methods. One takes MaterialData, the other take BlockData

echo basalt
#

try using blockdata if it supports

quaint mantle
#

@eternal oxide cant believe i missed that

#

ty

echo basalt
#

ayo where can I find this

#

might need to run buildtools actually

eternal oxide
#

with --remapped I belive

upper osprey
#

Hello, how to make bossbar line hide bar only show text

echo basalt
#

might be a resource pack

dense kestrel
torn shuttle
#

I am dead certain monitors like these only exist for programmers that refuse to break lines

#

get three of them together and you will never have to scroll laterally again

dense kestrel
#

breaking lines looks messy 😄

torn shuttle
#

I'm going to just keep buying these until I can see my entire codebase on a single line

dense kestrel
#

!!!

#

get a circular desk

#

and put them in a circle around ya

torn shuttle
#

infinity desk

dense kestrel
#

😮

torn shuttle
#

set up webcams to track where you're looking

dense kestrel
#

fair

torn shuttle
#

that way if you keep spinning on your chair it keeps going sideways

#

there's a bug 40 spins counter clock-wise

dense kestrel
#

im getting one of those

#

when my fiance and I move in together

#

😛

torn shuttle
#

how did you find my mad max throne

dense kestrel
#

XD

torn shuttle
#

which a chair that large you'd think the computer case could fit inside the chair

dense kestrel
#

maybe i could hollow out the back

#

and work it in there

torn shuttle
#

it's clearly not hollow

dense kestrel
#

i could make it hollow!

torn shuttle
#

hm

#

I'd wonder why it's not hollow

dense kestrel
#

because thats where you hide your deep web hard drives from the FBI

torn shuttle
#

no you hide those inside the wall

#

then only connect to that pc via wifi

#

on your local network

echo basalt
#

so me

torn shuttle
#

and me

echo basalt
#

flip it vertically and you'll love your new discord experience

torn shuttle
#

I feel personally called out

echo basalt
#

nah I do it too

torn shuttle
echo basalt
#

oh god I tried doing it and it looks horrible

#

aspect ratio is all messed up

torn shuttle
#

I don't get that at all

#

but then again it's a 4k monitor so it has all the space it needs

#

and then some

echo basalt
#

yeah mine's like

#

weird

#

1600x900

#

somehow still 16:9 but it's weird

waxen plinth
torn shuttle
torn shuttle
#

that guy must make 130k a year

echo basalt
#

more

#

he doesn't waste time

waxen plinth
echo basalt
#

he's an efficient programmer

#

he even skipped his github pfp because that's a waste of time

#

username? punches keyboard

torn shuttle
#

I don't like pfps

echo basalt
#

lmao wtf

shadow night
#

i want to make a plugin for me and my friend, so we can change our in game names. Idk how to do that, what are the basics for a plugin like that?

sullen ember
#

can anybody help i want to create a text channel on disocrd through which we can read and message in minecraft server

proper notch
proper notch
sullen ember
#

thx i will try but i am not good in this

whole badge
#

Is there a plugin that make nametags always behavior like you sneak when you sneak and when you not sneak

proper notch
whole badge
quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

any tips for saving a bed's state, destroying both parts of it then resetting it

eternal oxide
#

Bed is Directional. you can getPart on each section to find the other half. Just Store the BlockData for each half.

opal juniper
#

elgarl i thought you were british

#

you literally don’t sleep

gusty briar
#

any help on this? i still cant figure this out

tough field
#

I want to start learn java any tips where to start?

dense kestrel
#

@tough field i got ya

#

ill DM ya it

opal juniper
undone axleBOT
opal juniper
#

lol

tough field
#

Thx

sullen ember
#

how to create a bot for discord srv plugin

#

can anbody tell

eternal oxide
gusty briar
#

i figured it out - I sentPacketPlayOutEntityMetadata before PacketPlayOutNamedEntitySpawn

#

so i kinda changed the skin layer before i made it visible

shadow skiff
#

Anyone know the undepricated methods for playeritempickup event?

#

Cause at the moment I have this and it doesn't add a lore to the items on pickup, and as I am typing this I think I know the issue is that I am not calling .getworld and .getserver

package me.Teric7.rarities;

import java.util.ArrayList;

import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;

public class rarities extends JavaPlugin implements Listener {

    @SuppressWarnings("deprecation")
    @EventHandler
    public void onItemPickup(PlayerPickupItemEvent e) {
        ItemStack item = new ItemStack(e.getItem().getItemStack());
        ItemMeta itemMeta = item.getItemMeta();
        Player player = e.getPlayer();
        ArrayList<String> lore = new ArrayList<String>();
        lore.add("§8");
        if (e.getItem().getItemStack().getType().equals(Material.DIAMOND_SWORD)) {
            lore.add("§e§lRARITY: §b§lCOMMON but in blue");
        } else {
            lore.add("§e§lRARITY: §f§lCOMMON");
        }
        itemMeta.setLore(lore);
        item.setItemMeta(itemMeta);
        player.getInventory().addItem(item);
        e.setCancelled(true);
        e.getItem().remove();
    }
}
sullen marlin
#

@shadow skiff read the docs

#

the docs will always tell you the alternative to a deprecated method

onyx shale
#

I feel like its better in term of what you can do

proper notch
#

I don't think they know java. They couldn't even Google the spigot page

quaint mantle
#

how i active command block on my server ?

proper notch
quaint mantle
#

Hi there, I appreciate that NMS is advised against now but I have a need for it; disabling ArmorStand's gravity without disabling it's velocity.

Can anyone tell me where CraftBukkit is hosted so I can add it as a maven dependency, or how I can add it as a dependency in a pom.xml?

I know an alternative is teleporting the armorstand every tick, but I'd like to explore this option too ^

onyx shale
#

Gravity is... velocity?

eternal oxide
#

CraftBukkit is in Spigot. run BuildTools to add it to your maven local

quaint mantle
#

Don't ask me, I don't make the rules stellrow lol

#

how i get beutiful server hud ?

whole badge
quaint mantle
near night
#

i have this in my pom.xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.1</version> <configuration> <outputDirectory>/pickle/dodo</outputDirectory> </configuration> </plugin>

#

but i get this error ```Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on project picklestring: Error assembling JAR

severe oracle
#

How can i get mapView of a map inside an item frame?

quaint mantle
# quaint mantle Hi there, I appreciate that NMS is advised against now but I have a need for it;...

Just trying to get NMS working still

On compilation, I get this error:
cannot access net.minecraft.world.INamableTileEntity

My pom includes (without error):

        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.17.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <!--Bukkit & CraftBukkit-->
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>craftbukkit</artifactId>
            <version>1.17.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>1.17.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>```

Am I missing something? 😄
eternal oxide
#

check the #announcements forum post. You need to run BT with --remapped

quaint mantle
#

o

#

Tyvm, two tags I missed on BT now

eternal oxide
#

you don't need the craftbukkit dependency. its in Spigot

#

nor the Bukkit depend

quaint mantle
#

Oh ty, I thought when they said it was no longer included it wouldn't be. Does that just mean it isn't included if you don't use --build craftbukkit ?

eternal oxide
#

you just build spigot. It has CB and Bukkit

quaint mantle
#

ty, apparently i've misunderstood the changes to be way more complicated than they actually are

chrome pewter
#

hey does anyone know how to replace block into air

#

package main;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockEvent;

public class blocks_replaced implements Listener {
public void block_changed(BlockEvent event) throws InterruptedException {
Block block = event.getBlock();
Material material = event.getBlock().getType();

    if (material.equals(Material.SLIME_BLOCK)){
        Thread.sleep(10000);

    }
}

}

eternal oxide
#

wrap code in three `

chrome pewter
#

i am sorry i dont understand

eternal oxide
#

put three ` before your code, and three more ` after

#

It creates a code block and makes it readable

#

in Discord

chrome pewter
#

oh k

#

thank you

eternal oxide
#

as for your code, you can;t listen to BlockEvent its an abstract class

#

and you can;t use sleep or wait on the main thread

chrome pewter
eternal oxide
quaint mantle
#

Hi sorry, now getting failure to find org.spigotmc:minecraft-server:txt:maps-mojang:1.17-R0.1-SNAPSHOT when remapping when building.

^ That file isn't in my local maven repo either. If anyone can send me that txt file it'd be a great help. Ran BuildTools again, still not appearing (with the --remapped as well). Thx

lean gull
#

can someone help? i made a custom crafting gui thing but there's a lot of bug to be fixed, pls help

code: https://paste.md-5.net/radiqexewi.java

bug 1: it doesn't set the result item when i put a correct recipe unless i click on an allowed slot / the result slot
bug 2: when i do click on an allowed slot / result slot then take the result it doesn't remove 1 item from each slot for a second (it's for a second intentionally for testing), then it puts the result in the result slot again

#

there might be more bugs that i haven't found yet

#

bug 3: it seems that one recipe does not require clicking on an allowed slot / result slot but the other one does?

quaint mantle
timid ruin
quaint mantle
timid ruin
#

ok

#

Do i need to use "new" to transfer a field from one class to another?

quaint mantle
#

What do you mean exactly

timid ruin
#
class Class1 {
    public String name = 'n';
}
class Class2 {
    public String myname = //here i need get a field name from Class1
}
#

in Class2 i get to get filed "name" from Class1

ivory sleet
#

Though it’s called that you need to pass an instance from one class to another

#

And that brings up the point what the notion of an instance is

quaint mantle
#

Conclureeeeeeeee

ivory sleet
#

Itzzyaa helu

quaint mantle
#

._.

#

Call me?

ivory sleet
#

Hmm

quaint mantle
#

Yes yes yes

ivory sleet
#

I need to get some breakfast first then maybe

quaint mantle
#

Okay ConclUwUre

ivory sleet
#

Stop lol

quaint mantle
#

😂

dire marsh
#

whoever named themselves event I am sorry for pinging

charred wind
#

Someone knowing, why the points are sorted that way?
Thats my query: "SELECT stats, JSON_EXTRACT(stats, '$.points') AS points FROM RageMode_30d WHERE month='SEPTEMBER-2021' ORDER BY points DESC LIMIT 10"

terse swift
#

@charred wind is points being treated as a string for some reason?

quaint mantle
charred wind
austere cove
#

yo since when can signs be lit

#

also I can't find the 'lit' value when looking at a sign in game

chrome beacon
#

1.17 iirc

austere cove
#

im in 1.17.1

#

I mean I figured out how to do it but it still doesn't show up as 'lit'

#

and I can't /setblock a lit sign

eternal night
#

because it isn't a blockstate

#

rather NBT

#

idk what wiki that is

#

but it should be part of the signs NBT

austere cove
#

hmm yea ig but wiki lists it as block data in the same list w rotation, waterlogged etc

#

which do show up

eternal night
#

wrong wiki ¯_(ツ)_/¯

#

it is definitely NBT

austere cove
#

that moment you can't copy from wiki anymore

#

;-;

terse swift
charred wind
#

Am I able to cast this?

#

or something like that

sullen ember
#

can anybody tell a plugin through which we will not able to see player nametag

terse swift
charred wind
#

how would that look?

amber vale
#

ok

#

?paste

undone axleBOT
amber vale
#

Why does this if (i == Gui.powerMiner) {
result in false, even though when ever you open the GUI it is being set up in the Gui class like this:

terse swift
lean gull
opal juniper
#

is there a way to make tnt do no environmental damage when you spawn the tnt primed or do i have to listen to the explode event?

gleaming grove
#

Hi do you know if there is some ByteBuffer builder in java that would work like this ?

ivory sleet
#

Nope

#

Maybe in guava

#

But it’s mutable so it doesn’t need the builder pattern

charred wind
# terse swift Google is your friend there 😁

SELECT stats, JSON_EXTRACT(stats, '$.points') AS 'pointsString' FROM RageMode_30d WHERE month='SEPTEMBER-2021', CAST(pointsString AS int) AS points ORDER BY `points` DESC LIMIT 10 I've tried it like that, but it doesn't work.. any idea?

quaint mantle
terse swift
#

Or there might be a json_value() function - I don't know what dB you're using

maiden briar
fiery inlet
#

How is it people make treecutter plugins

#

Where you hit the bottom part and it takes out the whole tree

terse swift
ivory sleet
lean gull
ornate heart
lyric grove
#

How would i remove the nametag of npc's?

wary harness
#

?paste

undone axleBOT
maiden briar
#

@eternal oxide remember the problem from yesterday? It was easy: I was just looking at the default config, and NOT at the user made config

quiet ice
#

Okay really stupid question, but how do I make so a class is serialised (via the java serialisation API) as another class. More specifically I am extending java.util.Vector (in the name of "performance") however I want to keep fully compatibility with the old system, which made use of the unaltered java.util.Vector class. I've been thinking that having something like

    private void writeObject(java.io.ObjectOutputStream out) throws IOException {
        out.writeObject(new Vector<>(this));
    }

would work, but apparently it does not and yields

java.lang.ClassCastException: cannot assign instance of java.util.Vector to field de.geolykt.feedbackvectors.collections.IdentityLookupVector.lookupMap of type java.util.Map in instance of de.geolykt.feedbackvectors.collections.IdentityFeedbackVector

even if the class is present (if the class is not present it results in a CNFE). Would I need to extend the ObjectOutputStream here or is there a simpler approach?

lost matrix
#

Wait im not sure if i understand your problem.

quiet ice
#

hm, yea, that might work. Surely didn't test that one

lost matrix
quiet ice
#

ah.

#

yep, Externalizable doesn't work. I guess I'll need to do some more hacks and extend the ObjectOutputStream

lost matrix
lost matrix
# quiet ice ah.

And why cant you just deserialize the byte stream to your own Vector class?

quiet ice
#

well, I need to to be able to be compatible with a protocol that someone wrote that used java serialisation

#

I really dislike the API, so if I had the choice I wouldn't use it

lost matrix
#

Oof...

brittle loom
#

Hello, I created a method that is supposed to remove all swords until there's only 1 left but I realised it doesn't work. I'm having some trouble finding out what I'm doing wrong, could anyone help me? ``` private void removeSwords(final Inventory inventory) {
for (int i = 0; i < inventory.getSize(); i++) {
final ItemStack item = inventory.getItem(i);

        if (item != null) {
            final boolean isSword = item.getType().name().contains("SWORD");

            if (isSword) {
                final boolean inventoryContainsSingleSword = inventory.contains(item, 1);

                if (!inventoryContainsSingleSword)
                    inventory.remove(item);
            }
        }
    }
}```
lost matrix
brittle loom
#

Ok thanks a lot for the help, I'll try it out.

lost matrix
# brittle loom Ok thanks a lot for the help, I'll try it out.

This should have an even better performance

  public void removeWithPredicateUntilAmountReached(final Inventory inventory, final Predicate<ItemStack> predicate, final int amount) {
    Preconditions.checkArgument(amount > 0);
    final int size = inventory.getSize();
    final Deque<Integer> matchingSlots = new ArrayDeque<>();
    for (int i = 0; i < size; i++) {
      if (predicate.test(inventory.getItem(i))) {
        matchingSlots.add(i);
      }
    }

    while (matchingSlots.size() > amount) {
      inventory.setItem(matchingSlots.poll(), null);
    }
  }
lyric grove
lost matrix
lyric grove
#

i cant do that on 1.7, i tried but the methods dont exist

lost matrix
lyric grove
#

xd

lost matrix
#

Right?

lyric grove
#

im not joking lmao

#

its definitely possible on 1.7, i just dont know how

lost matrix
#

Wow... You know that this version is ancient and you wont get any support for this anywhere.

lost matrix
stone sinew
quiet ice
lyric grove
#

should i use nvms? its possible to get armor stands in 1.7 so im sure it will be possible to hide the nametags in that version

quiet ice
#

Finding these ancient versions is hard

lyric grove
stone sinew
lost matrix
lyric grove
lost matrix
lyric grove
#

or horse if player is 1.7

quaint mantle
#

ok but thats still not armor stands in 1.7

lost matrix
#

But a horse is not an armorstand. Its not possible to get armorstands in 1.7

lyric grove
lost matrix
quaint mantle
#

through 1.7, not in 1.7

lost matrix
#

You can always write a packet and send it to a client. Even if you are in 1.2.5 you can technically spawn the wither for a 1.13 client if you just send the right bytes to the client.
That doesnt mean it is actually spawned. Just that the client thinks it is.

cinder comet
#

Hello, I have question with spigot. I'm now setting up CI for plugin development and I want it to fail when there's exception happens

chrome pewter
#

is it possible to change mobs ai in spigot for example i want to make a cat have a baby zombie ai

lyric grove
#

and it will display as a armor stand

lost matrix
cinder comet
chrome pewter
cinder comet
#
String a = null;
a.equal("asdf");
#

I want it to fail when I do that

#

I see NPE on log

chrome pewter
cinder comet
#

Right now CI only compiles the plugin

lost matrix
lost matrix
severe oracle
#

can i use hex color code in setPixel instead of MapPalette ?

cinder comet
lost matrix
lost matrix
cinder comet
#

thank you

severe oracle
#

how to use byte color ?

chrome pewter
#

so how do i setup nms

#

??

#

oh and sorry i forgot please

quaint mantle
#

run buildtools

#

add the spigot maven repo

steady rapids
#

is it possible to remove this speed limit? when I sprint & jump on a pressure plate (launchpads plugin) I get too fast and i get a teleport bug in game and this warning in the console: https://romano.eats.dog/7mSZ1pAz

buoyant mica
#

do you guys know by chance how to make a good scoreboard for the server

kind coral
#

Hey guys im making a blockparty plugin, tho i would like to set the block as a sort of a grid instead of them being completely random but i really don't have a base and don't know where to start, as anyone got an idea? I got two corners that represent the size of the "terrain" the Y is always the same due to the terrain being only 1 block tall

waxen plinth
#

What is blockparty?

quaint mantle
#

like musical chairs but you have to get on a specific block in time before all the other blocks disappear

buoyant mica
#

yep

#

like random wool blocks with different colors

#

its like a stop dance

kind coral
#

yep

#

the game works great, tho i would like to achieve patterns, them being smaller and smaller everytime

hasty shard
#

If there is someone who writes World Generator for a fee, can they contact me?

lyric grove
# lost matrix No its not

I think this might be the solution, thanks for the support
npc.getBukkitEntity().setCustomNameVisible(false);

fleet badger
#

Would dripstone growth be BlockSpreadEvent or would it just be BlockGrowEvent? Or BlockFormEvent? or something else?

chrome pewter
#

i install nms and change the api but it still dosent work

lost matrix
upbeat sky
#

Hey! When compiling I suddenly get this error. Anyone know how to fix?

#

This is how i registered the command

lost matrix
upbeat sky
#

It does

lost matrix
#

Do you use maven?

upbeat sky
#

I dont, just artifacts

kindred valley
#

hey i made an object named handcluffs and i set its meta when im executing command handcluffs and it gives me default tripwire_hook not the meta one

halcyon mica
#

So how comes my own abstracted interface that implements bukkit's mob fails to compile with this error?

#

It is not interacting with a vanilla entity at all

lost matrix
upbeat sky
#

I removed the onCommand and pasted it back in and now it builds.. Weird

lost matrix
halcyon mica
#

No, org.bukkit.Mob

kind stirrup
#

Hi, I am trying to do command "/god" but something went wrong. Who could help me with that?

lost matrix
halcyon mica
lost matrix
halcyon mica
#

No, this is just a additional library I am creating

#

I have created a new vanilla entity that I am abstracting through this interface for a actual plugin to interact with

#

And no, it is not a modded entity, as far as the client is concerned, it is a pillager

lost matrix
halcyon mica
#

No, I have created a proxy spigot entity named CraftPathfinder which extends CraftMob, implements Pathfinder and holds a PathfinderMob handle

lost matrix
#

Ah ok good

manic bison
#

List<String> testlist;
testlist = Arrays.asList();
testlist = Arrays.asList("1","2")

someitemmeta.setLore(Arrays.asList("test","test1",testlist);

^^
the code above is an example
and the last line outputs me the following error:
The method setLore(List<String>) in the type ItemMeta is not applicable for the arguments (List<Object>)
Anyone knows how to fix that ? or help me to

kindred valley
undone axleBOT
kindred valley
halcyon mica
#

So why is it complaining about poses

lost matrix
halcyon mica
#

But the pathfinder interface is in no way related to the nms entity object

lost matrix
kindred valley
lost matrix
#

Including imports

halcyon mica
#

It simply extends mob

edgy basalt
#

Hi !
Does someone know a good tutorial to create my first plugin with visual studio code ? (i've search and i only find tutorial with eclipse)

lost matrix
edgy basalt
#

cause i don't have much space on my computer

#

i have to install eclipse

#

visual studio code is on my pc because i need it

#

for other works

#

so if i install eclipse it will be VS Code + Eclipse

hasty prawn
#

Eclipse doesn't really require that much disk space, if you're running out already you should get more space.

#

You're just delaying an inevitable problem

lost matrix
# halcyon mica

I dont even see net.minecraft.world.entity.Mob as a class...

edgy basalt
edgy basalt
#

and i know it's possible to do a plugin with it

hasty prawn
#

Mojang Mappings I assume

edgy basalt
#

but i don't find good tutorials

hasty prawn
#

Probably because most people don't use VSCode for Java.

lost matrix
edgy basalt
kindred valley
edgy basalt
#

Is js = java script ?

hasty prawn
#

Yes

manic bison
hasty prawn
#

Aren't Datapacks basically just text files?

hasty prawn
lost matrix
halcyon mica
#

Otherwise working with NMS is basicially impossible

edgy basalt
#

they are Json and Mcmeta

gleaming grove
#

is minecraft client based on ticks. What if i create other thread that send packets to client faster then 1/20 sec?

lost matrix
# halcyon mica

Hey sry but i dont see any problem unless there is some nms class implementing a Spigot interface.
How does your CraftEntity look like?

hasty prawn
halcyon mica
edgy basalt
#

oh

#

yes

#

you're right

lost matrix
hasty prawn
#

Vatuu what are you trying to do?

halcyon mica
#

I am creating a abstract pathfinder entity for custom mob ai

#

Vanilla goals are not suitable for what I need

gleaming grove
#

meh ;/

hasty prawn
#

You can make custom goals by just extending Goal and overriding the methods.

halcyon mica
#

But the client explicitly requested that the entity is compatible with existing spigot wrappers

#

The very structure of vanilla pathfinding does not fit

kindred valley
#

?paste

undone axleBOT
halcyon mica
#

I am replacing the entirety of the vanilla entity's path generation and controller

hasty prawn
#

Ah

lost matrix
halcyon mica
#

unless you can tell me how to make a mob clear and jump gaps like a player

lost matrix
#

But that should be fine in my head...

halcyon mica
kindred valley
lost matrix
halcyon mica
#

nope

#

The only static methods in this context are the spawn method and the verification if it can reach a location

lost matrix
lost matrix
lost matrix
#

PersistentDataContainer

#

I think you could also just use scoreboard tags.

kindred valley
#

.

lost matrix
lost matrix
# kindred valley .
  private static final String CUFF_TAG = "__CUFFED__";

  public static void setCuffed(final Player player) {
    final Set<String> tags = player.getScoreboardTags();
    tags.add(CUFF_TAG);
  }

  public static boolean isCuffed(final Player player) {
    final Set<String> tags = player.getScoreboardTags();
    return tags.contains(CUFF_TAG);
  }

  public static void unCuff(final Player player) {
    final Set<String> tags = player.getScoreboardTags();
    tags.remove(CUFF_TAG);
  }

  @EventHandler
  public void onMove(final PlayerMoveEvent event) {
    final Location from = event.getFrom();
    final Location to = event.getTo();
    final Player player = event.getPlayer();
    if (!this.isCuffed(player)) {
      return;
    }
    if (from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ()) {
      event.setCancelled(true);
    }
  }

I used a bit more static than i normally would to make it simpler to use.

#

But generally you would want a way to check if a player is cuffed or not and then react on that somehow.

stone sinew
#

I think so

eternal oxide
#

not spigot

stone sinew
#

paper

lost matrix
stone sinew
#

lol

lost matrix
stone sinew
lost matrix
stone sinew
candid wave
#

Hi Guys, for some reason using nuvotifier on two plugins the vote event is not fired on latest bungee. Is something broken?

#

you can see the debug log of the vote received but nothing is fired

lost matrix
#

InventoryHolder will never be an instance of Inventory

#

Idk what you are trying to accomplish with this check.

#

But remove it

#

You cant check if a player opens his own inventory

#

Not possible

#

Even in huge plugins i rarely have more than 10 eventhandler methods. This is def not the way to go.

stone sinew
#

Could just check PlayerPickupItemEvent

#

CraftItemEvent

lost matrix
#

Hm. Couldnt you build a PlayerInventoryOpenEvent by using a custom achievement like the vanilla "Taking Inventory"
one and then revoking it afterwards?

stone sinew
#

Events would be your best bet. A scheduler for every player can get pretty laggy.

lost matrix
#

You can evenly distribute the runnable over N ticks.

#

From this

#

To this

gleaming grove
ebon magnet
stone sinew
ebon magnet
ebon magnet
#

So it's like the equivalent of glancing at somebody's cubicle as you walk by on your way to do something else.

#

As opposed to actively going in and thoroughly searching every person's cubicle.

gleaming grove
#

how to make atomic queue?

#

or thread safe queue

dense goblet
#

unless you have a custom core that allows you to register new items and send them as vanilla items to the player

stone sinew
#

InventoryMoveItemEvent?

compact cape
#

Any one good with custom pathfinders? I did my first one, But doesn't seem to work 😂

lost matrix
# dense goblet if you're trying to implement custom functionality (custom items, custom blocks)...

I just need one single listener for custom items which activate by interaction

public class CustomItemManager {

  private static final NamespacedKey INTERACTABLE_KEY = ProjectRevenant.asNameSpaceFor("custom-interactable");

  private final Int2ObjectMap<Consumer<PlayerInteractEvent>> interactableMap = new Int2ObjectOpenHashMap<>();

  public void registerInteraction(final String key, final Consumer<PlayerInteractEvent> eventConsumer) {
    this.interactableMap.put(key.hashCode(), eventConsumer);
  }
  
  protected void handleEvent(final PlayerInteractEvent event) {
    final ItemStack itemStack = event.getItem();
    if (itemStack == null) {
      return;
    }
    final ItemMeta meta = itemStack.getItemMeta();
    if (meta == null) {
      return;
    }
    ...
    Some more logic inclduing PDC stuff
#

And my Listener is literally just this

stone sinew
#

Is there a clone method for lists?

private List<String> list = new ArrayList<>();
public List<String> getList() {
    List<String> listClone = new ArrayList<>();
    listClone.addAll(list);
    return listClone;
}
```This is what I am currently using.
lost matrix
stone sinew
compact cape
lost matrix
dense goblet
# lost matrix I just need one single listener for custom items which activate by interaction `...

for blocks I need to intercept any events that change the state of the world (block mined, exploded, changed by entity, burned, moved by piston, etc etc etc).

For items, I have to listen for:
-player interact event
-player interact entity event
-block place event (so you can place custom blocks using corresponding custom items)
-item held event
-player logged in event (to update custom items in their inventory in case their stats changed)

and to stop custom items from being used inappropriately (e.g. using steel as netherite in the upgrade table):
-inventory click
-inventory drag
-inventory move

and for custom recipes and disallowing custom items to be used as substitutes for vanilla items:
-prepare item craft
-furnace burn event
-furnace smelt event

lost matrix
dense goblet
#

ahh I see

#

yeah I don't see the need to listen to the same event more than once unless it's a clearly different purpose

#

e.g. in my item events class I listen to FurnaceBurnEvent to stop vanilla furnaces burning custom items, while in my world events class I listen to FurnaceBurnEvent to stop custom blocks, which use the furnace as their model, from burning any items.

halcyon mica
#

So it appears the getPose() method in the nms entity and in bukkit's entity conflicts

#

Which I find weird, because the actual nms entity never touches any bukkit interfaces

quaint mantle
#

is there an event for when the server starts?

lost matrix
ancient whale
#

Hey, I'm trying to get a world with Bukkit.getWorld in the onload method, seem like worlds aren't loaded yet which result in an NPE, is there any other way to handle this without having to put my method in the onEnable ?

lost matrix
quaint mantle
#

How would I go about making a BlockBreakEvent or similar drop a different item than the harvested block? Or a custom item

eternal oxide
#

you can only remove drops there

quaint mantle
#

Yea

#

Figured that the hard way

eternal oxide
#

or you can cancel teh break event, set to air and dropItemNaturally

lost matrix
#

Then just get the world from there and drop an item at the broken blocks location.

eternal oxide
#

yep

quaint mantle
#

ok thx

halcyon mica
#

I don't understand this, how is the nms entity attemping to implement the bukkit entity interface

eternal oxide
#

BlockDrop Item is probably best as you leave all the tests to see if it can be broken to other plugins

ancient whale
eternal oxide
#

you just deal with the drops

quaint mantle
lost matrix
eternal oxide
#

if you only want to change the drops do as 7smile7 said, use BlockDropItemEvent, cancel it and drop the item yourslef

halcyon mica
#

Yet it clearly does somewhere

lost matrix
halcyon mica
#

Otherwise this would not be a problem

#

But I don't understand where

#

This seems to be something the ide should catch onto

lost matrix
halcyon mica
#
[INFO] -----------------------< dev.vatuu:pathfinding >------------------------
[INFO] Building Pathfinding 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ pathfinding ---
[INFO] Deleting C:\Users\Vatuu\IdeaProjects\Comissions\Pathfinding\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ pathfinding ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ pathfinding ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 13 source files to C:\Users\Vatuu\IdeaProjects\Comissions\Pathfinding\target\classes
[INFO] /C:/Users/Vatuu/IdeaProjects/Comissions/Pathfinding/src/main/java/dev/vatuu/pathfinding/ReflectionUtils.java: C:\Users\Vatuu\IdeaProjects\Comissions\Pathfinding\src\main\java\dev\vatuu\pathfinding\ReflectionUtils.java uses unchecked or unsafe operations.
[INFO] /C:/Users/Vatuu/IdeaProjects/Comissions/Pathfinding/src/main/java/dev/vatuu/pathfinding/ReflectionUtils.java: Recompile with -Xlint:unchecked for details.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/Vatuu/IdeaProjects/Comissions/Pathfinding/src/main/java/dev/vatuu/pathfinding/entity/Pathfinder.java: getPose() in net.minecraft.world.entity.Entity cannot implement getPose() in org.bukkit.entity.Entity
  return type net.minecraft.world.entity.Pose is not compatible with org.bukkit.entity.Pose
[INFO] 1 error
[INFO] -------------------------------------------------------------
#

Compile time

lost matrix
halcyon mica
#

Yes, I do

quaint mantle
halcyon mica
lost matrix
eternal oxide
#

It literally takes a location and an ItemStack

quaint mantle
#

ye i meant method

halcyon mica
#

This is far from the worst stuff I have done, that would probably be where I modify the network thread to sent armorstand pose Update packets at 60/s

lost matrix
quaint mantle
#

Ok but how do i call it in my event class? e.g.

public void onBlockBreak(BlockDropItemEvent e) {
Block block = event.getBlock();

if (block.getType() == Material.GOLD_BLOCK) {
event.setCancelled(true);
block.setType(Material.AIR)
//call dropItemNaturally method, but how?
...
halcyon mica
#

Nope, exclusively spigot

#

Not spigot-api either

#

Remapped with mojmap

eternal oxide
lost matrix
eternal oxide
#

block.getLocation().getWorld().dropItemNaturally(...

halcyon mica
#

Yes

quaint mantle
#

ok thank you

halcyon mica
#

It must be something related to my creation of the entity

#

Before I went for the spigot-esque abstraction, it worked fine

lost matrix
#

Could you send nms, craftimpl and interface again pls?

halcyon mica
#

One moment

quaint mantle
#

It doesn't seem to work, it didn't drop the item i wanted it to drop. I made sure that the event is registered in my plugin class.

    public void onBlockBreak(BlockDropItemEvent event) {
        Block block = event.getBlock();
        ItemStack test = new ItemStack(Material.APPLE);
        Location blockLocation = block.getLocation();

        if (block.getType() == Material.GOLD_BLOCK) {
            block.getDrops().clear();
            block.setType(Material.AIR);
            block.getLocation().getWorld().dropItemNaturally(blockLocation, test);
        }
    }
eternal oxide
#

Your code will fail as the block is already broken. use getBlockState

quaint mantle
#

kk

crimson terrace
#

use BlockBreakEvent?

eternal oxide
#

no, he;s doing drops

crimson terrace
#

yeah but you can do drops from blockbreakevent

eternal oxide
#

you can but you have to mess with event order etc in case another plugin cancels the event

#

easier to use the event thats specifically for drops to handle drops

crimson terrace
#

hm, fair point

#

maybe instead of dropping the item yourself add it to the getDrops?

quaint mantle
#

nah doesnt work that way

#

you cant add an item to getDrops only remove

kindred valley
eternal oxide
#

No you can;t

#

it says so in the javadocs

#

not a copy, but not permitted to add

#
getItems
@NotNull
public List<Item> getItems()
Gets list of the Item drops caused by the block break. This list is mutable - removing an item from it will cause it to not drop. It is not legal however to add new items to the list.

Returns:
    The Item the block caused to drop

quaint mantle
#

Still didnt work. Did i work this correctly into my code?

    public void onBlockBreak(BlockDropItemEvent event) {
        Block block = event.getBlock();
        ItemStack test = new ItemStack(Material.APPLE);
        Location blockLoc = block.getLocation();

        if (block.getState().getType() == Material.GOLD_BLOCK) {
            block.getDrops().clear();
            block.getState().setType(Material.AIR);
            block.getState().getLocation().getWorld().dropItemNaturally(blockLoc, test);
        }
    }
eternal oxide
#

no thast wrong

#

you can't use getBlock, use getBlockState in the event, not on the block

quaint mantle
#

oh ok

crimson terrace
eternal oxide
#

BlockState state = event.getBlockState();

crimson terrace
#

use getItems() to remove the drops

halcyon mica
#

@lost matrix Found anything?

kindred valley
lost matrix
quaint mantle
#

Thank you finally

lost matrix
eternal oxide
lost matrix
kindred valley
crimson terrace
#

if anyones got the time, you know a good tutorial on how to save a hashmap to a file?

halcyon mica
#

I wish you could remove the number every scoreboard line is prefixed as tbh

crimson terrace
#

just config.set(data)? assuming data is the hashmap?

eternal oxide
#

path, map

lost matrix
crimson terrace
#

ok thats easier than I thought. was going around looking at custom config files

#

thanks

lost matrix
crimson terrace
eternal oxide
#

you will need to save and reload after setting a Map

eternal oxide
#

If not it will be a Map in memory. It gets converted to a MemorySection upon load

crimson terrace
stark marlin
crimson terrace
#

tried restarting the IDE?

kindred valley
eternal oxide
stark marlin
#

I need BukkitCommand for the execute() method. Seems that if I try to use TabExecutor instead of TabCompleter it wants to add onCommand() instead