public class StructureUtility extends Object
IStructureElement. However, in that case javac generic will often fail to infer the type for you, so we have
to define them as static methods
onlyIf(Predicate, IStructureElement) and its overloadspartitionBy(Function, IStructureElement[]) and its overloadsofChain(IStructureElement[]) and its overloadsonElementPass(Consumer, IStructureElement): Call an callback upon element check successonElementFail(Consumer, IStructureElement): Call an callback upon element check failurewithContext(IStructureElement): switch context to the extended contextwithChannel(String, IStructureElement): switch channel using
ChannelDataAccessor.withChannel(ItemStack, String) when a trigger item is present.ofHint(int), ofHintDeferred(Supplier) and its overloadsIStructureElement implementations.
ofBlock(Block, int, Block, int), ofBlocksFlat(Map, Block, int),
ofBlocksMap(Map, Block, int) and their overloads: the most basic formofBlockHint(Block, int, Block, int), ofBlocksFlatHint(Map, Block, int),
ofBlocksMapHint(Map, Block, int): these are the same as above, but will not do autoplaceisAir(), notAir(): They are supplied by default under the identifier '-' and
'+' respectively, but are provided here regardless in case you want to use them as a fallback.ofBlockAdder(IBlockAdder, Block, int), ofBlockAdderHint(IBlockAdder, Block, int) and their
overloads: hands off actual adder logic to an IBlockAdder you supplied. Save you the boilerplate of querying
block type and block meta from WorldofBlocksTiered(ITierConverter, Object, BiConsumer, Function) and its overloads: accept a series of
blocks that each may have different tier, but only allow one single tier for anywhere this element is used (e.g.
coils).ofTileAdder(ITileAdder, Block, int), ofSpecificTileAdder(BiPredicate, Class, Block, int):
Similar to block adder, but for tile entities.IStructureElement, but is helpful to the instantiation or
implementation of these.
survivalPlaceBlock(Block, int, World, int, int, int, IItemSource, EntityPlayer, Consumer) and its
overloads: Helper method to cut common boilerplate for implementing
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer)getPseudoJavaCode(World, ExtendedFacing, int, int, int, int, int, int, Function, int, int, int, boolean):
Generate a structure code template from existing structure.iterate(World, ExtendedFacing, int, int, int, int, int, int, boolean, int, int, int, IBlockPosConsumer, Runnable, Runnable)
and its overloads: help iterate over a coordinate space.| Modifier and Type | Method and Description |
|---|---|
static <T> IStructureElementDeferred<T> |
defer(BiFunction<T,ItemStack,Integer> keyExtractor,
IStructureElement<T>... array)
This is the switch block for structure code.
|
static <T> IStructureElementDeferred<T> |
defer(BiFunction<T,ItemStack,Integer> keyExtractor,
List<IStructureElement<T>> array)
This is the switch block for structure code.
|
static <T> IStructureElementDeferred<T> |
defer(BiFunction<T,ItemStack,IStructureElement<T>> to)
This will defer the actual instantiation of structure element until the structure code is actually called.
|
static <T,K> IStructureElementDeferred<T> |
defer(BiFunction<T,ItemStack,K> keyExtractor,
Map<K,IStructureElement<T>> map)
Deprecated.
renamed to partitionBy
|
static <T,K> IStructureElementDeferred<T> |
defer(BiFunction<T,ItemStack,K> keyExtractor,
Map<K,IStructureElement<T>> map,
IStructureElement<T> defaultElem)
Deprecated.
renamed to partitionBy
|
static <T> IStructureElementDeferred<T> |
defer(Function<T,Integer> keyExtractorCheck,
BiFunction<T,ItemStack,Integer> keyExtractor,
IStructureElement<T>... array)
Deprecated.
renamed to partitionBy
|
static <T> IStructureElementDeferred<T> |
defer(Function<T,Integer> keyExtractorCheck,
BiFunction<T,ItemStack,Integer> keyExtractor,
List<IStructureElement<T>> array)
Deprecated.
renamed to partitionBy
|
static <T> IStructureElementDeferred<T> |
defer(Function<T,Integer> keyExtractor,
IStructureElement<T>... array)
Deprecated.
renamed to partitionBy
|
static <T> IStructureElementDeferred<T> |
defer(Function<T,Integer> keyExtractor,
List<IStructureElement<T>> array)
Deprecated.
renamed to partitionBy
|
static <T> IStructureElementDeferred<T> |
defer(Function<T,IStructureElement<T>> to)
This will defer the actual instantiation of structure element until the structure code is actually called.
|
static <T> IStructureElementDeferred<T> |
defer(Function<T,IStructureElement<T>> toCheck,
BiFunction<T,ItemStack,IStructureElement<T>> to)
This will defer the actual instantiation of structure element until the first time structure code is
actually called.
|
static <T,K> IStructureElementDeferred<T> |
defer(Function<T,K> keyExtractorCheck,
BiFunction<T,ItemStack,K> keyExtractor,
Map<K,IStructureElement<T>> map)
Deprecated.
renamed to partitionBy
|
static <T,K> IStructureElementDeferred<T> |
defer(Function<T,K> keyExtractorCheck,
BiFunction<T,ItemStack,K> keyExtractor,
Map<K,IStructureElement<T>> map,
IStructureElement<T> defaultElem)
Deprecated.
renamed to partitionBy
|
static <T,K> IStructureElementDeferred<T> |
defer(Function<T,K> keyExtractor,
Map<K,IStructureElement<T>> map)
Deprecated.
renamed to partitionBy
|
static <T,K> IStructureElementDeferred<T> |
defer(Function<T,K> keyExtractor,
Map<K,IStructureElement<T>> map,
IStructureElement<T> defaultElem)
Deprecated.
renamed to partitionBy
|
static <T> IStructureElementDeferred<T> |
defer(Supplier<IStructureElement<T>> to)
This will defer the actual instantiation of structure element until the structure code is actually called.
|
static <T> IStructureElement<T> |
error()
Check returns false.
|
static String |
getPseudoJavaCode(World world,
ExtendedFacing extendedFacing,
int basePositionX,
int basePositionY,
int basePositionZ,
int basePositionA,
int basePositionB,
int basePositionC,
Function<? super TileEntity,String> tileEntityClassifier,
int sizeA,
int sizeB,
int sizeC,
boolean transpose)
Used only to get pseudo code in structure writer...
|
static <T> IStructureElement<T> |
isAir()
Return a structure element that only allow air (or air equivalents, like Railcraft hidden blocks).
|
static void |
iterate(World world,
ExtendedFacing extendedFacing,
int basePositionX,
int basePositionY,
int basePositionZ,
int basePositionA,
int basePositionB,
int basePositionC,
boolean transpose,
int sizeA,
int sizeB,
int sizeC,
IBlockPosConsumer iBlockPosConsumer,
Runnable nextB,
Runnable nextC) |
static void |
iterate(World world,
ExtendedFacing extendedFacing,
int basePositionX,
int basePositionY,
int basePositionZ,
int basePositionA,
int basePositionB,
int basePositionC,
int sizeA,
int sizeB,
int sizeC,
IBlockPosConsumer iBlockPosConsumer) |
static <T> IStructureElementDeferred<T> |
lazy(Function<T,IStructureElement<T>> to)
This will defer the actual instantiation of structure element until the first time structure code is
actually called.
|
static <T> IStructureElementDeferred<T> |
lazy(Supplier<IStructureElement<T>> to)
Similar to defer, but caches the first returned element returned and won't call it again.
|
static <T> IStructureElement<T> |
notAir()
Return a structure element that allow anything but air (or air equivalents, like Railcraft hidden blocks).
|
static <T> IStructureElement<T> |
ofBlock(Block block,
int meta)
Accept a single block with a fixed meta.
|
static <T> IStructureElement<T> |
ofBlock(Block block,
int meta,
Block defaultBlock,
int defaultMeta)
Accept a block.
|
static <T> IStructureElement<T> |
ofBlockAdder(IBlockAdder<T> iBlockAdder,
Block defaultBlock,
int defaultMeta)
Add a block using block adder.
|
static <T> IStructureElement<T> |
ofBlockAdder(IBlockAdder<T> iBlockAdder,
int dots) |
static <T> IStructureElementNoPlacement<T> |
ofBlockAdderHint(IBlockAdder<T> iBlockAdder,
Block hintBlock,
int hintMeta)
Add a block using block adder.
|
static <T> IStructureElement<T> |
ofBlockAnyMeta(Block block)
Accept a single block, but accept any meta.
|
static <T> IStructureElement<T> |
ofBlockAnyMeta(Block block,
Block defaultBlock,
int defaultMeta)
Same as
ofBlock(Block, int, Block, int) but ignores target meta id |
static <T> IStructureElement<T> |
ofBlockAnyMeta(Block block,
int defaultMeta)
Accept a single block, but accept any meta.
|
static <T> IStructureElementNoPlacement<T> |
ofBlockHint(Block block,
int meta)
Accept one (block, meta).
|
static <T> IStructureElementNoPlacement<T> |
ofBlockHint(Block block,
int meta,
Block hintBlock,
int hintMeta)
Accept one (block, meta).
|
static <T> IStructureElement<T> |
ofBlocksFlat(Map<Block,Integer> blocsMap,
Block defaultBlock,
int defaultMeta)
Accept a set of blocks.
|
static <T> IStructureElementNoPlacement<T> |
ofBlocksFlatHint(Map<Block,Integer> blocsMap,
Block hintBlock,
int hintMeta)
Accept a set of blocks.
|
static <T> IStructureElement<T> |
ofBlocksMap(Map<Block,Collection<Integer>> blocsMap,
Block defaultBlock,
int defaultMeta)
Accept a set of blocks.
|
static <T> IStructureElementNoPlacement<T> |
ofBlocksMapHint(Map<Block,Collection<Integer>> blocsMap,
Block hintBlock,
int hintMeta)
Accept a set of blocks.
|
static <T,TIER> IStructureElement<T> |
ofBlocksTiered(ITierConverter<TIER> tierExtractor,
List<org.apache.commons.lang3.tuple.Pair<Block,Integer>> allKnownTiers,
TIER notSet,
BiConsumer<T,TIER> setter,
Function<T,TIER> getter)
Element representing a component with different tiers.
|
static <T,TIER> IStructureElementCheckOnly<T> |
ofBlocksTiered(ITierConverter<TIER> tierExtractor,
TIER notSet,
BiConsumer<T,TIER> setter,
Function<T,TIER> getter)
A more primitive variant of
ofBlocksTiered(ITierConverter, List, Object, BiConsumer, Function) Main
difference is this one is check only. |
static <T> IStructureElement<T> |
ofBlockUnlocalizedName(String modid,
String unlocalizedName,
int meta)
Denote a block using unlocalized names.
|
static <T> IStructureElement<T> |
ofBlockUnlocalizedName(String modid,
String registryName,
int meta,
boolean wildcard)
Denote a block using unlocalized names.
|
static <T> IStructureElement<T> |
ofBlockUnlocalizedName(String modid,
String unlocalizedName,
int meta,
IStructureElement<T> fallback)
Similiar to the other overload, but allows client code to specify a fallback in case said block was not found
later when the element got called.
|
static <T> IStructureElementChain<T> |
ofChain(IStructureElement<T>... elementChain)
This allows you to compose different
IStructureElement to form a OR chain. |
static <T> IStructureElementChain<T> |
ofChain(List<IStructureElement<T>> elementChain)
This allows you to compose different
IStructureElement to form a OR chain. |
static <T> IStructureElementNoPlacement<T> |
ofHint(int dots)
Spawn a hint with given amount of dots.
|
static <T> IStructureElementNoPlacement<T> |
ofHintDeferred(Supplier<IIcon[]> icons)
Spawn a hint with given textures.
|
static <T> IStructureElementNoPlacement<T> |
ofHintDeferred(Supplier<IIcon[]> icons,
short[] RGBa)
Spawn a hint with given amount of textures and tint.
|
static <T,E> IStructureElementNoPlacement<T> |
ofSpecificTileAdder(BiPredicate<T,E> iTileAdder,
Class<E> tileClass,
Block hintBlock,
int hintMeta)
Try to add a structure element with a particular type of tile entity.
|
static <T> IStructureElementNoPlacement<T> |
ofTileAdder(ITileAdder<T> iTileAdder,
Block hintBlock,
int hintMeta)
Try to add a structure element with a tile entity.
|
static <B extends IStructureElement<T>,T> |
onElementFail(Consumer<T> onFail,
B element)
Call a callback if downstream element returned false in check.
|
static <B extends IStructureElement<T>,T> |
onElementPass(Consumer<T> onCheckPass,
B element)
Call a callback if downstream element returned true in check.
|
static <T> IStructureElement<T> |
onlyIf(Predicate<? super T> predicate,
IStructureElement<? super T> downstream)
Enable this structure element only if given predicate returns true.
|
static <T> IStructureElement<T> |
onlyIf(Predicate<? super T> predicate,
IStructureElement<? super T> downstream,
IStructureElement.PlaceResult placeResultWhenDisabled)
Enable this structure element only if given predicate returns true.
|
static <T,K> IStructureElementDeferred<T> |
partitionBy(BiFunction<T,ItemStack,K> keyExtractor,
Map<K,IStructureElement<T>> map)
This is the switch block for structure code.
|
static <T,K> IStructureElementDeferred<T> |
partitionBy(BiFunction<T,ItemStack,K> keyExtractor,
Map<K,IStructureElement<T>> map,
IStructureElement<T> defaultElem)
This is the switch block for structure code, with default case support.
|
static <T> IStructureElementDeferred<T> |
partitionBy(Function<T,Integer> keyExtractorCheck,
BiFunction<T,ItemStack,Integer> keyExtractor,
IStructureElement<T>... array)
This is the switch block for structure code, with default case.
|
static <T> IStructureElementDeferred<T> |
partitionBy(Function<T,Integer> keyExtractorCheck,
BiFunction<T,ItemStack,Integer> keyExtractor,
List<IStructureElement<T>> array)
This is the switch block for structure code, with default case.
|
static <T> IStructureElementDeferred<T> |
partitionBy(Function<T,Integer> keyExtractor,
IStructureElement<T>... array)
This is the switch block for structure code.
|
static <T> IStructureElementDeferred<T> |
partitionBy(Function<T,Integer> keyExtractor,
List<IStructureElement<T>> array)
This is the switch block for structure code.
|
static <T,K> IStructureElementDeferred<T> |
partitionBy(Function<T,K> keyExtractorCheck,
BiFunction<T,ItemStack,K> keyExtractor,
Map<K,IStructureElement<T>> map)
This is the switch block for structure code.
|
static <T,K> IStructureElementDeferred<T> |
partitionBy(Function<T,K> keyExtractorCheck,
BiFunction<T,ItemStack,K> keyExtractor,
Map<K,IStructureElement<T>> map,
IStructureElement<T> defaultElem)
This is the switch block for structure code, with default case.
|
static <T,K> IStructureElementDeferred<T> |
partitionBy(Function<T,K> keyExtractor,
Map<K,IStructureElement<T>> map)
This is the switch block for structure code.
|
static <T,K> IStructureElementDeferred<T> |
partitionBy(Function<T,K> keyExtractor,
Map<K,IStructureElement<T>> map,
IStructureElement<T> defaultElem)
This is the switch block for structure code, with default case support.
|
static <T> com.gtnewhorizon.structurelib.structure.IStructureNavigate<T> |
step(int a,
int b,
int c)
Used internally, to generate skips for structure definitions
|
static <T> com.gtnewhorizon.structurelib.structure.IStructureNavigate<T> |
step(Vec3Impl step)
Used internally, to generate skips for structure definitions
|
static IStructureElement.PlaceResult |
survivalPlaceBlock(Block block,
int meta,
World world,
int x,
int y,
int z,
IItemSource s,
EntityPlayer actor)
This is a helper method for implementing
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer) |
static IStructureElement.PlaceResult |
survivalPlaceBlock(Block block,
int meta,
World world,
int x,
int y,
int z,
IItemSource s,
EntityPlayer actor,
Consumer<IChatComponent> chatter)
This is a helper method for implementing
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer) |
static IStructureElement.PlaceResult |
survivalPlaceBlock(Block block,
int meta,
World world,
int x,
int y,
int z,
IItemSource s,
EntityPlayerMP actor)
This is a helper method for implementing
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer) |
static IStructureElement.PlaceResult |
survivalPlaceBlock(Block block,
int meta,
World world,
int x,
int y,
int z,
IItemSource s,
EntityPlayerMP actor,
Consumer<IChatComponent> chatter)
This is a helper method for implementing
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer) |
static IStructureElement.PlaceResult |
survivalPlaceBlock(ItemStack stack,
ItemStackPredicate.NBTMode nbtMode,
NBTTagCompound tag,
boolean assumeStackPresent,
World world,
int x,
int y,
int z,
IItemSource s,
EntityPlayer actor)
This is a helper method for implementing
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer) |
static IStructureElement.PlaceResult |
survivalPlaceBlock(ItemStack stack,
ItemStackPredicate.NBTMode nbtMode,
NBTTagCompound tag,
boolean assumeStackPresent,
World world,
int x,
int y,
int z,
IItemSource s,
EntityPlayer actor,
Consumer<IChatComponent> chatter)
This is a helper method for implementing
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer) |
static IStructureElement.PlaceResult |
survivalPlaceBlock(ItemStack stack,
ItemStackPredicate.NBTMode nbtMode,
NBTTagCompound tag,
boolean assumeStackPresent,
World world,
int x,
int y,
int z,
IItemSource s,
EntityPlayerMP actor)
This is a helper method for implementing
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer) |
static IStructureElement.PlaceResult |
survivalPlaceBlock(ItemStack stack,
ItemStackPredicate.NBTMode nbtMode,
NBTTagCompound tag,
boolean assumeStackPresent,
World world,
int x,
int y,
int z,
IItemSource s,
EntityPlayerMP actor,
Consumer<IChatComponent> chatter)
This is a helper method for implementing
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer) |
static String[][] |
transpose(String[][] structurePiece)
Transposes shape (swaps B and C axis, can be used to un-transpose transposed shape) WARNING! Do not use on old
api...
|
static <T> IStructureElement<T> |
withChannel(String channel,
IStructureElement<T> backing)
See channels.md in docs folder
|
static <CTX,T extends IWithExtendedContext<CTX>> |
withContext(IStructureElement<CTX> elem)
Switch to the extended context object in the downstream element
|
public static IStructureElement.PlaceResult survivalPlaceBlock(Block block, int meta, World world, int x, int y, int z, IItemSource s, EntityPlayerMP actor)
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer)
This method will try to look up an ItemBlock for given block and meta from s and place it at
given location. This method assume block at given coord is NOT acceptable, but may or may not be trivially
replaceable This method might yield error messages to the player only if there is likely a programming error or
exploit.
s - drain resources from this placeactor - source of action. cannot be null.public static IStructureElement.PlaceResult survivalPlaceBlock(Block block, int meta, World world, int x, int y, int z, IItemSource s, EntityPlayer actor)
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer)
This method will try to look up an ItemBlock for given block and meta from s and place it at
given location. This method assume block at given coord is NOT acceptable, but may or may not be trivially
replaceable This method might yield error messages to the player only if there is likely a programming error or
exploit.
s - drain resources from this placeactor - source of action. cannot be null.public static IStructureElement.PlaceResult survivalPlaceBlock(Block block, int meta, World world, int x, int y, int z, IItemSource s, EntityPlayerMP actor, Consumer<IChatComponent> chatter)
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer)
This method will try to look up an ItemBlock for given block and meta from s and place it at
given location. This method assume block at given coord is NOT acceptable, but may or may not be trivially
replaceable This method might yield error messages to the player only if there is likely a programming error or
exploit. This method might yield error messages to the chatter.
s - drain resources from this placeactor - source of action. cannot be null.chatter - normal error destination. can be null to suppress them.public static IStructureElement.PlaceResult survivalPlaceBlock(Block block, int meta, World world, int x, int y, int z, IItemSource s, EntityPlayer actor, Consumer<IChatComponent> chatter)
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer)
This method will try to look up an ItemBlock for given block and meta from s and place it at
given location. This method assume block at given coord is NOT acceptable, but may or may not be trivially
replaceable This method might yield error messages to the player only if there is likely a programming error or
exploit. This method might yield error messages to the chatter.
s - drain resources from this placeactor - source of action. cannot be null.chatter - normal error destination. can be null to suppress them.public static IStructureElement.PlaceResult survivalPlaceBlock(ItemStack stack, ItemStackPredicate.NBTMode nbtMode, NBTTagCompound tag, boolean assumeStackPresent, World world, int x, int y, int z, IItemSource s, EntityPlayerMP actor)
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer)
This method will try to look up an ItemBlock for given block and meta from s and place it at
given location. This method assume block at given coord is NOT acceptable, but may or may not be trivially
replaceable This method might yield error messages to the player only if there is likely a programming error or
exploit.
stack - a valid stack with stack size of exactly 1. Must be of an ItemBlock!s - drain resources from this placeactor - source of action. cannot be null.public static IStructureElement.PlaceResult survivalPlaceBlock(ItemStack stack, ItemStackPredicate.NBTMode nbtMode, NBTTagCompound tag, boolean assumeStackPresent, World world, int x, int y, int z, IItemSource s, EntityPlayer actor)
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer)
This method will try to look up an ItemBlock for given block and meta from s and place it at
given location. This method assume block at given coord is NOT acceptable, but may or may not be trivially
replaceable This method might yield error messages to the player only if there is likely a programming error or
exploit.
stack - a valid stack with stack size of exactly 1. Must be of an ItemBlock!s - drain resources from this placeactor - source of action. cannot be null.public static IStructureElement.PlaceResult survivalPlaceBlock(ItemStack stack, ItemStackPredicate.NBTMode nbtMode, NBTTagCompound tag, boolean assumeStackPresent, World world, int x, int y, int z, IItemSource s, EntityPlayerMP actor, @Nullable Consumer<IChatComponent> chatter)
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer)
This method will try to look up an ItemBlock for given block and meta from s and place it at
given location. This method assume block at given coord is NOT acceptable, but may or may not be trivially
replaceable This method might yield error messages to the player only if there is likely a programming error or
exploit. This method might yield error messages to the chatter.
stack - a valid stack with stack size of exactly 1. Must be of an ItemBlock!s - drain resources from this placeactor - source of action. cannot be null.chatter - normal error destination. can be null to suppress them.public static IStructureElement.PlaceResult survivalPlaceBlock(ItemStack stack, ItemStackPredicate.NBTMode nbtMode, NBTTagCompound tag, boolean assumeStackPresent, World world, int x, int y, int z, IItemSource s, EntityPlayer actor, @Nullable Consumer<IChatComponent> chatter)
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, IItemSource, EntityPlayerMP, Consumer)
This method will try to look up an ItemBlock for given block and meta from s and place it at
given location. This method assume block at given coord is NOT acceptable, but may or may not be trivially
replaceable This method might yield error messages to the player only if there is likely a programming error or
exploit. This method might yield error messages to the chatter.
stack - a valid stack with stack size of exactly 1. Must be of an ItemBlock!s - drain resources from this placeactor - source of action. cannot be null.chatter - normal error destination. can be null to suppress them.public static <T> IStructureElement<T> isAir()
- in shape to automatically use this. Provided nontheless in case
you want this as a fallback to something else.public static <T> IStructureElement<T> notAir()
+ in shape to automatically use this. Provided nontheless
in case you want this as a fallback to something else.public static <T> IStructureElement<T> error()
public static <T> IStructureElementNoPlacement<T> ofHint(int dots)
ofBlockUnlocalizedName(String, String, int, IStructureElement)public static <T> IStructureElementNoPlacement<T> ofHintDeferred(Supplier<IIcon[]> icons)
ofBlockUnlocalizedName(String, String, int, IStructureElement)public static <T> IStructureElementNoPlacement<T> ofHintDeferred(Supplier<IIcon[]> icons, short[] RGBa)
ofBlockUnlocalizedName(String, String, int, IStructureElement)public static <T,TIER> IStructureElementCheckOnly<T> ofBlocksTiered(ITierConverter<TIER> tierExtractor, @Nullable TIER notSet, BiConsumer<T,TIER> setter, Function<T,TIER> getter)
ofBlocksTiered(ITierConverter, List, Object, BiConsumer, Function) Main
difference is this one is check only.
Note that if tierExtractor returns a null, this block will be rejected immediately. This makes null a potent candidate for notSet.
See documentation on the other overload for more information.
public static <T,TIER> IStructureElement<T> ofBlocksTiered(ITierConverter<TIER> tierExtractor, @Nullable List<org.apache.commons.lang3.tuple.Pair<Block,Integer>> allKnownTiers, @Nullable TIER notSet, BiConsumer<T,TIER> setter, Function<T,TIER> getter)
(*): Implementation wise, this structure element will only accept a block if its tier is the same as existing tier or if existing tier is unset (i.e. value of third argument)
Above all else, you need to decide what tier you are going to use. For simpler cases, Integer is a good choice.
You can also use an existing Enum. Tier can never be null though. It can also be a String or a
ResourceLocation, or basically anything. It doesn't even have to implement
Comparable.
This assumes you will reset the backing storage, and on the first occurrence getter would return notSet. You can
also make getter to return other value to forcefully select a certain tier, but you're probably better off using
block adders or ofBlock(Block, int, Block, int) and its overloads
Implementation wise, this allows a block only when we don't yet have a tier, or the block at that location has the same tier as we already have.
There is yet no TileEntity counterpart of this utility. Feel free to submit a PR to add it.
For most typical use cases, you will NOT want to return notSet from your tierExtractor. If you do so, we will have this kind of chain of events:
Example:
Assume you have 16 tier, each map to one block's 16 different meta. You will usually want something like this
public class Tile extends TileEntity {
private static final Block B = getTargetBlock();
private static final IStructureDefinition<Tile> S = IStructureDefinition.<Tile>builder()
// ... addShape, and other elements
.addElement('c', ofBlocksTiered((b, m) -> b == B ? m : null,
IntStream.range(0, 16).mapToObj(i -> Pair.of(B, i)).collect(Collectors.toList()),
-1,
(t, m) -> t.tier = m,
t -> t.tier))
.build();
private int tier;
public boolean check() {
tier = -1;
if (!S.check(...))
return false;
return isTierAcceptable(tier);
}
}
tierExtractor - a function to extract tier info from a block. This function can return null and will never
be passed a null block or an invalid block meta.allKnownTiers - A list of all known tiers as of calling. Can be empty or null. No hint will be spawned if
empty or null. Cannot have null elements. First element denotes the most primitive tier.
Last element denotes the most advanced tier. If not all tiers are available at definition
construction time, use lazy(Supplier) or its overloads to delay a bit. This list is
only for hint particle spawning and survival build. The hint/autoplace code will choose 1st
pair to spawn/place if trigger item has master channel data of 1, 2nd pair if 2, and so on.notSet - The value returned from getter when there were no tier info found in T yet. Can be
null.getter - a function to retrieve the current tier from context objectsetter - a function to set the current tier into context objectpublic static <T> IStructureElement<T> ofBlockUnlocalizedName(String modid, String unlocalizedName, int meta)
DUE TO HISTORICAL REASONS, THIS WAS CALLED ofBlockUnlocalizedName, BUT IT ACTUALLY USES REGISTRY NAME INSTEAD.
While no immediate error will be thrown, client code should ensure said mod is loaded and said mod is present, otherwise bad things will happen later!
public static <T> IStructureElement<T> ofBlockUnlocalizedName(String modid, String registryName, int meta, boolean wildcard)
DUE TO HISTORICAL REASONS, THIS WAS CALLED ofBlockUnlocalizedName, BUT IT ACTUALLY USES REGISTRY NAME INSTEAD.
While no immediate error will be thrown, client code should ensure said mod is loaded and said mod is present,
otherwise the element will effectively become an error().
Will place block or hint using the given meta if wildcard is true.
public static <T> IStructureElement<T> ofBlockUnlocalizedName(String modid, String unlocalizedName, int meta, IStructureElement<T> fallback)
DUE TO HISTORICAL REASONS, THIS WAS CALLED ofBlockUnlocalizedName, BUT IT ACTUALLY USES REGISTRY NAME INSTEAD.
This is slightly different to using the other overload and another element in a
ofChain(IStructureElement[]). Here fallback will only ever be used if this fails, where ofChain would
form an OR relationship even if the mod is loaded and the block exists in registry.
public static <T> IStructureElementNoPlacement<T> ofBlocksFlatHint(Map<Block,Integer> blocsMap, Block hintBlock, int hintMeta)
ofBlocksMapHint(Map, Block, int) when for any
accepted block type we accept only one meta for each.
Does not have autoplace.
blocsMap - Accepted (block, meta) pairs.hintBlock - hint block to usehintMeta - hint meta to useofBlocksMapHint(Map, Block, int)public static <T> IStructureElementNoPlacement<T> ofBlocksMapHint(Map<Block,Collection<Integer>> blocsMap, Block hintBlock, int hintMeta)
Does not have autoplace.
blocsMap - Accepted (block, meta) pairs.hintBlock - hint block to usehintMeta - hint meta to useofBlocksFlatHint(Map, Block, int)public static <T> IStructureElementNoPlacement<T> ofBlockHint(Block block, int meta, Block hintBlock, int hintMeta)
public static <T> IStructureElementNoPlacement<T> ofBlockHint(Block block, int meta)
ofBlock(Block, int), except it explicitly turns off creative/survival
build.public static <T> IStructureElementNoPlacement<T> ofBlockAdderHint(IBlockAdder<T> iBlockAdder, Block hintBlock, int hintMeta)
Useful when your logic is very complex. Does not support autoplace.
public static <T> IStructureElement<T> ofBlocksFlat(Map<Block,Integer> blocsMap, Block defaultBlock, int defaultMeta)
ofBlocksMap(Map, Block, int) when for any accepted
block type we accept only one meta for each.blocsMap - Accepted (block, meta) pairs.defaultBlock - default block to place/spawn hintdefaultMeta - default meta to place/spawn hintofBlocksMapHint(Map, Block, int)public static <T> IStructureElement<T> ofBlocksMap(Map<Block,Collection<Integer>> blocsMap, Block defaultBlock, int defaultMeta)
blocsMap - Accepted (block, meta) pairs.defaultBlock - default block to place/spawn hintdefaultMeta - default meta to place/spawn hintofBlocksMapHint(Map, Block, int)public static <T> IStructureElement<T> ofBlock(Block block, int meta, Block defaultBlock, int defaultMeta)
block - accepted blockmeta - accepted metadefaultBlock - hint blockdefaultMeta - hint metapublic static <T> IStructureElement<T> ofBlockAnyMeta(Block block, Block defaultBlock, int defaultMeta)
ofBlock(Block, int, Block, int) but ignores target meta idpublic static <T> IStructureElement<T> ofBlock(Block block, int meta)
public static <T> IStructureElement<T> ofBlockAnyMeta(Block block)
public static <T> IStructureElement<T> ofBlockAnyMeta(Block block, int defaultMeta)
public static <T> IStructureElement<T> ofBlockAdder(IBlockAdder<T> iBlockAdder, Block defaultBlock, int defaultMeta)
Useful when your logic is very complex.
public static <T> IStructureElement<T> ofBlockAdder(IBlockAdder<T> iBlockAdder, int dots)
public static <T> IStructureElementNoPlacement<T> ofTileAdder(ITileAdder<T> iTileAdder, Block hintBlock, int hintMeta)
public static <T,E> IStructureElementNoPlacement<T> ofSpecificTileAdder(BiPredicate<T,E> iTileAdder, Class<E> tileClass, Block hintBlock, int hintMeta)
public static <B extends IStructureElement<T>,T> IStructureElement<T> onElementPass(Consumer<T> onCheckPass, B element)
onCheckPass - side effectelement - downstreampublic static <B extends IStructureElement<T>,T> IStructureElement<T> onElementFail(Consumer<T> onFail, B element)
onFail - side effectelement - downstreampublic static <T> IStructureElement<T> onlyIf(Predicate<? super T> predicate, IStructureElement<? super T> downstream)
Return SKIP when survival auto place if given predicate returns false.
public static <T> IStructureElement<T> onlyIf(Predicate<? super T> predicate, IStructureElement<? super T> downstream, IStructureElement.PlaceResult placeResultWhenDisabled)
placeResultWhenDisabled - value to return for survival auto place when predicate returns false@SafeVarargs public static <T> IStructureElementChain<T> ofChain(IStructureElement<T>... elementChain)
IStructureElement to form a OR chain. As with any other OR
operator, this one exhibits short-circuiting behavior, i.e. it will not call next structure element if previous
one succeeded. (*)
This allows you e.g. accept both a glass block using ofBlock(Block, int, Block, int) and a piece of air
using isAir(). It will not attempt to capture any errors though, so next one will not be tried if
previous one would crash.
(*): For survival auto place, it will * REJECT, if all structure element REJECT * SKIP, if 1 or more structure element SKIP and the rest structure element (0 or more) REJECT * any other result, **immediately** upon any structure element returns these other results. This behavior is not 100% fixed and might change later on, but we will send the notice on a best effort basis.
Take care while chaining, as it will try to call every structure element until it returns true. If none does it will finally return false.
public static <T> IStructureElementChain<T> ofChain(List<IStructureElement<T>> elementChain)
IStructureElement to form a OR chain.
Practically no difference with the other overload.
ofChain(IStructureElement[])public static <CTX,T extends IWithExtendedContext<CTX>> IStructureElement<T> withContext(IStructureElement<CTX> elem)
CTX - extended context typeT - existing context object typeelem - downstream elementpublic static <T> IStructureElementDeferred<T> lazy(Supplier<IStructureElement<T>> to)
public static <T> IStructureElementDeferred<T> lazy(Function<T,IStructureElement<T>> to)
Similar to defer, but caches the first returned element returned and won't call it again. Initialization is not thread safe. This will allow the structure element constructor to access properties only present on the context object (e.g. GT5 multiblock controller), e.g. hatch texture index to use. Use this if the data you access will remain constant.
to - create structure element from the first context object passed inpublic static <T> IStructureElementDeferred<T> defer(Supplier<IStructureElement<T>> to)
lazy(Supplier) is enough will not break anything, but would incur unnecessary
performance overhead.to - downstream element supplierpublic static <T> IStructureElementDeferred<T> defer(Function<T,IStructureElement<T>> to)
lazy(Supplier) is enough will not break anything, but would incur unnecessary
performance overhead.to - downstream element supplier@Deprecated public static <T,K> IStructureElementDeferred<T> defer(Function<T,K> keyExtractor, Map<K,IStructureElement<T>> map)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to use.
keyExtractor - extract a key from the context objectmap - all possible structure elementpublic static <T,K> IStructureElementDeferred<T> partitionBy(Function<T,K> keyExtractor, Map<K,IStructureElement<T>> map)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns a key not found in map.
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
keyExtractor - extract a key from the context objectmap - all possible structure element@Deprecated public static <T,K> IStructureElementDeferred<T> defer(Function<T,K> keyExtractor, Map<K,IStructureElement<T>> map, IStructureElement<T> defaultElem)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to
use. The fallback will only be used when keyExtractor returns a value not found in given map. This will play
nicely in combination with error()
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
keyExtractor - extract a key from the context objectmap - all possible structure elementdefaultElem - element to use when keyExtractor returns a value not found in given mappublic static <T,K> IStructureElementDeferred<T> partitionBy(Function<T,K> keyExtractor, Map<K,IStructureElement<T>> map, IStructureElement<T> defaultElem)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to
use. The fallback will only be used when keyExtractor returns a value not found in given map. This will play
nicely in combination with error()
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
keyExtractor - extract a key from the context objectmap - all possible structure elementdefaultElem - element to use when keyExtractor returns a value not found in given map@SafeVarargs @Deprecated public static <T> IStructureElementDeferred<T> defer(Function<T,Integer> keyExtractor, IStructureElement<T>... array)
This allows you to extract or compute an index from context object, and lookup an array for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns an index not within the array bound
Do pay place null values in the array.
keyExtractor - extract an index from the context objectarray - all possible structure element@SafeVarargs public static <T> IStructureElementDeferred<T> partitionBy(Function<T,Integer> keyExtractor, IStructureElement<T>... array)
This allows you to extract or compute an index from context object, and lookup an array for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns an index not within the array bound
Do pay place null values in the array.
keyExtractor - extract an index from the context objectarray - all possible structure element@Deprecated public static <T> IStructureElementDeferred<T> defer(Function<T,Integer> keyExtractor, List<IStructureElement<T>> array)
This allows you to extract or compute an index from context object, and lookup an array for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns an index not within the array bound
Do pay place null values in the array.
keyExtractor - extract an index from the context objectarray - all possible structure elementpublic static <T> IStructureElementDeferred<T> partitionBy(Function<T,Integer> keyExtractor, List<IStructureElement<T>> array)
This allows you to extract or compute an index from context object, and lookup an array for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns an index not within the array bound
Do pay place null values in the array.
keyExtractor - extract an index from the context objectarray - all possible structure elementpublic static <T> IStructureElementDeferred<T> defer(BiFunction<T,ItemStack,IStructureElement<T>> to)
lazy(Supplier) is enough will not break anything, but would incur unnecessary
performance overhead.
This variant also passes the trigger item to the function, allowing it to get more info.
to - downstream element supplier@Deprecated public static <T,K> IStructureElementDeferred<T> defer(BiFunction<T,ItemStack,K> keyExtractor, Map<K,IStructureElement<T>> map)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns a key not found in map.
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
This variant also passes the trigger item to the function, allowing it to get more info.
keyExtractor - extract a key from the context object and trigger itemmap - all possible structure elementpublic static <T,K> IStructureElementDeferred<T> partitionBy(BiFunction<T,ItemStack,K> keyExtractor, Map<K,IStructureElement<T>> map)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns a key not found in map.
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
This variant also passes the trigger item to the function, allowing it to get more info.
keyExtractor - extract a key from the context object and trigger itemmap - all possible structure element@Deprecated public static <T,K> IStructureElementDeferred<T> defer(BiFunction<T,ItemStack,K> keyExtractor, Map<K,IStructureElement<T>> map, IStructureElement<T> defaultElem)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to
use. The fallback will only be used when keyExtractor returns a value not found in given map. This will play
nicely in combination with error()
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
This variant also passes the trigger item to the function, allowing it to get more info.
keyExtractor - extract a key from the context object and trigger itemmap - all possible structure elementdefaultElem - element to use when keyExtractor returns a value not found in given mappublic static <T,K> IStructureElementDeferred<T> partitionBy(BiFunction<T,ItemStack,K> keyExtractor, Map<K,IStructureElement<T>> map, IStructureElement<T> defaultElem)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to
use. The fallback will only be used when keyExtractor returns a value not found in given map. This will play
nicely in combination with error()
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
This variant also passes the trigger item to the function, allowing it to get more info.
keyExtractor - extract a key from the context object and trigger itemmap - all possible structure elementdefaultElem - element to use when keyExtractor returns a value not found in given map@SafeVarargs public static <T> IStructureElementDeferred<T> defer(BiFunction<T,ItemStack,Integer> keyExtractor, IStructureElement<T>... array)
This allows you to extract or compute an index from context object, and lookup an array for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns an index not within the array bound
Do pay place null values in the array.
This variant also passes the trigger item to the function, allowing it to get more info.
keyExtractor - extract a key from the context object and trigger itemarray - all possible structure elementpublic static <T> IStructureElementDeferred<T> defer(BiFunction<T,ItemStack,Integer> keyExtractor, List<IStructureElement<T>> array)
This allows you to extract or compute an index from context object, and lookup an array for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns an index not within the array bound
Do pay place null values in the array.
This variant also passes the trigger item to the function, allowing it to get more info.
keyExtractor - extract a key from the context object and trigger itemarray - all possible structure elementpublic static <T> IStructureElementDeferred<T> defer(Function<T,IStructureElement<T>> toCheck, BiFunction<T,ItemStack,IStructureElement<T>> to)
Similar to defer, but caches the first returned element returned and won't call it again. Initialization is not thread safe. This will allow the structure element constructor to access properties only present on the context object (e.g. GT5 multiblock controller), e.g. hatch texture index to use. Use this if the data you access will remain constant.
This variant will override the check function of the structure element from second function with the one returned from the structure element from first function.
toCheck - override the check function with the returned elementto - create structure element from the context object passed in@Deprecated public static <T,K> IStructureElementDeferred<T> defer(Function<T,K> keyExtractorCheck, BiFunction<T,ItemStack,K> keyExtractor, Map<K,IStructureElement<T>> map)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns a key not found in map.
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
This variant also passes the trigger item to the function, allowing it to get more info.
This variant will override the check function of the structure element from second function with the one returned from the structure element from first function.
keyExtractorCheck - key extractor of the structure element that will be used for check.keyExtractor - extract a key from the context object and trigger itemmap - all possible structure elementpublic static <T,K> IStructureElementDeferred<T> partitionBy(Function<T,K> keyExtractorCheck, BiFunction<T,ItemStack,K> keyExtractor, Map<K,IStructureElement<T>> map)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns a key not found in map.
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
This variant also passes the trigger item to the function, allowing it to get more info.
This variant will override the check function of the structure element from second function with the one returned from the structure element from first function.
keyExtractorCheck - key extractor of the structure element that will be used for check.keyExtractor - extract a key from the context object and trigger itemmap - all possible structure element@Deprecated public static <T,K> IStructureElementDeferred<T> defer(Function<T,K> keyExtractorCheck, BiFunction<T,ItemStack,K> keyExtractor, Map<K,IStructureElement<T>> map, IStructureElement<T> defaultElem)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to use. defaultElem will be used if either extractor returned a key not found in map.
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
This variant also passes the trigger item to the function, allowing it to get more info.
This variant will override the check function of the structure element from second function with the one returned from the structure element from first function.
keyExtractorCheck - key extractor of the structure element that will be used for check.keyExtractor - extract a key from the context object and trigger itemmap - all possible structure elementpublic static <T,K> IStructureElementDeferred<T> partitionBy(Function<T,K> keyExtractorCheck, BiFunction<T,ItemStack,K> keyExtractor, Map<K,IStructureElement<T>> map, IStructureElement<T> defaultElem)
This allows you to extract or compute a key from context object, and lookup a map for actual structure element to use. defaultElem will be used if either extractor returned a key not found in map.
Do pay attention to what properties your map has though. You need to pay attention to how they consider equality and how they consider null key/values. Guava ImmutableMap is usually a good enough choice.
This variant also passes the trigger item to the function, allowing it to get more info.
This variant will override the check function of the structure element from second function with the one returned from the structure element from first function.
keyExtractorCheck - key extractor of the structure element that will be used for check.keyExtractor - extract a key from the context object and trigger itemmap - all possible structure element@SafeVarargs @Deprecated public static <T> IStructureElementDeferred<T> defer(Function<T,Integer> keyExtractorCheck, BiFunction<T,ItemStack,Integer> keyExtractor, IStructureElement<T>... array)
This allows you to extract or compute an index from context object, and lookup an array for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns an index not within the array bound
Do pay place null values in the array.
This variant also passes the trigger item to the function, allowing it to get more info.
This variant will override the check function of the structure element from second function with the one returned from the structure element from first function.
keyExtractorCheck - key extractor of the structure element that will be used for check.keyExtractor - extract a key from the context object and trigger itemarray - all possible structure element@SafeVarargs public static <T> IStructureElementDeferred<T> partitionBy(Function<T,Integer> keyExtractorCheck, BiFunction<T,ItemStack,Integer> keyExtractor, IStructureElement<T>... array)
This allows you to extract or compute an index from context object, and lookup an array for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns an index not within the array bound
Do pay place null values in the array.
This variant also passes the trigger item to the function, allowing it to get more info.
This variant will override the check function of the structure element from second function with the one returned from the structure element from first function.
keyExtractorCheck - key extractor of the structure element that will be used for check.keyExtractor - extract a key from the context object and trigger itemarray - all possible structure element@Deprecated public static <T> IStructureElementDeferred<T> defer(Function<T,Integer> keyExtractorCheck, BiFunction<T,ItemStack,Integer> keyExtractor, List<IStructureElement<T>> array)
This allows you to extract or compute an index from context object, and lookup an array for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns an index not within the array bound
This variant also passes the trigger item to the function, allowing it to get more info.
This variant will override the check function of the structure element from second function with the one returned from the structure element from first function.
keyExtractorCheck - key extractor of the structure element that will be used for check.keyExtractor - extract a key from the context object and trigger itemarray - all possible structure elementpublic static <T> IStructureElementDeferred<T> partitionBy(Function<T,Integer> keyExtractorCheck, BiFunction<T,ItemStack,Integer> keyExtractor, List<IStructureElement<T>> array)
This allows you to extract or compute an index from context object, and lookup an array for actual structure element to use. This will usually, but not guaranteed, to throw an exception at runtime if keyExtractor returns an index not within the array bound
This variant also passes the trigger item to the function, allowing it to get more info.
This variant will override the check function of the structure element from second function with the one returned from the structure element from first function.
keyExtractorCheck - key extractor of the structure element that will be used for check.keyExtractor - extract a key from the context object and trigger itemarray - all possible structure elementpublic static <T> IStructureElement<T> withChannel(String channel, IStructureElement<T> backing)
public static <T> com.gtnewhorizon.structurelib.structure.IStructureNavigate<T> step(int a,
int b,
int c)
public static <T> com.gtnewhorizon.structurelib.structure.IStructureNavigate<T> step(Vec3Impl step)
public static String getPseudoJavaCode(World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, Function<? super TileEntity,String> tileEntityClassifier, int sizeA, int sizeB, int sizeC, boolean transpose)
NOTE: GT specific code got removed. TODO add a mean
tileEntityClassifier - return a string that denote the type of a tile entity, or null if it's nothing
special. useful if the tile entity cannot be simply distinguished via getClass.public static void iterate(World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, int sizeA, int sizeB, int sizeC, IBlockPosConsumer iBlockPosConsumer)
public static void iterate(World world, ExtendedFacing extendedFacing, int basePositionX, int basePositionY, int basePositionZ, int basePositionA, int basePositionB, int basePositionC, boolean transpose, int sizeA, int sizeB, int sizeC, IBlockPosConsumer iBlockPosConsumer, Runnable nextB, Runnable nextC)