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