#1100: Add methods to get sounds from entities

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot
2022-09-11 22:24:15 +10:00
parent 803175b864
commit d41367ee6d
7 changed files with 215 additions and 76 deletions

View File

@@ -81,7 +81,20 @@
}
@Override
@@ -453,16 +505,26 @@
@@ -364,6 +416,12 @@
return null;
}
+ // CraftBukkit start - Add delegate method
+ public SoundEffect getAmbientSound0() {
+ return getAmbientSound();
+ }
+ // CraftBukkit end
+
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -453,16 +511,26 @@
nbttagcompound.putBoolean("NoAI", this.isNoAi());
}
@@ -110,7 +123,7 @@
NBTTagList nbttaglist;
int i;
@@ -509,6 +571,11 @@
@@ -509,6 +577,11 @@
}
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
@@ -122,7 +135,7 @@
}
@Override
@@ -577,7 +644,7 @@
@@ -577,7 +650,7 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@@ -131,7 +144,7 @@
this.onItemPickup(entityitem);
this.take(entityitem, itemstack.getCount());
entityitem.discard();
@@ -586,15 +653,29 @@
@@ -586,15 +659,29 @@
}
public boolean equipItemIfPossible(ItemStack itemstack) {
@@ -162,7 +175,7 @@
}
this.setItemSlotAndDropWhenKilled(enumitemslot, itemstack);
@@ -732,6 +813,7 @@
@@ -732,6 +819,7 @@
@Override
protected final void serverAiStep() {
++this.noActionTime;
@@ -170,7 +183,7 @@
this.level.getProfiler().push("sensing");
this.sensing.tick();
this.level.getProfiler().pop();
@@ -1125,6 +1207,12 @@
@@ -1125,6 +1213,12 @@
if (!this.isAlive()) {
return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) {
@@ -183,7 +196,7 @@
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
} else {
@@ -1148,6 +1236,12 @@
@@ -1148,6 +1242,12 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
@@ -196,7 +209,7 @@
this.setLeashedTo(entityhuman, true);
itemstack.shrink(1);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
@@ -1163,7 +1257,7 @@
@@ -1163,7 +1263,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.level instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@@ -205,7 +218,7 @@
optional.ifPresent((entityinsentient) -> {
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
@@ -1213,12 +1307,19 @@
@@ -1213,12 +1313,19 @@
return this.restrictRadius != -1.0F;
}
@@ -226,7 +239,7 @@
t0.copyPosition(this);
t0.setBaby(this.isBaby());
@@ -1250,7 +1351,12 @@
@@ -1250,7 +1357,12 @@
}
}
@@ -240,7 +253,7 @@
if (this.isPassenger()) {
Entity entity = this.getVehicle();
@@ -1270,6 +1376,7 @@
@@ -1270,6 +1382,7 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@@ -248,7 +261,7 @@
this.dropLeash(true, true);
}
@@ -1281,7 +1388,9 @@
@@ -1281,7 +1394,9 @@
this.leashHolder = null;
this.leashInfoTag = null;
if (!this.level.isClientSide && flag1) {
@@ -258,7 +271,7 @@
}
if (!this.level.isClientSide && flag && this.level instanceof WorldServer) {
@@ -1331,6 +1440,7 @@
@@ -1331,6 +1446,7 @@
boolean flag1 = super.startRiding(entity, flag);
if (flag1 && this.isLeashed()) {
@@ -266,7 +279,7 @@
this.dropLeash(true, true);
}
@@ -1355,7 +1465,9 @@
@@ -1355,7 +1471,9 @@
}
if (this.tickCount > 100) {
@@ -276,7 +289,7 @@
this.leashInfoTag = null;
}
}
@@ -1432,7 +1544,14 @@
@@ -1432,7 +1550,14 @@
int i = EnchantmentManager.getFireAspect(this);
if (i > 0) {
@@ -292,7 +305,7 @@
}
boolean flag = entity.hurt(DamageSource.mobAttack(this), f);
@@ -1500,9 +1619,10 @@
@@ -1500,9 +1625,10 @@
@Override
protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions();