forked from Ferdzz/PlaceableItems
-
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.
Spawn flame particles overtime, complete an item on Ferdzz#72
- Loading branch information
1 parent
2e5af70
commit f863347
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...src/main/java/me/ferdz/placeableitems/block/component/impl/BlazePowderBlockComponent.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,33 @@ | ||
package me.ferdz.placeableitems.block.component.impl; | ||
|
||
import me.ferdz.placeableitems.block.component.AbstractBlockComponent; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.particles.ParticleTypes; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
|
||
import java.util.Random; | ||
|
||
public class BlazePowderBlockComponent extends AbstractBlockComponent { | ||
@Override | ||
public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random random) { | ||
final double xSpreadRadius = 0.15, ySpreadRadius = 0.05; | ||
worldIn.addParticle( | ||
ParticleTypes.FLAME, | ||
pos.getX() + 0.5 + randomFireSpread(xSpreadRadius, random), | ||
pos.getY() + 0.2 + randomFireSpread(ySpreadRadius, random), | ||
pos.getZ() + 0.5 + randomFireSpread(xSpreadRadius, random), | ||
0, | ||
0, | ||
0 | ||
); | ||
} | ||
|
||
private double randomFireSpread(double spreadRadius, Random random) { | ||
return (-spreadRadius + (2 * spreadRadius * random.nextGaussian())); | ||
} | ||
|
||
private double randomFireSpeed(Random random) { | ||
return random.nextGaussian() * 0.03; | ||
} | ||
} |
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