Posted August 6, 20169 yr Hi. Suddenly my custom particles stopped rendering the texture, I dont know what changed that could do this. Now it only shows the purple/black texture. I debugged it and came to the conclusion that my texture is not loaded. Image of debugger: i've tried changing public ResourceLocation texture = new ResourceLocation(ModNames.MOD_NAME, "particles/"+ ModNames.PARTICLE_CONSUME); to public ResourceLocation texture = new ResourceLocation("ancienttech", "particles/sacrificealtar"); and public ResourceLocation texture = new ResourceLocation("ancienttech", "particles/sacrificealtar.png"); and public ResourceLocation texture = new ResourceLocation("ancienttech", "textures/particles/sacrificealtar"); and public ResourceLocation texture = new ResourceLocation("ancienttech", "textures/particles/sacrificealtar.png"); my particle class (yeah its still messy im in the works to clean up my code): package com.daskaktus.ancienttech.entity.fx; import java.awt.Color; import com.daskaktus.ancienttech.register.ModNames; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; public class ConsumeParticles extends Particle { private double targetX; private double targetY; private double targetZ; public double colorR = 0; public double colorG = 0; public double colorB = 0; public ResourceLocation texture = new ResourceLocation(ModNames.MOD_NAME, "particles/"+ ModNames.PARTICLE_CONSUME); public ConsumeParticles(World w, double x, double y, double z, double tx, double ty, double tz, int count, int color, float scale) { super(w, x, y, z, 0.0D, 0.0D, 0.0D); this.particleRed = (this.particleGreen = this.particleBlue = 0.6F); this.particleScale = ((MathHelper.sin(count / 2.0F) * 0.1F + 1.0F) * scale); this.targetX = tx; this.targetY = ty; this.targetZ = tz; this.posY += 0.33000001311302185D; double dx = tx - this.posX; double dy = ty - this.posY; double dz = tz - this.posZ; int base = (int)(MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz) * 30.0F); if (base < 1) { base = 1; } this.particleMaxAge = (base / 2 + this.rand.nextInt(base)); this.motionX = (MathHelper.sin(count / 4.0F) * 0.015F + this.rand.nextGaussian() * 0.0020000000949949026D); this.motionY = (MathHelper.sin(count / 3.0F) * 0.015F + this.rand.nextGaussian() * 0.0020000000949949026D); this.motionZ = (MathHelper.sin(count / 2.0F) * 0.015F + this.rand.nextGaussian() * 0.0020000000949949026D); if (this.isCollided){ this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; } Color c = new Color(color); float mr = c.getRed() / 255.0F * 0.2F; float mg = c.getGreen() / 255.0F * 0.2F; float mb = c.getBlue() / 255.0F * 0.2F; this.particleRed = (c.getRed() / 255.0F - mr + this.rand.nextFloat() * mr) / 2; this.particleGreen = (c.getGreen() / 255.0F - mg + this.rand.nextFloat() * mg) / 2; this.particleBlue = (c.getBlue() / 255.0F - mb + this.rand.nextFloat() * mb) / 2; this.particleGravity = 0.2F; TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(texture.toString()); this.setParticleTexture(sprite); //System.out.println(texture.toString()); //this.noClip = true; try { Entity renderentity = FMLClientHandler.instance().getClient().getRenderViewEntity(); int visibleDistance = 64; if (!FMLClientHandler.instance().getClient().gameSettings.fancyGraphics) { visibleDistance = 32; } if (renderentity.getDistance(this.posX, this.posY, this.posZ) > visibleDistance) { this.particleMaxAge = 0; } } catch (Exception e) {} } @Override public boolean isTransparent(){ return true; } public void onUpdate(){ this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; if (this.particleAge++ >= this.particleMaxAge){ this.setExpired(); return; } this.motionY += 0.01D * this.particleGravity; //if (!this.noClip) { // pushOutOfBlocks(this.posX, this.posY, this.posZ); //} moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.985D; this.motionY *= 0.985D; this.motionZ *= 0.985D; this.motionX = MathHelper.clamp_float((float)this.motionX, -0.05F, 0.05F); this.motionY = MathHelper.clamp_float((float)this.motionY, -0.05F, 0.05F); this.motionZ = MathHelper.clamp_float((float)this.motionZ, -0.05F, 0.05F); double dx = this.targetX - this.posX; double dy = this.targetY - this.posY; double dz = this.targetZ - this.posZ; double d13 = 0.01D; double d11 = MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz); if (d11 < 2.0D) { this.particleScale *= 0.98F; } if (this.particleScale < 0.2F){ this.setExpired(); return; } dx /= d11; dy /= d11; dz /= d11; this.motionX += dx * (d13 / Math.min(1.0D, d11)); this.motionY += dy * (d13 / Math.min(1.0D, d11)); this.motionZ += dz * (d13 / Math.min(1.0D, d11)); float lifeCoeff = ((float)this.particleMaxAge-(float)this.particleAge)/(float)this.particleMaxAge; this.particleRed = Math.min(1.0f, (float)colorR*(1.5f-lifeCoeff)+lifeCoeff / 2); this.particleGreen = Math.min(1.0f, (float)colorG*(1.5f-lifeCoeff)+lifeCoeff / 2); this.particleBlue = Math.min(1.0f, (float)colorB*(1.5f-lifeCoeff)+lifeCoeff / 2); //System.out.println(this.particleRed); } //public void renderParticle(WorldRenderer wr, Entity entity, float f, float f1, float f2, float f3, float f4, float f5){ public int getFXLayer(){ return 1; } } Particle in clientproxy: public void spawnConsumeParticles(Entity entity, double targetX, double targetY, double targetZ){ ATColor col = new ATColor("00ff00"); ConsumeParticles particle = new ConsumeParticles( entity.worldObj, entity.posX + entity.worldObj.rand.nextFloat() * entity.width * 2.0F - entity.width, entity.posY + 0.5D + entity.worldObj.rand.nextFloat() * entity.height, entity.posZ + entity.worldObj.rand.nextFloat() * entity.width * 2.0F - entity.width, targetX + 0.5, targetY + 1, targetZ + 0.5,10, col.toInt(),1F); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } Code in my tilentity to spawn particles: AncientTech.proxy.spawnConsumeParticles(entity,blockpos.getX(),blockpos.getY(),blockpos.getZ()); asset path (image) There are no missing texture errors in console, no errors at all. I really could use a second pair of eyes, the code was working before and the particles were rendering just fine. Not all things in the world are red, there are round objects too!
August 6, 20169 yr Author Nobody? Is there anywhere else I can try to register the texture? Not all things in the world are red, there are round objects too!
August 6, 20169 yr Author I got it working again. It was my EventManager that was'nt loading. So this was never triggered. @SideOnly(Side.CLIENT) @SubscribeEvent public void onTextureStitch(TextureStitchEvent event){ ResourceLocation sacrificealtarParticleRL = new ResourceLocation("ancienttech","particles/" + ModNames.PARTICLE_CONSUME); event.getMap().registerSprite(sacrificealtarParticleRL); } Not all things in the world are red, there are round objects too!
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.