Rainbow sheep (help)

Discussion in 'Plugin Development' started by Nojus, May 2, 2014.

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

    Nojus

    How do i spawn a rainbow sheep ? I wan't to spawn a rainbow sheep and name it something like: "Colorful sheep".
     
  2. I dont think that this is possible without having lots of code. Maybe you can name a sheep spawn egg jeb_ and find a way to give it a 'fake name'
     
  3. Offline

    Nojus

    I saw it in one server, and i don't know how they did that.
     
  4. Nojus

    They named a spawn egg of a sheep jeb_ with an nametag
     
  5. Offline

    Nojus

    bramhaag

    No, its named Sir Sheepie go and check it out ip: playmc.cc
     
  6. Nojus

    Ask the owner or admin?
     
  7. Offline

    Aqua

    Nojus
    They do it by chaning the color every few ticks.
     
  8. Offline

    Nojus

    Aqua
    How can i do that?
     
  9. Offline

    Aqua

    Nojus
    Create a BukkitRunnable.
    Create a sheep.
    Create an array of sheepwool colors in the order you want the sheep to change colors.
    Create an int variable which is used as indicator.

    Inside the runnable;
    check if variable equals arraylength, if so, set variable back to 0.
    get color from array using the variable and put it on the sheep.
    increase int variable by 1.
     
  10. Offline

    Nojus

    Aqua
    Can you make the code, i don't really understand what you said.. (My english is not really good)
     
  11. Offline

    Funergy

    we don't make a plugin/code for you. you need to learn it by yourself. so what I mean you can begin with making the code and when you have found something that doesn't work, then can you post it here.
    here is something that can help you
    Code:
    Sheep p = Bukkit.getWorld("world").spawn(
                            e.getPlayer().getLocation(), Sheep.class);
                    p.setCustomName("§cSwagg");
                    p.setCustomNameVisible(true);
     
    GrandmaJam likes this.
  12. Offline

    bennie3211

    Is it possible to set the color of the sheep to all possible colours without NMS?
     
  13. Offline

    DxDy

    Doxygen
     
  14. Offline

    Nojus

    Code:java
    1. Sheep p = Bukkit.getWorld("world").spawn(player.getLocation(), Sheep.class);
    2. p.setCustomName("§cSwagg");
    3. p.setCustomNameVisible(true);
    4. p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, Integer.MAX_VALUE));


    Its working but server crashes when i spawn it.. Why? It says: Internal Exception: io.netty.handler.timeout.ReadTimeoutException
     
  15. Offline

    bennie3211

    DxDy that can only change it to the 16 values that mc has (wool colors), or not?
     
  16. Offline

    Aqua

    Nojus
    The error means the connection between client and server timed out.
    This error happen with bad internet connection or the server crashing.
     
  17. Offline

    Nojus

    Aqua
    Well then it crashed becouse i host server localy.
     
  18. Offline

    DxDy

    If you believe that those crashes are connected to your plugin, we need more data. For example any excpetions that pop up, the server crash logs, ...
     
  19. Offline

    Nojus

    DxDy
    Server just freezez and i can't do command or see anything like errors.

    FIXED IT :p

    So can someone make the code?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  20. Offline

    itzrobotix

    Make it yourself we're not your pets.
     
  21. Offline

    Nojus

    I made this:
    Code:java
    1. BukkitTask runnable = new BukkitRunnable() {
    2. int colors = 16;
    3. @Override
    4. public void run() {
    5. colors -= 1;
    6. p = world.spawn(loc, Sheep.class);
    7. p.setCustomName("§aS§bp§ca§dl§ev§fo§at§ba §favis!");
    8. p.setCustomNameVisible(true);
    9. p.setColor(dyeColors[colors]);
    10. p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000000, 1000000));
    11.  
    12. if (colors == 1) {
    13. colors = 16;
    14. }
    15. }
    16. }.runTaskTimer(this, 20L, 20L);

    now inside that i need scheduleSyncDelayedTask but i can't put that there... (to remove the sheep after some time) any sugestions?
     
  22. Offline

    DxDy

    Make your runnable a proper class and store the reference to your sheep instead of spawning a new sheep every second ;)
     
    GrandmaJam and Nojus like this.
  23. Offline

    Nojus

    DxDy Thanks. It works!! But i can push the sheep around how to stop that?
     
  24. Offline

    CheesyFreezy

    @Nojust,
    use the EntityMoveEvent. Cancel it
     
Thread Status:
Not open for further replies.

Share This Page