Files
Chisel/src/main/java/com/cricketcraft/chisel/utils/GeneralClient.java
T

40 lines
1.2 KiB
Java
Raw Normal View History

2014-12-15 00:11:48 +00:00
package com.cricketcraft.chisel.utils;
2014-03-16 22:26:43 +01:00
2014-12-14 20:05:39 +00:00
import java.util.HashMap;
import java.util.Random;
2014-03-16 22:26:43 +01:00
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
2014-12-11 20:09:54 -05:00
2015-01-11 20:59:16 +00:00
import org.lwjgl.opengl.GL11;
public class GeneralClient {
public static Random rand = new Random();
public static void playChiselSound(World world, int x, int y, int z, String sound) {
Minecraft.getMinecraft().theWorld.playSound(x + 0.5, y + 0.5, z + 0.5, sound, 0.3f + 0.7f * rand.nextFloat(), 0.6f + 0.4f * rand.nextFloat(), true);
}
static HashMap<String, ResourceLocation> resources = new HashMap<String, ResourceLocation>();
public static void bind(String textureName) {
ResourceLocation res = resources.get(textureName);
if (res == null) {
res = new ResourceLocation(textureName);
resources.put(textureName, res);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(res);
}
public static void setGLColorFromInt(int color)
{
float red = (color >> 16 & 255) / 255.0F;
float green = (color >> 8 & 255) / 255.0F;
float blue = (color & 255) / 255.0F;
GL11.glColor4f(red, green, blue, 1.0F);
}
2014-03-16 22:26:43 +01:00
}