Jump to content

Recommended Posts

Posted (edited)

Hey Guys, me again :D
I tried to create a "glint" particle for my golden trees

all of this works perfectly, but the particles don't have a texture
there's these "missing texture" thing everwhere my particle should be shown

The code of my Particle:

package com.setrion.koratio.particles;

import com.setrion.koratio.main.Koratio;

import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

public class ParticleGlint extends Particle {

	private int i;
	private int i2;

	public ParticleGlint(World world, double x, double y, double z, double f, double f1, double f2) {
		this(world, x, y, z, 1.0F, f, f1, f2);
	}

	public ParticleGlint(World world, double x, double y, double z, float f, double f1, double f2, double f3) {
		super(world, x, y, z, 0.0D, 0.0D, 0.0D);
		motionX *= 2.10000000149011612D;
		motionY *= 2.10000000149011612D;
		motionZ *= 2.10000000149011612D;
		particleRed = particleGreen = 1.0F * f;
		particleRed *= 0.9F;
		particleBlue = 0.0F;
		particleScale = 1.0f + (rand.nextFloat() * 0.6f);
		particleScale *= f;
		i = particleMaxAge = 10 + rand.nextInt(21);
		particleMaxAge *= f;
		i2 = i / 2;
		canCollide = true;
		
		this.setParticleTexture(Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(new ResourceLocation(Koratio.modid, "particle/glint").toString()));
	}

	@Override
	public void renderParticle(BufferBuilder buffer, Entity entity, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {

		particleAlpha = getGlowBrightness();
		super.renderParticle(buffer, entity, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
	}

	@Override
	public void onUpdate() {
		if (i <= 1) {
			setExpired();
		} else {
			i--;
		}
	}

	public float getGlowBrightness() {
		if (i <= i2) {
			return (float) i / (float) i2;
		} else {
			return Math.max(1.0f - (((float) i - i2) / i2), 0);
		}
	}

	@Override
	public int getBrightnessForRender(float partialTicks) {
		return 0xF000F0;
	}

	@Override
	public int getFXLayer() {
		return 1;
	}
}


And here's a Screenshot of how it looks ingame:
2018-09-11_22.32.48.png

(These Link is because i can't upload these Picture here, don't know why)

Can anyone tell me why my Texture isn't there?
(If this helps, my texture is in these package: (assets.koratio.textures.particle)

Edited by Setrion
Posted
1 hour ago, Setrion said:

getTextureMapBlocks().getAtlasSprite

This only works if you've told the TextureAtlas about your particle during stitching. If you haven't, then the atlas knows fuckall about your texture.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.