Class MainHandProvider
This provider selects the appropriate AbstractMainHand
implementation
based on the current Minecraft version, handling the introduction of dual-wielding
mechanics in Minecraft 1.9. Main hand providers manage the distinction between
main hand and off-hand items across different Minecraft versions.
The provider addresses the major gameplay change in Minecraft 1.9:
- 1.8 and earlier: Single-hand system with no off-hand support
- 1.9+: Dual-wielding system with main hand and off-hand slots
This enables consistent item handling across versions while providing access to dual-wielding features on supported versions and graceful fallback behavior on older versions that only support single-hand gameplay.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull AbstractMainHand
provide
(int ver) Creates the appropriate implementation for the specified NMS version.
-
Constructor Details
-
MainHandProvider
public MainHandProvider()
-
-
Method Details
-
provide
Creates the appropriate implementation for the specified NMS version.This method must be implemented by subclasses to provide version-specific logic for creating the appropriate implementation. The method receives a formatted NMS integer that can be compared against known version thresholds to determine which implementation to create.
Use the
Provider.f(String)
helper method to convert Minecraft version strings to formatted integers for comparison.Selects the main hand implementation based on dual-wielding support availability. Versions 1.9+ support dual-wielding mechanics, while earlier versions use single-hand systems with appropriate fallback behavior.
- Specified by:
provide
in classProvider<AbstractMainHand>
- Parameters:
ver
- the formatted NMS version integer- Returns:
- the version-appropriate
AbstractMainHand
implementation
-