|
1 | 1 | package com.manwe.dsl.mixin.log; |
2 | 2 |
|
| 3 | +import net.minecraft.client.Minecraft; |
3 | 4 | import net.minecraft.client.multiplayer.ClientPacketListener; |
| 5 | +import net.minecraft.client.player.LocalPlayer; |
4 | 6 | import net.minecraft.network.protocol.game.*; |
| 7 | +import net.minecraft.server.level.ServerPlayer; |
| 8 | +import net.minecraft.world.entity.Entity; |
| 9 | +import net.minecraft.world.entity.player.Player; |
5 | 10 | import org.checkerframework.checker.units.qual.A; |
6 | 11 | import org.spongepowered.asm.mixin.Mixin; |
7 | 12 | import org.spongepowered.asm.mixin.injection.At; |
@@ -61,6 +66,8 @@ public void handleServerData(ClientboundServerDataPacket pPacket, CallbackInfo c |
61 | 66 | @Inject(method = "handlePlayerInfoUpdate",at = @At("HEAD")) |
62 | 67 | public void handlePlayerInfoUpdate(ClientboundPlayerInfoUpdatePacket pPacket, CallbackInfo ci){ |
63 | 68 | System.out.println("handlePlayerInfoUpdate"); |
| 69 | + pPacket.actions().forEach(action -> System.out.println(action)); |
| 70 | + |
64 | 71 | } |
65 | 72 | @Inject(method = "handleInitializeBorder",at = @At("HEAD")) |
66 | 73 | public void handleInitializeBorder(ClientboundInitializeBorderPacket pPacket, CallbackInfo ci){ |
@@ -96,14 +103,53 @@ public void handleSetHealth(ClientboundSetHealthPacket pPacket, CallbackInfo ci) |
96 | 103 | } |
97 | 104 | @Inject(method = "handleLevelChunkWithLight", at = @At("HEAD")) |
98 | 105 | public void handleLevelChunkWithLight(ClientboundLevelChunkWithLightPacket pPacket, CallbackInfo ci){ |
99 | | - System.out.println("handleLevelChunkWithLight"); |
| 106 | + System.out.printf("chunk %d,%d arrived (player %d,%d)%n", |
| 107 | + pPacket.getX(), pPacket.getZ(), |
| 108 | + Minecraft.getInstance().player.getBlockX() >> 4, |
| 109 | + Minecraft.getInstance().player.getBlockZ() >> 4); |
100 | 110 | } |
101 | 111 | @Inject(method = "handleChunkBatchFinished", at = @At("HEAD")) |
102 | 112 | public void handleChunkBatchFinished(ClientboundChunkBatchFinishedPacket pPacket, CallbackInfo ci){ |
103 | | - System.out.println("handleChunkBatchFinished"); |
| 113 | + System.out.println("handleChunkBatchFinished size: "+pPacket.batchSize()); |
104 | 114 | } |
105 | 115 | @Inject(method = "handleChunkBatchStart", at = @At("HEAD")) |
106 | 116 | public void handleChunkBatchStart(ClientboundChunkBatchStartPacket pPacket, CallbackInfo ci){ |
107 | 117 | System.out.println("handleChunkBatchStart"); |
108 | 118 | } |
| 119 | + |
| 120 | + @Inject(method = "handleForgetLevelChunk", at = @At("HEAD")) |
| 121 | + public void handleForgetLevelChunk(ClientboundForgetLevelChunkPacket pPacket, CallbackInfo ci){ |
| 122 | + System.out.printf("chunk %d,%d UNLOADED%n", pPacket.pos().x, pPacket.pos().z); |
| 123 | + } |
| 124 | + |
| 125 | + @Inject(method = "handleRemoveEntities", at = @At("HEAD")) |
| 126 | + public void handleRemoveEntities(ClientboundRemoveEntitiesPacket pPacket, CallbackInfo ci){ |
| 127 | + /* |
| 128 | + int me = Minecraft.getInstance().player.getId(); |
| 129 | + System.out.println("handleRemoveEntities player id " + me); |
| 130 | +
|
| 131 | + if(Minecraft.getInstance().level == null) { |
| 132 | + System.out.println("level == null"); |
| 133 | + } else { |
| 134 | + for(Integer id : pPacket.getEntityIds()){ |
| 135 | + Entity entity = ((ClientLevelInvoker) Minecraft.getInstance().level).invokeGetEntities().get(id); |
| 136 | + if(entity != null){ |
| 137 | + System.out.println("Removed entity: " + entity.getName().getString()); |
| 138 | + } else { |
| 139 | + System.out.println("Removed unknown with id: " +id); |
| 140 | + } |
| 141 | + } |
| 142 | + } |
| 143 | + */ |
| 144 | + } |
| 145 | + @Inject(method = "handleRespawn", at = @At("HEAD")) |
| 146 | + public void handleRespawn(ClientboundRespawnPacket pPacket, CallbackInfo ci){ |
| 147 | + System.out.println("handleRespawn"); |
| 148 | + } |
| 149 | + @Inject(method = "handlePlayerInfoRemove", at = @At("HEAD")) |
| 150 | + public void handlePlayerInfoRemove(ClientboundPlayerInfoRemovePacket pPacket, CallbackInfo ci){ |
| 151 | + System.out.println("handlePlayerInfoRemove UUIDS:"); |
| 152 | + pPacket.profileIds().forEach(System.out::println); |
| 153 | + } |
| 154 | + |
109 | 155 | } |
0 commit comments