AbstractBannerBlock .java

net.minecraft.world.level.block.AbstractBannerBlock (class): members: isPossibleToRespawnInThis, getCloneItemStack, getColor, newBlockEntity, color.

net.minecraft.world.level.blockclass39 linescommonextends BaseEntityBlock1.3 KB

API Surface (4)

boolean isPossibleToRespawnInThis(final BlockState state)
BlockEntity newBlockEntity(final BlockPos worldPosition, final BlockState blockState)
ItemStack getCloneItemStack(final LevelReader level, final BlockPos pos, final BlockState state, final boolean includeData)
DyeColor getColor()

Fields & Constants (1)

color

Full Source

AbstractBannerBlock.java39 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.block;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.world.item.DyeColor;
5
import net.minecraft.world.item.ItemStack;
6
import net.minecraft.world.level.LevelReader;
7
import net.minecraft.world.level.block.entity.BannerBlockEntity;
8
import net.minecraft.world.level.block.entity.BlockEntity;
9
import net.minecraft.world.level.block.state.BlockBehaviour;
10
import net.minecraft.world.level.block.state.BlockState;
11
12
public abstract class AbstractBannerBlock extends BaseEntityBlock {
13
	private final DyeColor color;
14
15
	protected AbstractBannerBlock(final DyeColor color, final BlockBehaviour.Properties properties) {
16
		super(properties);
17
		this.color = color;
18
	}
19
20
	@Override
21
	public boolean isPossibleToRespawnInThis(final BlockState state) {
22
		return true;
23
	}
24
25
	@Override
26
	public BlockEntity newBlockEntity(final BlockPos worldPosition, final BlockState blockState) {
27
		return new BannerBlockEntity(worldPosition, blockState, this.color);
28
	}
29
30
	@Override
31
	protected ItemStack getCloneItemStack(final LevelReader level, final BlockPos pos, final BlockState state, final boolean includeData) {
32
		return level.getBlockEntity(pos) instanceof BannerBlockEntity banner ? banner.getItem() : super.getCloneItemStack(level, pos, state, includeData);
33
	}
34
35
	public DyeColor getColor() {
36
		return this.color;
37
	}
38
}
39

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