Various technical articles, IT-related tutorials, software information, and development journals
Wednesday, August 14, 2013
HigherPower - Superclassing
I decided to finally clean up a lot of HigherPower's classes by moving copy-pasted functionality to a common superclass. That new class was _HPMachineTE, containing methods for ejecting items, performing NBT operations, giving information about the IInventory to Forge, and hooking HigherPower machines to slot-related events. I did something similar with the Block classes that represented machines, creating _HPBlockContainer. That class provides methods for orienting the block (with four or six directions), opening GUIs, creating and managing TileEntity instances, and spawning contents into the world when broken. It really feels good to eliminate hundreds of lines of unnecessary code from a project.
Labels:
dev,
higherpower
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment