Skip to content

Commit

Permalink
Added color-blind textures for solid item colors
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryLoenwind committed Dec 15, 2020
1 parent 4418e6f commit 770035b
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 1 deletion.
4 changes: 4 additions & 0 deletions externalannotations/com/google/common/base/Optional.eea
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class com/google/common/base/Optional
fromNullable
<T:Ljava/lang/Object;>(TT;)Lcom/google/common/base/Optional<TT;>;
<T:Ljava/lang/Object;>(TT;)L1com/google/common/base/Optional<TT;>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class com/google/common/collect/ImmutableSet
copyOf
<E:Ljava/lang/Object;>(Ljava/util/Collection<+TE;>;)Lcom/google/common/collect/ImmutableSet<TE;>;
<E:Ljava/lang/Object;>(Ljava/util/Collection<+TE;>;)L1com/google/common/collect/ImmutableSet<TE;>;
18 changes: 18 additions & 0 deletions src/main/java/com/enderio/core/client/render/EnderWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ public enum EnderWidget implements IWidgetIcon {
STOP_BUT_HOVER(200, 80, 8, 8),
RETURN_BUT_HOVER(200, 88, 8, 8),

// Item colors
COLOR_BLACK(0, 240), // 0: #1e1b1b #242020 black
COLOR_RED(16, 240), // 1: #b3312c #d63a34 red
COLOR_GREEN(32, 240), // 2: #3b511a #46611f green
COLOR_BROWN(48, 240), // 3: #51301a #61391f brown
COLOR_BLUE(64, 240), // 4: #253192 #2c3aaf blue
COLOR_PURPLE(80, 240), // 5: #7b2fbe #9338e4 purple
COLOR_CYAN(96, 240), // 6: #287697 #308db5 cyan
COLOR_SILVER(112, 240), // 7: #ababab #888888 silver
COLOR_GRAY(128, 240), // 8: #434343 #505050 gray
COLOR_PINK(144, 240), // 9: #d88198 #ac6779 pink
COLOR_LIME(160, 240), // 10: #41cd34 #4ef63e lime
COLOR_YELLOW(176, 240), // 11: #decf2a #b1a521 yellow
COLOR_LIGHTBLUE(192, 240), // 12: #6689d3 #516da8 lightBlue
COLOR_MAGENTA(208, 240), // 13: #c354cd #9c43a4 magenta
COLOR_ORANGE(224, 240), // 14: #eb8844 #bc6c36 orange
COLOR_WHITE(240, 240),// 15: #f0f0f0 #c0c0c0 white

;

public static final @Nonnull ResourceLocation TEXTURE = new ResourceLocation(EnderCore.MODID, "textures/gui/widgets.png");
Expand Down
27 changes: 26 additions & 1 deletion src/main/java/com/enderio/core/common/util/DyeColor.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
package com.enderio.core.common.util;

import java.util.List;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.enderio.core.EnderCore;
import com.enderio.core.api.client.render.IWidgetIcon;
import com.enderio.core.client.gui.button.CycleButton.ICycleEnum;
import com.enderio.core.client.render.EnderWidget;

import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.oredict.OreDictionary;

public enum DyeColor {
public enum DyeColor implements ICycleEnum {

BLACK,
RED,
Expand Down Expand Up @@ -42,6 +47,14 @@ public enum DyeColor {

};

public static final IWidgetIcon[] DYE_ICONS = {

EnderWidget.COLOR_BLACK, EnderWidget.COLOR_RED, EnderWidget.COLOR_GREEN, EnderWidget.COLOR_BROWN, EnderWidget.COLOR_BLUE, EnderWidget.COLOR_PURPLE,
EnderWidget.COLOR_CYAN, EnderWidget.COLOR_SILVER, EnderWidget.COLOR_GRAY, EnderWidget.COLOR_PINK, EnderWidget.COLOR_LIME, EnderWidget.COLOR_YELLOW,
EnderWidget.COLOR_LIGHTBLUE, EnderWidget.COLOR_MAGENTA, EnderWidget.COLOR_ORANGE, EnderWidget.COLOR_WHITE

};

public static @Nonnull DyeColor getNext(@Nonnull DyeColor col) {
int ord = col.ordinal() + 1;
if (ord >= DyeColor.values().length) {
Expand Down Expand Up @@ -89,4 +102,16 @@ public int getColor() {
public String toString() {
return getName();
}

@Override
@Nonnull
public IWidgetIcon getIcon() {
return NullHelper.first(DYE_ICONS[ordinal()], EnderWidget.COLOR_BLACK);
}

@Override
@Nonnull
public List<String> getTooltipLines() {
return new NNList<>(getLocalisedName());
}
}
Binary file modified src/main/resources/assets/endercore/textures/gui/widgets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 770035b

Please sign in to comment.