mirror of
https://github.com/TeamMidnightDust/PictureSign.git
synced 2025-12-15 21:55:09 +01:00
PictureSign 2.0 Beta 1 - Video support & rotations
- Port to 1.20.1 - Add support for video playback using VLCj - YouTube videos are being played using Invidious, as VLC currently doesn't support YouTube playback - Add ability to rotate images (on X, Y & Z-axis; only with exceedVanillaLineLength enabled) - Marginally improve PictureSign helper screen - Way less bugs - GUI for Video & Rotation - Support for Hanging signs - Improved config screen - Ability to select shader program pictures are being rendered with when using Iris - Brightness of images is now based on light level at sign position by default - Ability to load URLs defined in JSON files, allowing for very long URLs like those of Twitch.tv streams, as well as start and stop times for videos
This commit is contained in:
@@ -6,7 +6,7 @@ import eu.midnightdust.picturesign.config.PictureSignConfig;
|
||||
import eu.midnightdust.picturesign.screen.PictureSignHelperScreen;
|
||||
import net.minecraft.block.entity.SignBlockEntity;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.SignEditScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@@ -20,14 +20,17 @@ import java.util.Objects;
|
||||
|
||||
import static eu.midnightdust.picturesign.PictureSignClient.MOD_ID;
|
||||
|
||||
@Mixin(SignEditScreen.class)
|
||||
@Mixin(AbstractSignEditScreen.class)
|
||||
public abstract class MixinSignEditScreen extends Screen {
|
||||
private static final Identifier PICTURESIGN_ICON_TEXTURE = new Identifier(MOD_ID,"textures/gui/picturesign_button.png");
|
||||
private static final Identifier CLIPBOARD_ICON_TEXTURE = new Identifier(MOD_ID,"textures/gui/clipboard_button.png");
|
||||
private static final Identifier TRASHBIN_ICON_TEXTURE = new Identifier(MOD_ID,"textures/gui/trashbin_button.png");
|
||||
@Shadow @Final private SignBlockEntity sign;
|
||||
@Shadow @Final private SignBlockEntity blockEntity;
|
||||
|
||||
@Shadow @Final private String[] text;
|
||||
@Shadow @Final private String[] messages;
|
||||
|
||||
@Shadow @Final private boolean front;
|
||||
private static boolean switchScreen = false;
|
||||
|
||||
protected MixinSignEditScreen(Text title) {
|
||||
super(title);
|
||||
@@ -38,21 +41,32 @@ public abstract class MixinSignEditScreen extends Screen {
|
||||
if (PictureSignClient.clipboard != null && PictureSignClient.clipboard[0] != null)
|
||||
this.addDrawableChild(new TexturedOverlayButtonWidget(this.width - 84, this.height - 40, 20, 20, 0, 0, 20, CLIPBOARD_ICON_TEXTURE, 32, 64, (buttonWidget) -> {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
text[i] = PictureSignClient.clipboard[i];
|
||||
sign.setTextOnRow(i, Text.of(text[i]));
|
||||
messages[i] = PictureSignClient.clipboard[i];
|
||||
int finalI = i;
|
||||
blockEntity.changeText(changer -> changer.withMessage(finalI, Text.of(messages[finalI])), front);
|
||||
}
|
||||
}, Text.empty()));
|
||||
if (PictureSignConfig.helperUi)
|
||||
this.addDrawableChild(new TexturedOverlayButtonWidget(this.width - 62, this.height - 40, 20, 20, 0, 0, 20, TRASHBIN_ICON_TEXTURE, 32, 64, (buttonWidget) -> {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
text[i] = "";
|
||||
sign.setTextOnRow(i, Text.empty());
|
||||
messages[i] = "";
|
||||
int finalI = i;
|
||||
blockEntity.changeText(changer -> changer.withMessage(finalI, Text.empty()), front);
|
||||
}
|
||||
}, Text.empty()));
|
||||
if (PictureSignConfig.helperUi)
|
||||
this.addDrawableChild(new TexturedOverlayButtonWidget(this.width - 40, this.height - 40, 20, 20, 0, 0, 20, PICTURESIGN_ICON_TEXTURE, 32, 64, (buttonWidget) -> {
|
||||
sign.setEditable(true);
|
||||
Objects.requireNonNull(client).setScreen(new PictureSignHelperScreen(this.sign,false));
|
||||
switchScreen = true;
|
||||
Objects.requireNonNull(client).setScreen(new PictureSignHelperScreen(this.blockEntity, front, false));
|
||||
}, Text.empty()));
|
||||
}
|
||||
@Inject(at = @At("HEAD"), method = "removed", cancellable = true)
|
||||
private void picturesign$removed(CallbackInfo ci) {
|
||||
if (switchScreen) {
|
||||
switchScreen = false;
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user