From 941360eced1ca20d72827cc0409b4386292e2faa Mon Sep 17 00:00:00 2001 From: yuesha-yc Date: Fri, 8 Oct 2021 00:05:47 -0700 Subject: [PATCH] 0.1.2: fix toggle hud --- build.gradle | 2 +- .../mixin/client/MixinClientEvents.java | 36 +++++++++++++++++++ src/main/resources/META-INF/mods.toml | 2 +- src/main/resources/steampowered.mixins.json | 1 + 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/teammoeg/steampowered/mixin/client/MixinClientEvents.java diff --git a/build.gradle b/build.gradle index 6e60330..a24a5d9 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' group = 'com.teammoeg' -version = '1.16.5-0.1.1' +version = '1.16.5-0.1.2' java { archivesBaseName = 'steampowered' diff --git a/src/main/java/com/teammoeg/steampowered/mixin/client/MixinClientEvents.java b/src/main/java/com/teammoeg/steampowered/mixin/client/MixinClientEvents.java new file mode 100644 index 0000000..8e01837 --- /dev/null +++ b/src/main/java/com/teammoeg/steampowered/mixin/client/MixinClientEvents.java @@ -0,0 +1,36 @@ +package com.teammoeg.steampowered.mixin.client; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.content.curiosities.armor.CopperBacktankArmorLayer; +import com.simibubi.create.events.ClientEvents; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; + +@Mixin(ClientEvents.class) +public class MixinClientEvents { + /** + * @author yuesha-yc + * @reason fix overlay when the hotbar event is canceled + */ + @SubscribeEvent + @Overwrite(remap = false) + public static void onRenderOverlay(RenderGameOverlayEvent.Post event) { + MatrixStack ms = event.getMatrixStack(); + IRenderTypeBuffer.Impl buffers = Minecraft.getInstance().renderBuffers().bufferSource(); + int light = 15728880; + int overlay = OverlayTexture.NO_OVERLAY; + float pt = event.getPartialTicks(); + if (event.getType() == RenderGameOverlayEvent.ElementType.AIR) { + CopperBacktankArmorLayer.renderRemainingAirOverlay(ms, buffers, light, overlay, pt); + } + + if (event.getType() == RenderGameOverlayEvent.ElementType.SUBTITLES) { + ClientEvents.onRenderHotbar(ms, buffers, light, overlay, pt); + } + } +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index dc1f8b2..4f80704 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -4,7 +4,7 @@ license = "GPLv3" issueTrackerURL = "https://github.com/TeamMoegMC/Steam-Powered/issues" [[mods]] #mandatory modId = "steampowered" #mandatory -version = "1.16.5-0.1.0" #mandatory +version = "1.16.5-0.1.2" #mandatory displayName = "Create: Steam Powered" #mandatory authors = "YueSha, dashuaibia, duck_egg, Luyuuke" description = ''' diff --git a/src/main/resources/steampowered.mixins.json b/src/main/resources/steampowered.mixins.json index 9e5fcf3..28e61e8 100644 --- a/src/main/resources/steampowered.mixins.json +++ b/src/main/resources/steampowered.mixins.json @@ -7,6 +7,7 @@ "FlywheelTileEntityAccess" ], "client": [ + "client.MixinClientEvents" ], "injectors": { "defaultRequire": 1