mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-29 06:05:17 +01:00
Disable milking protected NPC cows
This commit is contained in:
parent
aa0752f7a2
commit
10cea99af1
@ -288,17 +288,17 @@ public class EventListen implements Listener {
|
|||||||
Bukkit.getPluginManager().callEvent(new NPCDeathEvent(npc, event));
|
Bukkit.getPluginManager().callEvent(new NPCDeathEvent(npc, event));
|
||||||
npc.despawn(DespawnReason.DEATH);
|
npc.despawn(DespawnReason.DEATH);
|
||||||
|
|
||||||
if (npc.data().get(NPC.RESPAWN_DELAY_METADATA, -1) >= 0) {
|
int delay = npc.data().get(NPC.RESPAWN_DELAY_METADATA, -1);
|
||||||
int delay = npc.data().get(NPC.RESPAWN_DELAY_METADATA, -1);
|
if (delay < 0)
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
return;
|
||||||
@Override
|
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
if (!npc.isSpawned() && npc.getOwningRegistry().getByUniqueId(npc.getUniqueId()) == npc) {
|
public void run() {
|
||||||
npc.spawn(location, SpawnReason.TIMED_RESPAWN);
|
if (!npc.isSpawned() && npc.getOwningRegistry().getByUniqueId(npc.getUniqueId()) == npc) {
|
||||||
}
|
npc.spawn(location, SpawnReason.TIMED_RESPAWN);
|
||||||
}
|
}
|
||||||
}, delay + 2);
|
}
|
||||||
}
|
}, delay + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -426,8 +426,7 @@ public class EventListen implements Listener {
|
|||||||
if (team.getSize() == 1) {
|
if (team.getSize() == 1) {
|
||||||
Util.sendTeamPacketToOnlinePlayers(team, 1);
|
Util.sendTeamPacketToOnlinePlayers(team, 1);
|
||||||
team.unregister();
|
team.unregister();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
team.removePlayer(player);
|
team.removePlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,10 +139,15 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
|||||||
* @return whether the mount was successful
|
* @return whether the mount was successful
|
||||||
*/
|
*/
|
||||||
public boolean mount(Player toMount) {
|
public boolean mount(Player toMount) {
|
||||||
boolean found = NMS.getPassengers(npc.getEntity()).size() == 0;
|
List<Entity> passengers = NMS.getPassengers(npc.getEntity());
|
||||||
for (Entity passenger : NMS.getPassengers(npc.getEntity())) {
|
if (passengers.size() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean found = false;
|
||||||
|
for (Entity passenger : passengers) {
|
||||||
if (passenger != null && passenger == toMount) {
|
if (passenger != null && passenger == toMount) {
|
||||||
found = true;
|
found = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
|
@ -16,7 +16,11 @@ import net.citizensnpcs.npc.ai.NPCHolder;
|
|||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_10_R1.BlockPosition;
|
import net.minecraft.server.v1_10_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_10_R1.EntityCow;
|
import net.minecraft.server.v1_10_R1.EntityCow;
|
||||||
|
import net.minecraft.server.v1_10_R1.EntityHuman;
|
||||||
|
import net.minecraft.server.v1_10_R1.EnumHand;
|
||||||
import net.minecraft.server.v1_10_R1.IBlockData;
|
import net.minecraft.server.v1_10_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_10_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_10_R1.Items;
|
||||||
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_10_R1.SoundEffect;
|
import net.minecraft.server.v1_10_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_10_R1.World;
|
import net.minecraft.server.v1_10_R1.World;
|
||||||
@ -79,6 +83,17 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand, itemstack);
|
||||||
|
if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild
|
||||||
|
&& !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand, itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SoundEffect bV() {
|
protected SoundEffect bV() {
|
||||||
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA);
|
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA);
|
||||||
|
@ -15,8 +15,12 @@ import net.citizensnpcs.npc.CitizensNPC;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_10_R1.BlockPosition;
|
import net.minecraft.server.v1_10_R1.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_10_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_10_R1.EntityMushroomCow;
|
import net.minecraft.server.v1_10_R1.EntityMushroomCow;
|
||||||
|
import net.minecraft.server.v1_10_R1.EnumHand;
|
||||||
import net.minecraft.server.v1_10_R1.IBlockData;
|
import net.minecraft.server.v1_10_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_10_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_10_R1.Items;
|
||||||
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_10_R1.SoundEffect;
|
import net.minecraft.server.v1_10_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_10_R1.World;
|
import net.minecraft.server.v1_10_R1.World;
|
||||||
@ -65,6 +69,17 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand, itemstack);
|
||||||
|
if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild
|
||||||
|
&& !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand, itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SoundEffect bV() {
|
protected SoundEffect bV() {
|
||||||
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA);
|
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA);
|
||||||
|
@ -16,7 +16,11 @@ import net.citizensnpcs.npc.ai.NPCHolder;
|
|||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_11_R1.BlockPosition;
|
import net.minecraft.server.v1_11_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_11_R1.EntityCow;
|
import net.minecraft.server.v1_11_R1.EntityCow;
|
||||||
|
import net.minecraft.server.v1_11_R1.EntityHuman;
|
||||||
|
import net.minecraft.server.v1_11_R1.EnumHand;
|
||||||
import net.minecraft.server.v1_11_R1.IBlockData;
|
import net.minecraft.server.v1_11_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_11_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_11_R1.Items;
|
||||||
import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_11_R1.SoundEffect;
|
import net.minecraft.server.v1_11_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_11_R1.World;
|
import net.minecraft.server.v1_11_R1.World;
|
||||||
@ -79,6 +83,17 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
ItemStack itemstack = entityhuman.b(enumhand);
|
||||||
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SoundEffect bW() {
|
protected SoundEffect bW() {
|
||||||
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA);
|
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA);
|
||||||
|
@ -15,8 +15,12 @@ import net.citizensnpcs.npc.CitizensNPC;
|
|||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_11_R1.BlockPosition;
|
import net.minecraft.server.v1_11_R1.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_11_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_11_R1.EntityMushroomCow;
|
import net.minecraft.server.v1_11_R1.EntityMushroomCow;
|
||||||
|
import net.minecraft.server.v1_11_R1.EnumHand;
|
||||||
import net.minecraft.server.v1_11_R1.IBlockData;
|
import net.minecraft.server.v1_11_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_11_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_11_R1.Items;
|
||||||
import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_11_R1.SoundEffect;
|
import net.minecraft.server.v1_11_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_11_R1.World;
|
import net.minecraft.server.v1_11_R1.World;
|
||||||
@ -65,6 +69,17 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
ItemStack itemstack = entityhuman.b(enumhand);
|
||||||
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SoundEffect bW() {
|
protected SoundEffect bW() {
|
||||||
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA);
|
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA);
|
||||||
|
@ -17,7 +17,11 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.server.v1_12_R1.BlockPosition;
|
import net.minecraft.server.v1_12_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_12_R1.DamageSource;
|
import net.minecraft.server.v1_12_R1.DamageSource;
|
||||||
import net.minecraft.server.v1_12_R1.EntityCow;
|
import net.minecraft.server.v1_12_R1.EntityCow;
|
||||||
|
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||||
|
import net.minecraft.server.v1_12_R1.EnumHand;
|
||||||
import net.minecraft.server.v1_12_R1.IBlockData;
|
import net.minecraft.server.v1_12_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_12_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_12_R1.Items;
|
||||||
import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_12_R1.SoundEffect;
|
import net.minecraft.server.v1_12_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_12_R1.World;
|
import net.minecraft.server.v1_12_R1.World;
|
||||||
@ -80,6 +84,17 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
ItemStack itemstack = entityhuman.b(enumhand);
|
||||||
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void a(float f, float f1, float f2) {
|
public void a(float f, float f1, float f2) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
|
@ -16,8 +16,12 @@ import net.citizensnpcs.npc.ai.NPCHolder;
|
|||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_12_R1.BlockPosition;
|
import net.minecraft.server.v1_12_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_12_R1.DamageSource;
|
import net.minecraft.server.v1_12_R1.DamageSource;
|
||||||
|
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_12_R1.EntityMushroomCow;
|
import net.minecraft.server.v1_12_R1.EntityMushroomCow;
|
||||||
|
import net.minecraft.server.v1_12_R1.EnumHand;
|
||||||
import net.minecraft.server.v1_12_R1.IBlockData;
|
import net.minecraft.server.v1_12_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_12_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_12_R1.Items;
|
||||||
import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_12_R1.SoundEffect;
|
import net.minecraft.server.v1_12_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_12_R1.World;
|
import net.minecraft.server.v1_12_R1.World;
|
||||||
@ -66,6 +70,17 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
ItemStack itemstack = entityhuman.b(enumhand);
|
||||||
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void a(float f, float f1, float f2) {
|
public void a(float f, float f1, float f2) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
|
@ -17,7 +17,11 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||||
import net.minecraft.server.v1_13_R2.DamageSource;
|
import net.minecraft.server.v1_13_R2.DamageSource;
|
||||||
import net.minecraft.server.v1_13_R2.EntityCow;
|
import net.minecraft.server.v1_13_R2.EntityCow;
|
||||||
|
import net.minecraft.server.v1_13_R2.EntityHuman;
|
||||||
|
import net.minecraft.server.v1_13_R2.EnumHand;
|
||||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||||
|
import net.minecraft.server.v1_13_R2.ItemStack;
|
||||||
|
import net.minecraft.server.v1_13_R2.Items;
|
||||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||||
import net.minecraft.server.v1_13_R2.World;
|
import net.minecraft.server.v1_13_R2.World;
|
||||||
@ -80,6 +84,17 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
ItemStack itemstack = entityhuman.b(enumhand);
|
||||||
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void a(float f, float f1, float f2) {
|
public void a(float f, float f1, float f2) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
@ -90,8 +105,10 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SoundEffect cs() {
|
public void c(float f, float f1) {
|
||||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
if (npc == null || !npc.isFlyable()) {
|
||||||
|
super.c(f, f1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -104,6 +121,11 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SoundEffect cs() {
|
||||||
|
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SoundEffect d(DamageSource damagesource) {
|
protected SoundEffect d(DamageSource damagesource) {
|
||||||
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
|
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
|
||||||
@ -115,10 +137,8 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void c(float f, float f1) {
|
protected SoundEffect D() {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
||||||
super.c(f, f1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -156,11 +176,6 @@ public class CowController extends MobEntityController {
|
|||||||
// cancelled.
|
// cancelled.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected SoundEffect D() {
|
|
||||||
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CraftEntity getBukkitEntity() {
|
public CraftEntity getBukkitEntity() {
|
||||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||||
@ -174,6 +189,13 @@ public class CowController extends MobEntityController {
|
|||||||
return npc;
|
return npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void I() {
|
||||||
|
if (npc == null) {
|
||||||
|
super.I();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLeashed() {
|
public boolean isLeashed() {
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
@ -187,13 +209,6 @@ public class CowController extends MobEntityController {
|
|||||||
return false; // shouldLeash
|
return false; // shouldLeash
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void I() {
|
|
||||||
if (npc == null) {
|
|
||||||
super.I();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mobTick() {
|
public void mobTick() {
|
||||||
super.mobTick();
|
super.mobTick();
|
||||||
|
@ -16,8 +16,12 @@ import net.citizensnpcs.npc.ai.NPCHolder;
|
|||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||||
import net.minecraft.server.v1_13_R2.DamageSource;
|
import net.minecraft.server.v1_13_R2.DamageSource;
|
||||||
|
import net.minecraft.server.v1_13_R2.EntityHuman;
|
||||||
import net.minecraft.server.v1_13_R2.EntityMushroomCow;
|
import net.minecraft.server.v1_13_R2.EntityMushroomCow;
|
||||||
|
import net.minecraft.server.v1_13_R2.EnumHand;
|
||||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||||
|
import net.minecraft.server.v1_13_R2.ItemStack;
|
||||||
|
import net.minecraft.server.v1_13_R2.Items;
|
||||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||||
import net.minecraft.server.v1_13_R2.World;
|
import net.minecraft.server.v1_13_R2.World;
|
||||||
@ -66,6 +70,17 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
ItemStack itemstack = entityhuman.b(enumhand);
|
||||||
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void a(float f, float f1, float f2) {
|
public void a(float f, float f1, float f2) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
@ -76,8 +91,10 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SoundEffect cs() {
|
public void c(float f, float f1) {
|
||||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
if (npc == null || !npc.isFlyable()) {
|
||||||
|
super.c(f, f1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -89,6 +106,11 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SoundEffect cs() {
|
||||||
|
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SoundEffect d(DamageSource damagesource) {
|
protected SoundEffect d(DamageSource damagesource) {
|
||||||
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
|
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
|
||||||
@ -100,10 +122,8 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void c(float f, float f1) {
|
protected SoundEffect D() {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
||||||
super.c(f, f1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -141,11 +161,6 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
// cancelled.
|
// cancelled.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected SoundEffect D() {
|
|
||||||
return NMSImpl.getSoundEffect(npc, super.D(), NPC.AMBIENT_SOUND_METADATA);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CraftEntity getBukkitEntity() {
|
public CraftEntity getBukkitEntity() {
|
||||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||||
@ -159,6 +174,13 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
return npc;
|
return npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void I() {
|
||||||
|
if (npc == null) {
|
||||||
|
super.I();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLeashed() {
|
public boolean isLeashed() {
|
||||||
if (npc == null)
|
if (npc == null)
|
||||||
@ -172,13 +194,6 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
return false; // shouldLeash
|
return false; // shouldLeash
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void I() {
|
|
||||||
if (npc == null) {
|
|
||||||
super.I();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mobTick() {
|
public void mobTick() {
|
||||||
super.mobTick();
|
super.mobTick();
|
||||||
|
@ -18,8 +18,12 @@ import net.minecraft.server.v1_14_R1.BlockPosition;
|
|||||||
import net.minecraft.server.v1_14_R1.DamageSource;
|
import net.minecraft.server.v1_14_R1.DamageSource;
|
||||||
import net.minecraft.server.v1_14_R1.DataWatcherObject;
|
import net.minecraft.server.v1_14_R1.DataWatcherObject;
|
||||||
import net.minecraft.server.v1_14_R1.EntityCow;
|
import net.minecraft.server.v1_14_R1.EntityCow;
|
||||||
|
import net.minecraft.server.v1_14_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||||
|
import net.minecraft.server.v1_14_R1.EnumHand;
|
||||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_14_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_14_R1.Items;
|
||||||
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.Vec3D;
|
||||||
@ -82,6 +86,17 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
ItemStack itemstack = entityhuman.b(enumhand);
|
||||||
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
}
|
||||||
|
|
||||||
@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()) {
|
||||||
|
@ -17,9 +17,13 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.server.v1_14_R1.BlockPosition;
|
import net.minecraft.server.v1_14_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_14_R1.DamageSource;
|
import net.minecraft.server.v1_14_R1.DamageSource;
|
||||||
import net.minecraft.server.v1_14_R1.DataWatcherObject;
|
import net.minecraft.server.v1_14_R1.DataWatcherObject;
|
||||||
|
import net.minecraft.server.v1_14_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_14_R1.EntityMushroomCow;
|
import net.minecraft.server.v1_14_R1.EntityMushroomCow;
|
||||||
import net.minecraft.server.v1_14_R1.EntityTypes;
|
import net.minecraft.server.v1_14_R1.EntityTypes;
|
||||||
|
import net.minecraft.server.v1_14_R1.EnumHand;
|
||||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
import net.minecraft.server.v1_14_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_14_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_14_R1.Items;
|
||||||
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.Vec3D;
|
||||||
@ -38,7 +42,6 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
|
|
||||||
public static class EntityMushroomCowNPC extends EntityMushroomCow implements NPCHolder {
|
public static class EntityMushroomCowNPC extends EntityMushroomCow implements NPCHolder {
|
||||||
boolean calledNMSHeight = false;
|
boolean calledNMSHeight = false;
|
||||||
|
|
||||||
private final CitizensNPC npc;
|
private final CitizensNPC npc;
|
||||||
|
|
||||||
public EntityMushroomCowNPC(EntityTypes<? extends EntityMushroomCow> types, World world) {
|
public EntityMushroomCowNPC(EntityTypes<? extends EntityMushroomCow> types, World world) {
|
||||||
@ -71,6 +74,17 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
ItemStack itemstack = entityhuman.b(enumhand);
|
||||||
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
}
|
||||||
|
|
||||||
@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()) {
|
||||||
|
@ -18,8 +18,12 @@ import net.minecraft.server.v1_15_R1.BlockPosition;
|
|||||||
import net.minecraft.server.v1_15_R1.DamageSource;
|
import net.minecraft.server.v1_15_R1.DamageSource;
|
||||||
import net.minecraft.server.v1_15_R1.DataWatcherObject;
|
import net.minecraft.server.v1_15_R1.DataWatcherObject;
|
||||||
import net.minecraft.server.v1_15_R1.EntityCow;
|
import net.minecraft.server.v1_15_R1.EntityCow;
|
||||||
|
import net.minecraft.server.v1_15_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||||
|
import net.minecraft.server.v1_15_R1.EnumHand;
|
||||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_15_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_15_R1.Items;
|
||||||
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_15_R1.SoundEffect;
|
import net.minecraft.server.v1_15_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_15_R1.Vec3D;
|
import net.minecraft.server.v1_15_R1.Vec3D;
|
||||||
@ -82,6 +86,17 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
ItemStack itemstack = entityhuman.b(enumhand);
|
||||||
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean b(float f, float f1) {
|
public boolean b(float f, float f1) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
|
@ -17,9 +17,13 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_15_R1.DamageSource;
|
import net.minecraft.server.v1_15_R1.DamageSource;
|
||||||
import net.minecraft.server.v1_15_R1.DataWatcherObject;
|
import net.minecraft.server.v1_15_R1.DataWatcherObject;
|
||||||
|
import net.minecraft.server.v1_15_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_15_R1.EntityMushroomCow;
|
import net.minecraft.server.v1_15_R1.EntityMushroomCow;
|
||||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||||
|
import net.minecraft.server.v1_15_R1.EnumHand;
|
||||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_15_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_15_R1.Items;
|
||||||
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_15_R1.SoundEffect;
|
import net.minecraft.server.v1_15_R1.SoundEffect;
|
||||||
import net.minecraft.server.v1_15_R1.Vec3D;
|
import net.minecraft.server.v1_15_R1.Vec3D;
|
||||||
@ -38,7 +42,6 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
|
|
||||||
public static class EntityMushroomCowNPC extends EntityMushroomCow implements NPCHolder {
|
public static class EntityMushroomCowNPC extends EntityMushroomCow implements NPCHolder {
|
||||||
boolean calledNMSHeight = false;
|
boolean calledNMSHeight = false;
|
||||||
|
|
||||||
private final CitizensNPC npc;
|
private final CitizensNPC npc;
|
||||||
|
|
||||||
public EntityMushroomCowNPC(EntityTypes<? extends EntityMushroomCow> types, World world) {
|
public EntityMushroomCowNPC(EntityTypes<? extends EntityMushroomCow> types, World world) {
|
||||||
@ -71,6 +74,17 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
ItemStack itemstack = entityhuman.b(enumhand);
|
||||||
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman, enumhand);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean b(float f, float f1) {
|
public boolean b(float f, float f1) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
|
@ -17,6 +17,9 @@ import net.citizensnpcs.util.Util;
|
|||||||
import net.minecraft.server.v1_8_R3.Block;
|
import net.minecraft.server.v1_8_R3.Block;
|
||||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||||
import net.minecraft.server.v1_8_R3.EntityCow;
|
import net.minecraft.server.v1_8_R3.EntityCow;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||||
|
import net.minecraft.server.v1_8_R3.ItemStack;
|
||||||
|
import net.minecraft.server.v1_8_R3.Items;
|
||||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_8_R3.World;
|
import net.minecraft.server.v1_8_R3.World;
|
||||||
|
|
||||||
@ -78,6 +81,18 @@ public class CowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman);
|
||||||
|
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||||
|
if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild
|
||||||
|
&& !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String bo() {
|
protected String bo() {
|
||||||
return NMSImpl.getSoundEffect(npc, super.bo(), NPC.HURT_SOUND_METADATA);
|
return NMSImpl.getSoundEffect(npc, super.bo(), NPC.HURT_SOUND_METADATA);
|
||||||
|
@ -16,7 +16,10 @@ import net.citizensnpcs.npc.ai.NPCHolder;
|
|||||||
import net.citizensnpcs.util.Util;
|
import net.citizensnpcs.util.Util;
|
||||||
import net.minecraft.server.v1_8_R3.Block;
|
import net.minecraft.server.v1_8_R3.Block;
|
||||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||||
import net.minecraft.server.v1_8_R3.EntityMushroomCow;
|
import net.minecraft.server.v1_8_R3.EntityMushroomCow;
|
||||||
|
import net.minecraft.server.v1_8_R3.ItemStack;
|
||||||
|
import net.minecraft.server.v1_8_R3.Items;
|
||||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_8_R3.World;
|
import net.minecraft.server.v1_8_R3.World;
|
||||||
|
|
||||||
@ -64,6 +67,18 @@ public class MushroomCowController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean a(EntityHuman entityhuman) {
|
||||||
|
if (npc == null || !npc.isProtected())
|
||||||
|
return super.a(entityhuman);
|
||||||
|
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||||
|
if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild
|
||||||
|
&& !this.isBaby()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.a(entityhuman);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String bo() {
|
protected String bo() {
|
||||||
return NMSImpl.getSoundEffect(npc, super.bo(), NPC.HURT_SOUND_METADATA);
|
return NMSImpl.getSoundEffect(npc, super.bo(), NPC.HURT_SOUND_METADATA);
|
||||||
|
Loading…
Reference in New Issue
Block a user