1313import net .minecraft .entity .Entity ;
1414import net .minecraft .entity .EntityType ;
1515import net .minecraft .entity .player .PlayerEntity ;
16- import net .minecraft .item .AxeItem ;
16+ import net .minecraft .item .MaceItem ;
1717import net .minecraft .registry .tag .ItemTags ;
1818
1919import java .util .Set ;
2020
2121public class Hitboxes extends Module {
2222 private final SettingGroup sgGeneral = settings .getDefaultGroup ();
23+ private final SettingGroup sgWeapon = settings .createGroup ("Weapon Options" );
2324
2425 private final Setting <Set <EntityType <?>>> entities = sgGeneral .add (new EntityTypeListSetting .Builder ()
2526 .name ("entities" )
@@ -42,13 +43,61 @@ public class Hitboxes extends Module {
4243 .build ()
4344 );
4445
45- private final Setting <Boolean > onlyOnWeapon = sgGeneral .add (new BoolSetting .Builder ()
46+ private final Setting <Boolean > onlyOnWeapon = sgWeapon .add (new BoolSetting .Builder ()
4647 .name ("only-on-weapon" )
4748 .description ("Only modifies hitbox when holding a weapon in hand." )
4849 .defaultValue (false )
4950 .build ()
5051 );
5152
53+ private final Setting <Boolean > sword = sgWeapon .add (new BoolSetting .Builder ()
54+ .name ("sword" )
55+ .description ("Enable when holding a sword." )
56+ .defaultValue (true )
57+ .visible (onlyOnWeapon ::get )
58+ .build ()
59+ );
60+
61+ private final Setting <Boolean > axe = sgWeapon .add (new BoolSetting .Builder ()
62+ .name ("axe" )
63+ .description ("Enable when holding an axe." )
64+ .defaultValue (true )
65+ .visible (onlyOnWeapon ::get )
66+ .build ()
67+ );
68+
69+ private final Setting <Boolean > pickaxe = sgWeapon .add (new BoolSetting .Builder ()
70+ .name ("pickaxe" )
71+ .description ("Enable when holding a pickaxe." )
72+ .defaultValue (true )
73+ .visible (onlyOnWeapon ::get )
74+ .build ()
75+ );
76+
77+ private final Setting <Boolean > shovel = sgWeapon .add (new BoolSetting .Builder ()
78+ .name ("shovel" )
79+ .description ("Enable when holding a shovel." )
80+ .defaultValue (true )
81+ .visible (onlyOnWeapon ::get )
82+ .build ()
83+ );
84+
85+ private final Setting <Boolean > hoe = sgWeapon .add (new BoolSetting .Builder ()
86+ .name ("hoe" )
87+ .description ("Enable when holding a hoe." )
88+ .defaultValue (true )
89+ .visible (onlyOnWeapon ::get )
90+ .build ()
91+ );
92+
93+ private final Setting <Boolean > mace = sgWeapon .add (new BoolSetting .Builder ()
94+ .name ("mace" )
95+ .description ("Enable when holding a mace." )
96+ .defaultValue (true )
97+ .visible (onlyOnWeapon ::get )
98+ .build ()
99+ );
100+
52101 public Hitboxes () {
53102 super (Categories .Combat , "hitboxes" , "Expands an entity's hitboxes." );
54103 }
@@ -61,6 +110,14 @@ public double getEntityValue(Entity entity) {
61110
62111 private boolean testWeapon () {
63112 if (!onlyOnWeapon .get ()) return true ;
64- return InvUtils .testInHands (itemStack -> itemStack .isIn (ItemTags .SWORDS ) || itemStack .getItem () instanceof AxeItem );
113+ return InvUtils .testInMainHand (itemStack -> {
114+ if (sword .get () && itemStack .isIn (ItemTags .SWORDS )) return true ;
115+ if (axe .get () && itemStack .isIn (ItemTags .AXES )) return true ;
116+ if (pickaxe .get () && itemStack .isIn (ItemTags .PICKAXES )) return true ;
117+ if (shovel .get () && itemStack .isIn (ItemTags .SHOVELS )) return true ;
118+ if (hoe .get () && itemStack .isIn (ItemTags .HOES )) return true ;
119+ if (mace .get () && itemStack .getItem () instanceof MaceItem ) return true ;
120+ return false ;
121+ });
65122 }
66123}
0 commit comments