SPIGOT-4742: Make Sign Colorable

This commit is contained in:
md_5 2019-04-25 14:49:23 +10:00
parent 42f88f72b5
commit 76a855c8ce

View file

@ -1,8 +1,10 @@
package org.bukkit.craftbukkit.block; package org.bukkit.craftbukkit.block;
import net.minecraft.server.ChatComponentText; import net.minecraft.server.ChatComponentText;
import net.minecraft.server.EnumColor;
import net.minecraft.server.IChatBaseComponent; import net.minecraft.server.IChatBaseComponent;
import net.minecraft.server.TileEntitySign; import net.minecraft.server.TileEntitySign;
import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
@ -55,6 +57,16 @@ public class CraftSign extends CraftBlockEntityState<TileEntitySign> implements
this.editable = editable; this.editable = editable;
} }
@Override
public DyeColor getColor() {
return DyeColor.getByWoolData((byte) getSnapshot().f().getColorIndex());
}
@Override
public void setColor(DyeColor color) {
getSnapshot().a(EnumColor.fromColorIndex(color.getWoolData()));
}
@Override @Override
public void applyTo(TileEntitySign sign) { public void applyTo(TileEntitySign sign) {
super.applyTo(sign); super.applyTo(sign);