mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 12:15:53 +01:00
Fix dropstrait, allow player hurt/death sound to be set
This commit is contained in:
parent
9906c44ff3
commit
36cbef81a7
@ -2285,7 +2285,7 @@ public class NPCCommands {
|
||||
min = 1,
|
||||
max = 1,
|
||||
permission = "citizens.npc.sound")
|
||||
@Requirements(selected = true, ownership = true, livingEntity = true, excludedTypes = { EntityType.PLAYER })
|
||||
@Requirements(selected = true, ownership = true, livingEntity = true)
|
||||
public void sound(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
|
||||
String ambientSound = npc.data().get(NPC.AMBIENT_SOUND_METADATA);
|
||||
String deathSound = npc.data().get(NPC.DEATH_SOUND_METADATA);
|
||||
|
@ -102,6 +102,9 @@ public class DropsTrait extends Trait {
|
||||
|
||||
@Override
|
||||
public void onClick(InventoryMenuSlot slot, InventoryClickEvent event) {
|
||||
if (slot.getCurrentItem() != null && slot.getCurrentItem().getType().name().equals("BARRIER"))
|
||||
return;
|
||||
event.setCancelled(false);
|
||||
if (event.getAction().name().contains("PICKUP")) {
|
||||
chances.remove(event.getSlot());
|
||||
} else if (event.getAction().name().contains("PLACE")) {
|
||||
|
@ -55,6 +55,7 @@ import net.minecraft.server.v1_10_R1.Packet;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_10_R1.PathType;
|
||||
import net.minecraft.server.v1_10_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_10_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_10_R1.WorldServer;
|
||||
|
||||
public class EntityHumanNPC extends EntityPlayer implements NPCHolder, SkinnableEntity {
|
||||
@ -107,6 +108,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
this.bz.put(pathtype, Float.valueOf(f));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect bV() {
|
||||
return NMSImpl.getSoundEffect(npc, super.bV(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect bW() {
|
||||
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_10_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
|
@ -57,6 +57,7 @@ import net.minecraft.server.v1_11_R1.Packet;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_11_R1.PathType;
|
||||
import net.minecraft.server.v1_11_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_11_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_11_R1.WorldServer;
|
||||
|
||||
public class EntityHumanNPC extends EntityPlayer implements NPCHolder, SkinnableEntity {
|
||||
@ -126,6 +127,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect bW() {
|
||||
return NMSImpl.getSoundEffect(npc, super.bW(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect bX() {
|
||||
return NMSImpl.getSoundEffect(npc, super.bX(), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_11_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
|
@ -61,6 +61,7 @@ import net.minecraft.server.v1_12_R1.Packet;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_12_R1.PathType;
|
||||
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_12_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_12_R1.WorldServer;
|
||||
|
||||
public class EntityHumanNPC extends EntityPlayer implements NPCHolder, SkinnableEntity {
|
||||
@ -139,6 +140,11 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect cf() {
|
||||
return NMSImpl.getSoundEffect(npc, super.cf(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_12_R1.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
@ -149,6 +155,11 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect d(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
// knock back velocity is cancelled and sent to client for handling when
|
||||
|
@ -61,6 +61,7 @@ import net.minecraft.server.v1_13_R2.Packet;
|
||||
import net.minecraft.server.v1_13_R2.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_13_R2.PathType;
|
||||
import net.minecraft.server.v1_13_R2.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_13_R2.SoundEffect;
|
||||
import net.minecraft.server.v1_13_R2.WorldServer;
|
||||
|
||||
public class EntityHumanNPC extends EntityPlayer implements NPCHolder, SkinnableEntity {
|
||||
@ -139,6 +140,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect cs() {
|
||||
return NMSImpl.getSoundEffect(npc, super.cs(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect d(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.d(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
// knock back velocity is cancelled and sent to client for handling when
|
||||
|
@ -59,6 +59,7 @@ import net.minecraft.server.v1_14_R1.Packet;
|
||||
import net.minecraft.server.v1_14_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_14_R1.PathType;
|
||||
import net.minecraft.server.v1_14_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_14_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_14_R1.Vec3D;
|
||||
import net.minecraft.server.v1_14_R1.WorldServer;
|
||||
|
||||
@ -246,6 +247,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
return skinTracker;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect getSoundDeath() {
|
||||
return NMSImpl.getSoundEffect(npc, super.getSoundDeath(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect getSoundHurt(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inBlock() {
|
||||
if (npc == null || noclip || isSleeping()) {
|
||||
|
@ -59,6 +59,7 @@ import net.minecraft.server.v1_15_R1.Packet;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_15_R1.PathType;
|
||||
import net.minecraft.server.v1_15_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_15_R1.SoundEffect;
|
||||
import net.minecraft.server.v1_15_R1.Vec3D;
|
||||
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||
|
||||
@ -239,6 +240,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
return skinTracker;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect getSoundDeath() {
|
||||
return NMSImpl.getSoundEffect(npc, super.getSoundDeath(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect getSoundHurt(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void h(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
|
@ -67,6 +67,7 @@ import net.minecraft.server.v1_16_R3.Packet;
|
||||
import net.minecraft.server.v1_16_R3.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_16_R3.PathType;
|
||||
import net.minecraft.server.v1_16_R3.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_16_R3.SoundEffect;
|
||||
import net.minecraft.server.v1_16_R3.Vec3D;
|
||||
import net.minecraft.server.v1_16_R3.WorldServer;
|
||||
|
||||
@ -252,6 +253,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
return skinTracker;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect getSoundDeath() {
|
||||
return NMSImpl.getSoundEffect(npc, super.getSoundDeath(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEffect getSoundHurt(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void i(double x, double y, double z) {
|
||||
Vector vector = Util.callPushEvent(npc, x, y, z);
|
||||
|
@ -55,6 +55,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ServerPlayerGameMode;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.stats.ServerStatsCounter;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@ -217,6 +218,16 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
return controllerJump;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound() {
|
||||
return NMSImpl.getSoundEffect(npc, super.getDeathSound(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.getHurtSound(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
public PlayerMoveControl getMoveControl() {
|
||||
return controllerMove;
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ServerPlayerGameMode;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.stats.ServerStatsCounter;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@ -218,6 +219,16 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
return controllerJump;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound() {
|
||||
return NMSImpl.getSoundEffect(npc, super.getDeathSound(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.getHurtSound(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
public PlayerMoveControl getMoveControl() {
|
||||
return controllerMove;
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.level.ServerPlayerGameMode;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.stats.ServerStatsCounter;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@ -220,6 +221,16 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
return controllerJump;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound() {
|
||||
return NMSImpl.getSoundEffect(npc, super.getDeathSound(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damagesource) {
|
||||
return NMSImpl.getSoundEffect(npc, super.getHurtSound(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
public PlayerMoveControl getMoveControl() {
|
||||
return controllerMove;
|
||||
}
|
||||
|
@ -103,6 +103,16 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
: !npc.isProtected();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String bo() {
|
||||
return NMSImpl.getSoundEffect(npc, super.bo(), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String bp() {
|
||||
return NMSImpl.getSoundEffect(npc, super.bp(), NPC.DEATH_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.v1_8_R3.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
|
Loading…
Reference in New Issue
Block a user