Use partial ticks for rendering.

This commit is contained in:
Lizbeth Rika committed 2014-09-26 15:40:55 +01:00
1 parent 6b641ca46e
commit 09e9085142
12 files changed
+37 -39

No files matched your search

@@ -32,6 +32,8 @@ import cpw.mods.fml.common.gameevent.TickEvent;
public final class TiaraWingRenderHandler {
private static ResourceLocation textureHalo = new ResourceLocation(LibResources.MISC_HALO);
@SubscribeEvent
public void onPlayerRender(RenderPlayerEvent.Specials.Post event) {
InventoryBaubles inv = PlayerHandler.getPlayerBaubles(event.entityPlayer);
@@ -44,7 +46,7 @@ public final class TiaraWingRenderHandler {
boolean flying = event.entityPlayer.capabilities.isFlying;
float rz = 120F;
float rx = 20F + (float) ((Math.sin((double) event.entityPlayer.ticksExisted * (flying ? 0.4F : 0.2F)) + 0.5F) * (flying ? 30F : 5F));
float rx = 20F + (float) ((Math.sin((double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * (flying ? 0.4F : 0.2F)) + 0.5F) * (flying ? 30F : 5F));
float ry = 0F;
float h = 0.2F;
float i = 0.15F;
@@ -95,7 +97,7 @@ public final class TiaraWingRenderHandler {
rz = 0F;
ry = -rx;
rx = 0F;
GL11.glColor4f(1F, 1F, 1F, 0.5F + (float) Math.cos((double) event.entityPlayer.ticksExisted * 0.3F) * 0.2F);
GL11.glColor4f(1F, 1F, 1F, 0.5F + (float) Math.cos((double) (event.entityPlayer.ticksExisted + event.partialRenderTick) * 0.3F) * 0.2F);
break;
}
}
@@ -138,15 +140,13 @@ public final class TiaraWingRenderHandler {
GL11.glPopMatrix();
// Jibril's Halo
if(meta == 1) renderHalo(event.entityPlayer, event.partialRenderTick);
if(meta == 1)
renderHalo(event.entityPlayer, event.partialRenderTick);
}
}
}
private static ResourceLocation textureHalo = new ResourceLocation(LibResources.MISC_HALO);
private void renderHalo(EntityPlayer player, float partialTicks) {
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
@@ -42,7 +42,7 @@ public class RenderSpark extends RenderEntity {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.05F);
int time = ClientTickHandler.ticksInGame;
double time = ClientTickHandler.ticksInGame + par9;
time += new Random(par1Entity.getEntityId()).nextInt();
GL11.glColor4f(1F, 1F, 1F, 0.7F + 0.3F * (float) (Math.sin(time / 5.0) + 0.5) * 2);
@@ -53,11 +53,11 @@ public class RenderSpark extends RenderEntity {
float r = 180.0F - renderManager.playerViewY;
GL11.glRotatef(r, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(25F * (float) Math.sin((double) time / 15), 1F, 0F, 0F);
GL11.glRotatef(25F * (float) Math.sin(time / 15), 1F, 0F, 0F);
func_77026_a(tessellator, iicon);
int upgrade = spark.getUpgrade() - 1;
if(upgrade >= 0 && upgrade < ItemSparkUpgrade.worldIcons.length) {
GL11.glTranslatef(-0.02F + (float) Math.sin((double) time / 20) * 0.2F, 0.24F + (float) Math.cos((double) time / 20) * 0.2F, 0.005F);
GL11.glTranslatef(-0.02F + (float) Math.sin(time / 20) * 0.2F, 0.24F + (float) Math.cos(time / 20) * 0.2F, 0.005F);
GL11.glScalef(0.2F, 0.2F, 0.2F);
func_77026_a(tessellator, ItemSparkUpgrade.worldIcons[upgrade]);
}
@@ -42,7 +42,7 @@ public class RenderTileAlfPortal extends TileEntitySpecialRenderer {
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_CULL_FACE);
float alpha = (float) Math.min(1F, (Math.sin(ClientTickHandler.ticksInGame / 8D) + 1D) / 7D + 0.6D) * (Math.min(60, portal.ticksOpen) / 60F);
float alpha = (float) Math.min(1F, (Math.sin((double) (ClientTickHandler.ticksInGame + f) / 8D) + 1D) / 7D + 0.6D) * (Math.min(60, portal.ticksOpen) / 60F);
GL11.glColor4f(1F, 1F, 1F, alpha);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
@@ -28,6 +28,7 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.model.ModelAltar;
import vazkii.botania.common.block.tile.TileAltar;
@@ -73,7 +74,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
final float radiusBase = 1.2F;
final float radiusMod = 0.1F;
double ticks = Minecraft.getMinecraft().thePlayer.ticksExisted * 0.5;
double ticks = (ClientTickHandler.ticksInGame + pticks) * 0.5;
float offsetPerPetal = 360 / petals;
GL11.glPushMatrix();
@@ -70,7 +70,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_ALPHA_TEST);
float alpha = (float) ((Math.sin(ClientTickHandler.ticksInGame / 8D) + 1D) / 5D + 0.4D) * alphaMod;
float alpha = (float) ((Math.sin((double) (ClientTickHandler.ticksInGame + f) / 8D) + 1D) / 5D + 0.4D) * alphaMod;
if(ShaderHelper.useShaders())
GL11.glColor4f(1F, 1F, 1F, alpha);
else {
@@ -78,7 +78,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
int lightmapX = light % 65536;
int lightmapY = light / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
GL11.glColor4f(0.6F + (float) ((Math.cos(ClientTickHandler.ticksInGame / 6D) + 1D) / 5D), 0.1F, 0.9F, alpha);
GL11.glColor4f(0.6F + (float) ((Math.cos((double) (ClientTickHandler.ticksInGame + f) / 6D) + 1D) / 5D), 0.1F, 0.9F, alpha);
}
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
@@ -42,17 +42,17 @@ public class RenderTileMiniIsland extends TileEntitySpecialRenderer {
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glTranslated(d0, d1, d2);
int worldTime = tile.getWorldObj() == null ? 0 : ClientTickHandler.ticksInGame;
double worldTime = tile.getWorldObj() == null ? 0 : (double) (ClientTickHandler.ticksInGame + t);
if(tile.getWorldObj() != null)
worldTime += new Random(tile.xCoord ^ tile.yCoord ^ tile.zCoord).nextInt(1000);
GL11.glTranslatef(0.5F, 0F, 0.5F);
GL11.glRotatef(-(worldTime * 0.5F), 0F, 1F, 0F);
GL11.glRotatef(-((float) worldTime * 0.5F), 0F, 1F, 0F);
GL11.glTranslatef(-0.5F, 0F, -0.5F);
if(tile.getWorldObj() != null) {
GL11.glTranslatef(0F, (float) Math.sin((double) worldTime * 0.05F) * 0.1F, 0F);
GL11.glRotatef(4F * (float) Math.sin((double) worldTime * 0.04F), 1F, 0F, 0F);
GL11.glTranslatef(0F, (float) Math.sin(worldTime * 0.05F) * 0.1F, 0F);
GL11.glRotatef(4F * (float) Math.sin(worldTime * 0.04F), 1F, 0F, 0F);
}
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
@@ -87,7 +87,7 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glColor4f(1F, 1F, 1F, (float) ((Math.sin(ClientTickHandler.ticksInGame / 20.0) + 1) * 0.3 + 0.2));
GL11.glColor4f(1F, 1F, 1F, (float) ((Math.sin((double) (ClientTickHandler.ticksInGame + f) / 20.0) + 1) * 0.3 + 0.2));
GL11.glTranslatef(-0.5F, -1F - 0.43F, -0.5F);
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glScalef(s, s, s);
@@ -64,7 +64,7 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
Minecraft.getMinecraft().renderEngine.bindTexture(pink ? texturePinkOld : green ? textureGreenOld : textureOld);
else Minecraft.getMinecraft().renderEngine.bindTexture(pink ? texturePink : green ? textureGreen : texture);
int worldTime = tileentity.getWorldObj() == null ? 0 : ClientTickHandler.ticksInGame;
double worldTime = tileentity.getWorldObj() == null ? 0 : (double) (ClientTickHandler.ticksInGame + pticks);
if(tileentity != null)
worldTime += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(360);
@@ -82,7 +82,7 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
if(!ConfigHandler.oldPylonModel)
GL11.glTranslatef(0.5F, 0F, -0.5F);
GL11.glRotatef(worldTime * 1.5F, 0F, 1F, 0F);
GL11.glRotatef((float) worldTime * 1.5F, 0F, 1F, 0F);
if(!ConfigHandler.oldPylonModel)
GL11.glTranslatef(-0.5F, 0F, 0.5F);
@@ -98,7 +98,7 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
if(!ConfigHandler.oldPylonModel)
GL11.glTranslatef(0.5F, 0F, -0.5F);
GL11.glRotatef(-worldTime, 0F, 1F, 0F);
GL11.glRotatef((float) -worldTime, 0F, 1F, 0F);
if(!ConfigHandler.oldPylonModel)
GL11.glTranslatef(-0.5F, 0F, 0.5F);
@@ -59,14 +59,16 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer {
for(int i = 0; i < angles.length; i++)
angles[i] = totalAngle += anglePer;
double time = ClientTickHandler.ticksInGame + partticks;
for(int i = 0; i < altar.getSizeInventory(); i++) {
GL11.glPushMatrix();
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(1F, 2.5F, 1F);
GL11.glRotatef(angles[i] + ClientTickHandler.ticksInGame, 0F, 1F, 0F);
GL11.glRotatef(angles[i] + (float) time, 0F, 1F, 0F);
GL11.glTranslatef(2.25F, 0F, 0.5F);
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glTranslated(0D, 0.15 * Math.sin((ClientTickHandler.ticksInGame + i * 10) / 5D), 0F);
GL11.glTranslated(0D, 0.15 * Math.sin((time + i * 10) / 5D), 0F);
ItemStack stack = altar.getStackInSlot(i);
Minecraft mc = Minecraft.getMinecraft();
if(stack != null) {
@@ -29,7 +29,6 @@ public class RenderTileSpawnerClaw extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity var1, double d0, double d1, double d2, float var8) {
// TileTinyPotato potato = (TileTinyPotato) var1;
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glColor4f(1F, 1F, 1F, 1F);
@@ -39,15 +38,6 @@ public class RenderTileSpawnerClaw extends TileEntitySpecialRenderer {
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
GL11.glScalef(1F, -1F, -1F);
// int meta = potato.getWorldObj() == null ? 3 : potato.getBlockMetadata();
// GL11.glRotatef(meta * 90F - 180F, 0F, 1F, 0F);
//
// int jump = potato.jumpTicks;
// float up = (float) -Math.abs(Math.sin((float) jump / 10 * Math.PI)) * 0.2F;
// float rot = (float) Math.sin((float) jump / 10 * Math.PI) * 2;
//
// GL11.glTranslatef(0F, up, 0F);
// GL11.glRotatef(rot, 0F, 0F, 1F);
model.render();
GL11.glColor3f(1F, 1F, 1F);
@@ -56,16 +56,18 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
Minecraft.getMinecraft().renderEngine.bindTexture(spreader.isRedstone() ? textureRs : spreader.isDreamwood() ? textureDw : texture);
GL11.glScalef(1F, -1F, -1F);
double time = ClientTickHandler.ticksInGame + f;
if(spreader.isULTRA_SPREADER()) {
Color color = Color.getHSBColor((float) (((double) System.currentTimeMillis() / 10 + new Random(spreader.xCoord ^ spreader.yCoord ^ spreader.zCoord).nextInt(10000)) % 360) / 360F, 0.4F, 0.9F);
Color color = Color.getHSBColor((float) ((time * 5 + new Random(spreader.xCoord ^ spreader.yCoord ^ spreader.zCoord).nextInt(10000)) % 360) / 360F, 0.4F, 0.9F);
GL11.glColor3f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
}
model.render();
GL11.glColor3f(1F, 1F, 1F);
GL11.glPushMatrix();
long worldTicks = tileentity.getWorldObj() == null ? 0 : ClientTickHandler.ticksInGame;
GL11.glRotatef(worldTicks % 360, 0F, 1F, 0F);
double worldTicks = tileentity.getWorldObj() == null ? 0 : time;
GL11.glRotatef((float) worldTicks % 360, 0F, 1F, 0F);
GL11.glTranslatef(0F, (float) Math.sin(worldTicks / 20.0) * 0.05F, 0F);
model.renderCube();
GL11.glPopMatrix();
@@ -43,9 +43,12 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer {
int meta = potato.getWorldObj() == null ? 3 : potato.getBlockMetadata();
GL11.glRotatef(meta * 90F - 180F, 0F, 1F, 0F);
int jump = potato.jumpTicks;
float up = (float) -Math.abs(Math.sin((float) jump / 10 * Math.PI)) * 0.2F;
float rot = (float) Math.sin((float) jump / 10 * Math.PI) * 2;
float jump = potato.jumpTicks;
if(jump > 0)
jump += var8;
float up = (float) -Math.abs(Math.sin(jump / 10 * Math.PI)) * 0.2F;
float rot = (float) Math.sin(jump / 10 * Math.PI) * 2;
GL11.glTranslatef(0F, up, 0F);
GL11.glRotatef(rot, 0F, 0F, 1F);