public class ChannelDataAccessor extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
countChannelData(ItemStack masterStack)
Get the number of subchannels present on given trigger item.
|
static int |
getChannelData(ItemStack masterStack,
String channel)
Get the subchannel data from given trigger item.
|
static boolean |
hasSubChannel(ItemStack masterStack)
Check if given trigger item contains any subchannel
|
static boolean |
hasSubChannel(ItemStack masterStack,
String channel)
Check if given trigger item contains specified subchannel
|
static Stream<Map.Entry<String,Integer>> |
iterateChannelData(ItemStack masterStack)
Iterate over all subchannel data on trigger stack.
|
static void |
setChannelData(ItemStack masterStack,
String channel,
int data)
Set the subchannel data on given trigger item
|
static void |
unsetChannelData(ItemStack masterStack,
String channel)
Clear the given subchannel from given trigger item, if it exists
|
static void |
wipeChannelData(ItemStack masterStack)
Wipe all subchannel data on given trigger item
|
static ItemStack |
withChannel(ItemStack masterStack,
String channel)
Return a trigger item that
Still carry all the subchannel in some unspecified ways
Have its master channel data replaced with specified subchannel's data
If given subchannel does not exist, masterStack may or may not be returned to save performance.
|
public static ItemStack withChannel(ItemStack masterStack, String channel)
masterStack - trigger item. can be the return value of another withChannel(ItemStack, String) callchannel - subchannel to use. will use current master channel data instead if this channel does not exist
Note: all channel identifiers are supposed to be lower case and not empty.public static boolean hasSubChannel(ItemStack masterStack)
masterStack - trigger stack to checkpublic static boolean hasSubChannel(ItemStack masterStack, String channel)
masterStack - trigger stack to checkchannel - channel identifier. Note: all channel identifiers are supposed to be lower case and not empty.public static int getChannelData(ItemStack masterStack, String channel)
masterStack - trigger stack to query fromchannel - channel identifier. Note: all channel identifiers are supposed to be lower case and not empty.public static void setChannelData(ItemStack masterStack, String channel, int data)
masterStack - trigger stack to checkchannel - channel identifier. Note: all channel identifiers are supposed to be lower case and not empty.data - subchannel data. should always be a positive valuepublic static void unsetChannelData(ItemStack masterStack, String channel)
masterStack - trigger stack to unsetchannel - channel identifier. Note: all channel identifiers are supposed to be lower case and not empty.public static void wipeChannelData(ItemStack masterStack)
masterStack - trigger stack to wipepublic static Stream<Map.Entry<String,Integer>> iterateChannelData(ItemStack masterStack)
masterStack - trigger stack to checkConcurrentModificationException if underlying
channel data is modified while stream is working.public static int countChannelData(ItemStack masterStack)
masterStack - trigger stack to query from