-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.19.3, add datagen cache to gitignore
- Loading branch information
Showing
63 changed files
with
149 additions
and
192 deletions.
There are no files selected for viewing
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
4 changes: 0 additions & 4 deletions
4
src/main/generated/.cache/03e4de26f1265135874f8cdcaebc09d9c08eb42b
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
src/main/generated/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e
This file was deleted.
Oops, something went wrong.
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
50 changes: 21 additions & 29 deletions
50
src/main/java/wraith/alloyforgery/AlloyForgeryItemGroup.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 |
---|---|---|
@@ -1,51 +1,43 @@ | ||
package wraith.alloyforgery; | ||
|
||
import io.wispforest.owo.itemgroup.Icon; | ||
import io.wispforest.owo.itemgroup.OwoItemGroup; | ||
import io.wispforest.owo.itemgroup.gui.ItemGroupButton; | ||
import io.wispforest.owo.itemgroup.gui.ItemGroupTab; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.collection.DefaultedList; | ||
import net.minecraft.text.Text; | ||
import wraith.alloyforgery.block.ForgeControllerBlock; | ||
import wraith.alloyforgery.forges.ForgeRegistry; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
|
||
public class AlloyForgeryItemGroup extends OwoItemGroup { | ||
public class AlloyForgeryItemGroup { | ||
|
||
private List<ItemStack> controllerCache = null; | ||
private static List<ItemStack> CONTROLLER_CACHE = null; | ||
|
||
protected AlloyForgeryItemGroup(Identifier id) { | ||
super(id); | ||
} | ||
public static final OwoItemGroup GROUP = OwoItemGroup.builder(AlloyForgery.id("alloy_forgery"), () -> { | ||
if (CONTROLLER_CACHE == null) return null; | ||
return Icon.of(CONTROLLER_CACHE.get(0)); | ||
}).initializer(group -> { | ||
group.tabs.add(new ItemGroupTab(Icon.of(ItemStack.EMPTY), Text.empty(), (enabledFeatures, entries, hasPermissions) -> { | ||
if (CONTROLLER_CACHE == null) createControllerCache(); | ||
CONTROLLER_CACHE.forEach(entries::add); | ||
}, ItemGroupTab.DEFAULT_TEXTURE, true)); | ||
|
||
@Override | ||
public ItemStack createIcon() { | ||
if (this.controllerCache == null) return Items.BRICKS.getDefaultStack(); | ||
return this.controllerCache.isEmpty() ? Items.BRICKS.getDefaultStack() : this.controllerCache.get(0); | ||
} | ||
group.addButton(ItemGroupButton.github(group, "https://github.com/LordDeatHunter/Alloy-Forgery")); | ||
group.addButton(ItemGroupButton.curseforge(group, "https://www.curseforge.com/minecraft/mc-mods/alloy-forgery")); | ||
group.addButton(ItemGroupButton.modrinth(group, "https://modrinth.com/mod/alloy-forgery")); | ||
group.addButton(ItemGroupButton.discord(group, "https://discord.gg/Pa5wDVm8Xv")); | ||
}).build(); | ||
|
||
@Override | ||
public void appendStacks(DefaultedList<ItemStack> stacks) { | ||
if (controllerCache == null) this.createControllerCache(); | ||
stacks.addAll(this.controllerCache); | ||
} | ||
|
||
private void createControllerCache() { | ||
private static void createControllerCache() { | ||
final var blockList = new ArrayList<>(ForgeRegistry.getControllerBlocks()); | ||
blockList.sort(Comparator.comparingInt(value -> ((ForgeControllerBlock) value).forgeDefinition.forgeTier())); | ||
|
||
this.controllerCache = new ArrayList<>(blockList.size()); | ||
blockList.forEach(block -> this.controllerCache.add(block.asItem().getDefaultStack())); | ||
CONTROLLER_CACHE = new ArrayList<>(blockList.size()); | ||
blockList.forEach(block -> CONTROLLER_CACHE.add(block.asItem().getDefaultStack())); | ||
} | ||
|
||
@Override | ||
protected void setup() { | ||
this.addButton(ItemGroupButton.github("https://github.com/LordDeatHunter/Alloy-Forgery")); | ||
this.addButton(ItemGroupButton.curseforge("https://www.curseforge.com/minecraft/mc-mods/alloy-forgery")); | ||
this.addButton(ItemGroupButton.modrinth("https://modrinth.com/mod/alloy-forgery")); | ||
this.addButton(ItemGroupButton.discord("https://discord.gg/Pa5wDVm8Xv")); | ||
} | ||
} |
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
Oops, something went wrong.