![](https://forums.minecraftforge.net/uploads/set_resources_2/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Coder
-
Posts
94 -
Joined
-
Last visited
Posts posted by Coder
-
-
Just now, diesieben07 said:
On the client the EntityDataManager will only be updated with a subsequent packet.
What are you trying to do with this name?
I would like to target items with a specific custom name for highlighting etc
-
9 minutes ago, diesieben07 said:
EntityItem#getItem returns the ItemStack contained in the EntityItem.
This is a classic XY problem. In the future please state your desired result, not how you tried to get to that result.
Aha! But for some reason it returns "Air" instead on the item name
-
Just now, diesieben07 said:
EntityJoinWorldEvent fires when an entity joins the world. There are no item stacks involved. Please clarify which ItemStack you want to access.
I would like to get the name of every item that "joins" the world. Meaning the entity item that's on the ground.
-
Just now, diesieben07 said:
No, you do not. ItemStack#getDisplayName is public.
Sorry for me acting like a complete noob. How do I get this using entityjoinworldevent?
-
2 hours ago, larsgerrits said:
IIRC, ItemStack#getDisplayName returns the custom name if the stack has one. What else are you trying to do?
I think you need reflection for this
-
1 minute ago, diesieben07 said:
Uhm, what? Why are you doing that?
Please clarify what exactly you want to achieve. You should not have to replace the EntityDataManager.
Just get the custom name of the item.
-
20 hours ago, Draco18s said:
Sure
Spoilerprivate static final Field DATA_FIELD; static { { Class<?> clazz = Entity.class; Field f = null; for (Field field : clazz.getDeclaredFields()) { if (field.getType() == EntityDataManager.class) { f = field; break; } } f.setAccessible(true); DATA_FIELD = f; } } public static void setEntityDataManager (Entity entity, EntityDataManager manager ) { try { DATA_FIELD.set(entity, manager); } catch(Exception e) { e.printStackTrace(); } }
-
Hello,
I am using reflection to get an item's display name by replacing its data manager.
the only thing I am changing there is setEntryValues in which I find the itemStack and like this, I get the item display name.
Sometimes when an item spawns it will disappear client side but when I will walk to the item location I will pick it up. Is it possible that forge is removing the visibility of the item for some reason?
-
Is it possible to get a list of all the items inside a chest without opening it? (Client side)
-
3 minutes ago, diesieben07 said:
- Use UTF-8 everywhere.
- Tell the Java compiler you are doing so.
- Stop messing with formatting codes. Use ITextComponent.
I am getting text using .getName().getUnformattedComponentText() however, the server adds § to format the colors, I can't really remove it if I don't have access to how the server displays it.
Can I compare these two "getUnformattedComponentText" that have some formatting in them?
-
I am trying to find out if a formatted string is equal to something. When I open the game inside eclipse it works, but when I compile it, it doesn't recognize the § symbol. (my idea is it replaces it with �).
Can I do something about this? I really need the text with the formatting codes, it is stored inside a string variable.
-
2 minutes ago, diesieben07 said:
You do know Java, yes? Then you certainly know about access levels.
You need reflection.
oh right, reflections are no fun
-
1 minute ago, diesieben07 said:
So, you checked GuiChest, but you did not see what GuiChest#drawGuiContainerForegroundLayer does?
I did, but I couldn't manage to access upperChestInventory
-
9 minutes ago, diesieben07 said:
GuiChest already draws the name, look at it.
I checked GuiChest by itself and what e.getGui() gives, also e.getGui().getClass() , couldn't find it. I'm probably not even close
-
13 minutes ago, diesieben07 said:
Use GLStateManager.color. You might also need RenderHelper.disableStandardItemLighting (and RenderHelper.enableStandardItemLighting after you are done).
Sure.
Awesome it worked. I am fiddling around trying to figure out how to get the custom chest name. Should it be inside getGui()?
-
11 minutes ago, diesieben07 said:
You need to set the GL color to white.
I don't think I really know how to do this, do you have an example of this?
GL11.glColor4f(1, 1, 1, 1);
This is what I found but it does nothing.
Also, can I get the chest's custom name from this event?
-
Just now, diesieben07 said:
You have shown zero of your code.
ScaledResolution sr = new ScaledResolution(mc); String displayGUIText = "This is a place-holder"; e.getGui().drawString(mc.fontRenderer, displayGUIText, sr.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(displayGUIText) / 2, sr.getScaledHeight() / 2 - 85, 0xFFFFFF);
just some basic font render stuff, it's all inside the event listener I sent earlier. (DrawScreenEvent.Post)
-
2 minutes ago, diesieben07 said:
I'm sorry, what?
This should be white, 0xFFFFFF or §f. All colors appear darker than they should for some reason.
-
22 minutes ago, diesieben07 said:
That is not how you subscribe to Forge events.
Btw. why does text look dark there?
-
6 minutes ago, diesieben07 said:
That is not how you subscribe to Forge events.
Oh oops, how did that get there
-
45 minutes ago, diesieben07 said:
GuiScreenEvent.DrawScreenEvent.
@EventHandler public void renderChest(DrawScreenEvent e) { if (e.getGui() instanceof GuiChest) { System.out.println("ok"); } }
Doesn't work for some reason
-
I need to add text to the chest window when the name of the chest is equal to something.
I guess I need an event that fires every tick or so when you are inside a chest, and then render the text somehow above it.
Are there any good examples of the events I need to use in order to achieve something like this?
-
-
Hi, hello.
I need to send a chat message client side only. I do it like so sender.sendMessage(new TextComponentString...
I would love to know if there is a way of editing the message after it is already sent. Is this possible without rewriting the whole messages GUI class?
Reflection making items invisible?
in Modder Support
Posted
I would like to get the item that has joined, get its name, take that name check if it is included inside an array if so, tell me that this item is there and it has the said custom name.
I want to highlight items that spawn when you have many items on the ground it is very helpful. That's all.