Skip to content

Commit

Permalink
(deps): update game-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakShearman committed Jan 5, 2024
1 parent 597a445 commit c9177e9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {
}

dependencies {
implementation("dev.emortal.minestom:game-sdk:5fdd697")
implementation("dev.emortal.minestom:game-sdk:a3bc80a")

implementation("net.kyori:adventure-text-minimessage:4.14.0")
implementation("dev.hollowcube:polar:1.3.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ private void spawnDummyBot() {
}

@Override
public @NotNull Instance getSpawningInstance() {
public @NotNull Instance getSpawningInstance(@NotNull Player player) {
return this.map.instance();
}

public @NotNull Instance getInstance() {
return this.map.instance();
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/emortal/minestom/lazertag/gun/Gun.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void shoot(@NotNull Player shooter, int ammo) {
Vec shootDir = spread(shooter.getPosition().direction(), this.itemInfo.spread());
Pos eyePos = shooter.getPosition().add(0, shooter.getEyeHeight(), 0);

RaycastResult raycast = RaycastUtil.raycast(this.game.getSpawningInstance(), eyePos, shootDir, this.itemInfo.distance(),
RaycastResult raycast = RaycastUtil.raycast(this.game.getInstance(), eyePos, shootDir, this.itemInfo.distance(),
entity -> entity != shooter && entity instanceof Player player && player.getGameMode() == GameMode.ADVENTURE);
Point hitPoint = raycast.hitPosition() == null ? eyePos.add(shootDir.mul(this.itemInfo.distance())) : raycast.hitPosition();

Expand All @@ -59,7 +59,7 @@ public void shoot(@NotNull Player shooter, int ammo) {
// TODO: hit block animation
}

ParticleUtil.renderBulletTrail(this.game.getSpawningInstance(), eyePos.add(shootDir.mul(2.0)), hitPoint, 1.5);
ParticleUtil.renderBulletTrail(this.game.getInstance(), eyePos.add(shootDir.mul(2.0)), hitPoint, 1.5);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void shoot(@NotNull Player shooter, int ammo) {
Pos spawnPos = shooter.getPosition().add(0, shooter.getEyeHeight() - EntityType.BEE.height() / 2, 0)
.add(shooter.getPosition().direction().mul(1));

entity.setInstance(this.game.getSpawningInstance(), spawnPos);
entity.setInstance(this.game.getInstance(), spawnPos);
}

private final class BeeBlasterEntity extends BetterEntityProjectile {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void shoot(@NotNull Player shooter, int ammo) {
Pos spawnPos = shooter.getPosition().add(0, shooter.getEyeHeight() - EntityType.BEE.height() / 4, 0)
.add(shooter.getPosition().direction().mul(1));

entity.setInstance(this.game.getSpawningInstance(), spawnPos);
entity.setInstance(this.game.getInstance(), spawnPos);
}

private final class BeeBlasterEntity extends BetterEntityProjectile {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void shoot(@NotNull Player shooter, int ammo) {
Pos spawnPos = shooter.getPosition().add(0, shooter.getEyeHeight() - EntityType.BEE.height() / 2, 0)
.add(shooter.getPosition().direction().mul(1));

entity.setInstance(this.game.getSpawningInstance(), spawnPos);
entity.setInstance(this.game.getInstance(), spawnPos);
}

private final class BlockChuckerEntity extends BetterEntityProjectile {
Expand Down Expand Up @@ -119,7 +119,7 @@ private void collide() {
ServerPacket explosionPacket = new ExplosionPacket(pos.x(), pos.y(), pos.z(), 2f, new byte[0], 0f, 0f, 0);
this.sendPacketToViewers(explosionPacket);

for (Player victim : BlockChucker.this.game.getSpawningInstance().getPlayers()) {
for (Player victim : BlockChucker.this.game.getInstance().getPlayers()) {
if (victim.isInvulnerable()) continue;
if (victim.getDistanceSquared(this) > 5 * 5) continue;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/emortal/minestom/lazertag/gun/guns/RBG.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void shoot(@NotNull Player shooter, int ammo) {
Pos spawnPos = shooter.getPosition().add(0, shooter.getEyeHeight() - EntityType.BEE.height() / 2, 0)
.add(shooter.getPosition().direction().mul(1));

entity.setInstance(this.game.getSpawningInstance(), spawnPos);
entity.setInstance(this.game.getInstance(), spawnPos);
}

private final class BeeBlasterEntity extends BetterEntityProjectile {
Expand Down Expand Up @@ -80,7 +80,7 @@ private void collide() {

this.sendPacketToViewers(explosionPacket);

for (Player victim : RBG.this.game.getSpawningInstance().getPlayers()) {
for (Player victim : RBG.this.game.getInstance().getPlayers()) {
if (victim == this.shooter) continue;
if (victim.isInvulnerable()) continue;
if (victim.getDistanceSquared(this) > 5 * 5) continue;
Expand Down

0 comments on commit c9177e9

Please sign in to comment.