Coder
-
Posts
94 -
Joined
-
Last visited
Posts posted by Coder
-
-
16 hours ago, diesieben07 said:
Check Minecraft::ingameGUI.getBossOverlay().mapBossInfos (you'll need reflection) for changes every tick.
is mapBossInfos a thing? can't find it.
-
I know this sounds a little weird, but I would like to have an event listener for when the boss name in the boss bar on the top of the screen is changed. This is a client-side only mod so I can't do anything with the server to inform the client about a name change.
Is it possible that there's a listener for something like this?
-
1 minute ago, diesieben07 said:
Yes. You'll probably have to use EntityJoinWorldEvent to detect the player joining.
Alright makes sense.
-
I am trying to send a client-side message to the user upon successful connection to any Minecraft server.
I am listening to ClientConnectedToServerEvent, when it happens I use player.sendMessage() to send a client-side only message. Unfortunately, I get a null pointer exception when doing so.
Can it possibly happen because it sends the message too early?
-
26 minutes ago, V0idWa1k3r said:
You would need to iterate through all inventory slots and check if each one of them is empty incrementing some counter if it is.
To clarify - you would need to iterate the InventoryPlayer#mainInventory list.
Awesome, thanks.
-
I am trying to get the number of how many empty inventory slots there are, we are talking about hotbar + regular inventory, without armor and without the second hand.
Just all of these: http://prntscr.com/jh0ucf
I tried using
player.inventory.getFirstEmptyStack()
But as you can tell it will tell me if there is any space in the inventory, not how many slots there are empty.
-
Got it. Thanks guys.
-
1 minute ago, diesieben07 said:
What are you even talking about... Yes, you can "target the entry and change it". I told you which method you need to use like 5 times already. You failed to mention why it does not work for you.
And I fail to understand how this is in any way useful. If you are unlucky your change will not even survive for one tick.
That's what I don't understand here. How can I get the full Lore array modify it and set it back again, without messing around with the "Name" or anything else.
As I said, it's inside display and inside Lore, how can I get it using the other stuff you mentioned, from what I see there you enter the nbt comp and an index.
-
Just now, diesieben07 said:
The data is going to get overridden by the server as soon as you move anything in your inventory.
I know, it's fine. I just want to know how to change it for the moment.
It would be much easier if I could just target the entry and change it. But looks like it's not possible, thus meaning I need to recreate the nbt compound.
-
Just now, diesieben07 said:
No.
You cannot change the NBT on the client. At all.
Changing the Lore client side? why not? I just did it.
-
2 minutes ago, Draco18s said:
No.
So I should just recreate it. Alright.
-
Let's say I get the tag comp from ToolTipEvent.getItemStack().getTagCompound(), then store it inside a variable.
Can I change one entry inside that array and push it back to the tag compound?
-
Just now, diesieben07 said:
You say "set by server". Does that mean you are writing a client-only mod? If so, this cannot work. You could set it temporarily for this specific client using ItemTooltipEvent. If you want to actually change the NBT in the stack, it must be done on the server. And in that case I still do not understand what the problem with the proposed method is.
Yeah I know, I would like this to be client side only for the session only (or to whenever the server changes it).
-
1 minute ago, diesieben07 said:
I am sorry, but I am not quite following what your issue is. The set method I mentioned sets the entry at a specific position in the list.
I would like to change one Lore array entry inside an existing item (Lore set by server, not in my control), so I get the ItemStack and what I would like to do it enter display > Lore > index of my choice, and set it to something else.
-
40 minutes ago, diesieben07 said:
NBTTagList has a set method which you can use.
Is there a way I can edit the exact entry?
Doesn't that mean all other tags will be deleted? Or you can somehow directly go to the Lore taglist
-
I am getting the nbtcompound from ItemStack, and I would like to edit one entry in the Lore array without needing to recreate everything..
Is editing one entry in the Lore array inside the item NBT possible? Perhaps somehow converting the existing nbt to a variable and changing it that way?
-
8 minutes ago, loordgek said:
why from the web
Latest version number, other config parameters etc
-
Hi guys,
I was wondering the other day when would be the best time to load a configuration file (probably in a JSON format) from a web API.
PostInit can be an option, but do you think there is another better way?
-
I am trying to get information about an item entity via listening to EntityJoinWorldEvent.
When there is a new item on the ground I get a confirmation in the console, but when I try getting the items data entries I an array of these:
net.minecraft.network.datasync.EntityDataManager$DataEntry@79d5182f
Can I somehow view what these are?
I get these via event.getEntity().getDataManager().getAll()
-
10 hours ago, diesieben07 said:
EntityItem::getItem gives you the ItemStack.
Can I get this using the EntityJoinWorldEvent?
This is what I managed to do so far:
@SubscribeEvent public void entityIn(EntityJoinWorldEvent event) { if (event.getEntity() instanceof EntityItem) { System.out.println("New entity item "+event.getEntity()); } }
-----
10 hours ago, Draco18s said:Oh, oops!
-
2 minutes ago, Draco18s said:
...what?
Imagine there's an item on the ground right (Entity)
I would like to get that items lure (the text people can add to items using command blocks) or just the custom name of the item if you anvil it for example.
-
I am trying to get the name (custom name that is not the original item name) and the item lure from getDataManager().get when the item spawnes.
I need some sort of a key to put inside getDataManager().get but I don't know where can I find all the possible keys.
-
Hi,
Is it possible to get the items NBT information while holding it?
(when hovering above items there is a text that says how many tags are there inside the item, but I would like to know what's inside those tags)
-
Hi,
I am trying to make it so the player will be able to see an item's name when the item is on the ground. All I found in the EntityItem class is the getName() but it just gives me the name back, nothing else.
Can I somehow iterate though all the item entities there are and enable the Display Name parameter like in the vanilla /entitydata command?
Thank you.
Boss name change event listener
in Modder Support
Posted
Btw, did it change? I remember getting Boss name in 1.11.2 was much different