Advertisement
Scouter456

Untitled

Jun 8th, 2023
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. public class TestScreen extends Screen {
  2.     protected TestScreen(Component pTitle) {
  3.         super(pTitle);
  4.     }
  5.     public static final ResourceLocation BOOK_LOCATION = new ResourceLocation("textures/gui/book.png");
  6.     private final List<EncyclopediaCodec> encyclopediaEntries = EncyclopediaJsonManager.getEncyclopediaEntries().values().stream().toList();
  7.  
  8.     @Override
  9.     public void render(PoseStack pPoseStack, int pMouseX, int pMouseY, float pPartialTick) {
  10.         this.renderBackground(pPoseStack);
  11.         RenderSystem.enableBlend();
  12.         RenderSystem.setShader(GameRenderer::getPositionTexShader);
  13.         RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
  14.         RenderSystem.setShaderTexture(0, BOOK_LOCATION);
  15.         int i = (this.width - 192) / 2;
  16.         this.blit(pPoseStack, i, 2, 0, 0, 192, 192);
  17.  
  18.         if(!encyclopediaEntries.isEmpty()) {
  19.             int k = encyclopediaEntries.get(0).getText().size();
  20.             for (int l = 0; l < k; ++l) {
  21.                 String formattedcharsequence = encyclopediaEntries.get(0).getText().get(l);
  22.                 this.font.draw(pPoseStack, formattedcharsequence, (float) (i + 36), (float) (32 + l * 9), 0);
  23.             }
  24.         }
  25.         super.render(pPoseStack, pMouseX, pMouseY, pPartialTick);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement