Skip to content

Commit

Permalink
Fix build error and fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Dec 10, 2024
1 parent 9462109 commit 3aa9690
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.http.HttpClient;
import java.util.concurrent.CompletableFuture;

import static ooo.foooooooooooo.wickedpaintings.util.ImageUtils.DEFAULT_TEX;

public class PaintingTexture extends ResourceTexture {
private static final HttpClient CLIENT = HttpClient.newBuilder().build();
private static final String USER_AGENT = "WickedPaintings (Minecraft Mod)";

public boolean tooLarge = false;
Expand Down Expand Up @@ -57,7 +55,7 @@ public void load(ResourceManager manager) {
});

if (this.loader == null) {
this.loader = CompletableFuture.runAsync(this::download, Util.getDownloadWorkerExecutor());
this.loader = CompletableFuture.runAsync(this::download, Util.getIoWorkerExecutor());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.joml.Matrix3f;
import org.joml.Matrix4f;
import org.joml.Quaternionf;

import static ooo.foooooooooooo.wickedpaintings.util.ImageUtils.DEFAULT_TEX;
import static ooo.foooooooooooo.wickedpaintings.util.ImageUtils.getOrLoadImage;

Expand All @@ -29,26 +28,12 @@ public WickedPaintingEntityRenderer(EntityRendererFactory.Context context) {

public static Quaternionf quaternionFromEulerAngles(float x, float y, float z, boolean degrees) {
if (degrees) {
x *= 0.017453292F;
y *= 0.017453292F;
z *= 0.017453292F;
x *= MathHelper.RADIANS_PER_DEGREE;
y *= MathHelper.RADIANS_PER_DEGREE;
z *= MathHelper.RADIANS_PER_DEGREE;
}

var f = MathHelper.sin(0.5F * x);
var g = MathHelper.cos(0.5F * x);
var h = MathHelper.sin(0.5F * y);
var i = MathHelper.cos(0.5F * y);
var j = MathHelper.sin(0.5F * z);
var k = MathHelper.cos(0.5F * z);

// @formatter:off
return new Quaternionf(
f * i * k + g * h * j,
g * h * k - f * i * j,
f * h * k + g * i * j,
g * i * k - f * h * j
);
// @formatter:on
return new Quaternionf(0, 0, 0, 1).rotateXYZ(x, y, z);
}

@Override
Expand Down Expand Up @@ -79,6 +64,7 @@ public Identifier getTexture(WickedPaintingEntity entity) {
return DEFAULT_TEX;
}

@SuppressWarnings("incomplete-switch")
private void drawTexture(MatrixStack matrices, VertexConsumer consumer, WickedPaintingEntity entity, int width, int height) {
var entry = matrices.peek();

Expand All @@ -88,8 +74,8 @@ private void drawTexture(MatrixStack matrices, VertexConsumer consumer, WickedPa
var offsetX = -width / 2f;
var offsetY = -height / 2f;

var scaleX = 1f / (float) width;
var scaleY = 1f / (float) height;
var scaleX = 1f / width;
var scaleY = 1f / height;

var lightX = entity.getBlockX();
var lightY = entity.getBlockY();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
import io.github.cottonmc.cotton.gui.widget.WWidget;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;

public class ImageWidget extends WWidget {
Expand Down

0 comments on commit 3aa9690

Please sign in to comment.