ArmorStand

Discussion in 'Plugin Development' started by ewrs, Aug 23, 2018.

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

    ewrs

    Hello. I had two questions.
    1. How to fix a bug. When a player dies next to ArmorStand, he stops being invisible. How to fix it?
    2. How do I make Velocity for ArmorStand? So he jumped up.

    Sorry for my english, he's not the bes

    @Zombie_Striker
     
    Last edited: Aug 23, 2018
  2. Offline

    Zombie_Striker

    Do you mean the Player stops being invisible, or the Armrostand stops being invisible?

    Either way, that should not happen in the base game. Do you have any other plugins on your server that modfified what happens when players die?
    Armorstand#setVelocity() should be enough to change the velocity of the armorstand. Note that this only works if the armorstand has gravity, since the "nogravity" tag stops all velocity.
     
  3. Offline

    ewrs

    No, there is no plugin at death.

    Are you hinting at this? It does not work. Most likely, I did wrong ...
    Vector vector = new Vector(block.getLocation().getX(), block.getLocation().getZ(), block.getLocation().getY() + 5);
    stand.setVelocity(vector);
     
    Last edited: Aug 23, 2018
  4. Offline

    Zombie_Striker

    Again, which thing stops being invisible?

    1. Vectors Use the system X Y Z for velocity. What you're doing is seting the Y (How far up the player needs to go) to be the same as Z (how far north), and setting its Z (how fast to the north the player moves) equal to the Y +5. You're making the player go north, not up.
    2. You're getting the entities LOCATION, and setting it equal to the velocity, not getting the entities velocity/ the Vector to the block and adding Y. Basically, if the block is at 0, 100, 0, the player will just go north very fast regardless of where the player is. If you want the player to move towards the block, you need to subtract the block's location relative to the player's location, and use that vector as the velocity.
     
  5. Offline

    ewrs

    Players can see ArmorStand even with Visible (false)

    I'm not very good with English, maybe I'm not reading this way, but I absolutely did not understand anything .... Example?
     
  6. Offline

    Zombie_Striker

    @ewrs
    Can you post an image/screenshot of what the player sees when they die?
     
  7. Offline

    ewrs

    When a player is dead and not reborn, it happens:
    These hands are visible.

    http://i.piccy.info/i9/30a92e911b834d28f6764de4fee767c1/1535055868/29214/1265090/mi709.jpg
    http://i.piccy.info/i9/f6e5110d53df33e6ef362c7cadc8beb6/1535055918/36971/1265090/mi710.jpg

    And further. How can I fix this bug? When ArmorStand is created, the head does not have skin on it, but when it spawns twice, the skin appears.

    And one more question. How can I make my head smaller? On the screenshots above it is huge. I need her to be like this:
    http://i.piccy.info/i9/f03bfcb6ffdfc614cb3aa75ea3e89515/1535057618/27850/1265090/mi711.jpg
    http://i.piccy.info/i9/c9367b4fa555e63dfbba522296175b3c/1535057681/23697/1265090/mi712.jpg
     
    Last edited: Aug 23, 2018
  8. Offline

    Zombie_Striker

    @ewrs
    1. If the first two images were supposed to be a before image and after image, they both are visible. Also, does this happen with all of the armorstands, or just that one?
    2. For the head/skin issue, this has something to do with a bug for MC. There currently isn't a fix besides spawning it twice.
    3. As for the other bug, to change the size of an armorstand, you need to call setSmall(true) to make it small
     
  9. Offline

    ewrs

    Last edited: Aug 23, 2018
  10. Offline

    Zombie_Striker

    @ewrs
    1. If other armorstands stay invisible when the player dies, there may be an issue with the way you are creating that specific one. Could you post the code you use to create it?
    2. Well, setOwner requires the player's name, so you would just need to provide the name of the player's whose skin you want.
    3. ARMORSTAND.setVelocity(ARMORSTAND.getVelocity().add(0,5,0));
     
  11. Offline

    ewrs

    @Zombie_Striker, help...

    1. https://pastebin.com/JvYi1AML
    2. This site is only available for VALUE
    3. how can I slow it down? stand.setVelocity(new Vector(0, 0.5, 0));

    And how can I do this so that after he gets up, he does not fall, but stops?

    I thought for a while and made him rise and stay in the air. But why does he stay in different places all the time?
    http://i.piccy.info/i9/e6af394680f241a7df920d67cbe3ef27/1535115268/42312/1265090/mi714.jpg
    http://i.piccy.info/i9/72b30b377677eaec557780603eea8f59/1535115384/38228/1265090/mi715.jpg

    Code:
    https://pastebin.com/xfRW2SNd
     
    Last edited: Aug 24, 2018
  12. Offline

    Zombie_Striker

    1. What does the "Animate" line do?
    2. What do you mean? What is this 'VALUE'?
    3. You can slow the armorstand by reducing the vector's Y.
    4. Well, to make the armorstand stop, check if the velocity for the armorstand is less than or equal to 0 (which means it either stopped going up, or is going down), and if it is, set gravity to false.
     
  13. Offline

    ewrs

    @Zombie_Striker,

    1. It does the animation.


    public Animate(ArmorStand stand) {
    s = stand;
    }

    @Override
    public void run() {
    EulerAngle oldRot = s.getHeadPose();
    EulerAngle newRot = oldRot.add(0, 0.2f, 0);
    s.setHeadPose(newRot);

    }

    2. For example, I can not get this head by nickname, but I can by value
    https://minecraft-heads.com/custom/heads/decoration/22488-pufferfish-dispenser

    3. But in fact it does not rise above

    stand.setVelocity(new Vector(0, 0.01, 0)); # where even less ???

    4. What? Example...... Help :D
     
  14. Offline

    Zombie_Striker

    @ewrs
    1. Then I'm not sure why that armorstand is visible. Try removing all other code for that armorstands besides making it invisible, in case one of your other systems is making it visible again.
    2. Okay, so that is not a player's skin, but instead some NBT tag data. Use this util to change the skin using the texture data from the command on that site.
    3. It's not rising because 0.01 is a very small velocity. Gravity applied to the armostand should be something like 0.1 Make sure it is greater than that for it to actually go up.
    4. Here's some code:
    Code:
    ARMOSTAND.setVelocity(new Vector(0,4,0));
    new BukkitRunnable(){
       public void run(){
          if(ARMORSTAND.getVelocity().getY() <= 0){
              ARMORSTAND.setGravity(true);
          }
       }
    }.runTaskLater(MAIN,10);
     
  15. Offline

    ewrs

    4.
    new BukkitRunnable(){
    public void run(){
    if(stand.getVelocity().getY() <= 0){
    stand.setGravity(false);
    }else {
    stand.setVelocity(new Vector(0,0.1f,0));
    }
    }
    }.runTaskLater(Main.getInstance(), 10);

    He generally stands still ... (That code does not work either ...)

    UPD: He takes off super-high and falls ...
     
  16. Offline

    Zombie_Striker

    @ewrs
    By setting the velocity to 0.1 every 10 ticks, the armorstand will go up forever, since you are always making it go up unless it somehow manages to go down. Move the setVelocity line out of the runnable
     
  17. Offline

    ewrs

    @Zombie_Sriker, Not Worked


    new BukkitRunnable(){
    public void run(){
    if(stand.getVelocity().getY() <= 0){
    stand.setGravity(false);
    }else {
    stand.setVelocity(new Vector(0,0.1,0));
    }
    }
    }.runTaskLater(Main.getInstance(), 10);

    I need him to stand up a little and froze...

    And why on the same cubecraft the skin is always there, and I sometimes have Alex? ..
     
    Last edited: Aug 24, 2018
  18. Offline

    Zombie_Striker

    @ewrs
    Again, try moving the setVelocty method outside of the runnable, and change the 0.1 to something like 1, 2, or 3.

    For the skin, there are a wide variety of things that could cause this. For example, if your server is in offline mode there is a chance that skins may not be applied. Also, for older updates such as 1.7 and lower, the skins will now load because Mojang changed the skin system.

    Does it only happen on your server? If so, there is something about it, whether it be a change made to one of the settings or possibly one of the plugins that is causing it. If it is only you who experiences the problem, it may be something that was set by you/ a plugin that specially targets you for something that is causing the problem.
     
  19. Offline

    ewrs

    @Zombie_Striker, The server is empty. On it there is only this plugin and some more (WorldGuard and WorldEdit)
     
Thread Status:
Not open for further replies.

Share This Page