Make client side armour stand not be shaded when is set to a marker.

Discussion in 'Spigot Plugin Development' started by Jonnyo101, Mar 23, 2019.

  1. Hello.

    I am spawning a client side armour stand to a player and using
    .setMarker(true); to allow the player to click where the armour stand is and trigger the playerInteractEvent
    how ever the armourstand will be shaded block if it is in a block.

    (with marker set to true)
    [​IMG]
    (without setmarker)
    [​IMG]

    Is there a way to stop the armour stand from being shaded black ?
     
  2. Choco

    Moderator

    I struggled with this exact issue and I couldn't figure out a good solution. The reason this occurs is because declaring an armour stand as a marker sets its hitbox to an incredibly small hitbox in the bottom left corner of the entity. Because of this, the entire hitbox is encapsulated by whatever block it's standing in and the server says "well, your hitbox isn't visible and you have no access to sunlight, so there's no sense in lighting you up". I tried changing the hitbox server side but this hadn't worked either because the client had a different idea of what the hitbox was, so I'm not sure if there is a way to fix this.
     
  3. Yer i tried the same things.. The reason i am setting the armour stand to a marker is to allow the player to be able to right click at the armour stand and the player interact event trigger. Without the armou stand set to a marker when you right click the player interact event will not trigger.
    Do you know of a way to detect is the player is right clicking even if there is a armour stand in front of the player. ?

    Or if is this is a bug with the player interact event ?
     
  4. Choco

    Moderator

    You'll want PlayerInteractAtEntityEvent instead if you're just trying to check for an interaction when an entity :)
     
  5. Yes i tried this.. This did not trigger.
    I am using a client side armour stand using packets.
     
  6. Choco

    Moderator

    Well then of course it won't trigger because it's not server-sided! ;P That's how the events work! I'm not sure a packet will be sent to the server if a client-sided entity is clicked, though if one is you're likely going to have to sniff it out using ProtocolLib.
     
  7. Okay i will have to listen to some packets and see if it is detectable.
    i will add a update if i can detect it.
     
  8. Okay figured out you can detect clicking on fake entity's by listening to the PacketPlayInUseEntity

    Snippet of what i used
    Code (Java):
           @Override
                public void channelRead(ChannelHandlerContext channelHandlerContext, Object packet) throws Exception {
                    if (packet instanceof PacketPlayInUseEntity ){
                   
                        PacketPlayInUseEntity packetPlayInUseEntity = (PacketPlayInUseEntity) packet;
                   
                        if (packetPlayInUseEntity.b() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT_AT){
                        new Task(TaskType.BUKKIT_THREAD_RETURN, () -> buildingManager.getStructureManager().getStructureBuild().BuildStructure(player)).Cache().Send();
                        }

                    }

                    super.channelRead(channelHandlerContext, packet);
                }
     
    • Like Like x 1