Skip to content

Commit

Permalink
signs now have a backside API/Impl is WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Faithcaio committed Jun 7, 2023
1 parent 621edbd commit d532bf6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
33 changes: 33 additions & 0 deletions src/main/java/org/spongepowered/api/block/entity/Sign.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package org.spongepowered.api.block.entity;

import net.kyori.adventure.text.Component;
import org.spongepowered.api.data.DataHolder;
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.ListValue;
import org.spongepowered.api.data.value.Value;
Expand Down Expand Up @@ -52,4 +53,36 @@ default Value.Mutable<Boolean> glowingText() {
return this.requireValue(Keys.GLOWING_TEXT).asMutable();
}

default Value.Mutable<Boolean> waxed() {
return this.requireValue(Keys.SIGN_WAXED).asMutable();
}

default SignText backText() {
return this.require(Keys.SIGN_BACK_TEXT);
}

default SignText frontText() {
return this.require(Keys.SIGN_FRONT_TEXT);
}

interface SignText extends DataHolder.Mutable {
/**
* Gets the {@link org.spongepowered.api.data.value.ListValue.Mutable} of {@link Component} for the {@link Sign}
* to show.
*
* @return The list of text lines
*/
default ListValue.Mutable<Component> lines() {
return this.requireValue(Keys.SIGN_LINES).asMutable();
}

/**
* {@return Whether this sign has glowing text}.
*/
default Value.Mutable<Boolean> glowingText() {
return this.requireValue(Keys.GLOWING_TEXT).asMutable();
}

// TODO color?
}
}
12 changes: 9 additions & 3 deletions src/main/java/org/spongepowered/api/data/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -1143,8 +1143,8 @@ public final class Keys {
public static final Key<Value<GrassColorModifier>> GRASS_COLOR_MODIFIER = Keys.key(ResourceKey.sponge("grass_color_modifier"), GrassColorModifier.class);

/**
* Whether a {@link Sign} has glowing text (from dying
* with {@link ItemTypes#GLOW_INK_SAC}).
* Whether a {@link org.spongepowered.api.block.entity.Sign.SignText} has glowing text (from dying
* with {@link ItemTypes#GLOW_INK_SAC}). When using it on {@link Sign} this refers to the {@link #SIGN_FRONT_TEXT} only.
*/
public static final Key<Value<Boolean>> GLOWING_TEXT = Keys.key(ResourceKey.sponge("glowing_text"), Boolean.class);

Expand Down Expand Up @@ -2749,10 +2749,16 @@ public final class Keys {
public static final Key<Value<Boolean>> SHOW_BOTTOM = Keys.key(ResourceKey.sponge("show_bottom"), Boolean.class);

/**
* The lines displayed on a {@link Sign}.
* The lines of a {@link org.spongepowered.api.block.entity.Sign.SignText}.
* When using it on {@link Sign} this refers to the {@link #SIGN_FRONT_TEXT} only.
*/
public static final Key<ListValue<Component>> SIGN_LINES = Keys.listKey(ResourceKey.sponge("sign_lines"), Component.class);

public static final Key<Value<Sign.SignText>> SIGN_BACK_TEXT = Keys.key(ResourceKey.sponge("sign_back_text"), Sign.SignText.class);
public static final Key<Value<Sign.SignText>> SIGN_FRONT_TEXT = Keys.key(ResourceKey.sponge("sign_front_text"), Sign.SignText.class);

public static final Key<Value<Boolean>> SIGN_WAXED = Keys.key(ResourceKey.sponge("sign_waxed"), Boolean.class);

/**
* The size of a {@link Slime}.
* or
Expand Down

0 comments on commit d532bf6

Please sign in to comment.