66import at .petrak .hexcasting .api .pigment .FrozenPigment ;
77import at .petrak .hexcasting .api .player .Sentinel ;
88import at .petrak .hexcasting .xplat .IXplatAbstractions ;
9+
910import com .google .common .base .Suppliers ;
11+
1012import net .minecraft .ChatFormatting ;
1113import net .minecraft .network .chat .Component ;
1214import net .minecraft .resources .ResourceKey ;
1618import net .minecraft .sounds .SoundEvents ;
1719import net .minecraft .world .entity .Entity ;
1820import net .minecraft .world .entity .EntityType ;
19- import net .minecraft .world .entity .EquipmentSlot ;
2021import net .minecraft .world .entity .Mob ;
2122import net .minecraft .world .entity .player .Player ;
2223import net .minecraft .world .item .ArmorItem ;
2324import net .minecraft .world .item .ArmorMaterial ;
2425import net .minecraft .world .item .ItemStack ;
2526import net .minecraft .world .item .crafting .Ingredient ;
2627import net .minecraft .world .phys .Vec3 ;
28+
2729import org .apache .logging .log4j .LogManager ;
2830import org .apache .logging .log4j .Logger ;
2931import org .jetbrains .annotations .NotNull ;
@@ -36,23 +38,27 @@ public interface HexAPI {
3638 String MOD_ID = "hexcasting" ;
3739 Logger LOGGER = LogManager .getLogger (MOD_ID );
3840
39- Supplier <HexAPI > INSTANCE = Suppliers .memoize (() -> {
40- try {
41- return (HexAPI ) Class .forName ("at.petrak.hexcasting.common.impl.HexAPIImpl" )
42- .getDeclaredConstructor ().newInstance ();
43- } catch (ReflectiveOperationException e ) {
44- LogManager .getLogger ().warn ("Unable to find HexAPIImpl, using a dummy" );
45- return new HexAPI () {
46- };
47- }
48- });
41+ Supplier <HexAPI > INSTANCE =
42+ Suppliers .memoize (
43+ () -> {
44+ try {
45+ return (HexAPI )
46+ Class .forName ("at.petrak.hexcasting.common.impl.HexAPIImpl" )
47+ .getDeclaredConstructor ()
48+ .newInstance ();
49+ } catch (ReflectiveOperationException e ) {
50+ LogManager .getLogger ().warn ("Unable to find HexAPIImpl, using a dummy" );
51+ return new HexAPI () {};
52+ }
53+ });
4954
5055 /**
5156 * Return the localization key for the given action.
52- * <p>
53- * Note we're allowed to have action <em>resource keys</em> on the client, just no actual actions.
54- * <p>
55- * Special handlers should be calling {@link SpecialHandler#getName()}
57+ *
58+ * <p>Note we're allowed to have action <em>resource keys</em> on the client, just no actual
59+ * actions.
60+ *
61+ * <p>Special handlers should be calling {@link SpecialHandler#getName()}
5662 */
5763 default String getActionI18nKey (ResourceKey <ActionRegistryEntry > action ) {
5864 return "hexcasting.action.%s" .formatted (action .location ().toString ());
@@ -63,37 +69,40 @@ default String getSpecialHandlerI18nKey(ResourceKey<SpecialHandler.Factory<?>> a
6369 }
6470
6571 /**
66- * Currently introspection/retrospection/consideration are hardcoded, but at least their names won't be
72+ * Currently introspection/retrospection/consideration are hardcoded, but at least their names
73+ * won't be
6774 */
6875 default String getRawHookI18nKey (ResourceLocation name ) {
6976 return "hexcasting.rawhook.%s" .formatted (name );
7077 }
7178
7279 default Component getActionI18n (ResourceKey <ActionRegistryEntry > key , boolean isGreat ) {
7380 return Component .translatable (getActionI18nKey (key ))
74- .withStyle (isGreat ? ChatFormatting .GOLD : ChatFormatting .LIGHT_PURPLE );
81+ .withStyle (isGreat ? ChatFormatting .GOLD : ChatFormatting .LIGHT_PURPLE );
7582 }
7683
7784 default Component getSpecialHandlerI18n (ResourceKey <SpecialHandler .Factory <?>> key ) {
7885 return Component .translatable (getSpecialHandlerI18nKey (key ))
79- .withStyle (ChatFormatting .LIGHT_PURPLE );
86+ .withStyle (ChatFormatting .LIGHT_PURPLE );
8087 }
8188
8289 default Component getRawHookI18n (ResourceLocation name ) {
83- return Component .translatable (getRawHookI18nKey (name )).withStyle (ChatFormatting .LIGHT_PURPLE );
90+ return Component .translatable (getRawHookI18nKey (name ))
91+ .withStyle (ChatFormatting .LIGHT_PURPLE );
8492 }
8593
8694 /**
87- * Register an entity with the given ID to have its velocity as perceived by OpEntityVelocity be different
88- * than it's "normal" velocity
95+ * Register an entity with the given ID to have its velocity as perceived by OpEntityVelocity be
96+ * different than it's "normal" velocity
8997 */
9098 // Should be OK to use the type directly as the key as they're singleton identity objects
91- default <T extends Entity > void registerSpecialVelocityGetter (EntityType < T > key , EntityVelocityGetter < T > getter ) {
92- }
99+ default <T extends Entity > void registerSpecialVelocityGetter (
100+ EntityType < T > key , EntityVelocityGetter < T > getter ) { }
93101
94102 /**
95- * If the entity has had a special getter registered with {@link HexAPI#registerSpecialVelocityGetter} then
96- * return that, otherwise return its normal delta movement
103+ * If the entity has had a special getter registered with {@link
104+ * HexAPI#registerSpecialVelocityGetter} then return that, otherwise return its normal delta
105+ * movement
97106 */
98107 default Vec3 getEntityVelocitySpecial (Entity entity ) {
99108 return entity .getDeltaMovement ();
@@ -106,36 +115,34 @@ interface EntityVelocityGetter<T extends Entity> {
106115
107116 /**
108117 * Register an entity type to have a custom behavior when getting brainswept.
109- * <p>
110- * This knocks out the normal behavior; if you want that behavior you should call
118+ *
119+ * <p> This knocks out the normal behavior; if you want that behavior you should call
111120 */
112- default <T extends Mob > void registerCustomBrainsweepingBehavior (EntityType < T > key , Consumer < T > hook ) {
113- }
121+ default <T extends Mob > void registerCustomBrainsweepingBehavior (
122+ EntityType < T > key , Consumer < T > hook ) { }
114123
115124 /**
116125 * The default behavior when an entity gets brainswept.
117- * <p>
118- * Something registered with {@link HexAPI#registerCustomBrainsweepingBehavior} doesn't call this automatically;
119- * you can use this to add things on top of the default behavior
126+ *
127+ * <p> Something registered with {@link HexAPI#registerCustomBrainsweepingBehavior} doesn't call
128+ * this automatically; you can use this to add things on top of the default behavior
120129 */
121130 default Consumer <Mob > defaultBrainsweepingBehavior () {
122- return mob -> {
123- };
131+ return mob -> {};
124132 }
125133
126134 /**
127- * If something special's been returned with {@link HexAPI#registerCustomBrainsweepingBehavior}, return that,
128- * otherwise return the default behavior
135+ * If something special's been returned with {@link HexAPI#registerCustomBrainsweepingBehavior},
136+ * return that, otherwise return the default behavior
129137 */
130138 default <T extends Mob > Consumer <T > getBrainsweepBehavior (EntityType <T > mobType ) {
131- return mob -> {
132- };
139+ return mob -> {};
133140 }
134141
135142 /**
136143 * Brainsweep (flay the mind of) the given mob.
137- * <p>
138- * This ignores the unbrainsweepable tag.
144+ *
145+ * <p> This ignores the unbrainsweepable tag.
139146 */
140147 default void brainsweep (Mob mob ) {
141148 var type = (EntityType <? extends Mob >) mob .getType ();
@@ -165,61 +172,59 @@ default FrozenPigment getColorizer(Player player) {
165172 return FrozenPigment .DEFAULT .get ();
166173 }
167174
168- ArmorMaterial DUMMY_ARMOR_MATERIAL = new ArmorMaterial () {
169- @ Override
170- public int getDurabilityForType (ArmorItem .Type type ) {
171- return 0 ;
172- }
173-
174- @ Override
175- public int getDefenseForType (ArmorItem .Type type ) {
176- return 0 ;
177- }
178-
179- @ Override
180- public int getEnchantmentValue () {
181- return 0 ;
182- }
183-
184- @ NotNull
185- @ Override
186- public SoundEvent getEquipSound () {
187- return SoundEvents .ARMOR_EQUIP_LEATHER ;
188- }
189-
190- @ NotNull
191- @ Override
192- public Ingredient getRepairIngredient () {
193- return Ingredient .EMPTY ;
194- }
195-
196- @ Override
197- public String getName () {
198- return "missingno" ;
199- }
200-
201- @ Override
202- public float getToughness () {
203- return 0 ;
204- }
205-
206- @ Override
207- public float getKnockbackResistance () {
208- return 0 ;
209- }
210- };
175+ ArmorMaterial DUMMY_ARMOR_MATERIAL =
176+ new ArmorMaterial () {
177+ @ Override
178+ public int getDurabilityForType (ArmorItem .Type type ) {
179+ return 0 ;
180+ }
181+
182+ @ Override
183+ public int getDefenseForType (ArmorItem .Type type ) {
184+ return 0 ;
185+ }
186+
187+ @ Override
188+ public int getEnchantmentValue () {
189+ return 0 ;
190+ }
191+
192+ @ NotNull
193+ @ Override
194+ public SoundEvent getEquipSound () {
195+ return SoundEvents .ARMOR_EQUIP_LEATHER ;
196+ }
197+
198+ @ NotNull
199+ @ Override
200+ public Ingredient getRepairIngredient () {
201+ return Ingredient .EMPTY ;
202+ }
203+
204+ @ Override
205+ public String getName () {
206+ return "missingno" ;
207+ }
208+
209+ @ Override
210+ public float getToughness () {
211+ return 0 ;
212+ }
213+
214+ @ Override
215+ public float getKnockbackResistance () {
216+ return 0 ;
217+ }
218+ };
211219
212220 default ArmorMaterial robesMaterial () {
213221 return DUMMY_ARMOR_MATERIAL ;
214222 }
215223
216- /**
217- * Location in the userdata of the ravenmind
218- */
224+ /** Location in the userdata of the ravenmind */
219225 String RAVENMIND_USERDATA = modLoc ("ravenmind" ).toString ();
220- /**
221- * Location in the userdata of the number of ops executed
222- */
226+
227+ /** Location in the userdata of the number of ops executed */
223228 String OP_COUNT_USERDATA = modLoc ("op_count" ).toString ();
224229
225230 String MARKED_MOVED_USERDATA = modLoc ("impulsed" ).toString ();
0 commit comments