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