Skip to content

Commit

Permalink
Close #2
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed Aug 12, 2020
1 parent 8c71fee commit 94d7e24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.16.2
yarn_mappings=1.16.2+build.6
loader_version=0.9.1+build.205
# Mod Properties
mod_version=1.1.7
mod_version=1.1.8
maven_group=fr.catcore
archives_base_name=deacoudre
# Dependencies
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/fr/catcore/deacoudre/game/DeACoudreActive.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ private void addPlayer(ServerPlayerEntity player) {
}

private boolean onPlayerDamage(ServerPlayerEntity player, DamageSource source, float amount) {
if (source == DamageSource.FALL) {
if (player == null) return true;
double playerY = player.getPos().y;
if (source == DamageSource.FALL && playerY < this.config.mapConfig.height + 1) {

if (this.lifeMap.get(PlayerRef.of(player)) < 2) this.eliminatePlayer(player);
else {
Expand All @@ -142,10 +144,8 @@ private boolean onPlayerDamage(ServerPlayerEntity player, DamageSource source, f
this.broadcastMessage(new LiteralText(String.format("%s lost a life! %s life/lives left!", message.getString(), this.lifeMap.get(PlayerRef.of(player)))).formatted(Formatting.YELLOW));
}
} else if (source == DamageSource.OUT_OF_WORLD) {
BlockBounds jumpBoundaries = this.gameMap.getTemplate().getFirstRegion("jumpingArea");
Vec3d vec3d = jumpBoundaries.getCenter().add(0, 2, 0);
player.setVelocity(new Vec3d(0,0,0));
player.teleport(this.gameWorld.getWorld(), vec3d.x, vec3d.y, vec3d.z, 180F, 0F);
BlockPos blockPos = this.gameMap.getSpawn();
player.teleport(this.gameWorld.getWorld(), blockPos.getX(), 10, blockPos.getZ(), 180F, 0F);
}
return true;
}
Expand Down Expand Up @@ -222,7 +222,6 @@ private void tick() {
this.broadcastMessage(new LiteralText("Next player is " + playerEntity.getName().getString()));
this.scoreboard.tick();
}
playerEntity.setVelocity(new Vec3d(0,0,0));
playerEntity.teleport(this.gameWorld.getWorld(), vec3d.x, vec3d.y, vec3d.z, 180F, 0F);
Text message = playerEntity.getDisplayName().shallowCopy();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ public void spawnPlayer(ServerPlayerEntity player, GameMode gameMode) {

BlockPos pos = new BlockPos(0,3,0);
player.teleport(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0.0F, 0.0F);
player.setVelocity(new Vec3d(0,0,0));
}
}

0 comments on commit 94d7e24

Please sign in to comment.