Skip to content

Commit

Permalink
fix REI pattern preview loading (#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
screret authored Apr 10, 2024
1 parent 704b74e commit 3b5f8f0
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.lowdragmc.lowdraglib.utils.ItemStackKey;
import com.lowdragmc.lowdraglib.utils.TrackedDummyWorld;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import dev.emi.emi.screen.RecipeScreen;
import it.unimi.dsi.fastutil.longs.LongSet;
import it.unimi.dsi.fastutil.longs.LongSets;
Expand Down Expand Up @@ -52,7 +53,7 @@
*/
@OnlyIn(Dist.CLIENT)
public class PatternPreviewWidget extends WidgetGroup {
private int i;
private boolean isLoaded;
private static TrackedDummyWorld LEVEL;
private static BlockPos LAST_POS = new BlockPos(0, 50, 0);
private static final Map<MultiblockMachineDefinition, MBPattern[]> CACHE = new HashMap<>();
Expand Down Expand Up @@ -245,10 +246,13 @@ public static BlockPos locateNextRegion(int range) {
public void updateScreen() {
super.updateScreen();
// I can only think of this way
if (i != 0 || !LDLib.isEmiLoaded() || !(Minecraft.getInstance().screen instanceof RecipeScreen)) return;
if (i != 0 || !LDLib.isReiLoaded() || !(Minecraft.getInstance().screen instanceof AbstractDisplayViewingScreen)) return;
setPage(i);
++i;
if (!isLoaded && LDLib.isEmiLoaded() && Minecraft.getInstance().screen instanceof RecipeScreen) {
setPage(0);
isLoaded = true;
} else if (!isLoaded && LDLib.isReiLoaded() && Minecraft.getInstance().screen instanceof AbstractDisplayViewingScreen) {
setPage(0);
isLoaded = true;
}
}

@Override
Expand Down

0 comments on commit 3b5f8f0

Please sign in to comment.