Fixed fake player skin
This commit is contained in:
parent
ecf2d35161
commit
c20acdd794
3 changed files with 48 additions and 3 deletions
|
@ -1,10 +1,12 @@
|
||||||
package com.github.hhhzzzsss.songplayer;
|
package com.github.hhhzzzsss.songplayer;
|
||||||
|
|
||||||
|
import com.github.hhhzzzsss.songplayer.mixin.ClientPlayNetworkHandlerAccessor;
|
||||||
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 com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.client.network.OtherClientPlayerEntity;
|
import net.minecraft.client.network.OtherClientPlayerEntity;
|
||||||
|
import net.minecraft.client.network.PlayerListEntry;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.EntityPose;
|
import net.minecraft.entity.EntityPose;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -12,11 +14,13 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class FakePlayerEntity extends OtherClientPlayerEntity {
|
public class FakePlayerEntity extends OtherClientPlayerEntity {
|
||||||
|
public static final UUID FAKE_PLAYER_UUID = UUID.randomUUID();
|
||||||
|
|
||||||
ClientPlayerEntity player = SongPlayer.MC.player;
|
ClientPlayerEntity player = SongPlayer.MC.player;
|
||||||
ClientWorld world = SongPlayer.MC.world;
|
ClientWorld world = SongPlayer.MC.world;
|
||||||
|
|
||||||
public FakePlayerEntity() {
|
public FakePlayerEntity() {
|
||||||
super(SongPlayer.MC.world, new GameProfile(UUID.randomUUID(), SongPlayer.MC.player.getGameProfile().getName()));
|
super(SongPlayer.MC.world, getProfile());
|
||||||
|
|
||||||
copyStagePosAndPlayerLook();
|
copyStagePosAndPlayerLook();
|
||||||
|
|
||||||
|
@ -54,4 +58,12 @@ public class FakePlayerEntity extends OtherClientPlayerEntity {
|
||||||
copyPositionAndRotation(player);
|
copyPositionAndRotation(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static GameProfile getProfile() {
|
||||||
|
GameProfile profile = new GameProfile(FAKE_PLAYER_UUID, SongPlayer.MC.player.getGameProfile().getName());
|
||||||
|
profile.getProperties().putAll(SongPlayer.MC.player.getGameProfile().getProperties());
|
||||||
|
PlayerListEntry playerListEntry = new PlayerListEntry(SongPlayer.MC.player.getGameProfile(), false);
|
||||||
|
((ClientPlayNetworkHandlerAccessor)SongPlayer.MC.getNetworkHandler()).getPlayerListEntries().put(FAKE_PLAYER_UUID, playerListEntry);
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.github.hhhzzzsss.songplayer.mixin;
|
||||||
|
|
||||||
|
import com.github.hhhzzzsss.songplayer.CommandProcessor;
|
||||||
|
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.network.ClientPlayNetworkHandler;
|
||||||
|
import net.minecraft.client.network.PlayerListEntry;
|
||||||
|
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 net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
|
||||||
|
import net.minecraft.network.packet.s2c.play.PlayerAbilitiesS2CPacket;
|
||||||
|
import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Mixin(ClientPlayNetworkHandler.class)
|
||||||
|
public interface ClientPlayNetworkHandlerAccessor {
|
||||||
|
@Accessor
|
||||||
|
Map<UUID, PlayerListEntry> getPlayerListEntries();
|
||||||
|
}
|
|
@ -6,9 +6,10 @@
|
||||||
"mixins": [
|
"mixins": [
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"ClientPlayNetworkHandlerMixin",
|
|
||||||
"ClientPlayerInteractionManagerAccessor",
|
|
||||||
"ChatInputSuggestorMixin",
|
"ChatInputSuggestorMixin",
|
||||||
|
"ClientPlayerInteractionManagerAccessor",
|
||||||
|
"ClientPlayNetworkHandlerAccessor",
|
||||||
|
"ClientPlayNetworkHandlerMixin",
|
||||||
"InGameHudMixin",
|
"InGameHudMixin",
|
||||||
"MinecraftClientMixin"
|
"MinecraftClientMixin"
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue