Search in sources :

Example 1 with BoundingBox

use of net.aufdemrand.denizen.nms.util.BoundingBox in project Denizen-For-Bukkit by DenizenScript.

the class EntityHelper_v1_9_R2 method getBoundingBox.

@Override
public BoundingBox getBoundingBox(Entity entity) {
    AxisAlignedBB boundingBox = ((CraftEntity) entity).getHandle().getBoundingBox();
    Vector position = new Vector(boundingBox.a, boundingBox.b, boundingBox.c);
    Vector size = new Vector(boundingBox.d, boundingBox.e, boundingBox.f);
    return new BoundingBox(position, size);
}
Also used : BoundingBox(net.aufdemrand.denizen.nms.util.BoundingBox) Vector(org.bukkit.util.Vector)

Example 2 with BoundingBox

use of net.aufdemrand.denizen.nms.util.BoundingBox in project Denizen-For-Bukkit by DenizenScript.

the class EntityBoundingBox method adjust.

@Override
public void adjust(Mechanism mechanism) {
    Element value = mechanism.getValue();
    if (mechanism.matches("bounding_box")) {
        if (entity.isCitizensNPC()) {
            // TODO: Allow editing NPC boxes properly?
            return;
        }
        List<dLocation> locations = value.asType(dList.class).filter(dLocation.class);
        if (locations.size() == 2) {
            BoundingBox boundingBox = new BoundingBox(locations.get(0).toVector(), locations.get(1).toVector());
            NMSHandler.getInstance().getEntityHelper().setBoundingBox(entity.getBukkitEntity(), boundingBox);
            modifiedBoxes.add(entity.getUUID());
        } else {
            dB.echoError("Must specify exactly 2 dLocations in the format '<low>|<high>'!");
        }
    }
}
Also used : Element(net.aufdemrand.denizencore.objects.Element) net.aufdemrand.denizencore.objects.dList(net.aufdemrand.denizencore.objects.dList) BoundingBox(net.aufdemrand.denizen.nms.util.BoundingBox) net.aufdemrand.denizen.objects.dLocation(net.aufdemrand.denizen.objects.dLocation)

Example 3 with BoundingBox

use of net.aufdemrand.denizen.nms.util.BoundingBox in project Denizen-For-Bukkit by DenizenScript.

the class EntityHelper_v1_11_R1 method getBoundingBox.

@Override
public BoundingBox getBoundingBox(Entity entity) {
    AxisAlignedBB boundingBox = ((CraftEntity) entity).getHandle().getBoundingBox();
    Vector position = new Vector(boundingBox.a, boundingBox.b, boundingBox.c);
    Vector size = new Vector(boundingBox.d, boundingBox.e, boundingBox.f);
    return new BoundingBox(position, size);
}
Also used : BoundingBox(net.aufdemrand.denizen.nms.util.BoundingBox) Vector(org.bukkit.util.Vector)

Example 4 with BoundingBox

use of net.aufdemrand.denizen.nms.util.BoundingBox in project Denizen-For-Bukkit by DenizenScript.

the class EntityHelper_v1_8_R3 method getBoundingBox.

@Override
public BoundingBox getBoundingBox(Entity entity) {
    AxisAlignedBB boundingBox = ((CraftEntity) entity).getHandle().getBoundingBox();
    Vector position = new Vector(boundingBox.a, boundingBox.b, boundingBox.c);
    Vector size = new Vector(boundingBox.d, boundingBox.e, boundingBox.f);
    return new BoundingBox(position, size);
}
Also used : BoundingBox(net.aufdemrand.denizen.nms.util.BoundingBox) Vector(org.bukkit.util.Vector)

Example 5 with BoundingBox

use of net.aufdemrand.denizen.nms.util.BoundingBox in project Denizen-For-Bukkit by DenizenScript.

the class EntityBoundingBox method getBoundingBox.

private dList getBoundingBox() {
    BoundingBox boundingBox = NMSHandler.getInstance().getEntityHelper().getBoundingBox(entity.getBukkitEntity());
    dList list = new dList();
    list.add(new dLocation(boundingBox.getLow()).identify());
    list.add(new dLocation(boundingBox.getHigh()).identify());
    return list;
}
Also used : BoundingBox(net.aufdemrand.denizen.nms.util.BoundingBox) net.aufdemrand.denizencore.objects.dList(net.aufdemrand.denizencore.objects.dList) net.aufdemrand.denizen.objects.dLocation(net.aufdemrand.denizen.objects.dLocation)

Aggregations

BoundingBox (net.aufdemrand.denizen.nms.util.BoundingBox)6 Vector (org.bukkit.util.Vector)4 net.aufdemrand.denizen.objects.dLocation (net.aufdemrand.denizen.objects.dLocation)2 net.aufdemrand.denizencore.objects.dList (net.aufdemrand.denizencore.objects.dList)2 Element (net.aufdemrand.denizencore.objects.Element)1