@@ -646,33 +646,10 @@ function getEnchantmentLevel (mcData, enchantmentName, enchantments) {
646
646
return 0
647
647
}
648
648
649
- function getStatusEffectNamesForVersion ( supportFeature ) {
650
- if ( supportFeature ( 'effectNamesAreRegistryNames' ) ) {
651
- return {
652
- jumpBoostEffectName : 'jump_boost' ,
653
- speedEffectName : 'speed' ,
654
- slownessEffectName : 'slowness' ,
655
- dolphinsGraceEffectName : 'dolphins_grace' ,
656
- slowFallingEffectName : 'slow_falling' ,
657
- levitationEffectName : 'levitation'
658
- }
659
- } else {
660
- return {
661
- jumpBoostEffectName : 'JumpBoost' ,
662
- speedEffectName : 'Speed' ,
663
- slownessEffectName : 'Slowness' ,
664
- dolphinsGraceEffectName : 'DolphinsGrace' ,
665
- slowFallingEffectName : 'SlowFalling' ,
666
- levitationEffectName : 'Levitation'
667
- }
668
- }
669
- }
670
-
671
649
class PlayerState {
672
650
constructor ( bot , control ) {
673
651
const mcData = require ( 'minecraft-data' ) ( bot . version )
674
652
const nbt = require ( 'prismarine-nbt' )
675
- const supportFeature = makeSupportFeature ( mcData )
676
653
677
654
// Input / Outputs
678
655
this . pos = bot . entity . position . clone ( )
@@ -694,15 +671,14 @@ class PlayerState {
694
671
695
672
// effects
696
673
const effects = bot . entity . effects
697
- const statusEffectNames = getStatusEffectNamesForVersion ( supportFeature )
698
674
699
- this . jumpBoost = getEffectLevel ( mcData , statusEffectNames . jumpBoostEffectName , effects )
700
- this . speed = getEffectLevel ( mcData , statusEffectNames . speedEffectName , effects )
701
- this . slowness = getEffectLevel ( mcData , statusEffectNames . slownessEffectName , effects )
675
+ this . jumpBoost = getEffectLevel ( mcData , 'JumpBoost' , effects )
676
+ this . speed = getEffectLevel ( mcData , 'Speed' , effects )
677
+ this . slowness = getEffectLevel ( mcData , 'Slowness' , effects )
702
678
703
- this . dolphinsGrace = getEffectLevel ( mcData , statusEffectNames . dolphinsGraceEffectName , effects )
704
- this . slowFalling = getEffectLevel ( mcData , statusEffectNames . slowFallingEffectName , effects )
705
- this . levitation = getEffectLevel ( mcData , statusEffectNames . levitationEffectName , effects )
679
+ this . dolphinsGrace = getEffectLevel ( mcData , 'DolphinsGrace' , effects )
680
+ this . slowFalling = getEffectLevel ( mcData , 'SlowFalling' , effects )
681
+ this . levitation = getEffectLevel ( mcData , 'Levitation' , effects )
706
682
707
683
// armour enchantments
708
684
const boots = bot . inventory . slots [ 8 ]
0 commit comments