#help-development

1 messages · Page 1009 of 1

eternal night
#

Not on paper

turbid flame
#

So my apologises @quiet ice

eternal oxide
#

Yep, as I told him, Spigot says not to

turbid flame
#

I didn't know that actually

valid burrow
#

?xy

undone axleBOT
fair rock
#

Bro you have a highly bad attitude, tf

turbid flame
#

Any way to get ID without throwing "java.lang.IllegalArgumentException: Cannot get ID of Modern Material"

echo basalt
#

.

blazing ocean
#

paper has their own way of doing things

valid burrow
#

thats just dumb

fair rock
turbid flame
valid burrow
turbid flame
#

Item

#

Not ItemStack

#

Not CratItem

valid burrow
#

getType.toString

#

nerd

#

TYPE TO STRING

#

TYPE TO FUCKING STRING

#

ITS AN ENUM

pseudo hazel
#

you triggered?

valid burrow
blazing ocean
#

a little

turbid flame
valid burrow
turbid flame
#

net.minecraft.item.Item

valid burrow
#

thats how enums work

pseudo hazel
#

what do you wanna do with the Item class

turbid flame
#

You don't understand what i am telling you

#

Learn how to read @valid burrow

eternal oxide
#

so NMS and not Spigot

valid burrow
pseudo hazel
#

that is nms, so nms probably has its own way to get the id

valid burrow
#

you said material and now you are saying item

#

decide

pseudo hazel
#

they never said that

valid burrow
pseudo hazel
#

stop being triggered by nothing

turbid flame
fair rock
#

Item item = BuiltInRegistries.ITEM.get(new ResourceLocation("NAME_OF_ITEM"));

#

?

valid burrow
valid burrow
valid burrow
turbid flame
#

And you tell me to use .toString() on enum

#

XD?

valid burrow
#

i literally asked you if you mean material and you said yes

#

cause guess whaz

#

Material is an enum

fair rock
valid burrow
#

?xy can only say that lol

undone axleBOT
turbid flame
#

I want to get and id to get Item.getId(int id);

eternal oxide
#

Yeah I began to ask him questions to narrow down what he actually hanted and he just got rude.

humble lynx
#

Where's the id coming from that can't be replaced with a string material?

turbid flame
#

The only time i was rude was to geol

fair rock
#

okay

#

Item item = BuiltInRegistries.ITEM.get(new ResourceLocation("NAME_OF_ITEM"));
Item.getId(item);

#

Next question

eternal oxide
#

so teh first thing you should be telling us is that its a Minecraft Item not anything to do with Spigot

tardy flame
#

Apigot???

eternal oxide
fair rock
eternal oxide
#

obviously 🙂

turbid flame
#

When i said ItemStack?

humble lynx
#

Actually here's an idea, make your own list of ids for each item stack

turbid flame
fair rock
#

a

humble lynx
#

Will take you hours and might keep you off discord for a bit

fair rock
turbid flame
#

Are you using 1.18.2?

fair rock
#

Do you use mapped?

turbid flame
#

Yes

#

If you have it and i don't, i will go blame my friend for removing it

#

i found it inside Registry class. Thanks for help

#

@fair rock

fair rock
#

Np

turbid flame
#

Oh i have another qustion

#

Not related to coding

#

But i was always wondering

#

Why ItemMeta is marked as @Nullable

eternal oxide
#

where?

turbid flame
#

ItemStack

eternal oxide
#

in what context?

ivory sleet
#

not all materials have a valid itemmeta

#

air for instance

eternal oxide
#

ah ItemMeta, sorry I misread

#

unless you edited it 😉

turbid flame
#

I did

#

I firstly said ItemStack

#

But i meant Itemmeta

eternal oxide
#

yeah my question would stand in that instance

#

yeah meta is not always there

turbid flame
eternal oxide
#

as Conclube said

#

AIR has no meta

#

so a call to getItemMeta() would return null if used on AIR

turbid flame
#

Never did that

#

But it make sense for me

#

Thx

pseudo hazel
#

just dont check for it and hope you never get air 😅

bright spire
hexed hinge
#
        ArrayList<String> lore = new ArrayList<String>();
        Set<String> stats = NBT.get(item, nbt -> (Set<String>) nbt.getCompound("stats").getKeys());
        for(String stringStat : stats){
            Stat stat = Stat.valueOf(stringStat);
            lore.add(colored("&7"+stat.getDisplayName()+": "+stat.getColor()+NBTHandler.getStat(item, stringStat)));
        }
        for(String s : lore) {
            Bukkit.broadcastMessage(s);
        }
        item.getItemMeta().setLore(lore);
    }```

why does the item not update lore? the broadcast part works
eternal oxide
#

meta is a clone

#

you have to put it back

hexed hinge
#

so how do i directly

eternal oxide
#

meta is ALWAYS a clone, you have to put it back on teh item after changing it

fair rock
#

ItemMeta meta = item.getItemMeta();

do Stuff

item.setItemMeta(meta);

tardy delta
#

still no ::updateMeta method?

#

or was that paper

eternal night
#

that was paper

hexed hinge
#

can i do it in one line

eternal night
#

no

hexed hinge
#

damn that sucks

eternal night
#

I mean, just make a helper method

inner mulch
eternal night
#
public static ItemStack editMeta(ItemStack stack, Consumer<ItemMeta> consumer) {
  final ItemMeta meta = stack.getItemMeta();
  if (meta != null) consumer.accept(meta);
  stack.setItemMeta(meta);
}
hexed hinge
#

like a method to do it all in one line?

eternal night
#

and off ya go

hexed hinge
#

i dont evne know what is a consumer 💀

eternal night
#

then you can just call editMeta(stack, i -> i.setLore(list));

eternal night
inner mulch
hexed hinge
#

oh alright

eternal night
#

that you cannot really revert now without breaking everything

inner mulch
#

i dont really get why cloning it is better

eternal oxide
#

Who mentioned good?

inner mulch
#

i mean some1 decided it was better

eternal night
#

¯_(ツ)_/¯

eternal oxide
#

Someone also decided Windows ME was a good idea too

tardy delta
#

is it related to the packets that need to be sent to update the item?

eternal night
#

a live reference is a bit annoying in how it interacts with e.g. minecraft

#

if you have a life reference and edit it, but the player merge the item into another, what happens?

#

this way, you have to have an item stack reference to set it back to

#

so it kinda forces you to not run into ugly issues

bright spire
#

Hey guys! How can I completely unload a plugin from the server? I am trying to make an autoupdate feature

quaint mantle
#

Just replace the jar and prompt the user to reboot

eternal oxide
#

just put your new jar in an update folder and the server will update it when it restarts

dawn flower
#

is there an app that turns an animation into spigot code using ticks instead of frames? and if there isn't, how possible would it be to make one

quaint mantle
#

Or a blender model

dawn flower
#

?

#

no

quaint mantle
#

What kind of animation

dawn flower
#

actually nvm i don't think it's possible

#

can u change the position of an entity's hand?

inner mulch
#

no

#

only armor stands

dawn flower
#

damn

inner mulch
#

if you want to animate an npc or something just make an armor stand look like it?

#

i think thats the approach

quaint mantle
#

There is also display entities

marsh crest
#

does anyone know why my goto command isn't teleporting me? all of the others work but not goto


            switch (command.getName().toLowerCase()) {
                case "die":
                    p.sendMessage("DIE loser");
                    for (int i = 0; i < 100; i++)
                        p.getWorld().strikeLightning(p.getLocation());
                    p.setHealth(0.0);
                case "gmc":
                    p.setGameMode(GameMode.CREATIVE);
                case "goto":
                    Location world = Objects.requireNonNull(getServer().getWorld("world")).getSpawnLocation();
                    p.teleport(world);
            }
eternal oxide
#

your switch statement needs a break; in each section

#

currently they all fall through

marsh crest
#

oh yeah whoops

eternal oxide
#

goto looks fine, so long as you are not getting a console eror

marsh crest
#

i think i am?

#

ima reset the server to get a clean slate rq

#

oh wait i'm getting an error when i'm first joining the world

#
    @EventHandler
    public void onPlayerFirstJoin(PlayerSpawnLocationEvent event) {
        event.setSpawnLocation(Objects.requireNonNull(getServer().getWorld("world")).getSpawnLocation());
    }
#

wait i can just get rid of this rn

#

yeah that was that issue

#

okay i just realized i need to make a forum account so i can post images here

#

cuz i am getting a crash log

#

and i haven't quite learned how to read these yet

eternal oxide
#

?paste

undone axleBOT
marsh crest
eternal oxide
#

post the full stacktrace

#

LegacyServerPlugin.java:44

marsh crest
#

line 44 specifically is Location world = Objects.requireNonNull(getServer().getWorld("world")).getSpawnLocation();

#

also fsr it freaked and told me to switch to enhanced switch statements?

#

idk why intellij wanted me to do that but whatever

eternal oxide
#

your world doesn;t exist

#

did you name it differently?

#

ph no I see

#

oh

#

remove the )) to be one )

#

after getWorld("world")

#

close at the end

marsh crest
#

do i put a ) after getSpawnLocation

#

it pasted into the terminal weirdly

eternal oxide
#

your world is not called world

marsh crest
#

is there another thing to paste images

pseudo hazel
#

enhanced switch statements is just a syntax update

marsh crest
#

bc i have a world indeed called world

pseudo hazel
#

verify

#

and then paste it here

fair rock
eternal oxide
#

you could do getServer().getWorlds()[0].getSpawnLocation()

marsh crest
#

oh ill try that

#

oh actually its a list

#

so ima .get(0)

eternal oxide
#

oh it's a list, so get(0) not [0]

marsh crest
#

mhm

#

okay so that works sweet

#

that i'm confused about is my order of worlds

#

ima try something

eternal oxide
#

main world will always be 0

pseudo hazel
#

print all the worlds and see if the names arent weird

proud badge
#

Is there a protocollib discord server?

marsh crest
#

how do i parse a string as an int in java

proud badge
#

I cant find one

marsh crest
#

casting does not work in this situation

eternal oxide
#

Integer.parseInt(String)

proud badge
marsh crest
#

cool

proud badge
pseudo hazel
#

whats a varint

icy beacon
#

It's

pseudo hazel
#

cant you just read it as int

icy beacon
#

I

marsh crest
#

alright so somehow i made my main world "worlds/parkour"

#

man ima go verify i wanna post images brb

#

/nick wizard

#

aw shucks

#

eh whatevs doesn't matter that much

eternal oxide
#

?img

undone axleBOT
#

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

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

marsh crest
#

anywho i think i messed up by making a worlds folder because now the autogenerated paths are getting kinda icky

eternal oxide
#

ah you have

fair rock
#

Did you change the worlds container path and in server.properties the world name to parkour?
That would explain why the name is parkour

marsh crest
#

i named it parkour bc i had a map to use as a test and i made it in a folder worlds/parkour

#

the plan was u would be at the main world and could type /goto parkour and it would take u there

#

but eventually i deleted the world

#

but when i loaded the server back it considered that a reset

pseudo hazel
#

but your server.properties says world is the main world?

marsh crest
#

ah so it updated that

#

mkay

pseudo hazel
#

right

#

thats your main world

marsh crest
#

okay that makes a lot more sense

#

ima test something then

pseudo hazel
#

it couldnt get world cuz it wasnt loaded

marsh crest
#

is there a way i could make it not generate a nether and end equivalent of each world?

fair rock
#

spigot.yml/bukkit.yml
server.properties

allow-nether: false
allow-end: false

Something like that

tardy delta
#

to get the default world use Bukkit.getWorlds().get(0) btw

#

overworld is 0, nether 1 and end is 2

pseudo hazel
#

doesnt it only generate nether and end for the main world?

marsh crest
#

oh i think maybe

#

since the parkour world became the new main

#

that would make sense

tardy delta
#

idk how other worlds work

pseudo hazel
#

right

#

so it loaded parkour but didnt find nether worlds so started making them too

marsh crest
#

yea

pseudo hazel
#

well rn im trying to create additional worlds with their own nethers and ends but the portals are giving me issues, since I have to basically generate all the worlds from scratch, so that means also linking portals

#

if there is a better i wanna know xD

#

but yeah thats what I understand

#

it creates ow, nether, end for main world, and then any extra world you create is just a single world

#

with nether portals bringing you to world 1 (main world nether)

marsh crest
#

so this main world is the one set to be the one you originally load in, but how would i load and then send people to a different world called lobby

pseudo hazel
#

load the world

#

and then you can teleport players to it

#

getWorld doesnt work until its loaded

worthy yarrow
#

Or keep it loaded, to reduce that heavy load

pseudo hazel
#

yeah

#

but like if you just started the server

worthy yarrow
#

But it is a lobby so that’s not really necessary in this case

marsh crest
#

could i load it when the server starts?

#

i just wanna /goto lobby or /goto main yk

worthy yarrow
#

It’s the difference between like a nanosecond and a full second for transfer times so it’s really not that big of a deal, however when it comes to other multi world mechanics, you’ll want all your worlds loaded before interacting with them

marsh crest
#

okay so now how do i actually load worlds lol

pseudo hazel
#

you use createWorld

worthy yarrow
#

Does create world have worlds loaded til plugin disables / server?

pseudo hazel
#

yeah or until you unload() it

#

though I think you can remove the world's folder when it doesnt have players

#

and I think that would cause getworld to fail afterwards

#

since the world is gone

#

but im not sure

#

still in the process of debugging that

worthy yarrow
#

Why would you need / want to remove the world’s folder?

marsh crest
#

oh i'm now realizing i need to make a system where it like

pseudo hazel
#

if you dont want the world anymore 🤷‍♂️

marsh crest
#

resets the lobby world and doesn't save what people do

pseudo hazel
#

like for minigames or whatever

marsh crest
#

yea

worthy yarrow
#

But that brings up: why would you let people do something to the lobby world?

vast ledge
worthy yarrow
#

You guys are trying to do extra work kek

eternal oxide
#

spawn protection everywhere 🙂

marsh crest
#

so people can have fun lol

vast ledge
pseudo hazel
#

yeah that works for most minigames I suppose

#

the ones with static maps

vast ledge
#

Yea

worthy yarrow
marsh crest
#

what about like spleef

worthy yarrow
#

You can handle that with plugins

marsh crest
#

my brother in christ I am Making The Plugins

worthy yarrow
#

Auto generation of an area with your spleef blocks or something

worthy yarrow
#

I’m just telling you that you’re doing extra work for no real benefit

marsh crest
#

i just wanna learn

#

i wanna be able to do it myself, i wanna understand why and how it all works

worthy yarrow
#

Well sure, but just be vigilant in the advice you get, a lot of it is yes, correct, but sometimes it can be extra work for no reason

#

It’s hard to say what to do and what not to do on a project when you’re not the one writing it

pseudo hazel
#

I made eveyrthing for my plugin by myself, except for spigot api and the anvil gui backbone since that requires nms

#

so it depends on what you wanna do

#

i just code for fun

marsh crest
#

me too lol

#

i dont wanna use other plugins bc i wanna do it lol

valid basin
#

What's best free java obfuscator?

#

That's compliant with spigotmc?

worthy yarrow
#

Keep at it!

quiet ice
#

The rules around obfuscation are honestly so strict that it isn't worth it

worthy yarrow
#

Geol you got md’s obfuscating link

lilac dagger
#

i looked at the rules, you can't really go wrong with proguard

#

the rules apply for string encryptors/long obfuscations

eternal oxide
worthy yarrow
#

ELGARL

lilac dagger
#

and flow obfuscations/ crashing

worthy yarrow
#

you are too fast 😦

#

I literally just grabbed it

valid basin
#

Thx guys, I'll check

eternal oxide
#

You just slow if a grandpa beat you

quiet ice
lilac dagger
#

i flattened mine to ro.fr33styler.project

worthy yarrow
lilac dagger
#

i think that's within the rules

eternal oxide
#

same 😛

worthy yarrow
#

Ok shut up I know I’m faster than you I just know it! How about we run a race

quiet ice
#

famous last words

marsh crest
#

🏁 start your engines!!!

#

can i make it so that you basically have infinite miners fatigue without showing that you have miner fatigue

lilac dagger
#

, false, false, false

#

it's the closest to it

#

these are flags either in addpotion or potion effect

#

i always forget

marsh crest
#

which one is miners fatigue

lilac dagger
#

it's an object

#

new potion effect ( potioneffecttype.here

marsh crest
#

the enum param actually wants to be a map

marsh crest
#

can i se the duration to like

#

0 for infinite

pseudo hazel
#

I think -1? im not sure

lilac dagger
#

it's the wrong usage

marsh crest
#

yea i see

pseudo hazel
#

or there was a constant for it

marsh crest
#

im just asting about the duration param

pseudo hazel
#

i forgot

lilac dagger
#

i use Integer.MAX_VALUE

pseudo hazel
#

yeah but I believe they added a specific infinite duration method

worthy yarrow
#

I thought -1 worked for infinite?

pseudo hazel
#

because there is a difference between the **.** and inifite

lilac dagger
#

i dunno

pseudo hazel
#

I think

lilac dagger
#

oh they did, that's nice

pseudo hazel
#

ah right

#

-1

lilac dagger
#

use that

pseudo hazel
#

but use the constant

marsh crest
#

update

#

miner fatigue makes your hand slower

#

and i set my amplifer to just like 100 or something

lilac dagger
#

are you just trying to disable breaking?

marsh crest
#

i already did that

#

but i wanna make it so like

lilac dagger
#

it stops on attempt?

marsh crest
#

if you are punching a block it doesn't show the damage done

lilac dagger
#

use gamemode adventure instead

lilac dagger
#

but it still does the animation

valid basin
#

I don't want my resource to be terminated Xd

marsh crest
#

i want the normal speed punching to be happening but no block damage to be done

lilac dagger
#

that's it

marsh crest
lilac dagger
#

set it to 0?

eternal oxide
#

did you register the listener?

lilac dagger
#

i think it has a damage step

eternal oxide
#

also the damage state may be client side. see if you can actually break

lilac dagger
#

you might wanna keep EventHandler methods

marsh crest
marsh crest
lilac dagger
#

also you didn't add an obfuscation file

lilac dagger
eternal oxide
#

I'm betting it's just a visual on the client

lilac dagger
#

so if you reset it to 0 that's gonna clear up any weird bugs

marsh crest
#

mayeb getBlock().progress? or something

lilac dagger
#

look in block

#

yeah

#

i don't know actually, but progress sounds right

fair rock
#

Wait did you register the listener?

marsh crest
#

i did yes

#

all the other event handlers in this works

fair rock
#

Because BlockBreakEvent should cancel that

marsh crest
#

block break cancels when the block is broken

#

i also wanna cancel like the progress of blocks being broken

#

like if u mined bedrock or something

#

i wanna get rid of this cracking without getting rid of the punching yk

worthy yarrow
#

I thought there was a break speed / block durability something or other now?

marsh crest
#

nvm thats redstone stuff

worthy yarrow
#

Maybe? I haven’t explored enough, but I swore there was something about block break speed

marsh crest
#

i found getBreakSpeed

#

but thats a getter not a setter

eternal oxide
#

probably send that in teh block damage event

#

cancel event and send 0.0f

clear elm
#

why the command dont stands in the console when i execute it with performCommand?

worthy yarrow
#

More context please and perhaps some logs + code

clear elm
#

when the player executes an command with perfromCommand(" ") it dont counts as an command for the PlayerCommandPreprocessEvent

#

p.performCommand("betterrtp world world_the_end");

eternal oxide
#

no it won't

#

as its not actually coming from the client

clear elm
marsh crest
eternal oxide
eternal oxide
marsh crest
#

okay so new info

#

it's fired once when you start to damage the block

#

but doesn't continue

eternal oxide
#

if you delay sending the BlockDamage by 1 tick does it rest it?

clear elm
#

I wanna do an rtp system and i use BetterRTP and becasue the betterrtp cooldown is ugly i do my own cooldown and only use the teleport from betterrtp. so i wanna do that only my command works

        String command = e.getMessage();
        Player p = e.getPlayer();
        if (command.contains("betterrtp")){
            if (PublicVariablen.getRtp() == true){
                PublicVariablen.rtp = false;
            } else if (PublicVariablen.getRtp() == false){
                e.setCancelled(true);
                p.performCommand("rtp");
            }
        }
        }```
#
                                    p.performCommand("betterrtp world world");```
marsh crest
clear elm
#

you could use a bukkit runnable

marsh crest
#

theres also this

eternal oxide
clear elm
#

wdym

eternal oxide
#

((BetterRTP) Bukkit.getPlugin("BetterRTP")).onCommand(...

clear elm
#

i dont know what this does can u prob explain?

eternal oxide
#

it gets the instance of BetterRTP thats on the server and calls the onCommand method that is in their main class

clear elm
#

and how can i add my code to it?

dawn flower
#

look how betterrtp rtps you, copy it, put it into ur **custom **rtp command

#

saved afew milliseconds on server load time and no ugly cooldown message

eternal oxide
#

you do yoru code, then call the BetterRTP command you want to run

clear elm
#

but if i run the betterrtp command it executes with no cooldown

eternal oxide
#

yes

dawn flower
#

or check if BetterRTP has a rtp method and run that

eternal oxide
#

DO YOUR code, THEN call BetterRTP

dawn flower
clear elm
#

okay

eternal oxide
#

actually that was all a waste of time. Just do your delay handling before you call performCommand

#

You were going ot do it in preProcess

worthy yarrow
#

Kek

charred blaze
#

why is my server getting crashed if i use openInventory in guiclose event?

eternal oxide
#

read the javadoc, but also because you are still in teh event so it's not yet closed. calling open forces it to close again, over and over

charred blaze
#

so just run task 1 ticks later?

eternal oxide
#

yes

charred blaze
#

k

#

Now somehow when i open the inventory its calling the inventory im opening's close event

#

but i have an inventoryholder check

#

how did that happen

pseudo hazel
#

dont have the holder check first of all

#

I guess thats also second of all

#

you should ideally use the reference of the inventory itself for comparison

#

?gui

charred blaze
pseudo hazel
#

like have a list of your inventories

#

and then check if the inventory is the one from your list

charred blaze
#

what if i make change to the inventory

#

like add item

pseudo hazel
#

its still the same inventory

#

the reference doesnt change

#

and if you keep the reference you can reopen it if you wanted

charred blaze
#

hm

#

there is an InventoryHandler?

#

or does he have custom object or something?

pseudo hazel
#

yeah its custom

#

thats what the page is about

#

if you read it xD

charred blaze
#

oh i see it now

azure vault
#

which event do i need to use to prevent the player from eating

#

got it

#

PlayerItemConsumeEvent

charred blaze
#

and why doesnt the inventoryholder check work?

pseudo hazel
#

im not sure but I have heard its very not optimized, but it should technically function I guess

#

unless you gave them all the same handler

charred blaze
#

nope

#

i didnt

#

did you mean holder?

pseudo hazel
#

yes

#

I got confused cuz you said handler

charred blaze
#

i only have 2 holders

charred blaze
#

my bad

pseudo hazel
#

anyways there is no real reason to use the holder if the reference to the actual inventory works too

charred blaze
#

if the inventory is linked to the holder if i do it like you say it will keep its old handler right?

pseudo hazel
#

what do you mean exactly?

#

I create inventories without the holder

charred blaze
#

i have an inventoryholder something i create inventories with.all inventories have separate InventoryHolder object of my inventoryholder class. i asked if i stored the inventories like you said if it would keep their inventoryholders

#

i have some data storing in the inventoryholder class in each inventory

#

thats why i am asking

chrome beacon
#

Don't use inventory holders for your data

mortal hare
#

minecraft wtf

#

am i just dirty minded

pseudo hazel
#

here it is

#

the story of how jimmy commits warcrimes without him knowing

#

poor innocent jimmy

#

actually this reminded me to check my itemstacks in my plugin 😅

tardy delta
pliant topaz
pseudo hazel
#

if teh arrays have teh same information, the data is gonna be the same

royal heath
#

If I'm making an API is it better to make a jar file that is downloaded, or it better to make it in maven and the user has to call a registerEvents(this) in their OnEnable so they don't need to have users download dependencies to use their plugin

pseudo hazel
#

you can download dependencies in your plugin I think

#

for libraries you probably shade them into the jar

#

so I guess the second

kindred sentinel
#

I need the formula of changing block breaking time because of instrument

pseudo hazel
#

though usually the only thing a library needs is a reference to the plugin instance

#

MyLib lib = new MyLib(Myplugin);

#

and then the library can register stuff themselves

#

on behalf of your plugin

royal heath
#

right, I just always thought it was a bit annoying to have to have people download a separate jar file for my plugin when it could just be internal

#

the user of the api I mean

kindred sentinel
#

Like by hand break block time is 15 ticks, but using wooden shovel it's 8 ticks

#

So how to get the formula?

pliant topaz
#

The problem i have, is that when on one item I modify the PD

#

then for a new instance of that item (which uses the default values) i have the modified values somehow

pseudo hazel
#

well you are probably writing the same array to it

#

or idk

gentle inlet
#

@EventHandler public void onItemCraft(CraftItemEvent event) { ItemStack result = event.getCurrentItem(); Player player = (Player) event.getWhoClicked(); if (result != null && result.hasItemMeta()) { ItemMeta meta = result.getItemMeta(); player.sendMessage(String.valueOf(result)); player.sendMessage(String.valueOf(meta)); if (meta.hasCustomModelData() && meta.getCustomModelData() == 637334) { if (event.getWhoClicked() instanceof Player) { player.getInventory().remove(result); Random(1, player); } } } }

How do i make it remove the deepslate?

shadow night
#

Can you cancel the event?

pliant topaz
fair rock
chrome beacon
#

I wouldn't recommend doing that

#

That gives the player 2-5 ticks to drop the item

#

You should register your own recipe instead of handling it through events

kindred sentinel
#

Oh, it's random

fair rock
#

Yeah its a random, idk if everytime you craft you get a random item xd

chrome beacon
#

then use the event to change the item

#

instead of adding a new item

kindred sentinel
#

Yeah. You can change the result

#

when player crafts item

pseudo hazel
#

just for my sanity, if you have an offline player, getting a (possible) online player in the best way is just doing Bukkit.getPlayer(offlinePlayer.getUniqueId()) right?

pseudo hazel
#

oof

chrome beacon
#

Do check if they're online with isOnline first

pseudo hazel
#

i feel stupid now

#

why

chrome beacon
#

ah ok it just returns null

#

you can skip the check then

fair rock
#

Why tf has the OfflinePlayer a player instance, im confused but i feel the same Steaf

sharp heart
#

Hello, what is the packet to start and end the animation of eating / using bow / drinking potion.. etc ? (1.20.4)
I've searched on wiki.vg, but I couldn't find anything

chrome beacon
#

A player is an offline player

#

an offline player is not a player

pseudo hazel
#

it doesnt have a player instance

#

it probably just uses Bukkit.getPlayer itself if I had to guess xD

fair rock
pseudo hazel
#

ah yeah

#

makes sense

#

so I guess it doesnt matter xD

fair rock
#

Yeah doesnt matter xd

pseudo hazel
#

but offlineplayer::getPlayer is more convenient

short drift
#
    @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerLoginEvent(PlayerLoginEvent event) {
// blah blah
        var result = event.getResult();
        if (result == PlayerLoginEvent.Result.KICK_BANNED) {
            event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Porttikielto: " + banReason);
            event.setKickMessage("Porttikielto: " + banReason);
        }

What am I doing wrong?

#

I'm not seeing the message I set.

fair rock
#

Can you try EventPriority.MONITOR?

short drift
#

What does that one do?

fair rock
#

Its a higher priority then highest

short drift
#

Oh. I did not know that.

#

Also, makes no sense.

shadow night
#

Do not use monitor if you do changes to the events result

fair rock
#

Yeah make sense but for testing its possible to check if his stuff gets called or another plugin interferes

short drift
#

There should not nothing interfering as far as I know.

#

Setting to monitor made no difference.

shadow night
#

Is the user banned using the default banlist? Idk how the default ban message looks like

shadow night
#

Because I've seen it happen that a vanilla ban will put the vanilla message there no matter what you do. Idk tho

short drift
fair rock
short drift
#

I also tried the deprecated PlayerPreLoginEvent, but that seemed to make no difference.

fair rock
#

AsyncPlayerPreLoginEvent?

#

Thats btw not deprecated

short drift
fair rock
#

Yeah would be interesting

short drift
#

Something seems to be interfering and quitting early. Let me debug that too...

#

It appears the event is not firing at all 🤔

#

But I'll make sure one more time.

#

Yes, it's definitely not outputting anything.

acoustic pendant
#
        BukkitRunnable runnable = new TaskManager(manager, e.getNewPhase());

        runnable.runTaskLater(plugin, (long) plugin.getConfig().getInt("world" + ".Phase1.timer") * 20 * 60); // in minutes```
#

Why is this crashing my server? 💀

short drift
#
    @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerLoginEvent(PlayerLoginEvent event) {
        System.out.println("PlayerLoginEvent triggered!!!");
}

I do think this should do something.

#

But it doesn't.

fair rock
#

Gimme sec, i check that myself

short drift
#

OMG. I'm such a noob today. I didn't register the listener.

fair rock
short drift
#

I had originally only command executors.

blazing ocean
short drift
#

And the listener was the last thing I added.

#

So I just forgot to register it and nothing was red.

#

Now I'm seeing everything as it should show up.

#

Thanks for helping out.

fair rock
short drift
#

Hey, by the way. What is KICK_OTHER?

#

The docs didn't say.

fair rock
charred blaze
#

why does my click event call twice on one click?

#

because of two hands or something?

short drift
#

Why doesn't this show up in my IDE 🤔

#

The player is not allowed to log in, for reasons undefined
Argh. So helpful.

fair rock
#

Banned, Kicked, Whitelist, Full and if you kick someone because of stupid stuff its KICK_OTHER idk xd

short drift
charred blaze
#

mouse release?

#

no i dont think so

fair rock
#

Which click event?

short drift
#

Like, mouse button press and mouse button release.

charred blaze
fair rock
#

Double registration? xd

charred blaze
#

whats that

fair rock
#

Cancel the event?

tawdry echo
#

You dont cancel event

rare rover
#

what's the method for the teleport interpolation for display entities

#

i keep forgetting it

#

i recently moved back to spigot so

dawn flower
#

sup

#

is there a particle like a laser beam

#

like the beacon one

flint coyote
#

I don't think you can use the beacon laser. You might be able to use guardian rays though

remote swallow
#

spawn millions of redstone dust particles

dawn flower
#

isn't a guardian ray just particles as well

#

ill use block display

fair rock
#

Isnt the beam client-side or im stupid?

flint coyote
#

The guardian one? It has packets

fair rock
#

Nah the beacon

chrome beacon
#

The beacon beam is client sided

#

You can probably use a resource pack to recreate the effect though

fair rock
#

But tbh would be cool if that effect would be possible vertical and horizontal lmao

chrome beacon
#

assuming you're on a modern version a resource pack can do that

fair rock
inner mulch
#

what do i do if i have class that i need to use everywhere in my project (package-private isn't an option), but when some1 is using the api it shouldn't be accessible as it would break stuff?

chrome beacon
#

Just have a public class that's not part of the api?

inner mulch
#

but how does the api work if the classes arent there?

unique shuttle
#

I updated to the latest version of 1.20.6 and it works perfectly. They probably fixed the bug in one of the recent builds

chrome beacon
#

Keep the api separate from the implementation

inner mulch
#

oh

charred blaze
unique shuttle
#

It wasn't working for me because of the version. I was using a jar that was 15 builds old 💀

charred blaze
#

^

unique shuttle
marsh crest
#

i think i'm not understanding Worldcreator

#

i have this folder placed here

marsh crest
#

i wanted it to load the one i put, not make a new world

#

well i guess i did do .createWorld

#

but there is no .loadWorld i don't think

fair rock
#

I try to understand:
You placed the world in worlds/minigames/tumble/default
You created a world with path: worlds/minigames/tumble/default

Right?

#

Did you set your world-container to "worlds"?
If you did, the createWorld method would use that path and put them in front like

world-container-path/your-path

that would be ./worlds/worlds/minigames/tumble/default

slender elbow
#

^ sounds like not the default world container setting

marsh crest
#

this is my worlds folder

#

i just set my level name to worlds/lobby

fair rock
#

If you dont know the setting, i dont think you changed that (its in bukkit.yml or a start parameter like --world-container)
So you didnt changed that, okay thats weird then

marsh crest
#

so how do i actually like load the world instead of it making a new one

fair rock
#

Can you try createWorld without worlds/ (Just in case you have anywhere set the world-container to /worlds)

#
getServer().createWorld(new WorldCreator("minigames/tumble/default"));
marsh crest
fair rock
marsh crest
#

nah

#

downloaded spigot 1.20.4

#

i'm tryna build everything from the ground up

fair rock
#

Im just confused why your world-container is set to /worlds as default, did that changed?

marsh crest
#

where can i check

#

i don't see it in any folders

fair rock
#

Can you look in bukkit.yml for world-container or in your start script for --world-container, --W, --universe?

#

Weird, okay

marsh crest
#

this is my start.bat

fair rock
#

Okay, im just confused, im just accepting that your world container is worlds without any reason lmao

marsh crest
#

maybe it's bc my main world is in worlds so it makes that the root?

fair rock
#

that would be interesting tbh

#

im checking that

fair rock
# marsh crest maybe it's bc my main world is in `worlds` so it makes that the root?

Yep its because of that.
I changed level-name to "worlds/world", logged the WorldContainer absolute path and its was fr ./worlds
Changed in back to "world" and the path was ./ so thats why your createWorld was like

worlds/worlds/... because of the WorldContainerPath + your extra path

Now i know you can change the world container path with server.properties xd

marsh crest
#

wow i am so good at guessing

fair rock
dawn flower
#

so uh, i have custom bosses with "minions", these "minions" are just husks with custom stuff but i recently ran into an issue where some husks spawn with a chicken. This messes up the coded BADLY since the minion animation STRONGLY depends on teleportable entities and creates exotics since you shouldn't be able to get vanilla raw chicken or feather. Is there a way to stop jockeys from spawning but not stop the mob itself from spawning?

flint coyote
#

I would expect this to only prevent the actual jockey entities to spawn

dawn flower
#

does JOCKEY fire for the chicken or the husk

flint coyote
#

I'd assume so. Just spawn a few and check the entity type via println. Then you'll see if it works

worldly ingot
#

It's the chicken

flint coyote
#

oh I missread

#

but yes

worldly ingot
#

Technically a zombie can hijack an existing chicken as well if it spawns on top of it, but if you have no chickens nearby then yeah it will spawn a new one with the JOCKEY reason

flint coyote
dawn flower
#

so i just have to kill all entities with JOCKEY spanw reason

worldly ingot
#

5x3x5

flint coyote
#

not kill, just cancel the event for them

worldly ingot
#

You said minions, so if you're extending an internal zombie entity type, you can override finalizeSpawn() and copy the majority of the logic while excluding the chicken jockey code

dawn flower
#

they're temporary minions so im just spawning a vanilla husk with custom attributes

worldly ingot
#

Okay then yeah, opt for the API then

dawn flower
#

alr

flint coyote
#

If a zombie "obducts" a chicken, can it still despawn?

#

imagine losing your chicken because a zombie took it and despawned lol

worldly ingot
#

It's still a 5% chance to actually become a jockey, even if it spawns on top of a chicken, but yeah. Regular despawn rules would apply to both entities I would imagine

flint coyote
#

I see, thanks

worldly ingot
#
if ((double) randomsource.nextFloat() < 0.05D) {
    List<EntityChicken> list = worldaccess.getEntitiesOfClass(EntityChicken.class, this.getBoundingBox().inflate(5.0D, 3.0D, 5.0D), IEntitySelector.ENTITY_NOT_BEING_RIDDEN);

    if (!list.isEmpty()) {
        EntityChicken entitychicken = (EntityChicken) list.get(0);

        entitychicken.setChickenJockey(true);
        this.startRiding(entitychicken);
    }
} else if ((double) randomsource.nextFloat() < 0.05D) {
    EntityChicken entitychicken1 = (EntityChicken) EntityTypes.CHICKEN.create(this.level());

    if (entitychicken1 != null) {
        entitychicken1.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
        entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null);
        entitychicken1.setChickenJockey(true);
        this.startRiding(entitychicken1);
        worldaccess.addFreshEntity(entitychicken1);
    }
}

#

Relevant code in the zombie spawning logic

#

Top block is hijiacking an existing chicken within a 5x3x5, bottom block is spawning a chicken if one isn't nearby

dawn flower
#

is it possible to make a slime with a double size?

worldly ingot
#

A double size. Not sure what you mean?

#

You can change the slime's size with Slime#setSize()

flint coyote
#

Size as a double instead of int

worldly ingot
#

Oh, I see. No. Sizes of slimes aren't their scale. Think of it more as a "level". If you have a size 3 slime, kill it once and you'll get a handful of size 2 slimes. Kill those and you'll get a bunch of size 1 slimes, until finally you kill the size 1 slimes and they die without splitting

#

You can use the scale attribute that was added in 1.20.5 now though, which I believe is a double and should work for slimes? I can't remember if maybe slimes were an exception

#

It's still going to respect the "size" value of the slime though in that size 1 slimes will die, > size 1 slimes will split

flint coyote
#

super small slimes sure would look funny

young knoll
#

the attribute is a double

#

I haven’t tried it on slimes tho

dawn flower
#

doesn't look like it

dawn flower
#

what's the difference between setPower and setVelocity in Fireball.class

drowsy helm
#

setPower isnt a method of Fireball

dawn flower
#

1.20.1

drowsy helm
dawn flower
#

it isn't in paper docs as well?

drowsy helm
#

but if I had to guess, power is explosive power

dawn flower
#

it takes a vector so im confused

drowsy helm
#

it's in the paper docs, not spigot

#

Note: For fireball entities, their movement is also controlled by their power.

Specified by:
setVelocity in interface Entity
Parameters:
velocity - New velocity to travel with```
dawn flower
#

paper docs

#

mind sending the link to that docs

drowsy helm
dawn flower
#

alr thanks

winter scarab
#

I'm using protocol lib to spawn a packet entity from the server to the client and im wondering if i can teleport the entity by calling the packetcontainer for the entityspawn under the entity teleport packet

#

or if thats not right, how would i do it

unique shuttle
#

Does anyone know how I can put armor on wolves in code? In version 1.20.6

carmine mica
#

should be able to set the body equipment slot

unique shuttle
carmine mica
#

should just be on the EntityEquipment you can get from any LivingEntity

marsh crest
#

is there a way to delete the saving of the chunks

#

i don't want it to save

rough ibex
#

Is this for your own plugin?

marsh crest
#

my own server yea

#

i wanna try writing as much of my own stuff

rough ibex
#

It doesn't seem possible

marsh crest
#

is there no setting to disable it?

rough ibex
#

you could try some hacky workarounds

#

do you see a config setting for it

marsh crest
#

i already did this

#

but this is autosaves during the server's runtime

rough ibex
#

that's autosave

#

yes

marsh crest
#

i don't want it to save on exit, not sure about how to do that

#

my idea was to like

#

instead of load the world

#

make a copy of the world and load that?

#

so nothing tampers with the original world

rough ibex
#

you can make the world read-only.

#

r--r-----

#

that would be chmod 110 I think

marsh crest
#

?

rough ibex
#

no sorry 440

#

chmod permissions

marsh crest
#

i don't know what any of that is sorry

rough ibex
#

Oh, you're on windows

#

properties

#

no idea how windows wants to do it

#

on linux (the one true way) you just do chmod 440 file

river oracle
#

Wouldn't that cause stack traces in console when io threads go to save

#

Personally especially if you're doing mini games I'd reccomend just unzipping a zip file from a Mongo bucket or something

#

Or spin up servers dedicated to a map if you have enough instances

drowsy helm
#

correct

#

the server puts a lock on the world aswell, if it can't do that it'll throw aswell

marsh crest
rough ibex
#

as I said, hacky workarounds

#

although i feel this is an XY problem

#

you likely just want copies of your world

grave kayak
#

I'm making a fishing plugin and im trying to have the fish spawn in much like how they do in vanilla minecraft coming out of the water and landing at the player. I can't seem to get it working how i'd like it to. any ideas appreciated! https://paste.md-5.net/ekeyuriboy.cs

eager turtle
#

I have a question. Let’s say I have a special item called Zeus’s trident. I add a persistent data container to the trident, storing the name “zues trident” so I can get it later. On projectile launch event, how can I get that the trident is Zeus‘s trident or not? Obviously, I can filter by entity type trident, but there is no event.getitem() for this event, only event.getentity(). Would the same persistent container, still be on item even tho its an entity? Or would I have to use event.getplayer().getiteminmainhand()? The main hand method works, but I am concerned that it might result in null sometimes if the trident has already left the inventory.

#

Or is there a way to covert the trident entity back to an item to get access to the PDC?

chrome beacon
eager turtle
#

yeah theres no getItem for it, unless you can cast the entity to a diff type that lets you

chrome beacon
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

chrome beacon
#

(check that it's actually a trident first...)

eager turtle
#

(not related to above) I also keep getting warning issue everytime I compile my 1.20.6 plugin

chrome beacon
#

hm? It does tell you what's wrong

#

You didn't specify which version of the maven compiler plugin to use

eager turtle
#

yeah ive tried adding it to the properties tag of my pom.xml but it still complains after

#

its not in this photo

chrome beacon
#

yeah

#

also you can compile against Java 21 if you want

#

You don't have to set the java version to 8 and miss out on the new features

eager turtle
#

<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>

#

i keep putting this but maybe i have to use 21

#

im using SDK 21 anyways

chrome beacon
#

I was refering to the java.version property

eager turtle
#

ah okay

#

1.21?

chrome beacon
#

21

eager turtle
#

kk

chrome beacon
#
  1. prefix was dropped
eager turtle
#

ohhhh

#

i was so confused about that

chrome beacon
#

I believe that was in Java 9

eager turtle
#

it kept telling me i was using 8 and im like bruh it says 1.8

#

what about this?

#

<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>

#

21s for both or target a lower?

chrome beacon
#

21 for both

eager turtle
#

yeah i did and reloaded my pom but still getting the same warning

chrome beacon
#

or <maven.compiler.release>21</maven.compiler.release> as a property and remove the compiler plugin entierly from the pom

chrome beacon
#

The error isn't complaining about Java version it's complaining about plugin version

eager turtle
#

i just noticed this sneaky plugin

#

maybe its complaining about this one lmao

chrome beacon
#

yeah that's it

#

why is it all on one line though

eager turtle
#

no idea wtf

chrome beacon
#

ctrl + alt + l

#

should be the reformat keybind for intellij

eager turtle
#

tyty

#

so either set the source and target to 21 for that or add <maven.compiler.release>21</maven.compiler.release> to my properties aswell?

chrome beacon
#

yes

eager turtle
#

well i think it also wants a version tag for the plugin

chrome beacon
#

yeah that's the warning you've been getting

eager turtle
#

well whats the version how can i know what to put there lol

chrome beacon
#

3.13.0

#

is the latest version

eager turtle
#

oh very nice thanks for that ill bookmark it

#

why do i even need this plugin tag though what is it doing?

chrome beacon
#

It's configuring the compiler

eager turtle
#

like you said i could put that snippet in properties instead

chrome beacon
#

Telling what to compile for

eager turtle
#

but this isnt specifying a version number: <maven.compiler.release>21</maven.compiler.release>

#

so why does this one haha

chrome beacon
#

?

eager turtle
#

sorry im not trying to be annoying just want to know so i know have to keep asking in the future

chrome beacon
#

ah I read your message wrong

eager turtle
#

i think you said earlier i could put that in the properties tag and remove the plugin one entirely

chrome beacon
#

yes

eager turtle
#

im just wondering how that could replace the plugin tag if it isnt specifying a version

#

like why does the plugin tag version of it need the version but this doesnt

#

if you dont know its fine im being a little ocd

chrome beacon
#

Putting it in properties will just use the bundled version I believe

eager turtle
#

welp i think ill go with that so i dont have to keep updating the version number!

chrome beacon
#

specifying it in the plugins section allows you to tell it exactly what to use

eager turtle
#

that makes sense

chrome beacon
#

which can be useful if your maven install is outdated

eager turtle
#

heck yeah it compiled no error

#

this good?

chrome beacon
#

You can skip source and target

#

release is the modern replacement

#

also you can use a variable so you don't have to update java version in 2 places;

<maven.compiler.release>${java.version}</maven.compiler.release>
eager turtle
#

its compiling alot faster now too

#

but thanks I appreciate the help

#

heres my full pom.xml if you wana take a peek maybe im doing something else silly

chrome beacon
#

You can define a property for spigot.version and then replace all cases of 1.20.6-R0.1-SNAPSHOT with a variable

#

makes it easier to change in the future

eager turtle
#

thats a good idea

#

do you have any links for keeping this version number correct also? i had the wrong number for it someone else had to help me

chrome beacon
#

also you can use variable from your pom in the plugin.yml or any other file in your resources folder

eager turtle
#

oh that would make it easier

eager turtle
#

bruh

#

absolute legend

chrome beacon
#

That site helps with searching for maven dependencies

#

You can for example also find the compiler plugin

#

Note this only works with maven dependencies in the central maven repository (the default one)

#

and not self hosted repositories like the spigot repo

eager turtle
#

thats awesome i appreciate you sharing that i had so much trouble updating from 1.20.4 to 1.20.6

#

and getting nms to work

#

but now we in full swing

chrome beacon
#

though I wouldn't rely on it for that

eager turtle
#

yeah ill mainly just need the special source one

#

or might just switch back to the api version cause its reducing the need for nms

#

at least in my case

#

finally adding a way to do holograms efficiently without nms

chrome beacon
#

Display entities are quite useful

eager turtle
#

havent tried them yet!

chrome beacon
#

more specifically the text display

eager turtle
#

yeah i read you can make them larger and stuff, set them to hidden from everyone by default

#

no more triple armor stands

#

nifty forsure

chrome beacon
#

yeah

spice burrow
#

anyone have a better method of getting all blocks within the radius of a player?

    Collection<Block> blocksInRadius = new HashSet<>();
    
    int locX = location.getBlockX();
    int locY = location.getBlockY();
    int locZ = location.getBlockZ();

    for(int x = locX - radius; x <= locX + radius; x++) {
        for(int y = locY - radius; y <= locY + radius; y++) {
            for(int z = locZ - radius; z <= locZ + radius; z++) {
                blocksInRadius.add(location.getWorld().getBlockAt(x,y,z));
            }
        }
    }
eager turtle
#

also curious about this as ive been trying to create my own explosion without using the createExplosion method

#

cause for some reason you cant set the damage to be 0 for it

eternal oxide
glad prawn
#

he said without using the createExplosion method

eternal oxide
#

Which you can, so invalidates the reasoning

eager turtle
#

well you can set power to be 0, but then it wont destroy any blocks

eternal oxide
#

you either want damage or you don;t

chrome beacon
#

You can just cancel the damage event

#

if you don't want players to take damage

eternal oxide
#

or clear teh blockList in the event

#

depends which you want

#

broken blocks or players hurt

eager turtle
#

theres no event specific to this type of explosion i dont think

eternal oxide
#

EntityExplodeEvent

eager turtle
#

EntityExplodeEvent

#

yes ive been trying that

chrome beacon
#

no but you can get the source of the damage

eager turtle
#

should work but then it would cancel all explosion damage

eternal oxide
#

What exactly are you trying to do? Blow up blocks but not damage players?

eager turtle
#

yep

#

setting the damage manually

#

i just need something to explode blocks, and also set off other TNT and stuff in the area

eternal oxide
#

you can;t have it both ways (automatically). Cancel damage on EntityDamageByEntityEvent

#

if the damaged is a Player, cancel

eager turtle
#

well i dont think it would call that event since its not by entity

eternal oxide
#

yes it is

#

Explosions are entities

eager turtle
#

does createExplosion have a way to attach an entity to it ill have to check

eternal oxide
#

yes

eager turtle
#

it does

eternal oxide
eager turtle
#

okay now were cooking here

#

ill just throw in my causing entity there and in the listener check if its the causing entity and cancel

eternal oxide
#

yep

eager turtle
#

canceling it in EntityDamageByEntityEvent would cancel the EntityDamageEvent right?

#

i think they are inherited

spice burrow
#

anyone know the packet name for picking up an item?

eternal oxide
#

there is an event in the API for it

spice burrow
#

haven't been able to find it anywhere, i thought it would be ClientboundTakeItemEntityPacket but it's asking for an item id as an integer

spice burrow
eternal oxide
#

why not spawnNaturally teh item you want to drop?

eager turtle
# eternal oxide yep

i dont understand, i cancel EntityExplodeEvent when its my entity i pass in but it still sends the EntityDamageByEntity event

eternal oxide
#

dropItemNaturally

eager turtle
#

it cancels the explosion part, but not damage

spice burrow
#

is there a way to manipulate the distance of grabbing said item? I'm basically adding an item to the players inventory when they break a block, cancelling the block break event and setting it to stone. only the player that breaks the block should be able to grab the item and it should be given no matter the distance from the block

#

some of the enchants that i have break blocks from a distance

eternal oxide
#

Only the owner can pick up that Item

spice burrow
#

yeah im using that for some stuff to deal with spawn but for this the player shouldnt be required to go back to the block broken to get the item

eternal oxide
#

then just add it to their inventory

spice burrow
#

im still trying to simulate picking it up though. im already adding it to their inventory

eternal oxide
#

anythign which doesn;t fit will be returned in a Map, you can then drop on the floor

#

For what reason do you want to fake a pickup?

#

What are you hoping to achieve?

spice burrow
#

im trying to get the itempickup animation from the block coordinate to the players location

eternal oxide
#

I don;t see that happening unless you also fake an entity drop at the location

#

the client animation would just be a setPos on the dropped entity

#

the client will extrapolate the movement

spice burrow
#

ill try it, ive been on a few servers that do it so i know its possible

eternal oxide
#

So spawn a fake Item for that player, setPos so it moves to the Player, then destroy it

#

however

#

you can do all that with the API, no packets needed

spice burrow
#

Interesting I thought I'd need to manipulate the packets

eternal oxide
#

DropItemNaturally... set its owner so it can;t be picked up by anyone else. Then teleport it to the player

echo basalt
#

The pickup animation is a single packet

eternal oxide
#

the player will then automatically pick it up

echo basalt
#

No need for fancy vectors and shit

spice burrow
#

alright ill give it a go

eternal oxide
#

The teleport will cause teh client to extrapolate teh movment. Unless you are miles away

spice burrow
#

yea it only needs to be possible for ~10-15 blocks

eternal oxide
#

8 blocks is ok, over that I'm not sure, try it and see