@@ -24,51 +24,50 @@ public final class SiegeKitStandEntity extends ArmorStandEntity {
24
24
@ Nullable
25
25
private final GameTeam team ;
26
26
27
- private final SiegeKit type ;
27
+ private final SiegeKit kit ;
28
28
private final SiegeActive game ;
29
29
30
30
public SiegeKitStandEntity (World world , SiegeActive game , SiegeKitStandLocation stand ) {
31
31
super (EntityType .ARMOR_STAND , world );
32
- this .type = stand .type ();
33
- this .team = stand .team ();
32
+ this .kit = stand .type ();
34
33
this .controllingFlag = stand .flag ();
34
+ this .team = this .controllingFlag != null ? this .controllingFlag .team : stand .team ();
35
35
this .game = game ;
36
36
this .setPose (EntityPose .CROUCHING );
37
37
38
38
this .updatePositionAndAngles (stand .pos ().x , stand .pos ().y , stand .pos ().z , stand .yaw (), 0 );
39
39
40
- this .setCustomName (this .type .name );
40
+ this .setCustomName (this .kit .name () );
41
41
this .setInvulnerable (true );
42
42
this .setCustomNameVisible (true );
43
43
this .setShowArms (true );
44
- this .type .equipArmourStand (this );
44
+ this .kit .equipArmourStand (this );
45
45
}
46
46
47
47
public GameTeam getTeam () {
48
- if (this .controllingFlag != null ) {
49
- return this .controllingFlag .team ;
50
- } else {
51
- return this .team ;
52
- }
48
+ return this .controllingFlag != null ? this .controllingFlag .team : this .team ;
53
49
}
54
50
55
51
public void onControllingFlagCaptured () {
56
- this .type .equipArmourStand (this );
52
+ this .kit .equipArmourStand (this );
57
53
}
58
54
59
55
@ Override
60
- public ActionResult interactAt (PlayerEntity player , Vec3d hitPos , Hand hand ) {
61
- SiegePlayer participant = this .game .participant ((ServerPlayerEntity ) player );
62
- if (participant == null || ((ServerPlayerEntity ) player ).interactionManager .getGameMode () != GameMode .SURVIVAL ) {
56
+ public ActionResult interactAt (PlayerEntity playerEntity , Vec3d hitPos , Hand hand ) {
57
+ var player = (ServerPlayerEntity ) playerEntity ;
58
+ SiegePlayer participant = this .game .participant (player );
59
+
60
+ if (participant == null || player .interactionManager .getGameMode () != GameMode .SURVIVAL ) {
63
61
return ActionResult .FAIL ;
64
62
}
65
63
66
64
if (participant .team != this .getTeam ()) {
67
65
return ActionResult .FAIL ;
68
66
}
69
67
70
- participant .kit = this .type ;
71
- this .type .equipPlayer ((ServerPlayerEntity ) player , participant , this .game .world , this .game .config );
68
+ participant .kit .returnResources (player , participant );
69
+ participant .kit = this .kit ;
70
+ this .kit .equipPlayer (player , participant , this .game .config , player .getWorld ().getTime ());
72
71
return ActionResult .SUCCESS ;
73
72
}
74
73
@@ -78,7 +77,7 @@ public boolean isImmobile() {
78
77
}
79
78
80
79
@ Override
81
- public void takeKnockback ( double strength , double x , double z ) {
82
- super . takeKnockback ( strength , x , z ) ;
80
+ public boolean isMarker ( ) {
81
+ return true ;
83
82
}
84
83
}
0 commit comments