-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
211 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
50 changes: 0 additions & 50 deletions
50
projects/pswg_blasters/src/client/java/dev/pswg/mixin/client/DrawContextMixin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.05 KB
..._blasters/src/main/resources/assets/pswg_blasters/textures/gui/hud_elements.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions
28
projects/pswg_core/src/client/java/dev/pswg/events/HudRenderEvents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package dev.pswg.events; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.render.RenderTickCounter; | ||
|
||
public final class HudRenderEvents | ||
{ | ||
@FunctionalInterface | ||
@Environment(EnvType.CLIENT) | ||
public interface Crosshair | ||
{ | ||
void crosshair(DrawContext context, RenderTickCounter tickCounter); | ||
} | ||
|
||
public static final Event<Crosshair> CROSSHAIR = EventFactory.createArrayBacked( | ||
Crosshair.class, | ||
(context, tickCounter) -> { | ||
}, | ||
(callbacks) -> (context, tickCounter) -> { | ||
for (Crosshair callback : callbacks) | ||
callback.crosshair(context, tickCounter); | ||
} | ||
); | ||
} |
24 changes: 24 additions & 0 deletions
24
projects/pswg_core/src/client/java/dev/pswg/mixin/client/events/InGameHudMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package dev.pswg.mixin.client.events; | ||
|
||
import dev.pswg.events.HudRenderEvents; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.hud.InGameHud; | ||
import net.minecraft.client.render.RenderTickCounter; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(InGameHud.class) | ||
public class InGameHudMixin | ||
{ | ||
@Inject(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIII)V", ordinal = 0)) | ||
void renderCrosshair(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) | ||
{ | ||
var matrix = context.getMatrices(); | ||
|
||
matrix.push(); | ||
HudRenderEvents.CROSSHAIR.invoker().crosshair(context, tickCounter); | ||
matrix.pop(); | ||
} | ||
} |
Oops, something went wrong.