diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$Command.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$Command.class index f24c1db..8073122 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$Command.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$Command.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$currentCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$currentCommand.class index daf6d7d..37a3f70 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$currentCommand.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$currentCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$gotoCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$gotoCommand.class index 9a7efc8..744652e 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$gotoCommand.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$gotoCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$helpCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$helpCommand.class index a809002..e5e6845 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$helpCommand.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$helpCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$loopCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$loopCommand.class index b7b4e78..7d05177 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$loopCommand.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$loopCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$playCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$playCommand.class index 9e41bbc..6ffd296 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$playCommand.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$playCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$playurlCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$playurlCommand.class index 44d22d9..b3b51ef 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$playurlCommand.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$playurlCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$setCreativeCommandCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$setCreativeCommandCommand.class index 519978b..e7678a4 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$setCreativeCommandCommand.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$setCreativeCommandCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$setSurvivalCommandCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$setSurvivalCommandCommand.class index bdbfb6f..3cf1e8f 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$setSurvivalCommandCommand.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$setSurvivalCommandCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$songsCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$songsCommand.class index 3416b45..95fe6df 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$songsCommand.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$songsCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$stopCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$stopCommand.class index e7f87e5..32a11ba 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$stopCommand.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$stopCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$toggleFakePlayerCommand.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$toggleFakePlayerCommand.class new file mode 100644 index 0000000..dfb4633 Binary files /dev/null and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor$toggleFakePlayerCommand.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor.class index 9c453a9..b9abd75 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/CommandProcessor.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/FakePlayerEntity.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/FakePlayerEntity.class index 5f0e0cf..97084df 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/FakePlayerEntity.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/FakePlayerEntity.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/SongPlayer$Mode.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/SongPlayer$Mode.class index 0228840..3c4f2c9 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/SongPlayer$Mode.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/SongPlayer$Mode.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/SongPlayer.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/SongPlayer.class index 2aa97c7..58f79bd 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/SongPlayer.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/SongPlayer.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/mixin/ClientPlayNetworkHandlerMixin.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/mixin/ClientPlayNetworkHandlerMixin.class index 6b92e85..66e88af 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/mixin/ClientPlayNetworkHandlerMixin.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/mixin/ClientPlayNetworkHandlerMixin.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/noteblocks/BuildingThread.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/noteblocks/BuildingThread.class index 23340e7..6a32ba1 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/noteblocks/BuildingThread.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/noteblocks/BuildingThread.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/noteblocks/PlayingThread.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/noteblocks/PlayingThread.class index bc66f2d..5fa447b 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/noteblocks/PlayingThread.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/noteblocks/PlayingThread.class differ diff --git a/build/classes/java/main/com/github/hhhzzzsss/songplayer/song/Song.class b/build/classes/java/main/com/github/hhhzzzsss/songplayer/song/Song.class index 11de1e7..b07ccfe 100644 Binary files a/build/classes/java/main/com/github/hhhzzzsss/songplayer/song/Song.class and b/build/classes/java/main/com/github/hhhzzzsss/songplayer/song/Song.class differ diff --git a/build/libs/song-player-1.0.0-dev.jar b/build/libs/song-player-1.0.0-dev.jar index 5c378b9..c2c3fa8 100644 Binary files a/build/libs/song-player-1.0.0-dev.jar and b/build/libs/song-player-1.0.0-dev.jar differ diff --git a/build/libs/song-player-1.0.0-sources-dev.jar b/build/libs/song-player-1.0.0-sources-dev.jar index 91e7326..016487f 100644 Binary files a/build/libs/song-player-1.0.0-sources-dev.jar and b/build/libs/song-player-1.0.0-sources-dev.jar differ diff --git a/build/libs/song-player-1.0.0-sources.jar b/build/libs/song-player-1.0.0-sources.jar index 9894be5..72bf674 100644 Binary files a/build/libs/song-player-1.0.0-sources.jar and b/build/libs/song-player-1.0.0-sources.jar differ diff --git a/build/libs/song-player-1.0.0.jar b/build/libs/song-player-1.0.0.jar index 4a43056..93a763a 100644 Binary files a/build/libs/song-player-1.0.0.jar and b/build/libs/song-player-1.0.0.jar differ diff --git a/build/tmp/compileJava/source-classes-mapping.txt b/build/tmp/compileJava/source-classes-mapping.txt index 5b5b120..dc450f0 100644 --- a/build/tmp/compileJava/source-classes-mapping.txt +++ b/build/tmp/compileJava/source-classes-mapping.txt @@ -36,6 +36,7 @@ com/github/hhhzzzsss/songplayer/CommandProcessor.java com.github.hhhzzzsss.songplayer.CommandProcessor$setSurvivalCommandCommand com.github.hhhzzzsss.songplayer.CommandProcessor$songsCommand com.github.hhhzzzsss.songplayer.CommandProcessor$stopCommand + com.github.hhhzzzsss.songplayer.CommandProcessor$toggleFakePlayerCommand com/github/hhhzzzsss/songplayer/mixin/ClientPlayNetworkHandlerMixin.java com.github.hhhzzzsss.songplayer.mixin.ClientPlayNetworkHandlerMixin com/github/hhhzzzsss/songplayer/noteblocks/PlayingThread.java diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java b/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java index 04d5201..5d276a4 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/CommandProcessor.java @@ -26,6 +26,7 @@ public class CommandProcessor { commands.add(new songsCommand()); commands.add(new setCreativeCommandCommand()); commands.add(new setSurvivalCommandCommand()); + commands.add(new toggleFakePlayerCommand()); } // returns true if it is a command and should be cancelled @@ -176,6 +177,10 @@ public class CommandProcessor { return true; } if (args.length() == 0) { + if (SongPlayer.fakePlayer != null) { + SongPlayer.fakePlayer.remove(); + SongPlayer.fakePlayer = null; + } SongPlayer.stage.movePlayerToStagePosition(); SongPlayer.mode = Mode.IDLE; SongPlayer.song.loop = false; @@ -330,7 +335,7 @@ public class CommandProcessor { public boolean processCommand(String args) { if (args.length() > 0) { SongPlayer.creativeCommand = args; - SongPlayer.addChatMessage("Set creative command to " + SongPlayer.creativeCommand); + SongPlayer.addChatMessage("§6Set creative command to " + SongPlayer.creativeCommand); return true; } else { @@ -352,7 +357,7 @@ public class CommandProcessor { public boolean processCommand(String args) { if (args.length() > 0) { SongPlayer.survivalCommand = args; - SongPlayer.addChatMessage("Set survival command to " + SongPlayer.survivalCommand); + SongPlayer.addChatMessage("§6Set survival command to " + SongPlayer.survivalCommand); return true; } else { @@ -360,4 +365,40 @@ public class CommandProcessor { } } } + + private static class toggleFakePlayerCommand extends Command { + public String getName() { + return "toggleFakePlayer"; + } + public String getSyntax() { + return "$toggleFakePlayer"; + } + public String getDescription() { + return "Shows a fake player representing your true position when playing songs"; + } + public boolean processCommand(String args) { + if (args.length() == 0) { + SongPlayer.showFakePlayer = !SongPlayer.showFakePlayer; + if (SongPlayer.showFakePlayer) { + if (SongPlayer.mode == Mode.PLAYING || SongPlayer.mode == Mode.BUILDING) { + if (SongPlayer.fakePlayer != null) { + SongPlayer.fakePlayer.remove(); + } + SongPlayer.fakePlayer = new FakePlayerEntity(); + } + SongPlayer.addChatMessage("§6Enabled fake player"); + } + else { + if (SongPlayer.fakePlayer != null) { + SongPlayer.fakePlayer.remove(); + } + SongPlayer.addChatMessage("§6Disabled fake player"); + } + return true; + } + else { + return false; + } + } + } } diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/FakePlayerEntity.java b/src/main/java/com/github/hhhzzzsss/songplayer/FakePlayerEntity.java index 590b37d..065a8ad 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/FakePlayerEntity.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/FakePlayerEntity.java @@ -12,7 +12,7 @@ public class FakePlayerEntity extends OtherClientPlayerEntity { public FakePlayerEntity() { super(SongPlayer.MC.world, SongPlayer.MC.player.getGameProfile()); - copyPositionAndRotation(player); + copyStagePosAndPlayerLook(); inventory.clone(player.inventory); @@ -32,4 +32,15 @@ public class FakePlayerEntity extends OtherClientPlayerEntity { public void resetPlayerPosition() { player.refreshPositionAndAngles(getX(), getY(), getZ(), yaw, pitch); } + + public void copyStagePosAndPlayerLook() { + if (SongPlayer.stage != null) { + refreshPositionAndAngles(SongPlayer.stage.position.getX()+0.5, SongPlayer.stage.position.getY(), SongPlayer.stage.position.getZ()+0.5, player.yaw, player.pitch); + headYaw = player.headYaw; + bodyYaw = player.bodyYaw; + } + else { + copyPositionAndRotation(player); + } + } } diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/SongPlayer.java b/src/main/java/com/github/hhhzzzsss/songplayer/SongPlayer.java index 2d42673..010f911 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/SongPlayer.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/SongPlayer.java @@ -17,6 +17,8 @@ public class SongPlayer implements ModInitializer { public static final File SONG_DIR = new File("songs"); public static Song song; public static Stage stage; + public static boolean showFakePlayer = false; + public static FakePlayerEntity fakePlayer; public static String creativeCommand = "/gmc"; public static String survivalCommand = "/gms"; diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/com/github/hhhzzzsss/songplayer/mixin/ClientPlayNetworkHandlerMixin.java index c7c760a..a2595db 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/mixin/ClientPlayNetworkHandlerMixin.java @@ -31,6 +31,9 @@ public class ClientPlayNetworkHandlerMixin { }*/ if (SongPlayer.mode != SongPlayer.Mode.IDLE && packet instanceof PlayerMoveC2SPacket) { connection.send(new PlayerMoveC2SPacket.Both(SongPlayer.stage.position.getX()+0.5, SongPlayer.stage.position.getY(), SongPlayer.stage.position.getZ()+0.5, SongPlayer.MC.player.yaw, SongPlayer.MC.player.pitch, true)); + if (SongPlayer.fakePlayer != null) { + SongPlayer.fakePlayer.copyStagePosAndPlayerLook(); + } ci.cancel(); } } diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/noteblocks/BuildingThread.java b/src/main/java/com/github/hhhzzzsss/songplayer/noteblocks/BuildingThread.java index ca5f172..74cdf8b 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/noteblocks/BuildingThread.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/noteblocks/BuildingThread.java @@ -2,6 +2,7 @@ package com.github.hhhzzzsss.songplayer.noteblocks; import java.util.ArrayList; +import com.github.hhhzzzsss.songplayer.FakePlayerEntity; import com.github.hhhzzzsss.songplayer.SongPlayer; import com.github.hhhzzzsss.songplayer.song.Song; @@ -91,6 +92,12 @@ public class BuildingThread extends Thread { player.abilities.allowFlying = true; player.abilities.flying = true; SongPlayer.stage.movePlayerToStagePosition(); + if (SongPlayer.showFakePlayer) { + if (SongPlayer.fakePlayer != null) { + SongPlayer.fakePlayer.remove(); + } + SongPlayer.fakePlayer = new FakePlayerEntity(); + } for (int dy : new int[] {0,1,3}) { for (int dx = -4; dx <= 4; dx++) { diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/noteblocks/PlayingThread.java b/src/main/java/com/github/hhhzzzsss/songplayer/noteblocks/PlayingThread.java index 7f4da32..5f212a2 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/noteblocks/PlayingThread.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/noteblocks/PlayingThread.java @@ -85,6 +85,10 @@ public class PlayingThread extends Thread{ player.abilities.allowFlying = true; player.abilities.flying = true; SongPlayer.stage.movePlayerToStagePosition(); + if (SongPlayer.fakePlayer != null) { + SongPlayer.fakePlayer.remove(); + SongPlayer.fakePlayer = null; + } SongPlayer.addChatMessage("§6Finished playing."); SongPlayer.mode = SongPlayer.Mode.IDLE; diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/song/Song.java b/src/main/java/com/github/hhhzzzsss/songplayer/song/Song.java index ce91e45..2be99b4 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/song/Song.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/song/Song.java @@ -46,7 +46,6 @@ public class Song { } if (!songPath.exists()) { songPath = new File(SongPlayer.SONG_DIR, file + ".mid"); - System.out.println(file + ".mid"); } if (!songPath.exists()) { songPath = new File(SongPlayer.SONG_DIR, file + ".midi"); @@ -55,9 +54,6 @@ public class Song { boolean isMidi = false; String extension = getExtension(songPath); if (extension.equalsIgnoreCase("mid") || extension.equalsIgnoreCase("midi")) isMidi = true; - System.out.println(songPath.getName()); - System.out.println(extension); - System.out.println(isMidi); if (isMidi) { BufferedInputStream bis = new BufferedInputStream(new FileInputStream(songPath)); song.notes.clear();