mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 12:15:53 +01:00
Improve underwater pathfinding, cleanup
This commit is contained in:
parent
b26dfb3d0f
commit
b12ae2ee66
@ -367,7 +367,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
if (!data().has(NPC.Metadata.SWIMMING) || data().<Boolean> get(NPC.Metadata.SWIMMING)) {
|
||||
Location currentDest = navigator.getPathStrategy().getCurrentDestination();
|
||||
if (currentDest == null || currentDest.getY() > getStoredLocation().getY()) {
|
||||
NMS.trySwim(getEntity(), SwimmingExaminer.isWaterMob(getEntity()) ? 0.01F : 0.04F);
|
||||
NMS.trySwim(getEntity(), SwimmingExaminer.isWaterMob(getEntity()) ? 0.02F : 0.04F);
|
||||
}
|
||||
}
|
||||
} else if (data().has(NPC.Metadata.SWIMMING) ? data().<Boolean> get(NPC.Metadata.SWIMMING)
|
||||
|
@ -56,7 +56,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
|
||||
|
||||
@Override
|
||||
public Location getCurrentDestination() {
|
||||
return vector != null ? vector.toLocation(npc.getEntity().getWorld()) : null;
|
||||
return plan != null ? plan.getCurrentVector().toLocation(npc.getEntity().getWorld()) : destination.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -141,7 +141,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
|
||||
}
|
||||
Location loc = npc.getEntity().getLocation(NPC_LOCATION);
|
||||
/* Proper door movement - gets stuck on corners at times
|
||||
|
||||
|
||||
Block block = currLoc.getWorld().getBlockAt(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
|
||||
if (MinecraftBlockExaminer.isDoor(block.getType())) {
|
||||
Door door = (Door) block.getState().getData();
|
||||
|
@ -22,7 +22,6 @@ import net.minecraft.server.v1_13_R2.EntityCod;
|
||||
import net.minecraft.server.v1_13_R2.EntityHuman;
|
||||
import net.minecraft.server.v1_13_R2.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_13_R2.EnumHand;
|
||||
import net.minecraft.server.v1_13_R2.EnumMoveType;
|
||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||
import net.minecraft.server.v1_13_R2.ItemStack;
|
||||
import net.minecraft.server.v1_13_R2.Items;
|
||||
@ -91,14 +90,7 @@ public class CodController extends MobEntityController {
|
||||
@Override
|
||||
public void a(float f, float f1, float f2) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(f, f1, f2, 0.01F);
|
||||
this.move(EnumMoveType.SELF, this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9D;
|
||||
this.motY *= 0.9D;
|
||||
this.motZ *= 0.9D;
|
||||
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, f, f1, f2)) {
|
||||
super.a(f, f1, f2);
|
||||
}
|
||||
} else {
|
||||
|
@ -19,6 +19,7 @@ import net.minecraft.server.v1_13_R2.Entity;
|
||||
import net.minecraft.server.v1_13_R2.EntityBoat;
|
||||
import net.minecraft.server.v1_13_R2.EntityDolphin;
|
||||
import net.minecraft.server.v1_13_R2.EntityMinecartAbstract;
|
||||
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;
|
||||
@ -61,6 +62,8 @@ public class DolphinController extends MobEntityController {
|
||||
if (npc != null) {
|
||||
NMSImpl.clearGoals(goalSelector, targetSelector);
|
||||
this.setNoAI(true);
|
||||
this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue() / 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +77,9 @@ public class DolphinController extends MobEntityController {
|
||||
@Override
|
||||
public void a(float f, float f1, float f2) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.a(f, f1, f2);
|
||||
if (!NMSImpl.moveFish(npc, this, f, f1, f2, cK())) {
|
||||
super.a(f, f1, f2);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, f, f1, f2);
|
||||
}
|
||||
|
@ -77,7 +77,9 @@ public class PufferFishController extends MobEntityController {
|
||||
@Override
|
||||
public void a(float f, float f1, float f2) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.a(f, f1, f2);
|
||||
if (!NMSImpl.moveFish(npc, this, f, f1, f2)) {
|
||||
super.a(f, f1, f2);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, f, f1, f2);
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import net.minecraft.server.v1_13_R2.EntityHuman;
|
||||
import net.minecraft.server.v1_13_R2.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_13_R2.EntitySalmon;
|
||||
import net.minecraft.server.v1_13_R2.EnumHand;
|
||||
import net.minecraft.server.v1_13_R2.EnumMoveType;
|
||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||
import net.minecraft.server.v1_13_R2.ItemStack;
|
||||
import net.minecraft.server.v1_13_R2.Items;
|
||||
@ -77,14 +76,7 @@ public class SalmonController extends MobEntityController {
|
||||
@Override
|
||||
public void a(float f, float f1, float f2) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(f, f1, f2, 0.01F);
|
||||
this.move(EnumMoveType.SELF, this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9D;
|
||||
this.motY *= 0.9D;
|
||||
this.motZ *= 0.9D;
|
||||
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, f, f1, f2)) {
|
||||
super.a(f, f1, f2);
|
||||
}
|
||||
} else {
|
||||
|
@ -22,7 +22,6 @@ import net.minecraft.server.v1_13_R2.EntityHuman;
|
||||
import net.minecraft.server.v1_13_R2.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_13_R2.EntityTropicalFish;
|
||||
import net.minecraft.server.v1_13_R2.EnumHand;
|
||||
import net.minecraft.server.v1_13_R2.EnumMoveType;
|
||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||
import net.minecraft.server.v1_13_R2.ItemStack;
|
||||
import net.minecraft.server.v1_13_R2.Items;
|
||||
@ -77,14 +76,7 @@ public class TropicalFishController extends MobEntityController {
|
||||
@Override
|
||||
public void a(float f, float f1, float f2) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(f, f1, f2, 0.01F);
|
||||
this.move(EnumMoveType.SELF, this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9D;
|
||||
this.motY *= 0.9D;
|
||||
this.motZ *= 0.9D;
|
||||
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, f, f1, f2)) {
|
||||
super.a(f, f1, f2);
|
||||
}
|
||||
} else {
|
||||
|
@ -22,11 +22,8 @@ import net.minecraft.server.v1_13_R2.EntityBoat;
|
||||
import net.minecraft.server.v1_13_R2.EntityInsentient;
|
||||
import net.minecraft.server.v1_13_R2.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_13_R2.EntityTurtle;
|
||||
import net.minecraft.server.v1_13_R2.EnumMoveType;
|
||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||
import net.minecraft.server.v1_13_R2.Navigation;
|
||||
import net.minecraft.server.v1_13_R2.NavigationAbstract;
|
||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||
import net.minecraft.server.v1_13_R2.World;
|
||||
|
||||
@ -67,14 +64,7 @@ public class TurtleController extends MobEntityController {
|
||||
@Override
|
||||
public void a(float f, float f1, float f2) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(f, f1, f2, 0.01F);
|
||||
this.move(EnumMoveType.SELF, this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9D;
|
||||
this.motY *= 0.9D;
|
||||
this.motZ *= 0.9D;
|
||||
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, f, f1, f2)) {
|
||||
super.a(f, f1, f2);
|
||||
}
|
||||
} else {
|
||||
@ -82,14 +72,6 @@ public class TurtleController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract b(World world) {
|
||||
if (npc == null) {
|
||||
return super.b(world);
|
||||
}
|
||||
return new Navigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
|
@ -219,6 +219,7 @@ import net.minecraft.server.v1_13_R2.EntityShulker;
|
||||
import net.minecraft.server.v1_13_R2.EntityTameableAnimal;
|
||||
import net.minecraft.server.v1_13_R2.EntityTracker;
|
||||
import net.minecraft.server.v1_13_R2.EntityTrackerEntry;
|
||||
import net.minecraft.server.v1_13_R2.EntityTurtle;
|
||||
import net.minecraft.server.v1_13_R2.EntityTypes;
|
||||
import net.minecraft.server.v1_13_R2.EntityWither;
|
||||
import net.minecraft.server.v1_13_R2.EnumMoveType;
|
||||
@ -1685,6 +1686,26 @@ public class NMSImpl implements NMSBridge {
|
||||
minecart.setDisplayBlockOffset(offset);
|
||||
}
|
||||
|
||||
public static boolean moveFish(NPC npc, EntityInsentient handle, float f, float f1, float f2) {
|
||||
return moveFish(npc, handle, f1, f1, f2, -1);
|
||||
}
|
||||
|
||||
public static boolean moveFish(NPC npc, EntityInsentient handle, float f, float f1, float f2, float speed) {
|
||||
if (npc == null) {
|
||||
return false;
|
||||
}
|
||||
if (!npc.useMinecraftAI() && handle.isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
handle.a(f, f1, f2, speed > 0 ? speed : handle instanceof EntityTurtle ? 0.1F : 0.01F);
|
||||
handle.move(EnumMoveType.SELF, handle.motX, handle.motY, handle.motZ);
|
||||
handle.motX *= 0.9D;
|
||||
handle.motY *= 0.9D;
|
||||
handle.motZ *= 0.9D;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void sendPacket(Player player, Packet<?> packet) {
|
||||
if (packet == null)
|
||||
return;
|
||||
|
@ -23,7 +23,6 @@ import net.minecraft.server.v1_14_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_14_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.EnumHand;
|
||||
import net.minecraft.server.v1_14_R1.EnumMoveType;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.ItemStack;
|
||||
import net.minecraft.server.v1_14_R1.Items;
|
||||
@ -121,11 +120,7 @@ public class CodController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -21,10 +21,9 @@ import net.minecraft.server.v1_14_R1.EntityBoat;
|
||||
import net.minecraft.server.v1_14_R1.EntityDolphin;
|
||||
import net.minecraft.server.v1_14_R1.EntityMinecartAbstract;
|
||||
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.Navigation;
|
||||
import net.minecraft.server.v1_14_R1.NavigationAbstract;
|
||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_14_R1.Vec3D;
|
||||
import net.minecraft.server.v1_14_R1.World;
|
||||
@ -66,6 +65,8 @@ public class DolphinController extends MobEntityController {
|
||||
if (npc != null) {
|
||||
NMSImpl.clearGoals(goalSelector, targetSelector);
|
||||
this.moveController = new ControllerMove(this);
|
||||
this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getBaseValue() / 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,11 +77,6 @@ public class DolphinController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean au() {
|
||||
return npc == null ? super.au() : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
@ -88,11 +84,6 @@ public class DolphinController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract b(World world) {
|
||||
return new Navigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkDespawn() {
|
||||
if (npc == null) {
|
||||
@ -117,7 +108,9 @@ public class DolphinController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.e(vec3d);
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d, db())) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
||||
}
|
||||
@ -181,11 +174,6 @@ public class DolphinController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWater() {
|
||||
return npc == null ? super.isInWater() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
|
@ -118,7 +118,9 @@ public class PufferFishController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.e(vec3d);
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import net.minecraft.server.v1_14_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_14_R1.EntitySalmon;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.EnumHand;
|
||||
import net.minecraft.server.v1_14_R1.EnumMoveType;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.ItemStack;
|
||||
import net.minecraft.server.v1_14_R1.Items;
|
||||
@ -107,11 +106,7 @@ public class SalmonController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -50,7 +50,6 @@ public class TraderLlamaController extends MobEntityController {
|
||||
|
||||
public static class EntityTraderLlamaNPC extends EntityLlamaTrader implements NPCHolder {
|
||||
boolean calledNMSHeight = false;
|
||||
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntityTraderLlamaNPC(EntityTypes<? extends EntityLlamaTrader> types, World world) {
|
||||
|
@ -23,7 +23,6 @@ import net.minecraft.server.v1_14_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_14_R1.EntityTropicalFish;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.EnumHand;
|
||||
import net.minecraft.server.v1_14_R1.EnumMoveType;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.ItemStack;
|
||||
import net.minecraft.server.v1_14_R1.Items;
|
||||
@ -107,11 +106,7 @@ public class TropicalFishController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -23,11 +23,8 @@ import net.minecraft.server.v1_14_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_14_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_14_R1.EntityTurtle;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.EnumMoveType;
|
||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_14_R1.Navigation;
|
||||
import net.minecraft.server.v1_14_R1.NavigationAbstract;
|
||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_14_R1.Vec3D;
|
||||
import net.minecraft.server.v1_14_R1.World;
|
||||
@ -73,14 +70,6 @@ public class TurtleController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract b(World world) {
|
||||
if (npc == null) {
|
||||
return super.b(world);
|
||||
}
|
||||
return new Navigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkDespawn() {
|
||||
if (npc == null) {
|
||||
@ -105,11 +94,7 @@ public class TurtleController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -238,6 +238,7 @@ import net.minecraft.server.v1_14_R1.EntityRabbit;
|
||||
import net.minecraft.server.v1_14_R1.EntityShulker;
|
||||
import net.minecraft.server.v1_14_R1.EntitySize;
|
||||
import net.minecraft.server.v1_14_R1.EntityTameableAnimal;
|
||||
import net.minecraft.server.v1_14_R1.EntityTurtle;
|
||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_14_R1.EntityWither;
|
||||
import net.minecraft.server.v1_14_R1.EnumMoveType;
|
||||
@ -1746,6 +1747,23 @@ public class NMSImpl implements NMSBridge {
|
||||
minecart.setDisplayBlockOffset(offset);
|
||||
}
|
||||
|
||||
public static boolean moveFish(NPC npc, EntityInsentient handle, Vec3D vec3d) {
|
||||
return moveFish(npc, handle, vec3d, -1);
|
||||
}
|
||||
|
||||
public static boolean moveFish(NPC npc, EntityInsentient handle, Vec3D vec3d, float speed) {
|
||||
if (npc == null) {
|
||||
return false;
|
||||
}
|
||||
if (!npc.useMinecraftAI() && handle.isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
handle.a(speed > 0 ? speed : handle instanceof EntityTurtle ? 0.1F : 0.01F, vec3d);
|
||||
handle.move(EnumMoveType.SELF, handle.getMot());
|
||||
handle.setMot(handle.getMot().a(0.9));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void resetPuffTicks(EntityPufferFish fish) {
|
||||
try {
|
||||
PUFFERFISH_C.invoke(fish, 0);
|
||||
|
@ -24,7 +24,6 @@ import net.minecraft.server.v1_15_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_15_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_15_R1.EnumHand;
|
||||
import net.minecraft.server.v1_15_R1.EnumMoveType;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.ItemStack;
|
||||
import net.minecraft.server.v1_15_R1.Items;
|
||||
@ -125,11 +124,7 @@ public class CodController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -22,10 +22,9 @@ import net.minecraft.server.v1_15_R1.EntityBoat;
|
||||
import net.minecraft.server.v1_15_R1.EntityDolphin;
|
||||
import net.minecraft.server.v1_15_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_15_R1.GenericAttributes;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_15_R1.Navigation;
|
||||
import net.minecraft.server.v1_15_R1.NavigationAbstract;
|
||||
import net.minecraft.server.v1_15_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_15_R1.Vec3D;
|
||||
import net.minecraft.server.v1_15_R1.World;
|
||||
@ -69,6 +68,8 @@ public class DolphinController extends MobEntityController {
|
||||
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
|
||||
this.oldMoveController = this.moveController;
|
||||
this.moveController = new ControllerMove(this);
|
||||
this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getBaseValue() / 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,11 +80,6 @@ public class DolphinController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ay() {
|
||||
return npc == null ? super.ay() : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean b(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
@ -92,11 +88,6 @@ public class DolphinController extends MobEntityController {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract b(World world) {
|
||||
return new Navigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (npc == null) {
|
||||
@ -121,7 +112,9 @@ public class DolphinController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.e(vec3d);
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d, dt())) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
||||
}
|
||||
@ -185,11 +178,6 @@ public class DolphinController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWater() {
|
||||
return npc == null ? super.isInWater() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
|
@ -122,7 +122,9 @@ public class PufferFishController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.e(vec3d);
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import net.minecraft.server.v1_15_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_15_R1.EntitySalmon;
|
||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_15_R1.EnumHand;
|
||||
import net.minecraft.server.v1_15_R1.EnumMoveType;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.ItemStack;
|
||||
import net.minecraft.server.v1_15_R1.Items;
|
||||
@ -111,11 +110,7 @@ public class SalmonController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -24,7 +24,6 @@ import net.minecraft.server.v1_15_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_15_R1.EntityTropicalFish;
|
||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_15_R1.EnumHand;
|
||||
import net.minecraft.server.v1_15_R1.EnumMoveType;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.ItemStack;
|
||||
import net.minecraft.server.v1_15_R1.Items;
|
||||
@ -111,11 +110,7 @@ public class TropicalFishController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -24,11 +24,8 @@ import net.minecraft.server.v1_15_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_15_R1.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_15_R1.EntityTurtle;
|
||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_15_R1.EnumMoveType;
|
||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_15_R1.Navigation;
|
||||
import net.minecraft.server.v1_15_R1.NavigationAbstract;
|
||||
import net.minecraft.server.v1_15_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_15_R1.Vec3D;
|
||||
import net.minecraft.server.v1_15_R1.World;
|
||||
@ -79,14 +76,6 @@ public class TurtleController extends MobEntityController {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract b(World world) {
|
||||
if (npc == null) {
|
||||
return super.b(world);
|
||||
}
|
||||
return new Navigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (npc == null) {
|
||||
@ -111,11 +100,7 @@ public class TurtleController extends MobEntityController {
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.e(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -242,6 +242,7 @@ import net.minecraft.server.v1_15_R1.EntityRabbit;
|
||||
import net.minecraft.server.v1_15_R1.EntityShulker;
|
||||
import net.minecraft.server.v1_15_R1.EntitySize;
|
||||
import net.minecraft.server.v1_15_R1.EntityTameableAnimal;
|
||||
import net.minecraft.server.v1_15_R1.EntityTurtle;
|
||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_15_R1.EntityWither;
|
||||
import net.minecraft.server.v1_15_R1.EnumMoveType;
|
||||
@ -1780,6 +1781,23 @@ public class NMSImpl implements NMSBridge {
|
||||
minecart.setDisplayBlockOffset(offset);
|
||||
}
|
||||
|
||||
public static boolean moveFish(NPC npc, EntityInsentient handle, Vec3D vec3d) {
|
||||
return moveFish(npc, handle, vec3d, -1);
|
||||
}
|
||||
|
||||
public static boolean moveFish(NPC npc, EntityInsentient handle, Vec3D vec3d, float speed) {
|
||||
if (npc == null) {
|
||||
return false;
|
||||
}
|
||||
if (!npc.useMinecraftAI() && handle.isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
handle.a(speed > 0 ? speed : handle instanceof EntityTurtle ? 0.1F : 0.01F, vec3d);
|
||||
handle.move(EnumMoveType.SELF, handle.getMot());
|
||||
handle.setMot(handle.getMot().a(0.9));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void resetPuffTicks(EntityPufferFish fish) {
|
||||
try {
|
||||
PUFFERFISH_C.invoke(fish, 0);
|
||||
|
@ -26,7 +26,6 @@ import net.minecraft.server.v1_16_R3.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_16_R3.EntityTypes;
|
||||
import net.minecraft.server.v1_16_R3.EnumHand;
|
||||
import net.minecraft.server.v1_16_R3.EnumInteractionResult;
|
||||
import net.minecraft.server.v1_16_R3.EnumMoveType;
|
||||
import net.minecraft.server.v1_16_R3.IBlockData;
|
||||
import net.minecraft.server.v1_16_R3.ItemStack;
|
||||
import net.minecraft.server.v1_16_R3.Items;
|
||||
@ -132,11 +131,7 @@ public class CodController extends MobEntityController {
|
||||
@Override
|
||||
public void g(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.g(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -23,10 +23,9 @@ import net.minecraft.server.v1_16_R3.EntityBoat;
|
||||
import net.minecraft.server.v1_16_R3.EntityDolphin;
|
||||
import net.minecraft.server.v1_16_R3.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_16_R3.EntityTypes;
|
||||
import net.minecraft.server.v1_16_R3.GenericAttributes;
|
||||
import net.minecraft.server.v1_16_R3.IBlockData;
|
||||
import net.minecraft.server.v1_16_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_16_R3.Navigation;
|
||||
import net.minecraft.server.v1_16_R3.NavigationAbstract;
|
||||
import net.minecraft.server.v1_16_R3.SoundEffect;
|
||||
import net.minecraft.server.v1_16_R3.Vec3D;
|
||||
import net.minecraft.server.v1_16_R3.World;
|
||||
@ -62,6 +61,8 @@ public class DolphinController extends MobEntityController {
|
||||
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
|
||||
this.oldMoveController = this.moveController;
|
||||
this.moveController = new ControllerMove(this);
|
||||
this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED)
|
||||
.setValue(this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getBaseValue() / 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,11 +73,6 @@ public class DolphinController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean aG() {
|
||||
return npc == null ? super.aG() : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean b(float f, float f1) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
@ -85,11 +81,6 @@ public class DolphinController extends MobEntityController {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract b(World world) {
|
||||
return new Navigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (npc == null) {
|
||||
@ -127,7 +118,9 @@ public class DolphinController extends MobEntityController {
|
||||
@Override
|
||||
public void g(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.g(vec3d);
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d, dM())) {
|
||||
super.g(vec3d);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
||||
}
|
||||
@ -178,11 +171,6 @@ public class DolphinController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWater() {
|
||||
return npc == null ? super.isInWater() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
|
@ -137,7 +137,9 @@ public class PufferFishController extends MobEntityController {
|
||||
@Override
|
||||
public void g(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.g(vec3d);
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.g(vec3d);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import net.minecraft.server.v1_16_R3.EntitySalmon;
|
||||
import net.minecraft.server.v1_16_R3.EntityTypes;
|
||||
import net.minecraft.server.v1_16_R3.EnumHand;
|
||||
import net.minecraft.server.v1_16_R3.EnumInteractionResult;
|
||||
import net.minecraft.server.v1_16_R3.EnumMoveType;
|
||||
import net.minecraft.server.v1_16_R3.IBlockData;
|
||||
import net.minecraft.server.v1_16_R3.ItemStack;
|
||||
import net.minecraft.server.v1_16_R3.Items;
|
||||
@ -126,11 +125,7 @@ public class SalmonController extends MobEntityController {
|
||||
@Override
|
||||
public void g(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.g(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -26,7 +26,6 @@ import net.minecraft.server.v1_16_R3.EntityTropicalFish;
|
||||
import net.minecraft.server.v1_16_R3.EntityTypes;
|
||||
import net.minecraft.server.v1_16_R3.EnumHand;
|
||||
import net.minecraft.server.v1_16_R3.EnumInteractionResult;
|
||||
import net.minecraft.server.v1_16_R3.EnumMoveType;
|
||||
import net.minecraft.server.v1_16_R3.IBlockData;
|
||||
import net.minecraft.server.v1_16_R3.ItemStack;
|
||||
import net.minecraft.server.v1_16_R3.Items;
|
||||
@ -126,11 +125,7 @@ public class TropicalFishController extends MobEntityController {
|
||||
@Override
|
||||
public void g(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.g(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -25,11 +25,8 @@ import net.minecraft.server.v1_16_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_16_R3.EntityMinecartAbstract;
|
||||
import net.minecraft.server.v1_16_R3.EntityTurtle;
|
||||
import net.minecraft.server.v1_16_R3.EntityTypes;
|
||||
import net.minecraft.server.v1_16_R3.EnumMoveType;
|
||||
import net.minecraft.server.v1_16_R3.IBlockData;
|
||||
import net.minecraft.server.v1_16_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_16_R3.Navigation;
|
||||
import net.minecraft.server.v1_16_R3.NavigationAbstract;
|
||||
import net.minecraft.server.v1_16_R3.SoundEffect;
|
||||
import net.minecraft.server.v1_16_R3.Vec3D;
|
||||
import net.minecraft.server.v1_16_R3.World;
|
||||
@ -80,14 +77,6 @@ public class TurtleController extends MobEntityController {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract b(World world) {
|
||||
if (npc == null) {
|
||||
return super.b(world);
|
||||
}
|
||||
return new Navigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (npc == null) {
|
||||
@ -125,11 +114,7 @@ public class TurtleController extends MobEntityController {
|
||||
@Override
|
||||
public void g(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.a(0.01F, vec3d);
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
this.setMot(this.getMot().a(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.g(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -247,6 +247,7 @@ import net.minecraft.server.v1_16_R3.EntityRabbit;
|
||||
import net.minecraft.server.v1_16_R3.EntityShulker;
|
||||
import net.minecraft.server.v1_16_R3.EntitySize;
|
||||
import net.minecraft.server.v1_16_R3.EntityTameableAnimal;
|
||||
import net.minecraft.server.v1_16_R3.EntityTurtle;
|
||||
import net.minecraft.server.v1_16_R3.EntityTypes;
|
||||
import net.minecraft.server.v1_16_R3.EntityWither;
|
||||
import net.minecraft.server.v1_16_R3.EnumMoveType;
|
||||
@ -1747,6 +1748,23 @@ public class NMSImpl implements NMSBridge {
|
||||
minecart.setDisplayBlockOffset(offset);
|
||||
}
|
||||
|
||||
public static boolean moveFish(NPC npc, EntityInsentient handle, Vec3D vec3d) {
|
||||
return moveFish(npc, handle, vec3d, -1);
|
||||
}
|
||||
|
||||
public static boolean moveFish(NPC npc, EntityInsentient handle, Vec3D vec3d, float speed) {
|
||||
if (npc == null) {
|
||||
return false;
|
||||
}
|
||||
if (!npc.useMinecraftAI() && handle.isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
handle.a(speed > 0 ? speed : handle instanceof EntityTurtle ? 0.1F : 0.01F, vec3d);
|
||||
handle.move(EnumMoveType.SELF, handle.getMot());
|
||||
handle.setMot(handle.getMot().a(0.9));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void resetPuffTicks(EntityPufferFish fish) {
|
||||
try {
|
||||
PUFFERFISH_C.invoke(fish, 0);
|
||||
|
@ -6,6 +6,8 @@ import org.bukkit.craftbukkit.v1_17_R1.entity.CraftAxolotl;
|
||||
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.mojang.serialization.Dynamic;
|
||||
|
||||
import net.citizensnpcs.api.event.NPCEnderTeleportEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_17_R1.util.ForwardingNPCHolder;
|
||||
@ -22,10 +24,9 @@ import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.Brain;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation;
|
||||
import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
||||
import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
@ -67,6 +68,8 @@ public class AxolotlController extends MobEntityController {
|
||||
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
|
||||
this.oldMoveController = this.moveControl;
|
||||
this.moveControl = new MoveControl(this);
|
||||
this.getAttribute(Attributes.MOVEMENT_SPEED)
|
||||
.setBaseValue(this.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue() / 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,11 +103,6 @@ public class AxolotlController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PathNavigation createNavigation(Level world) {
|
||||
return new GroundPathNavigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismountTo(double d0, double d1, double d2) {
|
||||
if (npc == null) {
|
||||
@ -146,16 +144,6 @@ public class AxolotlController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWater() {
|
||||
return npc == null ? super.isInWater() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWaterRainOrBubble() {
|
||||
return npc == null ? super.isInWaterRainOrBubble() : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
@ -169,6 +157,14 @@ public class AxolotlController extends MobEntityController {
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Brain makeBrain(Dynamic dynamic) {
|
||||
if (npc == null || npc.useMinecraftAI()) {
|
||||
return super.makeBrain(dynamic);
|
||||
}
|
||||
return brainProvider().makeBrain(dynamic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult mobInteract(Player entityhuman, InteractionHand enumhand) {
|
||||
if (npc == null || !npc.isProtected())
|
||||
@ -229,11 +225,7 @@ public class AxolotlController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(this.getSpeed(), vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -22,7 +22,6 @@ import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.animal.Cod;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@ -229,11 +228,7 @@ public class CodController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(0.01F, vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -20,9 +20,8 @@ import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation;
|
||||
import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
||||
import net.minecraft.world.entity.animal.Dolphin;
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
import net.minecraft.world.entity.vehicle.Boat;
|
||||
@ -61,6 +60,8 @@ public class DolphinController extends MobEntityController {
|
||||
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
|
||||
this.oldMoveController = this.moveControl;
|
||||
this.moveControl = new MoveControl(this);
|
||||
this.getAttribute(Attributes.MOVEMENT_SPEED)
|
||||
.setBaseValue(this.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue() / 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,11 +95,6 @@ public class DolphinController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PathNavigation createNavigation(Level world) {
|
||||
return new GroundPathNavigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismountTo(double d0, double d1, double d2) {
|
||||
if (npc == null) {
|
||||
@ -140,16 +136,6 @@ public class DolphinController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWater() {
|
||||
return npc == null ? super.isInWater() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWaterRainOrBubble() {
|
||||
return npc == null ? super.isInWaterRainOrBubble() : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
@ -212,7 +198,9 @@ public class DolphinController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.travel(vec3d);
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
||||
}
|
||||
|
@ -179,7 +179,9 @@ public class PigZombieController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.travel(vec3d);
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityDimensions;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.Pose;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.animal.Pufferfish;
|
||||
@ -244,7 +245,9 @@ public class PufferFishController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.travel(vec3d);
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.animal.Salmon;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@ -221,11 +220,7 @@ public class SalmonController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(0.01F, vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -22,7 +22,6 @@ import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.animal.TropicalFish;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@ -223,11 +222,7 @@ public class TropicalFishController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(0.01F, vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -21,11 +21,8 @@ import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.control.JumpControl;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation;
|
||||
import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
||||
import net.minecraft.world.entity.animal.Turtle;
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
import net.minecraft.world.entity.vehicle.Boat;
|
||||
@ -94,14 +91,6 @@ public class TurtleController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PathNavigation createNavigation(Level world) {
|
||||
if (npc == null) {
|
||||
return super.createNavigation(world);
|
||||
}
|
||||
return new GroundPathNavigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customServerAiStep() {
|
||||
super.customServerAiStep();
|
||||
@ -208,11 +197,7 @@ public class TurtleController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(0.1F, vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -253,10 +253,13 @@ import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
||||
import net.minecraft.world.entity.animal.AbstractFish;
|
||||
import net.minecraft.world.entity.animal.AbstractSchoolingFish;
|
||||
import net.minecraft.world.entity.animal.Cat;
|
||||
import net.minecraft.world.entity.animal.Dolphin;
|
||||
import net.minecraft.world.entity.animal.Panda;
|
||||
import net.minecraft.world.entity.animal.PolarBear;
|
||||
import net.minecraft.world.entity.animal.Pufferfish;
|
||||
import net.minecraft.world.entity.animal.Rabbit;
|
||||
import net.minecraft.world.entity.animal.Turtle;
|
||||
import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
||||
import net.minecraft.world.entity.animal.horse.AbstractHorse;
|
||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||
import net.minecraft.world.entity.boss.wither.WitherBoss;
|
||||
@ -1745,6 +1748,20 @@ public class NMSImpl implements NMSBridge {
|
||||
minecart.setDisplayOffset(offset);
|
||||
}
|
||||
|
||||
public static boolean moveFish(NPC npc, Mob handle, Vec3 vec3d) {
|
||||
if (npc == null) {
|
||||
return false;
|
||||
}
|
||||
if (!npc.useMinecraftAI() && handle.isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
handle.moveRelative((handle instanceof Dolphin || handle instanceof Axolotl) ? handle.getSpeed()
|
||||
: handle instanceof Turtle ? 0.1F : 0.01F, vec3d);
|
||||
handle.move(MoverType.SELF, handle.getDeltaMovement());
|
||||
handle.setDeltaMovement(handle.getDeltaMovement().scale(0.9));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void resetPuffTicks(Pufferfish fish) {
|
||||
try {
|
||||
PUFFERFISH_C.invoke(fish, 0);
|
||||
|
@ -6,11 +6,12 @@ import org.bukkit.craftbukkit.v1_18_R1.entity.CraftAxolotl;
|
||||
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.mojang.serialization.Dynamic;
|
||||
|
||||
import net.citizensnpcs.api.event.NPCEnderTeleportEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_18_R1.util.ForwardingNPCHolder;
|
||||
import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.nms.v1_18_R1.util.PlayerMoveControl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
@ -23,10 +24,9 @@ import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.Brain;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation;
|
||||
import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
||||
import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
@ -68,6 +68,8 @@ public class AxolotlController extends MobEntityController {
|
||||
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
|
||||
this.oldMoveController = this.moveControl;
|
||||
this.moveControl = new MoveControl(this);
|
||||
this.getAttribute(Attributes.MOVEMENT_SPEED)
|
||||
.setBaseValue(this.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue() / 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,11 +103,6 @@ public class AxolotlController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PathNavigation createNavigation(Level world) {
|
||||
return new GroundPathNavigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismountTo(double d0, double d1, double d2) {
|
||||
if (npc == null) {
|
||||
@ -147,16 +144,6 @@ public class AxolotlController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWater() {
|
||||
return npc == null ? super.isInWater() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWaterRainOrBubble() {
|
||||
return npc == null ? super.isInWaterRainOrBubble() : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
@ -170,6 +157,14 @@ public class AxolotlController extends MobEntityController {
|
||||
return false; // shouldLeash
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Brain makeBrain(Dynamic dynamic) {
|
||||
if (npc == null || npc.useMinecraftAI()) {
|
||||
return super.makeBrain(dynamic);
|
||||
}
|
||||
return brainProvider().makeBrain(dynamic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult mobInteract(Player entityhuman, InteractionHand enumhand) {
|
||||
if (npc == null || !npc.isProtected())
|
||||
@ -228,7 +223,7 @@ public class AxolotlController extends MobEntityController {
|
||||
this.moveControl = this.oldMoveController;
|
||||
}
|
||||
if (!npc.useMinecraftAI() && this.moveControl == this.oldMoveController) {
|
||||
this.moveControl = new PlayerMoveControl(this);
|
||||
this.moveControl = new MoveControl(this);
|
||||
}
|
||||
npc.update();
|
||||
}
|
||||
@ -237,11 +232,7 @@ public class AxolotlController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(this.getSpeed(), vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -23,7 +23,6 @@ import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.animal.Cod;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@ -238,11 +237,7 @@ public class CodController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(0.01F, vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -10,7 +10,6 @@ import net.citizensnpcs.api.event.NPCEnderTeleportEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.nms.v1_18_R1.util.ForwardingNPCHolder;
|
||||
import net.citizensnpcs.nms.v1_18_R1.util.NMSImpl;
|
||||
import net.citizensnpcs.nms.v1_18_R1.util.PlayerMoveControl;
|
||||
import net.citizensnpcs.npc.CitizensNPC;
|
||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||
import net.citizensnpcs.util.Util;
|
||||
@ -21,9 +20,8 @@ import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation;
|
||||
import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
||||
import net.minecraft.world.entity.animal.Dolphin;
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
import net.minecraft.world.entity.vehicle.Boat;
|
||||
@ -62,6 +60,8 @@ public class DolphinController extends MobEntityController {
|
||||
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
|
||||
this.oldMoveController = this.moveControl;
|
||||
this.moveControl = new MoveControl(this);
|
||||
this.getAttribute(Attributes.MOVEMENT_SPEED)
|
||||
.setBaseValue(this.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue() / 10);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,11 +95,6 @@ public class DolphinController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PathNavigation createNavigation(Level world) {
|
||||
return new GroundPathNavigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismountTo(double d0, double d1, double d2) {
|
||||
if (npc == null) {
|
||||
@ -141,16 +136,6 @@ public class DolphinController extends MobEntityController {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWater() {
|
||||
return npc == null ? super.isInWater() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWaterRainOrBubble() {
|
||||
return npc == null ? super.isInWaterRainOrBubble() : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null)
|
||||
@ -186,8 +171,9 @@ public class DolphinController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.push(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -211,7 +197,7 @@ public class DolphinController extends MobEntityController {
|
||||
this.moveControl = this.oldMoveController;
|
||||
}
|
||||
if (!npc.useMinecraftAI() && this.moveControl == this.oldMoveController) {
|
||||
this.moveControl = new PlayerMoveControl(this);
|
||||
this.moveControl = new MoveControl(this);
|
||||
}
|
||||
npc.update();
|
||||
}
|
||||
@ -220,7 +206,9 @@ public class DolphinController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
super.travel(vec3d);
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
NMSImpl.flyingMoveLogic(this, vec3d);
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityDimensions;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.Pose;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.animal.Pufferfish;
|
||||
@ -253,11 +252,7 @@ public class PufferFishController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(0.01F, vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -23,7 +23,6 @@ import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.animal.Salmon;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@ -229,11 +228,7 @@ public class SalmonController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(0.01F, vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -23,7 +23,6 @@ import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.animal.TropicalFish;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@ -231,11 +230,7 @@ public class TropicalFishController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(0.01F, vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -22,11 +22,8 @@ import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.control.JumpControl;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation;
|
||||
import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
||||
import net.minecraft.world.entity.animal.Turtle;
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
import net.minecraft.world.entity.vehicle.Boat;
|
||||
@ -95,14 +92,6 @@ public class TurtleController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PathNavigation createNavigation(Level world) {
|
||||
if (npc == null) {
|
||||
return super.createNavigation(world);
|
||||
}
|
||||
return new GroundPathNavigation(this, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customServerAiStep() {
|
||||
super.customServerAiStep();
|
||||
@ -216,11 +205,7 @@ public class TurtleController extends MobEntityController {
|
||||
@Override
|
||||
public void travel(Vec3 vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (!npc.useMinecraftAI() && isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
this.moveRelative(0.1F, vec3d);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
|
||||
} else {
|
||||
if (!NMSImpl.moveFish(npc, this, vec3d)) {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
} else {
|
||||
|
@ -255,10 +255,13 @@ import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
||||
import net.minecraft.world.entity.animal.AbstractFish;
|
||||
import net.minecraft.world.entity.animal.AbstractSchoolingFish;
|
||||
import net.minecraft.world.entity.animal.Cat;
|
||||
import net.minecraft.world.entity.animal.Dolphin;
|
||||
import net.minecraft.world.entity.animal.Panda;
|
||||
import net.minecraft.world.entity.animal.PolarBear;
|
||||
import net.minecraft.world.entity.animal.Pufferfish;
|
||||
import net.minecraft.world.entity.animal.Rabbit;
|
||||
import net.minecraft.world.entity.animal.Turtle;
|
||||
import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
||||
import net.minecraft.world.entity.animal.horse.AbstractHorse;
|
||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||
import net.minecraft.world.entity.boss.wither.WitherBoss;
|
||||
@ -1748,6 +1751,20 @@ public class NMSImpl implements NMSBridge {
|
||||
minecart.setDisplayOffset(offset);
|
||||
}
|
||||
|
||||
public static boolean moveFish(NPC npc, Mob handle, Vec3 vec3d) {
|
||||
if (npc == null) {
|
||||
return false;
|
||||
}
|
||||
if (!npc.useMinecraftAI() && handle.isInWater() && !npc.getNavigator().isNavigating()) {
|
||||
handle.moveRelative((handle instanceof Dolphin || handle instanceof Axolotl) ? handle.getSpeed()
|
||||
: handle instanceof Turtle ? 0.1F : 0.01F, vec3d);
|
||||
handle.move(MoverType.SELF, handle.getDeltaMovement());
|
||||
handle.setDeltaMovement(handle.getDeltaMovement().scale(0.9));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void resetPuffTicks(Pufferfish fish) {
|
||||
try {
|
||||
PUFFERFISH_C.invoke(fish, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user