de.pewpewproject.lasertag.mixin.gui.InGameHudMixin   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A modifyScoreboardObjective2(ScoreboardObjective) 0 3 1
1
package de.pewpewproject.lasertag.mixin.gui;
2
3
import net.minecraft.client.gui.hud.InGameHud;
4
import net.minecraft.scoreboard.ScoreboardObjective;
5
import net.minecraft.text.Text;
6
import org.spongepowered.asm.mixin.Mixin;
7
import org.spongepowered.asm.mixin.injection.At;
8
import org.spongepowered.asm.mixin.injection.ModifyVariable;
9
10
/**
11
 * Mixin to show team list even tho the world is in singleplayer
12
 *
13
 * @author Étienne Muser
14
 */
15
@Mixin(InGameHud.class)
16
public class InGameHudMixin {
17
18
    /**
19
     * Hack to show team list even if world is in singleplayer.
20
     * Set scoreboardObjective2 to non-null value so that second hand of OR-operator is always false. Therefore
21
     * Only !this.client.options.playerListKey.isPressed() matters
22
     *
23
     * @param original
24
     * @return
25
     */
26
    @ModifyVariable(method = "render(Lnet/minecraft/client/util/math/MatrixStack;F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;isPressed()Z"), ordinal = 1)
27
    private ScoreboardObjective modifyScoreboardObjective2(ScoreboardObjective original) {
28
        return new ScoreboardObjective(null, null, null, Text.literal("<dummy>"), null);
29
    }
30
}
31