Skip to content

Commit 09b0e2e

Browse files
committed
add a way to disable some parts of bars ui via config and select them via devtool elem select
1 parent c844b99 commit 09b0e2e

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/react/ArmorBar.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
--offset: calc(-1 * 25px);
99
--bg-x: calc(-1 * 16px);
1010
--bg-y: calc(-1 * 9px);
11-
pointer-events: none;
1211
image-rendering: pixelated;
1312
}
1413

src/react/BreathBar.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
--offset: calc(-1 * 16px);
1010
--bg-x: calc(-1 * 16px);
1111
--bg-y: calc(-1 * 18px);
12-
pointer-events: none;
1312
image-rendering: pixelated;
1413
}
1514

src/react/FoodBar.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
--offset: calc(-1 * (52px + (9px * (4 * var(--kind) + var(--lightened) * 2))));
1212
--bg-x: calc(-1 * (16px + 9px * var(--lightened)));
1313
--bg-y: calc(-1 * 27px);
14-
pointer-events: none;
1514
image-rendering: pixelated;
1615
}
1716

src/react/HealthBar.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
--offset: calc(-1 * (52px + (9px * (4 * var(--kind) + var(--lightened) * 2)) ));
1212
--bg-x: calc(-1 * (16px + 9px * var(--lightened)));
1313
--bg-y: calc(-1 * var(--hardcore) * 45px);
14-
pointer-events: none;
1514
image-rendering: pixelated;
1615
}
1716

src/react/HudBarsProvider.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { useRef, useState, useMemo } from 'react'
22
import { GameMode } from 'mineflayer'
3+
import { useSnapshot } from 'valtio'
4+
import { options } from '../optionsStorage'
35
import { armor } from './armorValues'
46
import HealthBar from './HealthBar'
57
import FoodBar from './FoodBar'
@@ -8,6 +10,8 @@ import BreathBar from './BreathBar'
810
import './HealthBar.css'
911

1012
export default () => {
13+
const { disabledUiParts } = useSnapshot(options)
14+
1115
const [damaged, setDamaged] = useState(false)
1216
const [healthValue, setHealthValue] = useState(bot.health)
1317
const [food, setFood] = useState(bot.food)
@@ -91,7 +95,7 @@ export default () => {
9195
}, [])
9296

9397
return <div className='hud-bars-container'>
94-
<HealthBar
98+
{!disabledUiParts.includes('health-bar') && <HealthBar
9599
gameMode={gameMode}
96100
isHardcore={isHardcore}
97101
damaged={damaged}
@@ -102,12 +106,12 @@ export default () => {
102106
setEffectToAdd(null)
103107
setEffectToRemove(null)
104108
}}
105-
/>
106-
<ArmorBar
109+
/>}
110+
{!disabledUiParts.includes('armor-bar') && <ArmorBar
107111
armorValue={armorValue}
108112
style={gameMode !== 'survival' && gameMode !== 'adventure' ? { display: 'none' } : { display: 'flex' }}
109-
/>
110-
<FoodBar
113+
/>}
114+
{!disabledUiParts.includes('food-bar') && <FoodBar
111115
gameMode={gameMode}
112116
food={food}
113117
effectToAdd={effectToAdd}
@@ -116,9 +120,9 @@ export default () => {
116120
setEffectToAdd(null)
117121
setEffectToRemove(null)
118122
}}
119-
/>
120-
<BreathBar
123+
/>}
124+
{!disabledUiParts.includes('breath-bar') && <BreathBar
121125
oxygen={gameMode !== 'survival' && gameMode !== 'adventure' ? 0 : oxygen}
122-
/>
126+
/>}
123127
</div>
124128
}

0 commit comments

Comments
 (0)