001 package net.minecraft.network.packet; 002 003 import net.minecraft.entity.player.EntityPlayer; 004 005 public abstract class NetHandler 006 { 007 /** 008 * determine if it is a server handler 009 */ 010 public abstract boolean isServerHandler(); 011 012 /** 013 * Handle Packet51MapChunk (full chunk update of blocks, metadata, light levels, and optionally biome data) 014 */ 015 public void handleMapChunk(Packet51MapChunk par1Packet51MapChunk) {} 016 017 /** 018 * Default handler called for packets that don't have their own handlers in NetClientHandler; currentlly does 019 * nothing. 020 */ 021 public void unexpectedPacket(Packet par1Packet) {} 022 023 public void handleErrorMessage(String par1Str, Object[] par2ArrayOfObj) {} 024 025 public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect) 026 { 027 this.unexpectedPacket(par1Packet255KickDisconnect); 028 } 029 030 public void handleLogin(Packet1Login par1Packet1Login) 031 { 032 this.unexpectedPacket(par1Packet1Login); 033 } 034 035 public void handleFlying(Packet10Flying par1Packet10Flying) 036 { 037 this.unexpectedPacket(par1Packet10Flying); 038 } 039 040 public void handleMultiBlockChange(Packet52MultiBlockChange par1Packet52MultiBlockChange) 041 { 042 this.unexpectedPacket(par1Packet52MultiBlockChange); 043 } 044 045 public void handleBlockDig(Packet14BlockDig par1Packet14BlockDig) 046 { 047 this.unexpectedPacket(par1Packet14BlockDig); 048 } 049 050 public void handleBlockChange(Packet53BlockChange par1Packet53BlockChange) 051 { 052 this.unexpectedPacket(par1Packet53BlockChange); 053 } 054 055 public void handleNamedEntitySpawn(Packet20NamedEntitySpawn par1Packet20NamedEntitySpawn) 056 { 057 this.unexpectedPacket(par1Packet20NamedEntitySpawn); 058 } 059 060 public void handleEntity(Packet30Entity par1Packet30Entity) 061 { 062 this.unexpectedPacket(par1Packet30Entity); 063 } 064 065 public void handleEntityTeleport(Packet34EntityTeleport par1Packet34EntityTeleport) 066 { 067 this.unexpectedPacket(par1Packet34EntityTeleport); 068 } 069 070 public void handlePlace(Packet15Place par1Packet15Place) 071 { 072 this.unexpectedPacket(par1Packet15Place); 073 } 074 075 public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch) 076 { 077 this.unexpectedPacket(par1Packet16BlockItemSwitch); 078 } 079 080 public void handleDestroyEntity(Packet29DestroyEntity par1Packet29DestroyEntity) 081 { 082 this.unexpectedPacket(par1Packet29DestroyEntity); 083 } 084 085 public void handleCollect(Packet22Collect par1Packet22Collect) 086 { 087 this.unexpectedPacket(par1Packet22Collect); 088 } 089 090 public void handleChat(Packet3Chat par1Packet3Chat) 091 { 092 this.unexpectedPacket(par1Packet3Chat); 093 } 094 095 public void handleVehicleSpawn(Packet23VehicleSpawn par1Packet23VehicleSpawn) 096 { 097 this.unexpectedPacket(par1Packet23VehicleSpawn); 098 } 099 100 public void handleAnimation(Packet18Animation par1Packet18Animation) 101 { 102 this.unexpectedPacket(par1Packet18Animation); 103 } 104 105 /** 106 * runs registerPacket on the given Packet19EntityAction 107 */ 108 public void handleEntityAction(Packet19EntityAction par1Packet19EntityAction) 109 { 110 this.unexpectedPacket(par1Packet19EntityAction); 111 } 112 113 public void handleClientProtocol(Packet2ClientProtocol par1Packet2ClientProtocol) 114 { 115 this.unexpectedPacket(par1Packet2ClientProtocol); 116 } 117 118 public void handleServerAuthData(Packet253ServerAuthData par1Packet253ServerAuthData) 119 { 120 this.unexpectedPacket(par1Packet253ServerAuthData); 121 } 122 123 public void handleSharedKey(Packet252SharedKey par1Packet252SharedKey) 124 { 125 this.unexpectedPacket(par1Packet252SharedKey); 126 } 127 128 public void handleMobSpawn(Packet24MobSpawn par1Packet24MobSpawn) 129 { 130 this.unexpectedPacket(par1Packet24MobSpawn); 131 } 132 133 public void handleUpdateTime(Packet4UpdateTime par1Packet4UpdateTime) 134 { 135 this.unexpectedPacket(par1Packet4UpdateTime); 136 } 137 138 public void handleSpawnPosition(Packet6SpawnPosition par1Packet6SpawnPosition) 139 { 140 this.unexpectedPacket(par1Packet6SpawnPosition); 141 } 142 143 /** 144 * Packet handler 145 */ 146 public void handleEntityVelocity(Packet28EntityVelocity par1Packet28EntityVelocity) 147 { 148 this.unexpectedPacket(par1Packet28EntityVelocity); 149 } 150 151 /** 152 * Packet handler 153 */ 154 public void handleEntityMetadata(Packet40EntityMetadata par1Packet40EntityMetadata) 155 { 156 this.unexpectedPacket(par1Packet40EntityMetadata); 157 } 158 159 /** 160 * Packet handler 161 */ 162 public void handleAttachEntity(Packet39AttachEntity par1Packet39AttachEntity) 163 { 164 this.unexpectedPacket(par1Packet39AttachEntity); 165 } 166 167 public void handleUseEntity(Packet7UseEntity par1Packet7UseEntity) 168 { 169 this.unexpectedPacket(par1Packet7UseEntity); 170 } 171 172 /** 173 * Packet handler 174 */ 175 public void handleEntityStatus(Packet38EntityStatus par1Packet38EntityStatus) 176 { 177 this.unexpectedPacket(par1Packet38EntityStatus); 178 } 179 180 /** 181 * Recieves player health from the server and then proceeds to set it locally on the client. 182 */ 183 public void handleUpdateHealth(Packet8UpdateHealth par1Packet8UpdateHealth) 184 { 185 this.unexpectedPacket(par1Packet8UpdateHealth); 186 } 187 188 /** 189 * respawns the player 190 */ 191 public void handleRespawn(Packet9Respawn par1Packet9Respawn) 192 { 193 this.unexpectedPacket(par1Packet9Respawn); 194 } 195 196 public void handleExplosion(Packet60Explosion par1Packet60Explosion) 197 { 198 this.unexpectedPacket(par1Packet60Explosion); 199 } 200 201 public void handleOpenWindow(Packet100OpenWindow par1Packet100OpenWindow) 202 { 203 this.unexpectedPacket(par1Packet100OpenWindow); 204 } 205 206 public void handleCloseWindow(Packet101CloseWindow par1Packet101CloseWindow) 207 { 208 this.unexpectedPacket(par1Packet101CloseWindow); 209 } 210 211 public void handleWindowClick(Packet102WindowClick par1Packet102WindowClick) 212 { 213 this.unexpectedPacket(par1Packet102WindowClick); 214 } 215 216 public void handleSetSlot(Packet103SetSlot par1Packet103SetSlot) 217 { 218 this.unexpectedPacket(par1Packet103SetSlot); 219 } 220 221 public void handleWindowItems(Packet104WindowItems par1Packet104WindowItems) 222 { 223 this.unexpectedPacket(par1Packet104WindowItems); 224 } 225 226 /** 227 * Updates Client side signs 228 */ 229 public void handleUpdateSign(Packet130UpdateSign par1Packet130UpdateSign) 230 { 231 this.unexpectedPacket(par1Packet130UpdateSign); 232 } 233 234 public void handleUpdateProgressbar(Packet105UpdateProgressbar par1Packet105UpdateProgressbar) 235 { 236 this.unexpectedPacket(par1Packet105UpdateProgressbar); 237 } 238 239 public void handlePlayerInventory(Packet5PlayerInventory par1Packet5PlayerInventory) 240 { 241 this.unexpectedPacket(par1Packet5PlayerInventory); 242 } 243 244 public void handleTransaction(Packet106Transaction par1Packet106Transaction) 245 { 246 this.unexpectedPacket(par1Packet106Transaction); 247 } 248 249 /** 250 * Packet handler 251 */ 252 public void handleEntityPainting(Packet25EntityPainting par1Packet25EntityPainting) 253 { 254 this.unexpectedPacket(par1Packet25EntityPainting); 255 } 256 257 public void handleBlockEvent(Packet54PlayNoteBlock par1Packet54PlayNoteBlock) 258 { 259 this.unexpectedPacket(par1Packet54PlayNoteBlock); 260 } 261 262 /** 263 * Increment player statistics 264 */ 265 public void handleStatistic(Packet200Statistic par1Packet200Statistic) 266 { 267 this.unexpectedPacket(par1Packet200Statistic); 268 } 269 270 public void handleSleep(Packet17Sleep par1Packet17Sleep) 271 { 272 this.unexpectedPacket(par1Packet17Sleep); 273 } 274 275 public void handleGameEvent(Packet70GameEvent par1Packet70GameEvent) 276 { 277 this.unexpectedPacket(par1Packet70GameEvent); 278 } 279 280 /** 281 * Handles weather packet 282 */ 283 public void handleWeather(Packet71Weather par1Packet71Weather) 284 { 285 this.unexpectedPacket(par1Packet71Weather); 286 } 287 288 /** 289 * Contains logic for handling packets containing arbitrary unique item data. Currently this is only for maps. 290 */ 291 public void handleMapData(Packet131MapData par1Packet131MapData) 292 { 293 this.unexpectedPacket(par1Packet131MapData); 294 } 295 296 public void handleDoorChange(Packet61DoorChange par1Packet61DoorChange) 297 { 298 this.unexpectedPacket(par1Packet61DoorChange); 299 } 300 301 /** 302 * Handle a server ping packet. 303 */ 304 public void handleServerPing(Packet254ServerPing par1Packet254ServerPing) 305 { 306 this.unexpectedPacket(par1Packet254ServerPing); 307 } 308 309 /** 310 * Handle an entity effect packet. 311 */ 312 public void handleEntityEffect(Packet41EntityEffect par1Packet41EntityEffect) 313 { 314 this.unexpectedPacket(par1Packet41EntityEffect); 315 } 316 317 /** 318 * Handle a remove entity effect packet. 319 */ 320 public void handleRemoveEntityEffect(Packet42RemoveEntityEffect par1Packet42RemoveEntityEffect) 321 { 322 this.unexpectedPacket(par1Packet42RemoveEntityEffect); 323 } 324 325 /** 326 * Handle a player information packet. 327 */ 328 public void handlePlayerInfo(Packet201PlayerInfo par1Packet201PlayerInfo) 329 { 330 this.unexpectedPacket(par1Packet201PlayerInfo); 331 } 332 333 /** 334 * Handle a keep alive packet. 335 */ 336 public void handleKeepAlive(Packet0KeepAlive par1Packet0KeepAlive) 337 { 338 this.unexpectedPacket(par1Packet0KeepAlive); 339 } 340 341 /** 342 * Handle an experience packet. 343 */ 344 public void handleExperience(Packet43Experience par1Packet43Experience) 345 { 346 this.unexpectedPacket(par1Packet43Experience); 347 } 348 349 /** 350 * Handle a creative slot packet. 351 */ 352 public void handleCreativeSetSlot(Packet107CreativeSetSlot par1Packet107CreativeSetSlot) 353 { 354 this.unexpectedPacket(par1Packet107CreativeSetSlot); 355 } 356 357 /** 358 * Handle a entity experience orb packet. 359 */ 360 public void handleEntityExpOrb(Packet26EntityExpOrb par1Packet26EntityExpOrb) 361 { 362 this.unexpectedPacket(par1Packet26EntityExpOrb); 363 } 364 365 public void handleEnchantItem(Packet108EnchantItem par1Packet108EnchantItem) {} 366 367 public void handleCustomPayload(Packet250CustomPayload par1Packet250CustomPayload) {} 368 369 public void handleEntityHeadRotation(Packet35EntityHeadRotation par1Packet35EntityHeadRotation) 370 { 371 this.unexpectedPacket(par1Packet35EntityHeadRotation); 372 } 373 374 public void handleTileEntityData(Packet132TileEntityData par1Packet132TileEntityData) 375 { 376 this.unexpectedPacket(par1Packet132TileEntityData); 377 } 378 379 /** 380 * Handle a player abilities packet. 381 */ 382 public void handlePlayerAbilities(Packet202PlayerAbilities par1Packet202PlayerAbilities) 383 { 384 this.unexpectedPacket(par1Packet202PlayerAbilities); 385 } 386 387 public void handleAutoComplete(Packet203AutoComplete par1Packet203AutoComplete) 388 { 389 this.unexpectedPacket(par1Packet203AutoComplete); 390 } 391 392 public void handleClientInfo(Packet204ClientInfo par1Packet204ClientInfo) 393 { 394 this.unexpectedPacket(par1Packet204ClientInfo); 395 } 396 397 public void handleLevelSound(Packet62LevelSound par1Packet62LevelSound) 398 { 399 this.unexpectedPacket(par1Packet62LevelSound); 400 } 401 402 public void handleBlockDestroy(Packet55BlockDestroy par1Packet55BlockDestroy) 403 { 404 this.unexpectedPacket(par1Packet55BlockDestroy); 405 } 406 407 public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand) {} 408 409 public void handleMapChunks(Packet56MapChunks par1Packet56MapChunks) 410 { 411 this.unexpectedPacket(par1Packet56MapChunks); 412 } 413 414 /** 415 * If this returns false, all packets will be queued for the main thread to handle, even if they would otherwise be 416 * processed asynchronously. Used to avoid processing packets on the client before the world has been downloaded 417 * (which happens on the main thread) 418 */ 419 public boolean canProcessPacketsAsync() 420 { 421 return false; 422 } 423 424 public abstract void handleVanilla250Packet(Packet250CustomPayload payload); 425 426 public abstract EntityPlayer getPlayer(); 427 }