java.lang.Object
nl.pim16aap2.animatedarchitecture.structures.drawbridge.Drawbridge
All Implemented Interfaces:
IStructureComponent

public class Drawbridge extends Object implements IStructureComponent
Represents a Drawbridge structure type.
  • Constructor Details

    • Drawbridge

      public Drawbridge()
  • Method Details

    • getPotentialNewCoordinates

      public Optional<Cuboid> getPotentialNewCoordinates(IStructureConst structure)
      Description copied from interface: IStructureComponent
      Finds the new minimum and maximum coordinates (represented by a Cuboid) of this structure that would be the result of toggling it.
      Specified by:
      getPotentialNewCoordinates in interface IStructureComponent
      Parameters:
      structure - The structure to calculate the animation range for.
      Returns:
      The Cuboid that would represent the structure if it was toggled right now.
    • constructAnimationComponent

      public IAnimationComponent constructAnimationComponent(IStructureConst structure, AnimationRequestData data)
      Description copied from interface: IStructureComponent
      Creates a new IAnimationComponent for the provided structure and data for this structure component.
      Specified by:
      constructAnimationComponent in interface IStructureComponent
      Parameters:
      structure - The structure to calculate the animation range for.
      data - The data for the toggle request.
      Returns:
      A new Animator for this type of structure.
    • calculateAnimationCycleDistance

      public double calculateAnimationCycleDistance(IStructureConst structure)
      Description copied from interface: IStructureComponent
      Calculate the animation cycle distance for this structure.

      This method should not be called directly. Instead, use Structure.getAnimationCycleDistance(). See the documentation for that method for more information.

      Specified by:
      calculateAnimationCycleDistance in interface IStructureComponent
      Parameters:
      structure - The structure to calculate the animation cycle distance for.
      Returns:
      The distance traveled per animation cycle by the block that travels the furthest.
    • calculateAnimationRange

      public Rectangle calculateAnimationRange(IStructureConst structure)
      Description copied from interface: IStructureComponent
      Calculate the animation range for this structure.

      This method should not be called directly. Instead, use Structure.getAnimationRange(). See the documentation for that method for more information.

      Specified by:
      calculateAnimationRange in interface IStructureComponent
      Parameters:
      structure - The structure to calculate the animation range for.
      Returns:
      The animation range for this structure.
    • calculateAnimationRange

      public static Rectangle calculateAnimationRange(double maxRadius, Cuboid cuboid)
      Calculates the animation range of a drawbridge.
      Parameters:
      maxRadius - See getMaxRadius(boolean, Cuboid, Vector3Di).
      cuboid - The cuboid that describes this door.
      Returns:
      The animation range.
    • getMaxRadius

      public static double getMaxRadius(boolean northSouthAligned, Cuboid cuboid, Vector3Di rotationPoint)
      Calculates the longest possible radius from the rotation point of a drawbridge to another point that is still part of the drawbridge.
      Parameters:
      cuboid - The cuboid that describes this drawbridge.
      rotationPoint - The rotation point of the drawbridge.
      Returns:
      The radius between the rotation point of the drawbridge and the animated block furthest from it.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object