Search in sources :

Example 16 with ArmorStand

use of com.loohp.interactionvisualizer.entityholders.ArmorStand in project InteractionVisualizer by LOOHP.

the class BeaconDisplay method spawnArmorStands.

public Map<String, ArmorStand> spawnArmorStands(Block block) {
    Map<String, ArmorStand> map = new HashMap<>();
    Location origin = block.getLocation().add(0.5, 0.25, 0.5);
    SurroundingPlaneArmorStand line1 = new SurroundingPlaneArmorStand(origin.clone().add(0.0, 0.25, 0.0), 0.7, pathType);
    setStand(line1);
    SurroundingPlaneArmorStand line2 = new SurroundingPlaneArmorStand(origin.clone(), 0.7, pathType);
    setStand(line2);
    SurroundingPlaneArmorStand line3 = new SurroundingPlaneArmorStand(origin.clone().add(0.0, -0.25, 0.0), 0.7, pathType);
    setStand(line3);
    map.put("1", line1);
    map.put("2", line2);
    map.put("3", line3);
    PacketManager.sendArmorStandSpawn(InteractionVisualizerAPI.getPlayerModuleList(Modules.HOLOGRAM, KEY), line1);
    PacketManager.sendArmorStandSpawn(InteractionVisualizerAPI.getPlayerModuleList(Modules.HOLOGRAM, KEY), line2);
    PacketManager.sendArmorStandSpawn(InteractionVisualizerAPI.getPlayerModuleList(Modules.HOLOGRAM, KEY), line3);
    return map;
}
Also used : SurroundingPlaneArmorStand(com.loohp.interactionvisualizer.entityholders.SurroundingPlaneArmorStand) ArmorStand(com.loohp.interactionvisualizer.entityholders.ArmorStand) SurroundingPlaneArmorStand(com.loohp.interactionvisualizer.entityholders.SurroundingPlaneArmorStand) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Location(org.bukkit.Location)

Example 17 with ArmorStand

use of com.loohp.interactionvisualizer.entityholders.ArmorStand in project InteractionVisualizer by LOOHP.

the class BeeHiveDisplay method onBreakBeehive.

@EventHandler(priority = EventPriority.MONITOR)
public void onBreakBeehive(TileEntityRemovedEvent event) {
    Block block = event.getBlock();
    if (!beehiveMap.containsKey(block)) {
        return;
    }
    Map<String, Object> map = beehiveMap.get(block);
    if (map.get("0") instanceof ArmorStand) {
        ArmorStand stand = (ArmorStand) map.get("0");
        PacketManager.removeArmorStand(InteractionVisualizerAPI.getPlayers(), stand);
    }
    if (map.get("1") instanceof ArmorStand) {
        ArmorStand stand = (ArmorStand) map.get("1");
        PacketManager.removeArmorStand(InteractionVisualizerAPI.getPlayers(), stand);
    }
    beehiveMap.remove(block);
}
Also used : ArmorStand(com.loohp.interactionvisualizer.entityholders.ArmorStand) Block(org.bukkit.block.Block) EventHandler(org.bukkit.event.EventHandler)

Example 18 with ArmorStand

use of com.loohp.interactionvisualizer.entityholders.ArmorStand in project InteractionVisualizer by LOOHP.

the class BeeNestDisplay method spawnArmorStands.

public Map<String, ArmorStand> spawnArmorStands(Block block) {
    Map<String, ArmorStand> map = new HashMap<>();
    Location origin = block.getLocation();
    BlockData blockData = block.getState().getBlockData();
    BlockFace facing = ((Directional) blockData).getFacing();
    Location target = block.getRelative(facing).getLocation();
    Vector direction = target.toVector().subtract(origin.toVector()).multiply(0.7);
    Location loc0 = block.getLocation().clone().add(direction).add(0.5, 0.25, 0.5);
    ArmorStand line0 = new ArmorStand(loc0.clone());
    setStand(line0);
    Location loc1 = block.getLocation().clone().add(direction).add(0.5, 0, 0.5);
    ArmorStand line1 = new ArmorStand(loc1.clone());
    setStand(line1);
    map.put("0", line0);
    map.put("1", line1);
    PacketManager.sendArmorStandSpawn(InteractionVisualizerAPI.getPlayerModuleList(Modules.HOLOGRAM, KEY), line0);
    PacketManager.sendArmorStandSpawn(InteractionVisualizerAPI.getPlayerModuleList(Modules.HOLOGRAM, KEY), line1);
    return map;
}
Also used : ArmorStand(com.loohp.interactionvisualizer.entityholders.ArmorStand) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) BlockFace(org.bukkit.block.BlockFace) BlockData(org.bukkit.block.data.BlockData) Vector(org.bukkit.util.Vector) Location(org.bukkit.Location) Directional(org.bukkit.block.data.Directional)

Example 19 with ArmorStand

use of com.loohp.interactionvisualizer.entityholders.ArmorStand in project InteractionVisualizer by LOOHP.

the class BlastFurnaceDisplay method onBreakBlastFurnace.

@EventHandler(priority = EventPriority.MONITOR)
public void onBreakBlastFurnace(TileEntityRemovedEvent event) {
    Block block = event.getBlock();
    if (!blastfurnaceMap.containsKey(block)) {
        return;
    }
    Map<String, Object> map = blastfurnaceMap.get(block);
    if (map.get("Item") instanceof Item) {
        Item item = (Item) map.get("Item");
        PacketManager.removeItem(InteractionVisualizerAPI.getPlayers(), item);
    }
    if (map.get("Stand") instanceof ArmorStand) {
        ArmorStand stand = (ArmorStand) map.get("Stand");
        PacketManager.removeArmorStand(InteractionVisualizerAPI.getPlayers(), stand);
    }
    blastfurnaceMap.remove(block);
}
Also used : Item(com.loohp.interactionvisualizer.entityholders.Item) ArmorStand(com.loohp.interactionvisualizer.entityholders.ArmorStand) Block(org.bukkit.block.Block) EventHandler(org.bukkit.event.EventHandler)

Example 20 with ArmorStand

use of com.loohp.interactionvisualizer.entityholders.ArmorStand in project InteractionVisualizer by LOOHP.

the class SoulCampfireDisplay method spawnArmorStands.

public Map<String, ArmorStand> spawnArmorStands(Block block) {
    Map<String, ArmorStand> map = new HashMap<>();
    Location origin = block.getLocation();
    BlockData blockData = block.getState().getBlockData();
    BlockFace facing = ((Directional) blockData).getFacing();
    Location target = block.getRelative(facing).getLocation();
    Vector direction = rotateVectorAroundY(target.toVector().subtract(origin.toVector()).multiply(0.44194173), 135);
    Location loc = origin.clone().add(0.5, 0.3, 0.5);
    ArmorStand slot1 = new ArmorStand(loc.clone().add(direction));
    setStand(slot1);
    ArmorStand slot2 = new ArmorStand(loc.clone().add(rotateVectorAroundY(direction.clone(), 90)));
    setStand(slot2);
    ArmorStand slot3 = new ArmorStand(loc.clone().add(rotateVectorAroundY(direction.clone(), 180)));
    setStand(slot3);
    ArmorStand slot4 = new ArmorStand(loc.clone().add(rotateVectorAroundY(direction.clone(), -90)));
    setStand(slot4);
    map.put("1", slot1);
    map.put("2", slot2);
    map.put("3", slot3);
    map.put("4", slot4);
    PacketManager.sendArmorStandSpawn(InteractionVisualizerAPI.getPlayerModuleList(Modules.HOLOGRAM, KEY), slot1);
    PacketManager.sendArmorStandSpawn(InteractionVisualizerAPI.getPlayerModuleList(Modules.HOLOGRAM, KEY), slot2);
    PacketManager.sendArmorStandSpawn(InteractionVisualizerAPI.getPlayerModuleList(Modules.HOLOGRAM, KEY), slot3);
    PacketManager.sendArmorStandSpawn(InteractionVisualizerAPI.getPlayerModuleList(Modules.HOLOGRAM, KEY), slot4);
    return map;
}
Also used : ArmorStand(com.loohp.interactionvisualizer.entityholders.ArmorStand) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) BlockFace(org.bukkit.block.BlockFace) BlockData(org.bukkit.block.data.BlockData) Vector(org.bukkit.util.Vector) Location(org.bukkit.Location) Directional(org.bukkit.block.data.Directional)

Aggregations

ArmorStand (com.loohp.interactionvisualizer.entityholders.ArmorStand)56 Location (org.bukkit.Location)30 Block (org.bukkit.block.Block)30 HashMap (java.util.HashMap)25 Vector (org.bukkit.util.Vector)24 Item (com.loohp.interactionvisualizer.entityholders.Item)23 EventHandler (org.bukkit.event.EventHandler)23 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)16 Player (org.bukkit.entity.Player)14 BlockFace (org.bukkit.block.BlockFace)9 ItemStack (org.bukkit.inventory.ItemStack)9 BlockData (org.bukkit.block.data.BlockData)8 Directional (org.bukkit.block.data.Directional)7 SurroundingPlaneArmorStand (com.loohp.interactionvisualizer.entityholders.SurroundingPlaneArmorStand)6 InventoryView (org.bukkit.inventory.InventoryView)5 DynamicVisualizerEntity (com.loohp.interactionvisualizer.entityholders.DynamicVisualizerEntity)4 ItemFrame (com.loohp.interactionvisualizer.entityholders.ItemFrame)4 VisualizerEntity (com.loohp.interactionvisualizer.entityholders.VisualizerEntity)4 Collection (java.util.Collection)4 Inventory (org.bukkit.inventory.Inventory)4