#How to detect double chests positions?

1 messages · Page 1 of 1 (latest)

fierce elk
#
if (block.typeId == `minecraft:double_chest`) {
}

then check its 4 neighbor blocks from +-x and +-z

#
  1. check if the block's id is double chest
  2. check for neighbor blocks
  3. check if the neighbor block is also double chest
  4. check the inventory of both block if they are the same
arctic ermine
#

oh damn didnt know minecraft:double_chest was a thing

arctic ermine
#

how do i check if the inventory of the 2 chests are the same? i tried using if chest.getComponent('inventory').container.getItem(i) == chest2.getComponent('inventory').container.getItem(i) inside of a for(i = 0; i < ....) {} but it got me confused

#
let i = 0
let stop = false
if (!stop) {
 for(i = 0; i < chest.getComponent('inventory').container.size; i++) {
  if (chest.getComponent('inventory').container.getItem(i) == chest2.getComponent('inventory').container.getItem(i)) {
    if (i == chest.getComponent('inventory').container.size) {
     //do something
    }
  }else{
      stop = true
  }
 }
}```
#

also minecraft:double_chest aint a thing

fierce elk
arctic ermine
#

That’s what I did but like still if there are 2 big chests near each other it won’t work well

#

But it’s alright

fierce elk