Skip to content

Commit 33b313b

Browse files
committed
improved filters
1 parent 9ca9e98 commit 33b313b

File tree

6 files changed

+156
-66
lines changed

6 files changed

+156
-66
lines changed

src/components/objects/gui.config.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ export const allLabelFilters: Record<string, string> = {
2424
smithing: 'Smithing',
2525
enchantingTable: 'Enchanting',
2626
brewingStand: 'Brewing',
27-
enderChests: 'Ender Chest',
28-
cherryTrees: 'Cherry Trees',
27+
enderChest: 'Ender Chest',
28+
cherryTree: 'Cherry Trees',
29+
village: 'Villages',
30+
ancientCity: 'Ancient Cities',
31+
trialChamber: 'Trial Chambers',
32+
stronghold: 'Strongholds',
33+
igloo: 'Igloos',
34+
mineshaft: 'Mineshafts',
2935
dogs: 'Tamed Wolves',
3036
cats: 'Tamed Cats',
3137
};
@@ -40,7 +46,7 @@ export const allCameraPositionsKeys: Record<string, string> = {
4046

4147
export const colourModesAvailable = ['default', 'cbf', 'ext', 'nat'];
4248
const labelFiltersAvailable: Record<string, string[]> = {
43-
bunnySnek: ['none', 'enderChests', 'cherryTrees'],
49+
bunnySnek: ['none', 'enderChest', 'cherryTree'],
4450
chocolateBnuuy: [
4551
'none',
4652
'bed',
@@ -51,9 +57,16 @@ const labelFiltersAvailable: Record<string, string[]> = {
5157
'smithing',
5258
'enchantingTable',
5359
'brewingStand',
54-
'enderChests',
55-
'cherryTrees',
60+
'enderChest',
61+
'cherryTree',
62+
'village',
63+
'ancientCity',
64+
'trialChamber',
65+
'stronghold',
66+
'igloo',
67+
'mineshaft',
5668
'dogs',
69+
'cats',
5770
],
5871
};
5972

src/components/objects/gui.ts

Lines changed: 11 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -161,71 +161,22 @@ function changeColourMode() {
161161
}
162162
}
163163

164+
function _addFilteredClass(key: string, label: CSS2DObject) {
165+
if (label.userData[key] === false) {
166+
label.element.classList.add('portalLabel-filtered');
167+
}
168+
}
169+
164170
function changeLabelFilter() {
165171
const { portalLabels, roomLabels } = getCurrentWorld();
172+
const filterKey =
173+
Object.keys(allLabelFilters).find(
174+
key => allLabelFilters[key] === options.labelFilter,
175+
) ?? '';
166176

167177
for (const label of portalLabels) {
168178
label.element.className = 'portalLabel';
169-
170-
switch (options.labelFilter) {
171-
case allLabelFilters.enderChests:
172-
if (!label.userData.enderChest)
173-
label.element.classList.add('portalLabel-filtered');
174-
break;
175-
176-
case allLabelFilters.cherryTrees:
177-
if (!label.userData.cherryTree)
178-
label.element.classList.add('portalLabel-filtered');
179-
break;
180-
181-
case allLabelFilters.bed:
182-
if (!label.userData.bed)
183-
label.element.classList.add('portalLabel-filtered');
184-
break;
185-
186-
case allLabelFilters.basicWorkstation:
187-
if (!label.userData.basicWorkstation)
188-
label.element.classList.add('portalLabel-filtered');
189-
break;
190-
191-
case allLabelFilters.storage:
192-
if (!label.userData.storage)
193-
label.element.classList.add('portalLabel-filtered');
194-
break;
195-
196-
case allLabelFilters.food:
197-
if (!label.userData.food)
198-
label.element.classList.add('portalLabel-filtered');
199-
break;
200-
201-
case allLabelFilters.lava:
202-
if (!label.userData.lava)
203-
label.element.classList.add('portalLabel-filtered');
204-
break;
205-
206-
case allLabelFilters.smithing:
207-
if (!label.userData.smithing)
208-
label.element.classList.add('portalLabel-filtered');
209-
break;
210-
211-
case allLabelFilters.enchantingTable:
212-
if (!label.userData.enchantingTable)
213-
label.element.classList.add('portalLabel-filtered');
214-
break;
215-
216-
case allLabelFilters.brewingStand:
217-
if (!label.userData.brewingStand)
218-
label.element.classList.add('portalLabel-filtered');
219-
break;
220-
221-
case allLabelFilters.dogs:
222-
if (!label.userData.dogs)
223-
label.element.classList.add('portalLabel-filtered');
224-
break;
225-
226-
case allLabelFilters.none:
227-
default:
228-
}
179+
_addFilteredClass(filterKey, label);
229180
}
230181

231182
for (const label of roomLabels) {

src/components/objects/mapObjects.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,12 @@ export function createPortal(
265265
hasEnchantingTable,
266266
hasFood,
267267
hasLava,
268+
village,
269+
ancientCity,
270+
trialChamber,
271+
stronghold,
272+
igloo,
273+
mineshaft,
268274
dogs,
269275
cats,
270276
} = portalData;
@@ -292,6 +298,12 @@ export function createPortal(
292298
portalLabel.userData.lava = hasLava;
293299
portalLabel.userData.enderChest = hasEnderChest;
294300
portalLabel.userData.cherryTree = hasCherryTree;
301+
portalLabel.userData.village = village;
302+
portalLabel.userData.ancientCity = ancientCity;
303+
portalLabel.userData.trialChamber = trialChamber;
304+
portalLabel.userData.stronghold = stronghold;
305+
portalLabel.userData.igloo = igloo;
306+
portalLabel.userData.mineshaft = mineshaft;
295307
portalLabel.userData.dogs = dogs > 0;
296308
portalLabel.userData.cats = cats > 0;
297309

src/config/urlParamsHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import dataManifest from '../data/manifest.json';
22

3-
const defaultWorldKey = 'bunnySnek';
3+
const defaultWorldKey = 'chocolateBnuuy';
44
export const startingWorldKey = getStartingWorld();
55

66
function getStartingWorld() {

src/data/chocolateBnuuy/bases.json

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
"hasLava": true,
1414
"hasEnderChest": true,
1515
"hasCherryTree": true,
16+
"village": false,
17+
"ancientCity": false,
18+
"trialChamber": false,
19+
"stronghold": false,
20+
"igloo": false,
21+
"mineshaft": false,
1622
"dogs": 1,
1723
"cats": 0
1824
},
@@ -30,6 +36,12 @@
3036
"hasLava": false,
3137
"hasEnderChest": false,
3238
"hasCherryTree": false,
39+
"village": false,
40+
"ancientCity": false,
41+
"trialChamber": false,
42+
"stronghold": false,
43+
"igloo": false,
44+
"mineshaft": false,
3345
"dogs": 0,
3446
"cats": 0
3547
},
@@ -47,6 +59,12 @@
4759
"hasLava": false,
4860
"hasEnderChest": true,
4961
"hasCherryTree": false,
62+
"village": false,
63+
"ancientCity": true,
64+
"trialChamber": false,
65+
"stronghold": false,
66+
"igloo": false,
67+
"mineshaft": false,
5068
"dogs": 0,
5169
"cats": 0
5270
},
@@ -64,6 +82,12 @@
6482
"hasLava": false,
6583
"hasEnderChest": false,
6684
"hasCherryTree": false,
85+
"village": true,
86+
"ancientCity": false,
87+
"trialChamber": false,
88+
"stronghold": false,
89+
"igloo": false,
90+
"mineshaft": false,
6791
"dogs": 0,
6892
"cats": 0
6993
},
@@ -81,6 +105,12 @@
81105
"hasLava": false,
82106
"hasEnderChest": false,
83107
"hasCherryTree": false,
108+
"village": true,
109+
"ancientCity": false,
110+
"trialChamber": false,
111+
"stronghold": false,
112+
"igloo": false,
113+
"mineshaft": false,
84114
"dogs": 0,
85115
"cats": 0
86116
},
@@ -98,6 +128,12 @@
98128
"hasLava": false,
99129
"hasEnderChest": false,
100130
"hasCherryTree": false,
131+
"village": false,
132+
"ancientCity": false,
133+
"trialChamber": false,
134+
"stronghold": false,
135+
"igloo": false,
136+
"mineshaft": false,
101137
"dogs": 0,
102138
"cats": 0
103139
},
@@ -115,6 +151,12 @@
115151
"hasLava": false,
116152
"hasEnderChest": false,
117153
"hasCherryTree": false,
154+
"village": true,
155+
"ancientCity": false,
156+
"trialChamber": false,
157+
"stronghold": false,
158+
"igloo": false,
159+
"mineshaft": false,
118160
"dogs": 0,
119161
"cats": 0
120162
},
@@ -132,6 +174,12 @@
132174
"hasLava": false,
133175
"hasEnderChest": false,
134176
"hasCherryTree": false,
177+
"village": false,
178+
"ancientCity": false,
179+
"trialChamber": false,
180+
"stronghold": false,
181+
"igloo": true,
182+
"mineshaft": false,
135183
"dogs": 0,
136184
"cats": 0
137185
},
@@ -149,6 +197,12 @@
149197
"hasLava": false,
150198
"hasEnderChest": true,
151199
"hasCherryTree": false,
200+
"village": false,
201+
"ancientCity": false,
202+
"trialChamber": false,
203+
"stronghold": false,
204+
"igloo": false,
205+
"mineshaft": false,
152206
"dogs": 0,
153207
"cats": 0
154208
},
@@ -166,6 +220,12 @@
166220
"hasLava": false,
167221
"hasEnderChest": false,
168222
"hasCherryTree": false,
223+
"village": false,
224+
"ancientCity": false,
225+
"trialChamber": false,
226+
"stronghold": false,
227+
"igloo": false,
228+
"mineshaft": false,
169229
"dogs": 0,
170230
"cats": 0
171231
},
@@ -183,6 +243,12 @@
183243
"hasLava": true,
184244
"hasEnderChest": true,
185245
"hasCherryTree": false,
246+
"village": false,
247+
"ancientCity": false,
248+
"trialChamber": false,
249+
"stronghold": false,
250+
"igloo": false,
251+
"mineshaft": true,
186252
"dogs": 0,
187253
"cats": 0
188254
},
@@ -200,6 +266,12 @@
200266
"hasLava": false,
201267
"hasEnderChest": false,
202268
"hasCherryTree": false,
269+
"village": false,
270+
"ancientCity": false,
271+
"trialChamber": true,
272+
"stronghold": false,
273+
"igloo": false,
274+
"mineshaft": false,
203275
"dogs": 0,
204276
"cats": 0
205277
},
@@ -217,6 +289,12 @@
217289
"hasLava": false,
218290
"hasEnderChest": false,
219291
"hasCherryTree": false,
292+
"village": true,
293+
"ancientCity": false,
294+
"trialChamber": false,
295+
"stronghold": false,
296+
"igloo": false,
297+
"mineshaft": false,
220298
"dogs": 0,
221299
"cats": 0
222300
},
@@ -234,6 +312,12 @@
234312
"hasLava": false,
235313
"hasEnderChest": true,
236314
"hasCherryTree": false,
315+
"village": true,
316+
"ancientCity": false,
317+
"trialChamber": false,
318+
"stronghold": false,
319+
"igloo": false,
320+
"mineshaft": false,
237321
"dogs": 2,
238322
"cats": 0
239323
},
@@ -251,6 +335,12 @@
251335
"hasLava": false,
252336
"hasEnderChest": true,
253337
"hasCherryTree": false,
338+
"village": false,
339+
"ancientCity": false,
340+
"trialChamber": false,
341+
"stronghold": false,
342+
"igloo": false,
343+
"mineshaft": false,
254344
"dogs": 0,
255345
"cats": 0
256346
},
@@ -268,6 +358,12 @@
268358
"hasLava": false,
269359
"hasEnderChest": false,
270360
"hasCherryTree": false,
361+
"village": true,
362+
"ancientCity": false,
363+
"trialChamber": false,
364+
"stronghold": false,
365+
"igloo": false,
366+
"mineshaft": false,
271367
"dogs": 0,
272368
"cats": 0
273369
},
@@ -285,6 +381,12 @@
285381
"hasLava": false,
286382
"hasEnderChest": false,
287383
"hasCherryTree": false,
384+
"village": true,
385+
"ancientCity": false,
386+
"trialChamber": false,
387+
"stronghold": false,
388+
"igloo": false,
389+
"mineshaft": false,
288390
"dogs": 0,
289391
"cats": 0
290392
},
@@ -302,6 +404,12 @@
302404
"hasLava": false,
303405
"hasEnderChest": true,
304406
"hasCherryTree": false,
407+
"village": false,
408+
"ancientCity": false,
409+
"trialChamber": true,
410+
"stronghold": false,
411+
"igloo": false,
412+
"mineshaft": false,
305413
"dogs": 0,
306414
"cats": 0
307415
}

0 commit comments

Comments
 (0)