mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-07 22:16:44 +01:00
Fixed fancy beds deleting their sheets when broken
This commit is contained in:
parent
7c48486956
commit
01b9e11e2d
2 changed files with 14 additions and 1 deletions
|
@ -57,6 +57,20 @@ public class FancyBedBlock extends BedBlock {
|
|||
return SHAPES.get(state.get(PART).ordinal()).apply(BedBlock.getOppositePartDirection(state));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
if (state.hasBlockEntity() && !state.isOf(newState.getBlock()) && state.get(PART) == BedPart.HEAD) {
|
||||
world.getBlockEntity(pos, UBlockEntities.FANCY_BED).ifPresent(tile -> {
|
||||
SheetPattern pattern = tile.getPattern();
|
||||
if (pattern != SheetPattern.NONE) {
|
||||
dropStack(world, pos, BedsheetsItem.forPattern(pattern).getDefaultStack());
|
||||
}
|
||||
});
|
||||
}
|
||||
super.onStateReplaced(state, world, pos, newState, moved);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new Tile(pos, state);
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.minelittlepony.unicopia.block.FancyBedBlock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
|
|
Loading…
Reference in a new issue