Added emote cancel (shift)
This commit is contained in:
@@ -206,4 +206,16 @@ public class Auth {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void cancelEmote() {
|
||||||
|
String uuid = SaturnClient.client.player.getUuidAsString().replace("-", "");
|
||||||
|
for (Map.Entry<String, String> player : playerNames.entrySet()) {
|
||||||
|
if (players.containsKey(player.getValue()) && !player.getValue().equals(uuid)) {
|
||||||
|
SaturnClient.client.player.networkHandler
|
||||||
|
.sendChatCommand("msg " + player.getKey() + " "
|
||||||
|
+ "$SATURN_CANCEL_EMOTE&@"+uuid+"&@ if you are seeing this as a player, please report this to https://github.com/saturnclientmc/saturnclient/issues");
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import net.minecraft.client.option.KeyBinding;
|
|||||||
import net.minecraft.client.util.InputUtil;
|
import net.minecraft.client.util.InputUtil;
|
||||||
|
|
||||||
import org.saturnclient.saturnclient.SaturnClient;
|
import org.saturnclient.saturnclient.SaturnClient;
|
||||||
|
import org.saturnclient.saturnclient.auth.Auth;
|
||||||
import org.saturnclient.ui2.screens.EmoteWheel;
|
import org.saturnclient.ui2.screens.EmoteWheel;
|
||||||
import org.saturnclient.ui2.screens.ShiftMenu;
|
import org.saturnclient.ui2.screens.ShiftMenu;
|
||||||
|
|
||||||
@@ -53,7 +54,10 @@ public class KeyInputHandler {
|
|||||||
|
|
||||||
if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) {
|
if (SaturnClient.client.player != null && SaturnClient.client.player.isSneaking()) {
|
||||||
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player);
|
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(SaturnClient.client.player);
|
||||||
animationStack.removeLayer(1000);
|
if (animationStack.isActive() && animationStack.getPriority() == 1000) {
|
||||||
|
animationStack.removeLayer(1000);
|
||||||
|
Auth.cancelEmote();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,24 +24,39 @@ public class SaturnReload {
|
|||||||
@Inject(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", at = @At("HEAD"), cancellable = true)
|
||||||
public void onAddMessage(Text message, @Nullable MessageSignatureData signatureData,
|
public void onAddMessage(Text message, @Nullable MessageSignatureData signatureData,
|
||||||
@Nullable MessageIndicator indicator, CallbackInfo ci) {
|
@Nullable MessageIndicator indicator, CallbackInfo ci) {
|
||||||
String msg = message.toString();
|
try {
|
||||||
if (msg.contains("$SATURN_RELOAD")) {
|
String msg = message.toString();
|
||||||
for (Map.Entry<String, String> player : Auth.playerNames.entrySet()) {
|
if (msg.contains("$SATURN_RELOAD")) {
|
||||||
String name = player.getKey();
|
for (Map.Entry<String, String> player : Auth.playerNames.entrySet()) {
|
||||||
if (msg.contains(name)) {
|
String name = player.getKey();
|
||||||
Auth.player(name, player.getValue());
|
if (msg.contains(name)) {
|
||||||
|
Auth.player(name, player.getValue());
|
||||||
|
}
|
||||||
|
ci.cancel();
|
||||||
}
|
}
|
||||||
ci.cancel();
|
} else if (msg.contains("$SATURN_EMOTE")) {
|
||||||
|
String[] args = msg.split("&@");
|
||||||
|
for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) {
|
||||||
|
if (player.getUuidAsString().replace("-", "").equals(args[1])) {
|
||||||
|
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player);
|
||||||
|
animationStack.addAnimLayer(1000, PlayerAnimationRegistry.getAnimation(Identifier.of("saturnclient", args[2])).playAnimation());
|
||||||
|
ci.cancel();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (msg.contains("$SATURN_CANCEL_EMOTE")) {
|
||||||
|
String[] args = msg.split("&@");
|
||||||
|
for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) {
|
||||||
|
if (player.getUuidAsString().replace("-", "").equals(args[1])) {
|
||||||
|
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player);
|
||||||
|
animationStack.removeLayer(1000);
|
||||||
|
ci.cancel();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (msg.contains("$SATURN_EMOTE")) {
|
} catch (Exception e) {
|
||||||
String[] args = msg.split("&@");
|
e.printStackTrace();
|
||||||
for (AbstractClientPlayerEntity player : SaturnClient.client.world.getPlayers()) {
|
|
||||||
if (player.getUuidAsString().replace("-", "").equals(args[1])) {
|
|
||||||
AnimationStack animationStack = PlayerAnimationAccess.getPlayerAnimLayer(player);
|
|
||||||
animationStack.addAnimLayer(1000, PlayerAnimationRegistry.getAnimation(Identifier.of("saturnclient", args[2])).playAnimation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ci.cancel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user