Fix incorrect import in NMS

This commit is contained in:
fullwall 2013-11-05 21:44:01 +08:00
parent a40aa327b5
commit 5a5fd0c83f
1 changed files with 60 additions and 60 deletions

View File

@ -12,8 +12,8 @@ import java.util.WeakHashMap;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.npc.entity.EntityHumanNPC;
import net.minecraft.server.Block;
import net.minecraft.server.v1_6_R3.AttributeInstance;
import net.minecraft.server.v1_6_R3.Block;
import net.minecraft.server.v1_6_R3.ControllerJump;
import net.minecraft.server.v1_6_R3.DamageSource;
import net.minecraft.server.v1_6_R3.EnchantmentManager;
@ -53,65 +53,6 @@ public class NMS {
// util class
}
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
if (entity.G()) {
entity.a(f, f1, 0.02F);
entity.move(entity.motX, entity.motY, entity.motZ);
entity.motX *= 0.800000011920929D;
entity.motY *= 0.800000011920929D;
entity.motZ *= 0.800000011920929D;
} else if (entity.I()) {
entity.a(f, f1, 0.02F);
entity.move(entity.motX, entity.motY, entity.motZ);
entity.motX *= 0.5D;
entity.motY *= 0.5D;
entity.motZ *= 0.5D;
} else {
float f2 = 0.91F;
if (entity.onGround) {
f2 = 0.54600006F;
int i = entity.world.getTypeId(MathHelper.floor(entity.locX),
MathHelper.floor(entity.boundingBox.b) - 1, MathHelper.floor(entity.locZ));
if (i > 0) {
f2 = Block.byId[i].frictionFactor * 0.91F;
}
}
float f3 = 0.16277136F / (f2 * f2 * f2);
entity.a(f, f1, entity.onGround ? 0.1F * f3 : 0.02F);
f2 = 0.91F;
if (entity.onGround) {
f2 = 0.54600006F;
int j = entity.world.getTypeId(MathHelper.floor(entity.locX),
MathHelper.floor(entity.boundingBox.b) - 1, MathHelper.floor(entity.locZ));
if (j > 0) {
f2 = Block.byId[j].frictionFactor * 0.91F;
}
}
entity.move(entity.motX, entity.motY, entity.motZ);
entity.motX *= f2;
entity.motY *= f2;
entity.motZ *= f2;
}
entity.aF = entity.aG;
double d0 = entity.locX - entity.lastX;
double d1 = entity.locZ - entity.lastZ;
float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
if (f4 > 1.0F) {
f4 = 1.0F;
}
entity.aG += (f4 - entity.aG) * 0.4F;
entity.aH += entity.aG;
}
public static void addOrRemoveFromPlayerList(org.bukkit.entity.Entity entity, boolean remove) {
if (entity == null)
return;
@ -179,6 +120,65 @@ public class NMS {
}
}
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
if (entity.G()) {
entity.a(f, f1, 0.02F);
entity.move(entity.motX, entity.motY, entity.motZ);
entity.motX *= 0.800000011920929D;
entity.motY *= 0.800000011920929D;
entity.motZ *= 0.800000011920929D;
} else if (entity.I()) {
entity.a(f, f1, 0.02F);
entity.move(entity.motX, entity.motY, entity.motZ);
entity.motX *= 0.5D;
entity.motY *= 0.5D;
entity.motZ *= 0.5D;
} else {
float f2 = 0.91F;
if (entity.onGround) {
f2 = 0.54600006F;
int i = entity.world.getTypeId(MathHelper.floor(entity.locX),
MathHelper.floor(entity.boundingBox.b) - 1, MathHelper.floor(entity.locZ));
if (i > 0) {
f2 = Block.byId[i].frictionFactor * 0.91F;
}
}
float f3 = 0.16277136F / (f2 * f2 * f2);
entity.a(f, f1, entity.onGround ? 0.1F * f3 : 0.02F);
f2 = 0.91F;
if (entity.onGround) {
f2 = 0.54600006F;
int j = entity.world.getTypeId(MathHelper.floor(entity.locX),
MathHelper.floor(entity.boundingBox.b) - 1, MathHelper.floor(entity.locZ));
if (j > 0) {
f2 = Block.byId[j].frictionFactor * 0.91F;
}
}
entity.move(entity.motX, entity.motY, entity.motZ);
entity.motX *= f2;
entity.motY *= f2;
entity.motZ *= f2;
}
entity.aF = entity.aG;
double d0 = entity.locX - entity.lastX;
double d1 = entity.locZ - entity.lastZ;
float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
if (f4 > 1.0F) {
f4 = 1.0F;
}
entity.aG += (f4 - entity.aG) * 0.4F;
entity.aH += entity.aG;
}
private static Constructor<?> getCustomEntityConstructor(Class<?> clazz, EntityType type) throws SecurityException,
NoSuchMethodException {
Constructor<?> constructor = ENTITY_CONSTRUCTOR_CACHE.get(clazz);