Solved Making a Mob Crouch

Discussion in 'Plugin Development' started by LordVakar, Apr 15, 2014.

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

    LordVakar

    How would one manipulate a mob so it crouches and uncrouches?
    I know you would have to define everyone online as a variable and then play packet 28 to all of them I believe, which is PacketPlayOutEntityMetadata.
    How would I go about using this packet?
     
  2. Offline

    Codex Arcanum

    Can mobs crouch? I've personally never seen any evidence they can.
     
    The Fancy Whale likes this.
  3. Offline

    The Fancy Whale

  4. Offline

    97WaterPolo

    The Fancy Whale
    I believe ther is a method using NMs for .setSneaking(true); but not sure if it actually works.
     
  5. Offline

    The Fancy Whale

    Last edited by a moderator: Jun 7, 2016
  6. Garris0n likes this.
  7. Offline

    Garris0n

    LordVakar and AdamQpzm like this.
  8. Offline

    Codex Arcanum

    Well, I stand corrected, and I'm glad of it. Means that I can start using this myself. Still - I feel like your statement "That's just ridiculous, of course they can sneak!" is rather unjustified. Non-players never sneak in vanilla minecraft, and there's no reason it was certain that Mojang bothered to create code for it to work on non-player humanoid entities.
     
  9. Offline

    97WaterPolo

    LordVakar
    Just tested it, enjoy!
    Show Spoiler

    [​IMG]

    [​IMG]
    [​IMG]


    I have only been modifying zombie entities at the moment but I would assume it works for all mobs that are humanish looking like skeletons and creepers, etc.
     
  10. Offline

    VictoryShot

    This will spam the zombie too sneak.
    Code:java
    1. getServer().getScheduler().scheduleSyncRepeatingTask(this,
    2. new BukkitRunnable() {
    3. @Override
    4. public void run() {
    5. if (z.isValid() && !z.isDead()) {
    6. ((CraftZombie) z).getHandle().setSneaking(!((CraftZombie) z).getHandle().isSneaking());
    7. }else {
    8. Bukkit.getScheduler().cancelTask(getTaskId());
    9. }
    10. }
    11.  
    12. }, 0 , 1 * 2);
     
  11. Offline

    LordVakar

    97WaterPolo likes this.
  12. Codex Arcanum Aha, I'm sorry you didn't catch the joke. Did you read the thread? If you do, you'll see that, not long ago, I answered with the same thought that it wouldn't be possible. :p Because of that, I didn't really think it was ridiculous that you didn't know - I'd have to be a hypocrite to think that (and linking evidence to prove I was being hypocritical would be very strange indeed!)
     
    LordVakar likes this.
  13. Offline

    Codex Arcanum

    Ah, OK. I only skimmed the thread in a very cursory sort of way, and didn't pick up on that. Sorry for my overly serious response.
     
    AdamQpzm likes this.
  14. Codex Arcanum No problem at all. At least now we all know the wonders of sneaking mobs :p
     
    LordVakar likes this.
Thread Status:
Not open for further replies.

Share This Page