Skip to content

Commit

Permalink
feat: lots of changes!
Browse files Browse the repository at this point in the history
  • Loading branch information
Restioson committed Jun 16, 2024
1 parent f5e7a45 commit 29cbce1
Show file tree
Hide file tree
Showing 23 changed files with 621 additions and 371 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,51 +24,50 @@ public final class SiegeKitStandEntity extends ArmorStandEntity {
@Nullable
private final GameTeam team;

private final SiegeKit type;
private final SiegeKit kit;
private final SiegeActive game;

public SiegeKitStandEntity(World world, SiegeActive game, SiegeKitStandLocation stand) {
super(EntityType.ARMOR_STAND, world);
this.type = stand.type();
this.team = stand.team();
this.kit = stand.type();
this.controllingFlag = stand.flag();
this.team = this.controllingFlag != null ? this.controllingFlag.team : stand.team();
this.game = game;
this.setPose(EntityPose.CROUCHING);

this.updatePositionAndAngles(stand.pos().x, stand.pos().y, stand.pos().z, stand.yaw(), 0);

this.setCustomName(this.type.name);
this.setCustomName(this.kit.name());
this.setInvulnerable(true);
this.setCustomNameVisible(true);
this.setShowArms(true);
this.type.equipArmourStand(this);
this.kit.equipArmourStand(this);
}

public GameTeam getTeam() {
if (this.controllingFlag != null) {
return this.controllingFlag.team;
} else {
return this.team;
}
return this.controllingFlag != null ? this.controllingFlag.team : this.team;
}

public void onControllingFlagCaptured() {
this.type.equipArmourStand(this);
this.kit.equipArmourStand(this);
}

@Override
public ActionResult interactAt(PlayerEntity player, Vec3d hitPos, Hand hand) {
SiegePlayer participant = this.game.participant((ServerPlayerEntity) player);
if (participant == null || ((ServerPlayerEntity) player).interactionManager.getGameMode() != GameMode.SURVIVAL) {
public ActionResult interactAt(PlayerEntity playerEntity, Vec3d hitPos, Hand hand) {
var player = (ServerPlayerEntity) playerEntity;
SiegePlayer participant = this.game.participant(player);

if (participant == null || player.interactionManager.getGameMode() != GameMode.SURVIVAL) {
return ActionResult.FAIL;
}

if (participant.team != this.getTeam()) {
return ActionResult.FAIL;
}

participant.kit = this.type;
this.type.equipPlayer((ServerPlayerEntity) player, participant, this.game.world, this.game.config);
participant.kit.returnResources(player, participant);
participant.kit = this.kit;
this.kit.equipPlayer(player, participant, this.game.config, player.getWorld().getTime());
return ActionResult.SUCCESS;
}

Expand All @@ -78,7 +77,7 @@ public boolean isImmobile() {
}

@Override
public void takeKnockback(double strength, double x, double z) {
super.takeKnockback(strength, x, z);
public boolean isMarker() {
return true;
}
}
Loading

0 comments on commit 29cbce1

Please sign in to comment.