This commit is contained in:
Ellpeck 2016-12-07 13:59:30 +01:00
parent c3ef81ff5f
commit b0d3ee66a2

View file

@ -18,15 +18,14 @@ import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
@ -38,9 +37,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
public final class AssetUtil{
public static int maxLightX = 0xF000F0;
public static int maxLightY = 0xF000F0;
public static final int MAX_LIGHT_X = 0xF000F0;
public static final int MAX_LIGHT_Y = 0xF000F0;
public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("gui_inventory");
@ -240,9 +239,9 @@ public final class AssetUtil{
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE);
int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC);
float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF);
GlStateManager.alphaFunc(GL11.GL_ALWAYS, 0);
int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC);
float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF);
GlStateManager.alphaFunc(GL11.GL_ALWAYS, 0);
GlStateManager.translate(firstX-TileEntityRendererDispatcher.staticPlayerX, firstY-TileEntityRendererDispatcher.staticPlayerY, firstZ-TileEntityRendererDispatcher.staticPlayerZ);
GlStateManager.rotate((float)(180*yaw/Math.PI), 0, 1, 0);
GlStateManager.rotate((float)(180*pitch/Math.PI), 0, 0, 1);
@ -296,35 +295,35 @@ public final class AssetUtil{
else{*/
GlStateManager.disableTexture2D();
render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
for (double i = 0; i < 4; i ++){
double width = beamWidth * (i/4.0);
render.pos(length, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(0, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(0, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(length, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(length, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(0, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(0, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(length, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(length, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(0, width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(0, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(length, width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(length, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(0, -width, width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(0, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
render.pos(length, -width, -width).tex(0, 0).lightmap(maxLightX, maxLightY).color(r, g, b, alpha).endVertex();
}
for(double i = 0; i < 4; i++){
double width = beamWidth*(i/4.0);
render.pos(length, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(0, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(0, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(length, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(length, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(0, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(0, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(length, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(length, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(0, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(0, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(length, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(length, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(0, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(0, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
render.pos(length, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(r, g, b, alpha).endVertex();
}
tessy.draw();
GlStateManager.enableTexture2D();
//}
GlStateManager.alphaFunc(func, ref);
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.alphaFunc(func, ref);
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.popMatrix();