Skip to content

Commit

Permalink
Add colors to register
Browse files Browse the repository at this point in the history
  • Loading branch information
HyCraftHD committed Jul 31, 2024
1 parent 18d45aa commit 8488b64
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class UsefulBackpacksClientConstruct implements ModConstruct {

@Override
public void construct() {
UsefulBackpacksColors.register();
UsefulBackpacksScreens.register();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package info.u_team.useful_backpacks.init;

import java.util.stream.Stream;

import info.u_team.u_team_core.api.registry.client.ColorProviderRegister;
import info.u_team.useful_backpacks.item.BackpackItem;
import net.minecraft.Util;
import net.minecraft.world.item.component.DyedItemColor;

public class UsefulBackpacksColors {

private static final ColorProviderRegister COLORS = Util.make(ColorProviderRegister.create(), colors -> {
colors.register((itemColors, blockColors, colorRegister) -> colorRegister.register((stack, index) -> {
return DyedItemColor.getOrDefault(stack, BackpackItem.DEFAULT_COLOR);
}, Stream.of(UsefulBackpacksItems.SMALL_BACKPACK.get(), UsefulBackpacksItems.MEDIUM_BACKPACK.get(), UsefulBackpacksItems.LARGE_BACKPACK.get())));
});

static void register() {
COLORS.register();
}

}

0 comments on commit 8488b64

Please sign in to comment.