Smooooooth animations
This commit is contained in:
@@ -26,7 +26,7 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doRender(EntityBlackHole blackhole, double x, double y, double z, float fa, float fb){
|
public void doRender(EntityBlackHole entity, double x, double y, double z, float entityYaw, float partialTicks){
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
|
||||||
@@ -48,14 +48,12 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
|||||||
|
|
||||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
if(blackhole.ticksExisted < 10){
|
int animationTicks = 10;
|
||||||
GlStateManager.scale((float)blackhole.ticksExisted / 10, (float)blackhole.ticksExisted / 10,
|
float age = entity.ticksExisted + partialTicks;
|
||||||
(float)blackhole.ticksExisted / 10);
|
float s = age < animationTicks ? age/animationTicks : MathHelper.clamp((entity.lifetime - age) / animationTicks, 0, 1);
|
||||||
}
|
s = (float)Math.pow(s, 0.4); // Smooths the animation
|
||||||
if(blackhole.ticksExisted > blackhole.lifetime - 10){
|
|
||||||
float scale = Math.max(0, (float)(blackhole.lifetime - blackhole.ticksExisted) / 10);
|
GlStateManager.scale(s, s, s);
|
||||||
GlStateManager.scale(scale, scale, scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.bindTexture(RAY_TEXTURE);
|
this.bindTexture(RAY_TEXTURE);
|
||||||
|
|
||||||
@@ -71,18 +69,18 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
|||||||
|
|
||||||
float scale = 3.0f;
|
float scale = 3.0f;
|
||||||
|
|
||||||
int a = blackhole.randomiser[j];
|
int a = entity.randomiser[j];
|
||||||
int b = blackhole.randomiser2[j];
|
int b = entity.randomiser2[j];
|
||||||
|
|
||||||
int sliceAngle = 20 + a;
|
int sliceAngle = 20 + a;
|
||||||
|
|
||||||
double x1 = scale * MathHelper.sin((blackhole.ticksExisted + 40 * j) * ((float)Math.PI / 180f));
|
double x1 = scale * MathHelper.sin((entity.ticksExisted + 40 * j) * ((float)Math.PI / 180f));
|
||||||
// double y1 = 0.7*MathHelper.cos((blackhole.timer - 40*j)*(Math.PI/180))*j/10;
|
// double y1 = 0.7*MathHelper.cos((blackhole.timer - 40*j)*(Math.PI/180))*j/10;
|
||||||
double z1 = scale * MathHelper.cos((blackhole.ticksExisted + 40 * j) * ((float)Math.PI / 180));
|
double z1 = scale * MathHelper.cos((entity.ticksExisted + 40 * j) * ((float)Math.PI / 180));
|
||||||
|
|
||||||
double x2 = scale * MathHelper.sin((blackhole.ticksExisted + 40 * j - sliceAngle) * ((float)Math.PI / 180));
|
double x2 = scale * MathHelper.sin((entity.ticksExisted + 40 * j - sliceAngle) * ((float)Math.PI / 180));
|
||||||
// double y2 = 0.7*MathHelper.sin((blackhole.timer - 40*j)*(Math.PI/180))*j/10;
|
// double y2 = 0.7*MathHelper.sin((blackhole.timer - 40*j)*(Math.PI/180))*j/10;
|
||||||
double z2 = scale * MathHelper.cos((blackhole.ticksExisted + 40 * j - sliceAngle) * ((float)Math.PI / 180));
|
double z2 = scale * MathHelper.cos((entity.ticksExisted + 40 * j - sliceAngle) * ((float)Math.PI / 180));
|
||||||
|
|
||||||
double absoluteX = x1 * MathHelper.cos(31 * b);
|
double absoluteX = x1 * MathHelper.cos(31 * b);
|
||||||
double absoluteY = z1 * MathHelper.sin(31 * a) + x1 * MathHelper.cos(31 * a) * MathHelper.sin(31 * b);
|
double absoluteY = z1 * MathHelper.sin(31 * a) + x1 * MathHelper.cos(31 * a) * MathHelper.sin(31 * b);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class RenderMagicLight extends TileEntitySpecialRenderer<TileEntityMagicL
|
|||||||
"textures/entity/light/flare.png");
|
"textures/entity/light/flare.png");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityMagicLight tileentity, double x, double y, double z, float f,
|
public void render(TileEntityMagicLight tileentity, double x, double y, double z, float partialTicks,
|
||||||
int destroyStage, float alpha){
|
int destroyStage, float alpha){
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
@@ -32,14 +32,12 @@ public class RenderMagicLight extends TileEntitySpecialRenderer<TileEntityMagicL
|
|||||||
|
|
||||||
GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5);
|
GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5);
|
||||||
|
|
||||||
if(tileentity.timer < 10){
|
int animationTicks = 10;
|
||||||
GlStateManager.scale((float)tileentity.timer / 10, (float)tileentity.timer / 10,
|
float age = tileentity.timer + partialTicks;
|
||||||
(float)tileentity.timer / 10);
|
float s = age < animationTicks ? age/animationTicks : MathHelper.clamp((tileentity.getLifetime() - age) / animationTicks, 0, 1);
|
||||||
}
|
s = (float)Math.pow(s, 0.4); // Smooths the animation
|
||||||
if(tileentity.maxTimer > 0 && tileentity.timer > tileentity.maxTimer - 10){
|
|
||||||
float scale = Math.max(0, (float)(tileentity.maxTimer - tileentity.timer) / 10);
|
GlStateManager.scale(s, s, s);
|
||||||
GlStateManager.scale(scale, scale, scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Renders the aura effect
|
// Renders the aura effect
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ public class TileEntityTimer extends TileEntity implements ITickable {
|
|||||||
this.maxTimer = lifetime;
|
this.maxTimer = lifetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getLifetime(){
|
||||||
|
return maxTimer;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound){
|
public void readFromNBT(NBTTagCompound tagCompound){
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
|
|||||||
Reference in New Issue
Block a user