Closed Gegy closed 4 years ago
I support all of the screen and overlay renames, those are definitely good.
The rest I'm less sure about, though.
I think the component names convey a level of unification that isn't present in the actual code; just implementing IGuiEventListener
doesn't give you the ability to do any rendering, only to handle input; a list of IGuiEventListener
isn't useful for a complete GUI. Also, non-gui classes implement it, specifically Minecraft
implements IGuiEventListenerDeferred
.
I like the rename to use Forwarding
for IGuiEventListenerDeferred
, though I don't want the component part of it. I'm less sure about GuiEventHandler
. I don't think Panel
is the right term; in AWT Panel
is something else and it's Container
that contains other components (and is subclassed by Panel
, ScrollPane
, Window
, etc).
I have no opinion on Gui
to GuiRenderer
. That class is just somewhat silly and probably should be static methods (possibly with static imports) instead.
I don't think the rename from GuiScreen
to AbstractScreen
is helpful. Outside of it being a fair amount of work to update around, I feel like it's not an implementation detail (which I partially associate wtih abstract classes); for instance it's used as a specific parameter in a ton of methods. That rename seems similar to changing Enchantment
to AbstractEnchantment
just because Enchantment
happens to be an abstract class.
I've already made my statement about the Component
suffix, but some other thoughts:
GuiButtonImage -> IconButton: This is OK-ish, but note that that class is only used for the recipe book (and there are other buttons with icons).
GuiSlot -> ListComponent, GuiListExtended -> GenericListComponent: I do think the Extended
part is weird, but I'm not sure "Generic" is the right prefix either. I don't have a better name though.
GuiLockIconButton -> LockableButton: This is wrong. This button is the "lock difficult" button, and it specifically renders a lock icon; to me that's more important than the fact that it becomes locked. Also this is only used by that one GUI, so maybe it shouldn't be treated as a general component.
GuiOptionButton -> menu/options/OptionButton, GuiOptionSlider -> menu/options/OptionSlider: I'm not sure what should be done about this, since this is the only slider class, but it's also a option-exclusive thing.
GuiLabel: You didn't mention this, but it's worth mentioning that it does exist and remains completely useless to this day. It probably would also need to be repackaged.
A few other of the gui-specific buttons (e.g. GuiButtonLanguage
): I don't know what to do with these either; they maybe should be moved into the package for their GUI but that seems like it could get awkward.
@Pokechu22
I can definitely agree with a lot of what you are saying; the main challenge now is coming up with more suitable names.
Component
: I don't think IGuiEventHandler
is very appropriate for how it is used. Event listeners imply being global, though they are instead generally local to a specific 'component' of a GUI. The name Component
may not be ideal here, but I think it makes more sense than EventListener
. What could be a more fitting name?Panel
: As Container
has other connotations in the MC codebase, we'd have to use something different. ComponentContainer
(independent of 'component') could possibly work, though may also be misleading due to using Container
. AbstractScreeen
: Would just Screen
be more appropriate, or too generic?IconButton
: The implementation is really generic to just supporting an arbitrary icon. I'd imagine this would be used in the future for other GUIs, so I think it's better to keep the name generic so that the name doesn't need to change with future updates.ListComponent, GenericListComponent
: For sure. My main thinking behind Generic
was that GenericListComponent
holds a List<T>
.LockableButton
: Same here applies in not making the name specific around how it is used.OptionSlider
: The implementation depends on GameSettings$Options
, it can't really be made more generic.GuiLabel
: Completely forgot this one. Would LabelComponent
be an appropriate name? (assuming the Component
suffix for example)LanguageButton
: I think it would depend on whether the implementation is generic or applies specifically to one GUI. LanguageButton
is already in a package with MainMenuScreen
, so it should not need to be moved.As a brief note, I think it's important for the "Inventory/Container Screens" to have consistent names with the associated Inventory
/Container
classes. This can of course be achieved by renaming either class (or both), but the end result should match.
Motivation
Over time the GUI class mapping has become a huge mess, lacking consistency and in some cases having nonsensical names. 1.13 is a great time to rework this structure, not only because so many other mappings are being reevaluated, but also because GUIs had some revision on the Vanilla side.
Examples
All menus for changing a specific type of option, yet completely different naming schemes.
This class is actually the "Direct Connect" screen, and has no list whatsoever.
GuiNewChat
handles chat history andGuiChat
handles new messages. If anything these are swapped around.Changes
component
package. Components also extend to screens themselves, as the full screen is a component.Screen
is used overGui
:MainMenuScreen
is used instead ofMainMenuGui
. What we know as GUIs always extendAbstractScreen
(GuiScreen
), so the term is applicable here.GuiEventHandler
). The current name does not properly describe the function, though. This class contains an arbitrary amount of components and propagates events to them.Panel
is a common term to describe this functionality in similar systems, so it is appropriate here.ingame.*
: anything accessible from ingamemenu.*
: all screens when outside of a gamecomponent.*
: all gui components such as buttons and text fieldsResult
* all from the reference of
net.minecraft.client.gui
IGuiEventListener
->IComponent
IGuiEventListenerDeferred
->IForwardingComponent
Gui
->GuiRenderer
GuiEventHandler
->Panel
GuiScreen
->AbstractScreen
Generic Components
GuiButton
->component/ButtonComponent
GuiButtonImage
->component/IconButton
GuiButtonToggle
->component/ToggleableButton
GuiSlot
->component/ListComponent
GuiListExtended
->component/GenericListComponent
GuiTextField
->component/TextFieldComponent
GuiLockIconButton
->component/LockableButton
Overlays/HUD
GuiIngame
->ingame/overlay/IngameOverlay
GuiOverlayDebug
->ingame/overlay/DebugOverlay
GuiBossOverlay
->ingame/overlay/BossOverlay
GuiChat
->ingame/overlay/ChatOverlay
GuiNewChat
->ingame/overlay/ChatHistoryOverlay
GuiPlayerTabOverlay
->ingame/overlay/PlayerListOverlay
GuiSpectator
->ingame/overlay/SpectatorOverlay
GuiSubtitleOverlay
->ingame/overlay/SubtitleOverlay
Generic In-game Screens
GuiIngameMenu
->ingame/PauseScreen
GuiGameOver
->ingame/DeathScreen
GuiSleepMP
->ingame/SleepingScreen
GuiShareToLan
->ingame/OpenToLanScreen
inventory/GuiEditSign
->ingame/EditSignScreen
inventory/GuiEditStructure
->ingame/EditStructureScreen
GuiScreenBook
->ingame/BookScreen
GuiCommandBlockBase
->ingame/CommandEditorScreen
GuiCommandBlock
->ingame/CommandBlockScreen
GuiEditCommandBlockMinecart
->ingame/CommandMinecartScreen
Inventory/Container Screens
inventory/CreativeCrafting
->ingame/inventory/CreativeCrafting
inventory/GuiBeacon
->ingame/inventory/BeaconScreen
inventory/GuiBrewingStand
->ingame/inventory/BrewingStandScreen
inventory/GuiChest
->ingame/inventory/ChestScreen
inventory/GuiContainer
->ingame/inventory/ContainerScreen
inventory/GuiContainerCreative
->ingame/inventory/CreativeInventoryScreen
inventory/GuiCrafting
->ingame/inventory/CraftingScreen
inventory/GuiDispenser
->ingame/inventory/DispenserScreen
inventory/GuiFurnace
->ingame/inventory/FurnaceScreen
inventory/GuiInventory
->ingame/inventory/InventoryScreen
inventory/GuiScreenHorseInventory
->ingame/inventory/HorseInventoryScreen
inventory/GuiShulkerBox
->ingame/inventory/ShulkerBoxScreen
GuiMerchant
->ingame/inventory/MerchantScreen
GuiEnchantment
->ingame/inventory/EnchantmentScreen
GuiHopper
->ingame/inventory/HopperScreen
GuiRepair
->ingame/inventory/AnvilScreen
Generic Menu Screens
GuiYesNo
->menu/ConfirmationScreen
GuiYesNoCallback
->menu/ConfirmationScreenCallback
GuiConfirmBackup
->menu/ConfirmBackupScreen
GuiConfirmOpenLink
->menu/ConfirmOpenLinkScreen
GuiCustomizeSkin
->menu/CustomizeSkinScreen
GuiMainMenu
->menu/MainMenuScreen
GuiButtonLanguage
->menu/LanguageButton
GuiScreenDemo
->menu/DemoReminderScreen
GuiSnooper
->menu/SnooperScreen
Resource Pack Screens
GuiScreenResourcePacks
->menu/resource/SelectResourcePackScreen
GuiResourcePackList
->menu/resource/ResourcePackList
GuiResourcePackAvailable
->menu/resource/AvailableResourcePackList
GuiResourcePackSelected
->menu/resource/SelectedResourcePackList
Server Screens
GuiScreenAddServer
->menu/server/AddServerScreen
GuiScreenServerList
->menu/server/DirectConnectScreen
GuiMultiplayer
->menu/server/SelectServerScreen
ServerSelectionList
->menu/server/ServerList
ServerListEntryLanDetected
->menu/server/LanServerListEntry
ServerListEntryLanScan
->menu/server/LanScanningServerListEntry
ServerListEntryNormal
->menu/server/ServerEntry
GuiScreenRealmsProxy
->menu/server/RealmsProxyScreen
GuiButtonRealmsProxy
->menu/server/ButtonRealmsProxy
World Screens
GuiFlatPresets
->menu/world/FlatPresetsScreen
GuiOptimizeWorld
->menu/world/OptimizeWorldScreen
GuiCreateBuffetWorld
->menu/world/CustomizeBuffetWorldScreen
GuiCreateFlatWorld
->menu/world/CustomizeFlatWorldScreen
GuiCreateWorld
->menu/world/CreateWorldScreen
GuiWorldEdit
->menu/world/EditWorldScreen
GuiWorldSelection
->menu/world/SelectWorldScreen
GuiListWorldSelection
->menu/world/WorldList
GuiListWorldSelectionEntry
->menu/world/WorldListEntry
Option Screens
GuiOptions
->menu/options/OptionsScreen
GuiVideoSettings
->menu/options/VideoOptionsScreen
GuiScreenOptionsSounds
->menu/options/SoundOptionsScreen
GuiControls
->menu/options/ControlOptionsScreen
ScreenChatOptions
->menu/options/ChatOptionsScreen
GuiOptionButton
->menu/options/OptionButton
GuiOptionSlider
->menu/options/OptionSlider
GuiOptionsRowList
->menu/options/OptionsList
GuiKeyBindingList
->menu/options/KeyBindList
Generic Misc Screens
GuiConnecting
->ConnectingScreen
GuiDirtMessageScreen
->StatusScreen
GuiDisconnected
->DisconnectedScreen
GuiErrorScreen
->JoinErrorScreen
GuiScreenLoading
->LoadingScreen
GuiScreenWorking
->WorkingScreen
GuiMemoryErrorScreen
->OutOfMemoryScreen
GuiWinGame
->CreditsScreen
GuiScreenAlert
->AlertScreen
Conclusion
These are a huge amount of changes and definitely encourage a discussion around these renames.