-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
configuration card & renderering fixes
- Loading branch information
Showing
25 changed files
with
601 additions
and
40 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
common/src/generated/resources/.cache/ac32a6491e9ad7e80dfd5d9683e4c90fbf53e1e6
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
4 changes: 2 additions & 2 deletions
4
common/src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// 1.20.2 2024-07-29T23:11:39.1659592 Languages: en_us | ||
51f24e3b8b2d0667dec3cce6b38b13b241264dc8 assets/theatrical/lang/en_us.json | ||
// 1.20.2 2024-07-30T20:12:14.177896 Languages: en_us | ||
dd27ac82d3d3f2c79ab7c9dcfc8cbd0ad314670e assets/theatrical/lang/en_us.json |
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
6 changes: 6 additions & 0 deletions
6
common/src/generated/resources/assets/theatrical/models/item/configuration_card.json
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,6 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "theatrical:item/configuration_card" | ||
} | ||
} |
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
50 changes: 50 additions & 0 deletions
50
common/src/main/java/dev/imabad/theatrical/client/LazyRenderers.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,50 @@ | ||
package dev.imabad.theatrical.client; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import net.minecraft.client.Camera; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.util.Tuple; | ||
import net.minecraft.world.phys.Vec3; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class LazyRenderers { | ||
|
||
public static abstract class LazyRenderer { | ||
public abstract void render(MultiBufferSource.BufferSource bufferSource, PoseStack poseStack, Camera camera, float partialTick); | ||
public abstract Vec3 getPos(float partialTick); | ||
} | ||
|
||
private static final List<LazyRenderer> renderers = new ArrayList<>(); | ||
|
||
public static void addLazyRender(LazyRenderer renderer){ | ||
renderers.add(renderer); | ||
} | ||
|
||
public static void doRender(Camera camera, PoseStack poseStack, MultiBufferSource.BufferSource renderer,float partialTick){ | ||
if(!renderers.isEmpty()){ | ||
if(renderers.size() == 1){ | ||
LazyRenderer first = renderers.get(0); | ||
first.render(renderer, poseStack, camera, partialTick); | ||
} else { | ||
List<Tuple<LazyRenderer, Double>> distanced = new ArrayList<>(); | ||
for (LazyRenderer lazyRenderer : renderers) { | ||
distanced.add(new Tuple<>(lazyRenderer, camera.getPosition().distanceToSqr(lazyRenderer.getPos(partialTick)))); | ||
} | ||
distanced.sort(Comparator.comparingDouble(t -> -t.getB())); | ||
for (Tuple<LazyRenderer, Double> lazyRendererDoubleTuple : distanced) { | ||
LazyRenderer a = lazyRendererDoubleTuple.getA(); | ||
a.render(renderer, poseStack, camera, partialTick); | ||
} | ||
} | ||
renderer.endBatch(); | ||
renderers.clear(); | ||
} | ||
} | ||
|
||
} |
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.