EnchantPeek
EnchantPeek 0.9.9 - BETA
I got tired of waiting for an update to Thebombzen's EnchantView mod. So I went ahead and made my own enchantment previewer.
This plugin does not require a client mod!
How it works.
Barely... Getting to the relevant data and using it in any manner was quite a hassle. MC normally generates the enchantments on an item in the last possible moment, i.e. when you click on the button. To circumvent this i had to pre-generate the enchanted item when you plug it in the table, save the pregenerated items and then override the enchanting process. (Believe me, it's not pretty.) The enchantment values are then (temporarily) added to the the item's Lore which enables the client to display them in the item tooltip.
But how do I use it?
Easy, just plug the .jar in the plugin directory and give yourself and anybody else you want to access it the permission "enchantpeek.allow"
. Ops are allowed per default.
If you put an enchantable item on an enchanting table, the tooltip will be updated with 3 rows showing you what you get for the listed price.
Known problems
- The lore sometimes seems to stay in the tooltip until you close the enchantment table.
- There might be some caveats with books, those weren't tested very well.
Screenshots
And here is a small screenshot "tutorial" which visually explains how this works.
i'm getting an UnsupportedClassVersionError : Unsupported major.minor version 51.0
Hey folks,
I just pushed a version compiled again CB 1.6.2. (Waiting for approval)
Since I'm currently stuck on an old, crappy Laptop which is in no way able to run bukkit or minecraft at all, this build is completely untested. I literally just changed 3 import lines and recompiled.
Since EnchantPeek doesn't do much, I'm reasonably certain that it will "just work"™, but you should test it on a server that you are prepared to throw away and/or restore from backup before putting it into production.
Yeah an update for 1.6.2 would be awesome :O
What about an upgrade to 1.6.2?
David
@Vrael_Soulrift
I don't think this is possible. As soon as the player opens the enchantment table, we're pretty much in a "locked" state with very few ways out except "cancel" or "enchant NOW". I can't create GUI elements server-side and afaik all the currency plugins work via the chat API so it would have to be a very roundabout way to get this working. (I also want to keep this plugin as lightweight as possible without having any dependencies. As of now I have to change 4 lines to update for every new CraftBukkit release, that's already 4 lines to much.) ;)
@C0nsoleMC
There must be something wrong with your eyes. :D
@fuzyfeet
Looking into it. It's possible but I see a few technical difficulties. EnchantPeek specifically avoids going around what CraftBukkit already does to make enchantments (so I don't have to change anything if mojang tweaks the algorithm and to keep it as "vanilla" as possible, while EnchantmentAPI is, naturally, all about going around Craftbukkit and making it's own enchantments.
We also both work with the lore part of the items in question since there is really no way to muck about enchantments any other way. A lot of this is hardcoded inside Minecraft :(.
now this looks awesome, i hope you keep this up to date :)
I love that things like this are becoming possible on bukkit. Is there a way you can get this to work with the EnchantmentAPI plugin? I will also post a similar comment there.
i guess there isnt any way you could add a config so that people can only see them by paying a certain amount of money
thanks anyway if its not possible, vrael
Oh god, there's a PrepareItemEnchantEvent? Who knew? XD Anyhow, that code looks pretty nice. Good work.
@pablo_horcajo
Just uploaded a new file. Not tested, I just recompiled it with the new CB.
@Senophoe
Sorry, no. The buttons basically don't exists from a server point of view. You need Thebombzen's EnchantView mod to do that.
Can't you make it so, instead of showing the enchant options in the weapon itself, show the enchants when you hover your mouse over 1 of the 3 enchant options?
Please update the plugin, this is my favourite plugin
@Mustakyy8
Source link is now in the description. Beware, it's far from pretty.
@Mortico8
In all my tests it worked as expected, but by the way it blunders about I wouldn't be surprised if there are conditions which break it.
The enchantment shown in the tooltip is generated as soon as you put the item into the slot and then saved together with your player. This enchantment then overrides the one created by bukkit when you click a button. Are you sure you looked at the correct level? It always generates all 3 enchantments, even when you can't afford all.
One known caveat is that it'll go haywire when your XP changes between putting the item in and clocking a button, i.e. picking up floating XP-bubbles while standing there or using server commands. Since I'm to lazy to code around that I just declare it intended behaviour :D.
Exactly what I've been looking for. no need for client side mods with this one. Now to see what the other admins think before we implement it lol
I actually like this mod better than Themobzen's because it takes a lot less to install it, rather than installing 2 APIs, a client mod and a bukkit plugin, I just do the bukkit plugin.
But I've encountered a bug, Sometimes the enchantment it tells me will be given is wrong. Twice now I have clicked to get Unbreaking 3 and Feather Falling 4 and gotten something completely different. Instead of Unbreaking I got Fire Protection and instead of Feather Falling I got Smite 4.
Are you planning on continuing to develop this mod, If so I'd like to continue using it.
So much simpler than Themobzen's!
Good job!
I did try to code the same thing actually but could not get it done. It was interesting to read your method in "How it works". Will definitely check the source if you put it up.
possible to create an external language file? i just modded/translated the class for my own server but it would be easier to do this with an external (maybe multi-language) file.
Except of that -> nice work! :)
@KurinPawpad
That sounds like you're using an old Java version. EP is built with Java7.
I cannot get this to work with the 1.5.1 beta build of bukkit. It throws a traceback of major.minor version incorrect.