本文整理汇总了Java中net.minecraft.item.ItemDye.DYE_COLORS属性的典型用法代码示例。如果您正苦于以下问题:Java ItemDye.DYE_COLORS属性的具体用法?Java ItemDye.DYE_COLORS怎么用?Java ItemDye.DYE_COLORS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.item.ItemDye
的用法示例。
在下文中一共展示了ItemDye.DYE_COLORS属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDye
public static void addDye(FluidStack plastic, int dyeMetadata) {
if (!Fluids.areFluidsEqual(plastic.getFluid(), Fluids.PLASTIC))
throw new IllegalArgumentException("Given fluid stack isn't mixable! " + plastic);
int dyeColor = ItemDye.DYE_COLORS[dyeMetadata];
int[] dyeColors = new int[]{dyeColor >> 16, dyeColor >> 8 & 255, dyeColor & 255};
int[] plasticColor = getColor3(plastic);
double ratio = PneumaticValues.PLASTIC_MIX_RATIO / (PneumaticValues.PLASTIC_MIX_RATIO * (plastic.amount / 1000D));
for (int i = 0; i < 3; i++) {
plasticColor[i] = (int) (ratio * dyeColors[i] + (1 - ratio) * plasticColor[i]);
}
if (plastic.tag == null) plastic.tag = new NBTTagCompound();
plastic.tag.setInteger("color", (plasticColor[0] << 16) + (plasticColor[1] << 8) + plasticColor[2]);
}