-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
34 changed files
with
19,745 additions
and
1,583 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 +1,6 @@ | ||
{ | ||
"dependencies": { | ||
"@minecraft/server": "^1.2.0-beta.1.19.80-preview.24", | ||
"@minecraft/server-gametest": "^1.0.0-beta.1.19.80-preview.24" | ||
"@minecraft/server": "^1.4.0-beta.1.20.10-preview.21", | ||
"@minecraft/server-gametest": "^1.0.0-beta.1.20.10-preview.21" | ||
} | ||
} |
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,15 +1,15 @@ | ||
import QRMode from './QRMode.js'; | ||
export default class QR8bitByte { | ||
constructor(data) { | ||
this.mode = QRMode.MODE_8BIT_BYTE; | ||
this.data = data; | ||
} | ||
getLength() { | ||
return this.data.length; | ||
} | ||
write(buffer) { | ||
for (var i = 0; i < this.data.length; i++) { | ||
buffer.put(this.data.charCodeAt(i), 8); | ||
} | ||
} | ||
} | ||
import QRMode from './QRMode.js'; | ||
export default class QR8bitByte { | ||
constructor(data) { | ||
this.mode = QRMode.MODE_8BIT_BYTE; | ||
this.data = data; | ||
} | ||
getLength() { | ||
return this.data.length; | ||
} | ||
write(buffer) { | ||
for (var i = 0; i < this.data.length; i++) { | ||
buffer.put(this.data.charCodeAt(i), 8); | ||
} | ||
} | ||
} |
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,28 +1,28 @@ | ||
export default class QRBitBuffer { | ||
constructor() { | ||
this.buffer = []; | ||
this.length = 0; | ||
} | ||
get(index) { | ||
var bufIndex = Math.floor(index / 8); | ||
return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1; | ||
} | ||
put(num, length) { | ||
for (var i = 0; i < length; i++) { | ||
this.putBit(((num >>> (length - i - 1)) & 1) == 1); | ||
} | ||
} | ||
getLengthInBits() { | ||
return this.length; | ||
} | ||
putBit(bit) { | ||
var bufIndex = Math.floor(this.length / 8); | ||
if (this.buffer.length <= bufIndex) { | ||
this.buffer.push(0); | ||
} | ||
if (bit) { | ||
this.buffer[bufIndex] |= (0x80 >>> (this.length % 8)); | ||
} | ||
this.length++; | ||
} | ||
} | ||
export default class QRBitBuffer { | ||
constructor() { | ||
this.buffer = []; | ||
this.length = 0; | ||
} | ||
get(index) { | ||
var bufIndex = Math.floor(index / 8); | ||
return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1; | ||
} | ||
put(num, length) { | ||
for (var i = 0; i < length; i++) { | ||
this.putBit(((num >>> (length - i - 1)) & 1) == 1); | ||
} | ||
} | ||
getLengthInBits() { | ||
return this.length; | ||
} | ||
putBit(bit) { | ||
var bufIndex = Math.floor(this.length / 8); | ||
if (this.buffer.length <= bufIndex) { | ||
this.buffer.push(0); | ||
} | ||
if (bit) { | ||
this.buffer[bufIndex] |= (0x80 >>> (this.length % 8)); | ||
} | ||
this.length++; | ||
} | ||
} |
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,7 +1,7 @@ | ||
const QRErrorCorrectLevel = { | ||
L: 1, | ||
M: 0, | ||
Q: 3, | ||
H: 2 | ||
}; | ||
export default QRErrorCorrectLevel; | ||
const QRErrorCorrectLevel = { | ||
L: 1, | ||
M: 0, | ||
Q: 3, | ||
H: 2 | ||
}; | ||
export default QRErrorCorrectLevel; |
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,11 +1,11 @@ | ||
const QRMaskPattern = { | ||
PATTERN000: 0, | ||
PATTERN001: 1, | ||
PATTERN010: 2, | ||
PATTERN011: 3, | ||
PATTERN100: 4, | ||
PATTERN101: 5, | ||
PATTERN110: 6, | ||
PATTERN111: 7 | ||
}; | ||
export default QRMaskPattern; | ||
const QRMaskPattern = { | ||
PATTERN000: 0, | ||
PATTERN001: 1, | ||
PATTERN010: 2, | ||
PATTERN011: 3, | ||
PATTERN100: 4, | ||
PATTERN101: 5, | ||
PATTERN110: 6, | ||
PATTERN111: 7 | ||
}; | ||
export default QRMaskPattern; |
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,32 +1,32 @@ | ||
let QRMath = { | ||
glog: function (n) { | ||
if (n < 1) { | ||
throw new Error("glog(" + n + ")"); | ||
} | ||
return QRMath.LOG_TABLE[n]; | ||
}, | ||
gexp: function (n) { | ||
while (n < 0) { | ||
n += 255; | ||
} | ||
while (n >= 256) { | ||
n -= 255; | ||
} | ||
return QRMath.EXP_TABLE[n]; | ||
}, | ||
EXP_TABLE: new Array(256), | ||
LOG_TABLE: new Array(256) | ||
}; | ||
for (let i = 0; i < 8; i++) { | ||
QRMath.EXP_TABLE[i] = 1 << i; | ||
} | ||
for (let i = 8; i < 256; i++) { | ||
QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] | ||
^ QRMath.EXP_TABLE[i - 5] | ||
^ QRMath.EXP_TABLE[i - 6] | ||
^ QRMath.EXP_TABLE[i - 8]; | ||
} | ||
for (let i = 0; i < 255; i++) { | ||
QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; | ||
} | ||
export default QRMath; | ||
let QRMath = { | ||
glog: function (n) { | ||
if (n < 1) { | ||
throw new Error("glog(" + n + ")"); | ||
} | ||
return QRMath.LOG_TABLE[n]; | ||
}, | ||
gexp: function (n) { | ||
while (n < 0) { | ||
n += 255; | ||
} | ||
while (n >= 256) { | ||
n -= 255; | ||
} | ||
return QRMath.EXP_TABLE[n]; | ||
}, | ||
EXP_TABLE: new Array(256), | ||
LOG_TABLE: new Array(256) | ||
}; | ||
for (let i = 0; i < 8; i++) { | ||
QRMath.EXP_TABLE[i] = 1 << i; | ||
} | ||
for (let i = 8; i < 256; i++) { | ||
QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] | ||
^ QRMath.EXP_TABLE[i - 5] | ||
^ QRMath.EXP_TABLE[i - 6] | ||
^ QRMath.EXP_TABLE[i - 8]; | ||
} | ||
for (let i = 0; i < 255; i++) { | ||
QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; | ||
} | ||
export default QRMath; |
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,7 +1,7 @@ | ||
const QRMode = { | ||
MODE_NUMBER: 1 << 0, | ||
MODE_ALPHA_NUM: 1 << 1, | ||
MODE_8BIT_BYTE: 1 << 2, | ||
MODE_KANJI: 1 << 3 | ||
}; | ||
export default QRMode; | ||
const QRMode = { | ||
MODE_NUMBER: 1 << 0, | ||
MODE_ALPHA_NUM: 1 << 1, | ||
MODE_8BIT_BYTE: 1 << 2, | ||
MODE_KANJI: 1 << 3 | ||
}; | ||
export default QRMode; |
Oops, something went wrong.