Skip to content

Commit

Permalink
Merge branch 'master' into redrak
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleepybear committed Feb 11, 2020
2 parents 512e47a + 385d42b commit d13b0de
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/main/java/cn/nukkit/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ protected void processMovement(int tickDiff) {
if (!to.equals(ev.getTo())) { //If plugins modify the destination
this.teleport(ev.getTo(), null);
} else {
this.addMovement(this.x, this.y + this.getEyeHeight(), this.z, this.yaw, this.pitch, this.yaw);
this.addMovement(this.x, this.y, this.z, this.yaw, this.pitch, this.yaw);
}
//Biome biome = Biome.biomes[level.getBiomeId(this.getFloorX(), this.getFloorZ())];
//sendTip(biome.getName() + " (" + biome.doesOverhang() + " " + biome.getBaseHeight() + "-" + biome.getHeightVariation() + ")");
Expand Down Expand Up @@ -1587,6 +1587,11 @@ protected void processMovement(int tickDiff) {
this.newPosition = null;
}

@Override
public void addMovement(double x, double y, double z, double yaw, double pitch, double headYaw) {
this.sendPosition(new Vector3(x, y, z), yaw, pitch, MovePlayerPacket.MODE_NORMAL, this.getViewers().values().toArray(new Player[0]));
}

@Override
public boolean setMotion(Vector3 motion) {
if (super.setMotion(motion)) {
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/cn/nukkit/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ public Level remove(Object key) {
put("rcon.password", Base64.getEncoder().encodeToString(UUID.randomUUID().toString().replace("-", "").getBytes()).substring(3, 13));
put("auto-save", true);
put("force-resources", false);
put("bug-report", true);
put("xbox-auth", true);
}
});
Expand Down Expand Up @@ -434,7 +433,14 @@ public Level remove(Object key) {
}
}

if (this.getConfig().getBoolean("bug-report", true)) {
boolean bugReport;
if (this.getConfig().exists("settings.bug-report")) {
bugReport = this.getConfig().getBoolean("settings.bug-report");
this.getProperties().remove("bug-report");
} else {
bugReport = this.getPropertyBoolean("bug-report", true); //backwards compat
}
if (bugReport) {
ExceptionHandler.registerExceptionHandler();
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/cn/nukkit/entity/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,10 @@ public AxisAlignedBB getBoundingBox() {
}

public void fall(float fallDistance) {
if (this.hasEffect(Effect.SLOW_FALLING)) {
return;
}

float damage = (float) Math.floor(fallDistance - 3 - (this.hasEffect(Effect.JUMP) ? this.getEffect(Effect.JUMP).getAmplifier() + 1 : 0));
if (damage > 0) {
this.attack(new EntityDamageEvent(this, DamageCause.FALL, damage));
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/cn/nukkit/level/Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -3216,8 +3216,9 @@ public boolean setRaining(boolean raining) {

if (raining) {
pk.evid = LevelEventPacket.EVENT_START_RAIN;
pk.data = ThreadLocalRandom.current().nextInt(50000) + 10000;
setRainTime(ThreadLocalRandom.current().nextInt(12000) + 12000);
int time = ThreadLocalRandom.current().nextInt(12000) + 12000;
pk.data = time;
setRainTime(time);
} else {
pk.evid = LevelEventPacket.EVENT_STOP_RAIN;
setRainTime(ThreadLocalRandom.current().nextInt(168000) + 12000);
Expand Down Expand Up @@ -3258,8 +3259,9 @@ public boolean setThundering(boolean thundering) {
// These numbers are from Minecraft
if (thundering) {
pk.evid = LevelEventPacket.EVENT_START_THUNDER;
pk.data = ThreadLocalRandom.current().nextInt(50000) + 10000;
setThunderTime(ThreadLocalRandom.current().nextInt(12000) + 3600);
int time = ThreadLocalRandom.current().nextInt(12000) + 3600;
pk.data = time;
setThunderTime(time);
} else {
pk.evid = LevelEventPacket.EVENT_STOP_THUNDER;
setThunderTime(ThreadLocalRandom.current().nextInt(168000) + 12000);
Expand Down Expand Up @@ -3287,7 +3289,7 @@ public void sendWeather(Player[] players) {

if (this.isRaining()) {
pk.evid = LevelEventPacket.EVENT_START_RAIN;
pk.data = ThreadLocalRandom.current().nextInt(50000) + 10000;
pk.data = this.rainTime;
} else {
pk.evid = LevelEventPacket.EVENT_STOP_RAIN;
}
Expand All @@ -3296,7 +3298,7 @@ public void sendWeather(Player[] players) {

if (this.isThundering()) {
pk.evid = LevelEventPacket.EVENT_START_THUNDER;
pk.data = ThreadLocalRandom.current().nextInt(50000) + 10000;
pk.data = this.thunderTime;
} else {
pk.evid = LevelEventPacket.EVENT_STOP_THUNDER;
}
Expand Down

0 comments on commit d13b0de

Please sign in to comment.