Cap min speed not velocity

This commit is contained in:
md_5 2013-08-06 11:19:10 +10:00
parent 5545a5473c
commit 8b99287132
2 changed files with 45 additions and 26 deletions

View file

@ -0,0 +1,45 @@
From 76bb8c8d312da90cbafdd5d05c59a252b0336a01 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 5 Aug 2013 20:17:20 +1000
Subject: [PATCH] Cap Minimum Player Speed
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 65a77dc..22ae561 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -178,9 +178,6 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
public void setVelocity(Vector vel) {
- entity.motX = vel.getX();
- entity.motY = vel.getY();
- entity.motZ = vel.getZ();
entity.velocityChanged = true;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 654c3c9..6ee31d9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -952,7 +952,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setFlySpeed(float value) {
validateSpeed(value);
EntityPlayer player = getHandle();
- player.abilities.flySpeed = value / 2f;
+ player.abilities.flySpeed = Math.max( value, 0.0001f ) / 2f; // Spigot
player.updateAbilities();
}
@@ -960,7 +960,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setWalkSpeed(float value) {
validateSpeed(value);
EntityPlayer player = getHandle();
- player.abilities.walkSpeed = value / 2f;
+ player.abilities.walkSpeed = Math.max( value, 0.0001f ) / 2f; // Spigot
player.updateAbilities();
}
--
1.8.1.2

View file

@ -1,26 +0,0 @@
From 9ea913497512111e043bb0007d0765a9003ce979 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 5 Aug 2013 20:17:20 +1000
Subject: [PATCH] Cap Minimum Velocity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 65a77dc..abac59c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -178,9 +178,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
public void setVelocity(Vector vel) {
- entity.motX = vel.getX();
- entity.motY = vel.getY();
- entity.motZ = vel.getZ();
+ entity.motX = Math.max( vel.getX(), 0.001 );
+ entity.motY = Math.max( vel.getY(), 0.001 );
+ entity.motZ = Math.max( vel.getZ(), 0.001 );
entity.velocityChanged = true;
}
--
1.8.1.2