implement packet compression, implement player controller, implement join server authentication, add cobblestone, implement chunk provider, implement block position, implement session, implement movement, chunk, chat and block update packets, version 1.1.5
This commit is contained in:
@@ -49,7 +49,12 @@ export default class Block {
|
||||
|
||||
shouldRenderFace(world, x, y, z, face) {
|
||||
let typeId = world.getBlockAtFace(x, y, z, face);
|
||||
return typeId === 0 || Block.getById(typeId).isTranslucent();
|
||||
if (typeId === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let block = Block.getById(typeId);
|
||||
return block === null || block.isTranslucent();
|
||||
}
|
||||
|
||||
getColor(world, x, y, z, face) {
|
||||
@@ -208,7 +213,8 @@ export default class Block {
|
||||
}
|
||||
|
||||
static getById(typeId) {
|
||||
return Block.blocks.get(typeId);
|
||||
let block = Block.blocks.get(typeId);
|
||||
return typeof block === "undefined" ? null : block;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import BlockBedrock from "./type/BlockBedrock.js";
|
||||
import BlockGlass from "./type/BlockGlass.js";
|
||||
import SoundGlass from "./sound/SoundGlass.js";
|
||||
import BlockGravel from "./type/BlockGravel.js";
|
||||
import BlockCobblestone from "./type/BlockCobblestone.js";
|
||||
|
||||
export class BlockRegistry {
|
||||
|
||||
@@ -30,6 +31,7 @@ export class BlockRegistry {
|
||||
BlockRegistry.STONE = new BlockStone(1, 0);
|
||||
BlockRegistry.GRASS = new BlockGrass(2, 1);
|
||||
BlockRegistry.DIRT = new BlockDirt(3, 2);
|
||||
BlockRegistry.COBBLE_STONE = new BlockCobblestone(4, 14);
|
||||
BlockRegistry.WOOD = new BlockWood(5, 10);
|
||||
BlockRegistry.BEDROCK = new BlockBedrock(7, 11);
|
||||
BlockRegistry.GRAVEL = new BlockGravel(13, 13);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import Block from "../Block.js";
|
||||
|
||||
export default class BlockCobblestone extends Block {
|
||||
|
||||
constructor(id, textureSlotId) {
|
||||
super(id, textureSlotId);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user