TechzoneMC / SonarPet

A fork of EchoPet, updated to 1.11
https://ci.techcable.net/job/SonarPet/
GNU General Public License v3.0
19 stars 16 forks source link

Make pet classes inherit from their respective NMS classes. #25

Closed Techcable closed 8 years ago

Techcable commented 8 years ago

This would reduce logic duplication, and allow us to better utilize the existing entity logic. Various entities (like ghasts and enderdragon), have seperate movement logic that isn't handled in EntityInsentient. To properly support these entity's AI, we have to rewrite it from scratch (or copy from NMS).

If we use inheritance, we get all the entity's logic for free.

However, since java doesn't have multiple inheritance, we would have to re-implement the sonarpet/IEntityPet logic for each class. To avoid this i'll use the 'hook strategy' I use in NPCLib. This separates the sonarpet entity logic from the underlying entity implementation, which allows us to inherit superclass behavior for sonarpet logic, but still delegate to the underlying NMS entity.