Skip to content

Commit

Permalink
add dog label filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mstop4 committed Nov 15, 2024
1 parent 7c08b69 commit 65cf4d0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/components/objects/gui.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const allLabelFilters: Record<string, string> = {
brewingStand: 'Brewing',
enderChests: 'Ender Chest',
cherryTrees: 'Cherry Trees',
dogs: 'Tamed Wolves',
cats: 'Tamed Cats',
};

export const allCameraPositionsKeys: Record<string, string> = {
Expand All @@ -51,6 +53,7 @@ const labelFiltersAvailable: Record<string, string[]> = {
'brewingStand',
'enderChests',
'cherryTrees',
'dogs',
],
};

Expand Down
9 changes: 7 additions & 2 deletions src/components/objects/gui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function updateLabelFolder(worldId: string) {

labelFolder
.add(options, 'labelFilter', Object.values(activeLabelFilters[worldId]))
.name('Filter Amenities')
.name('Filter')
.onChange(changeLabelFilter);
}

Expand Down Expand Up @@ -74,7 +74,7 @@ export function setupGUI() {
'labelFilter',
Object.values(activeLabelFilters[startingWorldKey]),
)
.name('Filter Amenities')
.name('Filter')
.onChange(changeLabelFilter);

const showHideFolder = gui.addFolder('Show/Hide');
Expand Down Expand Up @@ -218,6 +218,11 @@ function changeLabelFilter() {
label.element.classList.add('portalLabel-filtered');
break;

case allLabelFilters.dogs:
if (!label.userData.dogs)
label.element.classList.add('portalLabel-filtered');
break;

case allLabelFilters.none:
default:
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/objects/mapObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ export function createPortal(
hasEnchantingTable,
hasFood,
hasLava,
dogs,
cats,
} = portalData;

// Create portal marker
Expand All @@ -290,6 +292,9 @@ export function createPortal(
portalLabel.userData.lava = hasLava;
portalLabel.userData.enderChest = hasEnderChest;
portalLabel.userData.cherryTree = hasCherryTree;
portalLabel.userData.dogs = dogs > 0;
portalLabel.userData.cats = cats > 0;

world.portalLabels.push(portalLabel);

portalLabel.position.set(
Expand Down
4 changes: 2 additions & 2 deletions src/data/chocolateBnuuy/bases.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"hasSmithing": false,
"hasBrewingStand": false,
"hasEnchantingTable": false,
"hasFood": false,
"hasFood": true,
"hasLava": false,
"hasEnderChest": true,
"hasCherryTree": false,
Expand Down Expand Up @@ -179,7 +179,7 @@
"hasSmithing": true,
"hasBrewingStand": false,
"hasEnchantingTable": false,
"hasFood": false,
"hasFood": true,
"hasLava": false,
"hasEnderChest": true,
"hasCherryTree": false,
Expand Down
2 changes: 2 additions & 0 deletions src/data/data.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@ export type BaseData = {
hasEnchantingTable: boolean;
hasFood: boolean;
hasLava: boolean;
dogs: number;
cats: number;
};

0 comments on commit 65cf4d0

Please sign in to comment.