Class GlobalVariableHelper
java.lang.Object
me.desht.pneumaticcraft.common.variables.GlobalVariableHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractVarnames(String[] varnames, boolean playerGlobal) Given a list of prefixed var names, return a corresponding list of var names with a matching prefix characterstatic booleanstatic intstatic net.minecraft.core.BlockPosRetrieve a blockpos variable from the GVM.static net.minecraft.core.BlockPosRetrieve a blockpos variable from the GVM.static StringgetPrefixedVar(String varName, boolean playerGlobal) Given a plain variable name, add the "#" or "%" prefix as appropriatestatic net.minecraft.world.item.ItemStackRetrieve an itemstack variable from the GVM.static net.minecraft.world.item.ItemStackRetrieve an itemstack variable from the GVM.static IVariableProviderstatic StringgetVarPrefix(boolean playerGlobal) Get the correct var prefixstatic booleanCheck if this varname has a prefix characterstatic voidstatic voidstatic StringstripVarPrefix(String varName) Strip the prefix character from a var name
-
Constructor Details
-
GlobalVariableHelper
public GlobalVariableHelper()
-
-
Method Details
-
getPos
public static net.minecraft.core.BlockPos getPos(@Nullable UUID id, String varName, net.minecraft.core.BlockPos def) Retrieve a blockpos variable from the GVM. The variable may start with "#" or "%" to indicate player-global or global respectively. Missing prefix defaults to player-global.- Parameters:
id- the ID of the owning player (ignored for "%" global variables)varName- the variable name, optionally prefixed with "%" or "#"def- default value if not present in the GVM- Returns:
- the variable's value
-
getPos
Retrieve a blockpos variable from the GVM. The variable may start with "#" or "%" to indicate player-global or global respectively. Missing prefix defaults to player-global.- Parameters:
id- the ID of the owning player (ignored for "%" global variables, must be a valid player UUID otherwise)varName- the variable name, optionally prefixed with "%" or "#"- Returns:
- the variable's value
-
getStack
public static net.minecraft.world.item.ItemStack getStack(@Nullable UUID id, String varName, net.minecraft.world.item.ItemStack def) Retrieve an itemstack variable from the GVM. The variable may start with "#" or "%" to indicate player-global or global respectively. Missing prefix defaults to player-global "#".- Parameters:
id- the ID of the owning player (ignored for "%" global variables, must be a valid player UUID otherwise)varName- the variable name, optionally prefixed with "%" or "#"def- default value if not present in the GVM- Returns:
- the variable's value
-
getStack
Retrieve an itemstack variable from the GVM. The variable may start with "#" or "%" to indicate player-global or global respectively. Missing prefix defaults to player-global.- Parameters:
id- the ID of the owning player (ignored for "%" global variables, must be a valid player UUID otherwise)varName- the variable name, optionally prefixed with "%" or "#"- Returns:
- the variable's value
-
setPos
-
setStack
-
getBool
-
getInt
-
getPrefixedVar
Given a plain variable name, add the "#" or "%" prefix as appropriate- Parameters:
varName- the variableplayerGlobal- true if a player-global, false if a server-global- Returns:
- the prefixed var name
-
getVarPrefix
Get the correct var prefix- Parameters:
playerGlobal- true if a player-global, false if a server-global- Returns:
- the var prefix
-
stripVarPrefix
Strip the prefix character from a var name- Parameters:
varName- the var name- Returns:
- the var name without a prefix
-
hasPrefix
Check if this varname has a prefix character- Parameters:
varName- the var name- Returns:
- true if prefixed, false otherwise
-
extractVarnames
Given a list of prefixed var names, return a corresponding list of var names with a matching prefix character- Parameters:
varnames- the var namesplayerGlobal- true to extract player-global, false for server-global- Returns:
- a list of unprefixed var names
-
getVariableProvider
-