minecraft_25w45a_unobfuscated/net/minecraft/world/level/block/TintedParticleLeavesBlock.java
2025-11-24 22:52:51 +03:00

45 lines
1.8 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.mojang.datafixers.kinds.App
* com.mojang.datafixers.kinds.Applicative
* com.mojang.serialization.MapCodec
* com.mojang.serialization.codecs.RecordCodecBuilder
*/
package net.minecraft.world.level.block;
import com.mojang.datafixers.kinds.App;
import com.mojang.datafixers.kinds.Applicative;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ColorParticleOption;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.ExtraCodecs;
import net.minecraft.util.ParticleUtils;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
public class TintedParticleLeavesBlock
extends LeavesBlock {
public static final MapCodec<TintedParticleLeavesBlock> CODEC = RecordCodecBuilder.mapCodec(i -> i.group((App)ExtraCodecs.floatRange(0.0f, 1.0f).fieldOf("leaf_particle_chance").forGetter(e -> Float.valueOf(e.leafParticleChance)), TintedParticleLeavesBlock.propertiesCodec()).apply((Applicative)i, TintedParticleLeavesBlock::new));
public TintedParticleLeavesBlock(float leafParticleChance, BlockBehaviour.Properties properties) {
super(leafParticleChance, properties);
}
@Override
protected void spawnFallingLeavesParticle(Level level, BlockPos pos, RandomSource random) {
ColorParticleOption particle = ColorParticleOption.create(ParticleTypes.TINTED_LEAVES, level.getClientLeafTintColor(pos));
ParticleUtils.spawnParticleBelow(level, pos, random, particle);
}
public MapCodec<? extends TintedParticleLeavesBlock> codec() {
return CODEC;
}
}