Class AutoPlaceEnvironment
- java.lang.Object
-
- com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment
-
public class AutoPlaceEnvironment extends java.lang.ObjectRepresent the environment in which autoplace of a single element took place.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAutoPlaceEnvironment.APILevelDefines the various API level anAutoPlaceEnvironmenthas implemented.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAutoPlaceEnvironment(AutoPlaceEnvironment parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AutoPlaceEnvironmentfromLegacy(IItemSource source, EntityPlayer actor, java.util.function.Consumer<IChatComponent> chatter)EntityPlayergetActor()The initiator of actions.AutoPlaceEnvironment.APILevelgetAPILevel()java.util.function.Consumer<IChatComponent>getChatter()send error messages here.ExtendedFacinggetFacing()IItemSourcegetSource()From where survival autoplace will drain resources.booleanisContainedInPiece(int offsetA, int offsetB, int offsetC)Test if given location is contained within the current piece.AutoPlaceEnvironmentwithActor(EntityPlayer actor)Return a new instance with actor modified to given value.AutoPlaceEnvironmentwithChatter(java.util.function.Consumer<IChatComponent> chatter)Return a new instance with chatter modified to given value.AutoPlaceEnvironmentwithSource(IItemSource source)Return a new instance with source modified to given value.
-
-
-
Constructor Detail
-
AutoPlaceEnvironment
protected AutoPlaceEnvironment(AutoPlaceEnvironment parent)
-
-
Method Detail
-
fromLegacy
public static AutoPlaceEnvironment fromLegacy(IItemSource source, EntityPlayer actor, java.util.function.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 thatgetChatter()might have. You might want to useStructureLibAPI.addThrottledChat(Object, EntityPlayer, IChatComponent, short)to help reduce spam.
-
getChatter
public java.util.function.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 elementoffsetB- offset in B direction relative to current elementoffsetC- 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(java.util.function.Consumer<IChatComponent> chatter)
Return a new instance with chatter modified to given value.- Parameters:
chatter- new chatter- Returns:
- new instance
-
-