Skip to content

Commit

Permalink
april fools config
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexModGuy committed Apr 1, 2023
1 parent 6299ad7 commit 64005af
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/github/alexthe666/citadel/Citadel.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public void onModConfigEvent(final ModConfigEvent event) {
if (config.getSpec() == ConfigHolder.SERVER_SPEC) {
ServerConfig.citadelEntityTrack = ConfigHolder.SERVER.citadelEntityTracker.get();
ServerConfig.chunkGenSpawnModifierVal = ConfigHolder.SERVER.chunkGenSpawnModifier.get();
ServerConfig.aprilFools = ConfigHolder.SERVER.aprilFoolsContent.get();
//citadelTestBiomeData = SpawnBiomeConfig.create(new ResourceLocation("citadel:config_biome"), CitadelBiomeDefinitions.TERRALITH_TEST);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.github.alexthe666.citadel;

import com.github.alexthe666.citadel.config.ServerConfig;

import java.util.Calendar;
import java.util.Date;

Expand All @@ -18,7 +20,7 @@ public static boolean isAprilFools(){
calendar.setTime(new Date());
aprilFools = calendar.get(Calendar.MONTH) + 1 == 4 && calendar.get(Calendar.DATE) == 1;
}
return aprilFools;
return aprilFools && ServerConfig.aprilFools;
}

}
15 changes: 11 additions & 4 deletions src/main/java/com/github/alexthe666/citadel/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.mojang.math.Axis;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.*;
import net.minecraft.client.renderer.GameRenderer;
Expand Down Expand Up @@ -137,12 +138,18 @@ public void screenRender(ScreenEvent.Render event) {
Tesselator tesselator = Tesselator.getInstance();
BufferBuilder bufferbuilder = tesselator.getBuilder();
bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
bufferbuilder.vertex(0.0D, screenHeight, -90.0D).uv(0.0F, 1.0F).endVertex();
bufferbuilder.vertex(screenWidth, screenHeight, -90.0D).uv(1.0F, 1.0F).endVertex();
bufferbuilder.vertex(screenWidth, 0.0D, -90.0D).uv(1.0F, 0.0F).endVertex();
bufferbuilder.vertex(0.0D, 0.0D, -90.0D).uv(0.0F, 0.0F).endVertex();
bufferbuilder.vertex(0.0D, screenHeight, -800.0D).uv(0.0F, 1.0F).endVertex();
bufferbuilder.vertex(screenWidth, screenHeight, -800.0D).uv(1.0F, 1.0F).endVertex();
bufferbuilder.vertex(screenWidth, 0.0D, -800.0D).uv(1.0F, 0.0F).endVertex();
bufferbuilder.vertex(0.0D, 0.0D, -800.0D).uv(0.0F, 0.0F).endVertex();
tesselator.end();
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
String s = "Happy April Fools from Citadel!";
event.getPoseStack().pushPose();
event.getPoseStack().scale(0.65F, 0.65F, 0.65F);
float hue = (System.currentTimeMillis() % 6000) / 6000f;
GuiComponent.drawString(event.getPoseStack(), Minecraft.getInstance().font, s, 5, 5, Color.HSBtoRGB(hue, 0.6f, 1));
event.getPoseStack().popPose();
}
} else if (rickrollVideo != null) {
rickrollVideo.setPaused(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ private void setupAudio(File mp4File, long time) {
try {
AudioInputStream audioInputStream = aacAudioFileReader.getAudioInputStream(mp4File);
audioClip = AudioSystem.getClip();

audioClip.open(audioInputStream);

audioClip.setMicrosecondPosition(time);
audioClip.start();
if(!hasAudioLoaded){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ public class ServerConfig {
public final ForgeConfigSpec.BooleanValue citadelEntityTracker;
public final ForgeConfigSpec.BooleanValue skipDatapackWarnings;
public final ForgeConfigSpec.DoubleValue chunkGenSpawnModifier;
public final ForgeConfigSpec.BooleanValue aprilFoolsContent;
public static boolean citadelEntityTrack;
public static boolean skipWarnings;
public static double chunkGenSpawnModifierVal = 1.0D;
public static boolean aprilFools;

public ServerConfig(final ForgeConfigSpec.Builder builder) {
builder.push("general");
this.citadelEntityTracker = buildBoolean(builder, "Track Entities", "all", true, "True if citadel tracks entity properties(freezing, stone mobs, etc) on server. Turn this to false to solve some server lag, may break some stuff.");
this.skipDatapackWarnings = buildBoolean(builder, "Skip Datapack Warnings", "all", true, "True to skip warnings about using datapacks.");
this.chunkGenSpawnModifier = builder.comment("Multiplies the count of entities spawned by this number. 0 = no entites added on chunk gen, 2 = twice as many entities added on chunk gen. Useful for many mods that add a lot of creatures, namely animals, to the spawn lists.").translation("chunkGenSpawnModifier").defineInRange("chunkGenSpawnModifier", 1.0F, 0.0F, 100000F);
this.aprilFoolsContent = buildBoolean(builder, "April Fools Content", "all", true, "True to if april fools content can display on april fools.");
}

private static ForgeConfigSpec.BooleanValue buildBoolean(ForgeConfigSpec.Builder builder, String name, String catagory, boolean defaultValue, String comment){
Expand Down

2 comments on commit 64005af

@TNadal
Copy link

@TNadal TNadal commented on 64005af Apr 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the dumbest thing i've seen a human being do "as a prank" that didn't immediately get them arrested or harmed.

@Towich
Copy link

@Towich Towich commented on 64005af Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got

java.lang.NullPointerException: Cannot invoke "net.minecraft.client.resources.model.BakedModel.m_7521_()" because "this.originalModel" is null
at net.minecraftforge.client.model.BakedModelWrapper.m_7521_(BakedModelWrapper.java:81) ~[forge-1.19.2-43.3.0-universal.jar%23720!/:?] {re:classloading,re:mixin}
at com.github.alexthe666.citadel.client.game.Tetris.generateNextTetromino(Tetris.java:209) ~[API-citadel-2.1.4-1.19.jar%23452!/:2.1.4-1.19] {re:classloading}
at com.github.alexthe666.citadel.client.game.Tetris.reset(Tetris.java:336) ~[API-citadel-2.1.4-1.19.jar%23452!/:2.1.4-1.19] {re:classloading}
at com.github.alexthe666.citadel.ClientProxy.clientTick(ClientProxy.java:200) ~[API-citadel-2.1.4-1.19.jar%23452!/:2.1.4-1.19] {re:classloading}
at com.github.alexthe666.citadel.__ClientProxy_clientTick_ClientTickEvent.invoke(.dynamic) ~[API-citadel-2.1.4-1.19.jar%23452!/:2.1.4-1.19] {re:classloading,pl:eventbus:B} because "this.originalModel" is null"

in my minecraft with mods exactly on 1 April

I had to switch my desktop time for 2 April to fix this xD

Please sign in to comment.