Skip to content

Commit

Permalink
[#120] Implemented new UMC text-rendering (will fail in Github Actions)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielxs01 committed Nov 25, 2023
1 parent b8c63fd commit 55a596a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/landofrails/landofsignals/LOSBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static void register() {
final Map.Entry<String, ContentPackModel[]> blockSignPartMetalRod = new AbstractMap.SimpleEntry<>("models/block/landofsignals/signs/gsar/metalrod/metalrod.obj", new ContentPackModel[]{new ContentPackModel(new float[]{0.5f, 0f, 0.5f}, new float[]{0.5f, 0f, 0.5f}, new float[]{1f, 1f, 1f}, new String[]{"Metal_Rod01_MR01"})});

registerSignContentPack("block_sign_part_gsar_metal_rod", "GSAR Metal Rod", false, Collections.singletonMap(blockSignPartMetalRod.getKey(), blockSignPartMetalRod.getValue()));
registerSignContentPack("block_sign_part_gsar_ne1", "GSAR Trapeztafel NE1", true, models("models/block/landofsignals/signs/gsar/ne1/signalne1.obj", new ContentPackModel[]{new ContentPackModel(new float[]{0.5f, 0f, 0.5f}, new float[]{0.5f, 0f, 0.5f}, new float[]{1f, 1f, 1f})}, blockSignPartMetalRod.getKey(), blockSignPartMetalRod.getValue()));
registerSignContentPack("block_sign_part_gsar_ne1", "GSAR Trapeztafel NE1", false, models("models/block/landofsignals/signs/gsar/ne1/signalne1.obj", new ContentPackModel[]{new ContentPackModel(new float[]{0.5f, 0f, 0.5f}, new float[]{0.5f, 0f, 0.5f}, new float[]{1f, 1f, 1f})}, blockSignPartMetalRod.getKey(), blockSignPartMetalRod.getValue()));

// Signs: SH2
registerSignContentPack("block_sign_part_gsar_sh2_full_wo_light", "GSAR Schutzsignal SH2 (Full, w/o Light)", false, Collections.singletonMap("models/block/landofsignals/signs/gsar/sh2/signalsh2.obj", new ContentPackModel[]{new ContentPackModel(new float[]{0.5f, 0f, 0.5f}, new float[]{1f, 1f, 1f}, new float[]{1f, 1f, 1f}, new float[]{0.5f, 0.5f, 0.5f}, new String[]{"Sign01_SI01", "MetalRodLong_MR02"})}));
Expand All @@ -139,7 +139,7 @@ public static void register() {
// Signs: LF
registerSignContentPack("block_sign_part_gsar_lf1_sign", "GSAR Langsamfahrscheibe LF1", false, models("models/block/landofsignals/signs/gsar/lf1/signallf1.obj", new ContentPackModel[]{new ContentPackModel(new float[]{0.5f, 0f, 0.5f}, new float[]{0.5f, 0f, 0.5f}, new float[]{1f, 1f, 1f})}, blockSignPartMetalRod.getKey(), blockSignPartMetalRod.getValue()));
registerSignContentPack("block_sign_part_gsar_lf6_sign", "GSAR Geschwindigkeits-Ankuendesignal LF6", false, models("models/block/landofsignals/signs/gsar/lf6/signallf6.obj", new ContentPackModel[]{new ContentPackModel(new float[]{0.5f, 0.2f, 0.5f}, new float[]{0.5f, 0.2f, 0.5f}, new float[]{1f, 1f, 1f}, new String[]{"Cube.001_Cube.002"})}, blockSignPartMetalRod.getKey(), blockSignPartMetalRod.getValue()));
registerSignContentPack("block_sign_part_gsar_lf7_sign", "GSAR Geschwindigkeitssignal LF7", false, models("models/block/landofsignals/signs/gsar/lf7/signallf7.obj", new ContentPackModel[]{new ContentPackModel(new float[]{0.5f, 0f, 0.5f}, new float[]{0.5f, 0f, 0.5f}, new float[]{1f, 1f, 1f})}, blockSignPartMetalRod.getKey(), blockSignPartMetalRod.getValue()));
registerSignContentPack("block_sign_part_gsar_lf7_sign", "GSAR Geschwindigkeitssignal LF7", true, models("models/block/landofsignals/signs/gsar/lf7/signallf7.obj", new ContentPackModel[]{new ContentPackModel(new float[]{0.5f, 0f, 0.5f}, new float[]{0.5f, 0f, 0.5f}, new float[]{1f, 1f, 1f})}, blockSignPartMetalRod.getKey(), blockSignPartMetalRod.getValue()));

// Signs: RA
registerSignContentPack("block_sign_part_gsar_ra10a_sign", "GSAR Rangierhalttafel RA10 (a)", false, models("models/block/landofsignals/signs/gsar/ra10a/signalra10a.obj", new ContentPackModel[]{new ContentPackModel(new float[]{0.5f, 0f, 0.5f}, new float[]{0.5f, 0f, 0.5f}, new float[]{1f, 1f, 1f})}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package net.landofrails.landofsignals.gui;

import cam72cam.mod.MinecraftClient;
import cam72cam.mod.entity.Player;
import cam72cam.mod.gui.screen.Button;
import cam72cam.mod.gui.screen.IScreen;
import cam72cam.mod.gui.screen.IScreenBuilder;
import cam72cam.mod.gui.screen.TextField;
import cam72cam.mod.math.Vec3i;
import cam72cam.mod.text.PlayerMessage;
import cam72cam.mod.text.TextUtil;
import net.landofrails.landofsignals.LandOfSignals;
import net.landofrails.landofsignals.packet.SignTextPacket;
Expand Down Expand Up @@ -37,10 +35,6 @@ public void init(IScreenBuilder screen) {
new Button(screen, -100, 55, 200, 20, TextUtil.translate(SAVEBUTTONLABELKEY)) {
@Override
public void onClick(Player.Hand hand) {

// CHECK: Remove with new umc version
MinecraftClient.getPlayer().sendMessage(PlayerMessage.translate(TEXTEDITORNEEDSNEWVERSIONMESSAGEKEY));
//
SignTextPacket.sendTextToServer(signPos, textField.getText());
screen.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,21 @@ private static void renderStuff(TileSignPart tsp, RenderState state) {
// Textrendering
ContentPackSign contentPackSign = LOSBlocks.BLOCK_SIGN_PART.getContentpackSigns().get(id);
if(contentPackSign.isWriteable()){
// Does not work because its fixed to the players screen and not the block
GlobalRender.drawFixedText(tsp.getText(), state.clone(), new Vec3d(.7, 1.2, .5), 0.15f, new Vec3d(180, tsp.getBlockRotate() + 180, 0));
RenderState textState = state.clone()
.lighting(false)
.depth_test(true)
.color(0, 0, 0, 1)
.translate(0.5, 0.675, 0.5)
.rotate(180, 1.0F, 0.0F, 0.0F) // X
.rotate(-tsp.getBlockRotate(), 0.0F, 1.0F, 0.0F) // Y
.rotate(0, 0.0F, 0.0F, 1.0F) // Z
.translate(0.025, 0, -0.065)
.scale(0.05f, 0.05f, 0.05f);
GlobalRender.drawRawCenteredText(tsp.getText(), textState.clone());
textState.translate(0,-10, 0);
GlobalRender.drawRawLeftOrientedText(tsp.getText(), textState.clone());
textState.translate(0, 20, 0);
GlobalRender.drawRawRightOrientedText(tsp.getText(), textState.clone());
}
//

Expand Down

0 comments on commit 55a596a

Please sign in to comment.