refactor: fix spelling mistakes

This commit is contained in:
trafficlunar 2025-01-07 20:08:39 +00:00
parent 26fb017d2d
commit 46648d92da
2 changed files with 9 additions and 9 deletions

View file

@ -40,8 +40,8 @@ function SaveLitematic({ close }: DialogProps) {
} }
} }
// Generate the block pallete // Generate the block palette
const blockStatePallete = [ const blockStatePalette = [
{ Name: "minecraft:air" }, { Name: "minecraft:air" },
...Array.from( ...Array.from(
new Set( new Set(
@ -61,14 +61,14 @@ function SaveLitematic({ close }: DialogProps) {
]; ];
// Get the block states // Get the block states
const requiredBits = Math.max(Math.ceil(Math.log2(blockStatePallete.length)), 2); const requiredBits = Math.max(Math.ceil(Math.log2(blockStatePalette.length)), 2);
const blockStates = new BigInt64Array(Math.ceil((filledBlocks.length * requiredBits) / 64)); const blockStates = new BigInt64Array(Math.ceil((filledBlocks.length * requiredBits) / 64));
filledBlocks.forEach((block) => { filledBlocks.forEach((block) => {
const blockInfo = blockData[block.name.replace("minecraft:", "")]; const blockInfo = blockData[block.name.replace("minecraft:", "")];
const blockName = blockInfo ? blockInfo.id[0].toString() : block.name; const blockName = blockInfo ? blockInfo.id[0].toString() : block.name;
const blockId = blockStatePallete.findIndex((entry) => entry.Name === `minecraft:${blockName}`); const blockId = blockStatePalette.findIndex((entry) => entry.Name === `minecraft:${blockName}`);
const reversedY = height - 1 - block.y; const reversedY = height - 1 - block.y;
const index = reversedY * width + block.x; const index = reversedY * width + block.x;
@ -122,7 +122,7 @@ function SaveLitematic({ close }: DialogProps) {
z: new nbt.Int32(1), z: new nbt.Int32(1),
}, },
BlockStates: blockStates, BlockStates: blockStates,
BlockStatePalette: blockStatePallete, BlockStatePalette: blockStatePalette,
TileEntities: [], TileEntities: [],
Entities: [], Entities: [],
PendingBlockTicks: [], PendingBlockTicks: [],

View file

@ -48,8 +48,8 @@ function SaveLitematic({ close }: DialogProps) {
return a.x - b.x; return a.x - b.x;
}); });
// Generate the block pallete // Generate the block palette
const blockPallete = Array.from( const blockPalette = Array.from(
new Set( new Set(
filledBlocks.map((block) => { filledBlocks.map((block) => {
const blockInfo = blockData[block.name.replace("minecraft:", "")]; const blockInfo = blockData[block.name.replace("minecraft:", "")];
@ -78,7 +78,7 @@ function SaveLitematic({ close }: DialogProps) {
.map(([key, value]) => `${key}=${value}`) .map(([key, value]) => `${key}=${value}`)
.join(",")}]` .join(",")}]`
: ""; : "";
const blockId = blockPallete[`minecraft:${blockName}${properties}`]; const blockId = blockPalette[`minecraft:${blockName}${properties}`];
blockPlaceData[index] = parseInt(blockId.toString()); blockPlaceData[index] = parseInt(blockId.toString());
}); });
@ -96,7 +96,7 @@ function SaveLitematic({ close }: DialogProps) {
}, },
Blocks: { Blocks: {
Data: blockPlaceData, Data: blockPlaceData,
Palette: blockPallete, Palette: blockPalette,
}, },
}, },
}; };