Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved ChargedCreepers and ExplodingCreepers

Comments in 'Plugin Development' started by ImagicalGamer, Jun 17, 2016.

  1. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    I have another Entity question, how can I spawn a charged creeper? Or better, how can I charge a creeper? I'm spawning an Creeper Entity to one player and I want to charge it and then make it explode a few seconds later, I can do the wait task for however long I want to wait before exploding but how can I do both of those things?
  2. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    EDIT: Can I set it in the meta data? When I'm spawning the creeper?
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Testing is essential part of programming.

    PHP:
    $this->namedtag->powered = new ByteTag("powered"$powered 0);
    $this->setDataProperty(/*self::DATA_POWERED*/19self::DATA_TYPE_BYTE$powered 0);
    Add this to NBT
    PHP:
    $nbt["powered"] = new ByteTag("powered"1);
    Note: boolean is alias to byte, false represents 0 and true represents 1.
    Last edited: Jun 17, 2016
    applqpak likes this.
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    That crashed my server. I actually tested that before and it worked for me in 0.12.0 lel
  5. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    I don't see any reason why it should crash, except for client side :eek:
    applqpak likes this.
  6. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    *ByteTag
    applqpak likes this.
  7. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    Dislike.
    Boolean is not alias to byte. A boolean is represented by a Tag_BYTE in NBT, but that doesn't mean that a byte is necessarily a boolean.

    A boolean basically refers to the data type that is fundamentally one-bit long, which can represent either true or false, or technically, 1 (on) or 0 (off).
    A byte refers to the data type that is normally 8-bit long (1-byte long) (I forgot where I read it: bytes are actually 9 bits long, with the 9th bit for checksum or something like that; citation needed please, can't google that), which can represent a range of 256 values, namely 0 to 255, or -128 to 127, inclusively.

    In Minecraft NBT, the Tag_BYTE also has its uses apart from storing booleans. For instance, according to http://minecraft.gamepedia.com/Player.dat_format#Potion_Effects, status effects are stored in Tag_COMPOUNDs that contain a Tag_BYTE for storing the effect ID. Therefore, bytes are not equivalent to booleans.

    In addition, when we want to store an array of booleans, we use a bitmask. See http://php.net/chmod for example; it should be the most known example of bitmask. (Hopefully everyone here knows the chmod command in Linux, and knows something more than "chmod +x file") In this case, a data type of larger size, such as a Tag_LONG with 64 bits, can be used if we want to store 64 booleans in one tag.

    In conclusion, byte ∉ boolean, and boolean ∉ byte. (∉ is the mathematical symbol that means "not in the set of".

    P.S. Once upon a time, I heard my teacher said that 1 is "on" and 0 is "off", so I naively thought that 3 is "sleep" and 4 is "hibernate" and 5 is "reboot", etc. :(
    applqpak and Survingo like this.
  8. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Sorry Chris, I shall Google it to approve the information I post next time :D

    Edit: I probably meant - boolean represents a one bit (0 - false, 1 - true). I have to be true this time right?
    Last edited: Jun 18, 2016
    applqpak likes this.
  9. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    Chris? My name is not Chris.

    Boolean represents one bit, but technically it is difficult to write one bit into a file without filling the other 7 bits, so it is often represented as a byte.
    applqpak likes this.
  10. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Who is Chris?
  11. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    PEMapModder.
    PocketKiller and applqpak like this.
  12. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Isn't @Primus Chris too?
    Last edited: Jun 19, 2016
    applqpak likes this.
  13. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    Gamecrafter and applqpak like this.
  14. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    I am not Hotshot.
  15. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Does anyone wonder why "not @PEMapModder" is so familiar with all @PEMapModder repos and knows PocketMine so good? Even in your signature You claim to be incognito user, I would be too in his place (yes I read the whole signature). I doubt that you're an 78 year old female anyway.

    @Gamecrafter mentioned that @PEMapModder name was Chris. I can't find your Github profile but I'm 80% sure It's new.

    As @Hotshot_9930 confirmed, your status proves nothing :D

    Anyway, @PEMapModder PocketMine needs you.
    Vaivez66 and applqpak like this.
  16. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Either he/she is @PEMapModder, or just someone intentionally trying to lead people on and/or troll. Either way, @SOFe is an interesting character.
    SOFe, applqpak and Primus like this.
  17. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    @PEMapModder was clear that doesn't have time for this junk now.
  18. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    What does that have to do with my post?
  19. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Sorry wrong quote :p
  20. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    It is an honour that you would compare me to @PEMapModder, but I'm afraid that you can't eliminate the possibility that I am just someone closely related to @PEMapModder, but not @PEMapModder itself.

Share This Page

Advertisement