Class AutoPlaceEnvironment

java.lang.Object
com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment

public class AutoPlaceEnvironment extends Object
Represent the environment in which autoplace of a single element took place.
  • Constructor Details

  • Method Details

    • fromLegacy

      public static AutoPlaceEnvironment fromLegacy(IItemSource source, EntityPlayer actor, Consumer<IChatComponent> chatter)
    • getAPILevel

      public AutoPlaceEnvironment.APILevel getAPILevel()
    • getSource

      public IItemSource getSource()
      From where survival autoplace will drain resources.
    • getActor

      public EntityPlayer getActor()
      The initiator of actions. for very critical errors you can also just send the error messages here, bypassing any filter that getChatter() might have. You might want to use StructureLibAPI.addThrottledChat(Object, EntityPlayer, IChatComponent, short) to help reduce spam.
    • getChatter

      public Consumer<IChatComponent> getChatter()
      send error messages here. Caller will choose an appropriate way to forward it to player if the other fallbacks also fails.
    • isContainedInPiece

      public boolean isContainedInPiece(int offsetA, int offsetB, int offsetC)
      Test if given location is contained within the current piece.
      Parameters:
      offsetA - offset in A direction relative to current element
      offsetB - offset in B direction relative to current element
      offsetC - offset in C direction relative to current element
      Returns:
      true if contained, false otherwise.
    • getFacing

      public ExtendedFacing getFacing()
    • withSource

      public AutoPlaceEnvironment withSource(IItemSource source)
      Return a new instance with source modified to given value.
      Parameters:
      source - new source
      Returns:
      new instance
    • withActor

      public AutoPlaceEnvironment withActor(EntityPlayer actor)
      Return a new instance with actor modified to given value.
      Parameters:
      actor - new actor
      Returns:
      new instance
    • withChatter

      public AutoPlaceEnvironment withChatter(Consumer<IChatComponent> chatter)
      Return a new instance with chatter modified to given value.
      Parameters:
      chatter - new chatter
      Returns:
      new instance