Skip to content

Commit

Permalink
Stop fish from flopping
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jul 1, 2019
1 parent b66fe9d commit 2caadf5
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 48 deletions.
Expand Up @@ -193,6 +193,18 @@ public void mobTick() {
}
}

@Override
public void movementTick() {
boolean lastInWater = this.C;
if (npc != null) {
this.C = false;
}
super.movementTick();
if (npc != null) {
this.C = lastInWater;
}
}

@Override
public boolean z_() {
if (npc == null || !npc.isFlyable()) {
Expand Down
Expand Up @@ -176,6 +176,18 @@ public void mobTick() {
}
}

@Override
public void movementTick() {
boolean lastInWater = this.C;
if (npc != null) {
this.C = false;
}
super.movementTick();
if (npc != null) {
this.C = lastInWater;
}
}

@Override
public boolean z_() {
if (npc == null || !npc.isFlyable()) {
Expand Down
Expand Up @@ -179,6 +179,18 @@ public void mobTick() {
}
}

@Override
public void movementTick() {
boolean lastInWater = this.C;
if (npc != null) {
this.C = false;
}
super.movementTick();
if (npc != null) {
this.C = lastInWater;
}
}

@Override
public boolean z_() {
if (npc == null || !npc.isFlyable()) {
Expand Down
Expand Up @@ -179,6 +179,18 @@ public void mobTick() {
}
}

@Override
public void movementTick() {
boolean lastInWater = this.C;
if (npc != null) {
this.C = false;
}
super.movementTick();
if (npc != null) {
this.C = lastInWater;
}
}

@Override
public boolean z_() {
if (npc == null || !npc.isFlyable()) {
Expand Down
@@ -1,7 +1,5 @@
package net.citizensnpcs.nms.v1_14_R1.entity;

import net.minecraft.server.v1_14_R1.Vec3D;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftCod;
Expand All @@ -24,6 +22,7 @@
import net.minecraft.server.v1_14_R1.IBlockData;
import net.minecraft.server.v1_14_R1.NBTTagCompound;
import net.minecraft.server.v1_14_R1.SoundEffect;
import net.minecraft.server.v1_14_R1.Vec3D;
import net.minecraft.server.v1_14_R1.World;

public class CodController extends MobEntityController {
Expand Down Expand Up @@ -73,15 +72,6 @@ protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockp
}
}

@Override
public void e(Vec3D vec3d) {
if (npc == null || !npc.isFlyable()) {
super.e(vec3d);
} else {
NMSImpl.flyingMoveLogic(this, vec3d);
}
}

@Override
public void b(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
Expand Down Expand Up @@ -110,6 +100,15 @@ public boolean d(NBTTagCompound save) {
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
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) {
Expand Down Expand Up @@ -173,6 +172,15 @@ protected SoundEffect getSoundHurt(DamageSource damagesource) {
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
public boolean isLeashed() {
if (npc == null)
Expand All @@ -198,11 +206,14 @@ public void mobTick() {
}

@Override
public boolean isClimbing() {
if (npc == null || !npc.isFlyable()) {
return super.isClimbing();
} else {
return false;
public void movementTick() {
boolean lastInWater = this.y;
if (npc != null) {
this.y = false;
}
super.movementTick();
if (npc != null) {
this.y = lastInWater;
}
}
}
Expand Down
Expand Up @@ -187,6 +187,18 @@ public void mobTick() {
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 {
Expand Down
@@ -1,7 +1,5 @@
package net.citizensnpcs.nms.v1_14_R1.entity;

import net.minecraft.server.v1_14_R1.Vec3D;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
Expand All @@ -24,6 +22,7 @@
import net.minecraft.server.v1_14_R1.IBlockData;
import net.minecraft.server.v1_14_R1.NBTTagCompound;
import net.minecraft.server.v1_14_R1.SoundEffect;
import net.minecraft.server.v1_14_R1.Vec3D;
import net.minecraft.server.v1_14_R1.World;

public class SalmonController extends MobEntityController {
Expand Down Expand Up @@ -59,15 +58,6 @@ protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockp
}
}

@Override
public void e(Vec3D vec3d) {
if (npc == null || !npc.isFlyable()) {
super.e(vec3d);
} else {
NMSImpl.flyingMoveLogic(this, vec3d);
}
}

@Override
public void b(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
Expand Down Expand Up @@ -96,6 +86,15 @@ public boolean d(NBTTagCompound save) {
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
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) {
Expand Down Expand Up @@ -159,6 +158,15 @@ protected SoundEffect getSoundHurt(DamageSource damagesource) {
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
public boolean isLeashed() {
if (npc == null)
Expand All @@ -184,11 +192,14 @@ public void mobTick() {
}

@Override
public boolean isClimbing() {
if (npc == null || !npc.isFlyable()) {
return super.isClimbing();
} else {
return false;
public void movementTick() {
boolean lastInWater = this.y;
if (npc != null) {
this.y = false;
}
super.movementTick();
if (npc != null) {
this.y = lastInWater;
}
}
}
Expand Down
@@ -1,7 +1,5 @@
package net.citizensnpcs.nms.v1_14_R1.entity;

import net.minecraft.server.v1_14_R1.Vec3D;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_14_R1.CraftServer;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
Expand All @@ -24,6 +22,7 @@
import net.minecraft.server.v1_14_R1.IBlockData;
import net.minecraft.server.v1_14_R1.NBTTagCompound;
import net.minecraft.server.v1_14_R1.SoundEffect;
import net.minecraft.server.v1_14_R1.Vec3D;
import net.minecraft.server.v1_14_R1.World;

public class TropicalFishController extends MobEntityController {
Expand Down Expand Up @@ -59,15 +58,6 @@ protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockp
}
}

@Override
public void e(Vec3D vec3d) {
if (npc == null || !npc.isFlyable()) {
super.e(vec3d);
} else {
NMSImpl.flyingMoveLogic(this, vec3d);
}
}

@Override
public void b(float f, float f1) {
if (npc == null || !npc.isFlyable()) {
Expand Down Expand Up @@ -96,6 +86,15 @@ public boolean d(NBTTagCompound save) {
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
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null) {
Expand Down Expand Up @@ -159,6 +158,15 @@ protected SoundEffect getSoundHurt(DamageSource damagesource) {
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
public boolean isLeashed() {
if (npc == null)
Expand All @@ -184,11 +192,14 @@ public void mobTick() {
}

@Override
public boolean isClimbing() {
if (npc == null || !npc.isFlyable()) {
return super.isClimbing();
} else {
return false;
public void movementTick() {
boolean lastInWater = this.y;
if (npc != null) {
this.y = false;
}
super.movementTick();
if (npc != null) {
this.y = lastInWater;
}
}
}
Expand Down

0 comments on commit 2caadf5

Please sign in to comment.