CoreNetwork / Mantle

The main plugin powering majority of features on Flatcore
1 stars 1 forks source link

Allow to define Nanobot templates for Compass and its GUI #291

Closed riddle closed 9 years ago

riddle commented 9 years ago

I want every compass to display information in its label what to do with it. It can be applied when normal compass enters inventory, no issue with that.

When used, Compass should have a dynamic template when hovered displaying distance in its name and selected category in label. I can make a Nanobot template, just need variable support. ProtocolLib can be used to make it dynamic.

On top of that, separate templates for the GUI itself:

  1. Enabled / disabled markings in window (glass pane and barrier)
  2. Every category (out of 8)
eliadil commented 9 years ago

NBT for gui items is already in, just as in beacons, put image

riddle commented 9 years ago

Awesome 😃

eliadil commented 9 years ago

Is this all from this issue? I dont really get what the first part means - should every compass have custom nbt added by default? Also, it already has custom "name" on move/display.

riddle commented 9 years ago

I dont really get what the first part means - should every compass have custom nbt added by default?

Yes, through ProtocolLib, using Nanobot template. Look at how spells use dynamic templates. Otherwise there is no discoverability of this feature.

matejdro commented 9 years ago

@eliadil Can you continue here? You know better where you store wanted data.

Just add bunch of NanobotUtil.replaceStringInItem here: https://github.com/CoreNetwork/Mantle/blob/development/src/main/java/us/corenetwork/mantle/restockablechests/CompassProtocolListener.java#L70

(For example like here: https://github.com/CoreNetwork/Mantle/blob/development/src/main/java/us/corenetwork/mantle/beacons/GUIBeaconStatus.java#L104)

eliadil commented 9 years ago

Sure, I'll think what to display & when ;] Thanks for help.

eliadil commented 9 years ago

Not sure at this hour, but I think nanobotUtil.replacestringinitem returns a copy of item stack. Wouldnt that require changing item in players inventory?

I copypasted needed code directly to compassProtocolListener for now.

matejdro commented 9 years ago

Right, completely forgot about that. There was reason why I copy it though (which I also can't remember right now, damn).