Work on getting the pylons to render properly, looking pretty good.

This commit is contained in:
Vasco Lavos committed 2014-03-02 21:23:24 +00:00
1 parent 7c856a9884
commit e71d6535c7
3 files changed
+60 -6

No files matched your search

@@ -34,8 +34,8 @@ public class ModelPylon extends ModelBase {
ModelRenderer outside8;
public ModelPylon() {
textureWidth = 256;
textureHeight = 128;
textureWidth = 64;
textureHeight = 32;
crystal1 = new ModelRenderer(this, 0, 0);
crystal1.addBox(-1.5F, -7F, -1F, 3, 7, 2);
@@ -11,7 +11,10 @@
*/
package vazkii.botania.client.render.tile;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
@@ -24,7 +27,7 @@ import vazkii.botania.client.model.ModelPylon;
public class RenderTilePylon extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_POOL);
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_PYLON);
ModelPylon model = new ModelPylon();
@Override
@@ -35,11 +38,39 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glTranslated(d0 + 0.5, d1 + 2.0, d2 + 0.5);
int worldTime = (int) (tileentity.worldObj == null ? 0 : tileentity.worldObj.getTotalWorldTime());
if(tileentity != null)
worldTime += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(360);
GL11.glTranslated(d0 + 0.5, d1 + 2.2, d2 + 0.5);
GL11.glScalef(1F, -1.5F, -1F);
model.renderCrystal();
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
GL11.glPushMatrix();
GL11.glRotatef(worldTime * 1.5F, 0F, 1F, 0F);
model.renderRing();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0D, Math.sin((double) worldTime / 20D) / 17.5, 0D);
GL11.glRotatef(-worldTime, 0F, 1F, 0F);
GL11.glDisable(GL11.GL_CULL_FACE);
model.renderCrystal();
GL11.glColor4f(1F, 1F, 1F, 1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
double alpha = Math.sin((double) worldTime / 20D) / 2D + 0.5;
GL11.glColor4d(1D, 1D, 1D, alpha + 0.183F);
GL11.glScalef(1.1F, 1.1F, 1.1F);
GL11.glTranslatef(0F, -0.09F, 0F);
model.renderCrystal();
GL11.glPopMatrix();
GL11.glScalef(1F, -1.5F, -1F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
@@ -11,10 +11,33 @@
*/
package vazkii.botania.common.block.tile;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.tileentity.TileEntity;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.helper.Vector3;
public class TilePylon extends TileEntity {
boolean activated = true; // TODO
@Override
public void updateEntity() {
if(activated && worldObj.isRemote) {
Vector3 centerBlock = new Vector3(-500.5, 4.75 + (Math.random() - 0.5 * 0.25), -411.5);
int id = worldObj.getBlockId(xCoord, yCoord - 1, zCoord);
if(id == ModBlocks.flower.blockID) {
int meta = worldObj.getBlockMetadata(xCoord, yCoord - 1, zCoord);
float[] color = EntitySheep.fleeceColorTable[meta];
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord - 0.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 3F, -0.04F);
Vector3 ourCoords = Vector3.fromTileEntityCenter(this).add(0, 1 + (Math.random() - 0.5 * 0.25), 0);
Vector3 movementVector = centerBlock.sub(ourCoords).normalize().multiply(0.2);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 8F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
}
}
}
}