use of cn.nukkit.math.AxisAlignedBB in project Nukkit by Nukkit.
the class BlockDoor method recalculateBoundingBox.
@Override
protected AxisAlignedBB recalculateBoundingBox() {
double f = 0.1875;
int damage = this.getFullDamage();
AxisAlignedBB bb = new SimpleAxisAlignedBB(this.x, this.y, this.z, this.x + 1, this.y + 2, this.z + 1);
int j = damage & 0x03;
boolean isOpen = ((damage & 0x04) > 0);
boolean isRight = ((damage & 0x10) > 0);
if (j == 0) {
if (isOpen) {
if (!isRight) {
bb.setBounds(this.x, this.y, this.z, this.x + 1, this.y + 1, this.z + f);
} else {
bb.setBounds(this.x, this.y, this.z + 1 - f, this.x + 1, this.y + 1, this.z + 1);
}
} else {
bb.setBounds(this.x, this.y, this.z, this.x + f, this.y + 1, this.z + 1);
}
} else if (j == 1) {
if (isOpen) {
if (!isRight) {
bb.setBounds(this.x + 1 - f, this.y, this.z, this.x + 1, this.y + 1, this.z + 1);
} else {
bb.setBounds(this.x, this.y, this.z, this.x + f, this.y + 1, this.z + 1);
}
} else {
bb.setBounds(this.x, this.y, this.z, this.x + 1, this.y + 1, this.z + f);
}
} else if (j == 2) {
if (isOpen) {
if (!isRight) {
bb.setBounds(this.x, this.y, this.z + 1 - f, this.x + 1, this.y + 1, this.z + 1);
} else {
bb.setBounds(this.x, this.y, this.z, this.x + 1, this.y + 1, this.z + f);
}
} else {
bb.setBounds(this.x + 1 - f, this.y, this.z, this.x + 1, this.y + 1, this.z + 1);
}
} else if (j == 3) {
if (isOpen) {
if (!isRight) {
bb.setBounds(this.x, this.y, this.z, this.x + f, this.y + 1, this.z + 1);
} else {
bb.setBounds(this.x + 1 - f, this.y, this.z, this.x + 1, this.y + 1, this.z + 1);
}
} else {
bb.setBounds(this.x, this.y, this.z + 1 - f, this.x + 1, this.y + 1, this.z + 1);
}
}
return bb;
}
Aggregations