1414import at .petrak .hexcasting .api .pigment .FrozenPigment ;
1515import at .petrak .hexcasting .api .utils .HexUtils ;
1616import at .petrak .hexcasting .api .utils .MediaHelper ;
17+ import at .petrak .hexcasting .common .lib .HexAttributes ;
1718import at .petrak .hexcasting .common .lib .HexDamageTypes ;
1819import at .petrak .hexcasting .xplat .IXplatAbstractions ;
1920import net .minecraft .core .BlockPos ;
3536import static at .petrak .hexcasting .api .HexAPI .modLoc ;
3637
3738public abstract class PlayerBasedCastEnv extends CastingEnvironment {
38- public static final double AMBIT_RADIUS = 32.0 ;
39- public static final double SENTINEL_RADIUS = 16.0 ;
39+ public static final double DEFAULT_AMBIT_RADIUS = 32.0 ;
40+ private double ambitRadius ;
41+ public static final double DEFAULT_SENTINEL_RADIUS = 16.0 ;
42+ private double sentinelRadius ;
4043
4144 protected final ServerPlayer caster ;
4245 protected final InteractionHand castingHand ;
@@ -45,6 +48,8 @@ protected PlayerBasedCastEnv(ServerPlayer caster, InteractionHand castingHand) {
4548 super (caster .serverLevel ());
4649 this .caster = caster ;
4750 this .castingHand = castingHand ;
51+ this .ambitRadius = caster .getAttributeValue (HexAttributes .AMBIT_RADIUS );
52+ this .sentinelRadius = caster .getAttributeValue (HexAttributes .SENTINEL_RADIUS );
4853 }
4954
5055 @ Override
@@ -78,6 +83,14 @@ protected List<HeldItemInfo> getPrimaryStacks() {
7883 return getPrimaryStacksForPlayer (this .castingHand , this .caster );
7984 }
8085
86+ public double getAmbitRadius () {
87+ return this .ambitRadius ;
88+ }
89+
90+ public double getSentinelRadius (){
91+ return this .sentinelRadius ;
92+ }
93+
8194 @ Override
8295 public boolean replaceItem (Predicate <ItemStack > stackOk , ItemStack replaceWith , @ Nullable InteractionHand hand ) {
8396 return replaceItemForPlayer (stackOk , replaceWith , hand , this .caster );
@@ -90,12 +103,12 @@ public boolean isVecInRangeEnvironment(Vec3 vec) {
90103 && sentinel .extendsRange ()
91104 && this .caster .level ().dimension () == sentinel .dimension ()
92105 // adding 0.00000000001 to avoid machine precision errors at specific angles
93- && vec .distanceToSqr (sentinel .position ()) <= SENTINEL_RADIUS * SENTINEL_RADIUS + 0.00000000001
106+ && vec .distanceToSqr (sentinel .position ()) <= sentinelRadius * sentinelRadius + 0.00000000001
94107 ) {
95108 return true ;
96109 }
97110
98- return vec .distanceToSqr (this .caster .position ()) <= AMBIT_RADIUS * AMBIT_RADIUS + 0.00000000001 ;
111+ return vec .distanceToSqr (this .caster .position ()) <= ambitRadius * ambitRadius + 0.00000000001 ;
99112 }
100113
101114 @ Override
0 commit comments