Skip to content

Commit

Permalink
Specify a color representation for fungi and bio infuse types for bar…
Browse files Browse the repository at this point in the history
… coloring, and also special case lava bar color in the gauge dropper
  • Loading branch information
pupnewfster committed Nov 28, 2021
1 parent d018371 commit c1cb94d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/main/java/mekanism/common/item/ItemGaugeDropper.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Rarity;
Expand Down Expand Up @@ -57,6 +58,10 @@ public int getRGBDurabilityForDisplay(ItemStack stack) {
//TODO: Technically doesn't support things where the color is part of the texture such as lava
// for chemicals it is supported via allowing people to override getColorRepresentation in their
// chemicals
if (fluidStack.getFluid().isSame(Fluids.LAVA)) {
//Special case lava
return 0xFFDB6B19;
}
return fluidStack.getFluid().getAttributes().getColor(fluidStack);
}
return ChemicalUtil.getRGBDurabilityForDisplay(stack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ public InfuseTypeRegistryObject<InfuseType> register(String name, int tint) {
return register(name, () -> new InfuseType(InfuseTypeBuilder.builder().color(tint)));
}

public InfuseTypeRegistryObject<InfuseType> register(String name, ResourceLocation texture) {
return register(name, () -> new InfuseType(InfuseTypeBuilder.builder(texture)));
public InfuseTypeRegistryObject<InfuseType> register(String name, ResourceLocation texture, int barColor) {
return register(name, () -> new InfuseType(InfuseTypeBuilder.builder(texture)) {
@Override
public int getColorRepresentation() {
return barColor;
}
});
}

public <INFUSE_TYPE extends InfuseType> InfuseTypeRegistryObject<INFUSE_TYPE> register(String name, Supplier<? extends INFUSE_TYPE> sup) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ private MekanismInfuseTypes() {
public static final InfuseTypeRegistryObject<InfuseType> REFINED_OBSIDIAN = INFUSE_TYPES.register("refined_obsidian", 0x7C00ED);
public static final InfuseTypeRegistryObject<InfuseType> GOLD = INFUSE_TYPES.register("gold", 0xF2CD67);
public static final InfuseTypeRegistryObject<InfuseType> TIN = INFUSE_TYPES.register("tin", 0xCCCCD9);
public static final InfuseTypeRegistryObject<InfuseType> FUNGI = INFUSE_TYPES.register("fungi", Mekanism.rl("infuse_type/fungi"));
public static final InfuseTypeRegistryObject<InfuseType> BIO = INFUSE_TYPES.register("bio", Mekanism.rl("infuse_type/bio"));
public static final InfuseTypeRegistryObject<InfuseType> FUNGI = INFUSE_TYPES.register("fungi", Mekanism.rl("infuse_type/fungi"), 0x74656A);
public static final InfuseTypeRegistryObject<InfuseType> BIO = INFUSE_TYPES.register("bio", Mekanism.rl("infuse_type/bio"), 0x5A4630);
}

0 comments on commit c1cb94d

Please sign in to comment.