Skip to content

Commit

Permalink
1.18 support (#2339)
Browse files Browse the repository at this point in the history
* test 1.18

* Update package.json

* Update ci.yml

* Update features.json for 1.18

* adapt chunk code

* support block entity that don't have nbt

* bump pchunk

* Update package.json

* Try to wait a bit longer in find block test

* add tall world feature to start tests at 4 or -60 depending on support

* improve internal tests

* don't hide errors

* Fix find block : handle negative y

By @nickelpro

* Fix find block bis

* fix lint and proper minY support

* improve doc to run specific test

* fix minY reference in findBlock

* fix resetBlocksToSuperflat and find block

* fix sectionY computation in findBlock

* handle variable section count in findblock

* fix sign test

* fix internal test of 1.18 by supporting minY and worldHeight

* bump mcdata to get multi_block_change fix

* adds 1.18 in readme

* add 1.18.1 support
  • Loading branch information
rom1504 authored Jan 22, 2022
1 parent ab1559e commit 694bee6
Show file tree
Hide file tree
Showing 13 changed files with 187 additions and 232 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
include:
- javaVersion: 16
mcVersion: '1.17.1'
- javaVersion: 17
mcVersion: '1.18.1'
fail-fast: false

steps:
Expand Down
10 changes: 7 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ First time using Node.js? You may want to start with the [tutorial](tutorial.md)

## Features

* Supports Minecraft 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16 and 1.17.
* Supports Minecraft 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17 and 1.18.
* Entity knowledge and tracking.
* Block knowledge. You can query the world around you. Milliseconds to find any block.
* Physics and movement - handle all bounding boxes
Expand Down Expand Up @@ -230,10 +230,14 @@ The most updated and useful are :
Simply run: `npm test`

### Testing specific version
Run `npm mocha_test -- -g <version>`, where `<version>` is a minecraft version like `1.12`, `1.15.2`...
Run `npm run mocha_test -- -g <version>`, where `<version>` is a minecraft version like `1.12`, `1.15.2`...

### Testing specific test
Run `npm mocha_test -- -g <test_name>`, where `<test_name>` is a name of the test like `bed`, `useChests`, `rayTrace`...
Run `npm run mocha_test -- -g <test_name>`, where `<test_name>` is a name of the test like `bed`, `useChests`, `rayTrace`...

### Example

`npm run mocha_test -- -g "1.18.1.*BlockFinder"` to run the block finder test for 1.18.1

## License

Expand Down
8 changes: 8 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,14 @@ Whether the bot is using the item that it's holding, for example eating food or

#### bot.game.serverBrand

#### bot.game.minY

minimum y of the world

#### bot.game.height

world height

### bot.physicsEnabled

Enable physics, default true.
Expand Down
59 changes: 32 additions & 27 deletions lib/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "spawner",
"description": "spawner is called spawner",
"versions": ["1.13", "1.17.1"]
"versions": ["1.13", "1.18.1"]
},
{
"name": "blockMetadata",
Expand All @@ -17,12 +17,12 @@
{
"name": "blockStateId",
"description": "block metadata is encoded as state id",
"versions": ["1.13", "1.17.1"]
"versions": ["1.13", "1.18.1"]
},
{
"name": "creativeSleepNearMobs",
"description": "can sleep near mobs in creative",
"versions": ["1.13", "1.17.1"]
"versions": ["1.13", "1.18.1"]
},
{
"name": "fixedPointPosition",
Expand All @@ -32,7 +32,7 @@
{
"name": "doublePosition",
"description": "Entity positions are represented with double",
"versions": ["1.9", "1.17.1"]
"versions": ["1.9", "1.18.1"]
},
{
"name": "fixedPointDelta",
Expand All @@ -42,7 +42,7 @@
{
"name": "fixedPointDelta128",
"description": "Delta of position are represented with fixed point numbers times 128",
"versions": ["1.9", "1.17.1"]
"versions": ["1.9", "1.18.1"]
},
{
"name": "customChannelMCPrefixed",
Expand All @@ -52,12 +52,12 @@
{
"name": "customChannelIdentifier",
"description": "custom channel is an identifier starting in minecraft namespace",
"versions": ["1.13", "1.17.1"]
"versions": ["1.13", "1.18.1"]
},
{
"name": "dimensionDataIsAvailable",
"description": "dimensionData is available, providing an additional information about the current dimension",
"versions": ["1.17", "1.17.1"]
"versions": ["1.17", "1.18.1"]
},
{
"name": "useItemWithBlockPlace",
Expand All @@ -67,7 +67,7 @@
{
"name": "useItemWithOwnPacket",
"description": "use item is done with its own packet",
"versions": ["1.9", "1.17.1"]
"versions": ["1.9", "1.18.1"]
},
{
"name": "blockPlaceHasHeldItem",
Expand All @@ -87,7 +87,7 @@
{
"name": "blockPlaceHasInsideBlock",
"description": "block_place packet has inside block",
"versions": ["1.14", "1.17.1"]
"versions": ["1.14", "1.18.1"]
},
{
"name": "teleportUsesPositionPacket",
Expand All @@ -102,7 +102,7 @@
{
"name": "teleportUsesOwnPacket",
"description": "teleport is done using its own packet",
"versions": ["1.9", "1.17.1"]
"versions": ["1.9", "1.18.1"]
},
{
"name": "oneBlockForSeveralVariations",
Expand All @@ -112,7 +112,7 @@
{
"name": "blockSchemeIsFlat",
"description": "all variations of a packet have their own id",
"versions": ["1.13", "1.17.1"]
"versions": ["1.13", "1.18.1"]
},
{
"name": "tabCompleteHasNoToolTip",
Expand All @@ -122,7 +122,7 @@
{
"name": "tabCompleteHasAToolTip",
"description": "tab complete has a tool tip",
"versions": ["1.13", "1.17.1"]
"versions": ["1.13", "1.18.1"]
},
{
"name": "effectAreMinecraftPrefixed",
Expand All @@ -132,7 +132,7 @@
{
"name": "effectAreNotPrefixed",
"description": "effect are not prefixed",
"versions": ["1.13", "1.17.1"]
"versions": ["1.13", "1.18.1"]
},
{
"name": "itemsAreAlsoBlocks",
Expand All @@ -142,12 +142,12 @@
{
"name": "itemsAreNotBlocks",
"description": "items are not block",
"versions": ["1.13", "1.17.1"]
"versions": ["1.13", "1.18.1"]
},
{
"name": "fishingBobberCorrectlyNamed",
"description": "the fishing hook entity is named fishing_bobber",
"versions": ["1.14", "1.17.1"]
"versions": ["1.14", "1.18.1"]
},
{
"name": "editBookIsPluginChannel",
Expand All @@ -157,7 +157,7 @@
{
"name": "hasEditBookPacket",
"description": "book editing is handled through a packet",
"versions": ["1.13", "1.17.1"]
"versions": ["1.13", "1.18.1"]
},
{
"name": "clientUpdateBookIdWhenSign",
Expand Down Expand Up @@ -197,12 +197,12 @@
{
"name": "dimensionIsAWorld",
"description": "description is a world name (string)",
"versions": ["1.16.2", "1.17.1"]
"versions": ["1.16.2", "1.18.1"]
},
{
"name": "dimensionDataIsAvailable",
"description": "dimensionData is available, describing additional dimension information",
"versions": ["1.17", "1.17.1"]
"versions": ["1.17", "1.18.1"]
},
{
"name": "doesntHaveChestType",
Expand All @@ -227,22 +227,22 @@
{
"name": "hasAttackCooldown",
"description": "if there is a cooldown after attacks to deal full damage",
"versions": ["1.9", "1.17.1"]
"versions": ["1.9", "1.18.1"]
},
{
"name": "usesLoginPacket",
"description": "uses the login packet as defined in mcData",
"versions": ["1.16", "1.17.1"]
"versions": ["1.16", "1.18.1"]
},
{
"name": "usesMultiblockSingleLong",
"description": "in the multi_block_change packet is stored as a single number",
"versions": ["1.16.2", "1.17.1"]
"versions": ["1.16.2", "1.18.1"]
},
{
"name": "usesMultiblock3DChunkCoords",
"description": "in the multi_block_change packet, all 3 axis coords are defined",
"versions": ["1.16.2", "1.17.1"]
"versions": ["1.16.2", "1.18.1"]
},
{
"name": "setBlockUsesMetadataNumber",
Expand All @@ -257,7 +257,7 @@
{
"name": "selectingTradeMovesItems",
"description": "selecting a trade automatically puts the required items into trading slots",
"versions": ["1.14", "1.17.1"]
"versions": ["1.14", "1.18.1"]
},
{
"name": "resourcePackUsesHash",
Expand All @@ -272,7 +272,7 @@
{
"name": "teamUsesChatComponents",
"description": "teams use chatcomponents for formatting",
"versions": ["1.13", "1.17.1"]
"versions": ["1.13", "1.18.1"]
},
{
"name": "teamUsesScoreboard",
Expand All @@ -287,7 +287,7 @@
{
"name": "enderCrystalNameNoCapsWithUnderscore",
"description": "this is when the end_crystal's entity name is end_crystal",
"versions": ["1.14", "1.17.1"]
"versions": ["1.14", "1.18.1"]
},
{
"name": "entityNameUpperCaseNoUnderscore",
Expand All @@ -307,7 +307,7 @@
{
"name": "stateIdUsed",
"description": "starting in 1.17.1, actionId has been replaced with stateId",
"versions": ["1.17.1", "1.17.1"]
"versions": ["1.17.1", "1.18.1"]
},
{
"name": "actionIdUsed",
Expand All @@ -317,11 +317,16 @@
{
"name": "setSlotAsTransaction",
"description": "use setslot as transaction instead of just hoping it'll work",
"versions": ["1.17", "1.17.1"]
"versions": ["1.17", "1.18.1"]
},
{
"name": "armAnimationBeforeUse",
"description": "arm animation packet sent before use entity packet",
"versions": ["1.8", "1.8.9"]
},
{
"name": "tallWorld",
"description": "world starts at -64 and ends at 384",
"versions": ["1.18", "1.18.1"]
}
]
2 changes: 1 addition & 1 deletion lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function createBot (options = {}) {
options.username = options.username ?? 'Player'
options.version = options.version ?? false
options.plugins = options.plugins ?? {}
options.hideErrors = options.hideErrors ?? true
options.hideErrors = options.hideErrors ?? false
options.logErrors = options.logErrors ?? true
options.loadInternalPlugins = options.loadInternalPlugins ?? true
options.client = options.client ?? null
Expand Down
Loading

0 comments on commit 694bee6

Please sign in to comment.