下面列出了net.minecraft.util.math.MathHelper#hsvToRGB ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public int drawString(String text, float x, float y, int color, boolean dropShadow) {
if(!(SexyFont.sexyTime || SexyFont.alwaysSexyTime)) {
return super.drawString(text, x, y, color, dropShadow);
}
if(SexyFont.intermittentSexyTime) {
int hash = text.hashCode() % 8;
int offset = (int) (Minecraft.getSystemTime() / 230f) % 8;
if((hash + offset) % 8 != 0) {
return super.drawString(text, x, y, color, dropShadow);
}
}
//Ok this is epic
float posX = x;
float huehuehue = (Minecraft.getSystemTime() / 700f) % 1;
float huehuehueStep = rangeRemap((float) (Math.sin(Minecraft.getSystemTime() / 2000f) % 6.28318f), -1, 1, 0.01f, 0.15f);
String textRender = ChatFormatting.stripFormatting(text);
for(int i = 0; i < textRender.length(); i++) {
int c = (color & 0xFF000000) | MathHelper.hsvToRGB(huehuehue, .8f, 1);
float yOffset = (float) Math.sin(i + (Minecraft.getSystemTime() / 300f));
posX = super.drawString(String.valueOf(textRender.charAt(i)), posX, y + yOffset, c, true) - 1;
huehuehue += huehuehueStep;
huehuehue %= 1;
}
return (int) posX;
}
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) {
T metaValueItem = getItem(stack);
if (metaValueItem != null && metaValueItem.getDurabilityManager() != null) {
return metaValueItem.getDurabilityManager().getRGBDurabilityForDisplay(stack);
}
return MathHelper.hsvToRGB(0.33f, 1.0f, 1.0f);
}
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) {
//always color durability bar as item internal damage
double internalDamage = getItemDamage(stack) / (getMaxItemDamage(stack) * 1.0);
return MathHelper.hsvToRGB(Math.max(0.0F, (float) (1.0 - internalDamage)) / 3.0F, 1.0F, 1.0F);
}
@Override
public int getRGBDurabilityForDisplay(ItemStack itemStack) {
return MathHelper.hsvToRGB(0.33f, 1.0f, 1.0f);
}
@Override
public int getRGBDurabilityForDisplay(ItemStack itemStack) {
return MathHelper.hsvToRGB((1.0f - (float) getDurabilityForDisplay(itemStack)) / 3.0f, 1.0f, 1.0f);
}
public static void drawCircle(@Nonnull Vec3d pos, double radius, boolean flattenToScreen, boolean enableDepth) {
int color = MathHelper.hsvToRGB(ClientTickHandler.getTicks() % 200 / 200F, 0.6F, 1F);
Color colorRGB = new Color(color);
drawCircle(pos, radius, flattenToScreen, enableDepth, colorRGB);
}