Skip to content

Commit

Permalink
Add 1.20.4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Jan 11, 2025
1 parent bdd7e4d commit fab1173
Show file tree
Hide file tree
Showing 14 changed files with 121 additions and 9 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: 'versions/**/build/libs/!(*-@(dev|sources|javadoc|all)).jar'
- name: Publish-1.20.4-fabric-Curseforge
uses: Kir-Antipov/[email protected]
with:
curseforge-id: 681953
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
loaders: fabric
name: ${{github.ref_name}}-1.20.4 - Fabric
files: 'versions/1.20.4-fabric/build/libs/!(*-@(dev|sources|javadoc|all)).jar'
game-versions: 1.20.4
- name: Publish-1.20.4-fabric-Modrinth
uses: Kir-Antipov/[email protected]
with:
modrinth-id: DynYZEae
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
loaders: fabric
name: ${{github.ref_name}}-1.20.4 - Fabric
files: 'versions/1.20.4-fabric/build/libs/!(*-@(dev|sources|javadoc|all)).jar'
game-versions: 1.20.4
- name: Publish-1.20.6-fabric-Curseforge
uses: Kir-Antipov/[email protected]
with:
Expand Down
1 change: 1 addition & 0 deletions settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"versions": [
"1.20.4-fabric",
"1.20.6-fabric",
"1.21-fabric",
"1.21.3-fabric",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import dev.tr7zw.exordium.versionless.config.Config;
import lombok.Getter;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;

public final class BufferInstance<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public boolean hasChanged(int tickCount, ChatAccess context) {
|| messageCount != context.getTrimmedMessages().size() || context.isChatFocused() != wasFocused
|| msg != lastMessage;
if (changed) {
System.out.println("Changed");
return true;
}
int j = context.getLinesPerPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
import lombok.Getter;
import net.minecraft.client.AttackIndicatorStatus;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.component.DataComponents;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
//#if MC >= 12104
import net.minecraft.core.component.DataComponents;
//#endif

public class HotbarComponent implements BufferComponent<Void> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import dev.tr7zw.exordium.access.ChatAccess;
import lombok.Getter;
import net.minecraft.client.GuiMessage;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.ChatComponent;
import net.minecraft.client.gui.screens.ChatScreen;

@Mixin(ChatComponent.class)
public abstract class ChatComponentMixin implements ChatAccess {
Expand All @@ -20,15 +22,18 @@ public abstract class ChatComponentMixin implements ChatAccess {
private List<GuiMessage.Line> trimmedMessages;
@Shadow
private int chatScrollbarPos;
@Shadow
private Minecraft minecraft;

@Override
public int getChatScollbarPos() {
return chatScrollbarPos;
}

@Override
@Shadow
public abstract boolean isChatFocused();
public boolean isChatFocused() {
return minecraft.screen instanceof ChatScreen;
};

@Override
@Shadow
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/dev/tr7zw/exordium/mixin/CrosshairMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
import dev.tr7zw.exordium.ExordiumModBase;
import dev.tr7zw.exordium.components.BufferInstance;
import dev.tr7zw.exordium.components.vanilla.CrosshairComponent;

import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.DebugScreenOverlay;
//#if MC < 12006
//$$import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
//$$import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
//$$import dev.tr7zw.exordium.components.vanilla.DebugOverlayComponent;
//#endif

//#if MC >= 12100
import net.minecraft.client.DeltaTracker;
Expand All @@ -23,6 +29,7 @@ public class CrosshairMixin {
@Shadow
private DebugScreenOverlay debugOverlay;

//#if MC >= 12005
@Inject(method = "renderCrosshair", at = @At("HEAD"), cancellable = true)
//#if MC >= 12100
private void renderCrosshairStart(GuiGraphics guiGraphics, DeltaTracker delta, CallbackInfo ci) {
Expand All @@ -47,5 +54,17 @@ private void renderCrosshairEnd(GuiGraphics guiGraphics, DeltaTracker delta, Cal
.getBufferInstance(CrosshairComponent.getId(), DebugScreenOverlay.class);
buffer.postRender(debugOverlay, guiGraphics);
}
//#else
//$$@WrapOperation(method = "render", at = {
//$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderCrosshair(Lnet/minecraft/client/gui/GuiGraphics;)V"), })
//$$private void renderCrosshairWrapper(Gui gui, GuiGraphics guiGraphics, final Operation<Void> operation) {
//$$ BufferInstance<Void> buffer = ExordiumModBase.instance.getBufferManager()
//$$ .getBufferInstance(CrosshairComponent.getId(), Void.class);
//$$ if (!buffer.renderBuffer(0, null, guiGraphics)) {
//$$ operation.call(gui, guiGraphics);
//$$ }
//$$ buffer.postRender(null, guiGraphics);
//$$}
//#endif

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
@Mixin(Gui.class)
public class GuiDebugOverlayMixin {

//#if MC >= 12005
@WrapOperation(method = "method_55807", at = {
@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/DebugScreenOverlay;render(Lnet/minecraft/client/gui/GuiGraphics;)V"), })
private void renderExperienceBarWrapper(DebugScreenOverlay overlay, GuiGraphics guiGraphics,
//#else
//$$@WrapOperation(method = "render", at = {
//$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/DebugScreenOverlay;render(Lnet/minecraft/client/gui/GuiGraphics;)V"), })
//#endif
private void renderDebugOverlayWrapper(DebugScreenOverlay overlay, GuiGraphics guiGraphics,
final Operation<Void> operation) {
BufferInstance<Void> buffer = ExordiumModBase.instance.getBufferManager()
.getBufferInstance(DebugOverlayComponent.getId(), Void.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ public class GuiExperienceMixin {
@Shadow
private Minecraft minecraft;

//#if MC >= 12005
@WrapOperation(method = "renderHotbarAndDecorations", at = {
@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderExperienceBar(Lnet/minecraft/client/gui/GuiGraphics;I)V"), })
//#else
//$$@WrapOperation(method = "render", at = {
//$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderExperienceBar(Lnet/minecraft/client/gui/GuiGraphics;I)V"), })
//#endif
private void renderExperienceBarWrapper(Gui gui, GuiGraphics guiGraphics, int i, final Operation<Void> operation) {
BufferInstance<Void> buffer = ExordiumModBase.instance.getBufferManager()
.getBufferInstance(ExperienceComponent.getId(), Void.class);
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/dev/tr7zw/exordium/mixin/GuiHealthMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
//#if MC < 12006
//$$import org.spongepowered.asm.mixin.injection.Inject;
//$$import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//#endif

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
Expand Down Expand Up @@ -37,8 +41,13 @@ public class GuiHealthMixin implements HealthAccess {

private boolean renderingMountHealth = false;

//#if MC >= 12005
@WrapOperation(method = "renderHotbarAndDecorations", at = {
@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderPlayerHealth(Lnet/minecraft/client/gui/GuiGraphics;)V"), })
//#else
//$$ @WrapOperation(method = "render", at = {
//$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderPlayerHealth(Lnet/minecraft/client/gui/GuiGraphics;)V"), })
//#endif
private void renderPlayerHealthWrapper(Gui gui, GuiGraphics guiGraphics, final Operation<Void> operation) {
BufferInstance<HealthAccess> buffer = ExordiumModBase.instance.getBufferManager()
.getBufferInstance(HealthComponent.getId(), HealthAccess.class);
Expand All @@ -51,6 +60,7 @@ private void renderPlayerHealthWrapper(Gui gui, GuiGraphics guiGraphics, final O
buffer.postRender(this, guiGraphics);
}

//#if MC >= 12005
@WrapOperation(method = "renderHotbarAndDecorations", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderVehicleHealth(Lnet/minecraft/client/gui/GuiGraphics;)V"))
private void renderVehicleHealthHead(Gui gui, GuiGraphics guiGraphics, final Operation<Void> operation) {
if (renderingMountHealth || !ExordiumModBase.instance.config.healthSettings.isEnabled()
Expand All @@ -59,6 +69,16 @@ private void renderVehicleHealthHead(Gui gui, GuiGraphics guiGraphics, final Ope
operation.call(gui, guiGraphics);
}
}
//#else
//$$ @Inject(method = "renderVehicleHealth", at = @At("HEAD"), cancellable = true)
//$$ private void renderVehicleHealthHead(GuiGraphics guiGraphics, CallbackInfo ci) {
//$$ if (!renderingMountHealth && ExordiumModBase.instance.config.healthSettings.isEnabled()
//$$ && !minecraft.player.isCreative()) {
//$$ // prevent rendering multiple times, just render into the texture
//$$ ci.cancel();
//$$ }
//$$ }
//#endif

@Shadow
public void renderVehicleHealth(GuiGraphics guiGraphics) {
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/dev/tr7zw/exordium/mixin/GuiHotbarMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,23 @@ public class GuiHotbarMixin {
@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderItemHotbar(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V") })
private void renderHotbarWrapper(Gui gui, GuiGraphics guiGraphics, DeltaTracker f,
final Operation<Void> operation) {
//#else
//#elseif MC >= 12005
//$$ @WrapOperation(method = "renderHotbarAndDecorations", at = {
//$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderItemHotbar(Lnet/minecraft/client/gui/GuiGraphics;F)V")})
//$$ private void renderHotbarWrapper(Gui gui, GuiGraphics guiGraphics, float f, final Operation<Void> operation) {
//#else
//$$ @WrapOperation(method = "render", at = {
//$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderHotbar(FLnet/minecraft/client/gui/GuiGraphics;)V"), })
//$$ private void renderHotbarWrapper(Gui gui, float f, GuiGraphics guiGraphics, final Operation<Void> operation) {
//#endif
BufferInstance<Void> buffer = ExordiumModBase.instance.getBufferManager()
.getBufferInstance(HotbarComponent.getId(), Void.class);
if (!buffer.renderBuffer(0, null, guiGraphics)) {
//#if MC >= 12005
operation.call(gui, guiGraphics, f);
//#else
//$$ operation.call(gui, f, guiGraphics);
//#endif
}
buffer.postRender(null, guiGraphics);
}
Expand Down
23 changes: 22 additions & 1 deletion src/main/java/dev/tr7zw/exordium/mixin/GuiMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,38 @@ public abstract class GuiMixin implements GuiAccess {
@Shadow
public abstract BossHealthOverlay getBossOverlay();

//#if MC >= 12005
@WrapOperation(method = "renderChat", at = {
@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/ChatComponent;render(Lnet/minecraft/client/gui/GuiGraphics;IIIZ)V"), })
//#else
//$$ @WrapOperation(method = "render", at = {
//$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/ChatComponent;render(Lnet/minecraft/client/gui/GuiGraphics;III)V"), })
//#endif
private void renderChatWrapper(ChatComponent instance, GuiGraphics guiGraphics, int tickCount, int j, int k,
boolean b, final Operation<Void> operation) {
//#if MC >= 12005
boolean b,
//#endif
final Operation<Void> operation) {
ChatAccess chatAccess = (ChatAccess) chat;
BufferInstance<ChatAccess> buffer = ExordiumModBase.instance.getBufferManager()
.getBufferInstance(dev.tr7zw.exordium.components.vanilla.ChatComponent.getId(), ChatAccess.class);
if (!buffer.renderBuffer(tickCount, chatAccess, guiGraphics)) {
//#if MC >= 12005
operation.call(instance, guiGraphics, tickCount, j, k, b);
//#else
//$$ operation.call(instance, guiGraphics, tickCount, j, k);
//#endif
}
buffer.postRender(chatAccess, guiGraphics);
}

//#if MC >= 12005
@WrapOperation(method = "renderTabList", at = {
@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/PlayerTabOverlay;render(Lnet/minecraft/client/gui/GuiGraphics;ILnet/minecraft/world/scores/Scoreboard;Lnet/minecraft/world/scores/Objective;)V"), })
//#else
//$$ @WrapOperation(method = "render", at = {
//$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/PlayerTabOverlay;render(Lnet/minecraft/client/gui/GuiGraphics;ILnet/minecraft/world/scores/Scoreboard;Lnet/minecraft/world/scores/Objective;)V"), })
//#endif
private void renderTablistWrapper(PlayerTabOverlay instance, GuiGraphics guiGraphics, int screenWidth,
Scoreboard scoreboard, Objective objective2, final Operation<Void> operation) {
TablistAccess tablistAccess = (TablistAccess) tabList;
Expand All @@ -70,7 +87,11 @@ private void renderTablistWrapper(PlayerTabOverlay instance, GuiGraphics guiGrap
buffer.postRender(context, guiGraphics);
}

//#if MC >= 12005
@WrapOperation(method = "method_55808", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/BossHealthOverlay;render(Lnet/minecraft/client/gui/GuiGraphics;)V"))
//#else
//$$ @WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/BossHealthOverlay;render(Lnet/minecraft/client/gui/GuiGraphics;)V"))
//#endif
private void renderBossBarWrapper(BossHealthOverlay instance, GuiGraphics guiGraphics, Operation<Void> original) {
BossOverlayAccess overlayAccess = (BossOverlayAccess) this.getBossOverlay();
@SuppressWarnings("unchecked")
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/dev/tr7zw/exordium/mixin/ScoreboardMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
@Mixin(Gui.class)
public class ScoreboardMixin {

//#if MC >= 12005
@WrapOperation(method = "renderScoreboardSidebar", at = {
@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;displayScoreboardSidebar(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/scores/Objective;)V"), })
//#else
//$$ @WrapOperation(method = "render", at = {
//$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;displayScoreboardSidebar(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/scores/Objective;)V"), })
//#endif
private void displayScoreboardSidebarWrapper(Gui gui, GuiGraphics guiGraphics, Objective objective,
final Operation<Void> operation) {
BufferInstance<Void> buffer = ExordiumModBase.instance.getBufferManager()
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/dev/tr7zw/exordium/mixin/VignetteMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ public class VignetteMixin {
private static ResourceLocation FAST_VIGNETTE_DARK_LOCATION = NMSHelper.getResourceLocation("exordium",
"textures/misc/fast_vignette_dark.png");

//#if MC >= 12005
@WrapOperation(method = "renderCameraOverlays", at = {
@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderVignette(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/Entity;)V"), })
//#else
//$$ @WrapOperation(method = "render", at = {
//$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderVignette(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/Entity;)V"), })
//#endif
private void renderVignetteWrapper(Gui gui, GuiGraphics guiGraphics, Entity entity,
final Operation<Void> operation) {

BufferInstance<Float> buffer = ExordiumModBase.instance.getBufferManager()
.getBufferInstance(VignetteComponent.getId(), Float.class);
float brightness = ((Gui) (Object) this).vignetteBrightness;
Expand Down

0 comments on commit fab1173

Please sign in to comment.