-
Notifications
You must be signed in to change notification settings - Fork 242
Ported overlays to 26.1.x #2634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: latest
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,31 @@ | ||
| package twilightforest.client.overlay; | ||
|
|
||
| import com.mojang.blaze3d.pipeline.DepthStencilState; | ||
| import com.mojang.blaze3d.pipeline.RenderPipeline; | ||
| import com.mojang.blaze3d.platform.CompareOp; | ||
| import com.mojang.blaze3d.platform.Window; | ||
| import com.mojang.blaze3d.systems.RenderSystem; | ||
| import net.minecraft.client.Minecraft; | ||
| import net.minecraft.client.gui.GuiGraphics; | ||
| import net.minecraft.client.renderer.texture.TextureAtlasSprite; | ||
| import net.minecraft.client.gui.GuiGraphicsExtractor; | ||
| import net.minecraft.client.renderer.RenderPipelines; | ||
| import net.minecraft.client.resources.model.sprite.Material; | ||
| import net.minecraft.util.ARGB; | ||
| import net.minecraft.world.entity.player.Player; | ||
| import twilightforest.components.entity.TFPortalAttachment; | ||
| import twilightforest.init.TFBlocks; | ||
| import twilightforest.init.TFDataAttachments; | ||
|
|
||
| public class PortalOverlay { | ||
|
|
||
| public static void render(GuiGraphics graphics, Minecraft minecraft, Player player) { | ||
| public static void render(GuiGraphicsExtractor graphics, Minecraft minecraft, Player player) { | ||
| Window window = minecraft.getWindow(); | ||
| if (player != null) { | ||
| TFPortalAttachment portal = player.getData(TFDataAttachments.TF_PORTAL_COOLDOWN); | ||
| if (portal.getPortalTimer() > 0) { | ||
| RenderSystem.disableDepthTest(); | ||
| RenderSystem.depthMask(false); | ||
| RenderSystem.enableBlend(); | ||
| graphics.setColor(1.0F, 1.0F, 1.0F, (float) portal.getPortalTimer() / (float) TFPortalAttachment.MAX_TICKS); | ||
| TextureAtlasSprite textureatlassprite = minecraft.getBlockRenderer().getBlockModelShaper().getParticleIcon(TFBlocks.TWILIGHT_PORTAL.get().defaultBlockState()); | ||
| graphics.blit(0, 0, -90, window.getGuiScaledWidth(), window.getGuiScaledHeight(), textureatlassprite); | ||
| RenderSystem.disableBlend(); | ||
| RenderSystem.depthMask(true); | ||
| RenderSystem.enableDepthTest(); | ||
| graphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); | ||
| RenderPipeline pipeline = RenderPipeline.builder(RenderPipelines.GUI_TEXTURED_SNIPPET) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this pipeline is unnecessary and
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I can delete this class, because it is unused? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure, but there is a lambda doing the same thing in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There may be cases where classes should be deleted, but it's probably best to confirm with a team member before deleting any files. |
||
| .withDepthStencilState(new DepthStencilState(CompareOp.ALWAYS_PASS, false)) | ||
| .build(); | ||
| Material.Baked textureatlassprite = minecraft.getModelManager().getBlockStateModelSet().getParticleMaterial(TFBlocks.TWILIGHT_PORTAL.get().defaultBlockState()); | ||
| graphics.blit(pipeline, textureatlassprite.sprite().atlasLocation(), 0, 0, 0, 0, -90, window.getGuiScaledWidth(), window.getGuiScaledHeight(), ARGB.color(portal.getPortalTimer() / TFPortalAttachment.MAX_TICKS, 0, 0, 0)); | ||
|
albazavr-alba marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| package twilightforest.client.overlay; | ||
|
|
||
| import com.mojang.blaze3d.platform.GlStateManager; | ||
| import com.mojang.blaze3d.systems.RenderSystem; | ||
| import net.minecraft.client.Minecraft; | ||
| import net.minecraft.client.gui.Gui; | ||
| import net.minecraft.client.gui.GuiGraphics; | ||
| import net.minecraft.client.gui.GuiGraphicsExtractor; | ||
| import net.minecraft.client.renderer.RenderPipelines; | ||
| import net.minecraft.resources.Identifier; | ||
| import net.minecraft.world.entity.player.Player; | ||
| import net.minecraft.world.item.ItemStack; | ||
|
|
@@ -24,24 +23,20 @@ public class QuestingRamIndicatorOverlay { | |
| @Autowired(dist = Dist.CLIENT) | ||
| private static QuestingRamCurrentContext questingRamCurrentContext; | ||
|
|
||
| public static void render(Minecraft minecraft, GuiGraphics graphics, Gui gui, Player player) { | ||
| public static void render(Minecraft minecraft, GuiGraphicsExtractor graphics, Gui gui, Player player) { | ||
| if (player != null && !minecraft.options.hideGui && TFConfig.showQuestRamCrosshairIndicator) { | ||
| if (minecraft.options.getCameraType().isFirstPerson() && (minecraft.gameMode.getPlayerMode() != GameType.SPECTATOR || gui.canRenderCrosshairForSpectator(minecraft.hitResult)) && minecraft.crosshairPickEntity instanceof QuestRam ram) { | ||
| ItemStack stack = player.getInventory().getItem(player.getInventory().selected); | ||
| ItemStack stack = player.getInventory().getItem(player.getInventory().getSelectedSlot()); | ||
| if (!stack.isEmpty()) { | ||
| for (var questEntry : questingRamCurrentContext.getContext().questItems().entrySet()) { | ||
| if (questEntry.getValue().test(stack)) { | ||
| RenderSystem.enableBlend(); | ||
| RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE_MINUS_DST_COLOR, GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); | ||
| int j = ((graphics.guiHeight() - 1) / 2) - 11; | ||
| int k = ((graphics.guiHeight() - 1) / 2) - 3; | ||
| if (!ram.isColorPresent(questEntry.getKey())) { | ||
| graphics.blitSprite(QUESTING_RAM_X_SPRITE, k, j, 7, 7); | ||
| graphics.blitSprite(RenderPipelines.GUI_TEXTURED, QUESTING_RAM_X_SPRITE, k, j, 7, 7); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be |
||
| } else { | ||
| graphics.blitSprite(QUESTING_RAM_CHECK_SPRITE, k, j, 7, 7); | ||
| graphics.blitSprite(RenderPipelines.GUI_TEXTURED, QUESTING_RAM_CHECK_SPRITE, k, j, 7, 7); | ||
| } | ||
| RenderSystem.defaultBlendFunc(); | ||
| RenderSystem.disableBlend(); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.