Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Build with Gradle
run: ./gradlew build --full-stacktrace
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/*-release.jar
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ plugins {
val versions = providers.gradleProperty("net.labymod.minecraft-versions").get().split(";")

group = "com.rappytv.signsearch"
version = providers.environmentVariable("VERSION").getOrElse("1.0.3")
version = providers.environmentVariable("VERSION").getOrElse("1.0.4")

labyMod {
defaultPackageName = "com.rappytv.signsearch" //change this to your main package name (used by all modules)
defaultPackageName = "com.rappytv.signsearch"

minecraft {
registerVersion(versions.toTypedArray()) {
Expand All @@ -26,7 +26,7 @@ labyMod {
displayName = "SignSearch"
author = "RappyTV"
description = "Highlight signs which contain a specific text."
minecraftVersion = "1.8<1.21.1"
minecraftVersion = "1.8<1.21.4"
version = rootProject.version.toString()
}
}
Expand Down
11 changes: 9 additions & 2 deletions core/src/main/java/com/rappytv/signsearch/SignSearchAddon.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.rappytv.signsearch;

import com.rappytv.signsearch.gui.settings.SignSearchSettingsActivity;
import com.rappytv.signsearch.listeners.KeyPressListener;
import com.rappytv.signsearch.listeners.PauseMenuListener;
import com.rappytv.signsearch.utils.SignManager;
import com.rappytv.signsearch.utils.SignSearchSettings;
Expand All @@ -13,15 +14,17 @@ public class SignSearchAddon extends LabyAddon<SignSearchConfiguration> {
private static SignSearchConfiguration config;
private static SignManager signManager;
private static SignSearchSettings searchSettings;
private SignSearchSettingsActivity settingsActivity;

@Override
protected void enable() {
registerSettingCategory();
config = configuration();
signManager = new SignManager();
searchSettings = new SignSearchSettings(config.enabled());
SignSearchSettingsActivity activity = new SignSearchSettingsActivity(searchSettings);
registerListener(new PauseMenuListener(activity));
settingsActivity = new SignSearchSettingsActivity(searchSettings);
registerListener(new KeyPressListener(this));
registerListener(new PauseMenuListener(settingsActivity));
}

@Override
Expand All @@ -40,4 +43,8 @@ public static SignManager getSignManager() {
public static SignSearchSettings getSearchSettings() {
return searchSettings;
}

public SignSearchSettingsActivity getSettingsActivity() {
return settingsActivity;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
package com.rappytv.signsearch;

import net.labymod.api.addon.AddonConfig;
import net.labymod.api.client.gui.screen.key.Key;
import net.labymod.api.client.gui.screen.widget.widgets.input.KeybindWidget.KeyBindSetting;
import net.labymod.api.client.gui.screen.widget.widgets.input.SwitchWidget.SwitchSetting;
import net.labymod.api.configuration.loader.property.ConfigProperty;

public class SignSearchConfiguration extends AddonConfig {

@SwitchSetting
private final ConfigProperty<Boolean> enabled = new ConfigProperty<>(true);

@KeyBindSetting
private final ConfigProperty<Key> menuHotkey = new ConfigProperty<>(Key.NONE);

@Override
public ConfigProperty<Boolean> enabled() {
return enabled;
}

public ConfigProperty<Key> menuHotkey() {
return menuHotkey;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.rappytv.signsearch.listeners;

import com.rappytv.signsearch.SignSearchAddon;
import net.labymod.api.Laby;
import net.labymod.api.event.Subscribe;
import net.labymod.api.event.client.input.KeyEvent;
import net.labymod.api.event.client.input.KeyEvent.State;

public class KeyPressListener {

private final SignSearchAddon addon;

public KeyPressListener(SignSearchAddon addon) {
this.addon = addon;
}

@Subscribe
public void onKeyDown(KeyEvent event) {
if(event.state() != State.PRESS
|| Laby.labyAPI().minecraft().minecraftWindow().isScreenOpened()
|| event.key() != addon.configuration().menuHotkey().get()) return;

Laby.labyAPI().minecraft().minecraftWindow().displayScreen(addon.getSettingsActivity());
}

}
3 changes: 3 additions & 0 deletions core/src/main/resources/assets/signsearch/i18n/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"settings": {
"enabled": {
"name": "Enabled"
},
"menuHotkey": {
"name": "Settings hotkey"
}
},
"ui": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
public abstract class SignMixin {

@Inject(method = "render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V", at = @At("HEAD"))
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack stack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
SignSearchAddon.getSignManager().onRender((net.labymod.api.client.blockentity.SignBlockEntity) signEntity, (BlockPosition) signEntity.getBlockPos());
}

@Redirect(method={"render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/model/geom/ModelPart;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;II)V"))
private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn) {
private void redirectSignColor(ModelPart modelPart, PoseStack stack, VertexConsumer consumer, int combinedLight, int combinedOverlay) {
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
Expand All @@ -37,6 +37,6 @@ private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn,
blue = signColor.getBlue();
alpha = signColor.getAlpha();
}
modelRenderer.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
modelPart.render(stack, consumer, combinedLight, combinedOverlay, red, green, blue, alpha);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
public abstract class SignMixin {

@Inject(method = "render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V", at = @At("HEAD"))
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack stack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
SignSearchAddon.getSignManager().onRender((net.labymod.api.client.blockentity.SignBlockEntity) signEntity, (BlockPosition) signEntity.getBlockPos());
}

@Redirect(method={"render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/model/geom/ModelPart;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;II)V"))
private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn) {
private void redirectSignColor(ModelPart modelPart, PoseStack stack, VertexConsumer consumer, int combinedLight, int combinedOverlay) {
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
Expand All @@ -37,6 +37,6 @@ private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn,
blue = signColor.getBlue();
alpha = signColor.getAlpha();
}
modelRenderer.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
modelPart.render(stack, consumer, combinedLight, combinedOverlay, red, green, blue, alpha);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
public abstract class SignMixin {

@Inject(method = "render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V", at = @At("HEAD"))
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack stack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
SignSearchAddon.getSignManager().onRender((net.labymod.api.client.blockentity.SignBlockEntity) signEntity, (BlockPosition) signEntity.getBlockPos());
}

@Redirect(method={"render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/model/geom/ModelPart;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;II)V"))
private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn) {
private void redirectSignColor(ModelPart modelPart, PoseStack stack, VertexConsumer consumer, int combinedLight, int combinedOverlay) {
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
Expand All @@ -37,6 +37,6 @@ private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn,
blue = signColor.getBlue();
alpha = signColor.getAlpha();
}
modelRenderer.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
modelPart.render(stack, consumer, combinedLight, combinedOverlay, red, green, blue, alpha);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
public abstract class SignMixin {

@Inject(method = "render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V", at = @At("HEAD"))
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack stack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
SignSearchAddon.getSignManager().onRender((net.labymod.api.client.blockentity.SignBlockEntity) signEntity, (BlockPosition) signEntity.getBlockPos());
}

@Redirect(method={"render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/model/geom/ModelPart;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;II)V"))
private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn) {
private void redirectSignColor(ModelPart modelPart, PoseStack stack, VertexConsumer consumer, int combinedLight, int combinedOverlay) {
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
Expand All @@ -37,6 +37,6 @@ private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn,
blue = signColor.getBlue();
alpha = signColor.getAlpha();
}
modelRenderer.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
modelPart.render(stack, consumer, combinedLight, combinedOverlay, red, green, blue, alpha);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
public abstract class SignMixin {

@Inject(method = "render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V", at = @At("HEAD"))
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack stack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
SignSearchAddon.getSignManager().onRender((net.labymod.api.client.blockentity.SignBlockEntity) signEntity, (BlockPosition) signEntity.getBlockPos());
}

@Redirect(method={"renderSignModel"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/model/geom/ModelPart;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;II)V"))
private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn) {
private void redirectSignColor(ModelPart modelPart, PoseStack stack, VertexConsumer bufferIn, int combinedLight, int combinedOverlay) {
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
Expand All @@ -37,6 +37,6 @@ private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn,
blue = signColor.getBlue();
alpha = signColor.getAlpha();
}
modelRenderer.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
modelPart.render(stack, bufferIn, combinedLight, combinedOverlay, red, green, blue, alpha);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
public abstract class SignMixin {

@Inject(method = "render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V", at = @At("HEAD"))
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack stack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
SignSearchAddon.getSignManager().onRender((net.labymod.api.client.blockentity.SignBlockEntity) signEntity, (BlockPosition) signEntity.getBlockPos());
}

@Redirect(method={"renderSignModel"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/model/geom/ModelPart;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;II)V"))
private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn) {
private void redirectSignColor(ModelPart modelPart, PoseStack stack, VertexConsumer bufferIn, int combinedLight, int combinedOverlay) {
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
Expand All @@ -37,6 +37,6 @@ private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn,
blue = signColor.getBlue();
alpha = signColor.getAlpha();
}
modelRenderer.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
modelPart.render(stack, bufferIn, combinedLight, combinedOverlay, red, green, blue, alpha);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
public abstract class SignMixin {

@Inject(method = "render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V", at = @At("HEAD"))
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack stack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
SignSearchAddon.getSignManager().onRender((net.labymod.api.client.blockentity.SignBlockEntity) signEntity, (BlockPosition) signEntity.getBlockPos());
}

@Redirect(method={"renderSignModel"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/model/geom/ModelPart;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;II)V"))
private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn) {
private void redirectSignColor(ModelPart modelPart, PoseStack stack, VertexConsumer bufferIn, int combinedLight, int combinedOverlay) {
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
Expand All @@ -37,6 +37,6 @@ private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn,
blue = signColor.getBlue();
alpha = signColor.getAlpha();
}
modelRenderer.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
modelPart.render(stack, bufferIn, combinedLight, combinedOverlay, red, green, blue, alpha);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
public abstract class SignMixin {

@Inject(method = "render(Lnet/minecraft/world/level/block/entity/SignBlockEntity;FLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)V", at = @At("HEAD"))
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
private void injectSignManager(SignBlockEntity signEntity, float partialTicket, PoseStack stack, MultiBufferSource buffer, int combinedLight, int combiedOverlay, CallbackInfo ci) {
SignSearchAddon.getSignManager().onRender((net.labymod.api.client.blockentity.SignBlockEntity) signEntity, (BlockPosition) signEntity.getBlockPos());
}

@Redirect(method={"renderSignModel"}, at=@At(value="INVOKE", target="Lnet/minecraft/client/model/geom/ModelPart;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;II)V"))
private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn) {
private void redirectSignColor(ModelPart modelPart, PoseStack stack, VertexConsumer bufferIn, int combinedLight, int combinedOverlay) {
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
Expand All @@ -37,6 +37,6 @@ private void redirectSignColor(ModelPart modelRenderer, PoseStack matrixStackIn,
blue = signColor.getBlue();
alpha = signColor.getAlpha();
}
modelRenderer.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
modelPart.render(stack, bufferIn, combinedLight, combinedOverlay, red, green, blue, alpha);
}
}
Loading
Loading