Class MeteorUtils

java.lang.Object
me.emafire003.dev.ohmymeteors.util.MeteorUtils

public class MeteorUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Must be called client side
    static boolean
    canMeteorSpawn(net.minecraft.server.level.ServerPlayer p)
     
    static boolean
    canMeteorSpawn(net.minecraft.server.level.ServerPlayer p, net.minecraft.core.Holder<net.minecraft.world.level.dimension.DimensionType> current_dim, net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> current_biome)
    Check if the meteor can spawn in a given location and sends out error messages if verbose is true
    static boolean
    canMeteorSpawnVerbose(net.minecraft.server.level.ServerPlayer p, net.minecraft.commands.CommandSourceStack source)
     
    static boolean
    canMeteorSpawnVerbose(net.minecraft.server.level.ServerPlayer p, net.minecraft.commands.CommandSourceStack source, net.minecraft.core.Holder<net.minecraft.world.level.dimension.DimensionType> current_dim, net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> current_biome)
     
    static boolean
    canSpawnInBiome(net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> current_biome)
    Checks if the meteor can spawn in the given biome
    static boolean
    canSpawnInDimension(net.minecraft.core.Holder<net.minecraft.world.level.dimension.DimensionType> current_dim)
    Checks if the meteor can spawn in the given dimension
    static boolean
    canSpawnInModdedRegion(net.minecraft.server.level.ServerPlayer p)
    Checks if the meteor can spawn in the given modded region
    static List<UUID>
     
    getDownwardsMeteor(net.minecraft.world.phys.Vec3 originPos, net.minecraft.server.level.ServerLevel world, int min_spawn_d, int max_spawn_d, double spawn_height, int min_size, int max_size, boolean homing)
    Gets a meteor object to be spawned in, with a velocity oriented downwards and a spawn position already set up
    static net.minecraft.util.Tuple<net.minecraft.world.phys.Vec3,net.minecraft.world.phys.Vec3>
    getDownwardsMeteorPosAndVelocity(net.minecraft.world.phys.Vec3 originPos, net.minecraft.server.level.ServerLevel world, int min_spawn_d, int max_spawn_d, double spawn_height)
    Used to get a random meteor position and velocity oriented downwards
    getDownwardsMeteorSameDirection(net.minecraft.world.phys.Vec3 prev_origin, net.minecraft.world.phys.Vec3 prev_vel, net.minecraft.server.level.ServerLevel world, int min_spawn_d, int max_spawn_d, double spawn_height, int min_size, int max_size, boolean homing)
    Used when spawning an orderd meteor shower where most meteors share the same general direction as the previous one
    static void
    Must be called client side
    static void
    spawnMeteor(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.player.Player p, boolean silenced)
    Spawns a meteor around a random alive online player
    static void
    spawnMeteorShowerDelayed(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.player.Player p)
    Spawns a meteor shower with meteors going in random directions but with a slight delay between them unlike spawnMeteorShowerInstant(ServerLevel, Player) where all meteors spawn at the same time.
    static void
    spawnMeteorShowerDelayedDirection(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.player.Player p)
    Spawns meteor showers that generally go in the same direction each delayed by a bit
    static void
    spawnMeteorShowerInstant(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.player.Player p)
    Spawns a meteor shower where all meteors spawn at the same time in random directions around the point of origin Also check out spawnMeteorShowerDelayed(ServerLevel, Player) and spawnMeteorShowerDelayedDirection(ServerLevel, Player)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MeteorUtils

      public MeteorUtils()
  • Method Details

    • getAliveMeteors

      public static List<UUID> getAliveMeteors()
    • addAliveMeteor

      public static void addAliveMeteor(UUID id)
      Must be called client side
    • removeAliveMeteor

      public static void removeAliveMeteor(UUID id)
      Must be called client side
    • getDownwardsMeteorPosAndVelocity

      public static net.minecraft.util.Tuple<net.minecraft.world.phys.Vec3,net.minecraft.world.phys.Vec3> getDownwardsMeteorPosAndVelocity(net.minecraft.world.phys.Vec3 originPos, net.minecraft.server.level.ServerLevel world, int min_spawn_d, int max_spawn_d, double spawn_height)
      Used to get a random meteor position and velocity oriented downwards
      Returns:
      a Pair, where the first value is the Position and teh second one the Velocity
    • getDownwardsMeteor

      public static MeteorProjectileEntity getDownwardsMeteor(net.minecraft.world.phys.Vec3 originPos, net.minecraft.server.level.ServerLevel world, int min_spawn_d, int max_spawn_d, double spawn_height, int min_size, int max_size, boolean homing)
      Gets a meteor object to be spawned in, with a velocity oriented downwards and a spawn position already set up
    • getDownwardsMeteorSameDirection

      public static MeteorProjectileEntity getDownwardsMeteorSameDirection(net.minecraft.world.phys.Vec3 prev_origin, net.minecraft.world.phys.Vec3 prev_vel, net.minecraft.server.level.ServerLevel world, int min_spawn_d, int max_spawn_d, double spawn_height, int min_size, int max_size, boolean homing)
      Used when spawning an orderd meteor shower where most meteors share the same general direction as the previous one

      Returns a new meteor object with a general direction similar to the specified one, but slightly different origin and velocity The spawn distances are for the new spread, so keep the generally low

    • spawnMeteor

      public static void spawnMeteor(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.player.Player p, boolean silenced)
      Spawns a meteor around a random alive online player
      Parameters:
      world - The world in which the meteors are gonna be spawned in
      p - The player around which the meteor will spawn
      silenced - Weather or not the meteor should be announced in chat
    • spawnMeteorShowerInstant

      public static void spawnMeteorShowerInstant(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.player.Player p)
      Spawns a meteor shower where all meteors spawn at the same time in random directions around the point of origin Also check out spawnMeteorShowerDelayed(ServerLevel, Player) and spawnMeteorShowerDelayedDirection(ServerLevel, Player)
    • spawnMeteorShowerDelayed

      public static void spawnMeteorShowerDelayed(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.player.Player p)
      Spawns a meteor shower with meteors going in random directions but with a slight delay between them unlike spawnMeteorShowerInstant(ServerLevel, Player) where all meteors spawn at the same time. Using spawnMeteorShowerDelayedDirection(ServerLevel, Player) will also have them follow the same general direction
    • spawnMeteorShowerDelayedDirection

      public static void spawnMeteorShowerDelayedDirection(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.player.Player p)
      Spawns meteor showers that generally go in the same direction each delayed by a bit
    • canSpawnInDimension

      public static boolean canSpawnInDimension(net.minecraft.core.Holder<net.minecraft.world.level.dimension.DimensionType> current_dim)
      Checks if the meteor can spawn in the given dimension
      Parameters:
      current_dim - The dimension on which to perform the check
      Returns:
      true if the meteor can spawn in there, false otherwise
    • canSpawnInBiome

      public static boolean canSpawnInBiome(net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> current_biome)
      Checks if the meteor can spawn in the given biome
      Parameters:
      current_biome - The biome on which to perform the check
      Returns:
      true if the meteor can spawn in there, false otherwise
    • canSpawnInModdedRegion

      public static boolean canSpawnInModdedRegion(net.minecraft.server.level.ServerPlayer p)
      Checks if the meteor can spawn in the given modded region
      Parameters:
      p - The player at whose position the meteor is going to spawn
      Returns:
      true if the meteor can spawn in there, false otherwise
    • canMeteorSpawn

      public static boolean canMeteorSpawn(net.minecraft.server.level.ServerPlayer p, net.minecraft.core.Holder<net.minecraft.world.level.dimension.DimensionType> current_dim, net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> current_biome)
      Check if the meteor can spawn in a given location and sends out error messages if verbose is true
    • canMeteorSpawn

      public static boolean canMeteorSpawn(net.minecraft.server.level.ServerPlayer p)
    • canMeteorSpawnVerbose

      public static boolean canMeteorSpawnVerbose(net.minecraft.server.level.ServerPlayer p, net.minecraft.commands.CommandSourceStack source, net.minecraft.core.Holder<net.minecraft.world.level.dimension.DimensionType> current_dim, net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> current_biome)
    • canMeteorSpawnVerbose

      public static boolean canMeteorSpawnVerbose(net.minecraft.server.level.ServerPlayer p, net.minecraft.commands.CommandSourceStack source)