#help-development
1 messages · Page 36 of 1
Thanks! : D
well
it turns out you can only have names up to 16 characters
which is a huge bummer
that wont work for me
You still on this? Just use a mounted entity already...
I already have
The mounted armor stand is too low
where the name tag is inside the head of the player
Thats what happens if you make it a marker
but if it's not a marker it will interfere with hitboxes
Let it be a small as and set collidable to false
will that completely stop any interferences?
Yes. No collision and no arrows.
But this will only work if you are on a newer version
Stupid question but how do I use nms?
why is that a stupid question
https://www.spigotmc.org/threads/spigot-bungeecord-1-19.559742/
Scroll down to the nms section and setup the special sources maven plugin in your project.
Then do not tinker with nms.
Nothing there is meant to be used. Nothing is documented and you wont get any help.
Its all just reverse engineering and suffering.
i was just tryna make a npc and every video i watch told me to use nms
i already tried the dependency config but intellj keeps putting out a error on it
buildtools
^
java -jar BuildTools.jar --rev 1.18?
okay yeah i did everything from https://www.spigotmc.org/wiki/buildtools/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
1.18.2?
should work
what did i do
Ok great
And the custom name won’t show for the player it’s mounted on right
You would need to do packet filtering for that
damnit
with ClientBoundDestroyEntities or whatever it’s called?
No. You just cancel the spawn packet for the as
Hello, is this the right place to get help coding a plugin?
How?
It's about the PlayerCommandSendEvent. I am trying to get the list of commands that gets sent to the user with e.getCommands() and it's telling me that it has a missing type "Collection" even though I've done all my imports
Does anyone have any ideas? I've been googling all day lol
Why i can still dragging item when i already cancelled event.
If you properly cancel the InventoryClickEvent then you wont be able to drag items anymore.
I can still get all the items on the inventory.
Then you dont properly cancel the event
I honestly don't know where I went wrong…
Did you register the listener?
Guys I am currently learning plugin development and I have made a really basic plugin so can anyone help me test it out?
Start an offline mode server and connect with two clients
Yeah the thing is My laptop cannot handle that
Wait that’s a thing?
How does one do that
I’ve always had two Minecraft accounts
for reasons other than plugin development
You host the server from your PC or Laptop
yeah of course
You do not need two accounts
but it contacts mojangs auth servers though
yes you do
After that join from minecraft the server which you hosted
You can access server.properties file in the server folder
wait what how would you even do this I thought you needed an account to even launch the game
DM me if anyone wants to help
oh so that’s where it is
Yes.
Add debug messages and debug your code
Yes after accessing the server.properties file you can find online mode which will be true by default and then set it to false
How does one cancel a spawn packet to a specific player
Check who the receiving player is and cancel it regardingly
Ok so I'm trying to create a project with multiple modules in order to support different nms versions. What I'm wondering is if it'll still remap correctly with SpecialSource
Would it be helpful if I post the whole listener class for the PlayerCommandSend event that's not working?
If you set up the special sources plugin for each module then yes
Properly setup your jdk in your project. Collection is from java itself.
No idea what that means
How do I "check" who it is
I'll do some more googling. Thanks
Is there an event for when packets are sent?
Protocollib has that
Like when I call the World#spawn method
How would I just stop the packet for one player
do you know of a good spigot module plugin that I can use as an example
Hm not really
https://github.com/mbax/AbstractionExamplePlugin
this is all I have rn and it's from 8 years ago
😩
A modular Spigot plugin that prevents players from logging out during combat and has many expansions for extra features. - GitHub - SirBlobman/CombatLogX: A modular Spigot plugin that prevents play...
I fixed the error but it still doesn't work. Gonna do some debug statements... and then idk lol
Alright I confirmed that it's triggering the event and running the code, but it's not doing what I want 😛
I'm trying to remove commands from the list that the players see
subcommands
that get run from clickable text
problem is I've heard of 3 different events to listen to. this one made the most sense
(the commands are still showing) EDIT: nvm! works now!
Does anyone know how to cancel an entity spawn packet with nms? Or maybe even ProtocolLib?
I want to spawn an entity in the world, but have it not exist for one player
restart your ide
Thank you @lost matrix
bump
so either try to listen to it via protolib or destroy the entity immediately afterwards for the player
destroying the entity immediately sounds inefficient
how would you listen to it with protocollib?
public static void onDrop(PlayerDropItemEvent e){
if (e.getPlayer().getInventory().getItemInMainHand() != null){
if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().equals(ItemManager.crown)){
e.setCancelled(true);
}
}
}``` anyone know why this not working?
ok so I'm making a multi module project and I'm trying to compile the whole thing into one jar file
the problem I'm running into right now is that each jar file is being completed individually
how so
thats probably how you do it
i mean
i feel like it should be possible to just send the spawn packet to specific players
listen to the sent entity spawn packet and cancel it 
rather than sending spawn packets to every player and then another delete packet to one player
but how i kinda have no experience with protocol lib lmao
what does, first or second sentence?
I need every player except one to see an entity
I'll do some experimenting
to intercept the spawn packet and then resend the spawn packet for only specific players
thats not what i meant
?
i just mean, "send the packet to all players but one", rather than "send the packet to all players and then send another delete packet to one"
bump
I'm not so good at xml so 😂
you need an uber module
which holds the ones you want to build as dependencies
public static void onDrop(PlayerDropItemEvent e){
if (e.getPlayer().getInventory().getItemInMainHand() != null){
if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().equals(ItemManager.crown)){
e.setCancelled(true);
}
}
}```
anyone know why my code isnt working?
it doesnt give an error
it just doesnt work
Dont check metas for equality. Use the persistent data container of the meta to tag an item as a custom one.
ok
?pdc
ok that's what I have but then when I do mvn package this is what it says, then proceeds to still build every single one
also a problem I have is that I'm using a maven plugin to remap and obfuscate the mojang mappings, and that's compiling into its own jar file just like the others
actually
nevermind!
it just outputs weird to this file name
I'm running into some strange desync issue
so I'm constantly teleporting an invisible armor stand on top of a player (mounting still didn't work- the name tag was either too high or too low)
and it works fine when both accounts are on the server when the plugin is reloaded
but when this "Jacob" accounts logs off and back on, this happens on my main account:
even though on the Jacob account, it still looks normal:
I have no idea what could be causing this. here's the code that's run when a player joins the server
private void updateArmorStand(Player player, String name) {
ArmorStand armorStand = playerArmorStands.get(player.getUniqueId());
if (armorStand == null || !armorStand.isValid()) {
armorStand = player.getWorld().spawn(player.getLocation().add(0, ARMOR_STAND_Y_OFFSET, 0), ArmorStand.class);
armorStand.setCustomNameVisible(true);
armorStand.setGravity(false);
armorStand.setVisible(false);
armorStand.setInvulnerable(true);
armorStand.setMarker(true);
playerArmorStands.put(player.getUniqueId(), armorStand);
}
armorStand.setCustomName(name);
}
the durability also gets checked
Are you removing the armor stand when the player is logging out
yes
the armor stand is deleted when the jacob accounts logs off
private void removeArmorStand(Player player) {
ArmorStand armorStand = playerArmorStands.get(player.getUniqueId());
if (armorStand != null) {
armorStand.remove();
playerArmorStands.remove(player.getUniqueId());
}
}
this is the code that's run on player quit or on player death
That's not removing it from the world though
nvm
I'm blind
Have you tried delaying the armor stand spawn by a tick
yes
by 0, 1, and 10 ticks
i've had the same problem but didn't looked further into it. what if you "reload" the entity for the player?
Can I check for if a chunk has been generated?
also when doing custom titles you want to use packets for the armorstands
that's a thing?
yes
havent gotten to there yet
I'm gonna use packets to hide the armor stand from the player
in newer version you could hide/show the armorstand for all players, otherwise packets
tfw hypixel just decides to completely disable playerinteractevent
I want the title to be visible to everyone except for the player it's on top of
a fake entity is the key here
i dont see any reload method for player or armorstand
^
fake entity on which client?
so you're saying instead I should just send fake armor stands to every player
yes
how do I teleport those armor stands on top of their respective players
well, first you need the entity
second you need to handle it (mount it, keep track of it, what happens if a player "unloads"(the entity will be gone as well, so resend the packet))
third what happens when you try to hit a player with a fake entity on him (you need to redirect the hit)
i mean
marker armor stands don't have hitboxes
so i dont think that'll be an issue
How do i do all of this lmao
I'm so lost
.
declaration: package: org.bukkit, interface: World
To see if it's loaded?
If it's ever been generated
.
Won’t this actually take up more memory though?
Because each player has their own set of fake armor stands (which are on top of other players)
how come whenever I do an entity spawn packet the entity isn't looking in the right location and the velocity vector does nothing pretty much
pitch and yaw of Location are where the player will be facing
What does this have to do with my problem though
my guess is your client thinks you are colliding with the stand so it pushes it
no, since all you are holding is a set (if even a set) of IDs per player. if you are really unnecessarily concerned about memory, use a profiler and sum the bytes
what are you talking about
How does that mess with visibility tho
I thought your issue was teh stand gets moved up for teh spawnign player?
the xrot and yrot arguments in the packet constructor are regarding the entity's spawn location that you're spawning in
are you talking about teh players facing or his head direction?
dude what
^
There is a seperate packet for setting teh lookat
the entity being spawned via that packet is not looking in the correct direction and the velocity vector does nothing
One armor stand per player?
then tell me why it's an argument in the packet constructor
No
The issue is that the stand becomes visible and the custom names becomes invisible for some clients
ClientboundRotateHeadPacket
strange
which packet?
the one I mentioned earlier
packetplayoutentityspawn
aka clientboundaddentitypacket
there is a ClientboundAddEntityPacket which just takes a LivingEntity, unless you are trying to custom set its facing
it does not just take a livingentity
you can create a client entity via that packet
this is one of the higher level constructors
So here’s what I would do:
Have a hashmap with player UUIDs as the key and fake armor stands as the value (I have no idea how to create a “fake armor stand” instance)
Then when a player moves, I’ll send a packet to every other player to teleport the fake armor stand on top of the player that moves (no idea how to teleport fake entities either)
Does this look right?
There is a contructor which takes a LivingEntity java LivingEntity livingEntity = null; new ClientboundAddEntityPacket(livingEntity);
sir
if you looked at the code, you would see that it's Entity, which is a super class of livingentity
and there are multiple other lower level constructors that allow you to do more
Yes, which is why I specifically asked you if you were just trying to spawn with a facing or you were trying to customize it
you never asked me that but ok
my question still hasn't been answered
why are both of the values in that packet if they don't do anything
ok be rude, ask someone else.
how am I being rude you're literally going on about one of the higher level constructors
when I have said I'm not using that one multiple times
and I asked you why not, twice
public ClientboundAddEntityPacket(int var0, UUID var1, double var2, double var4, double var6, float var8, float var9, EntityType<?> var10, int var11, Vec3 var12)
this is the one I'm referriing to
yes I know which constructor you are using, I'm asking why
So what's the problem? What actually do you need help with
let's start over
so
I have everything filled in and the zombie spawns
however
a) his velocity is static and doesn't seem to change (what is the last value for if that doesn't edit velocity)
b) var8 and var9 (xRot and yRot) seemingly have no impact as well
Does anyone know how to create NMS entities in 1.19.1?
Yeah
What part do you need help with
The creation of the entity
Use Level#addFreshEntity to spawn the entity in the world
I mean like starting off from here
class Test extends EntitySkeleton {
}
look at the entityskeleton class
Why does it have to take multiple EntityTypes?
public EntitySkeleton(EntityTypes<? extends EntitySkeleton> entitytypes, World world) {
it doesn't
It takes the Skeleton Entity type
'x()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type
Use Mojmaps
The last value (d3) is the entities yHeadRot
Unmapped is just a pain to work with and you run in to issues like that
I don't see a d3
What's that?
mojang mappings
PacketPlayOutSpawnEntity(int i, UUID uuid, double d0, double d1, double d2, float f, float f1, EntityTypes<?> entitytypes, int j, Vec3D vec3d, double d3)
Thank you
what version are you on
1.19.1
I'm on 1.18.2, I do not have that value
ah
I mean this is just an example I'm doing to make sure everything works. I just want to make sure there's nothing wrong on my end with my code for why the xrot, yrot, and vector have seemingly no impact
so I can better understand what's going on
ElgarLs constructor is the same as your one
no
I do not have the last value
ah'
I think I know the problem
and @eternal oxide tried to point it out earlier
just not perfectly since he didn't know my full context which is fine
I'm using the packet for minecarts and other nonliving entities (as stated by wiki.vg)
so those things probably don't have a major effect or not the one I expected
I'll give the other packet a go
Thanks. Sorry I'm in and out as cooking wifes breakfast
Any idea how I get the Level instance?
Level nmsLevel = ((CraftWorld) bukkitWorld).getHandle(); probably
Ty
might be ServerLevel idk
oh i just genuinely didnt remember the mappings
java.lang.NoClassDefFoundError: net/minecraft/world/level/Level
Ah ok
Maven tab on the right side > package
If you're using Intellij
Yeah that works thanks
is there a way to get an entity object in spigot without spawning it
https://www.spigotmc.org/threads/creating-entity-without-spawning-it.314683/
was reading this thread and was hoping it was a thing by now
You're already using NMS for packets
?
why the question mark
Make some abstraction or use reflection
I am
Would this be correct?
private class Test extends Skeleton {
public Test(net.minecraft.world.entity.EntityType<? extends Skeleton> entitytypes, Level world) {
super(entitytypes, world);
}
}
Level level = ((CraftWorld) Bukkit.getWorld("world")).getHandle();
Test test = new Test(net.minecraft.world.entity.EntityType.SKELETON, level);
test.teleportTo(-3, 70, 6);
Yes. You can call setPos in the constructor though if that's easier for you
Looks like it can't find a plugin
Specify the exact maven plugin dependency
if(configSec == null) return;
if(configSec.getList("list") == null) return;
configSec.getList("list").remove(piece);```
according to my ide, how can .remove() possibly be NullPointerException if ive accounted for literally every variable to be null?
A plugin called lint
^^
Quick question, How do I make a plugin pause for 2 seconds?
Your IDE doesn't know that it won't return null the second time
?scheduling
what do you mean by the second time
if it checks everytime beforehand?
You call getList twice
so i need to make it a variable to keep the same instance?
Yes
any other ways? i will have to do this with quite a lot and rather not
You can just ignore that warning
what about the assert statement?
I wouldn't know since I'm not the best but I get the same error when I don't reference the plugin instance
Neither
Did you add the maven repo for that plugin
and did you follow the installation instructions
if there should be no way of a NPE occuring with what i have going, is it ok to suppress null warnings in specific classes i know it will especially flag
If you know your IDE is wrong you can ignore it
The entity doesn't seem to spawn, no error in console or anything
I have this
private class Test extends Skeleton {
public Test(net.minecraft.world.entity.EntityType<? extends Skeleton> entitytypes, Level world) {
super(entitytypes, world);
this.setPos(4.0, 72.0, 12.0);
}
}
also did you actually spawn it with level.addFreshEntity
Oh... forgot that
Does anyone know how I can create a world with only plaints biome and only bedrock on layer 1? a normal world
seems to be working well now, thanks
Your mean this?
Is there an equivalent to Thread.sleep(5) but for spigot?
Yes, but then I can't make a normal world with only bedrock on layer 1, not from 1 to 5, I think it's only programmable that I can do that
Since everything else is some weird indent
I heard that datapacks are more suited for this type of thing
Use the scheduler like I linked earlier
I had a look but I'm special
How can I create a pathfinding goal for an entity? For example following a player
You can take a look at the existing goals
Does anyone know how to stop a player moving in a boat?
I've tried something like this
World#notifyAndUpdatePhysics anyone know how work flag in this method? 😅
If you had many of these it looks like it would be a pain
Well that's what you need to do
but it kinda just teleports the player on to the top of the boat
rather than putting them in it
Oh
maybe like player or entity move event and cancel that
bruh
NMS?
If so there should be a class with constants you can use
Yea
Don't remember the old name
The whole server stopped when I did this
Sounds like you still have thread sleep somewhere
Bukkit.getScheduler().scheduleSyncDelayedTask(myPluginInstance, () -> {
((Player) sender).teleport(finalLocation);
Location finalLocationAbove = ((Player) sender).getWorld().getBlockAt(blockX, blockY + 10, blockZ).getLocation();
((Player) sender).getWorld().spawnParticle(Particle.EXPLOSION_HUGE, finalLocationAbove, 1);
sender.sendMessage(ChatColor.GREEN + "Teleporting...");
}, 10L);
And I don't understand
the code surrounding it?
?paste
because that will not stop a server
On what version you write?
1.19
isChunkGenerated uses chunk coords
Not regular ones
Also getBlockAt will load the chunk
think your position choosing code might be a little slow, you can automatically make random generate between a min and max using
int randInt(int min, int max) {
return random.nextInt(max - min) + min;
}
It'll be fine
But
The server stops for 10 second E.i. The time I specify
^^
also youre not specifying 10 seconds there, rather 10 ticks
if (!(sender instanceof Player p)) { return true; } you should use it
1 second == 20 ticks
10 seconds = 200 ticks
thats what you want in the value
for scheduleSyncDelayedTask
generics are kinda cool
yeah
Try looking at the DFU and you'll never want to see Generics again
im sure its very good at its job cause my worlds havent corrupted yet
It's over engineered
public <A, B, C, D> App2<FunctionType.Mu, Pair<A, C>, Pair<B, D>> par(final App2<FunctionType.Mu, A, B> first, final Supplier<App2<FunctionType.Mu, C, D>> second)
where can i vomit
but whatever
i can see why paper hates working with it :)
bang
more like mojunk
Hello. I want to display info below player's name. Why doesn't my code work?
public static void setUserLivesScoreboard(User user) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard scoreboard = manager.getNewScoreboard();
Objective objective = scoreboard.registerNewObjective("name", "dummy", "lives");
objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
objective.setRenderType(RenderType.INTEGER);
objective.getScore("lives_team").setScore(user.getLives());
Team team = scoreboard.registerNewTeam("lives_team");
team.addEntry(user.getPlayer().getName());
}
Use the main scoreboard or set the players scoreboard to the new one you created
Wouldn't everyone have the same info?
how do I check how many items are in players inventory?
I want to display the lifes count for every player
Either create a team for each player or set the players scoreboard
You probably want a team for each player
how many or what items they have?
Can you show an example, pls? Or is this one correct?
public static void setUserLivesScoreboard(User user) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard scoreboard = manager.getMainScoreboard();
Objective objective = scoreboard.registerNewObjective("name", "dummy", "lives");
objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
objective.setRenderType(RenderType.INTEGER);
objective.getScore("lives_team").setScore(user.getLives());
Player player = user.getPlayer();
Team team = scoreboard.registerNewTeam("lives_team_" + player.getName());
team.addEntry(player.getName());
}
how many of any item
#getInventory#getContents
also make sure to remove teams when they aren't needed
thats contents not size
ok, I'll try that, ty
and .length doesnt work
well there are stackables
just how many slots are taken up
thats why you get the contents first
hm actually what are you using the team for?
oh
I want to display players' lives count (from the plugin) below their names
Can you show an example?
its to check if there is room in the inventory to add another item for auto pagination
Just like you did above but skip creating a team
not sure if there are specific methods for that, but I would loop the contents and filter out empty slots
I'm not too familiar with scoreboards 😦
thats straight up filly
k
ill do that
But every player has it's own lives count
or not
Yeah
The problem is a player can only be in one team at a time
You might cause conflicts with other plugins if you're not careful
wdym if I'm not careful?
Example:
plugin a; Creates a team for name colors
Your plugin adds lives count; Name colors no longer work
Actually again we don't need a team for this. Just create an dummy objective for each player and set the lives of that
like that?
public static void setUserLivesScoreboard(User user) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard scoreboard = manager.getMainScoreboard();
Objective objective = scoreboard.registerNewObjective("name", "dummy", "lives");
objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
objective.setRenderType(RenderType.INTEGER);
Player player = user.getPlayer();
objective.getScore("lives_" + player.getName()).setScore(user.getLives());
}
Hey guys
Why does
e.getAdvancement().getDisplay()
Throw a
java.lang.NoSuchMethodError: 'org.bukkit.advancement.AdvancementDisplay org.bukkit.advancement.Advancement.getDisplay()' error??????
ugh I hate working with scoreboards
me too 😵💫
That's probably not going to work either. Just use an existing plugin like TAB and add your own PlaceholderAPI
Looks like that method doesn't exist in the version you're running
I need it to work in my plugin 🥲
TAB is open-source go take a look at how it works I guess
But I'm running 1.19.1??
What version is your plugin developed on? If it compiles but doesnt run on the sever then you got something mismatching somewhere
Does anyone have any ideas for making a cooldown for a command?
Like methods for doing it
1.19.1
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Oh 1.19
but still
Store a HashMap of UUID/Long
Where long is the Epoch milli of the time they ran the command, look into the Instant class its really helpful for this
And where UUID is the players uuid
From there, just compare times and if time is == 30 seconds + the stored time then you know 30 seconds has passed, you can remove them from the hashmap and process the command right there
Your server isn't 1.19 or its not Spigot
you know what it makes sense alex was talking about some issues with advancments on paper a few days back
@hidden kestrel
also those 2 minor versions could of had a method rename too, may be good to check javadocs or just fully upgrade both sides
Its in both 1.19 and 1.19.1. Excactly the same https://hub.spigotmc.org/javadocs/spigot/org/bukkit/advancement/Advancement.html#getDisplay()
yeah likely on paper then
heh @tender shard we found your breaking change 😅 ^
How can show this screen with code ?
thanks
uhhhhhhhhhhhhh
or is it just a packet for freeze
entity metadata packets then
since when does this exist
might have unintended consequences
ever since the powdered snow was added
I feel like it's 1.17
tf
because entity metadata packet
i think so too
i never experienced this
its annoying
what does it do
had to shift all bit fields by 1
when you fall in it you can see shit
because we added a new field to all entity metadata
and it just freezes you and constantly damages you
ah
you find them in snowy biomes
but it looks cool
could be some mmorpg thing
they need a fire one
you can do funky shit
back to the minecraft mmorpg server idea
quick question, for the InventoryClickEvent, does setCurrentItem() set the itemstack before or after an item is moved to the cursor?
iirc doesnt that set the item currently clicked
setCurrentItem sets the item at the target gui
or last clicked
ignore me
and those are the values before the inventory changes
because the event can cancel
issa pain
inv api is a mess
if you set it just 1 tick below the max it doesnt damage the player
that work ! , but a event exist for when player take damage because that for cancel ?
well thats bad for my use case since I wanted to set item lore once a player cursor picks up an item, and setcursor is deprecated
wouldnt it still slow them tud?
getView().setCursor
it does
Yeah it may likely be unwanted
im new to this so getView() gets the viewer of the view where the click occurred? I was kinda confused with that and getViewers()
it returns the whole inventory view
top and bottom inv, whos the viewer
whats the cursor etc
can confirm its a 1.17 thing
its not on 1.16
back to building my reactor
alright that makes sense, thanks
what a weird name for npc pathfindings
nah its my mekanism reactor
i got tired of staring at a ide for 14 hours
fucking with packets
do you still have the walking strategy?
I might need to code A* into minecraft
ofc
I assume that HumanEntity can be casted to Player with no issue?
use olis with my path strat
well they wont target through walls sadly
the path strat will give up if no path found
does it support trapdoors
Usually yes. It might be worth to do an instanceof check
no
but yeah it does
well, i've never tested trapdoors or any kind of that
i never tested that
but i guess if its open 🤔
@opal juniper ever tested trapdoors?
its before you added instance based rules
nope
yeah i would've to adjust it anyways
I wonder how it would act here
since we started to implement rulesets
in what way doe? like walking over or thru
my path strat should go up the stairs
probably determine doors and trapdoors as solid blocks
i think they would be OTHER
by default tho it may do something whacky
it would bug here then
hmmmmmmm
you could test it
?paste
https://paste.md-5.net/hamujimife.java
This tries to avoid falling off cliffs and will try to avoid lakes whenever possible by an offset of 2 blocks
May not be best for performance but its async 
zombies pathfind up here and then get stuck because they can't yeet through barriers
instead of going around
like how tf
ollies should be fine with barriers
yeah it is, but if its the default it will also try to find holes in the barriers
or try to go above it if there is a hole
it needs 2 block high handling is all
then its perfect 👌
thats easy to add tho
there are literally no holes
so probably a "can stand here"
thats fine
only issue with my strat
it wont walk on 1x1 spaces
its scared to
like in the air
wait no
i fixed that
nvm
only issue i had with ollies pathfinding is sometimes
the blocks dont nail to the floor
so with packet based npcs they fly lol if your not handling physics
these stupid mfs
have a tracking range of 200 blocks
and still just decide to die
200??????
yeah
they also respawn if the target is further than 70 blocks
but what if there's no spawn point available
take entity -> teleport it to random location offset by 5-15 blocks
🤔
I've been working on this damn zombies project for 2 months
we had a meeting last week
guy died, fell through the floor and crashed the server
so we had another one 2 days ago fixing stuff
and the map would close doors you opened
if you got too far
👍
honestly you might want a custom strat for something like that
even different than mine
if you use ollies lib***
sorry
more like the block checker itself
I'd rather do like 3 hours of NMS reworking to get this to work
than to write a pathfinding algo
Is there a way to set a passenger entity leashed to a player? When I leash an entity and set it riding another entity, it removes the leash (with nms)
you dont need to write an algo
or tune an algo
dot
@opal juniper make it work on client side blocks 😄 (joking btw)
if it doesnt work on trapdoors it would be a rather easy fix
some trapdoors are closed
some are open
I use some as walls
others as decoration
try and see
youll never know without trying but
you have client side blocks
so it makes it way more complex
lol, thats not possible right
you dont know what blocks they have
it is if they make theyre own isValid handler
and store the blocks each player has but
jesus so much work
mfw you send API requests to the client :))
you can make an interface
if you look at the gist
I do track what players see what
You can make an interface which is like
but that is reliant on your plugin being the only one faking blocks as well
public Material getTargetType(LivingEntity target, Location location) { return location.getBlock().getType(); ]
fuck
PathLocation
I mean
BukkitMapper.toPathlocation(location)
ChunkSnapshots
or pass in your own PathBlocks
why doubles
abused the poor thing so hard
and location takes doubles
okay i am making a suggestion
ehhh okay I'll try
new PathBlock(1, 1, 1, PathBlockType.SOLID)
world goes brr
where else would the location be
it already has it no? for the pathfinder?
okay now
how the fuck do I make a zombie follow that path
without setting velocities every tick
okay so
pathblocks holds a pathlocation which holds 3 doubles and a pathworld
Couldnt Pathfinder just hold the pathWorld?

ik
not at the current state
that was most of my time spend using it
ah kk
i already thought about making the pathfinder instance based as well
and passing in 2 locations
worst part is like
the target is an entity
so you'd need to recalc path every tick or something
I like the PathFinder#pathfind(to fromt) imo
but nms also does that
yeah also recycling doesnt sound bad
i recalc every like 10ish ticks but im not in a small confined area
Can make PathFinder hold certain settings too
they are used for world domains @noble lantern
https://github.com/olijeffers0n/PatheticAPI/blob/bf3374490bed547ae33677e441551ca99aaf4e7a/pathetic-model/src/main/java/xyz/ollieee/model/snapshot/SnapshotManagerImpl.java#L33
that way you dont need to re-initialized
10 ticks*
Ahh
that could esily be put in pathfinder tbf
your never gonna switch world like pathfinding like that lol
unless you add support for portals
yeah i just noted that down
yeah that part is done
you are pathetic
it looks like the dude in the front is spawning over and over again
it sysouts, but then failes before the second
true dat
no error tho, just silent
so apparently sender is null causing an NPE
who would have known
not me cause java stupid and errored silently
ye its how the initialisers work
oh so you can initalize it like that without needing to override
didnt know that
everytime i tried it it just gave me options to override
yes and i like it
makes a whole anonymous class
why cant i paste pictures here
you're not verified
Is there a way to create an Entity or CraftEntity object or something of the sorts? I have some NBT i'd like to add to an entity before it is placed in the world, so it spawns with everything included.
wait wudaheq
new CraftEntity
type thing
its not sending some data eventhough i set it to
Oh, I see. I was so used to almost never instantiating anything in spigot that I didn't consider that.
Thank you.
^^
do yoru changes in the Consumer
not really that safe conestly
It should be
Will look at this
For some reason this exception crashes my plugin
ive got pom.xml and jar libraries so idk why it cant find it
this class exists in the jar
These look like manually added jars, not Maven
i tried maven, jars, both at the same time
Don;t use jars if you are using maven, unless you are forced to 3rd party jar.
if You manually add jars Maven will not see them.
allow Maven to do what its supposed to do
add scopes to your dependencies
and what is that sir?
removed jars and replaced with maven only
good
anything which is already on yoru server you can set as <scope>provided</scope>
public void diamondDropListener(ItemSpawnEvent e){
ItemStack item = e.getEntity().getItemStack();
if(item.getType().equals(Material.DIAMOND)){
removeIfOwned(item);
item.getItemMeta().setLore(null);
}
}
So this code block attempts to remove lore from items upon becoming an item entity
doesnt seem to work?
didnt fix anything still class not found
did you @eventhandler
Your dependencies need to be shaded into your plugin jar
Can someone help? Im not experienced in plugins, idk how to check if player is right clicking with my created item
its there
did you build using Artifacts or teh maven package menu?
for (short s = ...) 💀
that's bad?
micro optimizng ram
not really useful
ah right java is always by value not reference
and lack of item utilities
no getMeta() always returns a copy
or well i called a getter
@dense pine If you're developing for 1.16 or higher you can add com.fasterxml.jackson.core:jackson-core:2.13.3 to the libraries section in the plugin.yml or you can shade the dependency using the maven shade plugin
alright so here's a new problem which im not sure how best to be done:
calculating how many of x item was used in a craft that a player did
Checking CraftItemEvent, the getRecipe() method returns a recipe that has getResult(), which isn't what I'm looking for
another loop reducing the radius
Is the best method of doing this like, check the result and make a big switch statement with all possible recipes this item can be used for, returning the quantity of the item used?
What are you actually trying to achieve
essentially im just trying to keep a scoreboard of diamonds that have a lore tag with the player name on them
and i want players to lose score if that diamond is crafted with
so i need to detect 2 things:
- when a player crafts, did they use a diamond in the recipe?
- if so, how many diamonds to reduce from the scoreboard?
In the https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/CraftItemEvent.html you can see what is in the inventory when the item is removed
you only have to watch for your specific diamond
it isn't a specific diamond though, its any arbitrary diamond
I thought you just said, if they craft using a diamond with a specific lore with their name on it?
ah right, i guess i should explain that any diamond that a player picks up / picked up with a cursor gets tagged
essentially every possible way you gain a diamond in the player inventory will tag it and contribute to score
I think the easiest way would be what ElgarL suggested, check the top inventory, cast it to a CraftingInventory and then check its matrix for your diamond
one thing you would have to be careful of is checking whether the player has clicked normally to craft one or shift clicked to craft multiple
Yeah, shift clicking is a pain
realised my definition wasn't really correct*
i dont have lbiraries section in my pom
in your plugin.yml
ah
perhaps one easy solution would be to simply remove the score if a player places diamonds in the crafting grid
im blind sorry xDF
That's the new way of adding dependencies however it's been buggy for me sometimes
probably more hassle because a player could decide not to craft the item, and there's a lot of ways they could bail out of the inventory
leaving the game, inventory close, removing the items from the grid etc.
i do have the following measures in place:
- upon an item becoming an item entity, score is removed
- upon clicking on an item in an inventory, if it isnt marked as yours, mark and gain score
Does the player have to keep the diamonds in their inventory to keep their score?
nope
in that case, why not update teh score every 60 seconds. Count how many diamonds in each players inventory
no messing about with totals and crafting then
well that wouldnt count diamonds in chests no?
it would not
the player doesn't need to keep them in their inventory
Sorry I mis read and thought they had to carry them
this would be a lot easier if it was just carrying lol, could've been the job for a datapack
ok the libraries worked but how do i shade dependencies so ill know if ever need to
thanks btw
Wth is nms?
how are you currently building your jar? @dense pine
net.minecraft.server Mojang code
i include project artifact while building
So vanilla server?
vanilla source.
yes but are you using the command line / maven panel in intellij or are you using intellij build artifacts?
does anyone knows if you put a plugin in the plugins/update folder and you reload the server instead of restarting, the plugin also enables?
one solution would be:
- get crafting result
- get a case statement for each recipe that uses diamonds and assign a value of diamonds used
- remove quantityUsed * itemstack.getamount() of score
However, its impossible to know if a player crafted a Firework that used a diamond
use maven/ gradle
there's probably a way to do it through intellij but I can't check at the moment. If you wanted to shade the dependencies into the JAR in the future you would need to run mvn package either through intellij maven panel or command line
The link I sent also shows relocating the dependencies which is good practise so you aren't using a dependency in someone elses plugin
Right side of your screen, maven window -> lifecycles -> package


