Skip to content

Commit

Permalink
Change to getComponentValue (#2549)
Browse files Browse the repository at this point in the history
  • Loading branch information
bob0005 authored Dec 17, 2024
1 parent 7e4dbf8 commit ea6a352
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/src/ui/components/resources/EntityResourceTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { BuildingType, CapacityConfigCategory, ID, RESOURCE_TIERS, StructureType
import { useComponentValue } from "@dojoengine/react";
import { useMemo } from "react";
import { ResourceChip } from "./ResourceChip";
import { getComponentValue } from "@dojoengine/recs";

export const EntityResourceTable = ({ entityId }: { entityId: ID | undefined }) => {
const dojo = useDojo();
Expand All @@ -19,8 +20,7 @@ export const EntityResourceTable = ({ entityId }: { entityId: ID | undefined })
getEntityIdFromKeys([BigInt(entityId || 0), BigInt(BuildingType.Storehouse)]),
)?.value || 0;

const { getStructureByEntityId } = useStructures();
const structure = getStructureByEntityId(entityId || 0);
const structure = getComponentValue(dojo.setup.components.Structure, getEntityIdFromKeys([BigInt(entityId || 0)]));

const maxStorehouseCapacityKg = useMemo(() => {
if (structure?.category === StructureType[StructureType.FragmentMine]) return Infinity;
Expand Down

0 comments on commit ea6a352

Please sign in to comment.