Solved Sheep #setSheared not working

Discussion in 'Plugin Development' started by ipodtouch0218, Nov 6, 2016.

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

    ipodtouch0218

    More problems... yeay!
    It seems that #setSheared on Sheep Entities does not do anything. Either this is a Bukkit issue, or a misunderstanding on my part. Setting it to both true or false results in the sheep keeping its wool.

    If this is incorrect, help on fixing? If not, how can I recreate this effect using NMS?

    Code:
    String[] values = {"false", "false", "15", "true"};
    
    boolean pickupItems = Boolean.getBoolean(values[0]);
    
    if (spawnedEntity instanceof Sheep) {
        Sheep sheepEntity = (Sheep) spawnedEntity;
        if (!Boolean.getBoolean(values[1])) {
            sheepEntity.setAdult();
        } else {
            sheepEntity.setBaby();
        }
        sheepEntity.setColor(DyeColor.getByWoolData(Byte.parseByte(values[2])));
        sheepEntity.setSheared(Boolean.getBoolean(values[3]));
    }
    EDIT: Added declaration of values String List.
     
  2. Offline

    Zombie_Striker

    @ipodtouch0218
    Since I can't find any other threads talking about this issue, It may be an issue with your server version. Have you tried using this method on Newer/Older server versions?
     
  3. Offline

    ipodtouch0218

    @Zombie_Striker
    I tried using 1.10 Spigot instead of 1.10.2, and now setAdult() and setBaby() doesn't work along with setSheared().
    :/

    EDIT: Wow... it was "Boolean.getBoolean()" instead of setSheared... just changed the check from #getBoolean to .equals("true");...
     
    Last edited: Nov 6, 2016
  4. Offline

    Zombie_Striker

    @ipodtouch0218
    If your problem has been solved, mark this thread as solved.
     
  5. Offline

    ipodtouch0218

Thread Status:
Not open for further replies.

Share This Page