Class MeteorUtils
java.lang.Object
me.emafire003.dev.ohmymeteors.util.MeteorUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAliveMeteor(UUID id) Must be called client sidestatic booleancanMeteorSpawn(net.minecraft.server.level.ServerPlayer p) static booleancanMeteorSpawn(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 truestatic booleancanMeteorSpawnVerbose(net.minecraft.server.level.ServerPlayer p, net.minecraft.commands.CommandSourceStack source) static booleancanMeteorSpawnVerbose(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 booleancanSpawnInBiome(net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> current_biome) Checks if the meteor can spawn in the given biomestatic booleancanSpawnInDimension(net.minecraft.core.Holder<net.minecraft.world.level.dimension.DimensionType> current_dim) Checks if the meteor can spawn in the given dimensionstatic booleancanSpawnInModdedRegion(net.minecraft.server.level.ServerPlayer p) Checks if the meteor can spawn in the given modded regionstatic MeteorProjectileEntitygetDownwardsMeteor(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 upstatic 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 downwardsstatic MeteorProjectileEntitygetDownwardsMeteorSameDirection(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 onestatic voidMust be called client sidestatic voidspawnMeteor(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.player.Player p, boolean silenced) Spawns a meteor around a random alive online playerstatic voidspawnMeteorShowerDelayed(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 unlikespawnMeteorShowerInstant(ServerLevel, Player)where all meteors spawn at the same time.static voidspawnMeteorShowerDelayedDirection(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 bitstatic voidspawnMeteorShowerInstant(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 outspawnMeteorShowerDelayed(ServerLevel, Player)andspawnMeteorShowerDelayedDirection(ServerLevel, Player)
-
Constructor Details
-
MeteorUtils
public MeteorUtils()
-
-
Method Details
-
getAliveMeteors
-
addAliveMeteor
Must be called client side -
removeAliveMeteor
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 oneReturns 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 inp- The player around which the meteor will spawnsilenced- 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 outspawnMeteorShowerDelayed(ServerLevel, Player)andspawnMeteorShowerDelayedDirection(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 unlikespawnMeteorShowerInstant(ServerLevel, Player)where all meteors spawn at the same time. UsingspawnMeteorShowerDelayedDirection(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)
-