From 33adf0434f7f0d7bb6f606fc6eb5f88d98339fb3 Mon Sep 17 00:00:00 2001 From: fullwall Date: Tue, 5 Nov 2013 21:44:01 +0800 Subject: [PATCH] Fix incorrect import in NMS --- src/main/java/net/citizensnpcs/util/NMS.java | 120 +++++++++---------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/main/java/net/citizensnpcs/util/NMS.java b/src/main/java/net/citizensnpcs/util/NMS.java index 550e97042..098f0d15e 100644 --- a/src/main/java/net/citizensnpcs/util/NMS.java +++ b/src/main/java/net/citizensnpcs/util/NMS.java @@ -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);