Solved Placing blocks in armor stands

Discussion in 'Spigot Plugin Development' started by MetallicGoat, Jul 5, 2021.

  1. So, in hypixel's bedwars, they have a gamemode called luckyblocks. I am trying to recreate the lucky 'block' that they have. Basically the lucky block is a head (on an armor stand) inside of a glass block. I was easily able to recreate the look, however I cant place my lucky blocks under my already placed lucky blocks because of the armor stand that is part if the 'block' above. How could hypixel gave made it so you can place lucky blocks under lucky blocks?

    Am I making sense?
     
  2. I guess you need to disable physics
     
  3. I don’t see what’s the problem. When you place a glass block, spawn an armorstand 1.5 blocks under with a lucky block head, and if you place another glass on top it’ll do the same tho. Entities can be at the same place.
     
  4. Yes, you can place blocks on top, but you cannot underneath because half an armor stand is there.
     
  5. Oh underneath, yeah then you have to use packets armor stand
     
  6. Hmm. Could you please elaborate on that?
     
  7. If you spawn the armor stands using packets, the players can see them but they do not exist on the server, meaning that the do not interact with physics stuff so you should be able to place a block on top of an armorstand
     
  8. Omg that is so cool, thank you! I will give it a shot.
     
  9. So I was finally able to test it out today, and it did not work unfortunately. Players still cant place blocks in armor stands as if there are not there. Here is my code:


    Code (Text):
                EntityArmorStand stand = new EntityArmorStand(s);

                stand.setLocation(loc.getX()+0.5, loc.getY()-1.25, loc.getZ()+0.5, 0, 0);
                stand.setInvisible(true);
                stand.setGravity(false);

                PacketPlayOutSpawnEntityLiving aStand = new PacketPlayOutSpawnEntityLiving(stand);
                PacketPlayOutEntityEquipment skull = new PacketPlayOutEntityEquipment(stand.getId(), 4, CraftItemStack.asNMSCopy(getSkull()));

                ((CraftPlayer)p).getHandle().playerConnection.sendPacket(aStand);
                ((CraftPlayer)p).getHandle().playerConnection.sendPacket(skull);
     
  10. The client will still send entity interaction packets because it believes it's interacting with an entity though. The server just ignores it because it does not see any entity for an interaction to be taking place with.

    Try ArmorStand#setMarker. When true, the collision box will be very small, which should make it much less likely to interfere with block placement.
     
    • Like Like x 1
  11. Defiantly better, thank you! Only thing now is I still cant place blocks 2 blocks under my luckyblock. I can place blocks directly under now though.

    Code (Text):
                ArmorStand armorStand = (ArmorStand) loc.getWorld().spawnEntity(loc.add(0.5, -1.25, 0.5), EntityType.ARMOR_STAND);

                armorStand.setVisible(false);
                armorStand.setGravity(false);
                armorStand.setMarker(true);
                armorStand.setHelmet(getSkull());

                biMap.put(e.getBlock(), armorStand);
     
  12. Just tested it in 1.16 and it works fine. Huh...
     
  13. Not sure what difference there would be between 1.8 and 1.16 armor stands as far as that all goes, but I suppose a lot can change between so many major updates. I don't know what would be preventing block placement in 1.8 if not a hitbox though.
     
  14. Yeah, I got no idea. Works for 1.16 though, and 1.8 is good enough for me. (At least for now) So I guess I will change this thread to solved. Thanks for your help :)
     
  15. The marker isn’t the same in 1.8
     
    • Informative Informative x 1