Stop fish from flopping

This commit is contained in:
fullwall 2019-07-01 17:16:06 +08:00
parent b66fe9d18a
commit 2caadf5bad
8 changed files with 141 additions and 48 deletions

View File

@ -193,6 +193,18 @@ public class CodController extends MobEntityController {
} }
} }
@Override
public void movementTick() {
boolean lastInWater = this.C;
if (npc != null) {
this.C = false;
}
super.movementTick();
if (npc != null) {
this.C = lastInWater;
}
}
@Override @Override
public boolean z_() { public boolean z_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -176,6 +176,18 @@ public class PufferFishController extends MobEntityController {
} }
} }
@Override
public void movementTick() {
boolean lastInWater = this.C;
if (npc != null) {
this.C = false;
}
super.movementTick();
if (npc != null) {
this.C = lastInWater;
}
}
@Override @Override
public boolean z_() { public boolean z_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -179,6 +179,18 @@ public class SalmonController extends MobEntityController {
} }
} }
@Override
public void movementTick() {
boolean lastInWater = this.C;
if (npc != null) {
this.C = false;
}
super.movementTick();
if (npc != null) {
this.C = lastInWater;
}
}
@Override @Override
public boolean z_() { public boolean z_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -179,6 +179,18 @@ public class TropicalFishController extends MobEntityController {
} }
} }
@Override
public void movementTick() {
boolean lastInWater = this.C;
if (npc != null) {
this.C = false;
}
super.movementTick();
if (npc != null) {
this.C = lastInWater;
}
}
@Override @Override
public boolean z_() { public boolean z_() {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {

View File

@ -1,7 +1,5 @@
package net.citizensnpcs.nms.v1_14_R1.entity; package net.citizensnpcs.nms.v1_14_R1.entity;
import net.minecraft.server.v1_14_R1.Vec3D;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftCod; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftCod;
@ -24,6 +22,7 @@ import net.minecraft.server.v1_14_R1.EntityTypes;
import net.minecraft.server.v1_14_R1.IBlockData; import net.minecraft.server.v1_14_R1.IBlockData;
import net.minecraft.server.v1_14_R1.NBTTagCompound; import net.minecraft.server.v1_14_R1.NBTTagCompound;
import net.minecraft.server.v1_14_R1.SoundEffect; import net.minecraft.server.v1_14_R1.SoundEffect;
import net.minecraft.server.v1_14_R1.Vec3D;
import net.minecraft.server.v1_14_R1.World; import net.minecraft.server.v1_14_R1.World;
public class CodController extends MobEntityController { public class CodController extends MobEntityController {
@ -73,15 +72,6 @@ public class CodController extends MobEntityController {
} }
} }
@Override
public void e(Vec3D vec3d) {
if (npc == null || !npc.isFlyable()) {
super.e(vec3d);
} else {
NMSImpl.flyingMoveLogic(this, vec3d);
}
}
@Override @Override
public void b(float f, float f1) { public void b(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -110,6 +100,15 @@ public class CodController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
public void e(Vec3D vec3d) {
if (npc == null || !npc.isFlyable()) {
super.e(vec3d);
} else {
NMSImpl.flyingMoveLogic(this, vec3d);
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) { if (npc == null) {
@ -173,6 +172,15 @@ public class CodController extends MobEntityController {
return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA);
} }
@Override
public boolean isClimbing() {
if (npc == null || !npc.isFlyable()) {
return super.isClimbing();
} else {
return false;
}
}
@Override @Override
public boolean isLeashed() { public boolean isLeashed() {
if (npc == null) if (npc == null)
@ -198,11 +206,14 @@ public class CodController extends MobEntityController {
} }
@Override @Override
public boolean isClimbing() { public void movementTick() {
if (npc == null || !npc.isFlyable()) { boolean lastInWater = this.y;
return super.isClimbing(); if (npc != null) {
} else { this.y = false;
return false; }
super.movementTick();
if (npc != null) {
this.y = lastInWater;
} }
} }
} }

View File

@ -187,6 +187,18 @@ public class PufferFishController extends MobEntityController {
npc.update(); npc.update();
} }
} }
@Override
public void movementTick() {
boolean lastInWater = this.y;
if (npc != null) {
this.y = false;
}
super.movementTick();
if (npc != null) {
this.y = lastInWater;
}
}
} }
public static class PufferFishNPC extends CraftPufferFish implements NPCHolder { public static class PufferFishNPC extends CraftPufferFish implements NPCHolder {

View File

@ -1,7 +1,5 @@
package net.citizensnpcs.nms.v1_14_R1.entity; package net.citizensnpcs.nms.v1_14_R1.entity;
import net.minecraft.server.v1_14_R1.Vec3D;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
@ -24,6 +22,7 @@ import net.minecraft.server.v1_14_R1.EntityTypes;
import net.minecraft.server.v1_14_R1.IBlockData; import net.minecraft.server.v1_14_R1.IBlockData;
import net.minecraft.server.v1_14_R1.NBTTagCompound; import net.minecraft.server.v1_14_R1.NBTTagCompound;
import net.minecraft.server.v1_14_R1.SoundEffect; import net.minecraft.server.v1_14_R1.SoundEffect;
import net.minecraft.server.v1_14_R1.Vec3D;
import net.minecraft.server.v1_14_R1.World; import net.minecraft.server.v1_14_R1.World;
public class SalmonController extends MobEntityController { public class SalmonController extends MobEntityController {
@ -59,15 +58,6 @@ public class SalmonController extends MobEntityController {
} }
} }
@Override
public void e(Vec3D vec3d) {
if (npc == null || !npc.isFlyable()) {
super.e(vec3d);
} else {
NMSImpl.flyingMoveLogic(this, vec3d);
}
}
@Override @Override
public void b(float f, float f1) { public void b(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -96,6 +86,15 @@ public class SalmonController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
public void e(Vec3D vec3d) {
if (npc == null || !npc.isFlyable()) {
super.e(vec3d);
} else {
NMSImpl.flyingMoveLogic(this, vec3d);
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) { if (npc == null) {
@ -159,6 +158,15 @@ public class SalmonController extends MobEntityController {
return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA);
} }
@Override
public boolean isClimbing() {
if (npc == null || !npc.isFlyable()) {
return super.isClimbing();
} else {
return false;
}
}
@Override @Override
public boolean isLeashed() { public boolean isLeashed() {
if (npc == null) if (npc == null)
@ -184,11 +192,14 @@ public class SalmonController extends MobEntityController {
} }
@Override @Override
public boolean isClimbing() { public void movementTick() {
if (npc == null || !npc.isFlyable()) { boolean lastInWater = this.y;
return super.isClimbing(); if (npc != null) {
} else { this.y = false;
return false; }
super.movementTick();
if (npc != null) {
this.y = lastInWater;
} }
} }
} }

View File

@ -1,7 +1,5 @@
package net.citizensnpcs.nms.v1_14_R1.entity; package net.citizensnpcs.nms.v1_14_R1.entity;
import net.minecraft.server.v1_14_R1.Vec3D;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
@ -24,6 +22,7 @@ import net.minecraft.server.v1_14_R1.EntityTypes;
import net.minecraft.server.v1_14_R1.IBlockData; import net.minecraft.server.v1_14_R1.IBlockData;
import net.minecraft.server.v1_14_R1.NBTTagCompound; import net.minecraft.server.v1_14_R1.NBTTagCompound;
import net.minecraft.server.v1_14_R1.SoundEffect; import net.minecraft.server.v1_14_R1.SoundEffect;
import net.minecraft.server.v1_14_R1.Vec3D;
import net.minecraft.server.v1_14_R1.World; import net.minecraft.server.v1_14_R1.World;
public class TropicalFishController extends MobEntityController { public class TropicalFishController extends MobEntityController {
@ -59,15 +58,6 @@ public class TropicalFishController extends MobEntityController {
} }
} }
@Override
public void e(Vec3D vec3d) {
if (npc == null || !npc.isFlyable()) {
super.e(vec3d);
} else {
NMSImpl.flyingMoveLogic(this, vec3d);
}
}
@Override @Override
public void b(float f, float f1) { public void b(float f, float f1) {
if (npc == null || !npc.isFlyable()) { if (npc == null || !npc.isFlyable()) {
@ -96,6 +86,15 @@ public class TropicalFishController extends MobEntityController {
return npc == null ? super.d(save) : false; return npc == null ? super.d(save) : false;
} }
@Override
public void e(Vec3D vec3d) {
if (npc == null || !npc.isFlyable()) {
super.e(vec3d);
} else {
NMSImpl.flyingMoveLogic(this, vec3d);
}
}
@Override @Override
public void enderTeleportTo(double d0, double d1, double d2) { public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) { if (npc == null) {
@ -159,6 +158,15 @@ public class TropicalFishController extends MobEntityController {
return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA); return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA);
} }
@Override
public boolean isClimbing() {
if (npc == null || !npc.isFlyable()) {
return super.isClimbing();
} else {
return false;
}
}
@Override @Override
public boolean isLeashed() { public boolean isLeashed() {
if (npc == null) if (npc == null)
@ -184,11 +192,14 @@ public class TropicalFishController extends MobEntityController {
} }
@Override @Override
public boolean isClimbing() { public void movementTick() {
if (npc == null || !npc.isFlyable()) { boolean lastInWater = this.y;
return super.isClimbing(); if (npc != null) {
} else { this.y = false;
return false; }
super.movementTick();
if (npc != null) {
this.y = lastInWater;
} }
} }
} }