Tweaked magic leaves
This commit is contained in:
parent
640b3c5935
commit
73e4abdb25
|
@ -1,11 +1,14 @@
|
||||||
package biomesoplenty;
|
package biomesoplenty;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.ModelChicken;
|
import net.minecraft.client.model.ModelChicken;
|
||||||
import net.minecraft.client.model.ModelSlime;
|
import net.minecraft.client.model.ModelSlime;
|
||||||
import net.minecraft.client.particle.EntityBreakingFX;
|
import net.minecraft.client.particle.EntityBreakingFX;
|
||||||
import net.minecraft.client.particle.EntityFX;
|
import net.minecraft.client.particle.EntityFX;
|
||||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import biomesoplenty.api.Items;
|
import biomesoplenty.api.Items;
|
||||||
import biomesoplenty.blocks.renderers.BambooRenderer;
|
import biomesoplenty.blocks.renderers.BambooRenderer;
|
||||||
import biomesoplenty.blocks.renderers.FoliageRenderer;
|
import biomesoplenty.blocks.renderers.FoliageRenderer;
|
||||||
|
@ -102,6 +105,8 @@ public class ClientProxy extends CommonProxy {
|
||||||
public void spawnParticle(String string, double x, double y, double z)
|
public void spawnParticle(String string, double x, double y, double z)
|
||||||
{
|
{
|
||||||
EntityFX entityfx = null;
|
EntityFX entityfx = null;
|
||||||
|
|
||||||
|
Random rand = new Random();
|
||||||
|
|
||||||
if (string == "mud")
|
if (string == "mud")
|
||||||
{
|
{
|
||||||
|
@ -125,11 +130,18 @@ public class ClientProxy extends CommonProxy {
|
||||||
}
|
}
|
||||||
else if (string == "magictree")
|
else if (string == "magictree")
|
||||||
{
|
{
|
||||||
entityfx = new EntityMagicTreeFX(mc.theWorld, x, y, z, 0.0D, -0.02D, 0.0D);
|
entityfx = new EntityMagicTreeFX(mc.theWorld, x, y, z, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03), -0.02D, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03));
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.effectRenderer.addEffect(entityfx);
|
mc.effectRenderer.addEffect(entityfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double generatRandomPositiveNegitiveValue(double max, double min)
|
||||||
|
{
|
||||||
|
Random rand = new Random();
|
||||||
|
double d = -min + (Math.random() * ((max - (-min)) + 1));
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int addArmor(String armor)
|
public int addArmor(String armor)
|
||||||
|
|
|
@ -147,7 +147,10 @@ public class BlockBOPLeaves extends BlockLeavesBase implements IShearable
|
||||||
|
|
||||||
if (world.getBlockId(x, y, z) == Blocks.leaves1.get().blockID && world.getBlockMetadata(x, y, z) == 2)
|
if (world.getBlockId(x, y, z) == Blocks.leaves1.get().blockID && world.getBlockMetadata(x, y, z) == 2)
|
||||||
{
|
{
|
||||||
BiomesOPlenty.proxy.spawnParticle("magictree", x + random.nextFloat(), y, z + random.nextFloat());
|
if (!(world.getBlockId(x, y - 1, z) == Blocks.leaves1.get().blockID && world.getBlockMetadata(x, y - 1, z) == 2))
|
||||||
|
{
|
||||||
|
BiomesOPlenty.proxy.spawnParticle("magictree", x + random.nextFloat(), y + 0.9F, z + random.nextFloat());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.randomDisplayTick(world, x, y, z, random);
|
super.randomDisplayTick(world, x, y, z, random);
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package biomesoplenty.particles;
|
package biomesoplenty.particles;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.particle.EntityFX;
|
import net.minecraft.client.particle.EntityFX;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -11,18 +15,18 @@ import cpw.mods.fml.client.FMLClientHandler;
|
||||||
|
|
||||||
public class EntityMagicTreeFX extends EntityFX
|
public class EntityMagicTreeFX extends EntityFX
|
||||||
{
|
{
|
||||||
private static final String texture = "biomesoplenty:textures/particles/magictree.png";
|
private static final String texture = "biomesoplenty:textures/particles/magictree.png";
|
||||||
|
|
||||||
float magicTreeParticleScale;
|
float magicTreeParticleScale;
|
||||||
|
|
||||||
public EntityMagicTreeFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
|
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);
|
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)
|
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);
|
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
|
||||||
this.motionX *= 0.10000000149011612D;
|
this.motionX *= 0.10000000149011612D;
|
||||||
this.motionY *= 0.10000000149011612D;
|
this.motionY *= 0.10000000149011612D;
|
||||||
this.motionZ *= 0.10000000149011612D;
|
this.motionZ *= 0.10000000149011612D;
|
||||||
|
@ -36,34 +40,34 @@ public class EntityMagicTreeFX extends EntityFX
|
||||||
this.particleMaxAge = (int)((float)this.particleMaxAge * par14);
|
this.particleMaxAge = (int)((float)this.particleMaxAge * par14);
|
||||||
this.particleAge = (particleMaxAge / 16) + (int)((particleMaxAge / 16) * par1World.rand.nextInt(7));
|
this.particleAge = (particleMaxAge / 16) + (int)((particleMaxAge / 16) * par1World.rand.nextInt(7));
|
||||||
this.noClip = false;
|
this.noClip = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
|
public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||||
{
|
{
|
||||||
float f = (particleAge + par2) / particleMaxAge * 32.0F;
|
float f = (particleAge + par2) / particleMaxAge * 32.0F;
|
||||||
|
|
||||||
if (f < 0.0F)
|
if (f < 0.0F)
|
||||||
{
|
{
|
||||||
f = 0.0F;
|
f = 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f > 1.0F)
|
if (f > 1.0F)
|
||||||
{
|
{
|
||||||
f = 1.0F;
|
f = 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
particleScale = particleScale * f;
|
particleScale = particleScale * f;
|
||||||
|
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
GL11.glDepthMask(false);
|
GL11.glDepthMask(false);
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
GL11.glBlendFunc(770, 1);
|
GL11.glBlendFunc(770, 1);
|
||||||
|
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(texture));
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(texture));
|
||||||
|
|
||||||
float f6 = (float)this.particleTextureIndexX / 16.0F;
|
float f6 = (float)this.particleTextureIndexX / 16.0F;
|
||||||
float f7 = f6 + 0.0624375F;
|
float f7 = f6 + 0.0624375F;
|
||||||
float f8 = (float)this.particleTextureIndexY / 16.0F;
|
float f8 = (float)this.particleTextureIndexY / 16.0F;
|
||||||
|
@ -81,60 +85,57 @@ public class EntityMagicTreeFX extends EntityFX
|
||||||
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
|
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 f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
|
||||||
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
|
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
|
||||||
|
|
||||||
tessellator.startDrawingQuads();
|
tessellator.startDrawingQuads();
|
||||||
tessellator.setBrightness(240);
|
tessellator.setBrightness(75);
|
||||||
|
|
||||||
tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1.0F);
|
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)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)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)f8);
|
||||||
tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
|
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);
|
tessellator.draw();
|
||||||
GL11.glDepthMask(true);
|
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
GL11.glDepthMask(true);
|
||||||
|
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("textures/particle/particles.png"));
|
GL11.glPopMatrix();
|
||||||
tessellator.startDrawingQuads();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("textures/particle/particles.png"));
|
||||||
* Called to update the entity's position/logic.
|
tessellator.startDrawingQuads();
|
||||||
*/
|
}
|
||||||
@Override
|
|
||||||
public void onUpdate()
|
|
||||||
{
|
|
||||||
prevPosX = posX;
|
|
||||||
prevPosY = posY;
|
|
||||||
prevPosZ = posZ;
|
|
||||||
|
|
||||||
if (particleAge++ >= particleMaxAge)
|
@Override
|
||||||
{
|
public void onUpdate()
|
||||||
this.setDead();
|
{
|
||||||
}
|
prevPosX = posX;
|
||||||
|
prevPosY = posY;
|
||||||
|
prevPosZ = posZ;
|
||||||
|
|
||||||
this.setParticleTextureIndex(7 - particleAge * 8 / particleMaxAge);
|
if (particleAge++ >= particleMaxAge)
|
||||||
motionY -= 0.0004D;
|
{
|
||||||
this.moveEntity(motionX, motionY, motionZ);
|
this.setDead();
|
||||||
|
}
|
||||||
|
|
||||||
if (posY == prevPosY)
|
this.setParticleTextureIndex(7 - particleAge * 8 / particleMaxAge);
|
||||||
{
|
motionY -= 0.0004D;
|
||||||
motionX *= 1.1D;
|
this.moveEntity(motionX, motionY, motionZ);
|
||||||
motionZ *= 1.1D;
|
|
||||||
}
|
|
||||||
|
|
||||||
motionX *= 0.9599999785423279D;
|
if (posY == prevPosY)
|
||||||
motionY *= 0.9599999785423279D;
|
{
|
||||||
motionZ *= 0.9599999785423279D;
|
motionX *= 1.1D;
|
||||||
|
motionZ *= 1.1D;
|
||||||
|
}
|
||||||
|
|
||||||
if (onGround)
|
motionX *= 0.9599999785423279D;
|
||||||
{
|
motionY *= 0.9599999785423279D;
|
||||||
motionX *= 0.699999988079071D;
|
motionZ *= 0.9599999785423279D;
|
||||||
motionZ *= 0.699999988079071D;
|
|
||||||
}
|
if (onGround)
|
||||||
}
|
{
|
||||||
|
motionX *= 0.699999988079071D;
|
||||||
|
motionZ *= 0.699999988079071D;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue