Trigger an update when a bed's sheets are changed

This commit is contained in:
Sollace 2023-11-25 02:37:10 +00:00
parent 7e25107f7a
commit a7ac895fd1
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -19,6 +19,7 @@ import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.enums.BedPart; import net.minecraft.block.enums.BedPart;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.DyeColor; import net.minecraft.util.DyeColor;
import net.minecraft.util.StringIdentifiable; import net.minecraft.util.StringIdentifiable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -114,6 +115,9 @@ public class FancyBedBlock extends BedBlock {
public void setPattern(SheetPattern pattern) { public void setPattern(SheetPattern pattern) {
this.pattern = pattern; this.pattern = pattern;
markDirty(); markDirty();
if (world instanceof ServerWorld sw) {
sw.getChunkManager().markForUpdate(getPos());
}
} }
public SheetPattern getPattern() { public SheetPattern getPattern() {