Skip to content

Commit 9d67bd9

Browse files
authored
remove a useless condition to the projectile hit detection
1 parent 99b3548 commit 9d67bd9

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

nPaper-Server/src/main/java/net/minecraft/server/EntityArrow.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public void h() {
181181

182182
Entity entity = null;
183183
List<Entity> list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
184-
double d0 = 0.0D;
184+
double d0 = Double.MAX_VALUE;
185185

186186
int j;
187187
float f1;
@@ -199,7 +199,7 @@ public void h() {
199199
if (movingobjectposition1 != null) {
200200
double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
201201

202-
if (d1 < d0 || d0 == 0.0D) {
202+
if (d1 < d0) {
203203
entity = entity1;
204204
d0 = d1;
205205
}

nPaper-Server/src/main/java/net/minecraft/server/EntityFireball.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void h() {
103103

104104
Entity entity = null;
105105
List<Entity> list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
106-
double d0 = 0.0D;
106+
double d0 = Double.MAX_VALUE;
107107

108108
Iterator<Entity> iterator = list.iterator();
109109

@@ -118,7 +118,7 @@ public void h() {
118118
if (movingobjectposition1 != null) {
119119
double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
120120

121-
if (d1 < d0 || d0 == 0.0D) {
121+
if (d1 < d0) {
122122
entity = entity1;
123123
d0 = d1;
124124
}

nPaper-Server/src/main/java/net/minecraft/server/EntityFishingHook.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public void h() {
159159

160160
Entity entity = null;
161161
List<Entity> list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
162-
double d4 = 0.0D;
162+
double d4 = Double.MAX_VALUE;
163163

164164
double d5;
165165

@@ -175,7 +175,7 @@ public void h() {
175175

176176
if (movingobjectposition1 != null) {
177177
d5 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
178-
if (d5 < d4 || d4 == 0.0D) {
178+
if (d5 < d4) {
179179
entity = entity1;
180180
d4 = d5;
181181
}

nPaper-Server/src/main/java/net/minecraft/server/EntityProjectile.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void h() {
127127
if (!this.world.isStatic) {
128128
Entity entity = null;
129129
List<Entity> list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
130-
double d0 = 0.0D;
130+
double d0 = Double.MAX_VALUE;
131131
EntityLiving entityliving = this.getShooter();
132132

133133
Iterator<Entity> iterator = list.iterator();
@@ -143,7 +143,7 @@ public void h() {
143143
if (movingobjectposition1 != null) {
144144
double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
145145

146-
if (d1 < d0 || d0 == 0.0D) {
146+
if (d1 < d0) {
147147
entity = entity1;
148148
d0 = d1;
149149
}

0 commit comments

Comments
 (0)