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