#help-development
1 messages · Page 1235 of 1
you can't
items in 1.21.4 do not have NBT anymore
outside of the custom_data component
So I just need to transfer the components instead of the nbt?
So basically I'm trying to sync inventories but I found a problem if the server version are different, on 1.20.x I serialized the item to base64 then deserialize it, it will work when I switch from older version to newer version, but not the other way around because downgrading item is not possible, because of that I decide to make my own serializer.
Alright.
like, if you are just doing NBT instead of Base64, that won't fix it
Like storing necessary data, like item meta stuff (display name, lore, and pdc), and the nbt too.
I would just check out the nms ItemStack.copy() method
Sorry I meant like basically storing the nbt and then applying that nbt to the new item.
That will not work when downgrading
But it works, was testing it on 1.20.4 and 1.20.1 server
something something transmute
it will absolutely not work when going from 1.21.4 to e.g. 1.20.4
Absolutely, that's my solution for 1.20.x version and currently trying to find a workaround for 1.21.x version.
ItemStack::transmuteCopy
I think your entire approach is just flawed
applies the components of the item it's called on onto the item its passed
1.20.4 to 1.20.5 will also e.g. not work
the only remotely sane approach here would be to write, what is basically a "reverse data fixer upper" implementation
what is he even trying to do
Here for context ^^^
I'm trying to sync inventories but I found a problem if the server version are different, on 1.20.x I serialized the item to base64 then deserialize it, it will work when I switch from older version to newer version, but not the other way around because downgrading item is not possible, because of that I decide to make my own serializer.
but not the other way around because downgrading item is not possible
yeah that's uh
well
you can look into whatever viaversion/viabackwards does
which is like driving the dfu in reverse somehow
beyond that, you're basically shit out of luck
if you only need lore/name/enchants + "nbt" as in the persistent data container, you can do the (de)serialization manually
damn, this is a tough one
why are the servers on different versions?
need to transfer data from other plugin like mmoitems for example
unless they are stupid they will have that in the persistent data container
they don't have it on pdc, still using some legacy nbt stuff
skill issue
basically i'm using ASWM, they don't have every version build, but honestly I would use the base64 in the end because i'm currently doing a server reset and will have both of the servers on the same version
that stuff is now on the CUSTOM_DATA component iirc, which holds a nbt compound
unfortunately from what i remember they don't have a convenient or even usable api to arbitrarily translate things back and forth
i had this magnificent idea at one point to write a very simple wire packets based plugin and then offload version compatibility to via
i would just write like 1.20 packets and via would update them to whatever the current version is, so it'd be maintenance free
but from what i remember trying to get it to work was like having sex with a cheesegrater
anyways, thanks for the help guys. from now on i'll make sure to use same version
@EventHandler
public void onPlayerInteractWithArmorStand(PlayerInteractEntityEvent event) {
System.out.println(1);
Player player = event.getPlayer();
Entity entity = event.getRightClicked();
String serverName = player.getServer().getMotd();
System.out.println("Server: " + serverName);
if (!serverName.toLowerCase().startsWith("lobby")) {return;}
System.out.println("Entity:" + entity.getClass().getName());
if (!(entity instanceof ArmorStand)) {return;}
event.setCancelled(true);
}
``` I would like to disable interactions with Armorstand but the event is not called... Why?
an Event not firing means you either didn;t register it or you are watching the wrong event
consider getting worldguard
Gonna try.
It works, thanks!
I noticed that the CrafterCraftEvent does not have a method to obtain any remaining item from a craft. Like the empty buckets from a cake (which the Crafter ejects too btw).
Is this intentional? Technical limitation? Just an oversight? If intentional, what's the intended way of detecting any remaining items from a Crafter craft?
i'm not sure where that might be available on spigot, in nms it's Item::getCraftingRemainder, paper exposes it through the experimental ItemType class
Bungee Class: https://hastebin.com/share/yofitehojo.java
LobbyCommand: https://hastebin.com/share/cocadufeyo.java
I would like that when I do /lobby it connects me to the first lobby server that has less than 20 players which is the maximum number of players on these servers, except that it connects me to all the servers that have less than 20 players, I have two lobby servers for testing and it connects me to the first, then to the second, except that I would like it to connect me only to the first one that finds, and not to the following ones, because if I have 50 servers it will connect to 50... and besides sometimes it refuses the connection, it times me out.
Break out of the for loop if the count is less thn 20 in sendPlayerToAvailableLobby
But how I know back that's the count is less than 20?
ah I see
I mean, I ask the info but get the result in another class, and now how I get back to my command class the result.
Yeah.
because you are requesting ALL server counts you keep triggering the onPluginMessageReceived even after you found a free server
So what can I do to stop requests when the player can be tped?
do a single request and process it on bungee
you can query player counts on bungee
Uh how?
or
delete all your bungee listener and process it when the response is returned to Spigot
teh Player count is a built in bungee response
basically you can;t fire/forget your player count
well you could query ALL servers
that way you are not sending multiple queries
That won't work. Tested it already on Paper and there f.e. CAKE returns null for the getCraftingRemainder
Well, it doesn't.
Event only has getResult() which returns a single ItemStack.
Looking further, getCraftingRemainingItem() exists, but that only returns for the ingerdient...
And CraftingRecipe has no method for obtaining the individual Item Ingredients by the looks of it.
So at most could I probs get the Crafter Block and go through its slots, checking if any item returns a remaining item.... fun
Sounds like you might wanna open a feature request 
hey,
i am currently trying to make a ability wich spawns multiple lines in front of the player like this example -> https://imgur.com/a/HXgb1kK not sure if i am allowed to paste those links but i think imgur.com should be safe
it should spawn always in the direction of the player and at the height of the crosshair but i cannot figure a way out how to make this properly
not very good at vector and location stuff but i tried it over the past days and i couldn't get it to work so here i am
thanks for any help its much appreciated
Get the location of the player. To this add the direction of the player, which you multiply with your wanted distance
That's your start point. Then have a simple for loop that adds a constant value to both x and z values, and draw a particle
For constant height, set the y of the direction vector 0 (or something) and call #normalize() afterwards. Do that before multplying the vector
EyeLocation if he wants it aligned to teh head
Guys i want to load a lot of heads into an inventory, like this, but the server lags when opening the menu, for obvious reasons, is there any way to optimize it? I can't think of anything
don't block the main thread for profile lookups
i feel like it might still be doing them
so i need to do this?
make sure to check length before normalize or you might end up with a nan vector if the player looks directly up/down
alternatively getYaw and use that
You could cache the texture
when player joins?
im currently using it like this
what grinds my gears are head database plugins that keep the cache in memory
YES PLEASE i want 15,000 head textures on my heap at all times
Bukkit#createProfile shouldn't be doing completions
loading offline player data can cause hiccups
what does that mean?
oh so thats the problem?
you could put the result of this into a map and clear it once the player leaves
i don't think getOfflinePlayer loads anything
any ideas how I can do this in an optimized way?
that you really don't need that being async
iirc it's when you call on properties of the offlineplayer, like name, that loading happens from the usercache or wherever
but u said "don't block the main thread for profile lookups" or what did you mean?
the texture/profile lookups
createprofile just creates a blank profile with uuid and possible name
its properties like name and skin then possibly need to be looked up from mojang/disk
also #setPlayerProfile is paper API so yeah
yea using paper
?whereami
why is it by the way that so many paper people ask their questions here
did they shut down their help channel?
so why would you ask here when you're literally using a completely paper-only API
No, but my problem is not really about paper.It's about Minecraft heads, I don't think I should go ask specifically there, I asked here because I found it convenient
okay by the way, thank you
hi kat
Hi rad
yeah spigot is super passive aggressive because of its shrinking (single-digit) market share so if they smell paper on your person they tell you to go ask them
what confuses me is why paper people even come here in the first place
@eternal night explain
it's lynx' fault
If only the Jira board wasn't hot garbage
That one aged badly...
(It's now the PaperMC discord)
HELP NO
not really, it's mainly because the two are very different behind the scenes, and something that happens on one may not on the other and vice versa, the ability of either party to be able to help you with issues found on the other's software is narrow at best :P
it's like asking help on the fabric discord server for quilt, they are similar, some overlap is there, but you're better off asking in the specific discord.
Yeah I saw that
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
Entity clickedEntity = event.getRightClicked();
ItemStack itemInHand = player.getInventory().getItemInMainHand();
if (clickedEntity instanceof Player && itemInHand != null && itemInHand.hasItemMeta()) {
NamespacedKey key_glace_freeze = new NamespacedKey(this.plugin, "modt-glace_freeze");
NamespacedKey key_playerhead_whois = new NamespacedKey(this.plugin, "modt-playerhead_whois");
if (itemInHand.getType() == Material.ICE && itemInHand.getItemMeta().getPersistentDataContainer().has(key_glace_freeze, PersistentDataType.DOUBLE)) {
Player targetPlayer = (Player) clickedEntity;
if (targetPlayer.hasPotionEffect(PotionEffectType.SLOWNESS) && targetPlayer.getGameMode() == GameMode.ADVENTURE) {
player.performCommand("unfreeze " + targetPlayer.getName());
} else {
player.performCommand("freeze " + targetPlayer.getName());
}
} else if (itemInHand.getType() == Material.PLAYER_HEAD && itemInHand.getItemMeta().getPersistentDataContainer().has(key_playerhead_whois, PersistentDataType.DOUBLE)) {
Player targetPlayer = (Player) clickedEntity;
player.performCommand("whois " + targetPlayer.getName());
}
}
}
Why is it doing the action in double?
@EventHandler
public void onPlayerRightClick(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
ItemStack itemInHand = player.getInventory().getItemInMainHand();
if (itemInHand.getType() == Material.IRON_HOE && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)) {
NamespacedKey key_hoe_vanish = new NamespacedKey(this.plugin, "modt-hoe_vanish");
if (itemInHand.hasItemMeta() && itemInHand.getItemMeta().getPersistentDataContainer().has(key_hoe_vanish, PersistentDataType.DOUBLE)) {
player.performCommand("vanish");
event.setCancelled(true);
}
}
}
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
Alternatively, and preferably, make use of PlayerInteractEvent#getItem() or #getMaterial() and compare against that so you could support off hand clicking of the item too
While the hand check is useful, it also unnecessarily blocks functionality from the off hand, which might actually be useful
that bot message really needs a facelift
it's protected territory
I personally keep my package private
in private?
deff public 
How does spigot handle circular dependency?
like in which order are the dependencies loaded if two different plugins want different orders
Why was the event.getSpawnReason() in CreatureSpawnEvent for fish out of buckets changed to SpawnReason.DEFAULT? Is this purposeful or a glitch in the current version?
IMO this is bad, because now the plugin can't distinguish the difference between a natural spawning mob at night and a player action. I don't think they should all be grouped together as SpawnReason.DEFAULT.
it just throws an exception
Does it sound intentional to you? What was it before
none of the reasons look obviously related to buckets to me, so I would love to know what it used to be. Also NATURAL and DEFAULT are two different reasons
You know how when you type a command and it says in red your messing up? Is that possible in a plugin like with onTabComplete?
I can't remember what it was before as i have a few reasons in my plugin to allow it which included fish from buckets. I just noticed it wasn't currently working leading me to discover it currently being reason DEFAULT. GPT claims that it used to be SPAWNER_EGG.
In the currently version, when a mob spawns "in the wild" because "it's dark outside" the event is giving the reason DEFAULT. Just FYI incase it's desired to be something different.
Not sure I'd believe chat gpt
Me either, just providing all i know.
But logically, i guess a fish bucket in concept is like a spawn egg from the creative menu.
I'd be interested in knowing what it actually was, if you can show what it actually was and it's different then it's very easy to change (same with the natural spawning)
md5 
There is no current SpawnReason. that i can see which would fit fish from bucket. If i had to pick one that was the closest i would go with SPAWNER_EGG. And i agree that vanilla mob spawning in the wild because its dark should be NATURAL instead of the current DEFAULT. I can't show you what it used to be, as i have in my plugin the allowed methods of EGG, SPAWNER, and SPAWNER_EGG and can't remember which one of those was for fish in a bucket.
could test an old version
I don't know when it changed, might have to go really old. I just noticed today my fish weren't being spawned from a bucket so debugged the spawn reason.
even in 1.12
there was no such thing
nvm i might be wrong sorry
code on its face does look like it uses SpawnReason.NATURAL for spawning at night
Okay, i made a mistake, testing again i see that mobs in the wild are showing SpawnReason.NATURAL.
I remember in 1.12.2 ocelot spawn egg sometimes spawn small ocelot from reason OCELOT_BABY
so default means by a standard game mechanic other than natural?
whats it say when you bread 2 animals?
err breed
SpawnReason.BREEDING
Can you check an old version?
I dont have an old version, i just run buildtools all the time. Is there somewhere to download old jars? Or do i set something in buildtools to make it do an old version? And what version should i try? And what about client? How far back will MS let you roll back your client version to connect to an old server version?
Forever
--rev (version)
Maybe try 1.19 or something to start? Whenever you think it was different
wait lemme try
im gonna try 1.16
Here it is spawner egg in 1.16
@long ocean
Thanks
broo i had to download jdk 16 to compile 
Thank you for your sacrifice!
How do I get the dispensers inventory?
?ask
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!
You are in the #help-development channel, please ask
from blockstate?
I see, its a plugin. #help-server you go
I at the phase to getting the items the miners mine. Currently it just breaks the block and sends it to the void. But I need to put the items in its inventory like its suppose to. I just need help getting the inventory, I can deal with the rest
declaration: package: org.bukkit.block, interface: Container
Its not working.
Inventory inv = ((Container) this.block.getBlockData()).getInventory();
inv.addItem(new ItemStack(Material.STONE,1));
try (Dispenser) instead of (Container)
Inventory is part of the block state
in = block.getState().getInventory()
Do note that it (get state) returns a copy
And therefor needs to be manually updated
EDIT: turns out getInventory doesn't require this if the state belongs to a valid block. It's only required for getSnapshotInventory
I was about to upload the video then I seen @lime pulsar with a possible fix. Testing now
Wait, that is not working either. What in the f***?!
show the line as you have it now?
Did you do what I told you to
This is the lineInventory inv = ((Container) block.getState()).getInventory();
Inventory inv = this.block.getState().getInventory();
That won't work
what class is block?
Its just the block in the world as shownthis.block.getRelative(0, -2, 0).getRelative(0, -(this.mineTrailPlaced-1), 0).equals(Material.BEDROCK)So if its suppose to work like you saying, there is no reason that the IDE should be throwing errors but it is
.getType() == Material.BEDROCK
== is fine for enums
That is not my issue, its just getting the inventory of this dispenser
They gave you examples
This should work
how is block defined? is it Dispenser block or Block block?
Block block
Alternatively you may cast it to InventoryHolder
if(block.getType() == Material.DISPENSER) Dispenser dispenser = (Dispencer) block.getState();
if (block.getState() instanceof Dispenser dispenser) {
// do your things in here...
}
instead of that ^
oh right the snapshots yea
Yeah
check out this nightnmare:
` static Chest getChest(Sign sign) {
Block signBlock = sign.getBlock();
if (signBlock.getBlockData() instanceof WallSign) {
WallSign signData = (WallSign) signBlock.getState().getBlockData();
Block attachedTo = signBlock.getRelative(signData.getFacing().getOppositeFace());
if (attachedTo != null && attachedTo.getType().equals(Material.CHEST)) {
Chest chest = (Chest) attachedTo.getState();
return chest;
}
}
return null;
}
`
But it is a dispenser already, there is no need for the check. The reason I say this because that block. Before I place a miner (Dispenser), it checks if its the miner (Dispenser). So that said, there is no reason for it to malfunction. Also, there is zero errors on the console
...
I did already tell you what the issue is
But I seem to be ignored
So someone else can repeat it later I suppose
trying to help them is just useless since they ignore any kind of input
wow my discord really crashed after saying that
if its a dispenser from the get go why is it stored as a block?
I not ignoring you, its just something that is not needed. If I have a chest or a block either than the dispenser, I can see why the check needs to be there
Location
I'm not sure what you're refering to here
blindly casting is a bad habit
.
You may be right but I still mean what I said
Dispenser dblock = (Dispenser) this.block.getState(); dblock.getInventory();
Its still not working
The inventory is not null because I see no errors
This is what its doing
This is the code where the block destroy occurs``` if( block.getType().isSolid() && !block.getType().equals(Material.BEDROCK) ) {
inv.addItem(new ItemStack(Material.STONE,1));
block.getWorld().playEffect(block.getLocation().add(0.5, 0.5, 0.5),Effect.STEP_SOUND, block.getType());
block.getWorld().spawnParticle(Particle.FLAME,block.getLocation().add(0.5, 0.5, 0.5), 10, 0.2, 0.2, 0.2, 0.1);
block.setType(Material.AIR);
}```
inv.update()
Is that what is happening?
like Olivo said
Could you show where you're getting the inventory
Preferably the entire method
?paste
I posted 2 methods. One for the mine and other for the get inventory.
That is not a valid method, just so you know
^^
I was talking about the getState being a copy operation
It snapshots the state
What does this mean?
It means that the changes to the block state won't apply until you call update on it
since it's a copy
Anyways I'm not a fan of how you're keeping a reference to the Block instance
You're probably better of holding the Location
and then getting the block if you need it
has been fixed now, thanks @jagged thicket
thx bro!!
I use the block for miner detection
hm?
That could still be done with the Location
You can get the block at the location if you want to check it
If you saying I have to change how I program, you going to be blocked. I did what you asked when it comes to the dispenser check. You got my methods
There's no need to be offended
It's just not typical to use the block reference directly. If you store the location and get the block from that location upon needing information it will always be the newest info (atleast from what I understood)
Yeah
If you don't you can keep an old outdated reference to it
Also if you don't clean up you can leak much more memory by mistake
me when I actually have to change my code when receiving help
what if someone uses something liek worldedit to remove the dispenser?
then your still chugging away with your saved block and ...
Interestingly enough CraftBlock does appear to just be a (nms) world + Block pos wrapper, so might not matter that much 🤷♂️
I tend to use records when dealing with blocks so the block is always coming from an event or a location
Hey guys! I am developing a plugin and I need to get materials from the player inventory.
This plugin should work on 1.8 to 1.21
My problem: If I dont set api version, it uses legacy materials. If I set api-version to 1.21, it doesnt work on 1.13, If i set api-version to 1.13, bundle stripped logs are took as normal logs.
How can I have 1.21 api-version behaviour while supporting 1.13?
I just want plain materials as they are
Are you 100% sure? The problem is I am comparing 1.21 packets with the inventories, and if i set api-version to 1.13 the packets material's differ from the spigot's
if you want to support 1.8, you need pre flattening material BS
No 1.8 is just fine
The problem is 1.21 and 1.18
1.8 is fine if you set the API version
Yeah the problem basically is the packet sent by player has a stripped log and if i set api version to 1.13 that stripped log in the spigot inventory is shown as normal log
1.8 would not be fine if you set the api version to 1.21 and compile against 1.21 spigot
No thats fine, the problem is another one
When comparing packet's material to server materials, if the api version is 1.13, the spigot's inventory materials differ
If the api version is 1.21 it works fine, but it doesnt run on 1.18
so you have a plugin with api-version: 1.21
You run it on a server with spigot 1.18
And your difference is what?
No bro
api-version 1.21 doesnt run in 1.18
api version 1.13 runs in 1.18 but stripped log is converted to normal log (this causes issues)
mhm
Is there a way to bypass conversion?
My other plan is to change api-version based on the server version... not sure if its possible
I think not
only with a jar in jar approach
no the plugin does not have any say in the bytecode rewriting
could look into something like xmaterials
Wont doing Material.get(modernMaterial.name()) fix the issue?
Material#valueOf iirc is rewritten too?
Tho only for pre 1.13 plugins
I have to test
but i think not thx
are you sure there is no way to completely disable this api version behaviour?
i dont use materials at all, i just compare ones sent and received by clients
so they are fine, and do not need any touching
but spigot touches them for some reason
I am honestly surprised it even explodes then when you specifc 1.13 as an API version
It doesnt explode, it changes the materials
stripped log is changed to normal log
Well yea, thats what I meant with explosion 
ah okay
yeah I am basically making an antiexploit feature that compares materials sent by clients and the ones actually in the server
so you cannot just send any item
but the ones whitelisted
problem is when api-version is specificed to 1.13, they get converted and differ, causing a client kick
so bots like ServerOverflow can't place bedrock everywhere?
I think this was the culprit...
Using toString instead of name... gets the non-converted value, and using name to compare, gives a converted value
I will use toString always

1.13 is when they stopped using numeric IDs and started using names
you had to add --forceUpgrade to your startup flags so you could use an existing world
Hi guys, im trying to make an rpg game (Economy oriented) so I need to create a mining system.
The way I would like it is like on Hypixel Skyblock.
The animation should match the current phase and it should be compatible with a Mining Speed stat (a double) from my PlayerManager
If anyone could help me I would highly appreciate it.
Im on 1.18.2 so I dont think that attribute is an option for me
My only question is how
Give mining fatigue to stop the clientside block break animation
and then send the packet for it yourself
Just simply mining fatigue 1 will work?
I forget what you need to set it to
Might have been a negative value
Mining fatigue 255 should work
Ahh, alright and how should I get into packets? (Possibbly trying to be using as least unnecesarry libraries as possible)
?nms
I do recommend PacketEvents or ProtocolLib
packetevents >>>
Ohh hack, thanks guys
public final class Packets {
private Packets() {}
public static void send(Player player, Packet<ClientboundPacketListener> packet) {
var vanillaPlayer = ((CraftPlayer) player).getHandle();
vanillaPlayer.connection.send(packet);
}
}
Yeah negative mining fatigue is the way
The only problem with the attribute is ideally you set it before they start breaking the block
Which means constant ray tracing to see what they are looking at :/
Meh, I dont even know what to do, how to even start it...
Start by giving the mining fatigue to the player
Then detect that the player is trying to break a block
I don't think 1.18 has the BlockDamageEvent
There’s a BlockDamageEvent for the start breaking
It has
so might need packets for that
Idk if BlockDamageAbortEvent is in 1.18 tho for stop breaking
It is
Well there ya go
And what is the packet for the animation?
Is Player#sendEffectChange in 1.18?
Player#sendBlockDamage iirc
If you have all of those methods you won’t need any packets
SendEffectChange for client side mining fatigue
SendBlockDamage for damage
BlockDamageEvent for start breaking
BlockDamageAbortEvent for stop breaking
I probably would need them at one point, so now that I somehow set it up with no problems imma leave it
Tysm
Thanks imma try these
hm sendEffectChange seems to be missing
Also does the effect need to be on client only?
It makes it easier to calculate the progress on the server
Since you can use getBreakSpeed
But otherwise no
No need, but I want the way that is easier lol
I have these methods in the player
And yea effect change is just missing
You might not have the one that allows you to specify the entity id for the damager tho
And which file should I use? remapped or remappd-obf
Then why are they there?
They're used during the build step
Some of the tooling uses the jar during the remapping process
But the main jar gets out first so it couldnt use it so im confused
Noh Im using Spigot
can anyone help me with line 9 and 18 im getting errors ```
on death of player:
if victim's held item is a totem of undying:
set the cooldown of totem of undying for victim to 10 seconds
if {totemCooldown::%victim%} is not set:
cancel event
set victim's health to victim's maximum health
send "&aYou have been revived by the power of the totem!" to victim
play sound "entity.totem.use" to victim
play 10 of particle "redstone" at location of victim offset 0.4, 0.4, 0.4 with speed 0.05
set {totemCooldown::%victim%} to now
else if difference between now and {totemCooldown::%victim%} is less than 30 seconds:
send "&cThe totem's power needs to recharge! Try again in &e%difference between 30 seconds and (difference between now and {totemCooldown::%victim%})% seconds &c." to victim
else:
cancel event
set victim's health to victim's maximum health
send "&aYou have been revived by the power of the totem!" to victim
play sound "entity.totem.use" to victim
spawn 20 of particle flame for player at player offset by 0.4, 0.4, 0.4 with speed 0.05
set {totemCooldown::%victim%} to now
this channel is for plugin development
play 10 of particle shouldnt that be spawn?
and flame is missing "
flame for player at player. "flame" at player
what scripting language is this?
Olivo! teach me how. to use Maven, im still using ant builder :p
ant 💀


I also use eclipse
I haven't used Eclipse in like 7 years
As for maven it's quite simple to use and there are plenty of guides online
Feel free to ask if you get stuck on something
k
How to make an apple have the texture of a head without resource pack or make a head edible
use the new food component iirc
afaik yeah
Inventory#addItem() seems to be changing the quantity of items added to it, how does that work?
like
It is known that in some implementations this method will also set the inputted argument amount to the number of that item not placed in slots.
why the fuck is the quantity changing
From Javadoc
because what it couldn't add, it mutates the item to have the remaining amount
Skript
The horrendous one
Maybe you have to update the itemstack in the inventory?
I don't really understand what the problem is, but it's worth mentioning that addItem() will mutate the ItemStack you pass into it
If you pass in itemStack with stack size 64 but it could only fit 10 items into the inventory, that itemStack instance you passed will now have a stack size of 54
I wish it didn't mutate the stack but that's a whole other issue
If your problem is that you're expecting addItem() to keep reference to the item in the inventory and expect changes to it to automatically apply to the item stack, that won't work either. When you add an ItemStack to the inventory, what's being added is a copy of that item as an NMS ItemStack, not a Bukkit ItemStack. The only time where updating an ItemStack will reflect its changes in the inventory is if you have a CraftItemStack that is mirroring an NMS ItemStack, which usually you get from Inventory#getItem() or an event or something
Hi, I'm trying to compile my plugin but it keeps on showing me this error:
Looks like you have a bad jar in your local maven repo
I deleted the corrupted jar, it still does that.
A couple of maven-metadata-evoke-snapshots.xml look bad as well
Yeah, I tried deleting all the files in the 2.4.11-SNAPSHOT\ folder
did you add artifacts through intellij?
I didn't add anything
Dear revered SpigotMC members,
I hope this letter finds you all well. I am anticipative of this writing, as it will aid me in finding not only a new friend, but a fellow competent server developer. I already own a server of the highest caliber specifications. Budget is not a problem for me. With all this being said, I still do not want to enjoy this journey alone. For more questions please DM me.
p.s. I cover all server expenses + resources
tldr: i wanna friend who is also good at developing because it sucks doing stuff by yourself.
PLEASE DM
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
do you always talk like that
reminds me of someone
amen
nuh uh
How may I remove the cd between hits like in the old pvp (in 1.8) in recent versions?
is it normal that player's name tag disappears when i player.addPassenger(textDisplay) ?
1.21.4 and i'm not using any weird plugins just my own rn
Is this still correct`
OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
using an UUID would be better but what do you mean correct?
What is args?
i meant like if it's still okay to use as it does say it's depreciated
from what, a command?
yeah and it literally tells you why it's deprecated
okay, ty ^^
bump for this ^ 🥲
Can anyone help me with creating spigot code in memory and then executing it?
excuse me?
probably something like exec() in python or eval() in java
but why would one want to do that?
*fun reasons
*
what exactly Are you trying to achieve?
I don't understand what is trying to be accomplished either .-.
I want to test something
"something"
Test what?
you'll need to elaborate
Define something
that's probably a general java question more than spigot question
elaborate
tell us exactly what you are trying to do
often the best solution is something you wouldnt even consider
Execute bukkit code which is sent in a discord channel

But why???
little bit of malware 
This sounds like the discord gansta with the remote rats :D
ratting a minecraft server gotta be one of the saddest things ever
i mean
most people dockerize their servers anyways
I mean I've played with the thought of somehow running code on runtime that can be edited
No lol
that already exists
What's it called?
Oh hey I did that
if this refers to hotloading , just google about it lol
I told you to execute Bukkit code Well particle beam code
tf is particle beam code
you'd typically do that with javascript rather than java
Do you not know what particles are in minecraft?
the overcomplicated way:
fetch whatever values you need from the discord channel
and then call the hard-coded method with those values
for example you make java public void iLikeThisFunction(Player player, float a, float b, int x, ...); and then java var data = fetchDataFromChannel(); iLikeThisFunction(data.getPlayer(), data.getA(), )
You're the first person ever to call Java code for Particles in spigot particle beam code
it's not @vast ledge's fault, you didn't describe it clearly
But the code will be in the plugin?
Are you trying to create this but for discord and on MineCraft?
https://sampforum.blast.hk/showthread.php?tid=98803
IRC Plugin This plugin allows for the creation and management of IRC bots through the SA-MP server. There are many features, including: SSL support and local IP address binding Automatic reconnection
if you want to let admins super customize your particle effects, have them just write them in javascript and then execute it with nashorn or whatever
that's how Skript works, no?
but that's overengineering it by quite a bit
well script has its own interpreter, it's a bit different
It does but I want to like execute the whole method on discord
Like a remote RCON?
make a command on discord that sends a ws req to your server and just have the server take the data it got and push into that method
You can use jshell to add/modify code at runtime
But the method must not be in the plugin
Im going to give the plugin to my friend and dont want him to have the code
You can't
that would break every server
if you could just inject code whenever you wanted
Why is it not possible?
I mean you can in certain versions with a certain RCE exploit
if the only reason is you don't want friend to see your code (and in that case you really could have skipped the unrelated "bukkit spigot particle beam" part) use an obfuscator instead of whatever you just came up with
but what you're making does sound more like malware
I just told you I dont want him to have the code cause its a particle beam (Minecraft particle beam)
That doesn't explain anything
You're trying to hide some of the most simple code there is?
WTH is a Minecraft Particle Beam?
or?
God knows!
Def not simple
If the code is to run at ANY time on the server it will be available to access.
And it doesn not allow me to upload an image so
?img
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
!verify
Usage: !verify <forums username>
just use imgur or smth
like this? java public static void drawLine(Location from, Location to, int points, Color color) { World world = from.getWorld(); assert world == to.getWorld(); Vector adder = to.toVector().subtract(from.toVector()).multiply(1.0 / (points+1)); Location cur = from.clone(); for (int i = 0; i < points; i++) { spawnParticle(world, cur.add(adder), color); } }
Not even close lmao
We do not understand what you're trying to do
to be fair, you've gotten us all confused. so don't expect anything
¯_(ツ)_/¯
We don'tknow
🤡
We are not here to guess what you want to do. Explain it clearly and precisely.
chatgpt summary of this channel:
User "Object" is seeking help with dynamically creating and executing Spigot (Bukkit) code in memory. They want to run a particle beam effect by executing code sent through a Discord channel, rather than embedding the method directly in the plugin. This approach is intended to test the functionality while keeping the code hidden from someone who will receive the plugin.
I hope this is not what he is making otherwise I recommend everyone to learn programming to be safe
But still why are you trying to hide it?????
Ye
Hacker Movie ahh ui
BLYAT
Hell no I dont care about bitcoin
Now what is that particle beam
If you're trying to make a line of particles from the sky to the ground at x position, you can use the code that was provided by @silver robin
Im not verified I sent an image of it to mesava
i'll remember
if the particle beam part is irrelevant, and all you want to do is hide code from friend, then use a java obfuscator
ah alr i'll look
Ye nope its not like that
wild pls send here @silver robin
it's just your everyday particle effect, just with tons of different particles presumably to make it look nicer
expirable link
it makes sense if OP would like to hide the actual math from a friend
still, obfuscation is the way to go (said it like third time lol)
Does anybody why even though i cancel my inventoryclick event i can still click the items and duplicate them? it gets cancelled but i duplicate it too?
isn't this the bliss smp particle effect for the water gem (t2?)
Cant we just try the dynamic thing?
And if you don't want that, you can have the discord thing send the formula to the plugin or smth
Flux 😭
MY BAD G
You can, go ahead!
Ye but how to do it?
if you're trying to make a GUI of some sort please don't reinvent everything
https://github.com/stefvanschie/IF
Any tutorial
@forest hedge please confirm that the part about 'particle beams' is irrelevant to what you trying to do
that's just wrong, you can reinvent stuff if you don't like existing frameworks
It is not
seemingly
Wdym?
this is your solution (one of the possible)
I have it 😭 It's pretty simple actually
well it will be revealed unless he just hard codes a lot of numbers for every tick
only reason Im doing this is because of the particle beam I dont want my friend to have the code for it
Im trying to cancel when a players click a specific item in a inventory. But when i cancel the click it cancels it but i also duplicates it and i have it as cursor item you understand
i mean that it's not related to particle beams at all, it could be any other functionality....
for particle beams if you want to hide the maths then pre-calculate all coordinates and particles which should be spawned there at specific tick then just iterate through that list
what do you care that he has it 😭
it's a thing of life, people will read & steal your code if given the chance
Take the chance away?
don't give him the plugin
that's the only way
The dynamic code loading??
it's still loaded
probably a dumb question from me but have you maybe forgot tojava player.updateInventory()?
he still gets it
whether you load it statically or dynamically or generate it programmatically; he gets it
It's that simple, nobody even needs your code ._.
OR make the plugin make a get request to and endpoint which returns json for particle positions, sizes and colors and make it call every 1 tick and make sure it's on the main thread so the server waits frfr
Check if it works lol
Your code isn't anything hard to make
also if it's your friend you can trust them, no??
You go ahead, can't be bothered
https://paste.md-5.net/hiqezogaqo.cpp
I forgot the patse
?paste
pls delete this nevermind this lol it was in a code block
it's a mayhem
also it's Particle.DUST instead of REDSTONE
ik nobody does either
sir this is past 1.8
Now its more buggy it cancels the first time but when i click the item again i can still duplicate it
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getWhoClicked() instanceof Player player) {
if (Objects.equals(event.getClickedInventory(), player.getInventory())) {
if (Cosmetics.isCosmeticItem(event.getCurrentItem())) {
System.out.println("Cosmetic Item clicked!");
event.setCancelled(true);
player.updateInventory();
}
}
}
}
did you consider inventory drag event too?
Im trying to show how simple it is to re-create what he wants, so theres no point in obfuscating it or using a friggin api endpoint as if it was important data that cannot be on the local machine
here's an example: https://www.youtube.com/watch?v=c7G1Iy2DGds
Thanks to the new minecraft version, prodigynightclub has a new awesome feature with realistic laser beam ! Forget about the old ugly guardian lasers and enjoy a real party !
You can purchase the plugin here:
https://www.spigotmc.org/resources/prodigynightclub.58234/
do you really think the dev wanted to hide this code?
oorah oorah
the api endpoint one was a joke
what are those, beacon beams or text displays
Still, sending data over a discord server is almost as wild
beacon beams are clientside
text displays are the only way to do that afaik
also @quaint mantle are you sure that it's not just a visual ghost item? or if you're in creative mode then
in the video are block display entities, strected out a lot and with a glowing effect
but text display can also do that
BASED
(it's not my video or plugin....)
I know
It wasnt a ghost item but it was because of creative mode..
talking about the author
eh we could've figured that out way earlier xd
creative mode is weird
it allows clients to just spawn any kind of item
with any nbt data
so it's actually a desync problem
but the server "accepted" that item you pulled out of the inventory, if you were in survival it would disappear
using a specific cheat client on creative servers to spawn heads, barriers, dragon eggs and command blocks was cool back in 2015
or a minecart with command block which was a force OP exploit 😄
You do see that this is a paid plugin so he would have to compile the github code
paid and open source don't really go together but whatever
They definitely can
yall made me double check it lol the 'Source Code' link leads to just the wiki and not source code
That is annoying. But know that EpicHoppers and all these paid plugins from Songoda are open source and can be viewed on github. Compiled for free so they do exist
unfortunately songoda plugins aren't worth the money even if you get them for free
and the source code is an active cognitohazard
Just making a point. That is what came to mind when @silver robin said paid and open source don't go together. But you right, Songoda are not worth the money. Its unrelated to this current talk
another example is mcmmo
and xenforo, a website forum framework, allows you to even edit code after buying it
...
dont think its that terrible anymore
ofc its nowhere near enterprise standard
yk what is enterprise standard?
🏃♂️
con when you gonna do the jd thing
i started it
I expected release date to be "1st April 2024" because what the hell is this
@Contract("random") is what gets me the most
nullable notnull
just one more annotation
wheres @EqualsAndHashCode
I feel like instead of functions you should make them all just functional interfaces and assign them to variables
so instead of this.whatever it's this.function.run()
cached functions woOo
LRU caches in the house tonight
so we do it completely point-free? i mean does sound good
this ain't kotlin
I mean we avoid being point-free
every function call has a .
point free has nothing to do w kotlin :c
one day 🙏
I was gonna look something up and now I forgor ffs
I found my issue with the inventories. I was compiling to the wrong plugin. Was set to the farmRod (Not related to the miner)
So its fixed now
As a note, I still using "Block block" and it still inserts the item, no .update() required
Yeah I did note that
getInventory vs getSnapshotInventory got them confused for a bit
Though I still feel it's a bit odd that getInventory actually refers to the block and not the state snapshot that you call it on
Its ok. The methods can be, you know. That is why I ask here and used to be (PaperMC). Does not help when the api changes alot, I think that is why there is no website like w3schools but for spigot. If there is tutorials how w3schools is laid out, it might people alot of people but any complex tasks will still go here
You can get most of the information from the javadoc
You right but does it show how its done, no
Doesn't need to really
I feel like that's the job of the programmer, piece it all together ?
myes
can't be spoonfed every little thing
an example here and there is fine but mostly it's just up to the programmer to read the docs and put the things together in such a way that it does what they want it to do
Example of what I mean
PHP Date<?php echo "Today is " . date("Y/m/d") . "<br>"; echo "Today is " . date("Y.m.d") . "<br>"; echo "Today is " . date("Y-m-d") . "<br>"; echo "Today is " . date("l"); ?>I got the code from w3schools. So if this was spigot api, you think it will help most people?
if i need an example i just ask leo in brave
and to be fair there are the spigot forums, where for years people have been asking mostly stupid questions and some good samaritans have spoonfed them answers
yea leo finds that stuff for you 😛
off the top of my head i could maybe name 3-4 finicky bits about the api for which you need or want to copy paste an impl from someone who's already spent 10 hours fiddling with it
one of them would be to get scoreboard sidebars updating correctly without flickering
but that isn't really the api's fault; it's a client problem
generally just the docs are sufficient
Learnspigot be like
How may I remove the cd between hits like in the old pvp (in 1.8) in recent versions?
You'll want to add an AttributeModifier either to the player or to the item they're using for the ATTACK_SPEED attribute
Higher the number, faster the player can attack. I believe it's full strength attacks per second or something, so if you just do an ADD_NUMBER operation with a value of like 100, it will work fine
Yeah it’s attacks per second
Is there a method for a plugin to retrieve a path to itself in the filesystem?
Actually I should probably explain why. I want to generate a hash of the installed plugin, to check for modifications.
JavaPlugin#getFile()? Is that what you're looking for?
Yess! Will this retrieve the exact path of the plugin?
private void setAttackSpeedTo1_8(Player player) {
player.getAttribute(Attribute.ATTACK_SPEED).addModifier(
new AttributeModifier(
"attack_speed_1_8",
4.0,
AttributeModifier.Operation.ADD_NUMBER
)
);
}
'AttributeModifier(java.lang.String, double, org.bukkit.attribute.AttributeModifier.Operation)' is deprecated since version 1.21 and marked for removal
What can I use?
The constructor is a bit simpler now. Should be able to use (NamespacedKey, double, Operation, EquipmentSlotGroup)
new AttributeModifier(
new NamespacedKey(pluginInstance, "attack_speed_1_8"),
4.0, // Might want to make this a bit higher. Up to you though
AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlotGroup.ANY
);
Yes it will. Will get you the actual .jar file
Can use toPath() if you want an NIO path
Thanks.
uh you sure?
'getFile()' has protected access in 'org. bukkit. plugin. java. JavaPlugin'
Mhmm. It's protected :p
Reflection time?
You can only use it from within JavaPlugin. If you want to use it externally, I guess a hacky workaround would be to make your own method in your plugin class called something like getPluginFile() and just return getFile() lol
No no, just a wrapper method
External being what?
out of the mainclass?
Outside the plugin class, yeah
I wanted to say override and make it public - but god forbid
You can't open access 
Oh what so you cant even access JavaPlugin in a command class within your plugin?
I'm confused.
abbev is it ur own JavaPlugin subclass?
All I'm doing is this right now:
private String generatePluginHash(JavaPlugin plugin) {
try {
File pluginFile = plugin.getFile();
if (pluginFile == null || !pluginFile.exists()) {
return "UNKNOWN";
}
MessageDigest digest = MessageDigest.getInstance("SHA-256");
try (FileInputStream fis = new FileInputStream(pluginFile)) {
byte[] buffer = new byte[8192];
int bytesRead;
while ((bytesRead = fis.read(buffer)) != -1) {
digest.update(buffer, 0, bytesRead);
}
}
byte[] hashBytes = digest.digest();
StringBuilder hexString = new StringBuilder();
for (byte hashByte : hashBytes) {
hexString.append(String.format("%02x", hashByte));
}
return hexString.toString();
} catch (Exception e) {
return "ERROR";
}
}
public class MyPlugin extends JavaPlugin {
public File getPluginFile() {
return getFile();
}
}
public class MyCommand implements CommandExecutor {
private final MyPlugin plugin;
public MyCommand(MyPlugin plugin) {
this.plugin = plugin;
}
public void onCommand(too lazy, to fill, out the, parameter list) {
File file = plugin.getPluginFile();
}
}
Yeah it will have to be your own instance instead of just JavaPlugin
If you're wanting to do this generally for other plugins, then yes, you will have to use reflection
In my plugin, I have:
this.plugin = plugin;
``` in the constructor already.
Yeah, note I'm defining it as MyPlugin though instead of JavaPlugin
OH i see what yo'ure aying.

Oh okay
can someone help me i am trying to make that the player is getting a colored message but its a error
Likely using the wrong ChatColor. You want the one from net.md_5.bungee.api
Or whatever the package is :p
"or whatever"?? chud. do you not respect the work of our good lord md5?
im very new to coding so i wont understand much
Show your imports at the top of the file.
So instead of ChatColor.of, use net.md_5.bungee.api.ChatColor.of()
i mean in this you could open access (but who cares)
k
You can't override a method and change its access to be more public. I'm not sure I understand what you mean
You have to wrap getFile() instead
yea you can
You're making me double check
:,)
can i just use &4 or some other formatting code from minecraft
im pretty sure if u have a non-final protected (maybe pack priv also) method, subclassing will allow u to override and open access
Oh, yes, ChatColor#translateAlternateColorCodes() is the method for that
The #of() method in the bungee package is for RGB colours
I dont like the name translateAlternateColorCodes.
I just have a method called "bob" which is a wrapper for translateAlternateColorCodes. Bob is more pleasant.
you mean html codes like #9c3232
You're right, sorry. It's the other way around. You can't make a child method more private than its parent
Yes
thx for your help
:> soz for the nitpick but yea ^^
No you're right lol. Not a nitpick
public class MyPlugin extends JavaPlugin {
@Override
public File getFile() { // Access from protected -> public
return super.getFile();
}
}
public class MyCommand implements CommandExecutor {
private final MyPlugin plugin;
public MyCommand(MyPlugin plugin) {
this.plugin = plugin;
}
public void onCommand(too lazy, to fill, out the, parameter list) {
File file = plugin.getFile();
}
}
It becomes this instead, my mistake
(good to leave a comment next to those so people don't think you're stupid for redefining a method and just calling super
)
cant believe a mfer asks one question, and 2 people argue back and forth for 30 minutes. /j
what is this mental illness?
Conclube and I? Cause he was just right
I had my access knowledge backwards
kek yes

How can I add a list of items to a inventory?
inv.addItem(block.getDrops()) <!-- Errored
i could give you a direct answer but in favor of actually learning something, let's see what the error is
this goes back to the whole "the programmer is supposed to put the things together" thing; what you have here is a cube and a circular hole, and you need to do something with the cube to make it fit
make a for and add them
I just did, thanks
but getFile is final tho
public_getFile()
haha fuck aint no way i trolled, but on a serious note is it? as far as I remember its one of those that are not final
the placeholder spi is working but we can't download the expansion
you own hypixel?
bro it's hypixel's lobby
oh
swear it was
like I'm dead convinced
I've been making bridge methods for it this whole time for no reason xD
Bro leaked upcoming minigame
Hey does anyone know how I might be able to go about building my own world generator that just makes changes to the world generation that is already made? I've been looking at the ChunkGenerator and BlockPopulator classes; I may be wrong, but it looks like BlockPopulator only works with blocks added in after chunk generation, and any overrided ChunkGenerator seems to default to a void generator, and so I am unable to work with the default generation using it as I know how to. Anyone have any advice?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/generator/ChunkGenerator.html
Look at the shouldXXX methods
declaration: package: org.bukkit.generator, class: ChunkGenerator
But otherwise a populator should be fine, not sure what the concern you have is
Hey guys, I wanna create a detection system to detect if you're inside a certain zone or not, but these zones will be very small as its for detecting if you're on top of very small structures generally, is there anything you think i could look into to help with this implementation? It needs to be a bit optimized since there can be a lot of these in the world at once
Divide your world into cells/chunks, and only check zones in the current and adjacent cells
And maybe define your small zones as axis-aligned bounding boxes
Anyone?
Are you using gradle?
wait thats maven
idk why i asked
@warm pine cant you just delete your maven cache??
[WARNING] The metadata C:\Users\ammar\.m2\repository\com\github\technicallycoded\FoliaLib\main-SNAPSHOT\maven-metadata-evoke-snapshots.xml is invalid: unexpected markup <!d (position: START_DOCUMENT seen <!d... @1:4)
I mean it kind of gives you an indication here.
I did it several times
how do i tell a beacon 'hey you're at y=-60'
Hello someone has alreeady done custom world generation and know how to handle biome transition regarding noise values (e.g terrain height) ?
I'm using LERP with smoothstep for the step of the lerp, for the X and Z axis on biome edges with a blendfactor of 10 and then I average them but I have an artefact problem where I have werid spikes comming out
are you applying the smoothstep function seperately on X and Z and THEN averaging?
yep
perhaps I can do it another way ?
No, thats the right way. sometimes people do it incorrectly.
What operations are you already doing?
Basically, I have a loop that checks 10 blocks ahead if there is a biome change, if it finds one it uses smoothstep & LERP to redefine the height if the noise at this location, and then breaks the cycle. Since the generateNoise function is called for each block. It works well with only X, when I put Z, I have as I said artifacts
I've also try weighted average like so
for (int i = 0; i < k ; i++) {
Biome biX = baseBiomeProvider.getBiome(worldInfo, worldX + i, worldInfo.getMaxHeight() / 2, worldZ);
Biome biZ = baseBiomeProvider.getBiome(worldInfo, worldX, worldInfo.getMaxHeight() / 2, worldZ + i);
if(biX != currentBiome || biZ != currentBiome) {
float t = WorldUtil.smoothstep(0.0f, 1.0f, (float) i / (float) k);
int caveTopX = biomeServiceFactory.getBiomeService(biX).getCaveTop(worldX, worldZ);
int caveTopZ = biomeServiceFactory.getBiomeService(biZ).getCaveTop(worldX, worldZ);
double smoothCaveTopX = WorldUtil.lerp(caveTopX, caveTop, t);
double smoothCaveTopZ = WorldUtil.lerp(caveTopZ, caveTop, t);
double deltaX = Math.abs(caveTopX - caveTop);
double deltaZ = Math.abs(caveTopZ - caveTop);
double totalDifference = deltaX + deltaZ;
double weightX = totalDifference > 0 ? deltaX / totalDifference : 0.5f;
double weightZ = 1.0f - weightX;
caveTop = (int) (smoothCaveTopX * weightX + smoothCaveTopZ * weightZ);
break;
}
}
But it doesn't work quite well, I still have artifacts
and with the normal arithmetic average I have
do you also notice like incosistent blending when it comes to diagonals?
for (int i = 0; i < k ; i++) {
Biome biX = baseBiomeProvider.getBiome(worldInfo, worldX + i, worldInfo.getMaxHeight() / 2, worldZ);
Biome biZ = baseBiomeProvider.getBiome(worldInfo, worldX, worldInfo.getMaxHeight() / 2, worldZ + i);
if(biX != currentBiome || biZ != currentBiome) {
float t = WorldUtil.smoothstep(0.0f, 1.0f, (float) i / (float) k);
int caveTopX = biomeServiceFactory.getBiomeService(biX).getCaveTop(worldX, worldZ);
int caveTopZ = biomeServiceFactory.getBiomeService(biZ).getCaveTop(worldX, worldZ);
double smoothCaveTopX = WorldUtil.lerp(caveTopX, caveTop, t);
double smoothCaveTopZ = WorldUtil.lerp(caveTopZ, caveTop, t);
caveTop = (int) (smoothCaveTopX + smoothCaveTopZ) / 2;
break;
}
}
Have you tried a cubic or quintic interpolation?
that is the artifacts i'm talking about
i'm gonna show you
No, do you think it could work ? instead of linear interpolation ?
Because I have the feeling that the problem here comes from the way smoothCaveTopX and Z are handled together
Weighting should have worked.
I'll send you images in DM because I cannot send here
note that k = 10
and int caveTop = biomeService.getCaveTop(worldX, worldZ);
with BiomeService biomeService = biomeServiceFactory.getBiomeService(currentBiome);
just gives me basic settings for each biomes, (here just a number which is the caveTop)
done
what do you mean tell a beacon
according to the wiki beacons only care about horizontal distance, limited by simulation distance
according to mojanks code as in spigot, this doesnt work downwards
did you try update?
yes so having a beacon at any height doens't matter
i do not have the beacon effect if im below it
thats just how vanilla works, no?
isnt it supposed to give the effect down too?
im pretty sure i researched it and it looked like it doesnt cus i was gonna put a beacon above my base and realized it wouldnt work
let me double check
oh ok i was partially right
so it actually goes infinitely upward but only like 20 blocks below
thats such nonsense bruh
yeah it honestly makes no fucking sense but it is what it is
now everything work properly sry for bothering 🙂 thanks
not really, this has always been the case that if you want the effect to go below you just build the beacon lower
yes, with packets you can make the beam invisible
it gets a bit tricky because the beam is mostly client side
but it is doable
Some shaders can be modified through packets yeah? And that extends to beacon beams?
how can i create a clickable text component with multiple in the same message?
I tried this, but i get a "IllegalStateException: zip file closed" exception on the sendMessage line
BaseComponent acceptComponent = TextComponent.fromLegacy(ChatColor.translateAlternateColorCodes('&', "&a&l[Accept]"));
acceptComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/duel accept " + from.getName()));
acceptComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("/duel accept " + from.getName()).create()));
BaseComponent rejectComponent = TextComponent.fromLegacy(ChatColor.translateAlternateColorCodes('&', "&c&l[Reject]"));
rejectComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/duel reject " + from.getName()));
rejectComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("/duel reject " + from.getName()).create()));
BaseComponent[] component = new ComponentBuilder("")
.append(acceptComponent)
.append(" ")
.append(rejectComponent)
.create();
to.spigot().sendMessage(component);
Not modified. The shader stays the same but the client never knows the beacon activates thus not showing the beam
maybe? not entirely sure on the shaders part
shaders can only be modified with resource packs
Oh ok
in a recent snapshot they killed core shader defs so you can't even add uniforms anymore, they're dictated by their new render pipelines 😭
dinnerbone why
Maybe we’ll get core shaders 2.0
they said that in a couple previous snapshots before too
You shouldn't be mixing legacy colour codes with components. You're at least using fromLegacy() but still not ideal. Something like this would work
BaseComponent message = new ComponentBuilder("")
.append(new ComponentBuilder("[Accept]")
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/duel accept " + from.getName()))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("/duel accept " + from.getName())))
.color(net.md_5.bungee.api.ChatColor.GREEN)
.bold(true)
.build()
)
.append(" ")
.append(new ComponentBuilder("[Reject]")
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/duel reject " + from.getName()))
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("/duel reject " + from.getName())))
.color(net.md_5.bungee.api.ChatColor.RED)
.bold(true)
.build()
)
.build();
to.spigot().sendMessage(message);
I also don't remember if the run command action requires a forward slash or not in its value. I don't think it does but I could be wrong
(the ISException is possibly the use of the deprecated HoverEvent constructor, note I used Text instead of passing in a component)
it does
Stupid >:(
ill give it a go, one moment
Since they are being run from chat, commands must be prefixed with the usual "/" slash, and player must have the required permissions. In signs, the command is run by the server at the sign's location, with the player who used the sign as the command executor (that is, the entity selected by @s).
https://minecraft.wiki/w/Text_component_format#Java_Edition > interactivity > click event > action
why everytime i do the command /worldcreate void hello
it send this error in console [13:17:01 ERROR]: No key layers in MapLike[{}]
the code behind the command is this:
public class testcreate implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] arg) {
if (commandSender instanceof Player) {
Player player = (Player) commandSender;
if (arg.length == 2) {
if (Bukkit.getWorld(arg[0]) == null) {
switch (arg[0]) {
case "void":
WorldCreator wcvoid = new WorldCreator(arg[1]);
wcvoid.type(WorldType.FLAT);
wcvoid.generator(new EmptyChunkGenerator());
wcvoid.createWorld();
case "flat":
WorldCreator wcflat = new WorldCreator(arg[1]);
wcflat.type(WorldType.FLAT);
wcflat.createWorld();
}
commandSender.sendMessage("World " + arg[1] + " created");
} else {
player.sendMessage("aready exist");
}
} else {
player.sendMessage("Correct usage /worldcreate <void/flat> <world name>");
}
}
return false;
}
}
class EmptyChunkGenerator extends ChunkGenerator {
@Override
@NonNull
public ChunkData generateChunkData(@NonNull World world, @NonNull Random random, int x, int z, @NonNull BiomeGrid biome) {
return createChunkData(world);
}
}
Does the world get created?
Was about to say that. If the world generates, just ignore it.
this is like the third or fourth major release in which this happens
they should just attach a log filter by default at this point that drops any records containing MapLike
And destroy most datapack errors ?
if that's what it takes
yes it get created i trought that i was doing something bad sry for bothering then
Are there any ultra-small generative models?
sure
they are also ultra-ass
how do you define ultra-small
microscopic
About 🤏
this is an enlarged version: .
Below 250 MB
For generating block structures in minecraft?
Images
Ah
For a minecraft plugin tho, yes
You could pull a StableDiffusion model straight from HuggingFace. No need to distribute it with your plugin.
How are you planning on loading the model?
I honestly think it might be better to simply define a standardized endpoint in your config. The user then has to select if he wants to start a model locally in api mode, or if he simply
pays for an online service. There are two standard api implementations for rest endpoints afaik.
But maybe you can find a Quantized StableDiffusion 1.5 Model that is around a GB
Never done anything with AI, not sure
That's pretty nice actually
How much memory does it consume?
Inference will always consume a couple of GBs. And generating an image on your CPU will also take several minutes.
Ive seen it run on a raspberry pi, consuming around 6GB of ram for a single generation.
This is probably the lowest you can get with the base model:
from diffusers import StableDiffusionPipeline
from PIL import Image
pipe = StableDiffusionPipeline.from_pretrained("../stable-diffusion-v1-5", low_cpu_mem_usage=True)
pipe = pipe.to("cpu")
prompt = "a black tree with golden leaves painted by Monet, autumn"
image = pipe(prompt, num_inference_steps=30, width=512, height=512).images[0]
image.save("output.png")
Requires the user to have Pyhton, Diffusers and Torch installed.
Honestly, you can probably quantize an SD 1.5 model. But this requires quite a bit of tinkering and knowledge about quantization.
depends a bit but typically the size of the model itself, could be a little bit less because there's metadata in the file and could be a bit more if the weights don't align with native data structures
because at the end of the day inference is just crunching the weight numbers with a smaller set of transient numbers
if you have 250mb of weights, then it'll use 250mb of memory
all that said huggingface also offers free-to-use endpoints so it probably doesn't make much sense to bundle it into your plugin
out of curiosity, what's the output of this one
just call their api (and probably let the user specify an api token in case they want to get the paid-for rate limits) and use that
that costs money
right, models aren't free to train and run either
huggingface requires an account and an api token, but usage is free
of course you're competing with 5 billion other free users so it can be quite slow
and if you use some fringe model nobody else uses it'll take like a minute for it to get loaded from the void realm
i love having 5 billion api consumers
average day at the catbase api