convert classes to es6
(cherry picked from commit e7615d49a4071fe5b5f192884f142c9f3385211a)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
window.BlockRenderType = class {
|
||||
export default class BlockRenderType {
|
||||
static BLOCK = 0;
|
||||
static TORCH = 1;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
window.BoundingBox = class {
|
||||
export default class BoundingBox {
|
||||
|
||||
/**
|
||||
* Bounding box
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
window.EnumBlockFace = class {
|
||||
export default class EnumBlockFace {
|
||||
|
||||
static TOP = new EnumBlockFace(0, 1, 0);
|
||||
static BOTTOM = new EnumBlockFace(0, -1, 0);
|
||||
static NORTH = new EnumBlockFace(0, 0, -1);
|
||||
static EAST = new EnumBlockFace(1, 0, 0);
|
||||
static SOUTH = new EnumBlockFace(0, 0, 1);
|
||||
static WEST = new EnumBlockFace(-1, 0, 0);
|
||||
|
||||
constructor(x, y, z) {
|
||||
this.x = x;
|
||||
@@ -47,24 +54,11 @@ window.EnumBlockFace = class {
|
||||
return null;
|
||||
}
|
||||
|
||||
static values() {
|
||||
return [
|
||||
EnumBlockFace.TOP,
|
||||
EnumBlockFace.BOTTOM,
|
||||
EnumBlockFace.NORTH,
|
||||
EnumBlockFace.EAST,
|
||||
EnumBlockFace.SOUTH,
|
||||
EnumBlockFace.WEST
|
||||
];
|
||||
equals(other) {
|
||||
return this.x === other.x && this.y === other.y && this.z === other.z;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
let c = window.EnumBlockFace;
|
||||
c.TOP = new EnumBlockFace(0, 1, 0);
|
||||
c.BOTTOM = new EnumBlockFace(0, -1, 0);
|
||||
c.NORTH = new EnumBlockFace(0, 0, -1);
|
||||
c.EAST = new EnumBlockFace(1, 0, 0);
|
||||
c.SOUTH = new EnumBlockFace(0, 0, 1);
|
||||
c.WEST = new EnumBlockFace(-1, 0, 0);
|
||||
}
|
||||
static values() {
|
||||
return [EnumBlockFace.TOP, EnumBlockFace.BOTTOM, EnumBlockFace.NORTH, EnumBlockFace.EAST, EnumBlockFace.SOUTH, EnumBlockFace.WEST];
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
window.EnumSkyBlock = class {
|
||||
export default class EnumSkyBlock {
|
||||
static SKY = 0;
|
||||
static BLOCK = 1;
|
||||
}
|
||||
@@ -1,17 +1,14 @@
|
||||
window.Keyboard = class {
|
||||
export default class Keyboard {
|
||||
|
||||
static state = {};
|
||||
|
||||
static create() {
|
||||
window.addEventListener('keydown', function (event) {
|
||||
//event.preventDefault();
|
||||
Keyboard.state[event.code] = true;
|
||||
//console.log("Key " + event.code + " down");
|
||||
});
|
||||
window.addEventListener('keyup', function (event) {
|
||||
event.preventDefault();
|
||||
delete Keyboard.state[event.code];
|
||||
//console.log("Key " + event.code + " up");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.MathHelper = class {
|
||||
export default class MathHelper {
|
||||
|
||||
/**
|
||||
* Returns the greatest integer less than or equal to the double argument
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
window.MetadataChunkBlock = class {
|
||||
import Block from "../client/world/block/Block.js";
|
||||
import EnumSkyBlock from "./EnumSkyBlock.js";
|
||||
import World from "../client/world/World.js";
|
||||
|
||||
export default class MetadataChunkBlock {
|
||||
|
||||
constructor(type, x1, y1, z1, x2, y2, z2) {
|
||||
this.type = type;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.MovingObjectPosition = class {
|
||||
export default class MovingObjectPosition {
|
||||
|
||||
constructor(vector, face, x, y, z) {
|
||||
this.vector = vector;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.Random = class {
|
||||
export default class Random {
|
||||
|
||||
static instances = 0;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.Timer = class {
|
||||
export default class Timer {
|
||||
|
||||
static MS_PER_SECOND = 1000;
|
||||
static MAX_MS_PER_UPDATE = 1000;
|
||||
@@ -63,4 +63,4 @@ window.Timer = class {
|
||||
this.passedTime -= this.ticks;
|
||||
this.partialTicks = this.passedTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
window.Vector3 = class {
|
||||
export default class Vector3 {
|
||||
|
||||
constructor(x = 0, y = 0, z = 0) {
|
||||
this.x = x;
|
||||
|
||||
Reference in New Issue
Block a user