Help with armorstand

Discussion in 'Plugin Development' started by 360_, Oct 4, 2018.

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

    360_

    So I'm trying to summon One armor stand at each yellow wool once run the command to start it instead of having just one armor stand each time I run the command. But I have no clue where to start with this. If someone could help me I would really appreciate it.[​IMG]
    For context, I'm trying to re-create this.
    Here is my code.
    Code (open)

    Code:
    public void TeaCups(Location loc, Player p) {
            //Location one = new Location(p.getWorld(), 780.500, 34, 1774.500);
                final ArmorStand cstand = (ArmorStand) loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
                cstand.setGravity(false);
                cstand.setVisible(false);
                cstand.setCustomName("E");
                cstand.setCustomNameVisible(true);
                //Vector vec = new Vector(0, 1, 0.5);
                final float radius = (float) 6;
                final float radPerSec = (float) 1;
                final float radPerTick = radPerSec / 30f;
    
            final ArmorStand stand = (ArmorStand) loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
            stand.setGravity(false);
            stand.setCustomName("Teacups");
            stand.setVisible(false);
    
            final ArmorStand creep = (ArmorStand) loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
            creep.setGravity(false);
            creep.setCustomName("Teacup");
            creep.setInvulnerable(true);
    
            final ArmorStand seat = (ArmorStand) loc.getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
            seat.setGravity(false);
            seat.setCustomName("seat");
            seat.setVisible(false);
    
            final Rabbit rab = (Rabbit) loc.getWorld().spawnEntity(loc, EntityType.RABBIT);
            rab.setGravity(false);
            rab.setCustomName("seat");
            rab.setLeashHolder(stand);
    
                ItemStack stack = new ItemStack(DISPENSER, 1, (short) 6);
                stand.setHelmet(stack);
                stand.setHeadPose(stand.getHeadPose().add(0,80,0));
    
                //
    
    
                    new BukkitRunnable() {
                        int tick = 0;
    
                        public void run() {
                            ++tick;
    
    
                            final Location center = cstand.getLocation();
    
                            Location loc = getLocationAroundCircle(center, radius, radPerTick * tick);
                            stand.setVelocity(new Vector(1, 0, 0));
                            creep.teleport(loc);
                            //creep.setLeashHolder(stand);
                            double x1 = creep.getLocation().getX();
                            double y1 = creep.getLocation().getY();
                            double z1 = creep.getLocation().getZ();
                            float yaw1 = creep.getLocation().getYaw();
                            float pitch1 = creep.getLocation().getPitch() - 90;
                            double x = stand.getLocation().getX();
                            double y = stand.getLocation().getY();
                            double z = stand.getLocation().getZ();
                            Location under = new Location(loc.getWorld(),x1,y1,z1,yaw1,pitch1);
    
                            stand.teleport(under.add(0,-10,0));
                            EntityArmorStand s1 = ((CraftArmorStand)seat).getHandle();
                            s1.setLocation(x,y,z,stand.getLocation().getYaw()-90,stand.getLocation().getPitch());
    
    
                            //drawLine(seat.getLocation().add(0,1,0),cstand.getLocation().add(0,2,0),0.4, Particle.SNOW_SHOVEL);
                        }
                    }.runTaskTimer(this, 0L, 1L);
        }
     
  2. Offline

    The_Spaceman

    If I understand you right:

    this is how I would do it:
    get the center of the ring. loop through a circle and test if the block is a yellow wool. if yellow wool summon armorstand an seat. save the uuids in a list. when the 'attraction' is placed create a Bukkit looping runnable. in that runnable teleport the seats in that circle. change the 'y' value each time. you can get the entities back using the saved uuids.

    I hope you understand it and create what you want to make
     
  3. Offline

    360_

    @The_Spaceman , I understand how to approach some of what you said but I'm not 100% sure on how to comply approach it / create it
     
Thread Status:
Not open for further replies.

Share This Page