Fix transient doors being solid
This commit is contained in:
parent
2b0fde9633
commit
8c575270f3
3 changed files with 225 additions and 180 deletions
|
@ -0,0 +1,187 @@
|
|||
package org.dimdev.dimdoors.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.dimdev.ddutils.RGBA;
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
public final class DimensionalWallRenderer {
|
||||
|
||||
private static final FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
|
||||
private static final ResourceLocation warpPath = new ResourceLocation(DimDoors.MODID + ":textures/other/warp.png");
|
||||
|
||||
// TODO: any angle
|
||||
/**
|
||||
* @param x The x coordinate of the wall's center.
|
||||
* @param y The y coordinate of the wall's center.
|
||||
* @param z The z coordinate of the wall's center.
|
||||
* //@param yaw The yaw of the normal vector of the wall in degrees, relative to __.
|
||||
* //@param pitch The pitch of the normal vector of the wall, relative to the xz plane.
|
||||
* @param orientation The orientation of the wall.
|
||||
* @param width The width of the wall.
|
||||
* @param height The height of the wall.
|
||||
* @param colors An array containing the color to use on each pass. Its length determines the number of passes to do.
|
||||
*/
|
||||
public static void renderDimensionalWall(double x, double y, double z, EnumFacing orientation, double width, double height, RGBA[] colors) {
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
for (int pass = 0; pass < 16; pass++) {
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
float var15 = 16 - pass;
|
||||
float var16 = 0.2625F;
|
||||
float var17 = 1.0F / (var15 + .80F);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(warpPath);
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
if (pass == 0) {
|
||||
var17 = 0.1F;
|
||||
var15 = 25.0F;
|
||||
var16 = 0.125F;
|
||||
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
if (pass == 1) {
|
||||
var16 = 0.5F;
|
||||
GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
GlStateManager.translate(Minecraft.getSystemTime() % 200000L / 200000.0F, 0, 0.0F);
|
||||
GlStateManager.translate(0, Minecraft.getSystemTime() % 200000L / 200000.0F, 0.0F);
|
||||
GlStateManager.translate(0, 0, Minecraft.getSystemTime() % 200000L / 200000.0F);
|
||||
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_LINEAR);
|
||||
|
||||
|
||||
switch (orientation) {
|
||||
case SOUTH:
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, -0.15F));
|
||||
break;
|
||||
case WEST:
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.15F));
|
||||
break;
|
||||
case NORTH:
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.15F));
|
||||
break;
|
||||
case EAST:
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, -0.15F));
|
||||
break;
|
||||
case UP:
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, getBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, getBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_EYE_PLANE, getBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
break;
|
||||
case DOWN:
|
||||
// TODO: logic for DOWN
|
||||
}
|
||||
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.S);
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.T);
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.R);
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.Q);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
GlStateManager.matrixMode(GL11.GL_TEXTURE);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.loadIdentity();
|
||||
GlStateManager.translate(0.0F, Minecraft.getSystemTime() % 200000L / 200000.0F * var15, 0.0F);
|
||||
GlStateManager.scale(var16, var16, var16);
|
||||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||
GlStateManager.rotate((pass * pass * 4321 + pass * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder worldRenderer = tessellator.getBuffer();
|
||||
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
|
||||
|
||||
RGBA color = colors[pass];
|
||||
GlStateManager.color(color.getRed() * var17, color.getGreen() * var17, color.getBlue() * var17, color.getAlpha());
|
||||
|
||||
switch (orientation) {
|
||||
case NORTH:
|
||||
worldRenderer.pos(x, y, z).endVertex();
|
||||
worldRenderer.pos(x, y + height, z).endVertex();
|
||||
worldRenderer.pos(x + width, y + height, z).endVertex();
|
||||
worldRenderer.pos(x + width, y, z).endVertex();
|
||||
break;
|
||||
case SOUTH:
|
||||
worldRenderer.pos(x, y, z).endVertex();
|
||||
worldRenderer.pos(x + width, y, z).endVertex();
|
||||
worldRenderer.pos(x + width, y + height, z).endVertex();
|
||||
worldRenderer.pos(x, y + height, z).endVertex();
|
||||
break;
|
||||
case WEST:
|
||||
worldRenderer.pos(x, y, z).endVertex();
|
||||
worldRenderer.pos(x, y, z + width).endVertex();
|
||||
worldRenderer.pos(x, y + height, z + width).endVertex();
|
||||
worldRenderer.pos(x, y + height, z).endVertex();
|
||||
break;
|
||||
case EAST:
|
||||
worldRenderer.pos(x, y, z).endVertex();
|
||||
worldRenderer.pos(x, y + height, z).endVertex();
|
||||
worldRenderer.pos(x, y + height, z + width).endVertex();
|
||||
worldRenderer.pos(x, y, z + width).endVertex();
|
||||
break;
|
||||
case UP:
|
||||
worldRenderer.pos(x, y, z).endVertex();
|
||||
worldRenderer.pos(x, y, z + width).endVertex();
|
||||
worldRenderer.pos(x + width, y, z + width).endVertex();
|
||||
worldRenderer.pos(x + width, y, z).endVertex();
|
||||
break;
|
||||
case DOWN:
|
||||
worldRenderer.pos(x, y, z).endVertex();
|
||||
worldRenderer.pos(x + width, y, z).endVertex();
|
||||
worldRenderer.pos(x + width, y, z + width).endVertex();
|
||||
worldRenderer.pos(x, y, z + width).endVertex();
|
||||
break;
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.S);
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.T);
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.R);
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.Q);
|
||||
GlStateManager.enableLighting();
|
||||
}
|
||||
|
||||
private static FloatBuffer getBuffer(float par1, float par2, float par3, float par4) {
|
||||
buffer.clear();
|
||||
buffer.put(par1).put(par2).put(par3).put(par4);
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
}
|
|
@ -1,188 +1,31 @@
|
|||
package org.dimdev.dimdoors.client;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.dimdev.ddutils.RGBA;
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift;
|
||||
import org.dimdev.ddutils.RGBA;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.vertex.*;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TileEntityEntranceRiftRenderer extends TileEntitySpecialRenderer<TileEntityEntranceRift> { // TODO: see TileEntityEndGatewayRenderer
|
||||
|
||||
private final FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
|
||||
private final ResourceLocation warpPath = new ResourceLocation(DimDoors.MODID + ":textures/other/warp.png");
|
||||
private final ResourceLocation keyPath = new ResourceLocation(DimDoors.MODID + ":textures/other/keyhole.png");
|
||||
private final ResourceLocation keyholeLight = new ResourceLocation(DimDoors.MODID + ":textures/other/keyhole_light.png");
|
||||
private final Map<TileEntityEntranceRift, RGBA[]> colorMap = new HashMap<>();
|
||||
|
||||
// TODO: allow any angle, make static and in a separate class
|
||||
public void renderDimensionalWall(double x, double y, double z, RGBA[] colors, EnumFacing orientation, double extendUp, double extendDown, double extendLeft, double extendRight, double pushIn) {
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
for (int pass = 0; pass < 16; pass++) {
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
float var15 = 16 - pass;
|
||||
float var16 = 0.2625F;
|
||||
float var17 = 1.0F / (var15 + .80F);
|
||||
|
||||
bindTexture(warpPath);
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
if (pass == 0) {
|
||||
var17 = 0.1F;
|
||||
var15 = 25.0F;
|
||||
var16 = 0.125F;
|
||||
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
if (pass == 1) {
|
||||
var16 = 0.5F;
|
||||
GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
GlStateManager.translate(Minecraft.getSystemTime() % 200000L / 200000.0F, 0, 0.0F);
|
||||
GlStateManager.translate(0, Minecraft.getSystemTime() % 200000L / 200000.0F, 0.0F);
|
||||
GlStateManager.translate(0, 0, Minecraft.getSystemTime() % 200000L / 200000.0F);
|
||||
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_LINEAR);
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_LINEAR);
|
||||
|
||||
|
||||
switch (orientation) {
|
||||
case SOUTH:
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 0.0F, 1.0F, -0.15F));
|
||||
break;
|
||||
case WEST:
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, getFloatBuffer(1.0F, 0.0F, 0.0F, 0.15F));
|
||||
break;
|
||||
case NORTH:
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 0.0F, 1.0F, 0.15F));
|
||||
break;
|
||||
case EAST:
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_OBJECT_PLANE, getFloatBuffer(1.0F, 0.0F, 0.0F, -0.15F));
|
||||
break;
|
||||
case UP:
|
||||
GlStateManager.texGen(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
GlStateManager.texGen(GlStateManager.TexGen.Q, GL11.GL_EYE_PLANE, getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
|
||||
break;
|
||||
case DOWN:
|
||||
// TODO: logic for DOWN
|
||||
}
|
||||
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.S);
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.T);
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.R);
|
||||
GlStateManager.enableTexGenCoord(GlStateManager.TexGen.Q);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
GlStateManager.matrixMode(GL11.GL_TEXTURE);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.loadIdentity();
|
||||
GlStateManager.translate(0.0F, Minecraft.getSystemTime() % 200000L / 200000.0F * var15, 0.0F);
|
||||
GlStateManager.scale(var16, var16, var16);
|
||||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||
GlStateManager.rotate((pass * pass * 4321 + pass * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder worldRenderer = tessellator.getBuffer();
|
||||
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
|
||||
|
||||
RGBA color = colors[pass];
|
||||
GlStateManager.color(color.getRed() * var17, color.getGreen() * var17, color.getBlue() * var17, color.getAlpha());
|
||||
|
||||
// Offsets in horizontal vertical and depth directions
|
||||
double ohs = 0.5 - extendLeft;
|
||||
double ohe = 0.5 + extendRight;
|
||||
double ovs = 0.5 - extendDown;
|
||||
double ove = 0.5 + extendUp;
|
||||
// Render the rectangle based on the orientation
|
||||
double od = orientation == EnumFacing.NORTH || orientation == EnumFacing.WEST || orientation == EnumFacing.UP ? pushIn : 1 - pushIn;
|
||||
switch (orientation) {
|
||||
case NORTH:
|
||||
worldRenderer.pos(x + ohs, y + ovs, z + od).endVertex();
|
||||
worldRenderer.pos(x + ohs, y + ove, z + od).endVertex();
|
||||
worldRenderer.pos(x + ohe, y + ove, z + od).endVertex();
|
||||
worldRenderer.pos(x + ohe, y + ovs, z + od).endVertex();
|
||||
break;
|
||||
case SOUTH:
|
||||
worldRenderer.pos(x + ohs, y + ovs, z + od).endVertex();
|
||||
worldRenderer.pos(x + ohe, y + ovs, z + od).endVertex();
|
||||
worldRenderer.pos(x + ohe, y + ove, z + od).endVertex();
|
||||
worldRenderer.pos(x + ohs, y + ove, z + od).endVertex();
|
||||
break;
|
||||
case WEST:
|
||||
worldRenderer.pos(x + od, y + ovs, z + ohs).endVertex();
|
||||
worldRenderer.pos(x + od, y + ovs, z + ohe).endVertex();
|
||||
worldRenderer.pos(x + od, y + ove, z + ohe).endVertex();
|
||||
worldRenderer.pos(x + od, y + ove, z + ohs).endVertex();
|
||||
break;
|
||||
case EAST:
|
||||
worldRenderer.pos(x + od, y + ovs, z + ohs).endVertex();
|
||||
worldRenderer.pos(x + od, y + ove, z + ohs).endVertex();
|
||||
worldRenderer.pos(x + od, y + ove, z + ohe).endVertex();
|
||||
worldRenderer.pos(x + od, y + ovs, z + ohe).endVertex();
|
||||
break;
|
||||
case UP:
|
||||
worldRenderer.pos(x + ovs, y + od, z + ohs).endVertex();
|
||||
worldRenderer.pos(x + ohs, y + od, z + ohe).endVertex();
|
||||
worldRenderer.pos(x + ohe, y + od, z + ohe).endVertex();
|
||||
worldRenderer.pos(x + ohe, y + od, z + ohs).endVertex();
|
||||
break;
|
||||
case DOWN:
|
||||
worldRenderer.pos(x + ovs, y + od, z + ohs).endVertex();
|
||||
worldRenderer.pos(x + ohe, y + od, z + ohs).endVertex();
|
||||
worldRenderer.pos(x + ohe, y + od, z + ohe).endVertex();
|
||||
worldRenderer.pos(x + ohs, y + od, z + ohe).endVertex();
|
||||
break;
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.S);
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.T);
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.R);
|
||||
GlStateManager.disableTexGenCoord(GlStateManager.TexGen.Q);
|
||||
GlStateManager.enableLighting();
|
||||
}
|
||||
|
||||
private RGBA[] getColors(TileEntityEntranceRift entrance) {
|
||||
if (colorMap.containsKey(entrance)) return colorMap.get(entrance);
|
||||
Random rand = new Random(31100L);
|
||||
|
@ -192,13 +35,6 @@ public class TileEntityEntranceRiftRenderer extends TileEntitySpecialRenderer<Ti
|
|||
return colors;
|
||||
}
|
||||
|
||||
private FloatBuffer getFloatBuffer(float par1, float par2, float par3, float par4) {
|
||||
buffer.clear();
|
||||
buffer.put(par1).put(par2).put(par3).put(par4);
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private void renderKeyHole(TileEntityEntranceRift tile, double x, double y, double z, int i) {
|
||||
EnumFacing rotation = EnumFacing.getHorizontal((tile.orientation.getHorizontalIndex() + 3) % 4);
|
||||
|
||||
|
@ -267,7 +103,20 @@ public class TileEntityEntranceRiftRenderer extends TileEntitySpecialRenderer<Ti
|
|||
@Override
|
||||
public void render(TileEntityEntranceRift entrance, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
|
||||
if (entrance.shouldRender) {
|
||||
renderDimensionalWall(x, y, z, getColors(entrance), entrance.orientation, entrance.extendUp, entrance.extendDown, entrance.extendLeft, entrance.extendRight, entrance.pushIn);
|
||||
Vec3d offset = new Vec3d(entrance.orientation.getOpposite().getDirectionVec()).scale(
|
||||
entrance.orientation == EnumFacing.NORTH ||
|
||||
entrance.orientation == EnumFacing.WEST ||
|
||||
entrance.orientation == EnumFacing.UP ? entrance.pushIn : entrance.pushIn - 1);
|
||||
DimensionalWallRenderer.renderDimensionalWall(
|
||||
x + offset.x,
|
||||
y + offset.y,
|
||||
z + offset.z,
|
||||
//entrance.orientation.getHorizontalAngle(),
|
||||
//entrance.orientation.getDirectionVec().getY() * 90,
|
||||
entrance.orientation,
|
||||
entrance.extendLeft + entrance.extendRight,
|
||||
entrance.extendDown + entrance.extendUp,
|
||||
getColors(entrance));
|
||||
if (entrance.lockStatus >= 1) {
|
||||
for (int i = 0; i < 1 + entrance.lockStatus; i++) {
|
||||
renderKeyHole(entrance, x, y, z, i);
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package org.dimdev.dimdoors.shared.blocks;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -28,6 +32,11 @@ public class BlockDimensionalDoorTransient extends BlockDimensionalDoor { // TOD
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupRift(TileEntityEntranceRift rift) {
|
||||
// TODO
|
||||
|
|
Loading…
Add table
Reference in a new issue