Search in sources :

Example 1 with NoFeatureConfig

use of net.minecraft.world.gen.feature.NoFeatureConfig in project Shrines by Silverminer007.

the class StructuresList method refreshList.

public void refreshList(Supplier<String> search) {
    this.clearEntries();
    List<AbstractStructure<NoFeatureConfig>> structs = NewStructureInit.STRUCTURES.values().stream().collect(Collectors.toList());
    structs.removeIf(struct -> struct == null);
    this.structures = structs.stream().map((config) -> {
        AbstractStructure<?> st = (AbstractStructure<?>) config.getStructure();
        return st.getConfig();
    }).collect(Collectors.toList());
    this.structures.removeIf(entry -> entry == null);
    List<String> structures = this.structures.stream().map(st -> st.getName()).collect(Collectors.toList());
    for (CustomStructureData d : Utils.getStructures(false)) {
        if (!structures.contains(d.getName())) {
            this.structures.add(d);
        }
    }
    if (!this.screen.builtInV) {
        this.structures.removeIf(st -> st.isBuiltIn());
    }
    if (!this.screen.customsV) {
        this.structures.removeIf(st -> !st.isBuiltIn());
    }
    Collections.sort(this.structures);
    String s = search.get().toLowerCase(Locale.ROOT);
    for (IStructureConfig cfg : this.structures) {
        if (cfg.getName().toLowerCase(Locale.ROOT).contains(s)) {
            this.addEntry(new StructuresList.Entry(this, cfg));
        }
    }
}
Also used : AbstractStructure(com.silverminer.shrines.structures.AbstractStructure) DynamicTexture(net.minecraft.client.renderer.texture.DynamicTexture) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) ConfirmScreen(net.minecraft.client.gui.screen.ConfirmScreen) Util(net.minecraft.util.Util) NewStructureInit(com.silverminer.shrines.init.NewStructureInit) Style(net.minecraft.util.text.Style) NoFeatureConfig(net.minecraft.world.gen.feature.NoFeatureConfig) Hashing(com.google.common.hash.Hashing) ConfigStructureScreen(com.silverminer.shrines.client.gui.config.options.ConfigStructureScreen) NativeImage(net.minecraft.client.renderer.texture.NativeImage) Supplier(java.util.function.Supplier) ITextComponent(net.minecraft.util.text.ITextComponent) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) Dist(net.minecraftforge.api.distmarker.Dist) Minecraft(net.minecraft.client.Minecraft) Locale(java.util.Locale) Color(net.minecraft.util.text.Color) Utils(com.silverminer.shrines.utils.custom_structures.Utils) StringTextComponent(net.minecraft.util.text.StringTextComponent) CustomStructureData(com.silverminer.shrines.structures.custom.helper.CustomStructureData) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) IStructureConfig(com.silverminer.shrines.config.IStructureConfig) Nullable(javax.annotation.Nullable) WorkingScreen(net.minecraft.client.gui.screen.WorkingScreen) ExtendedList(net.minecraft.client.gui.widget.list.ExtendedList) FileInputStream(java.io.FileInputStream) Collectors(java.util.stream.Collectors) File(java.io.File) AbstractGui(net.minecraft.client.gui.AbstractGui) List(java.util.List) Validate(org.apache.commons.lang3.Validate) Logger(org.apache.logging.log4j.Logger) DialogTexts(net.minecraft.client.gui.DialogTexts) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) ShrinesMod(com.silverminer.shrines.ShrinesMod) ResourceLocation(net.minecraft.util.ResourceLocation) Optional(java.util.Optional) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) InputStream(java.io.InputStream) CustomStructureData(com.silverminer.shrines.structures.custom.helper.CustomStructureData) AbstractStructure(com.silverminer.shrines.structures.AbstractStructure) IStructureConfig(com.silverminer.shrines.config.IStructureConfig)

Aggregations

Hashing (com.google.common.hash.Hashing)1 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)1 RenderSystem (com.mojang.blaze3d.systems.RenderSystem)1 ShrinesMod (com.silverminer.shrines.ShrinesMod)1 ConfigStructureScreen (com.silverminer.shrines.client.gui.config.options.ConfigStructureScreen)1 IStructureConfig (com.silverminer.shrines.config.IStructureConfig)1 NewStructureInit (com.silverminer.shrines.init.NewStructureInit)1 AbstractStructure (com.silverminer.shrines.structures.AbstractStructure)1 CustomStructureData (com.silverminer.shrines.structures.custom.helper.CustomStructureData)1 Utils (com.silverminer.shrines.utils.custom_structures.Utils)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 Collections (java.util.Collections)1 List (java.util.List)1 Locale (java.util.Locale)1 Optional (java.util.Optional)1 Supplier (java.util.function.Supplier)1 Collectors (java.util.stream.Collectors)1 Nullable (javax.annotation.Nullable)1