From e09ac92b7343703b43b7910239d78d7e7596e08d Mon Sep 17 00:00:00 2001 From: PotatoPresident Date: Sun, 7 Mar 2021 14:39:58 -0800 Subject: [PATCH 01/15] Updated to 1.16 Removed cloth and auto config Removed right click to get name Created config gui and system Implemented #18 --- build.gradle | 28 ++- gradle.properties | 12 +- .../petowner/client/ModMenuIntegration.java | 22 +-- .../petowner/client/PetOwnerClient.java | 180 ++++++++++-------- .../petowner/client/PetOwnerConfig.java | 17 -- .../petowner/client/config/ConfigGUI.java | 51 +++++ .../config/KeybindModeButtonWidget.java | 43 +++++ .../client/config/PetOwnerConfig.java | 51 +++++ .../petowner/mixin/FoxTrustedAccessor.java | 3 +- .../petowner/mixin/OwnerNameTagRendering.java | 82 ++++---- .../resources/assets/petowner/lang/en_us.json | 20 +- .../resources/assets/petowner/lang/es_ar.json | 2 - .../resources/assets/petowner/lang/es_cl.json | 2 - .../resources/assets/petowner/lang/es_ec.json | 2 - .../resources/assets/petowner/lang/es_es.json | 2 - .../resources/assets/petowner/lang/es_mx.json | 2 - .../resources/assets/petowner/lang/es_uy.json | 2 - .../resources/assets/petowner/lang/es_ve.json | 2 - .../resources/assets/petowner/lang/fi_fi.json | 4 + .../resources/assets/petowner/lang/ja_jp.json | 2 - .../resources/assets/petowner/lang/tr_tr.json | 6 - .../resources/assets/petowner/lang/zh_cn.json | 2 - .../resources/assets/petowner/lang/zh_tw.json | 2 - src/main/resources/fabric.mod.json | 12 +- src/main/resources/petowner.mixins.json | 2 - 25 files changed, 334 insertions(+), 219 deletions(-) delete mode 100644 src/main/java/us/potatoboy/petowner/client/PetOwnerConfig.java create mode 100644 src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java create mode 100644 src/main/java/us/potatoboy/petowner/client/config/KeybindModeButtonWidget.java create mode 100644 src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java create mode 100644 src/main/resources/assets/petowner/lang/fi_fi.json diff --git a/build.gradle b/build.gradle index b97534c..92df043 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ version = project.mod_version + "-" + project.minecraft_version + "+" group = project.maven_group repositories { - jcenter() + maven { url "https://maven.terraformersmc.com/"} } dependencies { @@ -21,27 +21,21 @@ dependencies { mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + // Fabric API + Set apiModules = [ + "fabric-api-base", + "fabric-key-binding-api-v1", + "fabric-lifecycle-events-v1" + ] - // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. - // You may need to force-disable transitiveness on them. - - modApi "me.shedaniel.cloth:config-2:4.7.0-unstable", { - exclude group: "net.fabricmc.fabric-api" + apiModules.forEach { + modImplementation(fabricApi.module(it, project.fabric_version)) } - include "me.shedaniel.cloth:config-2:4.7.0-unstable" - modApi "me.sargunvohra.mcmods:autoconfig1u:3.2.0-unstable", { - exclude group: "net.fabricmc.fabric-api" - } - include "me.sargunvohra.mcmods:autoconfig1u:3.2.0-unstable" - modImplementation "io.github.prospector:modmenu:1.14.6+build.31", { - exclude group: "net.fabricmc.fabric-api" + modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}", { + exclude module: "fabric-api" } - - modRuntime "curse.maven:auth-me:3055415" } processResources { diff --git a/gradle.properties b/gradle.properties index be10ace..d0b17e7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,14 +2,14 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://modmuss50.me/fabric.html -minecraft_version=1.16.2 -yarn_mappings=1.16.2+build.19 -loader_version=0.9.1+build.205 +minecraft_version=1.16.5 +yarn_mappings=1.16.5+build.5 +loader_version=0.11.2 # Mod Properties -mod_version=1.7.1 +mod_version=2.0.0 maven_group=us.potatoboy archives_base_name=PetOwner # Dependencies # check this on https://modmuss50.me/fabric.html -fabric_version=0.18.0+build.397-1.16 -cloth_api_version=config-2:4.5.6 \ No newline at end of file +fabric_version=0.31.0+1.16 +modmenu_version=1.16.8 \ No newline at end of file diff --git a/src/main/java/us/potatoboy/petowner/client/ModMenuIntegration.java b/src/main/java/us/potatoboy/petowner/client/ModMenuIntegration.java index 0a56a99..b267284 100644 --- a/src/main/java/us/potatoboy/petowner/client/ModMenuIntegration.java +++ b/src/main/java/us/potatoboy/petowner/client/ModMenuIntegration.java @@ -1,20 +1,12 @@ package us.potatoboy.petowner.client; -import io.github.prospector.modmenu.api.ConfigScreenFactory; -import io.github.prospector.modmenu.api.ModMenuApi; -import me.sargunvohra.mcmods.autoconfig1u.AutoConfig; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import us.potatoboy.petowner.client.config.ConfigGUI; -@Environment(EnvType.CLIENT) public class ModMenuIntegration implements ModMenuApi { - @Override - public String getModId() { - return "petowner"; - } - - @Override - public ConfigScreenFactory getModConfigScreenFactory() { - return parent -> AutoConfig.getConfigScreen(PetOwnerConfig.class, parent).get(); - } + @Override + public ConfigScreenFactory getModConfigScreenFactory() { + return ConfigGUI::new; + } } diff --git a/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java b/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java index bcbdbd7..a8a2dea 100644 --- a/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java +++ b/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java @@ -4,101 +4,115 @@ import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.mojang.authlib.GameProfile; -import me.sargunvohra.mcmods.autoconfig1u.AutoConfig; -import me.sargunvohra.mcmods.autoconfig1u.serializer.JanksonConfigSerializer; import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.event.player.UseEntityCallback; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.options.KeyBinding; +import net.minecraft.client.util.InputUtil; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.FoxEntity; import net.minecraft.entity.passive.HorseBaseEntity; import net.minecraft.entity.passive.TameableEntity; import net.minecraft.text.TranslatableText; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import us.potatoboy.petowner.client.config.PetOwnerConfig; import us.potatoboy.petowner.mixin.FoxTrustedAccessor; +import java.io.File; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; -@Environment(EnvType.CLIENT) public class PetOwnerClient implements ClientModInitializer { - private static final LoadingCache> usernameCache = CacheBuilder - .newBuilder() - .expireAfterWrite(6, TimeUnit.HOURS) - .build(new CacheLoader>() { - @Override - public Optional load(UUID key) throws Exception { - CompletableFuture.runAsync(() -> { - GameProfile playerProfile = new GameProfile(key, null); - playerProfile = MinecraftClient.getInstance().getSessionService().fillProfileProperties(playerProfile, false); - usernameCache.put(key, Optional.ofNullable(playerProfile.getName())); - }); - - return Optional.of("Waiting..."); - } - }); - - @Override - public void onInitializeClient() { - AutoConfig.register(PetOwnerConfig.class, JanksonConfigSerializer::new); - PetOwnerConfig config = AutoConfig.getConfigHolder(PetOwnerConfig.class).getConfig(); - - UseEntityCallback.EVENT.register(((playerEntity, world, hand, entity, entityHitResult) -> { - if (!config.click) return ActionResult.PASS; - - if (!hand.equals(Hand.MAIN_HAND)) return ActionResult.PASS; - if (config.requireEmptyHand) { - if (!playerEntity.getMainHandStack().isEmpty()) return ActionResult.PASS; - } - - for (UUID ownerId : getOwnerIds(entity)) - { - if (ownerId == null) continue; - if (playerEntity.getUuid().equals(ownerId)) continue; - - Optional username = PetOwnerClient.getNameFromId(ownerId); - - if (username.isPresent()) { - playerEntity.sendMessage(new TranslatableText("text.petowner.message.owner", username.get()), false); - } else { - playerEntity.sendMessage(new TranslatableText("text.petowner.message.error"), false); - } - } - - return ActionResult.PASS; - })); - } - - public static Optional getNameFromId(UUID uuid) { - return usernameCache.getUnchecked(uuid); - } - - public static List getOwnerIds(Entity entity) { - if (entity instanceof TameableEntity) { - TameableEntity tameableEntity = (TameableEntity) entity; - - if (tameableEntity.isTamed()) { - return Collections.singletonList(tameableEntity.getOwnerUuid()); - } - } - - if (entity instanceof HorseBaseEntity) { - HorseBaseEntity horseBaseEntity = (HorseBaseEntity) entity; - - if (horseBaseEntity.isTame()) { - return Collections.singletonList(horseBaseEntity.getOwnerUuid()); - } - } - - if (entity instanceof FoxEntity) { - FoxEntity foxEntity = (FoxEntity) entity; - return ((FoxTrustedAccessor)foxEntity).getTrusedIds(); - } - - return new ArrayList<>(); - } + public static final Logger LOGGER = LogManager.getLogger("PetOwner"); + + public static boolean enabled = true; + public static KeyBinding keyBinding; + public static PetOwnerConfig config; + + private static final LoadingCache> usernameCache = CacheBuilder + .newBuilder() + .expireAfterWrite(6, TimeUnit.HOURS) + .build(new CacheLoader>() { + @Override + public Optional load(UUID key) { + CompletableFuture.runAsync(() -> { + GameProfile playerProfile = new GameProfile(key, null); + playerProfile = MinecraftClient.getInstance().getSessionService().fillProfileProperties(playerProfile, false); + usernameCache.put(key, Optional.ofNullable(playerProfile.getName())); + }); + + return Optional.of("Waiting..."); + } + }); + + @Override + public void onInitializeClient() { + config = PetOwnerConfig.loadConfig(new File(FabricLoader.getInstance().getConfigDir().toFile(), "petowner.json")); + + keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding( + "key.petowner.hide", + InputUtil.UNKNOWN_KEY.getCode(), + "category.petowner.title" + )); + + ClientTickEvents.END_CLIENT_TICK.register(minecraftClient -> { + if (keyBinding.isUnbound()) return; + + if (!config.keybindMode) { + //Hold mode + enabled = keyBinding.isPressed(); + + if (keyBinding.isPressed() || keyBinding.wasPressed()) { + if (minecraftClient.player != null) { + minecraftClient.player.sendMessage(new TranslatableText(enabled ? "text.petowner.message.enabled" : "text.petowner.message.disabled"), true); + } + } + } else { + //Toggle mode + while (keyBinding.wasPressed()) { + enabled = !enabled; + if (minecraftClient.player != null) { + minecraftClient.player.sendMessage(new TranslatableText(enabled ? "text.petowner.message.enabled" : "text.petowner.message.disabled"), true); + } + } + } + }); + } + + public static Optional getNameFromId(UUID uuid) { + return usernameCache.getUnchecked(uuid); + } + + public static List getOwnerIds(Entity entity) { + if (entity instanceof TameableEntity) { + TameableEntity tameableEntity = (TameableEntity) entity; + + if (tameableEntity.isTamed()) { + return Collections.singletonList(tameableEntity.getOwnerUuid()); + } + } + + if (entity instanceof HorseBaseEntity) { + HorseBaseEntity horseBaseEntity = (HorseBaseEntity) entity; + + if (horseBaseEntity.isTame()) { + return Collections.singletonList(horseBaseEntity.getOwnerUuid()); + } + } + + if (entity instanceof FoxEntity) { + FoxEntity foxEntity = (FoxEntity) entity; + return ((FoxTrustedAccessor) foxEntity).getTrusedIds(); + } + + return new ArrayList<>(); + } + + public static void saveConfig () { + config.saveConfig(new File(FabricLoader.getInstance().getConfigDir().toFile(), "petowner.json")); + } } diff --git a/src/main/java/us/potatoboy/petowner/client/PetOwnerConfig.java b/src/main/java/us/potatoboy/petowner/client/PetOwnerConfig.java deleted file mode 100644 index ba0cdc3..0000000 --- a/src/main/java/us/potatoboy/petowner/client/PetOwnerConfig.java +++ /dev/null @@ -1,17 +0,0 @@ -package us.potatoboy.petowner.client; - -import me.sargunvohra.mcmods.autoconfig1u.ConfigData; -import me.sargunvohra.mcmods.autoconfig1u.annotation.Config; -import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry; - -@Config(name = "petowner") -public class PetOwnerConfig implements ConfigData { - @ConfigEntry.Category("nametag") - public Boolean nametag = true; - - @ConfigEntry.Category("click") - public Boolean click = false; - - @ConfigEntry.Category("click") - public Boolean requireEmptyHand = true; -} diff --git a/src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java b/src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java new file mode 100644 index 0000000..d8ccabf --- /dev/null +++ b/src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java @@ -0,0 +1,51 @@ +package us.potatoboy.petowner.client.config; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.options.AttackIndicator; +import net.minecraft.client.options.CyclingOption; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.text.TranslatableText; + +public class ConfigGUI extends Screen { + private final Screen parent; + + private KeybindModeButtonWidget keybindModeButtonWidget; + + private ButtonWidget confirm; + + public ConfigGUI(Screen parent) { + super(new TranslatableText("text.petowner.config.title")); + + this.parent = parent; + } + + @Override + public void init(MinecraftClient client, int width, int height) { + super.init(client, width, height); + + keybindModeButtonWidget = addButton(new KeybindModeButtonWidget(10, 30, 175, 20)); + + confirm = addButton(new ButtonWidget(width - 220, height - 30, 100, 20, new TranslatableText("text.petowner.config.button.confirm"), (onPress) -> { + keybindModeButtonWidget.saveValue(); + client.openScreen(parent); + })); + } + + @Override + public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + renderBackground(matrices); + super.render(matrices, mouseX, mouseY, delta); + + drawStringWithShadow(matrices, textRenderer, new TranslatableText("text.petowner.config.title").getString(), 20, 10, 16777215); + if (keybindModeButtonWidget.isHovered()) { + renderTooltip(matrices, keybindModeButtonWidget.getTooltip(), mouseX, mouseY); + } + } + + @Override + public boolean isPauseScreen() { + return true; + } +} diff --git a/src/main/java/us/potatoboy/petowner/client/config/KeybindModeButtonWidget.java b/src/main/java/us/potatoboy/petowner/client/config/KeybindModeButtonWidget.java new file mode 100644 index 0000000..09f1088 --- /dev/null +++ b/src/main/java/us/potatoboy/petowner/client/config/KeybindModeButtonWidget.java @@ -0,0 +1,43 @@ +package us.potatoboy.petowner.client.config; + +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; +import us.potatoboy.petowner.client.PetOwnerClient; + +public class KeybindModeButtonWidget extends ButtonWidget { + private boolean value; + + public KeybindModeButtonWidget(int x, int y, int width, int height) { + super(x, y, width, height, new LiteralText(""), press -> {}); + + value = PetOwnerClient.config.keybindMode; + updateMessage(); + } + + @Override + public void onPress() { + value = !value; + updateMessage(); + } + + @Override + public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) { + super.renderButton(matrices, mouseX, mouseY, delta); + } + + private void updateMessage() { + setMessage(new TranslatableText("text.petowner.config.mode." + (value ? "toggle": "hold"))); + } + + public Text getTooltip() { + return new TranslatableText("text.petowner.config.mode.tooltip." + (value ? "toggle": "hold")); + } + + public void saveValue() { + PetOwnerClient.config.keybindMode = value; + PetOwnerClient.saveConfig(); + } +} diff --git a/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java b/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java new file mode 100644 index 0000000..e3c8e20 --- /dev/null +++ b/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java @@ -0,0 +1,51 @@ +package us.potatoboy.petowner.client.config; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import us.potatoboy.petowner.client.PetOwnerClient; + +import java.io.*; +import java.nio.charset.StandardCharsets; + +public class PetOwnerConfig { + private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); + + /** + * When true mode is toggle + * When false mode is hold + */ + public boolean keybindMode = true; + + public static PetOwnerConfig loadConfig(File file) { + PetOwnerConfig config; + + if (file.exists() && file.isFile()) { + try ( + FileInputStream fileInputStream = new FileInputStream(file); + InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader); + ) { + config = GSON.fromJson(bufferedReader, PetOwnerConfig.class); + } catch (IOException e) { + throw new RuntimeException("[HTM] Failed to load config", e); + } + } else { + config = new PetOwnerConfig(); + } + + config.saveConfig(file); + + return config; + } + + public void saveConfig(File config) { + try ( + FileOutputStream stream = new FileOutputStream(config); + Writer writer = new OutputStreamWriter(stream, StandardCharsets.UTF_8); + ) { + GSON.toJson(this, writer); + } catch (IOException e) { + PetOwnerClient.LOGGER.error("Failed to save config"); + } + } +} diff --git a/src/main/java/us/potatoboy/petowner/mixin/FoxTrustedAccessor.java b/src/main/java/us/potatoboy/petowner/mixin/FoxTrustedAccessor.java index bee37e9..e3ac60f 100644 --- a/src/main/java/us/potatoboy/petowner/mixin/FoxTrustedAccessor.java +++ b/src/main/java/us/potatoboy/petowner/mixin/FoxTrustedAccessor.java @@ -9,5 +9,6 @@ @Mixin(FoxEntity.class) public interface FoxTrustedAccessor { - @Invoker("getTrustedUuids") List getTrusedIds(); + @Invoker("getTrustedUuids") + List getTrusedIds(); } diff --git a/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java b/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java index 7e89e9a..ca80898 100644 --- a/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java +++ b/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java @@ -1,6 +1,5 @@ package us.potatoboy.petowner.mixin; -import me.sargunvohra.mcmods.autoconfig1u.AutoConfig; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.render.VertexConsumerProvider; @@ -18,7 +17,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import us.potatoboy.petowner.client.PetOwnerClient; -import us.potatoboy.petowner.client.PetOwnerConfig; import java.util.List; import java.util.Optional; @@ -26,54 +24,52 @@ @Mixin(EntityRenderer.class) public abstract class OwnerNameTagRendering { - @Final - @Shadow - protected EntityRenderDispatcher dispatcher; + @Final + @Shadow + protected EntityRenderDispatcher dispatcher; - @Inject(method = "render", at = @At("HEAD")) - private void render(Entity entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { - if (MinecraftClient.getInstance().options.hudHidden) return; + @Inject(method = "render", at = @At("HEAD")) + private void render(Entity entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { + //If HUD is hidden + if (MinecraftClient.getInstance().options.hudHidden) return; + //If the key is bound and owner is disabled + if (!PetOwnerClient.keyBinding.isUnbound() && !PetOwnerClient.enabled) return; + //If the entity is not targeted + if (dispatcher.targetedEntity != entity) return; - PetOwnerConfig config = AutoConfig.getConfigHolder(PetOwnerConfig.class).getConfig(); - if (!config.nametag) return; + List ownerIds = PetOwnerClient.getOwnerIds(entity); + if (ownerIds.isEmpty()) return; - if (dispatcher.targetedEntity != entity) return; + for (int i = 0; i < ownerIds.size(); i++) { + UUID ownerId = ownerIds.get(i); + if (ownerId == null) return; - List ownerIds = PetOwnerClient.getOwnerIds(entity); - if (ownerIds.isEmpty()) return; + Optional usernameString = PetOwnerClient.getNameFromId(ownerId); - int index = 0; - for (UUID ownerId : ownerIds) { - if (ownerId == null) return; + Text text = new TranslatableText("text.petowner.message.owner", usernameString.isPresent() ? + usernameString.get() : new TranslatableText("text.petowner.message.error")); - Text text; + double d = this.dispatcher.getSquaredDistanceToCamera(entity); + @SuppressWarnings("rawtypes") EntityRenderer entityRenderer = (EntityRenderer) (Object) this; + if (d <= 4096.0D) { + float height = entity.getHeight() + 0.5F; + int y = 10 + (10 * i); + matrices.push(); + matrices.translate(0.0D, height, 0.0D); + matrices.multiply(this.dispatcher.getRotation()); + matrices.scale(-0.025F, -0.025F, 0.025F); + Matrix4f matrix4f = matrices.peek().getModel(); + TextRenderer textRenderer = entityRenderer.getFontRenderer(); + float x = (float) (-textRenderer.getWidth(text) / 2); - Optional usernameString = PetOwnerClient.getNameFromId(ownerId); + float backgroundOpacity = MinecraftClient.getInstance().options.getTextBackgroundOpacity(0.25F); + int backgroundColor = (int) (backgroundOpacity * 255.0F) << 24; - if (usernameString.isPresent()) { - text = new TranslatableText("text.petowner.message.owner", usernameString.get()); - } else { - text = new TranslatableText("text.petowner.message.owner", new TranslatableText("text.petowner.message.error")); - } + textRenderer.draw(text, x, (float) y, 553648127, false, matrix4f, vertexConsumers, true, backgroundColor, light); + textRenderer.draw(text, x, (float) y, -1, false, matrix4f, vertexConsumers, false, 0, light); - double d = this.dispatcher.getSquaredDistanceToCamera(entity); - @SuppressWarnings("rawtypes") EntityRenderer entityRenderer = (EntityRenderer)(Object)this; - if (d <= 4096.0D) { - float f = entity.getHeight() + 0.5F; - int i = 10 + (10 * index); - matrices.push(); - matrices.translate(0.0D, f, 0.0D); - matrices.multiply(this.dispatcher.getRotation()); - matrices.scale(-0.025F, -0.025F, 0.025F); - Matrix4f matrix4f = matrices.peek().getModel(); - TextRenderer textRenderer = entityRenderer.getFontRenderer(); - float h = (float)(-textRenderer.getWidth(text) / 2); - - textRenderer.draw(text, h, (float)i, -1, false, matrix4f, vertexConsumers, false, 0, light); - - matrices.pop(); - index++; - } - } - } + matrices.pop(); + } + } + } } diff --git a/src/main/resources/assets/petowner/lang/en_us.json b/src/main/resources/assets/petowner/lang/en_us.json index ccc36d0..e565515 100644 --- a/src/main/resources/assets/petowner/lang/en_us.json +++ b/src/main/resources/assets/petowner/lang/en_us.json @@ -1,10 +1,16 @@ { - "text.autoconfig.petowner.title": "Pet Owner Config", - "text.autoconfig.petowner.category.nametag": "Nametag", - "text.autoconfig.petowner.option.nametag": "Show Owner On Pet Nametag", - "text.autoconfig.petowner.category.click": "Click", - "text.autoconfig.petowner.option.click": "Right Click On Pet To Show Owner", - "text.autoconfig.petowner.option.requireEmptyHand": "Require Empty Hand", + "text.petowner.config.title": "Pet Owner Config", + "text.petowner.config.button.confirm": "Confirm", + "text.petowner.config.mode.hold": "Hold", + "text.petowner.config.mode.tooltip.hold": "Only show owner when holding keybind", + "text.petowner.config.mode.toggle": "Toggle", + "text.petowner.config.mode.tooltip.toggle": "Toggle showing the owner when pressing keybind", + "text.petowner.message.owner": "§3Owner: %s", - "text.petowner.message.error": "§4Something went wrong" + "text.petowner.message.error": "§4Something went wrong", + "text.petowner.message.enabled": "§a§lShowing §rPet Names", + "text.petowner.message.disabled": "§c§lHiding §rPet Names", + + "category.petowner.title": "Pet Owner", + "key.petowner.hide": "Hide Owner" } \ No newline at end of file diff --git a/src/main/resources/assets/petowner/lang/es_ar.json b/src/main/resources/assets/petowner/lang/es_ar.json index 2e82948..743e25d 100644 --- a/src/main/resources/assets/petowner/lang/es_ar.json +++ b/src/main/resources/assets/petowner/lang/es_ar.json @@ -1,6 +1,4 @@ { - "text.autoconfig.petowner.title": "Configuración de Pet Owner", - "text.autoconfig.petowner.option.requireEmptyHand": "Se requiere una mano vacía.", "text.petowner.message.owner": "§3Pertenece a: %s", "text.petowner.message.error": "§4Algo salio mal" } \ No newline at end of file diff --git a/src/main/resources/assets/petowner/lang/es_cl.json b/src/main/resources/assets/petowner/lang/es_cl.json index 2e82948..743e25d 100644 --- a/src/main/resources/assets/petowner/lang/es_cl.json +++ b/src/main/resources/assets/petowner/lang/es_cl.json @@ -1,6 +1,4 @@ { - "text.autoconfig.petowner.title": "Configuración de Pet Owner", - "text.autoconfig.petowner.option.requireEmptyHand": "Se requiere una mano vacía.", "text.petowner.message.owner": "§3Pertenece a: %s", "text.petowner.message.error": "§4Algo salio mal" } \ No newline at end of file diff --git a/src/main/resources/assets/petowner/lang/es_ec.json b/src/main/resources/assets/petowner/lang/es_ec.json index 2e82948..743e25d 100644 --- a/src/main/resources/assets/petowner/lang/es_ec.json +++ b/src/main/resources/assets/petowner/lang/es_ec.json @@ -1,6 +1,4 @@ { - "text.autoconfig.petowner.title": "Configuración de Pet Owner", - "text.autoconfig.petowner.option.requireEmptyHand": "Se requiere una mano vacía.", "text.petowner.message.owner": "§3Pertenece a: %s", "text.petowner.message.error": "§4Algo salio mal" } \ No newline at end of file diff --git a/src/main/resources/assets/petowner/lang/es_es.json b/src/main/resources/assets/petowner/lang/es_es.json index 2e82948..743e25d 100644 --- a/src/main/resources/assets/petowner/lang/es_es.json +++ b/src/main/resources/assets/petowner/lang/es_es.json @@ -1,6 +1,4 @@ { - "text.autoconfig.petowner.title": "Configuración de Pet Owner", - "text.autoconfig.petowner.option.requireEmptyHand": "Se requiere una mano vacía.", "text.petowner.message.owner": "§3Pertenece a: %s", "text.petowner.message.error": "§4Algo salio mal" } \ No newline at end of file diff --git a/src/main/resources/assets/petowner/lang/es_mx.json b/src/main/resources/assets/petowner/lang/es_mx.json index 2e82948..743e25d 100644 --- a/src/main/resources/assets/petowner/lang/es_mx.json +++ b/src/main/resources/assets/petowner/lang/es_mx.json @@ -1,6 +1,4 @@ { - "text.autoconfig.petowner.title": "Configuración de Pet Owner", - "text.autoconfig.petowner.option.requireEmptyHand": "Se requiere una mano vacía.", "text.petowner.message.owner": "§3Pertenece a: %s", "text.petowner.message.error": "§4Algo salio mal" } \ No newline at end of file diff --git a/src/main/resources/assets/petowner/lang/es_uy.json b/src/main/resources/assets/petowner/lang/es_uy.json index 2e82948..743e25d 100644 --- a/src/main/resources/assets/petowner/lang/es_uy.json +++ b/src/main/resources/assets/petowner/lang/es_uy.json @@ -1,6 +1,4 @@ { - "text.autoconfig.petowner.title": "Configuración de Pet Owner", - "text.autoconfig.petowner.option.requireEmptyHand": "Se requiere una mano vacía.", "text.petowner.message.owner": "§3Pertenece a: %s", "text.petowner.message.error": "§4Algo salio mal" } \ No newline at end of file diff --git a/src/main/resources/assets/petowner/lang/es_ve.json b/src/main/resources/assets/petowner/lang/es_ve.json index 2e82948..743e25d 100644 --- a/src/main/resources/assets/petowner/lang/es_ve.json +++ b/src/main/resources/assets/petowner/lang/es_ve.json @@ -1,6 +1,4 @@ { - "text.autoconfig.petowner.title": "Configuración de Pet Owner", - "text.autoconfig.petowner.option.requireEmptyHand": "Se requiere una mano vacía.", "text.petowner.message.owner": "§3Pertenece a: %s", "text.petowner.message.error": "§4Algo salio mal" } \ No newline at end of file diff --git a/src/main/resources/assets/petowner/lang/fi_fi.json b/src/main/resources/assets/petowner/lang/fi_fi.json new file mode 100644 index 0000000..ad3e3a8 --- /dev/null +++ b/src/main/resources/assets/petowner/lang/fi_fi.json @@ -0,0 +1,4 @@ +{ + "text.petowner.message.owner": "§3Omistaja: %s", + "text.petowner.message.error": "§4jokin meni pieleen" +} \ No newline at end of file diff --git a/src/main/resources/assets/petowner/lang/ja_jp.json b/src/main/resources/assets/petowner/lang/ja_jp.json index 3e4cede..6767a45 100644 --- a/src/main/resources/assets/petowner/lang/ja_jp.json +++ b/src/main/resources/assets/petowner/lang/ja_jp.json @@ -1,6 +1,4 @@ { - "text.autoconfig.petowner.title": "ペットの飼い主の設定", - "text.autoconfig.petowner.option.requireEmptyHand": "手ぶらが必要", "text.petowner.message.owner": "§3飼い主: %s", "text.petowner.message.error": "§4エラーが発生しました" } diff --git a/src/main/resources/assets/petowner/lang/tr_tr.json b/src/main/resources/assets/petowner/lang/tr_tr.json index 08d7976..c39febb 100644 --- a/src/main/resources/assets/petowner/lang/tr_tr.json +++ b/src/main/resources/assets/petowner/lang/tr_tr.json @@ -1,10 +1,4 @@ { - "text.autoconfig.petowner.title": "Pet Owner (Evcil Hayvan Sahibi) Ayarları", - "text.autoconfig.petowner.category.nametag": "İsim Etiketi", - "text.autoconfig.petowner.option.nametag": "Sahibini Hayvanın İsim Etiketinde Göster", - "text.autoconfig.petowner.category.click": "Tıklama", - "text.autoconfig.petowner.option.click": "Sahibini Göstermek için Hayvana Sağ Tıkla", - "text.autoconfig.petowner.option.requireEmptyHand": "Eli Boş Olmalı", "text.petowner.message.owner": "§3Sahibi: %s", "text.petowner.message.error": "§4Bir şey yanlış gitti" } diff --git a/src/main/resources/assets/petowner/lang/zh_cn.json b/src/main/resources/assets/petowner/lang/zh_cn.json index 9c9680d..ee16f9f 100644 --- a/src/main/resources/assets/petowner/lang/zh_cn.json +++ b/src/main/resources/assets/petowner/lang/zh_cn.json @@ -1,6 +1,4 @@ { - "text.autoconfig.petowner.title": "宠物归属配置 §7(Pet Owner)", - "text.autoconfig.petowner.option.requireEmptyHand": "需要空手", "text.petowner.message.owner": "§3该宠物归属于: %s", "text.petowner.message.error": "§4出现了一点小问题" } diff --git a/src/main/resources/assets/petowner/lang/zh_tw.json b/src/main/resources/assets/petowner/lang/zh_tw.json index 52478b1..c3d976c 100644 --- a/src/main/resources/assets/petowner/lang/zh_tw.json +++ b/src/main/resources/assets/petowner/lang/zh_tw.json @@ -1,6 +1,4 @@ { - "text.autoconfig.petowner.title": "寵物歸屬配置 §7(Pet Owner)", - "text.autoconfig.petowner.option.requireEmptyHand": "需要空手", "text.petowner.message.owner": "§3該寵物歸屬於: %s", "text.petowner.message.error": "§4出現了一點小問題" } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9cff217..4b15225 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -12,6 +12,13 @@ "sources": "https://github.com/PotatoPresident/PetOwner/tree/master", "issues": "https://github.com/PotatoPresident/PetOwner/issues" }, + "custom": { + "modmenu": { + "links": { + "modmenu.discord": "https://discord.gg/ByaVuebAPb" + } + } + }, "license": "MIT", "icon": "logo.png", "environment": "client", @@ -24,9 +31,10 @@ ] }, "depends": { + "fabric-key-binding-api-v1": "*", + "fabric-lifecycle-events-v1": "*", "fabricloader": ">=0.7.2", - "fabric": "*", - "minecraft":"^1.16.2" + "minecraft":">=1.16.5" }, "mixins": [ "petowner.mixins.json" diff --git a/src/main/resources/petowner.mixins.json b/src/main/resources/petowner.mixins.json index 3c62ef4..41090e3 100644 --- a/src/main/resources/petowner.mixins.json +++ b/src/main/resources/petowner.mixins.json @@ -3,12 +3,10 @@ "minVersion": "0.8", "package": "us.potatoboy.petowner.mixin", "compatibilityLevel": "JAVA_8", - "mixins": [], "client": [ "FoxTrustedAccessor", "OwnerNameTagRendering" ], - "server": [], "injectors": { "defaultRequire": 1 } From 3e96df01e2e9a18a2d5f3f4caf932c15be2cd104 Mon Sep 17 00:00:00 2001 From: Niketats <68917520+Niketats@users.noreply.github.com> Date: Mon, 8 Feb 2021 17:04:18 +0300 Subject: [PATCH 02/15] Create ru_ru.json Just Russian translation (cherry picked from commit 9d51178757169831e82d0ca5f996d1147b2fa665) --- src/main/resources/assets/petowner/lang/ru_ru.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/main/resources/assets/petowner/lang/ru_ru.json diff --git a/src/main/resources/assets/petowner/lang/ru_ru.json b/src/main/resources/assets/petowner/lang/ru_ru.json new file mode 100644 index 0000000..496fd2a --- /dev/null +++ b/src/main/resources/assets/petowner/lang/ru_ru.json @@ -0,0 +1,10 @@ +{ + "text.autoconfig.petowner.title": "Конфигурация Pet Owner", + "text.autoconfig.petowner.category.nametag": "Именная метка", + "text.autoconfig.petowner.option.nametag": "Показывать имя владельца на именной метке питомца", + "text.autoconfig.petowner.category.click": "Нажми", + "text.autoconfig.petowner.option.click": "ПКМ По питомцу чтобы увидеть имя владельца", + "text.autoconfig.petowner.option.requireEmptyHand": "Требовать пустую руку", + "text.petowner.message.owner": "§3Владелец: %s", + "text.petowner.message.error": "§4Что-то пошло не так" +} From 20bc8b023cddc8a36f8a2710b343969bcefcf424 Mon Sep 17 00:00:00 2001 From: Ege Date: Mon, 8 Mar 2021 02:11:34 +0300 Subject: [PATCH 03/15] Update tr_tr.json - Added new Turkish translation strings from refactor --- src/main/resources/assets/petowner/lang/tr_tr.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/resources/assets/petowner/lang/tr_tr.json b/src/main/resources/assets/petowner/lang/tr_tr.json index c39febb..828a59f 100644 --- a/src/main/resources/assets/petowner/lang/tr_tr.json +++ b/src/main/resources/assets/petowner/lang/tr_tr.json @@ -1,4 +1,16 @@ { + "text.petowner.config.title": "Pet Owner (Evcil Hayvan Sahibi) Ayarları", + "text.petowner.config.button.confirm": "Onayla", + "text.petowner.config.mode.hold": "Basılı Tut", + "text.petowner.config.mode.tooltip.hold": "Atanan tuşa yalnızca basılı tuttuğunda sahibi göster", + "text.petowner.config.mode.toggle": "Aç/Kapa", + "text.petowner.config.mode.tooltip.toggle": "Atanan tuşa basınca sahibi göster/gizle", + "text.petowner.message.owner": "§3Sahibi: %s", - "text.petowner.message.error": "§4Bir şey yanlış gitti" + "text.petowner.message.error": "§4Bir şey yanlış gitti", + "text.petowner.message.enabled": "§a§lGösteriliyor: §rEvcil Hayvan İsimleri", + "text.petowner.message.disabled": "§c§lGizleniyor: §rEvcil Hayvan İsimleri", + + "category.petowner.title": "Pet Owner (Evcil Hayvan Sahibi)", + "key.petowner.hide": "Sahibi Gizle" } From 05be88a0fcc59ef5a1b345167baa91ba544649fd Mon Sep 17 00:00:00 2001 From: Samekichi Date: Mon, 8 Mar 2021 16:33:29 +0800 Subject: [PATCH 04/15] Update zh_cn.json --- .../resources/assets/petowner/lang/zh_cn.json | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/petowner/lang/zh_cn.json b/src/main/resources/assets/petowner/lang/zh_cn.json index ee16f9f..64309dc 100644 --- a/src/main/resources/assets/petowner/lang/zh_cn.json +++ b/src/main/resources/assets/petowner/lang/zh_cn.json @@ -1,4 +1,16 @@ { - "text.petowner.message.owner": "§3该宠物归属于: %s", - "text.petowner.message.error": "§4出现了一点小问题" + "text.petowner.config.title": "宠物拥有者配置 (Pet Owner)", + "text.petowner.config.button.confirm": "确定", + "text.petowner.config.mode.hold": "保持", + "text.petowner.config.mode.tooltip.hold": "仅在按下快捷键时显示拥有者", + "text.petowner.config.mode.toggle": "切换", + "text.petowner.config.mode.tooltip.toggle": "按下快捷键时切换是否显示拥有者", + + "text.petowner.message.owner": "§3拥有者: %s", + "text.petowner.message.error": "§4出现了一些问题", + "text.petowner.message.enabled": "已§a§l显示§r宠物名字", + "text.petowner.message.disabled": "已§c§l隐藏§r宠物名字", + + "category.petowner.title": "宠物拥有者", + "key.petowner.hide": "隐藏宠物拥有者" } From 8f2e8d05298c6eccf17a0f0a3ee0154f3bcc6f1a Mon Sep 17 00:00:00 2001 From: PotatoPresident Date: Fri, 12 Mar 2021 09:05:39 -0800 Subject: [PATCH 05/15] Updated loom Other cleanup --- build.gradle | 4 +--- .../java/us/potatoboy/petowner/client/PetOwnerClient.java | 2 +- .../java/us/potatoboy/petowner/client/config/ConfigGUI.java | 6 +----- .../us/potatoboy/petowner/client/config/PetOwnerConfig.java | 4 ++-- .../us/potatoboy/petowner/mixin/FoxTrustedAccessor.java | 2 +- src/main/resources/assets/petowner/lang/en_us.json | 4 ++-- 6 files changed, 8 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 92df043..1998344 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,6 @@ plugins { - id 'fabric-loom' version '0.5-SNAPSHOT' + id 'fabric-loom' version '0.6-SNAPSHOT' id 'maven-publish' - id ("com.wynprice.cursemaven") version "2.1.5" } sourceCompatibility = JavaVersion.VERSION_1_8 @@ -23,7 +22,6 @@ dependencies { // Fabric API Set apiModules = [ - "fabric-api-base", "fabric-key-binding-api-v1", "fabric-lifecycle-events-v1" ] diff --git a/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java b/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java index a8a2dea..7352a6f 100644 --- a/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java +++ b/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java @@ -106,7 +106,7 @@ public static List getOwnerIds(Entity entity) { if (entity instanceof FoxEntity) { FoxEntity foxEntity = (FoxEntity) entity; - return ((FoxTrustedAccessor) foxEntity).getTrusedIds(); + return ((FoxTrustedAccessor) foxEntity).getTrustedIds(); } return new ArrayList<>(); diff --git a/src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java b/src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java index d8ccabf..adaf542 100644 --- a/src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java +++ b/src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java @@ -3,8 +3,6 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.options.AttackIndicator; -import net.minecraft.client.options.CyclingOption; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.TranslatableText; @@ -13,8 +11,6 @@ public class ConfigGUI extends Screen { private KeybindModeButtonWidget keybindModeButtonWidget; - private ButtonWidget confirm; - public ConfigGUI(Screen parent) { super(new TranslatableText("text.petowner.config.title")); @@ -27,7 +23,7 @@ public void init(MinecraftClient client, int width, int height) { keybindModeButtonWidget = addButton(new KeybindModeButtonWidget(10, 30, 175, 20)); - confirm = addButton(new ButtonWidget(width - 220, height - 30, 100, 20, new TranslatableText("text.petowner.config.button.confirm"), (onPress) -> { + addButton(new ButtonWidget(width - 220, height - 30, 100, 20, new TranslatableText("text.petowner.config.button.confirm"), (onPress) -> { keybindModeButtonWidget.saveValue(); client.openScreen(parent); })); diff --git a/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java b/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java index e3c8e20..a5a171a 100644 --- a/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java +++ b/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java @@ -23,7 +23,7 @@ public static PetOwnerConfig loadConfig(File file) { try ( FileInputStream fileInputStream = new FileInputStream(file); InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8); - BufferedReader bufferedReader = new BufferedReader(inputStreamReader); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader) ) { config = GSON.fromJson(bufferedReader, PetOwnerConfig.class); } catch (IOException e) { @@ -41,7 +41,7 @@ public static PetOwnerConfig loadConfig(File file) { public void saveConfig(File config) { try ( FileOutputStream stream = new FileOutputStream(config); - Writer writer = new OutputStreamWriter(stream, StandardCharsets.UTF_8); + Writer writer = new OutputStreamWriter(stream, StandardCharsets.UTF_8) ) { GSON.toJson(this, writer); } catch (IOException e) { diff --git a/src/main/java/us/potatoboy/petowner/mixin/FoxTrustedAccessor.java b/src/main/java/us/potatoboy/petowner/mixin/FoxTrustedAccessor.java index e3ac60f..58447b5 100644 --- a/src/main/java/us/potatoboy/petowner/mixin/FoxTrustedAccessor.java +++ b/src/main/java/us/potatoboy/petowner/mixin/FoxTrustedAccessor.java @@ -10,5 +10,5 @@ @Mixin(FoxEntity.class) public interface FoxTrustedAccessor { @Invoker("getTrustedUuids") - List getTrusedIds(); + List getTrustedIds(); } diff --git a/src/main/resources/assets/petowner/lang/en_us.json b/src/main/resources/assets/petowner/lang/en_us.json index e565515..aef5f71 100644 --- a/src/main/resources/assets/petowner/lang/en_us.json +++ b/src/main/resources/assets/petowner/lang/en_us.json @@ -2,9 +2,9 @@ "text.petowner.config.title": "Pet Owner Config", "text.petowner.config.button.confirm": "Confirm", "text.petowner.config.mode.hold": "Hold", - "text.petowner.config.mode.tooltip.hold": "Only show owner when holding keybind", + "text.petowner.config.mode.tooltip.hold": "Only show owner when holding keybinding", "text.petowner.config.mode.toggle": "Toggle", - "text.petowner.config.mode.tooltip.toggle": "Toggle showing the owner when pressing keybind", + "text.petowner.config.mode.tooltip.toggle": "Toggle showing the owner when pressing keybinding", "text.petowner.message.owner": "§3Owner: %s", "text.petowner.message.error": "§4Something went wrong", From fcafe7c17cc4f0807eaf352c0afde568a184255f Mon Sep 17 00:00:00 2001 From: PotatoPresident Date: Sun, 11 Apr 2021 21:02:43 -0700 Subject: [PATCH 06/15] Got rid of my poor config gui and switched to cloth config lite Added always show config option Added show keybind messages config option Changed version to 1.8.0 --- build.gradle | 3 ++ gradle.properties | 2 +- .../petowner/client/ModMenuIntegration.java | 12 ----- .../petowner/client/PetOwnerClient.java | 12 +++-- .../petowner/client/config/ConfigGUI.java | 47 ------------------- .../config/KeybindModeButtonWidget.java | 43 ----------------- .../client/config/ModMenuIntegration.java | 45 ++++++++++++++++++ .../client/config/PetOwnerConfig.java | 8 ++-- .../petowner/mixin/OwnerNameTagRendering.java | 2 +- .../resources/assets/petowner/lang/en_us.json | 8 ++-- .../resources/assets/petowner/lang/ru_ru.json | 6 --- src/main/resources/fabric.mod.json | 2 +- 12 files changed, 65 insertions(+), 125 deletions(-) delete mode 100644 src/main/java/us/potatoboy/petowner/client/ModMenuIntegration.java delete mode 100644 src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java delete mode 100644 src/main/java/us/potatoboy/petowner/client/config/KeybindModeButtonWidget.java create mode 100644 src/main/java/us/potatoboy/petowner/client/config/ModMenuIntegration.java diff --git a/build.gradle b/build.gradle index 1998344..2b5d361 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,7 @@ group = project.maven_group repositories { maven { url "https://maven.terraformersmc.com/"} + maven { url "https://maven.shedaniel.me/" } } dependencies { @@ -30,6 +31,8 @@ dependencies { modImplementation(fabricApi.module(it, project.fabric_version)) } + modApi "me.shedaniel.cloth:cloth-config-lite-fabric:1.0.+" + include "me.shedaniel.cloth:cloth-config-lite-fabric:1.0.+" modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}", { exclude module: "fabric-api" diff --git a/gradle.properties b/gradle.properties index d0b17e7..04d409b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.16.5 yarn_mappings=1.16.5+build.5 loader_version=0.11.2 # Mod Properties -mod_version=2.0.0 +mod_version=1.8.0 maven_group=us.potatoboy archives_base_name=PetOwner # Dependencies diff --git a/src/main/java/us/potatoboy/petowner/client/ModMenuIntegration.java b/src/main/java/us/potatoboy/petowner/client/ModMenuIntegration.java deleted file mode 100644 index b267284..0000000 --- a/src/main/java/us/potatoboy/petowner/client/ModMenuIntegration.java +++ /dev/null @@ -1,12 +0,0 @@ -package us.potatoboy.petowner.client; - -import com.terraformersmc.modmenu.api.ConfigScreenFactory; -import com.terraformersmc.modmenu.api.ModMenuApi; -import us.potatoboy.petowner.client.config.ConfigGUI; - -public class ModMenuIntegration implements ModMenuApi { - @Override - public ConfigScreenFactory getModConfigScreenFactory() { - return ConfigGUI::new; - } -} diff --git a/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java b/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java index 7352a6f..4b859e3 100644 --- a/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java +++ b/src/main/java/us/potatoboy/petowner/client/PetOwnerClient.java @@ -62,12 +62,11 @@ public void onInitializeClient() { ClientTickEvents.END_CLIENT_TICK.register(minecraftClient -> { if (keyBinding.isUnbound()) return; - if (!config.keybindMode) { - //Hold mode + if (config.keybindMode == KeybindMode.HOLD) { enabled = keyBinding.isPressed(); if (keyBinding.isPressed() || keyBinding.wasPressed()) { - if (minecraftClient.player != null) { + if (minecraftClient.player != null && config.showKeybindMessage) { minecraftClient.player.sendMessage(new TranslatableText(enabled ? "text.petowner.message.enabled" : "text.petowner.message.disabled"), true); } } @@ -75,7 +74,7 @@ public void onInitializeClient() { //Toggle mode while (keyBinding.wasPressed()) { enabled = !enabled; - if (minecraftClient.player != null) { + if (minecraftClient.player != null && config.showKeybindMessage) { minecraftClient.player.sendMessage(new TranslatableText(enabled ? "text.petowner.message.enabled" : "text.petowner.message.disabled"), true); } } @@ -115,4 +114,9 @@ public static List getOwnerIds(Entity entity) { public static void saveConfig () { config.saveConfig(new File(FabricLoader.getInstance().getConfigDir().toFile(), "petowner.json")); } + + public enum KeybindMode { + TOGGLE, + HOLD + } } diff --git a/src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java b/src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java deleted file mode 100644 index adaf542..0000000 --- a/src/main/java/us/potatoboy/petowner/client/config/ConfigGUI.java +++ /dev/null @@ -1,47 +0,0 @@ -package us.potatoboy.petowner.client.config; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.TranslatableText; - -public class ConfigGUI extends Screen { - private final Screen parent; - - private KeybindModeButtonWidget keybindModeButtonWidget; - - public ConfigGUI(Screen parent) { - super(new TranslatableText("text.petowner.config.title")); - - this.parent = parent; - } - - @Override - public void init(MinecraftClient client, int width, int height) { - super.init(client, width, height); - - keybindModeButtonWidget = addButton(new KeybindModeButtonWidget(10, 30, 175, 20)); - - addButton(new ButtonWidget(width - 220, height - 30, 100, 20, new TranslatableText("text.petowner.config.button.confirm"), (onPress) -> { - keybindModeButtonWidget.saveValue(); - client.openScreen(parent); - })); - } - - @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { - renderBackground(matrices); - super.render(matrices, mouseX, mouseY, delta); - - drawStringWithShadow(matrices, textRenderer, new TranslatableText("text.petowner.config.title").getString(), 20, 10, 16777215); - if (keybindModeButtonWidget.isHovered()) { - renderTooltip(matrices, keybindModeButtonWidget.getTooltip(), mouseX, mouseY); - } - } - - @Override - public boolean isPauseScreen() { - return true; - } -} diff --git a/src/main/java/us/potatoboy/petowner/client/config/KeybindModeButtonWidget.java b/src/main/java/us/potatoboy/petowner/client/config/KeybindModeButtonWidget.java deleted file mode 100644 index 09f1088..0000000 --- a/src/main/java/us/potatoboy/petowner/client/config/KeybindModeButtonWidget.java +++ /dev/null @@ -1,43 +0,0 @@ -package us.potatoboy.petowner.client.config; - -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.LiteralText; -import net.minecraft.text.Text; -import net.minecraft.text.TranslatableText; -import us.potatoboy.petowner.client.PetOwnerClient; - -public class KeybindModeButtonWidget extends ButtonWidget { - private boolean value; - - public KeybindModeButtonWidget(int x, int y, int width, int height) { - super(x, y, width, height, new LiteralText(""), press -> {}); - - value = PetOwnerClient.config.keybindMode; - updateMessage(); - } - - @Override - public void onPress() { - value = !value; - updateMessage(); - } - - @Override - public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) { - super.renderButton(matrices, mouseX, mouseY, delta); - } - - private void updateMessage() { - setMessage(new TranslatableText("text.petowner.config.mode." + (value ? "toggle": "hold"))); - } - - public Text getTooltip() { - return new TranslatableText("text.petowner.config.mode.tooltip." + (value ? "toggle": "hold")); - } - - public void saveValue() { - PetOwnerClient.config.keybindMode = value; - PetOwnerClient.saveConfig(); - } -} diff --git a/src/main/java/us/potatoboy/petowner/client/config/ModMenuIntegration.java b/src/main/java/us/potatoboy/petowner/client/config/ModMenuIntegration.java new file mode 100644 index 0000000..79f29ee --- /dev/null +++ b/src/main/java/us/potatoboy/petowner/client/config/ModMenuIntegration.java @@ -0,0 +1,45 @@ +package us.potatoboy.petowner.client.config; + +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import me.shedaniel.clothconfiglite.api.ConfigScreen; +import net.minecraft.text.TranslatableText; +import us.potatoboy.petowner.client.PetOwnerClient; + +public class ModMenuIntegration implements ModMenuApi { + @Override + public ConfigScreenFactory getModConfigScreenFactory() { + return parent -> { + ConfigScreen screen = ConfigScreen.create(new TranslatableText("text.petowner.config.title"), parent); + screen.add( + new TranslatableText("text.petowner.config.always_show"), + PetOwnerClient.config.alwaysShow, + () -> false, + o -> { + PetOwnerClient.config.alwaysShow = (boolean) o; + PetOwnerClient.saveConfig(); + } + ); + screen.add( + new TranslatableText("text.petowner.config.mode"), + PetOwnerClient.config.keybindMode, + () -> PetOwnerClient.KeybindMode.TOGGLE, + o -> { + PetOwnerClient.config.keybindMode = (PetOwnerClient.KeybindMode) o; + PetOwnerClient.saveConfig(); + } + ); + screen.add( + new TranslatableText("text.petowner.config.show_keybind_message"), + PetOwnerClient.config.showKeybindMessage, + () -> true, + o -> { + PetOwnerClient.config.showKeybindMessage = (boolean) o; + PetOwnerClient.saveConfig(); + } + ); + + return screen.get(); + }; + } +} diff --git a/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java b/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java index a5a171a..7339358 100644 --- a/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java +++ b/src/main/java/us/potatoboy/petowner/client/config/PetOwnerConfig.java @@ -10,11 +10,9 @@ public class PetOwnerConfig { private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); - /** - * When true mode is toggle - * When false mode is hold - */ - public boolean keybindMode = true; + public PetOwnerClient.KeybindMode keybindMode = PetOwnerClient.KeybindMode.TOGGLE; + public boolean alwaysShow = false; + public boolean showKeybindMessage = false; public static PetOwnerConfig loadConfig(File file) { PetOwnerConfig config; diff --git a/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java b/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java index ca80898..9828171 100644 --- a/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java +++ b/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java @@ -35,7 +35,7 @@ private void render(Entity entity, float yaw, float tickDelta, MatrixStack matri //If the key is bound and owner is disabled if (!PetOwnerClient.keyBinding.isUnbound() && !PetOwnerClient.enabled) return; //If the entity is not targeted - if (dispatcher.targetedEntity != entity) return; + if (dispatcher.targetedEntity != entity && !PetOwnerClient.config.alwaysShow) return; List ownerIds = PetOwnerClient.getOwnerIds(entity); if (ownerIds.isEmpty()) return; diff --git a/src/main/resources/assets/petowner/lang/en_us.json b/src/main/resources/assets/petowner/lang/en_us.json index aef5f71..27549bd 100644 --- a/src/main/resources/assets/petowner/lang/en_us.json +++ b/src/main/resources/assets/petowner/lang/en_us.json @@ -1,10 +1,8 @@ { "text.petowner.config.title": "Pet Owner Config", - "text.petowner.config.button.confirm": "Confirm", - "text.petowner.config.mode.hold": "Hold", - "text.petowner.config.mode.tooltip.hold": "Only show owner when holding keybinding", - "text.petowner.config.mode.toggle": "Toggle", - "text.petowner.config.mode.tooltip.toggle": "Toggle showing the owner when pressing keybinding", + "text.petowner.config.mode": "Keybind mode (Only when keybind set)", + "text.petowner.config.always_show": "Always show owner, even when not looking", + "text.petowner.config.show_keybind_message": "Show keybind messages", "text.petowner.message.owner": "§3Owner: %s", "text.petowner.message.error": "§4Something went wrong", diff --git a/src/main/resources/assets/petowner/lang/ru_ru.json b/src/main/resources/assets/petowner/lang/ru_ru.json index 496fd2a..2e3fb77 100644 --- a/src/main/resources/assets/petowner/lang/ru_ru.json +++ b/src/main/resources/assets/petowner/lang/ru_ru.json @@ -1,10 +1,4 @@ { - "text.autoconfig.petowner.title": "Конфигурация Pet Owner", - "text.autoconfig.petowner.category.nametag": "Именная метка", - "text.autoconfig.petowner.option.nametag": "Показывать имя владельца на именной метке питомца", - "text.autoconfig.petowner.category.click": "Нажми", - "text.autoconfig.petowner.option.click": "ПКМ По питомцу чтобы увидеть имя владельца", - "text.autoconfig.petowner.option.requireEmptyHand": "Требовать пустую руку", "text.petowner.message.owner": "§3Владелец: %s", "text.petowner.message.error": "§4Что-то пошло не так" } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 4b15225..c31f473 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -27,7 +27,7 @@ "us.potatoboy.petowner.client.PetOwnerClient" ], "modmenu": [ - "us.potatoboy.petowner.client.ModMenuIntegration" + "us.potatoboy.petowner.client.config.ModMenuIntegration" ] }, "depends": { From 4056d31b882b0563c54b51333456a94053adb31a Mon Sep 17 00:00:00 2001 From: PotatoPresident Date: Mon, 12 Apr 2021 10:30:00 -0700 Subject: [PATCH 07/15] Add github actions --- .github/workflows/build.yml | 41 +++++++++++++++++++++++++++++++++++++ build.gradle | 3 +-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..97bd5ff --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,41 @@ +# Automatically build the project and run any configured tests for every push +# and submitted pull request. This can help catch issues that only occur on +# certain platforms or Java versions, and provides a first line of defence +# against bad commits. + +name: build +on: [pull_request, push] + +jobs: + build: + strategy: + matrix: + # Use these Java versions + java: [ + 1.8, # Minimum supported by Minecraft + 11, # Current Java LTS + 15 # Latest version + ] + # and run on both Linux and Windows + os: [ubuntu-20.04, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: checkout repository + uses: actions/checkout@v2 + - name: validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: setup jdk ${{ matrix.java }} + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: chmod +x ./gradlew + - name: build + run: ./gradlew build + - name: capture build artifacts + if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS + uses: actions/upload-artifact@v2 + with: + name: Artifacts + path: build/libs/ \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2b5d361..624b5f3 100644 --- a/build.gradle +++ b/build.gradle @@ -31,8 +31,7 @@ dependencies { modImplementation(fabricApi.module(it, project.fabric_version)) } - modApi "me.shedaniel.cloth:cloth-config-lite-fabric:1.0.+" - include "me.shedaniel.cloth:cloth-config-lite-fabric:1.0.+" + modApi include("me.shedaniel.cloth:cloth-config-lite-fabric:1.0.+") modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}", { exclude module: "fabric-api" From 4ce51fbb594b946d589c3b8f3039a2d828611263 Mon Sep 17 00:00:00 2001 From: barraIhsan <57800056+barraIhsan@users.noreply.github.com> Date: Tue, 13 Apr 2021 13:09:33 +0700 Subject: [PATCH 08/15] Create id_id.json --- src/main/resources/assets/petowner/lang/id_id.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/main/resources/assets/petowner/lang/id_id.json diff --git a/src/main/resources/assets/petowner/lang/id_id.json b/src/main/resources/assets/petowner/lang/id_id.json new file mode 100644 index 0000000..e307b42 --- /dev/null +++ b/src/main/resources/assets/petowner/lang/id_id.json @@ -0,0 +1,14 @@ +{ + "text.petowner.config.title": "Pengaturan", + "text.petowner.config.mode": "Mode keybind (Hanya ketika keybind sudah di set)", + "text.petowner.config.always_show": "Selalu tampilkan pemilik, walaupun tidak melihat ke peliharaan", + "text.petowner.config.show_keybind_message": "Tampilkan pesan keybind", + + "text.petowner.message.owner": "§3Pemilik: %s", + "text.petowner.message.error": "§4Ada yang salah", + "text.petowner.message.enabled": "§a§lMenampilkan §rNama Peliharaan", + "text.petowner.message.disabled": "§c§lMenampilkan §rNama Peliharaan", + + "category.petowner.title": "Pemilik Peliharaan", + "key.petowner.hide": "Sembunyikan Pemilik" +} From 0ff6372c2936a09bb0fa1f4047512fea61bfbf3a Mon Sep 17 00:00:00 2001 From: Ege Date: Tue, 13 Apr 2021 13:08:03 +0300 Subject: [PATCH 09/15] Update tr_tr.json for major_refactor --- src/main/resources/assets/petowner/lang/tr_tr.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/resources/assets/petowner/lang/tr_tr.json b/src/main/resources/assets/petowner/lang/tr_tr.json index 828a59f..eff7232 100644 --- a/src/main/resources/assets/petowner/lang/tr_tr.json +++ b/src/main/resources/assets/petowner/lang/tr_tr.json @@ -1,10 +1,8 @@ { "text.petowner.config.title": "Pet Owner (Evcil Hayvan Sahibi) Ayarları", - "text.petowner.config.button.confirm": "Onayla", - "text.petowner.config.mode.hold": "Basılı Tut", - "text.petowner.config.mode.tooltip.hold": "Atanan tuşa yalnızca basılı tuttuğunda sahibi göster", - "text.petowner.config.mode.toggle": "Aç/Kapa", - "text.petowner.config.mode.tooltip.toggle": "Atanan tuşa basınca sahibi göster/gizle", + "text.petowner.config.mode": "Tuş atama modu (Yalnızca tuş tanımlıyken)", + "text.petowner.config.always_show": "Bakmazken bile sahibi her zaman göster", + "text.petowner.config.show_keybind_message": "Tuş atama mesajlarını göster", "text.petowner.message.owner": "§3Sahibi: %s", "text.petowner.message.error": "§4Bir şey yanlış gitti", From ab3c82c6c5f854d303e5783cf7255b1f7931dbb2 Mon Sep 17 00:00:00 2001 From: PotatoPresident Date: Tue, 13 Apr 2021 09:37:31 -0700 Subject: [PATCH 10/15] Include fabric-key-binding-api-v1 Include fabric-lifecycle-events-v1 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 624b5f3..2399c88 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ dependencies { ] apiModules.forEach { - modImplementation(fabricApi.module(it, project.fabric_version)) + modImplementation include(fabricApi.module(it, project.fabric_version)) } modApi include("me.shedaniel.cloth:cloth-config-lite-fabric:1.0.+") From a88c6e41432a4ebb70d9daee6588b21f4c192e12 Mon Sep 17 00:00:00 2001 From: Samekichi Date: Wed, 14 Apr 2021 01:49:55 +0800 Subject: [PATCH 11/15] Update zh_cn.json --- src/main/resources/assets/petowner/lang/zh_cn.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/resources/assets/petowner/lang/zh_cn.json b/src/main/resources/assets/petowner/lang/zh_cn.json index 9c9680d..d1b36b7 100644 --- a/src/main/resources/assets/petowner/lang/zh_cn.json +++ b/src/main/resources/assets/petowner/lang/zh_cn.json @@ -1,6 +1,10 @@ { "text.autoconfig.petowner.title": "宠物归属配置 §7(Pet Owner)", + "text.autoconfig.petowner.category.nametag": "名称标签", + "text.autoconfig.petowner.option.nametag": "在宠物的名称标签中显示拥有者", + "text.autoconfig.petowner.category.click": "单击", + "text.autoconfig.petowner.option.click": "右键单击宠物以显示其拥有者", "text.autoconfig.petowner.option.requireEmptyHand": "需要空手", - "text.petowner.message.owner": "§3该宠物归属于: %s", + "text.petowner.message.owner": "§3拥有者: %s", "text.petowner.message.error": "§4出现了一点小问题" } From 0424e34394f5fed0ef0601d28a4e78da46472a92 Mon Sep 17 00:00:00 2001 From: PotatoPresident Date: Tue, 13 Apr 2021 11:24:11 -0700 Subject: [PATCH 12/15] Don't show the name of an entity you are riding --- .../java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java b/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java index 9828171..362d113 100644 --- a/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java +++ b/src/main/java/us/potatoboy/petowner/mixin/OwnerNameTagRendering.java @@ -32,6 +32,8 @@ public abstract class OwnerNameTagRendering { private void render(Entity entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { //If HUD is hidden if (MinecraftClient.getInstance().options.hudHidden) return; + //If the player is riding the entity + if (entity.hasPassenger(MinecraftClient.getInstance().player)) return; //If the key is bound and owner is disabled if (!PetOwnerClient.keyBinding.isUnbound() && !PetOwnerClient.enabled) return; //If the entity is not targeted From 224e0f4950b062fabab4e0eb3f376d2eb2bf1fef Mon Sep 17 00:00:00 2001 From: Samekichi Date: Fri, 23 Apr 2021 09:16:55 +0800 Subject: [PATCH 13/15] Update zh_cn.json --- .../resources/assets/petowner/lang/zh_cn.json | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/resources/assets/petowner/lang/zh_cn.json b/src/main/resources/assets/petowner/lang/zh_cn.json index d1b36b7..7e34512 100644 --- a/src/main/resources/assets/petowner/lang/zh_cn.json +++ b/src/main/resources/assets/petowner/lang/zh_cn.json @@ -1,10 +1,14 @@ { - "text.autoconfig.petowner.title": "宠物归属配置 §7(Pet Owner)", - "text.autoconfig.petowner.category.nametag": "名称标签", - "text.autoconfig.petowner.option.nametag": "在宠物的名称标签中显示拥有者", - "text.autoconfig.petowner.category.click": "单击", - "text.autoconfig.petowner.option.click": "右键单击宠物以显示其拥有者", - "text.autoconfig.petowner.option.requireEmptyHand": "需要空手", + "text.petowner.config.title": "宠物拥有者配置 §7(Pet Owner)", + "text.petowner.config.mode": "按键模式 (仅在设置了快捷键后生效)", + "text.petowner.config.always_show": "宠物在视线外时仍显示其拥有者", + "text.petowner.config.show_keybind_message": "显示快捷键信息", + "text.petowner.message.owner": "§3拥有者: %s", - "text.petowner.message.error": "§4出现了一点小问题" + "text.petowner.message.error": "§4出现了一点小问题", + "text.petowner.message.enabled": "§a§l已显示 §r宠物名称", + "text.petowner.message.disabled": "§c§l已隐藏 §r宠物名称", + + "category.petowner.title": "宠物拥有者", + "key.petowner.hide": "隐藏宠物拥有者" } From 55320700e77a5ae19aba9bd759d1d148ebc307f5 Mon Sep 17 00:00:00 2001 From: Potatoboy99999 <51728317+PotatoPresident@users.noreply.github.com> Date: Fri, 23 Apr 2021 10:07:26 -0700 Subject: [PATCH 14/15] Delete ru_ru.json --- src/main/resources/assets/petowner/lang/ru_ru.json | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 src/main/resources/assets/petowner/lang/ru_ru.json diff --git a/src/main/resources/assets/petowner/lang/ru_ru.json b/src/main/resources/assets/petowner/lang/ru_ru.json deleted file mode 100644 index 496fd2a..0000000 --- a/src/main/resources/assets/petowner/lang/ru_ru.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "text.autoconfig.petowner.title": "Конфигурация Pet Owner", - "text.autoconfig.petowner.category.nametag": "Именная метка", - "text.autoconfig.petowner.option.nametag": "Показывать имя владельца на именной метке питомца", - "text.autoconfig.petowner.category.click": "Нажми", - "text.autoconfig.petowner.option.click": "ПКМ По питомцу чтобы увидеть имя владельца", - "text.autoconfig.petowner.option.requireEmptyHand": "Требовать пустую руку", - "text.petowner.message.owner": "§3Владелец: %s", - "text.petowner.message.error": "§4Что-то пошло не так" -} From 147a50dfbbd30068692af52b36c7a14b3efac455 Mon Sep 17 00:00:00 2001 From: PotatoPresident Date: Fri, 23 Apr 2021 10:54:00 -0700 Subject: [PATCH 15/15] Added fabric-api-base --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 2399c88..cf9d2a8 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,7 @@ dependencies { // Fabric API Set apiModules = [ + "fabric-api-base", "fabric-key-binding-api-v1", "fabric-lifecycle-events-v1" ]