Class MinecraftHelpers

java.lang.Object
org.cyclops.cyclopscore.helper.MinecraftHelpers

public class MinecraftHelpers extends Object
Contains helper methods for various minecraft specific things.
  • Field Details

    • MINECRAFT_DAY

      public static final int MINECRAFT_DAY
      The length of one Minecraft day.
      See Also:
    • COMPARATOR_MULTIPLIER

      public static final int COMPARATOR_MULTIPLIER
      The amount of steps there are in a vanilla comparator.
      See Also:
    • SECOND_IN_TICKS

      public static final int SECOND_IN_TICKS
      The amount of ticks that go in one second.
      See Also:
    • BLOCK_NOTIFY

      public static final int BLOCK_NOTIFY
      Cause a regular blockState update.
      See Also:
    • BLOCK_NOTIFY_CLIENT

      public static final int BLOCK_NOTIFY_CLIENT
      Send a blockState update to the client.
      See Also:
    • BLOCK_NOTIFY_NO_RERENDER

      public static final int BLOCK_NOTIFY_NO_RERENDER
      Stop 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

      public static String getMinecraftVersion()
      Returns:
      The Minecraft version (e.g. "1.14.4")
    • getMinecraftVersionMajorMinor

      public static String 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 for BlockPos.
      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.