1.20.2
This commit is contained in:
parent
1b3c83671f
commit
fe92fae94f
6 changed files with 55 additions and 41 deletions
|
@ -4,9 +4,9 @@ org.gradle.parallel=true
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version=1.20.1
|
minecraft_version=1.20.2
|
||||||
yarn_mappings=1.20.1+build.2
|
yarn_mappings=1.20.2+build.1
|
||||||
loader_version=0.14.21
|
loader_version=0.14.22
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 3.1.1
|
mod_version = 3.1.1
|
||||||
|
@ -15,4 +15,4 @@ org.gradle.parallel=true
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_version=0.83.1+1.20.1
|
fabric_version=0.89.2+1.20.2
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class FakePlayerEntity extends OtherClientPlayerEntity {
|
||||||
capeY = getY();
|
capeY = getY();
|
||||||
capeZ = getZ();
|
capeZ = getZ();
|
||||||
|
|
||||||
world.addEntity(getId(), this);
|
world.addEntity(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetPlayerPosition() {
|
public void resetPlayerPosition() {
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class SongItemConfirmationScreen extends Screen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
this.renderBackground(context);
|
this.renderBackground(context, mouseX, mouseY, delta);
|
||||||
|
|
||||||
context.drawCenteredTextWithShadow(textRenderer, this.title, this.width / 2, 40, 0xFFFFFF);
|
context.drawCenteredTextWithShadow(textRenderer, this.title, this.width / 2, 40, 0xFFFFFF);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.github.hhhzzzsss.songplayer.mixin;
|
||||||
|
|
||||||
|
import com.github.hhhzzzsss.songplayer.Config;
|
||||||
|
import com.github.hhhzzzsss.songplayer.SongPlayer;
|
||||||
|
import com.github.hhhzzzsss.songplayer.playing.SongHandler;
|
||||||
|
import com.github.hhhzzzsss.songplayer.playing.Stage;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.entity.EntityPose;
|
||||||
|
import net.minecraft.network.ClientConnection;
|
||||||
|
import net.minecraft.network.packet.Packet;
|
||||||
|
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;
|
||||||
|
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(ClientConnection.class)
|
||||||
|
public class ClientConnectionMixin {
|
||||||
|
@Inject(at = @At("HEAD"), method = "send(Lnet/minecraft/network/packet/Packet;)V", cancellable = true)
|
||||||
|
private void sendPacket(Packet<?> packet, CallbackInfo ci) {
|
||||||
|
Stage stage = SongHandler.getInstance().stage;
|
||||||
|
|
||||||
|
if (stage != null && packet instanceof PlayerMoveC2SPacket) {
|
||||||
|
if (!Config.getConfig().rotate) {
|
||||||
|
MinecraftClient.getInstance().getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.Full(stage.position.getX() + 0.5, stage.position.getY(), stage.position.getZ() + 0.5, SongPlayer.MC.player.getYaw(), SongPlayer.MC.player.getPitch(), true));
|
||||||
|
if (SongPlayer.fakePlayer != null) {
|
||||||
|
SongPlayer.fakePlayer.copyStagePosAndPlayerLook();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
else if (packet instanceof ClientCommandC2SPacket) {
|
||||||
|
ClientCommandC2SPacket.Mode mode = ((ClientCommandC2SPacket) packet).getMode();
|
||||||
|
if (SongPlayer.fakePlayer != null) {
|
||||||
|
if (mode == ClientCommandC2SPacket.Mode.PRESS_SHIFT_KEY) {
|
||||||
|
SongPlayer.fakePlayer.setSneaking(true);
|
||||||
|
SongPlayer.fakePlayer.setPose(EntityPose.CROUCHING);
|
||||||
|
}
|
||||||
|
else if (mode == ClientCommandC2SPacket.Mode.RELEASE_SHIFT_KEY) {
|
||||||
|
SongPlayer.fakePlayer.setSneaking(false);
|
||||||
|
SongPlayer.fakePlayer.setPose(EntityPose.STANDING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import com.github.hhhzzzsss.songplayer.Config;
|
||||||
import com.github.hhhzzzsss.songplayer.SongPlayer;
|
import com.github.hhhzzzsss.songplayer.SongPlayer;
|
||||||
import com.github.hhhzzzsss.songplayer.playing.SongHandler;
|
import com.github.hhhzzzsss.songplayer.playing.SongHandler;
|
||||||
import com.github.hhhzzzsss.songplayer.playing.Stage;
|
import com.github.hhhzzzsss.songplayer.playing.Stage;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
import net.minecraft.entity.EntityPose;
|
import net.minecraft.entity.EntityPose;
|
||||||
import net.minecraft.network.ClientConnection;
|
import net.minecraft.network.ClientConnection;
|
||||||
|
@ -23,41 +24,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(ClientPlayNetworkHandler.class)
|
@Mixin(ClientPlayNetworkHandler.class)
|
||||||
public class ClientPlayNetworkHandlerMixin {
|
public class ClientPlayNetworkHandlerMixin {
|
||||||
@Shadow
|
|
||||||
private final ClientConnection connection;
|
|
||||||
|
|
||||||
public ClientPlayNetworkHandlerMixin() {
|
|
||||||
connection = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", cancellable = true)
|
|
||||||
private void onSendPacket(Packet<?> packet, CallbackInfo ci) {
|
|
||||||
Stage stage = SongHandler.getInstance().stage;
|
|
||||||
|
|
||||||
if (stage != null && packet instanceof PlayerMoveC2SPacket) {
|
|
||||||
if (!Config.getConfig().rotate) {
|
|
||||||
connection.send(new PlayerMoveC2SPacket.Full(stage.position.getX() + 0.5, stage.position.getY(), stage.position.getZ() + 0.5, SongPlayer.MC.player.getYaw(), SongPlayer.MC.player.getPitch(), true));
|
|
||||||
if (SongPlayer.fakePlayer != null) {
|
|
||||||
SongPlayer.fakePlayer.copyStagePosAndPlayerLook();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
else if (packet instanceof ClientCommandC2SPacket) {
|
|
||||||
ClientCommandC2SPacket.Mode mode = ((ClientCommandC2SPacket) packet).getMode();
|
|
||||||
if (SongPlayer.fakePlayer != null) {
|
|
||||||
if (mode == ClientCommandC2SPacket.Mode.PRESS_SHIFT_KEY) {
|
|
||||||
SongPlayer.fakePlayer.setSneaking(true);
|
|
||||||
SongPlayer.fakePlayer.setPose(EntityPose.CROUCHING);
|
|
||||||
}
|
|
||||||
else if (mode == ClientCommandC2SPacket.Mode.RELEASE_SHIFT_KEY) {
|
|
||||||
SongPlayer.fakePlayer.setSneaking(false);
|
|
||||||
SongPlayer.fakePlayer.setPose(EntityPose.STANDING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "sendChatMessage(Ljava/lang/String;)V", cancellable=true)
|
@Inject(at = @At("HEAD"), method = "sendChatMessage(Ljava/lang/String;)V", cancellable=true)
|
||||||
private void onSendChatMessage(String content, CallbackInfo ci) {
|
private void onSendChatMessage(String content, CallbackInfo ci) {
|
||||||
boolean isCommand = CommandProcessor.processChatMessage(content);
|
boolean isCommand = CommandProcessor.processChatMessage(content);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"ClientPlayerInteractionManagerAccessor",
|
"ClientPlayerInteractionManagerAccessor",
|
||||||
"ClientPlayNetworkHandlerAccessor",
|
"ClientPlayNetworkHandlerAccessor",
|
||||||
"ClientPlayNetworkHandlerMixin",
|
"ClientPlayNetworkHandlerMixin",
|
||||||
|
"ClientConnectionMixin",
|
||||||
"InGameHudMixin",
|
"InGameHudMixin",
|
||||||
"MinecraftClientMixin"
|
"MinecraftClientMixin"
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue