Readded dandelion and magic tree particles

This commit is contained in:
Adubbz 2013-12-28 17:59:09 +11:00
parent 27515b2d51
commit 0d6e232c4f
7 changed files with 554 additions and 11 deletions

View File

@ -6,7 +6,12 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.util.MathHelper;
import biomesoplenty.api.BOPItemHelper;
import biomesoplenty.client.particles.EntityDandelionFX;
import biomesoplenty.client.particles.EntityMagicTreeFX;
import biomesoplenty.client.particles.EntityPixieTrailFX;
import biomesoplenty.client.particles.EntitySteamFX;
import biomesoplenty.client.render.blocks.BambooRenderer;
import biomesoplenty.client.render.blocks.FoliageRenderer;
import biomesoplenty.client.render.blocks.GraveRenderer;
@ -67,22 +72,22 @@ public class ClientProxy extends CommonProxy
{
entityfx = new EntityBreakingFX(minecraft.theWorld, x, y, z, BOPItemHelper.get("dart"), 1);
}
/*else if (string == "dandelion")
else if (string == "dandelion")
{
entityfx = new EntityDandelionFX(mc.theWorld, x, y, z, 2.0F);
entityfx = new EntityDandelionFX(minecraft.theWorld, x, y, z, 2.0F);
}
else if (string == "steam")
{
entityfx = new EntitySteamFX(mc.theWorld, x, y, z, 0.0D, 0.0D, 0.0D);
entityfx = new EntitySteamFX(minecraft.theWorld, x, y, z, 0.0D, 0.0D, 0.0D);
}
else if (string == "magictree")
{
entityfx = new EntityMagicTreeFX(mc.theWorld, x, y, z, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03), -0.02D, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03));
entityfx = new EntityMagicTreeFX(minecraft.theWorld, x, y, z, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03), -0.02D, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03));
}
else if (string == "pixietrail")
{
entityfx = new EntityPixieTrailFX(mc.theWorld, x, y, z, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03), -0.02D, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03));
}*/
entityfx = new EntityPixieTrailFX(minecraft.theWorld, x, y, z, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03), -0.02D, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03));
}
minecraft.effectRenderer.addEffect(entityfx);
}

View File

@ -0,0 +1,103 @@
package biomesoplenty.client.particles;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class EntityDandelionFX extends EntityFX
{
private static final String texture = "biomesoplenty:textures/particles/dandelion.png";
public EntityDandelionFX(World par1World, double par2, double par4, double par6, float par8)
{
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
motionX *= 0.20000000149011612D;
motionY *= 0.10000000149011612D;
motionZ *= 0.20000000149011612D;
float f4 = (float)Math.random() * 0.4F + 0.6F;
particleScale *= 0.25F;
particleScale *= par8;
particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
particleMaxAge = (int)(particleMaxAge * par8);
noClip = false;
this.setSize(0.01F, 0.01F);
}
@Override
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
tessellator.draw();
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glEnable(3042);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(texture));
float sizeFactor = 0.1F * particleScale;
float var13 = (float)(prevPosX + (posX - prevPosX) * par2 - EntityFX.interpPosX);
float var14 = (float)(prevPosY + (posY - prevPosY) * par2 - EntityFX.interpPosY);
float var15 = (float)(prevPosZ + (posZ - prevPosZ) * par2 - EntityFX.interpPosZ);
tessellator.startDrawingQuads();
tessellator.setBrightness(240);
tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, 1.0F);
tessellator.addVertexWithUV(var13 - par3 * sizeFactor - par6 * sizeFactor, var14 - par4 * sizeFactor, var15 - par5 * sizeFactor - par7 * sizeFactor, 0.0D, 1.0D);
tessellator.addVertexWithUV(var13 - par3 * sizeFactor + par6 * sizeFactor, var14 + par4 * sizeFactor, var15 - par5 * sizeFactor + par7 * sizeFactor, 1.0D, 1.0D);
tessellator.addVertexWithUV(var13 + par3 * sizeFactor + par6 * sizeFactor, var14 + par4 * sizeFactor, var15 + par5 * sizeFactor + par7 * sizeFactor, 1.0D, 0.0D);
tessellator.addVertexWithUV(var13 + par3 * sizeFactor - par6 * sizeFactor, var14 - par4 * sizeFactor, var15 + par5 * sizeFactor - par7 * sizeFactor, 0.0D, 0.0D);
tessellator.draw();
GL11.glDisable(3042);
GL11.glDepthMask(true);
GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("/particles.png"));
tessellator.startDrawingQuads();
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
if (particleAge++ >= particleMaxAge)
{
this.setDead();
}
motionY += 0.004D;
this.moveEntity(motionX, motionY, motionZ);
if (posY == prevPosY)
{
motionX *= 1.1D;
motionZ *= 1.1D;
}
motionX *= 0.9599999785423279D;
motionY *= 0.9599999785423279D;
motionZ *= 0.9599999785423279D;
if (onGround)
{
motionX *= 0.699999988079071D;
motionZ *= 0.699999988079071D;
}
}
}

View File

@ -0,0 +1,141 @@
package biomesoplenty.client.particles;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Direction;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class EntityMagicTreeFX extends EntityFX
{
private static final String texture = "biomesoplenty:textures/particles/magictree.png";
float magicTreeParticleScale;
public EntityMagicTreeFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
{
this(par1World, par2, par4, par6, par8, par10, par12, 1.0F);
}
public EntityMagicTreeFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14)
{
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += par8;
this.motionY += par10;
this.motionZ += par12;
this.particleScale *= 0.75F;
this.particleScale *= par14;
this.magicTreeParticleScale = this.particleScale;
this.particleMaxAge = (int)((8.0D / (Math.random() * 0.8D + 0.2D)) * 64);
this.particleMaxAge = (int)((float)this.particleMaxAge * par14);
this.particleAge = (particleMaxAge / 16) + (int)((particleMaxAge / 16) * par1World.rand.nextInt(7));
this.noClip = false;
}
@Override
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float f = (particleAge + par2) / particleMaxAge * 32.0F;
if (f < 0.0F)
{
f = 0.0F;
}
if (f > 1.0F)
{
f = 1.0F;
}
particleScale = particleScale * f;
tessellator.draw();
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(texture));
float f6 = (float)this.particleTextureIndexX / 16.0F;
float f7 = f6 + 0.0624375F;
float f8 = (float)this.particleTextureIndexY / 16.0F;
float f9 = f8 + 0.0624375F;
float f10 = 0.1F * this.particleScale;
if (this.particleIcon != null)
{
f6 = this.particleIcon.getMinU();
f7 = this.particleIcon.getMaxU();
f8 = this.particleIcon.getMinV();
f9 = this.particleIcon.getMaxV();
}
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
tessellator.startDrawingQuads();
tessellator.setBrightness(150);
tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1.0F);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
tessellator.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("textures/particle/particles.png"));
tessellator.startDrawingQuads();
}
@Override
public void onUpdate()
{
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
if (particleAge++ >= particleMaxAge)
{
this.setDead();
}
this.setParticleTextureIndex(7 - particleAge * 8 / particleMaxAge);
motionY -= 0.0004D;
this.moveEntity(motionX, motionY, motionZ);
if (posY == prevPosY)
{
motionX *= 1.1D;
motionZ *= 1.1D;
}
motionX *= 0.9599999785423279D;
motionY *= 0.9599999785423279D;
motionZ *= 0.9599999785423279D;
if (onGround)
{
motionX *= 0.699999988079071D;
motionZ *= 0.699999988079071D;
}
}
}

View File

@ -0,0 +1,140 @@
package biomesoplenty.client.particles;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Direction;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class EntityPixieTrailFX extends EntityFX
{
private static final String texture = "biomesoplenty:textures/particles/pixietrail.png";
float pixieTrailParticleScale;
public EntityPixieTrailFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
{
this(par1World, par2, par4, par6, par8, par10, par12, 1.0F);
}
public EntityPixieTrailFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14)
{
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += par8;
this.motionY += par10;
this.motionZ += par12;
this.particleScale *= 0.75F;
this.particleScale *= par14;
this.pixieTrailParticleScale = this.particleScale;
this.particleMaxAge = (int)((8.0D / (Math.random() * 0.8D + 0.2D)) * 8);
this.particleMaxAge = (int)((float)this.particleMaxAge * par14);
this.particleAge = (particleMaxAge / 2) + (int)((particleMaxAge / 2) * par1World.rand.nextInt(7));
this.noClip = false;
}
@Override
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float f = (particleAge + par2) / particleMaxAge * 32.0F;
if (f < 0.0F)
{
f = 0.0F;
}
if (f > 1.0F)
{
f = 1.0F;
}
particleScale = particleScale * f;
tessellator.draw();
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(texture));
float f6 = (float)this.particleTextureIndexX / 16.0F;
float f7 = f6 + 0.0624375F;
float f8 = (float)this.particleTextureIndexY / 16.0F;
float f9 = f8 + 0.0624375F;
float f10 = 0.1F * this.particleScale;
if (this.particleIcon != null)
{
f6 = this.particleIcon.getMinU();
f7 = this.particleIcon.getMaxU();
f8 = this.particleIcon.getMinV();
f9 = this.particleIcon.getMaxV();
}
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
tessellator.startDrawingQuads();
tessellator.setBrightness(175);
tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1.0F);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
tessellator.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("textures/particle/particles.png"));
tessellator.startDrawingQuads();
}
@Override
public void onUpdate()
{
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
if (particleAge++ >= particleMaxAge)
{
this.setDead();
}
this.setParticleTextureIndex(7 - particleAge * 8 / particleMaxAge);
this.moveEntity(motionX, motionY, motionZ);
if (posY == prevPosY)
{
motionX *= 1.1D;
motionZ *= 1.1D;
}
motionX *= 0.9599999785423279D;
motionY *= 0.9599999785423279D;
motionZ *= 0.9599999785423279D;
if (onGround)
{
motionX *= 0.699999988079071D;
motionZ *= 0.699999988079071D;
}
}
}

View File

@ -0,0 +1,141 @@
package biomesoplenty.client.particles;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class EntitySteamFX extends EntityFX
{
private static final String texture = "biomesoplenty:textures/particles/steam.png";
float steamParticleScale;
public EntitySteamFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
{
this(par1World, par2, par4, par6, par8, par10, par12, 1.0F);
}
public EntitySteamFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14)
{
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += par8;
this.motionY += par10;
this.motionZ += par12;
this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D);
this.particleScale *= 0.75F;
this.particleScale *= par14;
this.steamParticleScale = this.particleScale;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.particleMaxAge = (int)((float)this.particleMaxAge * par14);
this.noClip = false;
}
@Override
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float f = (particleAge + par2) / particleMaxAge * 32.0F;
if (f < 0.0F)
{
f = 0.0F;
}
if (f > 1.0F)
{
f = 1.0F;
}
particleScale = particleScale * f;
tessellator.draw();
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(texture));
float f6 = (float)this.particleTextureIndexX / 16.0F;
float f7 = f6 + 0.0624375F;
float f8 = (float)this.particleTextureIndexY / 16.0F;
float f9 = f8 + 0.0624375F;
float f10 = 0.1F * this.particleScale;
if (this.particleIcon != null)
{
f6 = this.particleIcon.getMinU();
f7 = this.particleIcon.getMaxU();
f8 = this.particleIcon.getMinV();
f9 = this.particleIcon.getMaxV();
}
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
float f14 = 1.0F;
tessellator.startDrawingQuads();
tessellator.setBrightness(10);
tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
tessellator.draw();
GL11.glDisable(3042);
GL11.glDepthMask(true);
GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("textures/particle/particles.png"));
tessellator.startDrawingQuads();
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
if (particleAge++ >= particleMaxAge)
{
this.setDead();
}
this.setParticleTextureIndex(7 - particleAge * 8 / particleMaxAge);
motionY += 0.004D;
this.moveEntity(motionX, motionY, motionZ);
if (posY == prevPosY)
{
motionX *= 1.1D;
motionZ *= 1.1D;
}
motionX *= 0.9599999785423279D;
motionY *= 0.9599999785423279D;
motionZ *= 0.9599999785423279D;
if (onGround)
{
motionX *= 0.699999988079071D;
motionZ *= 0.699999988079071D;
}
}
}

View File

@ -162,21 +162,33 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
double d2 = z + random.nextFloat();
world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
/*TODO: FEATURE if (world.getBlockId(x, y, z) == Blocks.leaves1.get().blockID && world.getBlockMetadata(x, y, z) == 2)
//TODO: getBlock()
if (world.func_147439_a(x, y, z) == BOPBlockHelper.get("leaves1") && isType(world.getBlockMetadata(x, y, z), 2))
{
if (!(world.getBlockId(x, y - 1, z) == Blocks.leaves1.get().blockID && world.getBlockMetadata(x, y - 1, z) == 2))
//TODO: getBlock()
if (!(world.func_147439_a(x, y - 1, z) == BOPBlockHelper.get("leaves1") && isType(world.getBlockMetadata(x, y - 1, z), 2)))
{
if (random.nextInt(5) == 0)
{
BiomesOPlenty.proxy.spawnParticle("magictree", x + random.nextFloat(), y + 0.9F, z + random.nextFloat());
}
}
}*/
}
//TODO: randomDisplayTick()
super.func_149734_b(world, x, y, z, random);
}
public boolean isType(int metadata, int baseMeta)
{
for (int type = baseMeta; type <= baseMeta + (4 * 3); type += 4)
{
if (metadata == type) return true;
}
return false;
}
@Override
//TODO: breakBlock()

View File

@ -125,7 +125,8 @@ public class ItemBlockFlower extends ItemBlock
@Override
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{
if (!par3EntityPlayer.capabilities.isCreativeMode && !par2World.isRemote) {
if (!par3EntityPlayer.capabilities.isCreativeMode && !par2World.isRemote)
{
--par1ItemStack.stackSize;
}
}