Add cloud particle from TF spell pack, and change smoke bomb to use it instead of vanilla's large_smoke particles
This commit is contained in:
@@ -333,6 +333,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ParticleWizardry.registerParticle(Type.BEAM, ParticleBeam::new);
|
||||
ParticleWizardry.registerParticle(Type.BLOCK_HIGHLIGHT, ParticleBlockHighlight::new);
|
||||
ParticleWizardry.registerParticle(Type.BUFF, ParticleBuff::new);
|
||||
ParticleWizardry.registerParticle(Type.CLOUD, ParticleCloud::new);
|
||||
ParticleWizardry.registerParticle(Type.DARK_MAGIC, ParticleDarkMagic::new);
|
||||
ParticleWizardry.registerParticle(Type.DUST, ParticleDust::new);
|
||||
ParticleWizardry.registerParticle(Type.FLASH, ParticleFlash::new);
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package electroblob.wizardry.client.particle;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
@Mod.EventBusSubscriber(Side.CLIENT)
|
||||
public class ParticleCloud extends ParticleWizardry {
|
||||
|
||||
private static final ResourceLocation[] TEXTURES = generateTextures("cloud", 4);
|
||||
|
||||
public ParticleCloud(World world, double x, double y, double z){
|
||||
|
||||
super(world, x, y, z, TEXTURES[world.rand.nextInt(TEXTURES.length)]);
|
||||
|
||||
this.setRBGColorF(1, 1, 1);
|
||||
this.particleMaxAge = 48 + this.rand.nextInt(12);
|
||||
this.particleScale *= 6;
|
||||
this.setGravity(false);
|
||||
this.setAlphaF(0);
|
||||
this.canCollide = false;
|
||||
this.shaded = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisableDepth(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
super.onUpdate();
|
||||
|
||||
// Fading
|
||||
float fadeTime = this.particleMaxAge * 0.3f;
|
||||
this.setAlphaF(MathHelper.clamp(Math.min(this.particleAge / fadeTime, (this.particleMaxAge - this.particleAge) / fadeTime), 0, 1));
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onTextureStitchEvent(TextureStitchEvent.Pre event){
|
||||
for(ResourceLocation texture : TEXTURES){
|
||||
event.getMap().registerSprite(texture);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,13 +39,12 @@ public class EntitySmokeBomb extends EntityBomb {
|
||||
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 0, 0, 0);
|
||||
|
||||
for(int i = 0; i < 60 * blastMultiplier; i++){
|
||||
|
||||
this.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE,
|
||||
this.posX + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posY + (this.rand.nextDouble() * 4 - 2) * blastMultiplier,
|
||||
this.posZ + (this.rand.nextDouble() * 4 - 2) * blastMultiplier, 0, 0, 0);
|
||||
|
||||
|
||||
float brightness = rand.nextFloat() * 0.3f;
|
||||
ParticleBuilder.create(Type.CLOUD, rand, posX, posY, posZ, 2*blastMultiplier, false)
|
||||
.clr(brightness, brightness, brightness).spawn(world);
|
||||
|
||||
brightness = rand.nextFloat() * 0.3f;
|
||||
ParticleBuilder.create(Type.DARK_MAGIC, rand, posX, posY, posZ, 2*blastMultiplier, false)
|
||||
.clr(brightness, brightness, brightness).spawn(world);
|
||||
}
|
||||
|
||||
@@ -98,6 +98,8 @@ public final class ParticleBuilder {
|
||||
/** Helical animated 'buffing' particle.<p></p><b>Defaults:</b><br>Lifetime: 15 ticks
|
||||
* <br>Velocity: (0, 0.27, 0)<br>Colour: white */
|
||||
public static final ResourceLocation BUFF = new ResourceLocation(Wizardry.MODID,"buff");
|
||||
/** Large, thick cloud.<p></p><b>Defaults:</b><br>Lifetime: 48-60 ticks<br> Colour: dark grey */
|
||||
public static final ResourceLocation CLOUD = new ResourceLocation(Wizardry.MODID,"cloud");
|
||||
/** Spiral particle, like potions.<p></p><b>Defaults:</b><br>Lifetime: 8-40 ticks<br>Colour: white */
|
||||
public static final ResourceLocation DARK_MAGIC = new ResourceLocation(Wizardry.MODID,"dark_magic");
|
||||
/** Single pixel particle.<p></p><b>Defaults:</b><br>Lifetime: 16-80 ticks<br>Colour: white */
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
Reference in New Issue
Block a user