Allow ITeleporter to override the vanilla teleport sound (#7682)

This commit is contained in:
Take Weiland authored and GitHub committed 2021-03-15 14:02:20 -07:00
1 parent 2a0d9e8dac
commit 7379e8b9a4
2 files changed
+19 -1

No files matched your search

@@ -56,7 +56,12 @@
this.field_71134_c.func_73080_a(p_241206_1_);
this.field_71135_a.func_147359_a(new SPlayerAbilitiesPacket(this.field_71075_bZ));
playerlist.func_72354_b(this, p_241206_1_);
@@ -670,6 +_,7 @@
@@ -666,10 +_,12 @@
this.field_71135_a.func_147359_a(new SPlayEntityEffectPacket(this.func_145782_y(), effectinstance));
}
+ if (teleporter.playTeleportSound(this, serverworld, p_241206_1_))
this.field_71135_a.func_147359_a(new SPlaySoundEventPacket(1032, BlockPos.field_177992_a, 0, false));
this.field_71144_ck = -1;
this.field_71149_ch = -1.0F;
this.field_71146_ci = -1;
@@ -91,4 +91,17 @@ public interface ITeleporter
{
return this.getClass() == Teleporter.class;
}
/**
* Called when vanilla wants to play the portal sound after teleporting. Return true to play the vanilla sound.
* @param player the player
* @param sourceWorld the source world
* @param destWorld the target world
* @return true to play the vanilla sound
*/
default boolean playTeleportSound(ServerPlayerEntity player, ServerWorld sourceWorld, ServerWorld destWorld)
{
return true;
}
}