1111import org .spongepowered .asm .mixin .injection .Inject ;
1212import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
1313
14+ import static net .F53 .HorseBuff .config .ModConfig .fairBreeds ;
15+
1416// Make breeding fair
1517@ Mixin (HorseBaseEntity .class )
1618abstract class HorseChildAttributeMixin extends AnimalEntity {
@@ -21,22 +23,24 @@ protected HorseChildAttributeMixin(EntityType<? extends AnimalEntity> entityType
2123
2224 @ Inject (method = "setChildAttributes" , at = @ At (value = "TAIL" ))
2325 protected void onSetChildAttributes (PassiveEntity mate , HorseBaseEntity child , CallbackInfo ci ) {
24- // Logic - Set stat to average parent stat, +/- some random amount, limited to vanilla min/max values
25-
26- // Health
27- // 15-30
28- double Health = Logic (this .getAttributeBaseValue (EntityAttributes .GENERIC_MAX_HEALTH ), mate .getAttributeBaseValue (EntityAttributes .GENERIC_MAX_HEALTH ), 15 , 30 );
29- child .getAttributeInstance (EntityAttributes .GENERIC_MAX_HEALTH ).setBaseValue (Health );
30-
31- // Jump
32- // 0.4-1.0
33- double JumpStrength = Logic (this .getAttributeBaseValue (EntityAttributes .HORSE_JUMP_STRENGTH ), mate .getAttributeBaseValue (EntityAttributes .HORSE_JUMP_STRENGTH ), 0.4 , 1.0 );
34- child .getAttributeInstance (EntityAttributes .HORSE_JUMP_STRENGTH ).setBaseValue (JumpStrength );
35-
36- // Movement
37- // 0.1125 - 0.3375
38- double MovementSpeed = Logic (this .getAttributeBaseValue (EntityAttributes .GENERIC_MOVEMENT_SPEED ), mate .getAttributeBaseValue (EntityAttributes .GENERIC_MOVEMENT_SPEED ), 0.1125 , 0.3375 );
39- child .getAttributeInstance (EntityAttributes .GENERIC_MOVEMENT_SPEED ).setBaseValue (MovementSpeed );
26+ if (fairBreeds ) {
27+ // Logic - Set stat to average parent stat, +/- some random amount, limited to vanilla min/max values
28+
29+ // Health
30+ // 15-30
31+ double Health = Logic (this .getAttributeBaseValue (EntityAttributes .GENERIC_MAX_HEALTH ), mate .getAttributeBaseValue (EntityAttributes .GENERIC_MAX_HEALTH ), 15 , 30 );
32+ child .getAttributeInstance (EntityAttributes .GENERIC_MAX_HEALTH ).setBaseValue (Health );
33+
34+ // Jump
35+ // 0.4-1.0
36+ double JumpStrength = Logic (this .getAttributeBaseValue (EntityAttributes .HORSE_JUMP_STRENGTH ), mate .getAttributeBaseValue (EntityAttributes .HORSE_JUMP_STRENGTH ), 0.4 , 1.0 );
37+ child .getAttributeInstance (EntityAttributes .HORSE_JUMP_STRENGTH ).setBaseValue (JumpStrength );
38+
39+ // Movement
40+ // 0.1125 - 0.3375
41+ double MovementSpeed = Logic (this .getAttributeBaseValue (EntityAttributes .GENERIC_MOVEMENT_SPEED ), mate .getAttributeBaseValue (EntityAttributes .GENERIC_MOVEMENT_SPEED ), 0.1125 , 0.3375 );
42+ child .getAttributeInstance (EntityAttributes .GENERIC_MOVEMENT_SPEED ).setBaseValue (MovementSpeed );
43+ }
4044 }
4145
4246 private double Logic (double A , double B , double min , double max ){
0 commit comments