summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server
diff options
context:
space:
mode:
authorVictorD <victor.danell@gmail.com>2011-02-20 23:22:28 +0100
committerVictorD <victor.danell@gmail.com>2011-02-20 23:22:28 +0100
commitbf9a55049e6be249856d07b1bda99552b0f902f7 (patch)
tree86f93e2b9bdf6dac7403fbd5edba065bdc36aa45 /src/main/java/net/minecraft/server
parentcec04a7360ef0baf7dfdc3cc2af2be02c54403c9 (diff)
downloadcraftbukkit-bf9a55049e6be249856d07b1bda99552b0f902f7.tar
craftbukkit-bf9a55049e6be249856d07b1bda99552b0f902f7.tar.gz
craftbukkit-bf9a55049e6be249856d07b1bda99552b0f902f7.tar.lz
craftbukkit-bf9a55049e6be249856d07b1bda99552b0f902f7.tar.xz
craftbukkit-bf9a55049e6be249856d07b1bda99552b0f902f7.zip
Second part of NPE and arctan update :3
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r--src/main/java/net/minecraft/server/Chunk.java5
-rw-r--r--src/main/java/net/minecraft/server/EntityCreature.java3
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java3
-rw-r--r--src/main/java/net/minecraft/server/EntityLiving.java3
4 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 592e3408..ef81adf9 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -6,6 +6,8 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
+import org.bukkit.craftbukkit.CraftWorld;
+
public class Chunk {
public static boolean a;
@@ -44,7 +46,8 @@ public class Chunk {
}
// CraftBukkit start
- bukkitChunk = ((WorldServer) world).getWorld().popPreservedChunk( i, j );
+ CraftWorld cw = ((WorldServer) world).getWorld();
+ bukkitChunk = (cw == null) ? null:cw.popPreservedChunk( i, j );
if (bukkitChunk == null) {
bukkitChunk = new org.bukkit.craftbukkit.CraftChunk( this );
}
diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java
index c867b32c..49b4c7a2 100644
--- a/src/main/java/net/minecraft/server/EntityCreature.java
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
@@ -4,6 +4,7 @@ package net.minecraft.server;
import org.bukkit.craftbukkit.entity.CraftMonster;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity;
+import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@@ -118,7 +119,7 @@ public class EntityCreature extends EntityLiving {
double d1 = vec3d.a - this.locX;
double d2 = vec3d.c - this.locZ;
double d3 = vec3d.b - (double) l1;
- float f4 = (float) (Math.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
+ float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f5 = f4 - this.yaw;
for (this.by = this.bC; f5 < -180.0F; f5 += 360.0F) {
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 2e3e7177..66bae6e1 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -4,6 +4,7 @@ import java.util.List;
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.craftbukkit.entity.CraftItemDrop;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
@@ -124,7 +125,7 @@ public abstract class EntityHuman extends EntityLiving {
this.as = this.at;
super.o();
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
- float f1 = (float) Math.atan(-this.motY * 0.20000000298023224D) * 15.0F;
+ float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F;
if (f > 0.1F) {
f = 0.1F;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 366f8f1e..c2c371db 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -10,6 +10,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
@@ -236,7 +237,7 @@ public abstract class EntityLiving extends Entity {
if (f > 0.05F) {
f3 = 1.0F;
f2 = f * 3.0F;
- f1 = (float) Math.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
+ f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
}
if (this.aY > 0.0F) {