Java Code Examples for net.minecraft.util.math.MathHelper#hsvToRGB()

The following examples show how to use net.minecraft.util.math.MathHelper#hsvToRGB() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SexyFontRenderer.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@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;
}
 
Example 2
Source File: MetaItem.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example 3
Source File: ToolMetaItem.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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);
}
 
Example 4
Source File: FoamSprayerBehavior.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public int getRGBDurabilityForDisplay(ItemStack itemStack) {
    return MathHelper.hsvToRGB(0.33f, 1.0f, 1.0f);
}
 
Example 5
Source File: AbstractMaterialPartBehavior.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public int getRGBDurabilityForDisplay(ItemStack itemStack) {
    return MathHelper.hsvToRGB((1.0f - (float) getDurabilityForDisplay(itemStack)) / 3.0f, 1.0f, 1.0f);
}
 
Example 6
Source File: RenderUtils.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
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);
}