Added debugging messages
This commit is contained in:
parent
3d35f07720
commit
75c6204dd0
3 changed files with 41 additions and 2 deletions
|
@ -0,0 +1,40 @@
|
|||
package com.github.hhhzzzsss.songplayer.mixin;
|
||||
|
||||
import com.github.hhhzzzsss.songplayer.SongPlayer;
|
||||
import com.github.hhhzzzsss.songplayer.playing.SongHandler;
|
||||
import com.github.hhhzzzsss.songplayer.playing.Stage;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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(ClientWorld.class)
|
||||
public class ClientWorldMixin {
|
||||
@Inject(at = @At("HEAD"), method = "handleBlockUpdate(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)V", cancellable = true)
|
||||
public void onHandleBlockUpdate(BlockPos pos, BlockState state, int flags, CallbackInfo ci) {
|
||||
Stage stage = SongHandler.getInstance().stage;
|
||||
if (stage != null && !SongHandler.getInstance().building) {
|
||||
for (BlockPos nbp : stage.noteblockPositions.values()) {
|
||||
if (nbp.equals(pos)) {
|
||||
BlockState oldState = SongPlayer.MC.world.getBlockState(pos);
|
||||
if (oldState.equals(state))
|
||||
return;
|
||||
SongPlayer.addChatMessage(String.format("§7Block in stage changed from §2%s §7to §2%s", oldState.toString(), state.toString()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// public String getBlockString(BlockState state) {
|
||||
// Block block = state.getBlock();
|
||||
// if (block instanceof NoteBlock) {
|
||||
// NoteBlock block = (NoteBlock) block;
|
||||
// } else {
|
||||
// return state.toString();
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -188,8 +188,6 @@ public class Stage {
|
|||
|
||||
// Set total missing notes
|
||||
totalMissingNotes = missingNotes.size();
|
||||
|
||||
System.out.println(player.getEyeY());
|
||||
}
|
||||
|
||||
boolean withinBreakingDist(int dx, int dy, int dz) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"client": [
|
||||
"ClientPlayerEntityMixin",
|
||||
"ClientPlayNetworkHandlerMixin",
|
||||
"ClientWorldMixin",
|
||||
"InGameHudMixin",
|
||||
"MinecraftClientMixin"
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue