Skip to content

Commit e3e35aa

Browse files
committed
Checks indicators
1 parent 4f2ea60 commit e3e35aa

5 files changed

Lines changed: 69 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.0.22
2+
3+
- Fixed actual use of structure set's "is_disabled" property (it was not used at all)
4+
- Added small check indicators to the structure button
5+
16
## 2.0.21
27

38
- Fixed compatibility with "Towns and Towers"

common/src/main/java/com/faboslav/structurify/common/config/client/gui/StructuresConfigScreen.java

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,31 @@ private static Option<Boolean> addStructure(
205205
String structureId,
206206
HolderLookup.RegistryLookup<Biome> biomeRegistry
207207
) {
208+
var name = LanguageUtil.translateId("structure", structureId);
209+
var flatnessCheck = !structureData.getFlatnessCheckData().isUsingDefaultValues() || structureData.getFlatnessCheckData().isOverridingGlobalFlatnessCheck();
210+
var biomeCheck = !structureData.getBiomeCheckData().isUsingDefaultValues() || structureData.getBiomeCheckData().isOverridingGlobalBiomeCheck();
211+
var overlapPreventionCheck = !structureData.getOverlapCheckData().isUsingDefaultValues() || structureData.getOverlapCheckData().isExcludedFromOverlapPrevention();
212+
var distanceFromWorldCenterCheck = !structureData.getDistanceFromWorldCenterCheckData().isUsingDefaultValues() || structureData.getDistanceFromWorldCenterCheckData().isOverridingGlobalDistanceFromWorldCenter();
213+
214+
215+
if(flatnessCheck) {
216+
name.append(" \u26F0");
217+
}
218+
219+
if(biomeCheck) {
220+
name.append(" \u2663");
221+
}
222+
223+
if(overlapPreventionCheck) {
224+
name.append(" \u29C9");
225+
}
226+
227+
if(distanceFromWorldCenterCheck) {
228+
name.append(" \u2316");
229+
}
230+
208231
var structureOptionBuilder = Option.<Boolean>createBuilder()
209-
.name(LanguageUtil.translateId("structure", structureId))
232+
.name(name)
210233
.binding(
211234
true,
212235
() -> !structureData.isDisabled(),
@@ -234,6 +257,35 @@ private static Option<Boolean> addStructure(
234257

235258
structureOptionBuilder.description(v -> {
236259
var descriptionBuilder = OptionDescription.createBuilder();
260+
var hasChecks = flatnessCheck || biomeCheck || overlapPreventionCheck || distanceFromWorldCenterCheck;
261+
262+
if(hasChecks) {
263+
descriptionBuilder.text(Component.translatable("gui.structurify.structures.checks_description").append(Component.literal("\n")));
264+
}
265+
266+
if(!structureData.getFlatnessCheckData().isUsingDefaultValues() || structureData.getFlatnessCheckData().isOverridingGlobalFlatnessCheck()) {
267+
descriptionBuilder.text(Component.literal("\u26F0 - ").append(Component.translatable("gui.structurify.structures.flatness_check")));
268+
hasChecks = true;
269+
}
270+
271+
if(!structureData.getBiomeCheckData().isUsingDefaultValues() || structureData.getBiomeCheckData().isOverridingGlobalBiomeCheck()) {
272+
descriptionBuilder.text(Component.literal("\u2663 - ").append(Component.translatable("gui.structurify.structures.biome_check")));
273+
hasChecks = true;
274+
}
275+
276+
if(!structureData.getOverlapCheckData().isUsingDefaultValues() || structureData.getOverlapCheckData().isExcludedFromOverlapPrevention()) {
277+
descriptionBuilder.text(Component.literal("\u29C9 - ").append(Component.translatable("gui.structurify.structures.overlap_check")));
278+
hasChecks = true;
279+
}
280+
281+
if(!structureData.getDistanceFromWorldCenterCheckData().isUsingDefaultValues() || structureData.getDistanceFromWorldCenterCheckData().isOverridingGlobalDistanceFromWorldCenter()) {
282+
descriptionBuilder.text(Component.literal("\u2316 - ").append(Component.translatable("gui.structurify.structures.distance_from_world_center")));
283+
hasChecks = true;
284+
}
285+
286+
if(hasChecks) {
287+
descriptionBuilder.text(Component.literal("\n"));
288+
}
237289

238290
descriptionBuilder.text(Component.translatable("gui.structurify.structures.biomes_description").append(Component.literal("\n")));
239291

common/src/main/java/com/faboslav/structurify/common/mixin/structure/StructureSetMixin.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ public abstract class StructureSetMixin implements StructurifyWithStructureSet
5454
return this.structurify$structures;
5555
}
5656

57-
var updatedStructures = new ArrayList<>(structures);
57+
List<StructureSet.StructureSelectionEntry> updatedStructures;
5858
var structureSetData = Structurify.getConfig().getStructureSetData().get(structureSetId);
5959

60-
if(!structureSetData.isDisabled()) {
60+
if(structureSetData.isDisabled()) {
61+
updatedStructures = new ArrayList<>();
62+
} else {
63+
updatedStructures = new ArrayList<>(structures);
6164

6265
for (var structureWeight : structureSetData.getStructureWeights().entrySet()) {
6366
var structureId = structureWeight.getKey();

common/src/main/resources/assets/structurify/lang/en_us.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,31 @@
2323
"gui.structurify.structures.structure.description": "„%s“ structure settings",
2424
"gui.structurify.structures.structure_set.title": "„%s“ structure set settings",
2525
"gui.structurify.structures.structure_set.description": "„%s“ structure set settings",
26+
"gui.structurify.structures.checks_description": "Structure has the following checks configured:",
2627
"gui.structurify.structures.biomes_description": "Structure can be found in the following biomes:",
2728
"gui.structurify.structures.warning": "Bear in mind that each structure may still be enabled or disabled by individual mods and datapacks.",
2829
"gui.structurify.structures.structures.structure.title": "Structure settings",
30+
"gui.structurify.structures.distance_from_world_center": "Distance from world center",
2931
"gui.structurify.structures.distance_from_world_center_group.title": "Distance from world center settings",
3032
"gui.structurify.structures.structure.override_global_distance_from_world_center.title": "Override global settings",
3133
"gui.structurify.structures.structure.override_global_distance_from_world_center.description": "Whenever to override distance from world center from global or „%s“ namespace settings with specific settings of the „%s“ structure.",
3234
"gui.structurify.structures.structure.min_distance_from_world_center.title": "Min. distance (in blocks)",
3335
"gui.structurify.structures.structure.min_distance_from_world_center.description": "Structure will only generate if they are farther than specified distance from the world center.",
3436
"gui.structurify.structures.structure.max_distance_from_world_center.title": "Max. distance (in blocks)",
3537
"gui.structurify.structures.structure.max_distance_from_world_center.description": "Structure will only generate if they are closer than specified distance from the world center.",
38+
"gui.structurify.structures.overlap_check": "Overlap prevention",
3639
"gui.structurify.structures.overlap_check_group.title": "Overlap prevention settings",
3740
"gui.structurify.structures.structure.exclude_from_overlap_prevention.title": "Exclude from overlap prevention",
3841
"gui.structurify.structures.structure.exclude_from_overlap_prevention.description": "Whenever to exclude „%s“ namespace or structure from global overlap prevention.",
42+
"gui.structurify.structures.flatness_check": "Flatness check",
3943
"gui.structurify.structures.flatness_check_group.title": "Flatness check settings",
4044
"gui.structurify.structures.structure.override_global_flatness_check.title": "Override global settings",
4145
"gui.structurify.structures.structure.override_global_flatness_check.description": "Whenever to override flatness check from global or „%s“ namespace settings with specific settings of the „%s“ structure.",
4246
"gui.structurify.structures.structure.enable_flatness_check.title": "Enable",
4347
"gui.structurify.structures.structure.enable_flatness_check.description": "The structure will only generate if the terrain under the structure is flat.",
4448
"gui.structurify.structures.structure.allow_non_solid_blocks_in_flatness_check.title": "Allow non solid blocks",
4549
"gui.structurify.structures.structure.allow_non_solid_blocks_in_flatness_check.description": "Liquid, air and other \"special\" blocks will count as solid blocks and will not fail the check.",
50+
"gui.structurify.structures.biome_check": "Biome check",
4651
"gui.structurify.structures.biome_check_group.title": "Biome check settings",
4752
"gui.structurify.structures.structure.detail_button.tooltip": "Opens „%s“ structure settings",
4853
"gui.structurify.structures.structure_set.config_button.tooltip": "Opens „%s“ structure set settings",

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ java.version=
1111
mod.name=Structurify
1212
mod.id=structurify
1313
mod.group=com.faboslav.structurify
14-
mod.version=2.0.21
14+
mod.version=2.0.22
1515
mod.author=Faboslav
1616
mod.description=Configuration mod that makes configuring everything related to structures very easy and accessible, eliminating the hassle of creating multiple datapacks.
1717
mod.license=CC-BY-NC-ND-4.0

0 commit comments

Comments
 (0)