mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-28 02:01:35 +01:00
Fix missing translations for player looking
This commit is contained in:
parent
db762b650e
commit
a674fadca3
@ -197,9 +197,9 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
// swallow
|
||||
}
|
||||
|
||||
AttributeInstance range = this.getAttributeInstance(GenericAttributes.b);
|
||||
AttributeInstance range = getAttributeInstance(GenericAttributes.b);
|
||||
if (range == null) {
|
||||
range = this.getAttributeMap().b(GenericAttributes.b);
|
||||
range = getAttributeMap().b(GenericAttributes.b);
|
||||
}
|
||||
range.setValue(Setting.DEFAULT_PATHFINDING_RANGE.asDouble());
|
||||
|
||||
|
@ -172,7 +172,7 @@ public class NMS {
|
||||
f5 = entity.world.getType(
|
||||
new BlockPosition(MathHelper.floor(entity.locX),
|
||||
MathHelper.floor(entity.getBoundingBox().b) - 1, MathHelper.floor(entity.locZ)))
|
||||
.getBlock().frictionFactor * 0.91F;
|
||||
.getBlock().frictionFactor * 0.91F;
|
||||
}
|
||||
|
||||
float f6 = 0.1627714F / (f5 * f5 * f5);
|
||||
@ -189,7 +189,7 @@ public class NMS {
|
||||
f5 = entity.world.getType(
|
||||
new BlockPosition(MathHelper.floor(entity.locX),
|
||||
MathHelper.floor(entity.getBoundingBox().b) - 1, MathHelper.floor(entity.locZ)))
|
||||
.getBlock().frictionFactor * 0.91F;
|
||||
.getBlock().frictionFactor * 0.91F;
|
||||
}
|
||||
|
||||
if (entity.k_()) {
|
||||
@ -245,7 +245,7 @@ public class NMS {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static Constructor<?> getCustomEntityConstructor(Class<?> clazz, EntityType type) throws SecurityException,
|
||||
NoSuchMethodException {
|
||||
NoSuchMethodException {
|
||||
Constructor<?> constructor = ENTITY_CONSTRUCTOR_CACHE.get(clazz);
|
||||
if (constructor == null) {
|
||||
constructor = clazz.getConstructor(World.class);
|
||||
@ -356,11 +356,23 @@ public class NMS {
|
||||
Entity handle = getHandle(entity);
|
||||
if (handle == null)
|
||||
return;
|
||||
yaw = clampYaw(yaw);
|
||||
handle.yaw = yaw;
|
||||
setHeadYaw(handle, yaw);
|
||||
handle.pitch = pitch;
|
||||
}
|
||||
|
||||
public static float clampYaw(float yaw) {
|
||||
while (yaw < -180.0F) {
|
||||
yaw += 360.0F;
|
||||
}
|
||||
|
||||
while (yaw >= 180.0F) {
|
||||
yaw -= 360.0F;
|
||||
}
|
||||
return yaw;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void minecartItemLogic(EntityMinecartAbstract minecart) {
|
||||
NPC npc = ((NPCHolder) minecart).getNPC();
|
||||
@ -504,13 +516,7 @@ public class NMS {
|
||||
if (!(en instanceof EntityLiving))
|
||||
return;
|
||||
EntityLiving handle = (EntityLiving) en;
|
||||
while (yaw < -180.0F) {
|
||||
yaw += 360.0F;
|
||||
}
|
||||
|
||||
while (yaw >= 180.0F) {
|
||||
yaw -= 360.0F;
|
||||
}
|
||||
yaw = clampYaw(yaw);
|
||||
handle.aK = yaw;
|
||||
if (!(handle instanceof EntityHuman))
|
||||
handle.aI = yaw;
|
||||
|
@ -5,8 +5,6 @@ import net.minecraft.server.v1_8_R2.Entity;
|
||||
import net.minecraft.server.v1_8_R2.EntityLiving;
|
||||
import net.minecraft.server.v1_8_R2.MathHelper;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_8_R2.TrigMath;
|
||||
|
||||
public class PlayerControllerLook {
|
||||
private final EntityHumanNPC a;
|
||||
private float b;
|
||||
@ -29,24 +27,24 @@ public class PlayerControllerLook {
|
||||
double d2 = this.g - this.a.locZ;
|
||||
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
float f = (float) (TrigMath.atan2(d2, d0) * 180.0D / 3.141592741012573D) - 90.0F;
|
||||
float f1 = (float) (-(TrigMath.atan2(d1, d3) * 180.0D / 3.141592741012573D));
|
||||
float f = (float) (MathHelper.b(d2, d0) * 180.0D / 3.141592741012573D) - 90.0F;
|
||||
float f1 = (float) (-(MathHelper.b(d1, d3) * 180.0D / 3.141592741012573D));
|
||||
|
||||
this.a.pitch = a(this.a.pitch, f1, this.c);
|
||||
this.a.aI = a(this.a.aI, f, this.b);
|
||||
this.a.aK = a(this.a.aK, f, this.b);
|
||||
} else {
|
||||
this.a.aI = a(this.a.aI, this.a.aG, 10.0F);
|
||||
this.a.aK = a(this.a.aK, this.a.aI, 10.0F);
|
||||
}
|
||||
|
||||
float f2 = MathHelper.g(this.a.aI - this.a.aG);
|
||||
float f2 = MathHelper.g(this.a.aK - this.a.aI);
|
||||
|
||||
if (!this.a.getNavigation().m()) {
|
||||
if (f2 < -75.0F) {
|
||||
this.a.aI = (this.a.aG - 75.0F);
|
||||
this.a.aK = (this.a.aI - 75.0F);
|
||||
}
|
||||
|
||||
if (f2 > 75.0F)
|
||||
this.a.aI = (this.a.aG + 75.0F);
|
||||
this.a.aK = (this.a.aI + 75.0F);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user