WeatheringCopperChestBlock .java

net.minecraft.world.level.block.WeatheringCopperChestBlock (class, 42 lines): members: closeSound, isWaxed, getAge, isRandomlyTicking, randomTick.

net.minecraft.world.level.blockclass42 linescommonextends CopperChestBlock1.5 KB

Implements

API Surface (4)

boolean isRandomlyTicking(final BlockState state)
void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random)
WeatheringCopper.WeatherState getAge()
boolean isWaxed()

Fields & Constants (1)

closeSound

Full Source

WeatheringCopperChestBlock.java42 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.server.level.ServerLevel;
5
import net.minecraft.sounds.SoundEvent;
6
import net.minecraft.util.RandomSource;
7
import net.minecraft.world.level.block.entity.ChestBlockEntity;
8
import net.minecraft.world.level.block.state.BlockBehaviour;
9
import net.minecraft.world.level.block.state.BlockState;
10
import net.minecraft.world.level.block.state.properties.ChestType;
11
12
public class WeatheringCopperChestBlock extends CopperChestBlock implements WeatheringCopper {
13
	public WeatheringCopperChestBlock(
14
		final WeatheringCopper.WeatherState weatherState, final SoundEvent openSound, final SoundEvent closeSound, final BlockBehaviour.Properties properties
15
	) {
16
		super(weatherState, openSound, closeSound, properties);
17
	}
18
19
	@Override
20
	protected boolean isRandomlyTicking(final BlockState state) {
21
		return WeatheringCopper.getNext(state.getBlock()).isPresent();
22
	}
23
24
	@Override
25
	protected void randomTick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) {
26
		if (!state.getValue(ChestBlock.TYPE).equals(ChestType.RIGHT)
27
			&& level.getBlockEntity(pos) instanceof ChestBlockEntity chestBlockEntity
28
			&& chestBlockEntity.getEntitiesWithContainerOpen().isEmpty()) {
29
			this.changeOverTime(state, level, pos, random);
30
		}
31
	}
32
33
	public WeatheringCopper.WeatherState getAge() {
34
		return this.getState();
35
	}
36
37
	@Override
38
	public boolean isWaxed() {
39
		return false;
40
	}
41
}
42

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