fix: remove average_colors.json
This commit is contained in:
parent
7f52cabfbd
commit
efd32a830b
7 changed files with 1684 additions and 1169 deletions
|
|
@ -4,7 +4,7 @@ import * as PIXI from "pixi.js";
|
|||
import { useApp } from "@pixi/react";
|
||||
import { CompositeTilemap, settings } from "@pixi/tilemap";
|
||||
|
||||
import blocksData from "@/data/blocks/programmer-art/average_colors.json";
|
||||
import blocksData from "@/data/blocks/programmer-art/data.json";
|
||||
|
||||
interface Props {
|
||||
blocks: Block[];
|
||||
|
|
@ -68,8 +68,10 @@ function Blocks({ blocks, setBlocks, textures, image, imageDimensions, coords, s
|
|||
let closestBlock = "";
|
||||
let closestDistance = Infinity;
|
||||
|
||||
Object.entries(blocksData).forEach(([block, rgba]) => {
|
||||
const distance = Math.sqrt(Math.pow(r - rgba[0], 2) + Math.pow(g - rgba[1], 2) + Math.pow(b - rgba[2], 2) + Math.pow(a - rgba[3], 3));
|
||||
Object.entries(blocksData).forEach(([block, data]) => {
|
||||
const distance = Math.sqrt(
|
||||
Math.pow(r - data.color[0], 2) + Math.pow(g - data.color[1], 2) + Math.pow(b - data.color[2], 2) + Math.pow(a - data.color[3], 3)
|
||||
);
|
||||
if (distance < closestDistance) {
|
||||
closestDistance = distance;
|
||||
closestBlock = block;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { CanvasContext } from "@/context/Canvas";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
|
||||
import _blockData from "@/data/blocks/data.json";
|
||||
import _blockData from "@/data/blocks/programmer-art/data.json";
|
||||
const blockData: BlockData = _blockData;
|
||||
|
||||
interface Props {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTit
|
|||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
|
||||
import _blockData from "@/data/blocks/data.json";
|
||||
import _blockData from "@/data/blocks/programmer-art/data.json";
|
||||
const blockData: BlockData = _blockData;
|
||||
|
||||
function SaveLitematic({ close }: DialogProps) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
1676
src/data/blocks/programmer-art/data.json
Normal file
1676
src/data/blocks/programmer-art/data.json
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue