Skip to content

Commit

Permalink
clouds and tag fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Oct 9, 2024
1 parent f91ba1f commit b6f8e3f
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public CloudRendererMixin() {
throw new NullPointerException("null cannot be cast to non-null type net.minecraft.client.world.ClientWorld");
}

@Inject(method = "renderClouds(Lnet/minecraft/client/util/math/MatrixStack;Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FDDD)V", at = @At("HEAD"), cancellable = true)
@Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true)
public void renderClouds(MatrixStack matrices, Matrix4f matrix4f, Matrix4f matrix4f2, float tickDelta, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) {
if (world.getRegistryKey() == ParadiseLostDimension.PARADISE_LOST_WORLD_KEY) {
internalCloudRender(matrices, matrix4f, matrix4f2, tickDelta, cameraX, cameraY, cameraZ, 160, 1f, 1f);
Expand All @@ -74,24 +74,21 @@ public void renderClouds(MatrixStack matrices, Matrix4f matrix4f, Matrix4f matri

// TODO: Replace this mostly copy-pasted code with some redirects or injections (PL-1.7)
private void internalCloudRender(MatrixStack matrices, Matrix4f matrix4f, Matrix4f matrix4f2, float tickDelta, double cameraX, double cameraY, double cameraZ, float cloudOffset, float cloudScale, float speedMod) {
float f = this.world.getDimensionEffects().getCloudsHeight();
if (!Float.isNaN(f)) {
float g = 12.0F;
float h = 4.0F;
double d = 2.0E-4;
double e = (((float)this.ticks + tickDelta) * 0.03F);
double i = (cameraX + e) / 12.0;
double j = (f - (float)cameraY + 0.33F);
double k = cameraZ / 12.0 + 0.33000001311302185;
i -= (MathHelper.floor(i / 2048.0) * 2048);
k -= (MathHelper.floor(k / 2048.0) * 2048);
float l = (float)(i - (double)MathHelper.floor(i));
float m = (float)(j / 4.0 - (double)MathHelper.floor(j / 4.0)) * 4.0F;
float n = (float)(k - (double)MathHelper.floor(k));
float cloudHeight = this.world.getDimensionEffects().getCloudsHeight();
if (!Float.isNaN(cloudHeight)) {
double speed = ((this.ticks + tickDelta) * (0.03F * speedMod));
double posX = (cameraX + speed) / 12.0D / cloudScale;
double posY = (cloudHeight - cameraY + cloudOffset) / cloudScale + 0.33F;
double posZ = cameraZ / 12.0D / cloudScale + 0.33000001311302185D;
posX -= (MathHelper.floor(posX / 2048.0) * 2048);
posZ -= (MathHelper.floor(posZ / 2048.0) * 2048);
float l = (float)(posX - (double)MathHelper.floor(posX));
float m = (float)(posY / 4.0 - (double)MathHelper.floor(posY / 4.0)) * 4.0F;
float n = (float)(posZ - (double)MathHelper.floor(posZ));
Vec3d vec3d = this.world.getCloudsColor(tickDelta);
int o = (int)Math.floor(i);
int p = (int)Math.floor(j / 4.0);
int q = (int)Math.floor(k);
int o = (int)Math.floor(posX);
int p = (int)Math.floor(posY / 4.0);
int q = (int)Math.floor(posZ);
if (o != this.lastCloudsBlockX || p != this.lastCloudsBlockY || q != this.lastCloudsBlockZ || this.client.options.getCloudRenderModeValue() != this.lastCloudRenderMode || this.lastCloudsColor.squaredDistanceTo(vec3d) > 2.0E-4) {
this.lastCloudsBlockX = o;
this.lastCloudsBlockY = p;
Expand All @@ -109,7 +106,7 @@ private void internalCloudRender(MatrixStack matrices, Matrix4f matrix4f, Matrix
}

this.cloudsBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC);
BufferBuilder.BuiltBuffer builtBuffer = this.renderClouds(bufferBuilder, i, j, k, vec3d);
BufferBuilder.BuiltBuffer builtBuffer = this.renderClouds(bufferBuilder, posX, posY, posZ, vec3d);
this.cloudsBuffer.bind();
this.cloudsBuffer.upload(builtBuffer);
VertexBuffer.unbind();
Expand All @@ -119,6 +116,7 @@ private void internalCloudRender(MatrixStack matrices, Matrix4f matrix4f, Matrix
matrices.push();
matrices.multiplyPositionMatrix(matrix4f);
matrices.scale(12.0F, 1.0F, 12.0F);
matrices.scale(cloudScale, cloudScale, cloudScale);
matrices.translate(-l, m, -n);
if (this.cloudsBuffer != null) {
this.cloudsBuffer.bind();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"replace": false,
"values": [
"paradise_lost:floestone_brick"
"paradise_lost:aurel_bookshelf"
]
}
6 changes: 6 additions & 0 deletions src/main/resources/data/c/tags/blocks/chains.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"paradise_lost:olvite_chain"
]
}
6 changes: 6 additions & 0 deletions src/main/resources/data/c/tags/blocks/cobblestones.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"paradise_lost:cobbled_floestone"
]
}
9 changes: 0 additions & 9 deletions src/main/resources/data/c/tags/blocks/dressed_bark.json

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/resources/data/c/tags/blocks/dressed_logs.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"replace": false,
"values": [
"paradise_lost:floestone"
]
}
9 changes: 0 additions & 9 deletions src/main/resources/data/c/tags/blocks/stripped_bark.json

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/resources/data/c/tags/blocks/stripped_logs.json

This file was deleted.

6 changes: 6 additions & 0 deletions src/main/resources/data/c/tags/item/foods/cooked_meat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"#paradise_lost:cooked_meat"
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"replace": false,
"values": [
"#paradise_lost:raw_meat"
]
}
8 changes: 0 additions & 8 deletions src/main/resources/data/fabric/tags/items/axes.json

This file was deleted.

13 changes: 0 additions & 13 deletions src/main/resources/data/fabric/tags/items/cooked_meat.json

This file was deleted.

8 changes: 0 additions & 8 deletions src/main/resources/data/fabric/tags/items/hoes.json

This file was deleted.

8 changes: 0 additions & 8 deletions src/main/resources/data/fabric/tags/items/pickaxes.json

This file was deleted.

13 changes: 0 additions & 13 deletions src/main/resources/data/fabric/tags/items/raw_meat.json

This file was deleted.

8 changes: 0 additions & 8 deletions src/main/resources/data/fabric/tags/items/shovels.json

This file was deleted.

8 changes: 0 additions & 8 deletions src/main/resources/data/fabric/tags/items/swords.json

This file was deleted.

0 comments on commit b6f8e3f

Please sign in to comment.