/* * 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.ParticleOptions; 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 UntintedParticleLeavesBlock extends LeavesBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(i -> i.group((App)ExtraCodecs.floatRange(0.0f, 1.0f).fieldOf("leaf_particle_chance").forGetter(e -> Float.valueOf(e.leafParticleChance)), (App)ParticleTypes.CODEC.fieldOf("leaf_particle").forGetter(e -> e.leafParticle), UntintedParticleLeavesBlock.propertiesCodec()).apply((Applicative)i, UntintedParticleLeavesBlock::new)); protected final ParticleOptions leafParticle; public UntintedParticleLeavesBlock(float leafParticleChance, ParticleOptions leafParticle, BlockBehaviour.Properties properties) { super(leafParticleChance, properties); this.leafParticle = leafParticle; } @Override protected void spawnFallingLeavesParticle(Level level, BlockPos pos, RandomSource random) { ParticleUtils.spawnParticleBelow(level, pos, random, this.leafParticle); } public MapCodec codec() { return CODEC; } }