Skip to content

Commit

Permalink
Always update slide state of current and next slide
Browse files Browse the repository at this point in the history
  • Loading branch information
ustc-zzzz committed Aug 20, 2024
1 parent c007615 commit 4fe673a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main/java/org/teacon/slides/renderer/ProjectorRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,19 @@ public ProjectorRenderer(BlockEntityRendererProvider.Context context) {
public void render(ProjectorBlockEntity tile, float partialTick, PoseStack pStack,
MultiBufferSource src, int packedLight, int packedOverlay) {
var tileState = tile.getBlockState();
// always update slide state whether the projector should be hidden or not
var currentEntry = tile.getNextCurrentEntries().right;
// always update slide state of current and next slide
var nextCurrentEntries = tile.getNextCurrentEntries();
var nextEntry = nextCurrentEntries.left;
if (nextEntry.isPresent()) {
var tileNextEntryUUID = nextEntry.get().id();
SlideState.getSlide(tileNextEntryUUID);
}
var currentEntry = nextCurrentEntries.right;
if (currentEntry.isPresent()) {
pStack.pushPose();
var tileColorTransform = tile.getColorTransform();
var tileCurrentSlide = SlideState.getSlide(currentEntry.get().id());
var tileCurrentEntryUUID = currentEntry.get().id();
var tileCurrentSlide = SlideState.getSlide(tileCurrentEntryUUID);
var tileIconHidden = tileCurrentSlide instanceof IconSlide iconSlide && switch (iconSlide) {
case DEFAULT_EMPTY -> tileColorTransform.hideEmptySlideIcon;
case DEFAULT_FAILED -> tileColorTransform.hideFailedSlideIcon;
Expand Down

0 comments on commit 4fe673a

Please sign in to comment.