mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-18 19:29:19 +00:00
channels
This commit is contained in:
18 files changed
+1404
-15
No files matched your search
@@ -5,6 +5,7 @@ import static java.lang.Integer.MIN_VALUE;
|
||||
|
||||
import com.gtnewhorizon.structurelib.StructureLib;
|
||||
import com.gtnewhorizon.structurelib.StructureLibAPI;
|
||||
import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor;
|
||||
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
|
||||
import com.gtnewhorizon.structurelib.structure.IStructureElement.PlaceResult;
|
||||
import com.gtnewhorizon.structurelib.structure.adders.IBlockAdder;
|
||||
@@ -1895,6 +1896,42 @@ public class StructureUtility {
|
||||
|
||||
// endregion
|
||||
|
||||
// region channels
|
||||
|
||||
/**
|
||||
* See channels.md in docs folder
|
||||
*/
|
||||
public static <T> IStructureElement<T> withChannel(String channel, IStructureElement<T> backing) {
|
||||
return new IStructureElement<T>() {
|
||||
public boolean check(T t, World world, int x, int y, int z) {
|
||||
return backing.check(t, world, x, y, z);
|
||||
}
|
||||
|
||||
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||
return backing.spawnHint(t, world, x, y, z, ChannelDataAccessor.withChannel(trigger, channel));
|
||||
}
|
||||
|
||||
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
|
||||
return backing.placeBlock(t, world, x, y, z, ChannelDataAccessor.withChannel(trigger, channel));
|
||||
}
|
||||
|
||||
public PlaceResult survivalPlaceBlock(
|
||||
T t,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
ItemStack trigger,
|
||||
IItemSource s,
|
||||
EntityPlayerMP actor,
|
||||
Consumer<IChatComponent> chatter) {
|
||||
return backing.survivalPlaceBlock(
|
||||
t, world, x, y, z, ChannelDataAccessor.withChannel(trigger, channel), s, actor, chatter);
|
||||
}
|
||||
};
|
||||
}
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* Used internally, to generate skips for structure definitions
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user