BlastFurnaceBlock .java

net.minecraft.world.level.block.BlastFurnaceBlock (class): members: openContainer, getTicker, newBlockEntity, animateTick. imports: MenuProvider, Stats.

net.minecraft.world.level.blockclass73 linescommonextends AbstractFurnaceBlock2.8 KB

API Surface (3)

BlockEntity newBlockEntity(final BlockPos worldPosition, final BlockState blockState)
void openContainer(final Level level, final BlockPos pos, final Player player)
void animateTick(final BlockState state, final Level level, final BlockPos pos, final RandomSource random)

Full Source

BlastFurnaceBlock.java73 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.core.Direction;
5
import net.minecraft.core.particles.ParticleTypes;
6
import net.minecraft.sounds.SoundEvents;
7
import net.minecraft.sounds.SoundSource;
8
import net.minecraft.stats.Stats;
9
import net.minecraft.util.RandomSource;
10
import net.minecraft.world.MenuProvider;
11
import net.minecraft.world.entity.player.Player;
12
import net.minecraft.world.level.Level;
13
import net.minecraft.world.level.block.entity.BlastFurnaceBlockEntity;
14
import net.minecraft.world.level.block.entity.BlockEntity;
15
import net.minecraft.world.level.block.entity.BlockEntityTicker;
16
import net.minecraft.world.level.block.entity.BlockEntityType;
17
import net.minecraft.world.level.block.entity.BlockEntityTypes;
18
import net.minecraft.world.level.block.state.BlockBehaviour;
19
import net.minecraft.world.level.block.state.BlockState;
20
import org.jspecify.annotations.Nullable;
21
22
/**
23
 * Access widened by fabric-transitive-access-wideners-v1 to accessible
24
 */
25
public class BlastFurnaceBlock extends AbstractFurnaceBlock {
26
	/**
27
	 * Access widened by fabric-transitive-access-wideners-v1 to accessible
28
	 */
29
	public BlastFurnaceBlock(final BlockBehaviour.Properties properties) {
30
		super(properties);
31
	}
32
33
	@Override
34
	public BlockEntity newBlockEntity(final BlockPos worldPosition, final BlockState blockState) {
35
		return new BlastFurnaceBlockEntity(worldPosition, blockState);
36
	}
37
38
	@Override
39
	public <T extends BlockEntity> @Nullable BlockEntityTicker<T> getTicker(final Level level, final BlockState blockState, final BlockEntityType<T> type) {
40
		return createFurnaceTicker(level, type, BlockEntityTypes.BLAST_FURNACE);
41
	}
42
43
	@Override
44
	protected void openContainer(final Level level, final BlockPos pos, final Player player) {
45
		BlockEntity blockEntity = level.getBlockEntity(pos);
46
		if (blockEntity instanceof BlastFurnaceBlockEntity) {
47
			player.openMenu((MenuProvider)blockEntity);
48
			player.awardStat(Stats.INTERACT_WITH_BLAST_FURNACE);
49
		}
50
	}
51
52
	@Override
53
	public void animateTick(final BlockState state, final Level level, final BlockPos pos, final RandomSource random) {
54
		if (state.getValue(LIT)) {
55
			double x = pos.getX() + 0.5;
56
			double y = pos.getY();
57
			double z = pos.getZ() + 0.5;
58
			if (random.nextDouble() < 0.1) {
59
				level.playLocalSound(x, y, z, SoundEvents.BLASTFURNACE_FIRE_CRACKLE, SoundSource.BLOCKS, 1.0F, 1.0F, false);
60
			}
61
62
			Direction direction = state.getValue(FACING);
63
			Direction.Axis axis = direction.getAxis();
64
			double r = 0.52;
65
			double ss = random.nextDouble() * 0.6 - 0.3;
66
			double dx = axis == Direction.Axis.X ? direction.getStepX() * 0.52 : ss;
67
			double dy = random.nextDouble() * 9.0 / 16.0;
68
			double dz = axis == Direction.Axis.Z ? direction.getStepZ() * 0.52 : ss;
69
			level.addParticle(ParticleTypes.SMOKE, x + dx, y + dy, z + dz, 0.0, 0.0, 0.0);
70
		}
71
	}
72
}
73

Decompiled Minecraft 26.3 source of BlastFurnaceBlock (net/minecraft/world/level/block/BlastFurnaceBlock.java) with Mojang official mappings, stored verbatim on the site.