Skip to content

Commit

Permalink
ported to 1.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke100000 committed Feb 19, 2023
1 parent f7a7ad9 commit 7b22d98
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion common/src/main/java/net/mca/client/SpeechManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void speak(String phrase, UUID sender) {
if (client.world != null && client.player != null) {
Collection<Identifier> keys = client.getSoundManager().getKeys();
if (keys.contains(sound)) {
EntityTrackingSoundInstance instance = new EntityTrackingSoundInstance(new SoundEvent(sound), SoundCategory.NEUTRAL, 1.0f, pitch, villager, threadSafeRandom.nextLong());
EntityTrackingSoundInstance instance = new EntityTrackingSoundInstance(SoundEvent.of(sound), SoundCategory.NEUTRAL, 1.0f, pitch, villager, threadSafeRandom.nextLong());
currentlyPlaying.put(sender, instance);
client.getSoundManager().play(instance);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.mca.mixin.client;

import com.mojang.authlib.GameProfile;
import net.mca.client.SpeechManager;
import net.minecraft.client.network.message.MessageHandler;
import net.minecraft.network.message.MessageType;
Expand All @@ -9,13 +10,10 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.UUID;

@Mixin(MessageHandler.class)
public class MixinMessageHandler {
@Inject(method = "onChatMessage(Lnet/minecraft/network/message/SignedMessage;Lnet/minecraft/network/message/MessageType$Parameters;)V", at = @At("TAIL"))
public void mca$onInit(SignedMessage message, MessageType.Parameters params, CallbackInfo ci) {
UUID sender = message.signedHeader().sender();
SpeechManager.INSTANCE.onChatMessage(message.getContent(), sender);
@Inject(method = "onChatMessage(Lnet/minecraft/network/message/SignedMessage;Lcom/mojang/authlib/GameProfile;Lnet/minecraft/network/message/MessageType$Parameters;)V", at = @At("TAIL"))
public void mca$onInit(SignedMessage message, GameProfile sender, MessageType.Parameters params, CallbackInfo ci) {
SpeechManager.INSTANCE.onChatMessage(message.getContent(), message.getSender());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import net.minecraft.client.toast.SystemToast;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.text.MutableText;
import net.minecraft.util.Hand;

public class ClientInteractionManagerImpl implements ClientInteractionManager {
Expand Down

0 comments on commit 7b22d98

Please sign in to comment.