congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DynamicLocation
Code IndexAdd Tabnine to your IDE (free)

How to use
DynamicLocation
in
de.slikey.effectlib.util

Best Java code snippets using de.slikey.effectlib.util.DynamicLocation (Showing top 20 results out of 315)

origin: Slikey/EffectLib

public void setTargetEntity(Entity entity) {
  target = new DynamicLocation(entity);
}
origin: Slikey/EffectLib

/**
 * Set the Location this Effect is centered on.
 */
public void setDynamicOrigin(DynamicLocation location) {
  if (location == null) {
    throw new IllegalArgumentException("Origin Location cannot be null!");
  }
  origin = location;
  if (offset != null) {
    origin.addOffset(offset);
  }
  if (relativeOffset != null) {
    origin.addRelativeOffset(relativeOffset);
  }
  origin.setDirectionOffset(yawOffset, pitchOffset);
  origin.setYaw(yaw);
  origin.setPitch(pitch);
  origin.setUpdateLocation(updateLocations);
  origin.setUpdateDirection(updateDirections);
  origin.updateDirection();
}
origin: Slikey/EffectLib

/**
 * Extending Effect classes can use this to determine the Entity this
 * Effect is targeted upon. This is probably a very rare case, such as
 * an Effect that "links" two Entities together somehow. (Idea!)
 *
 * This may return null, even for an Effect that was set with a target Entity,
 * if the Entity gets GC'd.
 */
public Entity getTargetEntity() {
  return target == null ? null : target.getEntity();
}
origin: Slikey/EffectLib

/**
 * Set the Location this Effect is targeting.
 */
public void setDynamicTarget(DynamicLocation location) {
  target = location;
  if (target != null && targetOffset != null) {
    target.addOffset(targetOffset);
  }
  if (target != null) {
    target.setUpdateLocation(updateLocations);
    target.setUpdateDirection(updateDirections);
  }
}
origin: Slikey/EffectLib

public void update() {
  if (location == null || (!updateLocation && !updateDirection)) {
    return;
  }
  Entity entityReference = entity == null ? null : entity.get();
  if (entityReference != null) {
    Location currentLocation = getEntityLocation(entityReference);
    if (updateDirection)
    {
      setDirection(currentLocation.getDirection());
    }
    if (updateLocation)
    {
      updateFrom(currentLocation);
    }
  }
}
origin: elBukkit/MagicPlugin

public void setTarget(Location location) {
  if (target == null) {
    target = new DynamicLocation(location);
  } else {
    Location targetLocation = target.getLocation();
    targetLocation.setX(location.getX());
    targetLocation.setY(location.getY());
    targetLocation.setZ(location.getZ());
  }
}
origin: elBukkit/MagicPlugin

  protected void startProjectileEffects(CastContext context, String effectKey) {

    Collection<EffectPlayer> projectileEffects = context.getEffects(effectKey);
    for (EffectPlayer apiEffectPlayer : projectileEffects)
    {
      if (effectLocation == null) {
        effectLocation = new DynamicLocation(actionContext.getTargetLocation());
        effectLocation.setDirection(velocity);
      }
      if (activeProjectileEffects == null) {
        activeProjectileEffects = new ArrayList<>();
      }
      // Hrm- this is ugly, but I don't want the API to depend on EffectLib.
      if (apiEffectPlayer instanceof com.elmakers.mine.bukkit.effect.EffectPlayer)
      {
        com.elmakers.mine.bukkit.effect.EffectPlayer effectPlayer = (com.elmakers.mine.bukkit.effect.EffectPlayer)apiEffectPlayer;
        effectPlayer.setEffectPlayList(activeProjectileEffects);
        if (projectileEffectsUseTarget) {
          Entity sourceEntity = actionContext.getEntity();
          DynamicLocation sourceLocation = sourceEntity == null ? new DynamicLocation(actionContext.getLocation()) : new DynamicLocation(sourceEntity);
          effectPlayer.startEffects(sourceLocation, effectLocation);
        } else {
          effectPlayer.startEffects(effectLocation, null);
        }
      }
    }
  }
}
origin: elBukkit/MagicPlugin

public void startEffects(DynamicLocation origin, DynamicLocation target) {
  Location targetLocation = target == null ? null : target.getLocation();
  Location originLocation = origin == null ? null : origin.getLocation();
  if (targetLocation != null && originLocation != null && !originLocation.getWorld().equals(targetLocation.getWorld())) {
    targetLocation.setWorld(originLocation.getWorld());
    this.origin.addRelativeOffset(originRelativeOffset);
    this.target.addRelativeOffset(targetRelativeOffset);
origin: elBukkit/MagicPlugin

@SuppressWarnings("deprecation")
protected void performEffects(DynamicLocation source, DynamicLocation target) {
  Location sourceLocation = source == null ? null : source.getLocation();
  if (sourceLocation == null) return;
  Entity sourceEntity = source == null ? null : source.getEntity();
  if (requireEntity && sourceEntity == null) return;
origin: elBukkit/MagicPlugin

  if (effectLocation != null)
    effectLocation.updateFrom(targetLocation);
if (effectLocation != null)
  effectLocation.updateFrom(projectileLocation);
  effectLocation.setDirection(velocity);
origin: Slikey/EffectLib

/**
 * Extending Effect classes should use this method to obtain the
 * current "target" Location of the effect.
 *
 * Unlike getLocation, this may return null.
 */
public final Location getTarget() {
  return target == null ? null : target.getLocation();
}
origin: Slikey/EffectLib

protected final boolean validate() {
  // Check if the origin and target entities are present
  if (disappearWithOriginEntity && (origin != null && !origin.hasValidEntity())) {
    return false;
  }
  
  if (disappearWithTargetEntity && (target != null && !target.hasValidEntity())) {
    return false;
  }
  
  // Check for a valid Location
  updateLocation();
  updateTarget();
  Location location = getLocation();
  if (location == null) {
    return false;
  }
  if (autoOrient) {
    Location targetLocation = target == null ? null : target.getLocation();
    if (targetLocation != null) {
      Vector direction = targetLocation.toVector().subtract(location.toVector());
      location.setDirection(direction);
      targetLocation.setDirection(direction.multiply(-1));
    }
  }
  return true;
}
origin: elBukkit/MagicPlugin

protected void checkLocations() {
  if (origin != null) {
    if (originOffset != null) {
      origin.addOffset(originOffset);
    }
  }
  if (target != null) {
    if (targetOffset != null) {
      target.addOffset(targetOffset);
    }
  }
}
origin: Slikey/EffectLib

public DynamicLocation(Entity entity) {
  if (entity != null) {
    this.entity = new WeakReference<Entity>(entity);
    this.location = getEntityLocation(entity);
  } else {
    this.entity = null;
    this.location = null;
  }
  this.originalLocation = location;
}
origin: elBukkit/MagicPlugin

public void setOrigin(Location location) {
  if (origin == null) {
    origin = new DynamicLocation(location);
  } else {
    Location originLocation = origin.getLocation();
    originLocation.setX(location.getX());
    originLocation.setY(location.getY());
    originLocation.setZ(location.getZ());
  }
}
origin: Slikey/EffectLib

/**
 * Extending Effect classes should use this method to obtain the
 * current "root" Location of the effect.
 *
 * This method will not return null when called from onRun. Effects
 * with invalid locations will be cancelled.
 */
public final Location getLocation() {
  return origin == null ? null : origin.getLocation();
}
origin: Slikey/EffectLib

origin.addOffset(offset);
previousOffset.add(offset);
origin: Slikey/EffectLib

public DynamicLocation(Location location, Entity entity) {
  if (location != null) {
    this.location = location.clone();
  } else if (entity != null) {
    this.location = getEntityLocation(entity);
  } else {
    this.location = null;
  }
  if (entity != null) {
    this.entity = new WeakReference<Entity>(entity);
    this.entityOffset = this.location.toVector().subtract(getEntityLocation(entity).toVector());
  } else {
    this.entity = null;
  }
  this.originalLocation = this.location == null ? null : this.location.clone();
}
origin: Slikey/EffectLib

public void setTargetLocation(Location location) {
  target = new DynamicLocation(location);
}
origin: Slikey/EffectLib

/**
 * Extending Effect classes can use this to determine the Entity this
 * Effect is centered upon.
 *
 * This may return null, even for an Effect that was set with an Entity,
 * if the Entity gets GC'd.
 */
public Entity getEntity() {
  return origin == null ? null : origin.getEntity();
}
de.slikey.effectlib.utilDynamicLocation

Javadoc

Represents a Location that can move, possibly bound to an Entity.

Most used methods

  • <init>
  • addOffset
  • addRelativeOffset
  • getEntity
  • getLocation
  • setDirection
  • updateFrom
  • getEntityLocation
  • hasValidEntity
  • setDirectionOffset
  • setPitch
  • setUpdateDirection
  • setPitch,
  • setUpdateDirection,
  • setUpdateLocation,
  • setYaw,
  • update,
  • updateDirection,
  • updateOffsets

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • setContentView (Activity)
  • startActivity (Activity)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now