Class AutoPlaceEnvironment
java.lang.Object
com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment
Represent the environment in which autoplace of a single element took place.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines the various API level anAutoPlaceEnvironmenthas implemented. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AutoPlaceEnvironmentfromLegacy(IItemSource source, EntityPlayer actor, Consumer<IChatComponent> chatter) getActor()The initiator of actions.send error messages here.From where survival autoplace will drain resources.booleanisContainedInPiece(int offsetA, int offsetB, int offsetC) Test if given location is contained within the current piece.withActor(EntityPlayer actor) Return a new instance with actor modified to given value.withChatter(Consumer<IChatComponent> chatter) Return a new instance with chatter modified to given value.withSource(IItemSource source) Return a new instance with source modified to given value.
-
Constructor Details
-
AutoPlaceEnvironment
-
-
Method Details
-
fromLegacy
public static AutoPlaceEnvironment fromLegacy(IItemSource source, EntityPlayer actor, Consumer<IChatComponent> chatter) -
getAPILevel
-
getSource
From where survival autoplace will drain resources. -
getActor
The initiator of actions. for very critical errors you can also just send the error messages here, bypassing any filter thatgetChatter()might have. You might want to useStructureLibAPI.addThrottledChat(Object, EntityPlayer, IChatComponent, short)to help reduce spam. -
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 elementoffsetB- offset in B direction relative to current elementoffsetC- offset in C direction relative to current element- Returns:
- true if contained, false otherwise.
-
getFacing
-
withSource
Return a new instance with source modified to given value.- Parameters:
source- new source- Returns:
- new instance
-
withActor
Return a new instance with actor modified to given value.- Parameters:
actor- new actor- Returns:
- new instance
-
withChatter
Return a new instance with chatter modified to given value.- Parameters:
chatter- new chatter- Returns:
- new instance
-