
AscendedKitten
Members-
Posts
23 -
Joined
-
Last visited
Everything posted by AscendedKitten
-
https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR3sfHoEiihxkitT61P1LbE5jhGOWdyBtLVel-lHwlZe6v9dgOx[/img] This is an example item; In order to know which "rarity" it has, I can either read the color (Aqua = "Legendary") or the lore, which states "Legendary Item"
-
In other words, you're writing a client-side mod to defeat the purpose and rules of a server (i.e. cheating). I think we're done here. You shouldn't try to judge before you know the whole story. It was more of an experiment at first, and after I was done I asked for allowance, which was given to me.
-
That'd be the lore, and that was also part of the original question. As I said, I didn't find a way to read it out properly yet
-
Do you have any better ideas?
-
All kind of items, ranging from weapons to slabs; the name is written in color, and as I didn't figure out how to properly read the lore yet, the only way to determine the "rarity" (RPG-server) of the item is to check the color.
-
Tried it using if (item.getEntityItem().getChatComponent().getChatStyle().getColor().equals(TextFormatting.DARK_PURPLE)) { , but without success
-
Thanks for the advice! The mod was written for a "RPG" server, where items dropped are unidentified, and there is no way to know which item you'll get unless you take it to a npc and so on, therefore this code is quite helpful for reading out the name of anything that's dropped nearby, to stop unecessary collecting of items.
-
Sadly, if (item.getEntityItem().getDisplayName().contains(TextFormatting.DARK_PURPLE.toString())) { doesn't seem to work either
-
Hey! Just a quick question; I've already tried playing around with the NBT compounds, but I can't seem to find out how to effectively save the lore of an itemstack in a String list. If anyone has an answer, I'd be delighted to hear it! Also, is it somehow possible to determine which colorcode was used in an itemname? I tried checking for the sign, e.g. ...contains("§5") but it doesn't seem to work.
-
This solution now works for me, I do hope I did it right this time package at.skyblok.client; import java.util.LinkedList; import java.util.Queue; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class WynncraftEvents { Queue<Runnable> queue; public WynncraftEvents() { queue = new LinkedList<Runnable>(); } void addTask(Runnable r) { queue.add(r); } @SubscribeEvent public void onPlayerUpdate(LivingUpdateEvent e) { if (e.getEntity() != null && Minecraft.getMinecraft().thePlayer != null) { if (e.getEntity().getDistanceToEntity(Minecraft.getMinecraft().thePlayer) <= 10) { while (!queue.isEmpty()) { queue.remove().run(); } } } } @SubscribeEvent public void onSpawn(final EntityJoinWorldEvent e) { if (e.getEntity() != null && Minecraft.getMinecraft().thePlayer != null) { if (e.getEntity().getDistanceToEntity(Minecraft.getMinecraft().thePlayer) <= 10) { if (e.getEntity() instanceof EntityItem) { addTask(new Runnable() { @Override public void run() { readItem(e.getEntity()); } }); } } } } private void readItem(Entity en) { EntityItem item = (EntityItem) en; Util.chat(Minecraft.getMinecraft().thePlayer, "Item: " + item.getEntityItem().getDisplayName(), TextFormatting.GREEN); } }
-
Sorry! To be honest, I never quite touched timers I know there is the update methode called once per tick, but how would I implement it in this case? Wouldn't it have to be "counted" within the EntityJoinWorldEvent?
-
Nevermind, used the wrong timer For everyone still seeking a solution, this one works for me! @SubscribeEvent public void onSpawn(final EntityJoinWorldEvent e) { new java.util.Timer().schedule(new java.util.TimerTask() { @Override public void run() { if (e.getEntity() != null && Minecraft.getMinecraft().thePlayer != null) { if (e.getEntity().getDistanceToEntity(Minecraft.getMinecraft().thePlayer) <= 10) { EntityItem item = (EntityItem) e.getEntity(); Util.chat(Minecraft.getMinecraft().thePlayer, "Item: " + item.getEntityItem().getDisplayName(), TextFormatting.GREEN); } } } }, 100); }
-
Tried that; it doesn't seem to do the trick. While it works in singleplayer (where it is fired twice, for some reason. One time with stone and one time with the right item), it doesn't work with multiplayer
-
Would a scheduler delaying the "reading" of the item work, or is there a second event used?
-
While the code is now working perfectly in Singleplayer, the item is always "Stone" in multiplayer. Is this due to the Server not passing on information about the item? Currently using @SubscribeEvent public void onSpawn(EntityJoinWorldEvent e) { if (e.getEntity() != null && Minecraft.getMinecraft().thePlayer != null) { if (e.getEntity().getDistanceToEntity(Minecraft.getMinecraft().thePlayer) <= 10) { if (e.getEntity() instanceof EntityItem) { EntityItem item = (EntityItem) e.getEntity(); Util.chat(Minecraft.getMinecraft().thePlayer, "Item: " + item.getEntityItem().getDisplayName(), TextFormatting.GREEN); } } } }
-
Thanks again! And sorry for my basic-questions, I am quite new to Forge modding, coming from Bukkit.
-
Thanks! In both cases, how'd I get the player-instance? As it is required to check in which radius of the player the items were dropped
-
Thanks! Final question: I assume I could get a list of all entities in a specific radius using the EntityJoinWorldEvent and check if they are instance of xyz entity? If so, is it also possible to get their data, e.g lore?
-
How comes I've seen it happend? This is a screenshot from a similiar mod, on the same server, purely clientsided http://puu.sh/q8nfq.jpg
-
I guess limiting it to a range is the only possiblity then? Still, I am not certain how I'd do that
-
I think it'd be more effective to check if the mob dying was killed by the user, as that'd require the user to be in a certain range.
-
The mod is supposed to enhance and provide extra functions for a server I play, e.g display the name of a dropped item before picking it up; I do know it is possible, but I wasn't able to find a client-side only solution myself yet
-
Hey! I've recently returned to developing Forge applications for version 1.9, but got stuck with some basic stuff. The mod I am trying to create is client-side only, and therefore the events working in Singleplayer are not triggered. Currently I list all items dropped when a mob dies (which was killed by the player) in the chat, but the LivingDropsEvent used in this case is (as expected) not triggering when used on a server without the mod. I am aware of the fact that it can't work the way I am trying, and would be delighted if someone could point me into the right direction. As this is a very basic scenario, I do not think it is neccessary to provide the code.