Celestria 2.0.0 - Improved Everything

- Port to 1.21
- Neoforge support
- Multiple shooting stars at the same time
- Stellar nights based on moon phase -> Increased shooting star rate
- Stars now move linearly instead of rotating
- Serverside-mode using Polymer
This commit is contained in:
Martin Prokoph
2024-08-17 21:20:41 +02:00
parent 541d4d164e
commit a42ffc8593
65 changed files with 1253 additions and 359 deletions

26
common/build.gradle Normal file
View File

@@ -0,0 +1,26 @@
architectury {
common(rootProject.enabled_platforms.split(","))
}
dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
// Using the Fabric version of midnightlib here to create a common config and get useful utilities
// Just make sure NOT to use classes from the .fabric classpath
modCompileOnlyApi "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
}
publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}

View File

@@ -0,0 +1,107 @@
package eu.midnightdust.celestria;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import eu.midnightdust.celestria.effect.StatusEffectInit;
import eu.midnightdust.celestria.util.CommonUtils;
import eu.midnightdust.celestria.util.PacketUtils;
import eu.midnightdust.celestria.util.ShootingStarPayload;
import eu.midnightdust.celestria.util.WelcomePayload;
import eu.midnightdust.celestria.config.CelestriaConfig;
import eu.midnightdust.lib.util.PlatformFunctions;
import net.minecraft.command.argument.EntityArgumentType;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Celestria {
public static final String MOD_ID = "celestria";
public static final Random random = Random.create();
private static int prevPlayerAmount = 0;
public static final List<PlayerEntity> playersWithMod = new ArrayList<>();
public static void init() {
CelestriaConfig.init(MOD_ID, CelestriaConfig.class);
if (CelestriaConfig.enableInsomnia || PlatformFunctions.isClientEnv()) StatusEffectInit.init();
PacketUtils.registerPayloadCommon(WelcomePayload.PACKET_ID, WelcomePayload.codec);
PacketUtils.registerPayloadS2C(ShootingStarPayload.PACKET_ID, ShootingStarPayload.codec);
PacketUtils.registerServerGlobalReceiver(WelcomePayload.PACKET_ID, (payload, player) -> playersWithMod.add(player));
LiteralArgumentBuilder<ServerCommandSource> command = CommandManager.literal("shootingStar")
.then(CommandManager.argument("players", EntityArgumentType.players()).requires(source -> source.hasPermissionLevel(2)).executes(ctx ->
createShootingStar(random.nextBetween(100, 150),
random.nextInt(360),
random.nextInt(3),
random.nextBetween(10, 170),
random.nextBetween(Math.min(CelestriaConfig.shootingStarMinSize, CelestriaConfig.shootingStarMaxSize),
Math.max(CelestriaConfig.shootingStarMaxSize, CelestriaConfig.shootingStarMinSize)),
EntityArgumentType.getPlayers(ctx, "players").toArray(new ServerPlayerEntity[0])))
.then(CommandManager.argument("x", IntegerArgumentType.integer(90, 180))
.then(CommandManager.argument("y", IntegerArgumentType.integer(0, 360))
.then(CommandManager.argument("type", IntegerArgumentType.integer(0, 3))
.then(CommandManager.argument("rotation", IntegerArgumentType.integer(10, 170))
.then(CommandManager.argument("size", IntegerArgumentType.integer(1, 250))
.requires(source -> source.hasPermissionLevel(2)).executes(ctx -> createShootingStar(
IntegerArgumentType.getInteger(ctx, "x"),
IntegerArgumentType.getInteger(ctx, "y"),
IntegerArgumentType.getInteger(ctx, "type"),
IntegerArgumentType.getInteger(ctx, "rotation"),
IntegerArgumentType.getInteger(ctx, "size"),
EntityArgumentType.getPlayers(ctx, "players").toArray(new ServerPlayerEntity[0])))))))));
LiteralArgumentBuilder<ServerCommandSource> finalized = CommandManager.literal("celestria").then(command).requires(source -> source.hasPermissionLevel(2));
PlatformFunctions.registerCommand(finalized);
CommonUtils.registerWorldTickEvent(true, world -> {
if (world.getPlayers().size() > prevPlayerAmount && CelestriaConfig.enableShootingStars) {
playersWithMod.clear();
world.getPlayers().forEach(player -> PacketUtils.sendPlayPayloadS2C((ServerPlayerEntity) player, new WelcomePayload()));
prevPlayerAmount = world.getPlayers().size();
}
if (world.isNight() && CelestriaConfig.enableInsomnia && world.getMoonPhase() == 0) {
for (PlayerEntity player : world.getPlayers()) {
if (world.random.nextInt(CelestriaConfig.insomniaChance) == 0) {
player.addStatusEffect(StatusEffectInit.insomniaEffect());
}
}
}
if (world.isNight() && CelestriaConfig.enableShootingStars && world.random.nextInt(getChance(world)) == 0) {
int x = world.random.nextBetween(100, 150);
int y = world.random.nextInt(360);
int type = world.random.nextInt(3);
int rotation = world.random.nextBetween(10, 170);
int size = world.random.nextBetween(Math.min(CelestriaConfig.shootingStarMinSize, CelestriaConfig.shootingStarMaxSize), Math.max(CelestriaConfig.shootingStarMaxSize, CelestriaConfig.shootingStarMinSize));
createShootingStar(x, y, type, rotation, size, playersWithMod.toArray(new ServerPlayerEntity[0]));
}
});
}
public static int createShootingStar(int x, int y, int type, int rotation, int size, ServerPlayerEntity... players) {
int message = Random.create().nextInt(CelestriaConfig.shootingStarMessages.size());
Arrays.stream(players).forEach(player -> {
player.addStatusEffect(new StatusEffectInstance(StatusEffects.LUCK, CelestriaConfig.shootingStarLuckDuration, 0, true, false, true));
PacketUtils.sendPlayPayloadS2C(player, new ShootingStarPayload(x, y, type, rotation, size));
if (CelestriaConfig.sendChatMessages) player.sendMessageToClient(Text.translatable(CelestriaConfig.shootingStarMessages.get(message)),true);
});
return 1;
}
public static int getChance(World world) {
// Stellar nights will occur when the moon is in the waxing crescent phase
return (world.getMoonPhase() == 5) ? CelestriaConfig.shootingStarChance / 200 : CelestriaConfig.shootingStarChance;
}
public static Identifier id(String path) {
return Identifier.of(MOD_ID, path);
}
}

View File

@@ -0,0 +1,44 @@
package eu.midnightdust.celestria;
import eu.midnightdust.celestria.config.CelestriaConfig;
import eu.midnightdust.celestria.util.ClientUtils;
import eu.midnightdust.celestria.util.PacketUtils;
import eu.midnightdust.celestria.util.ShootingStarPayload;
import eu.midnightdust.celestria.util.WelcomePayload;
import java.util.HashSet;
import java.util.Set;
import static eu.midnightdust.celestria.Celestria.id;
import static eu.midnightdust.celestria.Celestria.random;
public class CelestriaClient {
private static boolean clientOnlyMode = true;
public static Set<ShootingStar> shootingStars = new HashSet<>();
public static void init() {
ClientUtils.registerBuiltinResourcePack(id("realistic"));
ClientUtils.registerBuiltinResourcePack(id("pixelperfect"));
PacketUtils.registerClientGlobalReceiver(WelcomePayload.PACKET_ID,
(payload, player) -> {
PacketUtils.sendPlayPayloadC2S(payload);
CelestriaClient.clientOnlyMode = false;
});
PacketUtils.registerClientGlobalReceiver(ShootingStarPayload.PACKET_ID,
(payload, player) -> {
CelestriaClient.clientOnlyMode = false; // If the welcome packet wasn't received correctly for some reason, disable clientOnlyMode on shooting star occurrence
shootingStars.add(new ShootingStar(CelestriaConfig.shootingStarPathLength, payload.type(), payload.x(), payload.y(), payload.rotation(), payload.size()));
});
ClientUtils.registerClientTick(true, (client) -> {
shootingStars.forEach(ShootingStar::tick);
shootingStars.removeAll(shootingStars.stream().filter(star -> star.progress <= 0).toList());
if (CelestriaClient.clientOnlyMode && CelestriaConfig.enableShootingStars && client.world != null) {
float tickDelta = client.getRenderTickCounter().getTickDelta(true);
if ((180 < client.world.getSkyAngle(tickDelta) * 360 && 270 > client.world.getSkyAngle(tickDelta) * 360) && random.nextInt(Celestria.getChance(client.world)) == 0) {
shootingStars.add(new ShootingStar(CelestriaConfig.shootingStarPathLength, random.nextInt(3), random.nextBetween(100, 150), random.nextInt(360), random.nextBetween(10, 170), random.nextBetween(Math.min(CelestriaConfig.shootingStarMinSize, CelestriaConfig.shootingStarMaxSize), Math.max(CelestriaConfig.shootingStarMaxSize, CelestriaConfig.shootingStarMinSize))));
}
}
});
ClientUtils.registerDisconnectEvent((handler, client) -> CelestriaClient.clientOnlyMode = true);
}
}

View File

@@ -0,0 +1,18 @@
package eu.midnightdust.celestria;
public class ShootingStar {
public int progress;
public final int type, x, y, rotation, size;
public ShootingStar(int progress, int type, int x, int y, int rotation, int size) {
this.progress = progress;
this.type = type;
this.x = x;
this.y = y;
this.rotation = rotation;
this.size = size;
}
public void tick() {
--progress;
}
}

View File

@@ -0,0 +1,25 @@
package eu.midnightdust.celestria.config;
import com.google.common.collect.Lists;
import eu.midnightdust.lib.config.MidnightConfig;
import java.util.List;
public class CelestriaConfig extends MidnightConfig {
public static final String STARS = "stars";
public static final String INSOMNIA = "insomnia";
@Entry public static boolean sendChatMessages = true;
@Entry(category = STARS) public static boolean enableShootingStars = true;
@Entry(category = STARS, isSlider = true, min = 0f, max = 6f) public static float shootingStarDistance = 2f;
@Entry(category = STARS, isSlider = true, min = 1, max = 250) public static int shootingStarMinSize = 25;
@Entry(category = STARS, isSlider = true, min = 1, max = 250) public static int shootingStarMaxSize = 125;
@Entry(category = STARS, isSlider = true, min = 0f, max = 10f) public static float shootingStarSpeed = 6.0f;
@Entry(category = STARS, isSlider = true, min = 0, max = 500) public static int shootingStarPathLength = 50;
@Entry(category = STARS) public static int shootingStarChance = 20000;
@Entry(category = STARS) public static int shootingStarLuckDuration = 1000;
@Entry(category = STARS) public static List<String> shootingStarMessages = Lists.newArrayList("celestria.shootingStar.1", "celestria.shootingStar.2", "celestria.shootingStar.3");
@Entry(category = INSOMNIA) public static boolean enableInsomnia = true;
@Entry(category = INSOMNIA) public static int insomniaChance = 30000;
@Entry(category = INSOMNIA, isSlider = true, min = 0, max = 5000) public static int insomniaDuration = 1000;
@Entry(category = INSOMNIA) public static List<String> insomniaMessages = Lists.newArrayList("celestria.insomnia.1", "celestria.insomnia.2");
}

View File

@@ -0,0 +1,10 @@
package eu.midnightdust.celestria.effect;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
public class InsomniaStatusEffect extends StatusEffect {
public InsomniaStatusEffect(StatusEffectCategory statusEffectCategory, int color) {
super(statusEffectCategory, color);
}
}

View File

@@ -0,0 +1,33 @@
package eu.midnightdust.celestria.effect;
import eu.midnightdust.celestria.config.CelestriaConfig;
import eu.midnightdust.celestria.util.PolymerUtils;
import eu.midnightdust.lib.util.MidnightColorUtil;
import eu.midnightdust.lib.util.PlatformFunctions;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import static eu.midnightdust.celestria.Celestria.id;
public class StatusEffectInit {
public static final StatusEffect INSOMNIA = initInsomnia();
public static RegistryEntry<StatusEffect> INSOMNIA_EFFECT;
public static void init() {
if (!PlatformFunctions.getPlatformName().equals("neoforge")) {
Registry.register(Registries.STATUS_EFFECT, id("insomnia"), INSOMNIA);
INSOMNIA_EFFECT = Registries.STATUS_EFFECT.getEntry(INSOMNIA);
}
}
public static StatusEffectInstance insomniaEffect() {
return new StatusEffectInstance(INSOMNIA_EFFECT, CelestriaConfig.insomniaDuration, 0, true, false, true);
}
public static StatusEffect initInsomnia() {
if (PlatformFunctions.isModLoaded("polymer-core")) return PolymerUtils.initInsomnia();
else return new InsomniaStatusEffect(StatusEffectCategory.HARMFUL, MidnightColorUtil.hex2Rgb("88A9C8").getRGB());
}
}

View File

@@ -0,0 +1,28 @@
package eu.midnightdust.celestria.mixin;
import eu.midnightdust.celestria.config.CelestriaConfig;
import eu.midnightdust.celestria.effect.StatusEffectInit;
import net.minecraft.block.BedBlock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(BedBlock.class)
public abstract class MixinBedBlock {
@Inject(at = @At("HEAD"), method = "onUse", cancellable = true)
public void celestria$onBedUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit, CallbackInfoReturnable<ActionResult> cir) {
if (CelestriaConfig.enableInsomnia && !world.isClient() && player instanceof ServerPlayerEntity serverPlayer && player.hasStatusEffect(StatusEffectInit.INSOMNIA_EFFECT)) {
if (CelestriaConfig.sendChatMessages) serverPlayer.sendMessageToClient(Text.literal("§f§l[§7§lC§8§le§7§ll§f§le§7§ls§8§lt§7§lr§f§li§7§la§8§l] ").append(Text.translatable(CelestriaConfig.insomniaMessages.get(world.random.nextInt(CelestriaConfig.insomniaMessages.size())))),false);
cir.setReturnValue(ActionResult.CONSUME);
}
}
}

View File

@@ -0,0 +1,28 @@
package eu.midnightdust.celestria.mixin;
import eu.midnightdust.celestria.render.ShootingStarRenderer;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.world.ClientWorld;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(WorldRenderer.class)
public abstract class MixinWorldRenderer {
@Unique private final ShootingStarRenderer celestria$shootingStarRenderer = new ShootingStarRenderer();
@Shadow @Nullable private ClientWorld world;
@Inject(at = @At(value = "TAIL"), method = "renderSky(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V")
public void celestria$renderShootingStars(Matrix4f matrix4f, Matrix4f projectionMatrix, float tickDelta, Camera camera, boolean thickFog, Runnable fogCallback, CallbackInfo ci) {
MatrixStack matrices = new MatrixStack();
matrices.multiplyPositionMatrix(matrix4f);
celestria$shootingStarRenderer.renderShootingStars(world, matrices);
}
}

View File

@@ -0,0 +1,62 @@
package eu.midnightdust.celestria.render;
import com.mojang.blaze3d.systems.RenderSystem;
import eu.midnightdust.celestria.CelestriaClient;
import eu.midnightdust.celestria.ShootingStar;
import eu.midnightdust.celestria.config.CelestriaConfig;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.math.RotationAxis;
import org.joml.Matrix4f;
import static eu.midnightdust.celestria.Celestria.id;
import static java.lang.Math.pow;
public class ShootingStarRenderer {
public void renderShootingStars(ClientWorld world, MatrixStack matrices) {
if (world != null && CelestriaConfig.enableShootingStars && !CelestriaClient.shootingStars.isEmpty()) {
world.getProfiler().swap("shooting_stars");
RenderSystem.defaultBlendFunc();
RenderSystem.enableDepthTest();
RenderSystem.enableBlend();
RenderSystem.setShader(GameRenderer::getPositionTexColorProgram);
CelestriaClient.shootingStars.forEach(star -> renderShootingStar(world, matrices, star));
RenderSystem.disableBlend();
RenderSystem.disableDepthTest();
}
}
@SuppressWarnings("SuspiciousNameCombination")
private void renderShootingStar(ClientWorld world, MatrixStack matrices, ShootingStar star) {
if (world != null && CelestriaConfig.enableShootingStars && !CelestriaClient.shootingStars.isEmpty()) {
world.getProfiler().swap("shooting_stars");
float alpha = (float) Math.clamp((star.progress - pow(1f / star.progress, 4)) / CelestriaConfig.shootingStarPathLength, 0, 1);
matrices.push();
matrices.scale(CelestriaConfig.shootingStarDistance,CelestriaConfig.shootingStarDistance,CelestriaConfig.shootingStarDistance);
int direction = isEven(star.type) ? -1 : 1;
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(star.y));
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(star.rotation * direction));
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(star.x+(star.progress*CelestriaConfig.shootingStarSpeed*0.05f)));
matrices.translate(star.progress * CelestriaConfig.shootingStarSpeed * direction, 0, 0);
Matrix4f matrix4f = matrices.peek().getPositionMatrix();
RenderSystem.setShaderTexture(0, id("textures/environment/shooting_star"+(star.type+1)+".png"));
BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
float height = star.size / 100f * 20.0F;
float width = star.size / 100f * 100.0F;
bufferBuilder.vertex(matrix4f, -height, -width, height).texture(0.0F, 0.0F).color(1, 1, 1, alpha);
bufferBuilder.vertex(matrix4f, height, -width, height).texture(1.0F, 0.0F).color(1, 1, 1, alpha);
bufferBuilder.vertex(matrix4f, height, -width, -height).texture(1.0F, 1.0F).color(1, 1, 1, alpha);
bufferBuilder.vertex(matrix4f, -height, -width, -height).texture(0.0F, 1.0F).color(1, 1, 1, alpha);
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
matrices.pop();
}
}
public static boolean isEven(int i) {
return (i | 1) > i;
}
}

View File

@@ -0,0 +1,24 @@
package eu.midnightdust.celestria.util;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.util.Identifier;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
public class ClientUtils {
@ExpectPlatform
public static void registerBuiltinResourcePack(Identifier id) {
throw new AssertionError();
}
@ExpectPlatform
public static void registerClientTick(boolean endTick, Consumer<MinecraftClient> code) {
throw new AssertionError();
}
@ExpectPlatform
public static void registerDisconnectEvent(BiConsumer<ClientPlayNetworkHandler, MinecraftClient> function) {
throw new AssertionError();
}
}

View File

@@ -0,0 +1,13 @@
package eu.midnightdust.celestria.util;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.world.World;
import java.util.function.Consumer;
public class CommonUtils {
@ExpectPlatform
public static void registerWorldTickEvent(boolean endTick, Consumer<World> code) {
throw new AssertionError();
}
}

View File

@@ -0,0 +1,47 @@
package eu.midnightdust.celestria.util;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.server.network.ServerPlayerEntity;
import java.util.function.BiConsumer;
public class PacketUtils {
// Common
@ExpectPlatform
public static <T extends CustomPayload> void registerPayloadCommon(CustomPayload.Id<T> id, PacketCodec<RegistryByteBuf, T> codec) {
throw new AssertionError();
}
// Server
@ExpectPlatform
public static <T extends CustomPayload> void registerPayloadS2C(CustomPayload.Id<T> id, PacketCodec<RegistryByteBuf, T> codec) {
throw new AssertionError();
}
@ExpectPlatform
public static void sendPlayPayloadS2C(ServerPlayerEntity player, CustomPayload payload) {
throw new AssertionError();
}
@ExpectPlatform
public static <T extends CustomPayload> void registerServerGlobalReceiver(CustomPayload.Id<T> id, BiConsumer<T, PlayerEntity> code) {
throw new AssertionError();
}
// Client
@ExpectPlatform
public static <T extends CustomPayload> void registerPayloadC2S(CustomPayload.Id<T> id, PacketCodec<RegistryByteBuf, T> codec) {
throw new AssertionError();
}
@ExpectPlatform
public static void sendPlayPayloadC2S(CustomPayload payload) {
throw new AssertionError();
}
@ExpectPlatform
public static <T extends CustomPayload> void registerClientGlobalReceiver(CustomPayload.Id<T> id, BiConsumer<T, PlayerEntity> code) {
throw new AssertionError();
}
}

View File

@@ -0,0 +1,11 @@
package eu.midnightdust.celestria.util;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.entity.effect.StatusEffect;
public class PolymerUtils {
@ExpectPlatform
public static StatusEffect initInsomnia() {
throw new AssertionError();
}
}

View File

@@ -0,0 +1,24 @@
package eu.midnightdust.celestria.util;
import eu.midnightdust.celestria.Celestria;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
public record ShootingStarPayload(int x, int y, int type, int rotation, int size) implements CustomPayload {
public static final CustomPayload.Id<ShootingStarPayload> PACKET_ID = new CustomPayload.Id<>(Celestria.id("shooting_star"));
public static final PacketCodec<RegistryByteBuf, ShootingStarPayload> codec = PacketCodec.of(ShootingStarPayload::write, ShootingStarPayload::read);
public static ShootingStarPayload read(RegistryByteBuf buf) {
return new ShootingStarPayload(buf.readInt(), buf.readInt(), buf.readInt(), buf.readInt(), buf.readInt());
}
public void write(RegistryByteBuf buf) {
buf.writeInt(x).writeInt(y).writeInt(type).writeInt(rotation).writeInt(size);
}
@Override
public CustomPayload.Id<? extends CustomPayload> getId() {
return PACKET_ID;
}
}

View File

@@ -0,0 +1,16 @@
package eu.midnightdust.celestria.util;
import eu.midnightdust.celestria.Celestria;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
public record WelcomePayload() implements CustomPayload {
public static final CustomPayload.Id<WelcomePayload> PACKET_ID = new CustomPayload.Id<>(Celestria.id("welcome"));
public static final PacketCodec<RegistryByteBuf, WelcomePayload> codec = PacketCodec.of((a, b) -> {}, buf -> new WelcomePayload());
@Override
public Id<? extends CustomPayload> getId() {
return PACKET_ID;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,26 @@
{
"celestria.midnightconfig.title": "Celestria Konfiguration",
"celestria.midnightconfig.category.stars": "Sternschnuppen",
"celestria.midnightconfig.category.insomnia": "Schlaflosigkeit",
"celestria.midnightconfig.sendChatMessages": "Sende Chat Nachrichten bei Events",
"celestria.midnightconfig.enableShootingStars": "Aktiviere Sternschnuppen",
"celestria.midnightconfig.shootingStarDistance": "Entfernung",
"celestria.midnightconfig.shootingStarDistance.tooltip": "Durch Anpassung der Entfernung kann die Kompatibilität mit Shadern verbessert werden.",
"celestria.midnightconfig.shootingStarMaxSize": "Maximale Größe",
"celestria.midnightconfig.shootingStarMinSize": "Minimale Größe",
"celestria.midnightconfig.shootingStarSpeed": "Sternschnuppengeschwindigkeit",
"celestria.midnightconfig.shootingStarPathLength": "Sternschnuppenpfadlänge",
"celestria.midnightconfig.shootingStarChance": "Sternschnuppen-Wahrscheinlichkeit",
"celestria.midnightconfig.shootingStarLuckDuration": "Sternschnuppen Glück Effektlänge",
"celestria.midnightconfig.shootingStarMessages": "Sternschnuppen-Nachrichten",
"celestria.midnightconfig.enableInsomnia": "Aktiviere Schlaflosigkeit",
"celestria.midnightconfig.insomniaChance": "Schlaflosigkeits-Wahrscheinlichkeit",
"celestria.midnightconfig.insomniaMessages": "Schlaflosigkeits-Nachrichten",
"celestria.midnightconfig.insomniaDuration": "Schlaflosigkeit Effektlänge",
"celestria.shootingStar.1": "§eOh, schau! Eine Sternschnuppe ist erschienen und hat dir Glück gebracht!",
"celestria.shootingStar.2": "§6Wow, eine Sternschnuppe ist erschienen, wünsch dir was!",
"celestria.shootingStar.3": "§2♪ Can we pretend that airplanes in the night sky are like shooting stars... ♫",
"celestria.insomnia.1": "§cDu hast Angst vor dem Vollmond, also kannst du einfach nicht einschlafen...",
"celestria.insomnia.2": "§3Ouuwwwh... Du hörst seltsame Geräusche und kannst deine Augen nicht schließen",
"effect.celestria.insomnia": "Schlaflosigkeit"
}

View File

@@ -0,0 +1,26 @@
{
"celestria.midnightconfig.title": "Celestria Config",
"celestria.midnightconfig.category.stars": "Shooting Stars",
"celestria.midnightconfig.category.insomnia": "Insomnia",
"celestria.midnightconfig.sendChatMessages": "Send Chat Messages on Events",
"celestria.midnightconfig.enableShootingStars": "Enable Shooting Stars",
"celestria.midnightconfig.shootingStarDistance": "Distance",
"celestria.midnightconfig.shootingStarDistance.tooltip": "Adjusting the distance can improve shader support",
"celestria.midnightconfig.shootingStarMaxSize": "Max Size",
"celestria.midnightconfig.shootingStarMinSize": "Min Size",
"celestria.midnightconfig.shootingStarSpeed": "Speed",
"celestria.midnightconfig.shootingStarPathLength": "Path Length",
"celestria.midnightconfig.shootingStarChance": "Chance",
"celestria.midnightconfig.shootingStarLuckDuration": "Luck Duration",
"celestria.midnightconfig.shootingStarMessages": "Messages",
"celestria.midnightconfig.enableInsomnia": "Enable Insomnia",
"celestria.midnightconfig.insomniaChance": "Chance",
"celestria.midnightconfig.insomniaMessages": "Messages",
"celestria.midnightconfig.insomniaDuration": "Insomnia Duration",
"celestria.shootingStar.1": "§eOh, look! A shooting star appeared and blessed you with good luck!",
"celestria.shootingStar.2": "§6Wow, a shooting star appeared, make a wish!",
"celestria.shootingStar.3": "§2♪ Can we pretend that airplanes in the night sky are like shooting stars... ♫",
"celestria.insomnia.1": "§cYou're afraid of the full moon, so you just can't find no rest...",
"celestria.insomnia.2": "§3Ouuwwwh... You hear strange noises from afar and can't close your eyes",
"effect.celestria.insomnia": "Insomnia"
}

View File

@@ -0,0 +1,19 @@
{
"celestria.midnightconfig.title": "Настройки Celestria",
"celestria.midnightconfig.sendChatMessages": "Отправлять Сообщения в Чате о Событиях",
"celestria.midnightconfig.enableShootingStars": "Включить Падающие Звёзды",
"celestria.midnightconfig.shootingStarChance": "Шанс Падающей Звезды",
"celestria.midnightconfig.shootingStarCooldownLength": "Длительность Отката Падающей Звезды",
"celestria.midnightconfig.shootingStarLuckDuration": "Длительность Эффекта Удачи от Падающей Звезды",
"celestria.midnightconfig.shootingStarMessages": "Сообщение о Падающей Звезде",
"celestria.midnightconfig.enableInsomnia": "Включить Бессонницу",
"celestria.midnightconfig.insomniaChance": "Шанс Бессонницы",
"celestria.midnightconfig.insomniaMessages": "Сообщение при Бессоннице",
"celestria.midnightconfig.insomniaDuration": "Длительность Эффекта Бессонницы",
"celestria.shootingStar.1": "§eО, гляди! Появилась падающая звезда и благословила тебя удачей!",
"celestria.shootingStar.2": "§6Вау, появилась падающая звезда, загадай желание!",
"celestria.shootingStar.3": "§2♪ Можем ли мы представить, что самолеты в ночном небе походят на падающие звезды...... ♫",
"celestria.insomnia.1": "§cТы боишься полнолуния, поэтому не можешь найти себе покоя...",
"celestria.insomnia.2": "§3Ауууууууу... Ты слышишь странные звуки издалека и не можешь закрыть глаза",
"effect.celestria.insomnia": "Бессонница"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,14 @@
{
"required": true,
"package": "eu.midnightdust.celestria.mixin",
"compatibilityLevel": "JAVA_17",
"client": [
"MixinWorldRenderer"
],
"mixins": [
"MixinBedBlock"
],
"injectors": {
"defaultRequire": 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -0,0 +1,7 @@
{
"pack": {
"pack_format": 15,
"supported_formats": [15, 999],
"description": "Makes the shooting star texture consistent with vanilla stars"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -0,0 +1,2 @@
https://www.pngkey.com/maxpic/u2a9o0o0o0y3u2u2/
https://picsart.com/i/sticker-275568554020211

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -0,0 +1,7 @@
{
"pack": {
"pack_format": 15,
"supported_formats": [15, 999],
"description": "Makes the shooting star textures appear realistic"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB