Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KrLite committed May 21, 2023
1 parent 5319104 commit 9e0fc29
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true

# https://fabricmc.net/develop
minecraft_version = 1.19.3
yarn_mappings = 1.19.3+build.5
minecraft_version = 1.19
yarn_mappings = 1.19+build.4
loader_version = 0.14.19

mod_version = 1.1.0
maven_group = net.krlite
archives_base_name = flash

# Dependencies
fabric_version = 0.76.1+1.19.3
fabric_version = 0.58.0+1.19
equator_version = v2.4.0
9 changes: 4 additions & 5 deletions src/main/java/net/krlite/flash/Flash.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.ScreenshotRecorder;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
import org.slf4j.Logger;
Expand Down Expand Up @@ -59,10 +58,10 @@ static void listenInput(MinecraftClient client) {
}

public static class Sounds {
public static final SoundEvent CAMERA_SHUTTER = SoundEvent.of(new Identifier(ID, "camera_shutter"));
public static final SoundEvent CAMERA_SHUTTER = new SoundEvent(new Identifier(ID, "camera_shutter"));

static void register() {
Registry.register(Registries.SOUND_EVENT, CAMERA_SHUTTER.getId(), CAMERA_SHUTTER);
Registry.register(Registry.SOUND_EVENT, CAMERA_SHUTTER.getId(), CAMERA_SHUTTER);
}

public static void playCameraShutter() {
Expand Down Expand Up @@ -109,7 +108,7 @@ public static int height() {

public static AccurateColor getBorderColor() {
if (MinecraftClient.getInstance().world != null) {
Vec3d color = MinecraftClient.getInstance().world.getSkyColor(MinecraftClient.getInstance().gameRenderer.getCamera().getBlockPos().toCenterPos(), 0);
Vec3d color = MinecraftClient.getInstance().world.getSkyColor(Vec3d.ofCenter(MinecraftClient.getInstance().gameRenderer.getCamera().getBlockPos()), 0);
float[] hsb = Color.RGBtoHSB((int) (color.x * 255), (int) (color.y * 255), (int) (color.z * 255), null);
hsb[2] = 1 - hsb[2];
return new AccurateColor(Colorspace.HSV, ColorConvertor.floatToDouble(hsb), 1);
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/krlite/flash/FlashRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
import org.joml.Matrix4f;
import net.minecraft.util.math.Matrix4f;
import org.lwjgl.opengl.GL11;

import java.nio.IntBuffer;
Expand Down Expand Up @@ -37,7 +37,7 @@ public static void render(MatrixStack matrixStack, IntBuffer intBuffer) {
Matrix4f matrix = matrixStack.peek().getPositionMatrix();

// Background
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
RenderSystem.setShader(GameRenderer::getPositionColorShader);

builder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);

Expand All @@ -46,10 +46,10 @@ public static void render(MatrixStack matrixStack, IntBuffer intBuffer) {
color(builder, matrix, minWidth / 2 + Flash.BORDER, height / 2 + Flash.BORDER, borderColor); // Bottom right
color(builder, matrix, width / 2 + Flash.BORDER, -(minHeight / 2 + Flash.BORDER), borderColor); // Top right

BufferRenderer.drawWithGlobalProgram(builder.end());
BufferRenderer.drawWithShader(builder.end());

RenderSystem.disableCull();
RenderSystem.setShader(GameRenderer::getPositionTexColorProgram);
RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
RenderSystem.setShaderTexture(0, textureId);

builder.begin(VertexFormat.DrawMode.TRIANGLE_STRIP, VertexFormats.POSITION_TEXTURE_COLOR);
Expand All @@ -70,7 +70,7 @@ public static void render(MatrixStack matrixStack, IntBuffer intBuffer) {
); // Right
}

BufferRenderer.drawWithGlobalProgram(builder.end());
BufferRenderer.drawWithShader(builder.end());
RenderSystem.enableCull();

matrixStack.pop();
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

"depends": {
"fabricloader": ">=0.14.19",
"fabric-api": "*",
"fabric": "*",
"fabric-key-binding-api-v1": "*",
"minecraft": "~1.19.3"
"minecraft": ["~1.19", "~1.19.1", "~1.19.2"]
},
"suggests": {
}
Expand Down

0 comments on commit 9e0fc29

Please sign in to comment.