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