Move Divination output to a HUD element

RIP chat spam 2014-2018

:hype:
This commit is contained in:
Nicholas Ignoffo 2018-02-12 19:45:09 -08:00
parent 3286849309
commit 7167aba23c
6 changed files with 188 additions and 69 deletions

View file

@ -0,0 +1,56 @@
package WayofTime.bloodmagic.client;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
public class Sprite {
private final ResourceLocation textureLocation;
private final int textureX;
private final int textureY;
private final int textureWidth;
private final int textureHeight;
public Sprite(ResourceLocation textureLocation, int textureX, int textureY, int textureWidth, int textureHeight) {
this.textureLocation = textureLocation;
this.textureX = textureX;
this.textureY = textureY;
this.textureWidth = textureWidth;
this.textureHeight = textureHeight;
}
public ResourceLocation getTextureLocation() {
return textureLocation;
}
public int getTextureX() {
return textureX;
}
public int getTextureY() {
return textureY;
}
public int getTextureWidth() {
return textureWidth;
}
public int getTextureHeight() {
return textureHeight;
}
public void draw(int x, int y) {
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(7, DefaultVertexFormats.POSITION_TEX);
buffer.pos((double) x, (double) (y + getTextureHeight()), 1.0F).tex((double) ((float) (getTextureX()) * f), (double) ((float) (getTextureY() + getTextureHeight()) * f1)).endVertex();
buffer.pos((double) (x + getTextureWidth()), (double) (y + getTextureHeight()), 1.0F).tex((double) ((float) (getTextureX() + getTextureWidth()) * f), (double) ((float) (getTextureY() + getTextureHeight()) * f1)).endVertex();
buffer.pos((double) (x + getTextureWidth()), (double) (y), 1.0F).tex((double) ((float) (getTextureX() + getTextureWidth()) * f), (double) ((float) (getTextureY()) * f1)).endVertex();
buffer.pos((double) x, (double) (y), 1.0F).tex((double) ((float) (getTextureX()) * f), (double) ((float) (getTextureY()) * f1)).endVertex();
tessellator.draw();
}
}