-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial trans flag heart particle impl :3
- Loading branch information
1 parent
acfb262
commit 25f8869
Showing
9 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/main/java/net/solaara/beeyourself/transflagheart/TransFlagHeartParticle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package net.solaara.beeyourself.transflagheart; | ||
|
||
import net.fabricmc.api.Environment; | ||
import net.fabricmc.api.EnvType; | ||
import net.minecraft.client.particle.Particle; | ||
import net.minecraft.client.particle.ParticleFactory; | ||
import net.minecraft.client.particle.ParticleTextureSheet; | ||
import net.minecraft.client.particle.SpriteBillboardParticle; | ||
import net.minecraft.client.particle.SpriteProvider; | ||
import net.minecraft.client.render.Tessellator; | ||
import net.minecraft.client.world.ClientWorld; | ||
import net.minecraft.particle.DefaultParticleType; | ||
import net.solaara.beeyourself.BeeYourself; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class TransFlagHeartParticle extends SpriteBillboardParticle { | ||
// The sprite provider which is used to determine the particle's texture | ||
private final SpriteProvider spriteProvider; | ||
private final int variant; | ||
|
||
TransFlagHeartParticle(ClientWorld world, double x, double y, double z, double velX, double velY, double velZ, | ||
SpriteProvider spriteProvider) { | ||
super(world, x, y, z); | ||
this.spriteProvider = spriteProvider; // Sets the sprite provider from above to the sprite provider in the | ||
// constructor parameters | ||
this.x = x; // The x from the constructor parameters | ||
this.y = y; | ||
this.z = z; | ||
this.alpha = 1.0f; // Setting the alpha to 1.0f means there will be no opacity change until the | ||
// alpha value is changed | ||
this.velocityMultiplier = 0.86F; | ||
this.velocityX *= 0.01F; | ||
this.velocityY *= 0.01F; | ||
this.velocityZ *= 0.01F; | ||
this.velocityY += 0.1; | ||
this.scale *= 1.5F; | ||
this.maxAge = 16; | ||
this.collidesWithWorld = false; | ||
this.setSpriteForAge(spriteProvider); // Required | ||
this.variant = world.random.nextInt(1, 4); | ||
var test = this.spriteProvider.getSprite(this.variant, this.variant); | ||
|
||
BeeYourself.LOGGER.info("variant " + this.variant); | ||
BeeYourself.LOGGER.info("variant " + test); | ||
} | ||
|
||
@Override | ||
public ParticleTextureSheet getType() { | ||
return ParticleTextureSheet.PARTICLE_SHEET_TRANSLUCENT; | ||
} | ||
|
||
@Environment(EnvType.CLIENT) | ||
public static class Factory implements ParticleFactory<DefaultParticleType> { | ||
// The factory used in a particle's registry | ||
private final SpriteProvider spriteProvider; | ||
|
||
public Factory(SpriteProvider spriteProvider) { | ||
this.spriteProvider = spriteProvider; | ||
} | ||
|
||
public Particle createParticle(DefaultParticleType defaultParticleType, ClientWorld clientWorld, double x, | ||
double y, double z, double velX, double velY, double velZ) { | ||
return new TransFlagHeartParticle(clientWorld, x, y, z, velX, velY, velZ, this.spriteProvider); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/resources/assets/bee-yourself/particles/trans_flag_heart.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"textures": [ | ||
"bee-yourself:trans_flag_heart_1", | ||
"bee-yourself:trans_flag_heart_2", | ||
"bee-yourself:trans_flag_heart_3" | ||
] | ||
} |
Binary file added
BIN
+2.22 KB
src/main/resources/assets/bee-yourself/textures/particle/trans_flag_heart_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.13 KB
src/main/resources/assets/bee-yourself/textures/particle/trans_flag_heart_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.19 KB
src/main/resources/assets/bee-yourself/textures/particle/trans_flag_heart_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.99 KB
src/main/resources/assets/bee-yourself/textures/particle/trans_heart_atlas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.