Class Helpers
java.lang.Object
org.cyclops.integrateddynamics.core.helper.Helpers
Helper methods.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.google.common.base.Predicate
<net.minecraft.world.entity.Entity> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addInterfaceRetriever
(Helpers.IInterfaceRetriever interfaceRetriever) static double
calculateTps
(long[] times) static String
capitalizeString
(String value) Return a string with the first character capitalized.static String
createPatternOfLength
(int length) Create a string of 'length' times '%s' seperated by ','.static net.neoforged.neoforge.fluids.FluidStack
getFluidStack
(net.minecraft.world.item.ItemStack itemStack) Get the fluidstack from the given itemstack.static int
getFluidStackCapacity
(net.minecraft.world.item.ItemStack itemStack) Get the fluidstack capacity from the given itemstack.static <C> Optional
<C> getInterface
(org.cyclops.cyclopscore.datastructure.DimPos dimPos, Class<C> clazz, boolean forceLoad) Check for the given interface at the given position.static net.minecraft.network.chat.Component
getLocalizedEnergyLevel
(int stored, int capacity) Get a localized string showing the ratio of stored energy vs the capacity.static Stream
<net.minecraft.world.item.ItemStack> getTagValues
(String name) Retrieves a Stream of items that are registered to this tag name.static <T> List
<T> Add the given element to a copy of the given list/static long
mean
(long[] values) static <T extends Exception,
R>
R
-
Field Details
-
SELECTOR_IS_PLAYER
public static final com.google.common.base.Predicate<net.minecraft.world.entity.Entity> SELECTOR_IS_PLAYER
-
-
Constructor Details
-
Helpers
public Helpers()
-
-
Method Details
-
getFluidStack
public static net.neoforged.neoforge.fluids.FluidStack getFluidStack(net.minecraft.world.item.ItemStack itemStack) Get the fluidstack from the given itemstack.- Parameters:
itemStack
- The itemstack.- Returns:
- The fluidstack or null.
-
getFluidStackCapacity
public static int getFluidStackCapacity(net.minecraft.world.item.ItemStack itemStack) Get the fluidstack capacity from the given itemstack.- Parameters:
itemStack
- The itemstack.- Returns:
- The capacity
-
getTagValues
public static Stream<net.minecraft.world.item.ItemStack> getTagValues(String name) throws net.minecraft.ResourceLocationException Retrieves a Stream of items that are registered to this tag name.- Parameters:
name
- The tag name, directly calls OreDictionary.getOres- Returns:
- A Stream containing ItemStacks registered for this ore
- Throws:
net.minecraft.ResourceLocationException
-
joinList
Add the given element to a copy of the given list/- Type Parameters:
T
- The type.- Parameters:
list
- The list.newElement
- The element.- Returns:
- The new joined list.
-
createPatternOfLength
Create a string of 'length' times '%s' seperated by ','.- Parameters:
length
- The length for the series of '%s'.- Returns:
- The string.
-
getInterface
public static <C> Optional<C> getInterface(org.cyclops.cyclopscore.datastructure.DimPos dimPos, Class<C> clazz, boolean forceLoad) Check for the given interface at the given position.- Type Parameters:
C
- The class type.- Parameters:
dimPos
- The dimensional position.clazz
- The class to find.forceLoad
- If the world should be loaded if it was not loaded yet.- Returns:
- The optional instance.
-
getLocalizedEnergyLevel
public static net.minecraft.network.chat.Component getLocalizedEnergyLevel(int stored, int capacity) Get a localized string showing the ratio of stored energy vs the capacity.- Parameters:
stored
- The stored amount of energy.capacity
- The capacity of the energy container.- Returns:
- The localized string.
-
calculateTps
public static double calculateTps(long[] times) -
mean
public static long mean(long[] values) -
addInterfaceRetriever
-
capitalizeString
Return a string with the first character capitalized.- Parameters:
value
- A string.- Returns:
- A capitalized string.
-
sneakyThrow
- Throws:
T
-