I've created a tutorial on custom particles for 1.8.9 on the forums, check it out . LapisSea, do you have any idea as to how my custom particles can load my own texture?
I got my texture loaded... though at the price of extending EntityFX instead of EntityReddustFX, oh well. I just copied and pasted the code needed for the behaviour of my particle. On a side note, is there a way where I can reduce the number of particles spawned? My particle class.
That would have to do with when you actually spawn the particle and how often you spawn it. You could also adjust how long the particle stays alive to make it seem like there are more/less particles.
You can create a new image and load it with resource location. Than you just bind it before drawing the particle. (also you need to call Tessellator.draw and WorldRederer.Start drawing in the particle rendering)
Rollback Post to RevisionRollBack
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
I got my texture loaded... though at the price of extending EntityFX instead of EntityReddustFX, oh well. I just copied and pasted the code needed for the behaviour of my particle. On a side note, is there a way where I can reduce the number of particles spawned? My particle class.
If you mean how far particles are spawning than you just need to check the distance of the particle before spawning. I made my own particle engine in mc 1.9 (this should not affect you) in order to optimise the rendering. So i have the distance checking right here. Although the function that i copied from mc code does a similar thing it is really confusing and hard to modify.
Rollback Post to RevisionRollBack
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
I have made two new classes to make new particles.
One creates the new particle, the other to render the texture on it.
How do I spawn the particle?
World.spawnParticle only allows default Minecraft particles.
@SideOnly(Side.CLIENT)
public class ModEntityFX extends EntityFX {
private static ResourceLocation loc = new ResourceLocation(ReferenceStrings.MODID, "textures/particles/BeeParticle.png");
public ModEntityFX(World w, double x, double y, double z, double offsetX, double offsetY, double offsetZ) {
super(w, x, y, z, offsetX, offsetY, offsetZ);
this.particleTextureIndexX = 0;
this.particleTextureIndexY = 0;
this.noClip = false;
this.particleAge = 0;
this.particleMaxAge = 50;
this.particleScale *= 1.4F;
this.particleRed = this.particleGreen = this.particleBlue = 1;
this.particleAlpha = 1;
}
@Override
public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_)
{
Minecraft.getMinecraft().renderEngine.bindTexture(loc);
super.renderParticle(worldRendererIn, entityIn, p_180434_8_, p_180434_8_, p_180434_8_, p_180434_8_, p_180434_8_, p_180434_8_);
}
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
particleAge++;
if(particleAge > particleMaxAge) {
this.setDead();
return;
}
moveEntity(motionX, motionY, motionZ);
motionX *= motionX > 0.04 ? 1 : 1.03;
motionY *= motionY > 0.04 ? 1 : 1.03;
motionZ *= motionZ > 0.04 ? 1 : 1.03;
}
@Override
public int getFXLayer() {
return 3;
}
@Override
public boolean canAttackWithItem()
{
return false;
}
}
public class TextureBeeParticle extends TextureAtlasSprite{
protected TextureBeeParticle(String spriteName) {
super(spriteName);
makeAtlasSprite(new ResourceLocation(ReferenceStrings.MODID + "textures/particles/BeeParticle.png"));
}
@Override
public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) {
return true;
}
}
Please be very detailed in your response, as Entities are apparently not my strong suit.
Thank you for your help!
here is an example of a particle and function for spawning it:
https://github.com/LapisSea/Magiology_1.8/blob/master/src/main/java/com/magiology/mcobjects/effect/EntityFacedFX.java
https://github.com/LapisSea/Magiology_1.8/blob/master/src/main/java/com/magiology/util/utilclasses/UtilM.java#L81-L92
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
Thank you for the help! I've got the particle spawning.
I've created a tutorial on custom particles for 1.8.9 on the forums, check it out . LapisSea, do you have any idea as to how my custom particles can load my own texture?
Yes make a class that extends TextureAtlasSprite. My looks about like this:
What must the size of the particle be in the texture file? 8px by 8px? and what must the size of the texture image be?
I'm not sure. I would just play around with different sized textures. Mine is 8px by 8px.
Alright, I created the class, what do I do in my EntityFX class so that the game will load up my own texture?
Mine is 8x8 yes..
but it really depends what kind of particle you would like.
I got my texture loaded... though at the price of extending EntityFX instead of EntityReddustFX, oh well. I just copied and pasted the code needed for the behaviour of my particle. On a side note, is there a way where I can reduce the number of particles spawned? My particle class.
That would have to do with when you actually spawn the particle and how often you spawn it. You could also adjust how long the particle stays alive to make it seem like there are more/less particles.
You can create a new image and load it with resource location. Than you just bind it before drawing the particle. (also you need to call Tessellator.draw and WorldRederer.Start drawing in the particle rendering)
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
If you mean how far particles are spawning than you just need to check the distance of the particle before spawning. I made my own particle engine in mc 1.9 (this should not affect you) in order to optimise the rendering. So i have the distance checking right here. Although the function that i copied from mc code does a similar thing it is really confusing and hard to modify.
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.