-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1279 from ZhuRuoLing/releases/1.21
修复流体渲染以及为方块添加tint
- Loading branch information
Showing
4 changed files
with
147 additions
and
12 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
60 changes: 60 additions & 0 deletions
60
src/main/java/dev/dubhe/anvilcraft/util/VertexConsumerWithPose.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,60 @@ | ||
package dev.dubhe.anvilcraft.util; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import net.minecraft.core.BlockPos; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
@ParametersAreNonnullByDefault | ||
public class VertexConsumerWithPose implements VertexConsumer { | ||
private final VertexConsumer parent; | ||
private final PoseStack.Pose pose; | ||
private final BlockPos originPos; | ||
|
||
|
||
public VertexConsumerWithPose(VertexConsumer parent, PoseStack.Pose pose, BlockPos originPos) { | ||
this.parent = parent; | ||
this.pose = pose; | ||
this.originPos = originPos; | ||
} | ||
|
||
@Override | ||
public VertexConsumer addVertex(float x, float y, float z) { | ||
float dx = originPos.getX() & 15; | ||
float dy = originPos.getY() & 15; | ||
float dz = originPos.getZ() & 15; | ||
return parent.addVertex(pose, x - dx, y - dy, z - dz); | ||
} | ||
|
||
@Override | ||
public VertexConsumer setColor(int r, int g, int b, int a) { | ||
return parent.setColor(r, g, b, a); | ||
} | ||
|
||
@Override | ||
public VertexConsumer setUv(float u, float v) { | ||
return parent.setUv(u, v); | ||
} | ||
|
||
@Override | ||
public VertexConsumer setUv1(int u, int v) { | ||
return parent.setUv1(u, v); | ||
} | ||
|
||
@Override | ||
public VertexConsumer setOverlay(int uv) { | ||
return parent.setUv1(uv & 65535, uv >> 16 & 65535); | ||
} | ||
|
||
@Override | ||
public VertexConsumer setUv2(int u, int v) { | ||
return parent.setUv2(u, v); | ||
} | ||
|
||
@Override | ||
public VertexConsumer setNormal(float x, float y, float z) { | ||
return parent.setNormal(pose, x, y, z); | ||
} | ||
|
||
} |