Skip to content

Commit fc4b817

Browse files
fix MC-188359 (#437)
* fix MC-188359 * add burp sound for drinking --------- Co-authored-by: Xander <xander@isxander.dev>
1 parent 0c823d6 commit fc4b817

4 files changed

Lines changed: 64 additions & 0 deletions

File tree

PATCHED.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
| Basic | [MC-165381](https://bugs.mojang.com/browse/MC-165381) | Block breaking can be delayed by dropping/throwing the tool while breaking a block | |
2626
| Basic | [MC-176559](https://bugs.mojang.com/browse/MC-176559) | Breaking process resets when a pickaxe enchanted with Mending mends by XP / Mending slows down breaking blocks again |
2727
| Basic | [MC-183776](https://bugs.mojang.com/browse/MC-183776) | After switching gamemodes using F3+F4, you need to press F3 twice to toggle the debug screen |
28+
| Basic | [MC-188359](https://bugs.mojang.com/browse/MC-188359) | Burp sound does not play after drinking or after eating cake |
2829
| Basic | [MC-187100](https://bugs.mojang.com/browse/MC-187100) | End crystals try to heal dying Ender dragons |
2930
| Basic | [MC-197260](https://bugs.mojang.com/browse/MC-197260) | Armor Stand renders itself and armor dark if its head is in a solid block |
3031
| Basic | [MC-210318](https://bugs.mojang.com/browse/MC-210318) | Maximum length of book title changed from 16 to 15 characters |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package dev.isxander.debugify.client.mixins.basic.mc188359;
2+
3+
import dev.isxander.debugify.fixes.BugFix;
4+
import dev.isxander.debugify.fixes.FixCategory;
5+
import net.minecraft.core.BlockPos;
6+
import net.minecraft.sounds.SoundEvents;
7+
import net.minecraft.sounds.SoundSource;
8+
import net.minecraft.util.Mth;
9+
import net.minecraft.world.InteractionResult;
10+
import net.minecraft.world.entity.player.Player;
11+
import net.minecraft.world.level.Level;
12+
import net.minecraft.world.level.block.CakeBlock;
13+
import net.minecraft.world.level.block.state.BlockState;
14+
import net.minecraft.world.phys.BlockHitResult;
15+
import org.spongepowered.asm.mixin.Mixin;
16+
import org.spongepowered.asm.mixin.injection.At;
17+
import org.spongepowered.asm.mixin.injection.Inject;
18+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
19+
20+
@BugFix(id = "MC-188359", category = FixCategory.BASIC, env = BugFix.Env.CLIENT, description = "Burp sound does not play after drinking or after eating cake")
21+
@Mixin(CakeBlock.class)
22+
public class CakeBlockMixin {
23+
@Inject(method = "useWithoutItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/CakeBlock;eat(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/entity/player/Player;)Lnet/minecraft/world/InteractionResult;", ordinal = 0))
24+
private void playBurpSound(BlockState blockState, Level level, BlockPos blockPos, Player player, BlockHitResult blockHitResult, CallbackInfoReturnable<InteractionResult> cir) {
25+
level.playLocalSound(player.getX() , player.getY(), player.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, Mth.randomBetween(player.getRandom(), 0.9F, 1.0F), false);
26+
}
27+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package dev.isxander.debugify.client.mixins.basic.mc188359;
2+
3+
import dev.isxander.debugify.fixes.BugFix;
4+
import dev.isxander.debugify.fixes.FixCategory;
5+
import net.minecraft.core.Holder;
6+
import net.minecraft.sounds.SoundEvent;
7+
import net.minecraft.sounds.SoundEvents;
8+
import net.minecraft.sounds.SoundSource;
9+
import net.minecraft.util.Mth;
10+
import net.minecraft.world.entity.LivingEntity;
11+
import net.minecraft.world.item.ItemStack;
12+
import net.minecraft.world.item.component.Consumable;
13+
import net.minecraft.world.level.Level;
14+
import org.spongepowered.asm.mixin.Final;
15+
import org.spongepowered.asm.mixin.Mixin;
16+
import org.spongepowered.asm.mixin.Shadow;
17+
import org.spongepowered.asm.mixin.injection.At;
18+
import org.spongepowered.asm.mixin.injection.Inject;
19+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
20+
21+
@BugFix(id = "MC-188359", category = FixCategory.BASIC, env = BugFix.Env.CLIENT, description = "Burp sound does not play after drinking or after eating cake")
22+
@Mixin(Consumable.class)
23+
public class ConsumableMixin {
24+
@Shadow
25+
@Final
26+
private Holder<SoundEvent> sound;
27+
28+
@Inject(method = "onConsume", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;consume(ILnet/minecraft/world/entity/LivingEntity;)V"))
29+
private void addBurpSound(Level level, LivingEntity livingEntity, ItemStack itemStack, CallbackInfoReturnable<ItemStack> cir) {
30+
if (this.sound.is(SoundEvents.GENERIC_DRINK) && livingEntity.isAlwaysTicking()) {
31+
level.playLocalSound(livingEntity.getX(), livingEntity.getY(), livingEntity.getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 0.5F, Mth.randomBetween(livingEntity.getRandom(), 0.9F, 1.0F), false);
32+
}
33+
}
34+
}

src/client/resources/debugify.client.mixins.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
],
5353
"mixins": [
5454
"basic.mc176559.ItemStackAccessor",
55+
"basic.mc188359.CakeBlockMixin",
56+
"basic.mc188359.ConsumableMixin",
5557
"basic.mc206540.EntityMixin",
5658
"basic.mc259512.LivingEntityMixin"
5759
]

0 commit comments

Comments
 (0)