Skip to content

Commit 2b72576

Browse files
committed
remove wall aabb calculation from blocks side
1 parent e956889 commit 2b72576

File tree

1 file changed

+0
-101
lines changed

1 file changed

+0
-101
lines changed

lib/plugins/blocks.js

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -239,101 +239,6 @@ function inject(bot, {version, storageBuilder, hideErrors}) {
239239
delColumn(packet.chunkX, packet.chunkZ)
240240
})
241241

242-
const wallIds = new Set([
243-
'cobblestone_wall'
244-
])
245-
246-
const stairIds = new Set([
247-
'oak_stairs',
248-
'stone_stairs',
249-
'brick_stairs',
250-
'stone_brick_stairs',
251-
'nether_brick_stairs',
252-
'sandstone_stairs',
253-
'spruce_stairs',
254-
'birch_stairs',
255-
'jungle_stairs',
256-
'quartz_stairs',
257-
'acacia_stairs',
258-
'dark_oak_stairs',
259-
'red_sandstone_stairs',
260-
'purpur_stairs',
261-
])
262-
263-
const CARDINAL_NOMENCLATURE = [
264-
'north',
265-
'east',
266-
'south',
267-
'west'
268-
]
269-
270-
const CARDINAL = [
271-
// north -z
272-
new Vec3(0, 0, -1),
273-
// east +x
274-
new Vec3(1, 0, 0),
275-
// south +z
276-
new Vec3(0, 0, 1),
277-
// west -x
278-
new Vec3(-1, 0, 0)
279-
]
280-
281-
function updateWallBB(connectDirection, boundingBox, isAddingWall) {
282-
// either we do or undo the connection operation
283-
if (isAddingWall) {
284-
switch (connectDirection) {
285-
case 0: // north
286-
boundingBox[0][2] = 0.0
287-
break
288-
case 1: // east
289-
boundingBox[0][3] = 1.0
290-
break
291-
case 2: // south
292-
boundingBox[0][5] = 1.0
293-
break
294-
case 3: // west
295-
boundingBox[0][0] = 0.0
296-
break
297-
}
298-
} else {
299-
switch (connectDirection) {
300-
case 0: // north
301-
boundingBox[0][2] = 0.25
302-
break
303-
case 1: // east
304-
boundingBox[0][3] = 0.75
305-
break
306-
case 2: // south
307-
boundingBox[0][5] = 0.75
308-
break
309-
case 3: // west
310-
boundingBox[0][0] = 0.25
311-
break
312-
}
313-
}
314-
}
315-
316-
function computeWallBB(block, wallRemoved) {
317-
const baseBoundingBox = [[0.25, 0.0, 0.25, 0.75, 1.5, 0.75]]
318-
319-
// check north, east, south, west for neighboring walls to connect to
320-
for (let i = 0; i < CARDINAL.length; i++) {
321-
// update the wall properties and the bounding box
322-
const neighborBlock = bot.blockAt(block.position.plus(CARDINAL[i]))
323-
if (!neighborBlock || !wallIds.has(neighborBlock.name)) {
324-
continue
325-
}
326-
const opposingState = (i + 2) % 4
327-
const clonedBB = [[...neighborBlock.shapes[0]]]
328-
updateWallBB(opposingState, clonedBB, !wallRemoved)
329-
neighborBlock.shapes = clonedBB
330-
if (!wallRemoved) updateWallBB(i, baseBoundingBox, !wallRemoved)
331-
}
332-
if (!wallRemoved) {
333-
block.shapes = baseBoundingBox
334-
}
335-
}
336-
337242
function updateBlockState(point, stateId) {
338243
const oldBlock = blockAt(point)
339244
bot.world.setBlockStateId(point, stateId)
@@ -348,12 +253,6 @@ function inject(bot, {version, storageBuilder, hideErrors}) {
348253
const pos = point.floored()
349254
const painting = paintingsByPos[pos]
350255
if (painting) deletePainting(painting)
351-
352-
// in 1.8.9, seems like these states are not sent from server and must be computed on client side
353-
if (wallIds.has(newBlock.name) || (oldBlock && wallIds.has(oldBlock.name))) {
354-
const wallRemoved = !wallIds.has(newBlock.name)
355-
computeWallBB(newBlock, wallRemoved)
356-
}
357256
}
358257

359258
bot._client.on('update_light', (packet) => {

0 commit comments

Comments
 (0)