Skip to content

Commit

Permalink
Fix wolf targeting with Citizens installed
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Feb 5, 2018
1 parent 476debf commit 9ad7c97
Show file tree
Hide file tree
Showing 51 changed files with 731 additions and 593 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public boolean m_() {

@Override
public boolean setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fire) {
return npc == null ? super.setGoalTarget(killer, reason, fire) : false;
return npc == null ? super.setGoalTarget(entityliving, reason, fire) : false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public boolean m_() {

@Override
public boolean setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fire) {
return npc == null ? super.setGoalTarget(killer, reason, fire) : false;
return npc == null ? super.setGoalTarget(entityliving, reason, fire) : false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ public boolean d(NBTTagCompound save) {

@Override
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
if (npc == null) {
super.enderTeleportTo(d0, d1, d2);
return;
}
NPCEnderTeleportEvent event = new NPCEnderTeleportEvent(npc);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ public boolean d(NBTTagCompound save) {

@Override
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
if (npc == null) {
super.enderTeleportTo(d0, d1, d2);
return;
}
NPCEnderTeleportEvent event = new NPCEnderTeleportEvent(npc);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.citizensnpcs.nms.v1_12_R1.entity; import net.minecraft.server.v1_12_R1.DamageSource;
package net.citizensnpcs.nms.v1_12_R1.entity;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
Expand All @@ -15,6 +15,7 @@
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_12_R1.BlockPosition;
import net.minecraft.server.v1_12_R1.DamageSource;
import net.minecraft.server.v1_12_R1.EntityCaveSpider;
import net.minecraft.server.v1_12_R1.IBlockData;
import net.minecraft.server.v1_12_R1.NBTTagCompound;
Expand Down Expand Up @@ -68,13 +69,17 @@ protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockp
}

@Override
protected SoundEffect cf() {
return NMSImpl.getSoundEffect(npc, super.cf(), NPC.DEATH_SOUND_METADATA);
public void a(float f, float f1, float f2) {
if (npc == null || !npc.isFlyable()) {
super.a(f, f1, f2);
} else {
NMSImpl.flyingMoveLogic(this, f, f1, f2);
}
}

@Override
protected SoundEffect d(DamageSource damagesource) {
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
protected SoundEffect cf() {
return NMSImpl.getSoundEffect(npc, super.cf(), NPC.DEATH_SOUND_METADATA);
}

@Override
Expand All @@ -87,6 +92,11 @@ public void collide(net.minecraft.server.v1_12_R1.Entity entity) {
}
}

@Override
protected SoundEffect d(DamageSource damagesource) {
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
}

@Override
public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
Expand All @@ -101,8 +111,10 @@ public void e(float f, float f1) {

@Override
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
if (npc == null) {
super.enderTeleportTo(d0, d1, d2);
return;
}
NPCEnderTeleportEvent event = new NPCEnderTeleportEvent(npc);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
Expand Down Expand Up @@ -132,15 +144,6 @@ public void f(double x, double y, double z) {
// cancelled.
}

@Override
public void a(float f, float f1, float f2) {
if (npc == null || !npc.isFlyable()) {
super.a(f, f1, f2);
} else {
NMSImpl.flyingMoveLogic(this, f, f1, f2);
}
}

@Override
protected SoundEffect F() {
return NMSImpl.getSoundEffect(npc, super.F(), NPC.AMBIENT_SOUND_METADATA);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.citizensnpcs.nms.v1_12_R1.entity; import net.minecraft.server.v1_12_R1.DamageSource;
package net.citizensnpcs.nms.v1_12_R1.entity;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
Expand All @@ -15,6 +15,7 @@
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_12_R1.BlockPosition;
import net.minecraft.server.v1_12_R1.DamageSource;
import net.minecraft.server.v1_12_R1.EntityChicken;
import net.minecraft.server.v1_12_R1.IBlockData;
import net.minecraft.server.v1_12_R1.NBTTagCompound;
Expand Down Expand Up @@ -79,13 +80,17 @@ protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockp
}

@Override
protected SoundEffect cf() {
return NMSImpl.getSoundEffect(npc, super.cf(), NPC.DEATH_SOUND_METADATA);
public void a(float f, float f1, float f2) {
if (npc == null || !npc.isFlyable()) {
super.a(f, f1, f2);
} else {
NMSImpl.flyingMoveLogic(this, f, f1, f2);
}
}

@Override
protected SoundEffect d(DamageSource damagesource) {
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
protected SoundEffect cf() {
return NMSImpl.getSoundEffect(npc, super.cf(), NPC.DEATH_SOUND_METADATA);
}

@Override
Expand All @@ -98,6 +103,11 @@ public void collide(net.minecraft.server.v1_12_R1.Entity entity) {
}
}

@Override
protected SoundEffect d(DamageSource damagesource) {
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
}

@Override
public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
Expand All @@ -112,8 +122,10 @@ public void e(float f, float f1) {

@Override
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
if (npc == null) {
super.enderTeleportTo(d0, d1, d2);
return;
}
NPCEnderTeleportEvent event = new NPCEnderTeleportEvent(npc);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
Expand Down Expand Up @@ -143,15 +155,6 @@ public void f(double x, double y, double z) {
// cancelled.
}

@Override
public void a(float f, float f1, float f2) {
if (npc == null || !npc.isFlyable()) {
super.a(f, f1, f2);
} else {
NMSImpl.flyingMoveLogic(this, f, f1, f2);
}
}

@Override
protected SoundEffect F() {
return NMSImpl.getSoundEffect(npc, super.F(), NPC.AMBIENT_SOUND_METADATA);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.citizensnpcs.nms.v1_12_R1.entity; import net.minecraft.server.v1_12_R1.DamageSource;
package net.citizensnpcs.nms.v1_12_R1.entity;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
Expand All @@ -15,6 +15,7 @@
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_12_R1.BlockPosition;
import net.minecraft.server.v1_12_R1.DamageSource;
import net.minecraft.server.v1_12_R1.EntityCow;
import net.minecraft.server.v1_12_R1.IBlockData;
import net.minecraft.server.v1_12_R1.NBTTagCompound;
Expand Down Expand Up @@ -80,13 +81,17 @@ protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockp
}

@Override
protected SoundEffect cf() {
return NMSImpl.getSoundEffect(npc, super.cf(), NPC.DEATH_SOUND_METADATA);
public void a(float f, float f1, float f2) {
if (npc == null || !npc.isFlyable()) {
super.a(f, f1, f2);
} else {
NMSImpl.flyingMoveLogic(this, f, f1, f2);
}
}

@Override
protected SoundEffect d(DamageSource damagesource) {
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
protected SoundEffect cf() {
return NMSImpl.getSoundEffect(npc, super.cf(), NPC.DEATH_SOUND_METADATA);
}

@Override
Expand All @@ -99,6 +104,11 @@ public void collide(net.minecraft.server.v1_12_R1.Entity entity) {
}
}

@Override
protected SoundEffect d(DamageSource damagesource) {
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
}

@Override
public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
Expand All @@ -113,8 +123,10 @@ public void e(float f, float f1) {

@Override
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
if (npc == null) {
super.enderTeleportTo(d0, d1, d2);
return;
}
NPCEnderTeleportEvent event = new NPCEnderTeleportEvent(npc);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
Expand Down Expand Up @@ -144,15 +156,6 @@ public void f(double x, double y, double z) {
// cancelled.
}

@Override
public void a(float f, float f1, float f2) {
if (npc == null || !npc.isFlyable()) {
super.a(f, f1, f2);
} else {
NMSImpl.flyingMoveLogic(this, f, f1, f2);
}
}

@Override
protected SoundEffect F() {
return NMSImpl.getSoundEffect(npc, super.F(), NPC.AMBIENT_SOUND_METADATA);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.citizensnpcs.nms.v1_12_R1.entity; import net.minecraft.server.v1_12_R1.DamageSource;
package net.citizensnpcs.nms.v1_12_R1.entity;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
Expand All @@ -15,6 +15,7 @@
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_12_R1.BlockPosition;
import net.minecraft.server.v1_12_R1.DamageSource;
import net.minecraft.server.v1_12_R1.EntityCreeper;
import net.minecraft.server.v1_12_R1.EntityLightning;
import net.minecraft.server.v1_12_R1.IBlockData;
Expand Down Expand Up @@ -70,13 +71,17 @@ protected void a(double d0, boolean flag, IBlockData block, BlockPosition blockp
}

@Override
protected SoundEffect cf() {
return NMSImpl.getSoundEffect(npc, super.cf(), NPC.DEATH_SOUND_METADATA);
public void a(float f, float f1, float f2) {
if (npc == null || !npc.isFlyable()) {
super.a(f, f1, f2);
} else {
NMSImpl.flyingMoveLogic(this, f, f1, f2);
}
}

@Override
protected SoundEffect d(DamageSource damagesource) {
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
protected SoundEffect cf() {
return NMSImpl.getSoundEffect(npc, super.cf(), NPC.DEATH_SOUND_METADATA);
}

@Override
Expand All @@ -88,6 +93,11 @@ public void collide(net.minecraft.server.v1_12_R1.Entity entity) {
Util.callCollisionEvent(npc, entity.getBukkitEntity());
}

@Override
protected SoundEffect d(DamageSource damagesource) {
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
}

@Override
public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
Expand All @@ -102,8 +112,10 @@ public void e(float f, float f1) {

@Override
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
if (npc == null) {
super.enderTeleportTo(d0, d1, d2);
return;
}
NPCEnderTeleportEvent event = new NPCEnderTeleportEvent(npc);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
Expand Down Expand Up @@ -134,15 +146,6 @@ public void f(double x, double y, double z) {
// cancelled.
}

@Override
public void a(float f, float f1, float f2) {
if (npc == null || !npc.isFlyable()) {
super.a(f, f1, f2);
} else {
NMSImpl.flyingMoveLogic(this, f, f1, f2);
}
}

@Override
protected SoundEffect F() {
return NMSImpl.getSoundEffect(npc, super.F(), NPC.AMBIENT_SOUND_METADATA);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.citizensnpcs.nms.v1_12_R1.entity; import net.minecraft.server.v1_12_R1.DamageSource;
package net.citizensnpcs.nms.v1_12_R1.entity;

import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
Expand All @@ -14,6 +14,7 @@
import net.citizensnpcs.npc.CitizensNPC;
import net.citizensnpcs.npc.ai.NPCHolder;
import net.citizensnpcs.util.Util;
import net.minecraft.server.v1_12_R1.DamageSource;
import net.minecraft.server.v1_12_R1.EntityEnderDragon;
import net.minecraft.server.v1_12_R1.NBTTagCompound;
import net.minecraft.server.v1_12_R1.SoundEffect;
Expand Down Expand Up @@ -63,11 +64,6 @@ protected SoundEffect cf() {
return NMSImpl.getSoundEffect(npc, super.cf(), NPC.DEATH_SOUND_METADATA);
}

@Override
protected SoundEffect d(DamageSource damagesource) {
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
}

@Override
public void collide(net.minecraft.server.v1_12_R1.Entity entity) {
// this method is called by both the entities involved - cancelling
Expand All @@ -77,15 +73,22 @@ public void collide(net.minecraft.server.v1_12_R1.Entity entity) {
Util.callCollisionEvent(npc, entity.getBukkitEntity());
}

@Override
protected SoundEffect d(DamageSource damagesource) {
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
}

@Override
public boolean d(NBTTagCompound save) {
return npc == null ? super.d(save) : false;
}

@Override
public void enderTeleportTo(double d0, double d1, double d2) {
if (npc == null)
if (npc == null) {
super.enderTeleportTo(d0, d1, d2);
return;
}
NPCEnderTeleportEvent event = new NPCEnderTeleportEvent(npc);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
Expand Down

0 comments on commit 9ad7c97

Please sign in to comment.