-
-
Notifications
You must be signed in to change notification settings - Fork 920
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support 1.20.4 * Update package.json * fix externalTest hang on op message waiting * add more context to to errors * replace nodejs once() usage with mineflayer once() with a default 20s timeout * fix path * fix ChatMessages to use .fromNotch * Update chat.js add debug * add more debug * internalTest: fix chat * fix nbt.string wrap * update prismarine-windows dep * fix * add logging * replace grass -> mycelium for test * remove debug console.log in chat.js * Update package.json * Update package.json --------- Co-authored-by: extremeheat <extreme@protonmail.ch>
- Loading branch information
1 parent
b9491ae
commit aa99daa
Showing
32 changed files
with
224 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,98 @@ | ||
let ChatMessage | ||
const colors = ['pink', 'blue', 'red', 'green', 'yellow', 'purple', 'white'] | ||
const divisions = [0, 6, 10, 12, 20] | ||
|
||
module.exports = loader | ||
|
||
function loader (registry) { | ||
ChatMessage = require('prismarine-chat')(registry) | ||
return BossBar | ||
} | ||
|
||
class BossBar { | ||
constructor (uuid, title, health, dividers, color, flags) { | ||
this._entityUUID = uuid | ||
this._title = new ChatMessage(JSON.parse(title)) | ||
this._health = health | ||
this._dividers = divisions[dividers] | ||
this._color = colors[color] | ||
this._shouldDarkenSky = flags & 0x1 | ||
this._isDragonBar = flags & 0x2 | ||
this._createFog = flags & 0x4 | ||
} | ||
|
||
set entityUUID (uuid) { | ||
this._entityUUID = uuid | ||
} | ||
|
||
set title (title) { | ||
this._title = new ChatMessage(JSON.parse(title)) | ||
} | ||
|
||
set health (health) { | ||
this._health = health | ||
} | ||
|
||
set dividers (dividers) { | ||
this._dividers = divisions[dividers] | ||
} | ||
|
||
set color (color) { | ||
this._color = colors[color] | ||
} | ||
|
||
set flags (flags) { | ||
this._shouldDarkenSky = flags & 0x1 | ||
this._isDragonBar = flags & 0x2 | ||
this._createFog = flags & 0x4 | ||
} | ||
|
||
get flags () { | ||
return (this._shouldDarkenSky) | (this._isDragonBar << 1) | (this._createFog << 2) | ||
} | ||
|
||
set shouldDarkenSky (darkenSky) { | ||
this._shouldDarkenSky = darkenSky | ||
} | ||
|
||
set isDragonBar (dragonBar) { | ||
this._isDragonBar = dragonBar | ||
} | ||
|
||
get createFog () { | ||
return this._createFog | ||
} | ||
|
||
set createFog (createFog) { | ||
this._createFog = createFog | ||
} | ||
|
||
get entityUUID () { | ||
return this._entityUUID | ||
} | ||
|
||
get title () { | ||
return this._title | ||
} | ||
|
||
get health () { | ||
return this._health | ||
} | ||
|
||
get dividers () { | ||
return this._dividers | ||
} | ||
|
||
get color () { | ||
return this._color | ||
} | ||
|
||
get shouldDarkenSky () { | ||
return this._shouldDarkenSky | ||
} | ||
|
||
get isDragonBar () { | ||
return this._isDragonBar | ||
} | ||
|
||
get shouldCreateFog () { | ||
return this._createFog | ||
const ChatMessage = require('prismarine-chat')(registry) | ||
return class BossBar { | ||
constructor (uuid, title, health, dividers, color, flags) { | ||
this._entityUUID = uuid | ||
this._title = ChatMessage.fromNotch(title) | ||
this._health = health | ||
this._dividers = divisions[dividers] | ||
this._color = colors[color] | ||
this._shouldDarkenSky = flags & 0x1 | ||
this._isDragonBar = flags & 0x2 | ||
this._createFog = flags & 0x4 | ||
} | ||
|
||
set entityUUID (uuid) { | ||
this._entityUUID = uuid | ||
} | ||
|
||
set title (title) { | ||
this._title = ChatMessage.fromNotch(title) | ||
} | ||
|
||
set health (health) { | ||
this._health = health | ||
} | ||
|
||
set dividers (dividers) { | ||
this._dividers = divisions[dividers] | ||
} | ||
|
||
set color (color) { | ||
this._color = colors[color] | ||
} | ||
|
||
set flags (flags) { | ||
this._shouldDarkenSky = flags & 0x1 | ||
this._isDragonBar = flags & 0x2 | ||
this._createFog = flags & 0x4 | ||
} | ||
|
||
get flags () { | ||
return (this._shouldDarkenSky) | (this._isDragonBar << 1) | (this._createFog << 2) | ||
} | ||
|
||
set shouldDarkenSky (darkenSky) { | ||
this._shouldDarkenSky = darkenSky | ||
} | ||
|
||
set isDragonBar (dragonBar) { | ||
this._isDragonBar = dragonBar | ||
} | ||
|
||
get createFog () { | ||
return this._createFog | ||
} | ||
|
||
set createFog (createFog) { | ||
this._createFog = createFog | ||
} | ||
|
||
get entityUUID () { | ||
return this._entityUUID | ||
} | ||
|
||
get title () { | ||
return this._title | ||
} | ||
|
||
get health () { | ||
return this._health | ||
} | ||
|
||
get dividers () { | ||
return this._dividers | ||
} | ||
|
||
get color () { | ||
return this._color | ||
} | ||
|
||
get shouldDarkenSky () { | ||
return this._shouldDarkenSky | ||
} | ||
|
||
get isDragonBar () { | ||
return this._isDragonBar | ||
} | ||
|
||
get shouldCreateFog () { | ||
return this._createFog | ||
} | ||
} | ||
} | ||
|
||
module.exports = loader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.