56 lines
1.8 KiB
Java
56 lines
1.8 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.serialization.MapCodec
|
|
*/
|
|
package net.minecraft.world.level.block;
|
|
|
|
import com.mojang.serialization.MapCodec;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.world.item.DyeColor;
|
|
import net.minecraft.world.item.ItemStack;
|
|
import net.minecraft.world.level.LevelReader;
|
|
import net.minecraft.world.level.block.BaseEntityBlock;
|
|
import net.minecraft.world.level.block.entity.BannerBlockEntity;
|
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
|
|
public abstract class AbstractBannerBlock
|
|
extends BaseEntityBlock {
|
|
private final DyeColor color;
|
|
|
|
protected AbstractBannerBlock(DyeColor color, BlockBehaviour.Properties properties) {
|
|
super(properties);
|
|
this.color = color;
|
|
}
|
|
|
|
protected abstract MapCodec<? extends AbstractBannerBlock> codec();
|
|
|
|
@Override
|
|
public boolean isPossibleToRespawnInThis(BlockState state) {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public BlockEntity newBlockEntity(BlockPos worldPosition, BlockState blockState) {
|
|
return new BannerBlockEntity(worldPosition, blockState, this.color);
|
|
}
|
|
|
|
@Override
|
|
protected ItemStack getCloneItemStack(LevelReader level, BlockPos pos, BlockState state, boolean includeData) {
|
|
BlockEntity blockEntity = level.getBlockEntity(pos);
|
|
if (blockEntity instanceof BannerBlockEntity) {
|
|
BannerBlockEntity banner = (BannerBlockEntity)blockEntity;
|
|
return banner.getItem();
|
|
}
|
|
return super.getCloneItemStack(level, pos, state, includeData);
|
|
}
|
|
|
|
public DyeColor getColor() {
|
|
return this.color;
|
|
}
|
|
}
|
|
|