mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-17 04:41:31 +01:00
Fix rabbit movement
This commit is contained in:
parent
35665695d1
commit
6cb0056b51
@ -16,6 +16,7 @@ import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_8_R3.Block;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_8_R3.EntityRabbit;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_8_R3.World;
|
||||
@ -42,7 +43,8 @@ public class RabbitController extends MobEntityController {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
|
||||
// this.g = new ControllerJump(this);
|
||||
// this.moveController = new ControllerMove(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,6 +121,7 @@ public class RabbitController extends MobEntityController {
|
||||
@Override
|
||||
public void E() {
|
||||
if (npc != null) {
|
||||
super.E();
|
||||
npc.update();
|
||||
} else {
|
||||
super.E();
|
||||
@ -163,6 +166,11 @@ public class RabbitController extends MobEntityController {
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityLiving getGoalTarget() {
|
||||
return npc != null ? null : super.getGoalTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
|
@ -2,8 +2,6 @@ package net.citizensnpcs.util.nms;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_8_R3.TrigMath;
|
||||
|
||||
import net.citizensnpcs.npc.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_8_R3.AttributeInstance;
|
||||
@ -84,24 +82,22 @@ public class PlayerControllerMove extends ControllerMove {
|
||||
double d1 = this.d - this.a.locZ;
|
||||
double d2 = this.c - i;
|
||||
double d3 = d0 * d0 + d2 * d2 + d1 * d1;
|
||||
|
||||
if (d3 >= 2.500000277905201E-007D) {
|
||||
float f = (float) (TrigMath.atan2(d1, d0) * 180.0D / 3.141592741012573D) - 90.0F;
|
||||
|
||||
this.a.yaw = a(this.a.yaw, f, 30.0F);
|
||||
NMS.setHeadYaw(a, this.a.yaw);
|
||||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
speed.setValue(0.1D * this.e);
|
||||
float movement = (float) (this.e * speed.getValue()) * 10;
|
||||
this.a.ba = movement;
|
||||
if (shouldSlimeJump() || ((d2 > 0.0D) && (d0 * d0 + d1 * d1 < 1.0D))) {
|
||||
this.h = cg();
|
||||
this.h /= 3;
|
||||
if (this.a instanceof EntityHumanNPC) {
|
||||
((EntityHumanNPC) this.a).getControllerJump().a();
|
||||
} else {
|
||||
((EntityInsentient) this.a).getControllerJump().a();
|
||||
}
|
||||
if (d3 < 2.500000277905201E-007D)
|
||||
return;
|
||||
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
|
||||
this.a.yaw = a(this.a.yaw, f, 30.0F);
|
||||
NMS.setHeadYaw(a, this.a.yaw);
|
||||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
speed.setValue(0.1D * this.e);
|
||||
float movement = (float) (this.e * speed.getValue()) * 10;
|
||||
this.a.ba = movement;
|
||||
if (shouldSlimeJump() || ((d2 > 0.0D) && (d0 * d0 + d1 * d1 < 1.0D))) {
|
||||
this.h = cg();
|
||||
this.h /= 3;
|
||||
if (this.a instanceof EntityHumanNPC) {
|
||||
((EntityHumanNPC) this.a).getControllerJump().a();
|
||||
} else {
|
||||
((EntityInsentient) this.a).getControllerJump().a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user