Passed
Push — main ( b981dd...7422f7 )
by Etienne
01:33
created

de.kleiner3.lasertag.mixin.ClientPlayerEntityMixin   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A openLasertagCreditsScreen(PlayerEntity) 0 3 1
A openLasertagTeamSelectorScreen() 0 3 1
A openLasertagTeamZoneGeneratorScreen(LasertagTeamZoneGeneratorBlockEntity) 0 3 1
A openLasertagGameManagerScreen(PlayerEntity) 0 3 1
1
package de.kleiner3.lasertag.mixin;
2
3
import de.kleiner3.lasertag.block.entity.LasertagTeamZoneGeneratorBlockEntity;
4
import de.kleiner3.lasertag.client.screen.*;
5
import net.minecraft.client.MinecraftClient;
6
import net.minecraft.client.network.ClientPlayerEntity;
7
import net.minecraft.entity.player.PlayerEntity;
8
import org.spongepowered.asm.mixin.Final;
9
import org.spongepowered.asm.mixin.Mixin;
10
import org.spongepowered.asm.mixin.Shadow;
11
12
/**
13
 * Mixin into the ClientPlayerEntity.class to implement the lasertag game manager screen opener
14
 *
15
 * @author Étienne Muser
16
 */
17
@Mixin(ClientPlayerEntity.class)
18
public class ClientPlayerEntityMixin implements ILasertagGameManagerScreenOpener, ILasertagTeamSelectorScreenOpener, ILasertagCreditsScreenOpener, ILasertagTeamZoneGeneratorScreenOpener {
19
    @Shadow @Final protected MinecraftClient client;
20
21
    @Override
22
    public void openLasertagGameManagerScreen(PlayerEntity player) {
23
        this.client.setScreen(new LasertagGameManagerScreen(player));
24
    }
25
26
    @Override
27
    public void openLasertagTeamSelectorScreen() {
28
        this.client.setScreen(new LasertagTeamSelectorScreen());
29
    }
30
31
    @Override
32
    public void openLasertagCreditsScreen(PlayerEntity player) {
33
        this.client.setScreen(new LasertagCreditsScreen());
34
    }
35
36
    @Override
37
    public void openLasertagTeamZoneGeneratorScreen(LasertagTeamZoneGeneratorBlockEntity teamZoneGenerator) {
38
        this.client.setScreen(new LasertagTeamZoneGeneratorScreen(teamZoneGenerator));
39
    }
40
}
41