mirror of
https://github.com/TeamMidnightDust/Celestria.git
synced 2025-12-13 06:35:09 +01:00
Celestria 1.1.0 - Fixes and Improvements
This commit is contained in:
@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
||||
loader_version=0.14.9
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.0
|
||||
mod_version = 1.1.0
|
||||
maven_group = eu.midnightdust
|
||||
archives_base_name = celestria
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.Collection;
|
||||
|
||||
public class Celestria implements ModInitializer {
|
||||
public static final String MOD_ID = "celestria";
|
||||
public static final Random random = Random.create();
|
||||
public static final Identifier SHOOTING_STAR_PACKET = new Identifier(MOD_ID, "shooting_star");
|
||||
public static final Identifier WELCOME_PACKET = new Identifier(MOD_ID, "welcome");
|
||||
public static final StatusEffect INSOMNIA = new InsomniaStatusEffect(StatusEffectCategory.HARMFUL, MidnightColorUtil.hex2Rgb("88A9C8").getRGB());
|
||||
@@ -37,14 +38,13 @@ public class Celestria implements ModInitializer {
|
||||
public void onInitialize() {
|
||||
CelestriaConfig.init(MOD_ID, CelestriaConfig.class);
|
||||
Registry.register(Registry.STATUS_EFFECT, new Identifier(MOD_ID, "insomnia"), INSOMNIA);
|
||||
LiteralArgumentBuilder<ServerCommandSource> command = CommandManager.literal("shootingStar");
|
||||
var commandPlayers = command.then(CommandManager.argument("players", EntityArgumentType.players()));
|
||||
var commandX = commandPlayers.then(CommandManager.argument("x", IntegerArgumentType.integer(90, 180)));
|
||||
var commandY = commandX.then(CommandManager.argument("y", IntegerArgumentType.integer(0, 360)));
|
||||
var commandType = commandY.then(CommandManager.argument("type", IntegerArgumentType.integer(0, 3)));
|
||||
LiteralArgumentBuilder<ServerCommandSource> finalized = CommandManager.literal("celestria").requires(source -> source.hasPermissionLevel(2)).then(commandType).executes(ctx ->
|
||||
createShootingStar(EntityArgumentType.getPlayers(ctx, "players"),
|
||||
IntegerArgumentType.getInteger(ctx, "x"), IntegerArgumentType.getInteger(ctx, "y"), IntegerArgumentType.getInteger(ctx, "type")));
|
||||
LiteralArgumentBuilder<ServerCommandSource> command = CommandManager.literal("shootingStar").then(CommandManager.argument("players", EntityArgumentType.players())
|
||||
.requires(source -> source.hasPermissionLevel(2)).executes(ctx -> createShootingStar(EntityArgumentType.getPlayers(ctx, "players"), random.nextBetween(100, 150), random.nextInt(360), random.nextInt(3)))
|
||||
.then(CommandManager.argument("x", IntegerArgumentType.integer(90, 180))
|
||||
.requires(source -> source.hasPermissionLevel(2)).then(CommandManager.argument("y", IntegerArgumentType.integer(0, 360))
|
||||
.then(CommandManager.argument("type", IntegerArgumentType.integer(0, 3)).requires(source -> source.hasPermissionLevel(2)).executes(ctx -> createShootingStar(EntityArgumentType.getPlayers(ctx, "players"),
|
||||
IntegerArgumentType.getInteger(ctx, "x"), IntegerArgumentType.getInteger(ctx, "y"), IntegerArgumentType.getInteger(ctx, "type")))))));
|
||||
LiteralArgumentBuilder<ServerCommandSource> finalized = CommandManager.literal("celestria").then(command).requires(source -> source.hasPermissionLevel(2));
|
||||
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated, registrationEnvironment) -> dispatcher.register(finalized));
|
||||
ServerTickEvents.END_WORLD_TICK.register(world -> {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class CelestriaClient implements ClientModInitializer {
|
||||
CelestriaClient.shootingStarX = array[0];
|
||||
CelestriaClient.shootingStarY = array[1];
|
||||
CelestriaClient.shootingStarType = array[2];
|
||||
CelestriaClient.shootingStarProgress = 100 + shootingStarType * 10;
|
||||
CelestriaClient.shootingStarProgress = CelestriaConfig.shootingStarPathLength + shootingStarType * 10;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -41,12 +41,14 @@ public class CelestriaClient implements ClientModInitializer {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
if (shootingStarProgress > 0) --shootingStarProgress;
|
||||
if (CelestriaClient.clientOnlyMode && CelestriaConfig.enableShootingStars && client.world != null) {
|
||||
if (Celestria.shootingStarCooldown > 0) --Celestria.shootingStarCooldown;
|
||||
if (client.world.isNight() && Celestria.shootingStarCooldown <= 0 && client.world.random.nextInt(CelestriaConfig.shootingStarChance) == 0) {
|
||||
CelestriaClient.shootingStarX = client.world.random.nextBetween(100, 150);
|
||||
CelestriaClient.shootingStarY = client.world.random.nextInt(360);
|
||||
CelestriaClient.shootingStarType = client.world.random.nextInt(3);
|
||||
CelestriaClient.shootingStarProgress = 100 + shootingStarType * 10;
|
||||
if (Celestria.shootingStarCooldown > 0) {
|
||||
--Celestria.shootingStarCooldown;
|
||||
}
|
||||
if (client.world.isNight() && Celestria.shootingStarCooldown <= 0 && Celestria.random.nextInt(CelestriaConfig.shootingStarChance) == 0) {
|
||||
CelestriaClient.shootingStarX = Celestria.random.nextBetween(100, 150);
|
||||
CelestriaClient.shootingStarY = Celestria.random.nextInt(360);
|
||||
CelestriaClient.shootingStarType = Celestria.random.nextInt(3);
|
||||
CelestriaClient.shootingStarProgress = CelestriaConfig.shootingStarPathLength + CelestriaClient.shootingStarType * 10;
|
||||
Celestria.shootingStarCooldown = CelestriaConfig.shootingStarCooldownLength;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import java.util.List;
|
||||
public class CelestriaConfig extends MidnightConfig {
|
||||
@Entry public static boolean sendChatMessages = true;
|
||||
@Entry public static boolean enableShootingStars = true;
|
||||
@Entry public static float shootingStarScale = 6f;
|
||||
@Entry public static float shootingStarSpeed = 0.5f;
|
||||
@Entry public static int shootingStarPathLength = 100;
|
||||
@Entry public static int shootingStarChance = 20000;
|
||||
@Entry public static int shootingStarCooldownLength = 1000;
|
||||
@Entry public static int shootingStarLuckDuration = 1000;
|
||||
|
||||
@@ -5,10 +5,12 @@ import eu.midnightdust.celestria.Celestria;
|
||||
import eu.midnightdust.celestria.CelestriaClient;
|
||||
import eu.midnightdust.celestria.config.CelestriaConfig;
|
||||
import eu.midnightdust.lib.util.MidnightMathUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
@@ -17,8 +19,9 @@ public class ShootingStarRenderer {
|
||||
if (world != null && CelestriaConfig.enableShootingStars && CelestriaClient.shootingStarProgress > 0) {
|
||||
world.getProfiler().swap("shooting_star");
|
||||
matrices.push();
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(MidnightMathUtil.isEven(CelestriaClient.shootingStarType) ? CelestriaClient.shootingStarY + CelestriaClient.shootingStarProgress : CelestriaClient.shootingStarY - CelestriaClient.shootingStarProgress));
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(CelestriaClient.shootingStarX));
|
||||
matrices.scale(CelestriaConfig.shootingStarScale,CelestriaConfig.shootingStarScale,CelestriaConfig.shootingStarScale);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(MidnightMathUtil.isEven(CelestriaClient.shootingStarType) ? CelestriaClient.shootingStarY + CelestriaClient.shootingStarProgress*CelestriaConfig.shootingStarSpeed : CelestriaClient.shootingStarY - CelestriaClient.shootingStarProgress*CelestriaConfig.shootingStarSpeed));
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(CelestriaClient.shootingStarX+(CelestriaClient.shootingStarProgress*CelestriaConfig.shootingStarSpeed*0.05f)));
|
||||
Matrix4f matrix4f = matrices.peek().getPositionMatrix();
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
"celestria.midnightconfig.title": "Celestria Konfiguration",
|
||||
"celestria.midnightconfig.sendChatMessages": "Sende Chat Nachrichten bei Events",
|
||||
"celestria.midnightconfig.enableShootingStars": "Aktiviere Sternschnuppen",
|
||||
"celestria.midnightconfig.shootingStarScale": "Sternschnuppenskalierung",
|
||||
"celestria.midnightconfig.shootingStarSpeed": "Sternschnuppengeschwindigkeit",
|
||||
"celestria.midnightconfig.shootingStarPathLength": "Sternschnuppenpfadlänge",
|
||||
"celestria.midnightconfig.shootingStarChance": "Sternschnuppen-Wahrscheinlichkeit",
|
||||
"celestria.midnightconfig.shootingStarCooldownLength": "Sternschnuppen Cooldown Länge",
|
||||
"celestria.midnightconfig.shootingStarLuckDuration": "Sternschnuppen Glück Effektlänge",
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
"celestria.midnightconfig.title": "Celestria Config",
|
||||
"celestria.midnightconfig.sendChatMessages": "Send Chat Messages on Events",
|
||||
"celestria.midnightconfig.enableShootingStars": "Enable Shooting Stars",
|
||||
"celestria.midnightconfig.shootingStarScale": "Shooting Star Scale",
|
||||
"celestria.midnightconfig.shootingStarSpeed": "Shooting Star Speed",
|
||||
"celestria.midnightconfig.shootingStarPathLength": "Shooting Star Path Length",
|
||||
"celestria.midnightconfig.shootingStarChance": "Shooting Star Chance",
|
||||
"celestria.midnightconfig.shootingStarCooldownLength": "Shooting Star Cooldown Length",
|
||||
"celestria.midnightconfig.shootingStarLuckDuration": "Shooting Star Luck Duration",
|
||||
|
||||
Reference in New Issue
Block a user