Sefiraat's Addons Documentation
  • Sefiraat
    • Throw me a sponsor, get some stuff!
  • Networks
    • Basics
      • What is Networks?
      • Item Deposit/Withdrawal
    • Network Nodes
      • Network Controller
      • Network Grid
      • Network Bridge
      • Network Cell
      • Network Monitor
      • Network Quantum Storage
      • Network Importer
      • Network Exporter
      • Network Grabber
      • Network Pusher
      • Network Purger
      • Network Capacitor
      • Network Power Display
      • Network Encoder
      • Network Autocrafters
      • Network Vanilla Pusher
      • Network Vanilla Grabber
      • Network Wireless Transmitter
      • Network Wireless Receiver
      • Network Control: X
      • Network Control: V
      • Network Vacuum
    • Tools
      • Network Remote
      • Crafting Blueprint
      • Network Crayon
      • Network Configurator
      • Network Wireless Configurator
      • Network Probe
  • Crystamae Historia
    • Spell Crafting
      • What is Crystamae?
      • Chronicling
      • Realisation
      • Liquefaction
      • Spell Plates
      • Stave Configurator
    • Spells
      • Abstract Void
      • Air Nova
      • Air Sprites
      • Ancient Defence
      • Animaniacs
    • Tools
      • Block Veil
      • Refracting Lens
      • Ephemeral Tables
      • Spell Plates
      • Connecting Compass
      • Displacer
      • Luminescence Scoops
      • Recalling Lattice
    • Gadgets
      • Lamps
      • Vacuums
      • Mob-spawning Dirt
      • Damage Plates
      • Experience Collectors
      • Ender Inhibitors
      • Verache Candles
      • Mysterious Items
      • Greenhouse Glass
      • Trophy Display
      • Exaltation Stand
      • Diverging Waystone
      • Angel Block
      • Philosopher's Spray
      • Glass of Milk
      • Voids
    • Artistic Items
    • Exalted Items
    • Uniques
  • Netheopoiesis
    • Overview
      • Purification
      • Growing and Breeding Plants
    • Purification
      • Sleeping in the Nether
      • Water in the Nether
      • Friendly Mobs
      • A Better-Barter
      • Mob Swapping
      • Mob Spawning
      • Purifying Aura
      • To the End!
    • Plants
      • Addon Berry Plant
      • Bartered Plant
      • Beach Plant
      • Best Friend Plant
      • Black and White Plant
      • Blob Plant
      • Busy Plant
      • Buzzing Plant
      • Chilly Plant
      • Cobbled Plant
      • Combustible Plant
      • Crystalline Plant
      • Cute Plant
      • Deepslate Plant
      • Desert Plant
      • Dusty Plant
      • Eden Plant
      • Enchanted Plant
      • Ethereal Plant
      • Feldspar Plant
      • Gateway Plant
      • Glistening Plant
      • Glowing Plant
      • Grainy Plant
      • Grass Plant
      • Hate Filled Plant
      • Hexed Plant
      • Igneous Plant
      • Ignited Plant
      • Jungle Plant
      • Learned Plant
      • Math Plant
      • Metallic Plant
      • Moldable Plant
      • Nori Plant
      • Oakendran Plant
      • Parrot Plant
      • Perfection Plant
      • Polar Plant
      • Porky Plant
      • Prismatic Plant
      • Protective Plant
      • Pulsing Plant
      • Purification Plant
      • Rainbow Plant
      • Rotten Plant
      • Saintly Plant
      • Seaside Plant
      • Seedy Plant
      • Shelled Plant
      • Shiny Plant
      • Slimy Plant
      • Smooth Plant
      • Soul Plant
      • Spindle Plant
      • Spiney Plant
      • Spirit Plant
      • Splintered Plant
      • Stoney Plant
      • Stray Plant
      • Stringy Plant
      • Swamp Plant
      • Sweet Plant
      • Tarnished Plant
      • Terrifying Plant
      • Treasured Plant
      • Valuable Plant
      • Volcanic Plant
      • Wet Plant
      • Wild Plant
  • SlimeTinker
    • Basics
    • Materials
      • Adamantite
      • Advanced Alloy
      • Aluminum Brass
      • Aluminum Bronze
      • Aluminum Singularity
      • Aluminum
      • Billon
      • Boomerite
      • Brass
      • Bronze
      • Carbon Fibre
      • Coal
      • Cobalt
      • Copper Singularity
      • Copper
      • Corinthian Bronze
      • Crimson Root
      • Cringleium
      • Damascus Steel
      • Daxi Absorption
      • Daxi Fortitude
      • Daxi Regeneration
      • Daxi Saturation
      • Daxi Strength
      • Diamond Singularity
      • Diamond
      • Duralium
      • Earth Singularity
      • Ferrosilicon
      • Fortune Singularity
      • Ghostly Essence
      • Gold Singularity
      • Gold
      • Hardened Metal
      • Infinite
      • Infinity Singularity
      • Interdimensional Presence
      • Iridium
      • Iron Singularity
      • Iron
      • Lead Singularity
      • Lead
      • Leather
      • Liquid Christmas
      • Liquid Love
      • Mag Thor
      • Magic Singularity
      • Magnesium Singularity
      • Magnesium
      • Magnonium
      • Magsteel
      • Metal Singularity
      • Mixed Metal
      • Mythril
      • Nickel
      • Osmium Superalloy
      • Osmium
      • Redstone Alloy
      • Redstone
      • Refined Iron
      • Reinforced Alloy
      • Reinforced Slime Steel
      • Remotininium
      • Rubber
      • Scrap
      • Sefirite
      • Segganesson
      • Silicon
      • Silver Singularity
      • Silver
      • Slime Steel
      • Slime
      • Solder
      • Stainless Steel
      • Star Dust
      • Steel
      • String
      • Tesseracting Material
      • Thorium
      • Tin Singularity
      • Tin
      • Titanium
      • Twisted Vine
      • Unpatentablium
      • Vex Gem
      • Vine
      • Void
      • Warped Root
      • Weeping Vine
      • Zinc Singularity
      • Zinc
    • Traits
  • Cultivation
    • Overview
      • Crop Breeding
    • Crafting Items
    • Tools
      • Crop Sticks
      • Plant Analyzer
      • Seed Pack
    • Machines
      • Garden Cloche
      • Cooking Work Stations
    • Plants
    • Developers
      • Adding Food Items via PR
        • 0: Adding new skull textures
        • 1: SlimefunItemStack
        • 2: Creating the Food SlimefunItem
  • DankTech2
    • Basics
  • Simple Storage
    • Basics
  • EMCTech
    • What is EMC?
    • EMC Calculations
  • Folio
    • Cards
      • Stone
      • Andesite
      • Basalt
  • SefiLib
    • Setup
      • Maven
    • Theme
    • SimpleFlexGroup
    • SimpleTickingBlock
    • TimePeriod
    • JavaDocs
Powered by GitBook
On this page

Was this helpful?

  1. SefiLib

SimpleFlexGroup

In Slimefun, NestedItemGroups allow you to condense your itemgroups into a single tile on the main guide pages. The downside of this is you cannot add a FlexItemGroup to them. Currently the only way to make this work is to make your main ItemGroup a FlexItemGroup. SimpleFlexGroup was made to make the process of setting up this type of FlexItemGroup much easier and to ensure it's as standardised with Slimefun's guide as possible.

All of the sorting, pagination and formatting of the GUI are all handled for you meaning you can have a working FlexItemGroup for your main guide item with just a few lines of code.

First, declare a new SimpleFlexGroup, this is no different to setting up a NestedItemGroup from Slimefun except a JavaPlugin instance needs to be provided (this is required for handling search queries).

public static final SimpleFlexGroup MAIN = new MainFlexGroup(
    SlimeTinker2.getInstance();
    "SlimeTinker2",
    Keys.newKey("main"),
    new CustomItemStack(
        new ItemStack(Material.FLETCHING_TABLE),
        TinkerThemes.MAIN.color("SlimeTinker2")
    )
);

Then declare all of your other ItemGroups. ItemGroup, NestedItemGroup and FlexItemGroup are all accepted here, SubItemGroup is not, as they MUST be inside of a nested group. For normal ItemGroups, you will likely want to use DummyItemGroup as this will stop the group being displayed on the front page of the SlimefunGuide.

public static final MaterialsFlexGroup MATERIALS = new MaterialsFlexGroup(
    Keys.newKey("materials"),
    new CustomItemStack(
        new ItemStack(Material.IRON_BLOCK),
        TinkerThemes.MAIN.color(SlimeTinker2.getLang().getGroupName("materials"))
    )
);

public static final DummyItemGroup TOOLS = new DummyItemGroup(
    Keys.newKey("tools"),
    new CustomItemStack(
        new ItemStack(Material.STONECUTTER),
        TinkerThemes.MAIN.color(SlimeTinker2.getLang().getGroupName("tools"))
    )
);

Then you can just call MainItemGroup.addItemGroup(ItemGroup)

public static void setup() {
    final SlimeTinker2 plugin = SlimeTinker2.getInstance();

    // Slimefun Registry
    MAIN.register(plugin);

    MAIN.addItemGroup(MATERIALS);
    MAIN.addItemGroup(TOOLS);
}

You can also add icons with custom effects by using the MenuItem class. A MenuItem class holds an ItemStack and a ClickHandler, this can allow you add add more complex items to your Flex guide in a simple and straight-forward manner. You can mix and match ItemGroups and MenuItems freely and they will be displayed in the order they were added.

MenuItem menuItem = new MenuItem(new ItemStack(Material.IRON_INGOT), (player, i, itemStack, clickAction) ->  {
    player.sendMessage("You clicked on an item!");
    return false;
});

MAIN.addMenuItem(menuItem);
PreviousThemeNextSimpleTickingBlock

Last updated 2 years ago

Was this helpful?