Removes unnecessary processingBlock variable
All checks were successful
KnarCraft/KnarLib/pipeline/head This commit looks good
All checks were successful
KnarCraft/KnarLib/pipeline/head This commit looks good
This commit is contained in:
parent
8028a8556b
commit
a89ed1fb39
@ -21,8 +21,6 @@ public final class ParticleSpawner implements Runnable {
|
||||
|
||||
private final ParticleConfig particleConfig;
|
||||
private final Map<Material, ParticleConfig> materialConfigs;
|
||||
|
||||
private Block processingBlock;
|
||||
private final Collection<Block> blocks;
|
||||
private final Supplier<Collection<Block>> blockSupplier;
|
||||
private final UUID storedCalculationId;
|
||||
@ -110,13 +108,10 @@ public final class ParticleSpawner implements Runnable {
|
||||
* @param location <p>A clone of the block's location</p>
|
||||
*/
|
||||
private void spawnParticleForBlock(@NotNull Block block, @NotNull World world, @NotNull Location location) {
|
||||
// Store the currently processed block for height calculation
|
||||
processingBlock = block;
|
||||
|
||||
double blockHeight = ParticleHelper.getBlockHeight(block);
|
||||
ParticleConfig activeConfig = getParticleConfig();
|
||||
ParticleConfig activeConfig = getParticleConfig(block.getType());
|
||||
|
||||
switch (getParticleConfig().getParticleMode()) {
|
||||
switch (activeConfig.getParticleMode()) {
|
||||
case SINGLE -> ParticleHelper.spawnParticle(world, location.clone().add(0.5,
|
||||
activeConfig.getHeightOffset(), 0.5), activeConfig, blockHeight);
|
||||
case SQUARE -> ParticleHelper.drawSquare(world, location, activeConfig, blockHeight);
|
||||
@ -130,13 +125,14 @@ public final class ParticleSpawner implements Runnable {
|
||||
/**
|
||||
* Gets the particle config to use for the current block's material
|
||||
*
|
||||
* @param material <p>The material of the block to get a configuration for</p>
|
||||
* @return <p>The particle config to use</p>
|
||||
*/
|
||||
private @NotNull ParticleConfig getParticleConfig() {
|
||||
private @NotNull ParticleConfig getParticleConfig(@NotNull Material material) {
|
||||
if (this.materialConfigs == null) {
|
||||
return this.particleConfig;
|
||||
}
|
||||
ParticleConfig materialConfig = this.materialConfigs.get(processingBlock.getType());
|
||||
ParticleConfig materialConfig = this.materialConfigs.get(material);
|
||||
if (materialConfig != null) {
|
||||
return materialConfig;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user