[IDEA] Roman Numerals for Enchants Over 10

Discussion in 'WIP and Development Status' started by Blah1, Nov 20, 2013.

Thread Status:
Not open for further replies.
  1. Offline


    (I have no clue if this has already been done)
    So I've had this idea for a while:
    Make a plugin where you can enchant items and that they show roman numerals for enchants even over 10.

    Quick example:


    btw this is just a displayname and a lore.

    So this is enchantment level 12. It looks so much better than enchantment.level.blahblahblah

    I think that making a plugin that could do this would be really cool.
    We could use ProtocalLib for the enchantment effect.
    The only tedious part would be to actually go in and make all the enchantments work. I'm sure that it won't be too hard if we can get a hold of the formulas Mojang uses for enchantment as they increase.

    I've never really teamed with anyone for coding and I don't think it will be all that fun :p
    Just putting this idea out there and I may start it like next week...who knows.

    So, what do you guys think and do you think that people will actually like it?
  2. Offline


    I think theres a way like i have seen people create their own enchantment you could create a "Sharpness" as a new then you set lore to XII (it think)
  3. Offline


    It's possible but not really worth the effort...
  4. Offline


    Rayzr522 and Garris0n like this.
  5. Offline


    Although it works, it's pretty messy as you're writing code for IV, V, etc instead of actually teaching the code what I before a letter means.
  6. Offline


    macguy8 What would be the point? At best, one could write an implementation with the different units, but it still feels crude. Also, it would produce exactly the same result at a slower rate:

    enum RomanUnit {
        I (1, 'I'),
        V (5, 'V'),
        X (10, 'X'),
        L (50, 'L'),
        C (100, 'C'),
        D (500, 'D'),
        M (1000, 'M');
        // fields
        RomanUnit (int value, char letter) {
            // set values
        public float percentage () {
            return index() % 2 == 0 ? .9F : .8F; // Every other unit is 5 times more than the previous
        public boolean unitOfFive () { return index() % 2 == 1; }
        private int index () {
            for (int i = 0; i < values().length; ++i)
                if (values()[i] == this) return i;
            return -1;
        private static RomanUnit greatestUnit (int value) {
            for (int i = values().length - 2; i >= 0; --i)
                if (values()[i].value >= value) return values()[i + 1];
            return RomanUnit.I;
        public static String convert (int value) {
            StringBuilder result = new StringBuilder();
            // 1792 = MDCCXCII
            /* First iteration = RUnit.M;
              * Second iteration =  RUnit.D;
              * Third / fourth iteration = RUnit.C;
              * Fifth iteration: RUnit.X, but 92 of 100 is over .9, so insert X and then C
            do {
                RomanUnit unit = greatestUnit(value);
                int id = unit.index();
                value -= unit.value;
                if (id < (values().length - 2)) { // We don't do "Roman subtraction" with D or M
                    if (value / values()[id + 1].values >= values()[id + 1].percentage() && !unit.unitOfFive()) {
                        unit = values()[id + 1];
                  } else if (value / values()[id + 2].value >= values()[id + 2].percentage()) {
                        unit = values()[id + 2];
          } while (value > 0);
            return result.toString();
    I'm not entirely sure this even works - if it does, wow. However, you can see how much of a pain it is to actually employ this - it seems a lot easier to introduce bugs than when one uses a simpler (and more reliable) method.
  7. Offline


    True, maybe, for something like Bukkit development, but in real life development, you'd have to use a situation that works for all setups, not just "with a few bugs"
  8. Offline


    Not sure what you're getting at here. Simple, dumb, readable, and fast code is almost always better than smart and clever code. His initial example is a perfectly acceptable way to do it. There's no reason to "teach" the code what I before V means.
  9. Offline


    it much more viable to indicate enchant levels in classical arab numbers...
  10. Offline


    I would love to see this. Do you think it's possible to hide the "enchantment.level.x" and replace that with a lore that gets the enchantment name, and then adds a roman numeral based on the number?
  11. Offline


    It's probably client sided and would require telling the player there's a fake enchantment on it to get the glow then adding lore (through ProtocolLib for safety).
  12. Offline


    looking at it this way it would be easy to do although you would run into a problem when actually applying the enchantments because in order to remove the enchantment lore you must also remove the enchantment. one fix i can think for this is to listen to the packets where it sends the player his nventory or any item changes using protocol lib and then edit the item that is sent by removing its enchantments, adding the fake enchantment and then setting the lore.
  13. Offline


    That's...exactly what I meant.
  14. Offline


    yeah i know i realised that as i finished my post xD didnt really think it through to be honest :p
  15. Offline


    Etian likes this.
  16. Offline


    bobacadodl Thanks! Aww dang, only up to enchantment levels of 4000? lol jk. Thanks, I'll be sure to test it out tomorrow.
Thread Status:
Not open for further replies.

Share This Page