-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add fluid rendering to multiblocks
includes a refactor of services to have separate client services Closes #156
- Loading branch information
1 parent
69a146f
commit 6ae19a8
Showing
32 changed files
with
536 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
common/src/main/java/com/klikli_dev/modonomicon/client/render/FluidBlockVertexConsumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2022 Authors of Patchouli | ||
* SPDX-FileCopyrightText: 2023 klikli-dev | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
package com.klikli_dev.modonomicon.client.render; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import net.minecraft.core.BlockPos; | ||
|
||
public record FluidBlockVertexConsumer(VertexConsumer prior, PoseStack pose, BlockPos pos) implements VertexConsumer { | ||
|
||
@Override | ||
public VertexConsumer vertex(double x, double y, double z) { | ||
final float dx = this.pos.getX() & 15; | ||
final float dy = this.pos.getY() & 15; | ||
final float dz = this.pos.getZ() & 15; | ||
return this.prior.vertex(this.pose.last().pose(), (float) x - dx, (float) y - dy, (float) z - dz); | ||
} | ||
|
||
@Override | ||
public VertexConsumer color(int r, int g, int b, int a) { | ||
return this.prior.color(r, g, b, a); | ||
} | ||
|
||
@Override | ||
public VertexConsumer uv(float u, float v) { | ||
return this.prior.uv(u, v); | ||
} | ||
|
||
@Override | ||
public VertexConsumer overlayCoords(int u, int v) { | ||
return this.prior.overlayCoords(u, v); | ||
} | ||
|
||
@Override | ||
public VertexConsumer uv2(int u, int v) { | ||
return this.prior.uv2(u, v); | ||
} | ||
|
||
@Override | ||
public VertexConsumer normal(float x, float y, float z) { | ||
return this.prior.normal(this.pose.last().normal(), x, y, z); | ||
} | ||
|
||
@Override | ||
public void endVertex() { | ||
this.prior.endVertex(); | ||
} | ||
|
||
@Override | ||
public void defaultColor(int r, int g, int b, int a) { | ||
this.prior.defaultColor(r, g, b, a); | ||
} | ||
|
||
@Override | ||
public void unsetDefaultColor() { | ||
this.prior.unsetDefaultColor(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.