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
@@ -0,0 +1,59 @@
package appeng.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.io.IOException;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.player.EntityPlayer;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.render.effects.AssemblerFX;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.util.item.AEItemStack;
public class PacketAssemblerAnimation extends AppEngPacket
{
int x, y, z;
byte rate;
IAEItemStack is;
// automatic.
public PacketAssemblerAnimation(ByteBuf stream) throws IOException {
x = stream.readInt();
y = stream.readInt();
z = stream.readInt();
rate = stream.readByte();
is = AEItemStack.loadItemStackFromPacket( stream );
}
@Override
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
{
double d0 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
double d1 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
double d2 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D);
AssemblerFX fx = new AssemblerFX( Minecraft.getMinecraft().theWorld, x + d0, y + d1, z + d2, 0.0D, 0.0D, 0.0D, rate, is );
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
}
// api
public PacketAssemblerAnimation(int x, int y, int z, byte rate, IAEItemStack is) throws IOException {
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( this.x = x );
data.writeInt( this.y = y );
data.writeInt( this.z = z );
data.writeByte( this.rate = rate );
is.writeToPacket( data );
this.is = is;
configureWrite( data );
}
}
+2 -2
View File
@@ -9,7 +9,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.player.EntityPlayer;
import appeng.client.ClientHelper;
import appeng.client.render.effects.LightningEffect;
import appeng.client.render.effects.LightningFX;
import appeng.core.AEConfig;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
@@ -39,7 +39,7 @@ public class PacketLightning extends AppEngPacket
{
if ( Platform.isClient() && AEConfig.instance.enableEffects )
{
LightningEffect fx = new LightningEffect( ClientHelper.proxy.getWorld(), x, y, z, 0.0f, 0.0f, 0.0f );
LightningFX fx = new LightningFX( ClientHelper.proxy.getWorld(), x, y, z, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
}
}
+2 -2
View File
@@ -10,7 +10,7 @@ import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.world.World;
import appeng.client.render.effects.MatterCannonEffect;
import appeng.client.render.effects.MatterCannonFX;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import cpw.mods.fml.client.FMLClientHandler;
@@ -49,7 +49,7 @@ public class PacketMatterCannon extends AppEngPacket
World world = FMLClientHandler.instance().getClient().theWorld;
for (int a = 1; a < len; a++)
{
MatterCannonEffect fx = new MatterCannonEffect( world, x + dx * a, y + dy * a, z + dz * a, Items.diamond );
MatterCannonFX fx = new MatterCannonFX( world, x + dx * a, y + dy * a, z + dz * a, Items.diamond );
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
}