Package org.cyclops.cyclopscore.helper
Class MinecraftHelpers
java.lang.Object
org.cyclops.cyclopscore.helper.MinecraftHelpers
Contains helper methods for various minecraft specific things.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Cause a regular blockState update.static final int
Send a blockState update to the client.static final int
Stop the blockState from re-rendering.static final int
The amount of steps there are in a vanilla comparator.static final int
The length of one Minecraft day.static final int
The amount of ticks that go in one second. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
compareBlockPos
(net.minecraft.core.BlockPos pos1, net.minecraft.core.BlockPos pos2) Comparator forBlockPos
.static String
static String
static boolean
static boolean
static boolean
static boolean
static boolean
Check if we are inside a modded minecraft environment.static boolean
isPlayerInventoryFull
(net.minecraft.world.entity.player.Player player) Check if the given player inventory is full.static boolean
static void
setDay
(net.minecraft.server.level.ServerLevel world, boolean toDay) Set the world time to day or night.static <T> net.minecraft.world.InteractionResultHolder<T>
successAction
(T result) Create a new successfull action result.
-
Field Details
-
MINECRAFT_DAY
public static final int MINECRAFT_DAYThe length of one Minecraft day.- See Also:
-
COMPARATOR_MULTIPLIER
public static final int COMPARATOR_MULTIPLIERThe amount of steps there are in a vanilla comparator.- See Also:
-
SECOND_IN_TICKS
public static final int SECOND_IN_TICKSThe amount of ticks that go in one second.- See Also:
-
BLOCK_NOTIFY
public static final int BLOCK_NOTIFYCause a regular blockState update.- See Also:
-
BLOCK_NOTIFY_CLIENT
public static final int BLOCK_NOTIFY_CLIENTSend a blockState update to the client.- See Also:
-
BLOCK_NOTIFY_NO_RERENDER
public static final int BLOCK_NOTIFY_NO_RERENDERStop the blockState from re-rendering.- See Also:
-
-
Constructor Details
-
MinecraftHelpers
public MinecraftHelpers()
-
-
Method Details
-
setDay
public static void setDay(net.minecraft.server.level.ServerLevel world, boolean toDay) Set the world time to day or night.- Parameters:
world
- the world to manipulate time in.toDay
- if true, set to day, otherwise to night.
-
isPlayerInventoryFull
public static boolean isPlayerInventoryFull(net.minecraft.world.entity.player.Player player) Check if the given player inventory is full.- Parameters:
player
- The player.- Returns:
- If the player does not have a free spot in it's inventory.
-
isDevEnvironment
public static boolean isDevEnvironment()- Returns:
- If we are currently running inside a deobfuscated development environment.
-
isMinecraftInitialized
public static boolean isMinecraftInitialized()- Returns:
- If minecraft has been fully loaded.
-
getMinecraftVersion
- Returns:
- The Minecraft version (e.g. "1.14.4")
-
getMinecraftVersionMajorMinor
- Returns:
- The Minecraft major and minor version (e.g. "1.14")
-
isModdedEnvironment
public static boolean isModdedEnvironment()Check if we are inside a modded minecraft environment.- Returns:
- If in minecraft.
-
isShifted
public static boolean isShifted()- Returns:
- If the user is shifted.
-
compareBlockPos
public static int compareBlockPos(net.minecraft.core.BlockPos pos1, net.minecraft.core.BlockPos pos2) Comparator forBlockPos
.- Parameters:
pos1
- First pos.pos2
- Second pos.- Returns:
- The compared value.
-
successAction
public static <T> net.minecraft.world.InteractionResultHolder<T> successAction(T result) Create a new successfull action result.- Type Parameters:
T
- The type.- Parameters:
result
- The result element.- Returns:
- The action result.
-
isClientSide
public static boolean isClientSide()- Returns:
- If we are physically running on a client.
-
isClientSideThread
public static boolean isClientSideThread()- Returns:
- If we are physically running on a client and are running in the client thread.
-