taste the rainbow
This commit is contained in:
1 parent
0dd88cd1dc
commit
9a6b598e48
2 files changed
+28
-26
No files matched your search
@@ -12,7 +12,7 @@ import it.unimi.dsi.fastutil.objects.Object2LongMap;
|
||||
import net.minecraft.block.AbstractBannerBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.block.MapColor;
|
||||
import net.minecraft.block.Stainable;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.DyeItem;
|
||||
@@ -68,7 +68,7 @@ public class HopperCounter
|
||||
{
|
||||
startTick = -1;
|
||||
this.color = color;
|
||||
this.prettyColour = WoolTool.Material2DyeName.getOrDefault(color.getMaterialColor(),"w ") + color.getName();
|
||||
this.prettyColour = WoolTool.Material2DyeName.getOrDefault(color.getMapColor(),"w ") + color.getName();
|
||||
}
|
||||
|
||||
public void add(MinecraftServer server, ItemStack stack)
|
||||
@@ -174,7 +174,7 @@ public class HopperCounter
|
||||
|
||||
public static int appropriateColor(int color)
|
||||
{
|
||||
if (color == 0) return MaterialColor.WHITE.color;
|
||||
if (color == 0) return MapColor.WHITE.color;
|
||||
int r = (color >> 16 & 255);
|
||||
int g = (color >> 8 & 255);
|
||||
int b = (color & 255);
|
||||
@@ -267,12 +267,14 @@ public class HopperCounter
|
||||
.put(Items.PHANTOM_MEMBRANE,Blocks.BONE_BLOCK)
|
||||
.put(Items.EGG,Blocks.BONE_BLOCK)
|
||||
//.put(Items.,Blocks.)
|
||||
.put(Items.COPPER_INGOT,Blocks.COPPER_BLOCK)
|
||||
.put(Items.AMETHYST_SHARD, Blocks.AMETHYST_BLOCK)
|
||||
.build();
|
||||
|
||||
public static TextColor fromItem(Item item)
|
||||
{
|
||||
if (DEFAULTS.containsKey(item)) return TextColor.fromRgb(appropriateColor(DEFAULTS.get(item).getDefaultMaterialColor().color));
|
||||
if (item instanceof DyeItem) return TextColor.fromRgb(appropriateColor(((DyeItem) item).getColor().getMaterialColor().color));
|
||||
if (DEFAULTS.containsKey(item)) return TextColor.fromRgb(appropriateColor(DEFAULTS.get(item).getDefaultMapColor().color));
|
||||
if (item instanceof DyeItem) return TextColor.fromRgb(appropriateColor(((DyeItem) item).getColor().getMapColor().color));
|
||||
Block block = null;
|
||||
Identifier id = Registry.ITEM.getId(item);
|
||||
if (item instanceof BlockItem)
|
||||
@@ -285,9 +287,9 @@ public class HopperCounter
|
||||
}
|
||||
if (block != null)
|
||||
{
|
||||
if (block instanceof AbstractBannerBlock) return TextColor.fromRgb(appropriateColor(((AbstractBannerBlock) block).getColor().getMaterialColor().color));
|
||||
if (block instanceof Stainable) return TextColor.fromRgb(appropriateColor( ((Stainable) block).getColor().getMaterialColor().color));
|
||||
return TextColor.fromRgb(appropriateColor( block.getDefaultMaterialColor().color));
|
||||
if (block instanceof AbstractBannerBlock) return TextColor.fromRgb(appropriateColor(((AbstractBannerBlock) block).getColor().getMapColor().color));
|
||||
if (block instanceof Stainable) return TextColor.fromRgb(appropriateColor( ((Stainable) block).getColor().getMapColor().color));
|
||||
return TextColor.fromRgb(appropriateColor( block.getDefaultMapColor().color));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -302,7 +304,7 @@ public class HopperCounter
|
||||
{
|
||||
for (Recipe<?> r: ((RecipeManagerInterface) CarpetServer.minecraft_server.getRecipeManager()).getAllMatching(type, id))
|
||||
{
|
||||
for (Ingredient ingredient: r.getPreviewInputs())
|
||||
for (Ingredient ingredient: r.getIngredients())
|
||||
{
|
||||
for (Collection<ItemStack> stacks : ((IngredientInterface) (Object) ingredient).getRecipeStacks())
|
||||
{
|
||||
|
||||
@@ -22,23 +22,23 @@ public class WoolTool
|
||||
{
|
||||
private static final HashMap<MapColor,DyeColor> Material2Dye = new HashMap<>();
|
||||
|
||||
public static final HashMap<MapColor,String> Material2DyeName = new HashMap<MaterialColor, String>(){{
|
||||
put(MaterialColor.WHITE, "w ");
|
||||
put(MaterialColor.ORANGE, "#F9801D ");
|
||||
put(MaterialColor.MAGENTA, "m ");
|
||||
put(MaterialColor.LIGHT_BLUE, "t ");
|
||||
put(MaterialColor.YELLOW, "y ");
|
||||
put(MaterialColor.LAPIS, "l ");
|
||||
put(MaterialColor.PINK, "#FFACCB ");
|
||||
put(MaterialColor.GRAY, "f ");
|
||||
put(MaterialColor.LIGHT_GRAY, "g ");
|
||||
put(MaterialColor.CYAN, "c ");
|
||||
put(MaterialColor.PURPLE, "p ");
|
||||
put(MaterialColor.BLUE, "v ");
|
||||
put(MaterialColor.BROWN, "#835432 ");
|
||||
put(MaterialColor.GREEN, "e ");
|
||||
put(MaterialColor.RED, "r ");
|
||||
put(MaterialColor.BLACK, "k ");
|
||||
public static final HashMap<MapColor,String> Material2DyeName = new HashMap<MapColor, String>(){{
|
||||
put(MapColor.WHITE, "w ");
|
||||
put(MapColor.ORANGE, "#F9801D ");
|
||||
put(MapColor.MAGENTA, "m ");
|
||||
put(MapColor.LIGHT_BLUE, "t ");
|
||||
put(MapColor.YELLOW, "y ");
|
||||
put(MapColor.LIME, "l ");
|
||||
put(MapColor.PINK, "#FFACCB ");
|
||||
put(MapColor.GRAY, "f ");
|
||||
put(MapColor.LIGHT_GRAY, "g ");
|
||||
put(MapColor.CYAN, "c ");
|
||||
put(MapColor.PURPLE, "p ");
|
||||
put(MapColor.BLUE, "v ");
|
||||
put(MapColor.BROWN, "#835432 ");
|
||||
put(MapColor.GREEN, "e ");
|
||||
put(MapColor.RED, "r ");
|
||||
put(MapColor.BLACK, "k ");
|
||||
}};
|
||||
static
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user