-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add charged variant items to creative tab again
- Loading branch information
Showing
7 changed files
with
55 additions
and
32 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
common/src/main/java/gripe/_90/megacells/definition/MEGACreativeTab.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package gripe._90.megacells.definition; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.CreativeModeTab; | ||
|
||
import appeng.block.AEBaseBlock; | ||
import appeng.block.AEBaseBlockItem; | ||
import appeng.core.definitions.ItemDefinition; | ||
import appeng.items.AEBaseItem; | ||
|
||
import gripe._90.megacells.util.Utils; | ||
|
||
public class MEGACreativeTab { | ||
public static final CreativeModeTab TAB = Utils.PLATFORM.getCreativeTab(MEGACreativeTab::populateTab); | ||
public static final ResourceLocation ID = Utils.makeId("tab"); | ||
|
||
private static void populateTab(CreativeModeTab.ItemDisplayParameters itemDisplayParameters, | ||
CreativeModeTab.Output output) { | ||
var itemDefs = new ArrayList<ItemDefinition<?>>(); | ||
var blacklist = List.of(MEGAItems.DECOMPRESSION_PATTERN); | ||
|
||
itemDefs.addAll(MEGAItems.getItems()); | ||
itemDefs.addAll(MEGABlocks.getBlocks()); | ||
itemDefs.removeAll(blacklist); | ||
|
||
for (var itemDef : itemDefs) { | ||
var item = itemDef.asItem(); | ||
|
||
// For block items, the block controls the creative tab | ||
if (item instanceof AEBaseBlockItem baseItem && baseItem.getBlock()instanceof AEBaseBlock baseBlock) { | ||
baseBlock.addToMainCreativeTab(output); | ||
} else if (item instanceof AEBaseItem baseItem) { | ||
baseItem.addToMainCreativeTab(output); | ||
} else { | ||
output.accept(itemDef); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters