Solved Getting the Diode object.

Discussion in 'Spigot Plugin Development' started by Yugikid1, May 2, 2017.

Thread Status:
Not open for further replies.
  1. So, i was working on a plugin and stumbled across a issue . I was trying to get the diode object to get a direction. I tried casting its materialdata (since diode extends materialdata) ...ect but it always ends up giving me a ClassCastException.
    I have a block which im sure is a "Diode off" material. Could anyone assist me in casting that to a diode object so that i can get its direction.

    Thanking you,
  2. "Wanna get the Diode Object to get the direction" Eehh what? Maybe show us a small example of what you are trying, and your class stuff to understand what you tried so far.
  3. Hmm the thing im trying was
    Code (Text):

    Diode d = (Diode)Block#getState().getData();
    Also tried a few others such as,
    Code (Text):

    Diode d = (Diode)Block#getState();
    Code (Text):

    Diode d = (Diode)Block;

    Currently not at home Ill post my listener once im home. Basically what i want to do with the diode is
    So that i can assign that blockface to another diode.

    I was pretty sure that the proper way to cast the repeater to diode was the first once since the getData() returned MaterialData and Diode extends MaterialData. Also, im 100% sure that the block I am trying to cast is a repeater which is turned off.
    #3 Yugikid1, May 2, 2017
    Last edited: May 2, 2017
  4. Bump.
    Someone help?
  5. material#getBlockFace() ?
  6. Nope.

    Fixed it myself. Anythanks thanks to those who tried. <3
Thread Status:
Not open for further replies.