mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-25 18:47:40 +01:00
Extend fixes to other horse types
This commit is contained in:
parent
7cb7b36507
commit
79ab0b4cba
@ -14,12 +14,14 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.HorseModifiers;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||
import net.minecraft.server.v1_13_R2.DamageSource;
|
||||
import net.minecraft.server.v1_13_R2.EntityHorseDonkey;
|
||||
import net.minecraft.server.v1_13_R2.GenericAttributes;
|
||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||
@ -42,8 +44,12 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
}
|
||||
|
||||
public static class EntityHorseDonkeyNPC extends EntityHorseDonkey implements NPCHolder {
|
||||
private double baseMovementSpeed;
|
||||
|
||||
private final CitizensNPC npc;
|
||||
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseDonkeyNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
@ -54,6 +60,7 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
if (npc != null) {
|
||||
NMSImpl.clearGoals(goalSelector, targetSelector);
|
||||
((Donkey) getBukkitEntity()).setDomestication(((Donkey) getBukkitEntity()).getMaxDomestication());
|
||||
baseMovementSpeed = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,8 +92,18 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect cs() {
|
||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||
public boolean bT() {
|
||||
if (npc != null && riding) {
|
||||
return true;
|
||||
}
|
||||
return super.bT();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.c(f, f1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,6 +116,11 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect cs() {
|
||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect d(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
@ -110,10 +132,8 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.c(f, f1);
|
||||
}
|
||||
protected SoundEffect D() {
|
||||
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -151,11 +171,6 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
// cancelled.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect D() {
|
||||
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
@ -169,6 +184,13 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void I() {
|
||||
if (npc == null) {
|
||||
super.I();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
@ -182,17 +204,20 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void I() {
|
||||
if (npc == null) {
|
||||
super.I();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mobTick() {
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
if (npc.hasTrait(Controllable.class) && npc.getTrait(Controllable.class).isEnabled()) {
|
||||
riding = getBukkitEntity().getPassengers().size() > 0;
|
||||
getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(baseMovementSpeed * npc.getNavigator().getDefaultParameters().speedModifier());
|
||||
} else {
|
||||
riding = false;
|
||||
}
|
||||
if (riding) {
|
||||
d(4, true); // datawatcher method
|
||||
}
|
||||
NMS.setStepHeight(getBukkitEntity(), 1);
|
||||
npc.update();
|
||||
}
|
||||
|
@ -14,12 +14,14 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.HorseModifiers;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||
import net.minecraft.server.v1_13_R2.DamageSource;
|
||||
import net.minecraft.server.v1_13_R2.EntityHorseMule;
|
||||
import net.minecraft.server.v1_13_R2.GenericAttributes;
|
||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||
@ -42,8 +44,12 @@ public class HorseMuleController extends MobEntityController {
|
||||
}
|
||||
|
||||
public static class EntityHorseMuleNPC extends EntityHorseMule implements NPCHolder {
|
||||
private double baseMovementSpeed;
|
||||
|
||||
private final CitizensNPC npc;
|
||||
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseMuleNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
@ -54,6 +60,7 @@ public class HorseMuleController extends MobEntityController {
|
||||
if (npc != null) {
|
||||
NMSImpl.clearGoals(goalSelector, targetSelector);
|
||||
((Mule) getBukkitEntity()).setDomestication(((Mule) getBukkitEntity()).getMaxDomestication());
|
||||
baseMovementSpeed = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,8 +92,18 @@ public class HorseMuleController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect cs() {
|
||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||
public boolean bT() {
|
||||
if (npc != null && riding) {
|
||||
return true;
|
||||
}
|
||||
return super.bT();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.c(f, f1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -99,6 +116,11 @@ public class HorseMuleController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect cs() {
|
||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect d(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
@ -110,10 +132,8 @@ public class HorseMuleController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.c(f, f1);
|
||||
}
|
||||
protected SoundEffect D() {
|
||||
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -151,11 +171,6 @@ public class HorseMuleController extends MobEntityController {
|
||||
// cancelled.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect D() {
|
||||
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
@ -169,6 +184,13 @@ public class HorseMuleController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void I() {
|
||||
if (npc == null) {
|
||||
super.I();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
@ -182,17 +204,20 @@ public class HorseMuleController extends MobEntityController {
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void I() {
|
||||
if (npc == null) {
|
||||
super.I();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mobTick() {
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
if (npc.hasTrait(Controllable.class) && npc.getTrait(Controllable.class).isEnabled()) {
|
||||
riding = getBukkitEntity().getPassengers().size() > 0;
|
||||
getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(baseMovementSpeed * npc.getNavigator().getDefaultParameters().speedModifier());
|
||||
} else {
|
||||
riding = false;
|
||||
}
|
||||
if (riding) {
|
||||
d(4, true); // datawatcher method
|
||||
}
|
||||
NMS.setStepHeight(getBukkitEntity(), 1);
|
||||
npc.update();
|
||||
}
|
||||
|
@ -14,12 +14,14 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.HorseModifiers;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||
import net.minecraft.server.v1_13_R2.DamageSource;
|
||||
import net.minecraft.server.v1_13_R2.EntityHorseSkeleton;
|
||||
import net.minecraft.server.v1_13_R2.GenericAttributes;
|
||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||
@ -42,8 +44,12 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
}
|
||||
|
||||
public static class EntityHorseSkeletonNPC extends EntityHorseSkeleton implements NPCHolder {
|
||||
private double baseMovementSpeed;
|
||||
|
||||
private final CitizensNPC npc;
|
||||
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseSkeletonNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
@ -55,6 +61,7 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
NMSImpl.clearGoals(goalSelector, targetSelector);
|
||||
((SkeletonHorse) getBukkitEntity())
|
||||
.setDomestication(((SkeletonHorse) getBukkitEntity()).getMaxDomestication());
|
||||
baseMovementSpeed = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,8 +93,18 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect cs() {
|
||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||
public boolean bT() {
|
||||
if (npc != null && riding) {
|
||||
return true;
|
||||
}
|
||||
return super.bT();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.c(f, f1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,6 +117,11 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect cs() {
|
||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect d(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
@ -111,10 +133,8 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.c(f, f1);
|
||||
}
|
||||
protected SoundEffect D() {
|
||||
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -152,11 +172,6 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
// cancelled.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect D() {
|
||||
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
@ -170,6 +185,13 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void I() {
|
||||
if (npc == null) {
|
||||
super.I();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
@ -183,17 +205,20 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void I() {
|
||||
if (npc == null) {
|
||||
super.I();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mobTick() {
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
if (npc.hasTrait(Controllable.class) && npc.getTrait(Controllable.class).isEnabled()) {
|
||||
riding = getBukkitEntity().getPassengers().size() > 0;
|
||||
getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(baseMovementSpeed * npc.getNavigator().getDefaultParameters().speedModifier());
|
||||
} else {
|
||||
riding = false;
|
||||
}
|
||||
if (riding) {
|
||||
d(4, true); // datawatcher method
|
||||
}
|
||||
NMS.setStepHeight(getBukkitEntity(), 1);
|
||||
npc.update();
|
||||
}
|
||||
|
@ -14,12 +14,14 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_13_R2.util.NMSImpl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.HorseModifiers;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||
import net.minecraft.server.v1_13_R2.DamageSource;
|
||||
import net.minecraft.server.v1_13_R2.EntityHorseZombie;
|
||||
import net.minecraft.server.v1_13_R2.GenericAttributes;
|
||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||
@ -42,8 +44,12 @@ public class HorseZombieController extends MobEntityController {
|
||||
}
|
||||
|
||||
public static class EntityHorseZombieNPC extends EntityHorseZombie implements NPCHolder {
|
||||
private double baseMovementSpeed;
|
||||
|
||||
private final CitizensNPC npc;
|
||||
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseZombieNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
@ -55,6 +61,7 @@ public class HorseZombieController extends MobEntityController {
|
||||
NMSImpl.clearGoals(goalSelector, targetSelector);
|
||||
((ZombieHorse) getBukkitEntity())
|
||||
.setDomestication(((ZombieHorse) getBukkitEntity()).getMaxDomestication());
|
||||
baseMovementSpeed = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,8 +93,18 @@ public class HorseZombieController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect cs() {
|
||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||
public boolean bT() {
|
||||
if (npc != null && riding) {
|
||||
return true;
|
||||
}
|
||||
return super.bT();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.c(f, f1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,6 +117,11 @@ public class HorseZombieController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect cs() {
|
||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect d(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
@ -111,10 +133,8 @@ public class HorseZombieController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.c(f, f1);
|
||||
}
|
||||
protected SoundEffect D() {
|
||||
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -152,11 +172,6 @@ public class HorseZombieController extends MobEntityController {
|
||||
// cancelled.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect D() {
|
||||
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
@ -170,6 +185,13 @@ public class HorseZombieController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void I() {
|
||||
if (npc == null) {
|
||||
super.I();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
@ -183,17 +205,20 @@ public class HorseZombieController extends MobEntityController {
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void I() {
|
||||
if (npc == null) {
|
||||
super.I();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mobTick() {
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
if (npc.hasTrait(Controllable.class) && npc.getTrait(Controllable.class).isEnabled()) {
|
||||
riding = getBukkitEntity().getPassengers().size() > 0;
|
||||
getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(baseMovementSpeed * npc.getNavigator().getDefaultParameters().speedModifier());
|
||||
} else {
|
||||
riding = false;
|
||||
}
|
||||
if (riding) {
|
||||
d(4, true); // datawatcher method
|
||||
}
|
||||
NMS.setStepHeight(getBukkitEntity(), 1);
|
||||
npc.update();
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.HorseModifiers;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
@ -22,6 +23,7 @@ import net.minecraft.server.v1_14_R1.DamageSource;
|
||||
import net.minecraft.server.v1_14_R1.DataWatcherObject;
|
||||
import net.minecraft.server.v1_14_R1.EntityHorseDonkey;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.GenericAttributes;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||
@ -45,10 +47,13 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
}
|
||||
|
||||
public static class EntityHorseDonkeyNPC extends EntityHorseDonkey implements NPCHolder {
|
||||
private double baseMovementSpeed;
|
||||
boolean calledNMSHeight = false;
|
||||
|
||||
private final CitizensNPC npc;
|
||||
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseDonkeyNPC(EntityTypes<? extends EntityHorseDonkey> types, World world) {
|
||||
this(types, world, null);
|
||||
}
|
||||
@ -59,6 +64,7 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
if (npc != null) {
|
||||
NMSImpl.clearGoals(goalSelector, targetSelector);
|
||||
((Donkey) getBukkitEntity()).setDomestication(((Donkey) getBukkitEntity()).getMaxDomestication());
|
||||
baseMovementSpeed = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,6 +93,14 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ca() {
|
||||
if (npc != null && riding) {
|
||||
return true;
|
||||
}
|
||||
return super.ca();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkDespawn() {
|
||||
if (npc == null) {
|
||||
@ -207,6 +221,16 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
public void mobTick() {
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
if (npc.hasTrait(Controllable.class) && npc.getTrait(Controllable.class).isEnabled()) {
|
||||
riding = getBukkitEntity().getPassengers().size() > 0;
|
||||
getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(baseMovementSpeed * npc.getNavigator().getDefaultParameters().speedModifier());
|
||||
} else {
|
||||
riding = false;
|
||||
}
|
||||
if (riding) {
|
||||
d(4, true); // datawatcher method
|
||||
}
|
||||
NMS.setStepHeight(getBukkitEntity(), 1);
|
||||
npc.update();
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.HorseModifiers;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
@ -22,6 +23,7 @@ import net.minecraft.server.v1_14_R1.DamageSource;
|
||||
import net.minecraft.server.v1_14_R1.DataWatcherObject;
|
||||
import net.minecraft.server.v1_14_R1.EntityHorseMule;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.GenericAttributes;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||
@ -45,9 +47,10 @@ public class HorseMuleController extends MobEntityController {
|
||||
}
|
||||
|
||||
public static class EntityHorseMuleNPC extends EntityHorseMule implements NPCHolder {
|
||||
private double baseMovementSpeed;
|
||||
boolean calledNMSHeight = false;
|
||||
|
||||
private final CitizensNPC npc;
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseMuleNPC(EntityTypes<? extends EntityHorseMule> types, World world) {
|
||||
this(types, world, null);
|
||||
@ -59,6 +62,7 @@ public class HorseMuleController extends MobEntityController {
|
||||
if (npc != null) {
|
||||
NMSImpl.clearGoals(goalSelector, targetSelector);
|
||||
((Mule) getBukkitEntity()).setDomestication(((Mule) getBukkitEntity()).getMaxDomestication());
|
||||
baseMovementSpeed = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,6 +91,14 @@ public class HorseMuleController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ca() {
|
||||
if (npc != null && riding) {
|
||||
return true;
|
||||
}
|
||||
return super.ca();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkDespawn() {
|
||||
if (npc == null) {
|
||||
@ -207,6 +219,16 @@ public class HorseMuleController extends MobEntityController {
|
||||
public void mobTick() {
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
if (npc.hasTrait(Controllable.class) && npc.getTrait(Controllable.class).isEnabled()) {
|
||||
riding = getBukkitEntity().getPassengers().size() > 0;
|
||||
getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(baseMovementSpeed * npc.getNavigator().getDefaultParameters().speedModifier());
|
||||
} else {
|
||||
riding = false;
|
||||
}
|
||||
if (riding) {
|
||||
d(4, true); // datawatcher method
|
||||
}
|
||||
NMS.setStepHeight(getBukkitEntity(), 1);
|
||||
npc.update();
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.HorseModifiers;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
@ -22,6 +23,7 @@ import net.minecraft.server.v1_14_R1.DamageSource;
|
||||
import net.minecraft.server.v1_14_R1.DataWatcherObject;
|
||||
import net.minecraft.server.v1_14_R1.EntityHorseSkeleton;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.GenericAttributes;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||
@ -45,10 +47,14 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
}
|
||||
|
||||
public static class EntityHorseSkeletonNPC extends EntityHorseSkeleton implements NPCHolder {
|
||||
private double baseMovementSpeed;
|
||||
|
||||
boolean calledNMSHeight = false;
|
||||
|
||||
private final CitizensNPC npc;
|
||||
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseSkeletonNPC(EntityTypes<? extends EntityHorseSkeleton> types, World world) {
|
||||
this(types, world, null);
|
||||
}
|
||||
@ -60,6 +66,7 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
NMSImpl.clearGoals(goalSelector, targetSelector);
|
||||
((SkeletonHorse) getBukkitEntity())
|
||||
.setDomestication(((SkeletonHorse) getBukkitEntity()).getMaxDomestication());
|
||||
baseMovementSpeed = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +95,14 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ca() {
|
||||
if (npc != null && riding) {
|
||||
return true;
|
||||
}
|
||||
return super.ca();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkDespawn() {
|
||||
if (npc == null) {
|
||||
@ -208,6 +223,16 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
public void mobTick() {
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
if (npc.hasTrait(Controllable.class) && npc.getTrait(Controllable.class).isEnabled()) {
|
||||
riding = getBukkitEntity().getPassengers().size() > 0;
|
||||
getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(baseMovementSpeed * npc.getNavigator().getDefaultParameters().speedModifier());
|
||||
} else {
|
||||
riding = false;
|
||||
}
|
||||
if (riding) {
|
||||
d(4, true); // datawatcher method
|
||||
}
|
||||
NMS.setStepHeight(getBukkitEntity(), 1);
|
||||
npc.update();
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_14_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.trait.Controllable;
|
||||
import net.citizensnpcs.trait.HorseModifiers;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
@ -22,6 +23,7 @@ import net.minecraft.server.v1_14_R1.DamageSource;
|
||||
import net.minecraft.server.v1_14_R1.DataWatcherObject;
|
||||
import net.minecraft.server.v1_14_R1.EntityHorseZombie;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.GenericAttributes;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||
@ -45,10 +47,14 @@ public class HorseZombieController extends MobEntityController {
|
||||
}
|
||||
|
||||
public static class EntityHorseZombieNPC extends EntityHorseZombie implements NPCHolder {
|
||||
private double baseMovementSpeed;
|
||||
|
||||
boolean calledNMSHeight = false;
|
||||
|
||||
private final CitizensNPC npc;
|
||||
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseZombieNPC(EntityTypes<? extends EntityHorseZombie> types, World world) {
|
||||
this(types, world, null);
|
||||
}
|
||||
@ -60,6 +66,7 @@ public class HorseZombieController extends MobEntityController {
|
||||
NMSImpl.clearGoals(goalSelector, targetSelector);
|
||||
((ZombieHorse) getBukkitEntity())
|
||||
.setDomestication(((ZombieHorse) getBukkitEntity()).getMaxDomestication());
|
||||
baseMovementSpeed = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +95,14 @@ public class HorseZombieController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ca() {
|
||||
if (npc != null && riding) {
|
||||
return true;
|
||||
}
|
||||
return super.ca();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkDespawn() {
|
||||
if (npc == null) {
|
||||
@ -208,6 +223,16 @@ public class HorseZombieController extends MobEntityController {
|
||||
public void mobTick() {
|
||||
super.mobTick();
|
||||
if (npc != null) {
|
||||
if (npc.hasTrait(Controllable.class) && npc.getTrait(Controllable.class).isEnabled()) {
|
||||
riding = getBukkitEntity().getPassengers().size() > 0;
|
||||
getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(baseMovementSpeed * npc.getNavigator().getDefaultParameters().speedModifier());
|
||||
} else {
|
||||
riding = false;
|
||||
}
|
||||
if (riding) {
|
||||
d(4, true); // datawatcher method
|
||||
}
|
||||
NMS.setStepHeight(getBukkitEntity(), 1);
|
||||
npc.update();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user