Posted June 17, 201510 yr world.spawnParticle("happyVillager", xCoord, yCoord+1, zCoord, 0, 0, 0); it seems that my particle is not seen. (I allowed particles when debugging)
June 17, 201510 yr Particles are client side. Show you spawning code. 1.7.10 is no longer supported by forge, you are on your own.
June 17, 201510 yr Author I planned something like this in my TE: double x = entity.posX; double y = entity.posY; double z = entity.posZ; if (world.isRemote) { world.spawnParticle("happyVillager", xCoord, yCoord+1, zCoord, 0, 0, 0); world.spawnParticle("happyVillager", x, y, z, 0, 0, 0); }
June 17, 201510 yr I'll just say - if you think you wrote something well and it's not working - the problem is NOT THERE. Please - full code. What is you entity? Are you sure you are grabbing right one? DId you register (created) particle? (EDIT: Its vanilla particle, isn't it?) Are they working elsewhere? Have you tried SIMPLE debugging (printing x/y/z for one)? 1.7.10 is no longer supported by forge, you are on your own.
June 17, 201510 yr Author In the meantime, what does the code do? I mean, it spawns a particle at x, y, z, with speed...? I need help on that speed.
June 17, 201510 yr Author Found out that I noobedly call that function on server side... Need to deal with that for a bit... But can anyone explain that "velocity" part? The last 3 argument ofWorld#spawnParticle()?
June 17, 201510 yr Velocity simply means motion - i.e. the direction(s) in which the particle will be moving. Each is further modified (randomly) based on the particles type, so you can start with all zeroes and see what it looks like, then go from there. Experimentation is key to getting particle motions looking right, and learning how they work. http://i.imgur.com/NdrFdld.png[/img]
June 17, 201510 yr Author And, by the way, how do I register custom particles? Or simply put, how to make one?
June 17, 201510 yr I read a lot of questions that can be solved with a bit of java knowledge. Anyway, the way to make a custom particle is by simply extending the EntityFX.Class. On the bottum of this post Ill put an example which I use in one of my mods. And with this line you can spawn in your particle: mc.effectRenderer.addEffect(new YourParticle(World, x, y, z, motionX, motionY, motionZ)); And thats basically all to it. PS. take a look at the vanilla particle classes, it contains a lot of examples! package mechanical_crafting_table.client.particles.entityfx; import static org.lwjgl.opengl.GL11.*; import mechanical_crafting_table.Main; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.Entity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class EntityWeldSparkFX extends EntityFX { private static final ResourceLocation WellingFXTexture = new ResourceLocation(Main.MODID, "textures/particles/WellingSpark.png"); public EntityWeldSparkFX(World world, double x, double y, double z, double mX, double mY, double mZ) { super(world, x, y, z, mX, mY, mZ); this.motionX = mX; this.motionY = mY; this.motionZ = mZ; this.particleScale *= 0.04F; this.particleAlpha = 1.0F; this.particleMaxAge = 7 + this.rand.nextInt(5); this.particleGravity = 1F; this.noClip = false; } public void renderParticle(Tessellator tess, float partialTick, float x, float y, float z, float u, float v) { if(this.particleAge < this.particleMaxAge) { Minecraft.getMinecraft().renderEngine.bindTexture(WellingFXTexture); glDepthMask(false); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glAlphaFunc(GL_GREATER, 0.003921569F); glAlphaFunc(GL_GREATER, 0.6F - ((float)this.particleAge + partialTick - 1.0F) * 0.25F * 0.5F); float f10 = 0.1F * this.particleScale; float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTick - interpPosX); float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTick - interpPosY); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTick - interpPosZ); tess.startDrawingQuads(); tess.setBrightness(getBrightnessForRender(partialTick)); tess.addVertexWithUV((double)(f11 - x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 - z * f10 - v * f10), 0, 0); tess.addVertexWithUV((double)(f11 - x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 - z * f10 + v * f10), 0, 1); tess.addVertexWithUV((double)(f11 + x * f10 + u * f10), (double)(f12 + y * f10), (double)(f13 + z * f10 + v * f10), 1, 1); tess.addVertexWithUV((double)(f11 + x * f10 - u * f10), (double)(f12 - y * f10), (double)(f13 + z * f10 - v * f10), 1, 0); tess.draw(); glDisable(GL_BLEND); glDepthMask(true); glAlphaFunc(GL_GREATER, 0.1F); } } public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; if (this.particleAge++ >= this.particleMaxAge) { this.setDead(); } if (this.particleAge > this.particleMaxAge / 2) { this.setAlphaF(1.0F - ((float) this.particleAge - (float) (this.particleMaxAge / 2)) / (float) this.particleMaxAge); } this.motionY -= 0.004D * (double)this.particleGravity;; this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.8D; this.motionY *= 0.05D; this.motionZ *= 0.8D; this.setRBGColorF(this.particleRed, this.particleBlue, this.particleGreen); if (this.onGround) { this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; } if (this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0) { EntityWeldSparkFX EntityWell = new EntityWeldSparkFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); EntityWell.particleAge = EntityWell.particleMaxAge / 2; Minecraft.getMinecraft().effectRenderer.addEffect(EntityWell); } } public int getBrightnessForRender(float brightnessFR) { return 15728880; } public float getBrightness(float brightness) { return 1.0F; } public boolean canBePushed() { return true; } public int getFXLayer() { return 3; } public AxisAlignedBB getBoundingBox() { return null; } } Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager
June 18, 201510 yr Author I need help on how to tell Forge to look at my image sources for my particles.
June 18, 201510 yr I need help on how to tell Forge to look at my image sources for my particles. Use a resource location. Look at the example above your post.
June 18, 201510 yr This part gets your texture: private static final ResourceLocation yourTexture = new ResourceLocation(Main.YOURMODID, "textures/particles/yourTextureFile.png"); And you bind it with the following: Minecraft.getMinecraft().renderEngine.bindTexture(yourTexture ); you can do it with openGL, but that means you got to convert/load in your texture so it can passed through as an Integer. (sound realy strange, but look up a tutorial of opengl, and you'll see what Im talking about) That being said, Minecraft made it way easier for us to bind a texture. (with the example above) So I would suggest using it. Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.