Using a bit mask in craft entities data watcher

Discussion in 'Plugin Development' started by SoThatsIt, Jul 19, 2013.

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

    SoThatsIt

    hi, i would like to know how i can use the bit mask to set values of craftbukkit classes using the data watcher. using this website you can see what datawatcher values you have to use to set certain attributes of different entities. what i am trying to do is set one of the values that has a bit mask. i am trying to set 20 in minecart to the block id and data. sorry if this is a bit confusing but if you go to the website you will see what i mean.
     
  2. Offline

    Cybermaxke

    Try something like this:
    Code:
    int id = ...;
    int data = ...;
     
    int value = id & 0xFFFF | data << 16;
     
  3. Offline

    SoThatsIt

    i am getting an error with the datawatcher that there is a duplicate for id 21. so, im guessing that i have to remove it, but i am not sure how i would do this, does anyone know?
     
  4. Offline

    Cybermaxke

    You need to use:
    Code:
    datawatcher.watch(int, value);
    instead of:
    Code:
    datawatcher.a(int, value);
     
Thread Status:
Not open for further replies.

Share This Page