1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-07-04 19:12:54 +00:00
SquidDev 39a9ad0ce7 Initial update to 1.14
So very little works, but it compiles and runs.

Things to resolve over the next few days:
 - Horrible mappings (should largely be resolved by tomorrow).
 - Cannot send extra data over containers - we'll have to see what Forge
   does here.
 - Turtle models are broken
 - No block drops yet - this will largely be cherry-picking whatever I
   did on Fabric.
 - Weird inventory desyncs (items don't show up initially when
   interacting with a CC inventory).
 - Probably lots of other things.
2019-06-08 13:36:31 +01:00

53 lines
1.4 KiB
Java

/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.shared.util;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tags.Tag;
import net.minecraftforge.common.Tags;
import javax.annotation.Nullable;
public final class ColourUtils
{
@SuppressWarnings( { "unchecked", "rawtypes" } )
private static final Tag<Item>[] DYES = new Tag[] {
Tags.Items.DYES_WHITE,
Tags.Items.DYES_ORANGE,
Tags.Items.DYES_MAGENTA,
Tags.Items.DYES_LIGHT_BLUE,
Tags.Items.DYES_YELLOW,
Tags.Items.DYES_LIME,
Tags.Items.DYES_PINK,
Tags.Items.DYES_GRAY,
Tags.Items.DYES_LIGHT_GRAY,
Tags.Items.DYES_CYAN,
Tags.Items.DYES_PURPLE,
Tags.Items.DYES_BLUE,
Tags.Items.DYES_BROWN,
Tags.Items.DYES_GREEN,
Tags.Items.DYES_RED,
Tags.Items.DYES_BLACK,
};
@Nullable
private ColourUtils() {}
public static DyeColor getStackColour( ItemStack stack )
{
for( int i = 0; i < DYES.length; i++ )
{
Tag<Item> dye = DYES[i];
if( dye.contains( stack.getItem() ) ) return DyeColor.byId( i );
}
return null;
}
}