Added Animation for MAssembler

This commit is contained in:
AlgorithmX2
2014-07-06 21:04:58 -05:00
parent 70ef70a42e
commit f3344f28c0
24 changed files with 637 additions and 262 deletions
+45
View File
@@ -0,0 +1,45 @@
package appeng.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
final public class EntityFloatingItem extends EntityItem
{
public static int ageStatic = 0;
int superDeath = 0;
private Entity parent;
float progress = 0;
public EntityFloatingItem(Entity parent, World p_i1710_1_, double p_i1710_2_, double p_i1710_4_, double p_i1710_6_, ItemStack p_i1710_8_) {
super( p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_, p_i1710_8_ );
motionX = motionY = motionZ = 0.0d;
this.hoverStart = 0.5f;
this.rotationYaw = 0;
this.parent = parent;
}
// public boolean isEntityAlive()
public void onUpdate()
{
if ( !isDead && parent.isDead )
this.setDead();
if ( superDeath++ > 100 )
setDead();
this.age = ageStatic;
}
public void setProgress(float progress)
{
this.progress = progress;
if ( this.progress > 0.99 )
this.setDead();
}
}
+52
View File
@@ -0,0 +1,52 @@
package appeng.entity;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderFloatingItem extends RenderItem
{
public static DoubleBuffer buffer = ByteBuffer.allocateDirect( 8 * 4 ).asDoubleBuffer();
public RenderFloatingItem() {
this.shadowOpaque = 0.0F;
this.renderManager = RenderManager.instance;
}
@Override
public boolean shouldBob()
{
return false;
}
@Override
public void doRender(EntityItem p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
if ( p_76986_1_ instanceof EntityFloatingItem )
{
EntityFloatingItem efi = (EntityFloatingItem) p_76986_1_;
if ( efi.progress > 0.0 )
{
GL11.glPushMatrix();
if ( !(efi.getEntityItem().getItem() instanceof ItemBlock) )
GL11.glTranslatef( 0, -0.15f, 0 );
super.doRender( efi, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_ );
GL11.glPopMatrix();
}
}
}
}