Interface IStructureElementChain<T>
-
- All Superinterfaces:
IStructureElement<T>
public interface IStructureElementChain<T> extends IStructureElement<T>
Use StructureUtility to instantiate
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.gtnewhorizon.structurelib.structure.IStructureElement
IStructureElement.BlocksToPlace, IStructureElement.PlaceResult
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancheck(T t, World world, int x, int y, int z)IStructureElement<T>[]fallbacks()default IStructureElement.BlocksToPlacegetBlocksToPlace(T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env)A simplified version of survivalPlaceBlock.default booleanplaceBlock(T t, World world, int x, int y, int z, ItemStack trigger)default booleanspawnHint(T t, World world, int x, int y, int z, ItemStack trigger)default IStructureElement.PlaceResultsurvivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env)Try place the block by taking resource from givenIItemSource.default IStructureElement.PlaceResultsurvivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, IItemSource s, EntityPlayerMP actor, java.util.function.Consumer<IChatComponent> chatter)Try place the block by taking resource from given IItemSource.-
Methods inherited from interface com.gtnewhorizon.structurelib.structure.IStructureElement
getStepA, getStepB, getStepC, isNavigating, noPlacement, resetA, resetB, resetC
-
-
-
-
Method Detail
-
fallbacks
IStructureElement<T>[] fallbacks()
-
check
default boolean check(T t, World world, int x, int y, int z)
- Specified by:
checkin interfaceIStructureElement<T>
-
spawnHint
default boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger)
- Specified by:
spawnHintin interfaceIStructureElement<T>
-
placeBlock
default boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger)
- Specified by:
placeBlockin interfaceIStructureElement<T>
-
getBlocksToPlace
@Nullable default IStructureElement.BlocksToPlace getBlocksToPlace(T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env)
Description copied from interface:IStructureElementA simplified version of survivalPlaceBlock. Return null if not implemented.BY OVERRIDING THIS TO NULL, YOU ACKNOWLEDGE THAT THE
IStructureElement.check(Object, World, int, int, int)OF THIS CLASS IS SIDE EFFECT FREE AND CAN HAVE ITS CHECK CALLED WITHOUT BREAKING ANYTHING. OTHERWISE OVERRIDE THEIStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, AutoPlaceEnvironment)TO PROVIDE A SIDEEFFECT FREEIStructureElement.PlaceResult.SKIP.It should be noticed that this filter is only advisory and the actual
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, AutoPlaceEnvironment)orIStructureElement.check(Object, World, int, int, int)are free to reject/accept/place blocks not contained in this list, e.g. when the element can be placed anywhere in the structure, but no more than 3 overall; when the structure element cannot know all blocks it will accept at the time of calling; when this is backed by a legacyIStructureElementthat just didn't implement this API.- Specified by:
getBlocksToPlacein interfaceIStructureElement<T>trigger- trigger itemenv- autoplacing environment- Returns:
- null if not implemented, otherwise an instance describing what kind of blocks will be placed by
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, AutoPlaceEnvironment)
-
survivalPlaceBlock
default IStructureElement.PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, IItemSource s, EntityPlayerMP actor, java.util.function.Consumer<IChatComponent> chatter)
Description copied from interface:IStructureElementTry place the block by taking resource from given IItemSource.You might want to use
StructureUtility.survivalPlaceBlock(Block, int, World, int, int, int, IItemSource, net.minecraft.entity.player.EntityPlayer)or its overloads to implement this.- Specified by:
survivalPlaceBlockin interfaceIStructureElement<T>trigger- trigger items- drain resources from this placeactor- source of action. for very critical errors you can also just send the error messages here, bypassing any filter that chatter might have.chatter- send error messages here. Caller will choose an appropriate way to forward it to player if the other fallbacks also fails.
-
survivalPlaceBlock
default IStructureElement.PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env)
Description copied from interface:IStructureElementTry place the block by taking resource from givenIItemSource.You might want to use
StructureUtility.survivalPlaceBlock(Block, int, World, int, int, int, IItemSource, net.minecraft.entity.player.EntityPlayer)or its overloads to implement this.The default implementation provided will
- Get
IStructureElement.BlocksToPlaceviaIStructureElement.getBlocksToPlace(Object, World, int, int, int, ItemStack, AutoPlaceEnvironment). If not null- call
IStructureElement.check(Object, World, int, int, int). If this returnstrue,IStructureElement.PlaceResult.SKIPwill be returned without further action. - Use the
IStructureElement.BlocksToPlaceretrieved earlier and passed inIItemSourceto determine an item to place - Hand over control to
StructureUtility.survivalPlaceBlock(ItemStack, NBTMode, NBTTagCompound, boolean, World, int, int, int, IItemSource, EntityPlayer, Consumer)
- call
- Call legacy
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer)ifenv.getActor()contains anEntityPlayerMP - Emit warning under debug mode (or throw exception under panic mode), then return
IStructureElement.PlaceResult.SKIP
IStructureElement.check(Object, World, int, int, int)is not side effect free, or is not idempotent. E.g. theIStructureElement.check(Object, World, int, int, int)will add current coord to aList. As this method might be invoked at a location that is already accepted, this will cause the machine to have multiple of this coord in its list.- Specified by:
survivalPlaceBlockin interfaceIStructureElement<T>trigger- trigger itemenv- autoplacing environment
- Get
-
-