Posted May 25, 20232 yr I'm making a custom particle and for some reason it's half inside the ground I tried changing the bounding box and it still doesn't work, is there a way to fix it? public class LegoStuds extends TextureSheetParticle { private final SpriteSet sprites; protected LegoStuds(ClientLevel pLevel, double pX, double pY, double pZ, double dX, double dY, double dZ, SpriteSet pSprites) { super(pLevel, pX, pY, pZ, dX, dY, dZ); this.friction = 0.8F; this.xd = dX; //+ (Math.random() * 20.0D - 1.0D) * (double)0.05F; this.yd = dY;// + (Math.random() * 20.0D - 1.0D) * (double)0.05F; this.zd = dZ; //+ (Math.random() * 20.0D - 1.0D) * (double)0.05F; this.quadSize *= 2F; this.lifetime = 64; this.gravity = 3; this.rCol = 1f; this.gCol = 1f; this.bCol = 1f; this.setBoundingBox(new AABB(pX - 0.5D, pY - 0.5D, pZ - 0.5D, pX + 0.5D, pY + 0.5D, pZ + 0.5D)); this.sprites = pSprites; this.setSpriteFromAge(pSprites); } @Override public void tick() { super.tick(); fadeOut(); this.setSpriteFromAge(this.sprites); } private void fadeOut() { this.alpha = (-(1/(float)lifetime) * age + 1); } @Override public ParticleRenderType getRenderType() { return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT; } @OnlyIn(Dist.CLIENT) public static class Provider implements ParticleProvider<SimpleParticleType> { private final SpriteSet sprites; public Provider(SpriteSet spriteSet) { this.sprites = spriteSet; } public Particle createParticle(SimpleParticleType particleType, ClientLevel pLevel, double pX, double pY, double pZ, double dx, double dy, double dz) { return new LegoStuds(pLevel, pX, pY, pZ, dx, dy, dz, this.sprites); } } } Edited May 25, 20232 yr by Blurr0-0
May 25, 20232 yr You don't set the bounding box directly - unless you have your own custom move() implementation. Like entities you set the position, velocity and size and the bounding box is recalculated for you as it moves or you manually change its parameters. See Particle.tick(), move(), setSize(), etc. for how it works. It's hard to say what your problem is without having all the information. Don't post incomplete snippets of code in the forum, put a simple project on github that reproduces your problem. I would guess (I shouldn't have to guess) it is that 2x quadsize since that is only used for rendering? While as I said above, it is the size (which proxies through to the min/max of the bounding box) that is used to (re)calculate the bounding box for collisions. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
May 25, 20232 yr Author okay thanks ill try it out, also I'll make sure to provide the project with github next time
May 26, 20232 yr Author I tried doing what you said and I think the particle hitbox works but it still goes half inside the ground. here's the github page of the project https://github.com/Blurr0-0/TestMod
May 26, 20232 yr I'm pretty sure your problem is actually something to do with your texture being 64x64 instead of the normal 16x16? https://github.com/Blurr0-0/TestMod/blob/master/src/main/resources/assets/test_mod/textures/particle/gray_lego_stud_0.png I tried your mod and it looks to me like 3/4 of the object is buried. i.e. pixels 17 to 64 Rendering is not something I know very well. So I don't personally know if minecraft supports such a thing or what you need to change to make it work properly. Maybe somebody else on this forum can help you? But you might get more insight if you ask on the discord of one of the mods that messes with graphics e.g. rubidium. Otherwise you will probably just have to read the particle rendering code to see how it would handle an oversized sprite. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
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.