From b985da155c76f95daceea2cfae8e642366913803 Mon Sep 17 00:00:00 2001 From: AterAnimAvis Date: Thu, 7 May 2020 17:15:34 +0100 Subject: [PATCH] Rename Mod Id to block_renderer + Remove Jenkinsfile --- Signed-off-by: AterAnimAvis --- Jenkinsfile | 5 --- build.gradle | 2 +- .../blockrenderer/BlockRenderer.java | 6 +-- .../unascribed/blockrenderer/Reference.java | 2 +- .../blockrenderer/init/Keybindings.java | 2 +- .../blockrenderer/render/BulkRenderer.java | 22 ++++++----- .../blockrenderer/render/IRenderer.java | 2 +- .../blockrenderer/screens/BaseScreen.java | 12 +++--- .../screens/EnterNamespaceScreen.java | 6 +-- .../screens/EnterSizeScreen.java | 2 +- .../blockrenderer/utils/MiscUtils.java | 2 +- .../blockrenderer/utils/StringUtils.java | 4 +- src/main/resources/META-INF/mods.toml | 2 +- .../assets/block_renderer/lang/en_us.json | 39 +++++++++++++++++++ .../assets/blockrenderer/lang/en_us.json | 39 ------------------- 15 files changed, 73 insertions(+), 74 deletions(-) delete mode 100644 Jenkinsfile create mode 100644 src/main/resources/assets/block_renderer/lang/en_us.json delete mode 100644 src/main/resources/assets/blockrenderer/lang/en_us.json diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 6c340a0..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,5 +0,0 @@ -node { - checkout scm - sh './gradlew setupCiWorkspace clean build' - archive 'build/libs/*jar' -} diff --git a/build.gradle b/build.gradle index f4fc92e..8770ca2 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ apply plugin: 'net.minecraftforge.gradle' group = "com.unascribed" archivesBaseName = "BlockRenderer" -version = "1.15.2-1.1.0" +version = "1.15.2-1.2.0" sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaVersion.VERSION_1_8 diff --git a/src/main/java/com/unascribed/blockrenderer/BlockRenderer.java b/src/main/java/com/unascribed/blockrenderer/BlockRenderer.java index a1b88ce..c479d12 100644 --- a/src/main/java/com/unascribed/blockrenderer/BlockRenderer.java +++ b/src/main/java/com/unascribed/blockrenderer/BlockRenderer.java @@ -91,19 +91,19 @@ public void onFrameStart(TickEvent.RenderTickEvent e) { renderStack(player.getHeldItemMainhand()); return; } - addMessage(new TranslationTextComponent("msg.blockrenderer.notContainer")); + addMessage(new TranslationTextComponent("msg.block_renderer.notContainer")); return; } if (hovered == null) { - addMessage(new TranslationTextComponent("msg.blockrenderer.slot.absent")); + addMessage(new TranslationTextComponent("msg.block_renderer.slot.absent")); return; } ItemStack stack = hovered.getStack(); if (stack.isEmpty()) { - addMessage(new TranslationTextComponent("msg.blockrenderer.slot.empty")); + addMessage(new TranslationTextComponent("msg.block_renderer.slot.empty")); return; } diff --git a/src/main/java/com/unascribed/blockrenderer/Reference.java b/src/main/java/com/unascribed/blockrenderer/Reference.java index 84afb52..61b6471 100644 --- a/src/main/java/com/unascribed/blockrenderer/Reference.java +++ b/src/main/java/com/unascribed/blockrenderer/Reference.java @@ -2,7 +2,7 @@ public interface Reference { - String MOD_ID = "blockrenderer"; + String MOD_ID = "block_renderer"; String NAME = "BlockRenderer"; String VERSION = "1.0.0"; diff --git a/src/main/java/com/unascribed/blockrenderer/init/Keybindings.java b/src/main/java/com/unascribed/blockrenderer/init/Keybindings.java index 79a5551..f449fe2 100644 --- a/src/main/java/com/unascribed/blockrenderer/init/Keybindings.java +++ b/src/main/java/com/unascribed/blockrenderer/init/Keybindings.java @@ -13,7 +13,7 @@ @Mod.EventBusSubscriber(modid = MOD_ID, bus = Bus.MOD) public interface Keybindings { - KeyBinding render = new KeyBinding("key.blockrenderer.render", GLFW.GLFW_KEY_GRAVE_ACCENT, "key.categories.blockrenderer"); + KeyBinding render = new KeyBinding("key.block_renderer.render", GLFW.GLFW_KEY_GRAVE_ACCENT, "key.categories.block_renderer"); @SubscribeEvent static void register(FMLClientSetupEvent event) { diff --git a/src/main/java/com/unascribed/blockrenderer/render/BulkRenderer.java b/src/main/java/com/unascribed/blockrenderer/render/BulkRenderer.java index a031877..02fef6e 100644 --- a/src/main/java/com/unascribed/blockrenderer/render/BulkRenderer.java +++ b/src/main/java/com/unascribed/blockrenderer/render/BulkRenderer.java @@ -26,7 +26,7 @@ public class BulkRenderer { public static void bulkRender(IRenderer renderer, String spec, List renders, int size, boolean useId, boolean addSize) { if (renders.size() < 1) { - addMessage(new TranslationTextComponent("msg.blockrenderer.bulk.noItems", spec)); + addMessage(new TranslationTextComponent("msg.block_renderer.bulk.noItems", spec)); return; } @@ -39,7 +39,7 @@ public static void bulkRender(IRenderer renderer, String spec, List re String sizeString = addSize ? size + "x" + size + "_" : ""; File folder = new File(DEFAULT_FOLDER, dateTime() + "_" + sizeString + sanitize(spec) + "/"); - String title = I18n.format("blockrenderer.gui.rendering", total, spec); + String title = I18n.format("block_renderer.gui.rendering", total, spec); long start = Util.milliTime(); @@ -63,7 +63,7 @@ public static void bulkRender(IRenderer renderer, String spec, List re if (Util.milliTime() - lastUpdate > 33) { renderer.teardown(); - renderLoading(renderer, title, I18n.format("blockrenderer.gui.progress", rendered, total, (total - rendered)), value, (float)rendered/ total); + renderLoading(renderer, title, I18n.format("block_renderer.gui.progress", rendered, total, (total - rendered)), value, (float)rendered/ total); lastUpdate = Util.milliTime(); renderer.setup(size); @@ -73,16 +73,20 @@ public static void bulkRender(IRenderer renderer, String spec, List re long elapsed = Util.milliTime() - start; if (rendered >= total) { - renderLoading(renderer, I18n.format("blockrenderer.gui.rendered", total, spec), "", null, 1f); - addMessage(new TranslationTextComponent("msg.blockrenderer.bulk.finished", total, spec, asClickable(folder))); + renderLoading(renderer, I18n.format("block_renderer.gui.rendered", total, spec), "", null, 1f); + addMessage(new TranslationTextComponent("msg.block_renderer.bulk.finished", total, spec, asClickable(folder))); } else { - renderLoading(renderer, I18n.format("blockrenderer.gui.renderCancelled"), I18n.format("blockrenderer.gui.progress", rendered, total, (total - rendered)), null, (float)rendered/ total); - addMessage(new TranslationTextComponent("msg.blockrenderer.bulk.cancelled", rendered, spec, asClickable(folder), total)); + renderLoading(renderer, I18n.format("block_renderer.gui.renderCancelled"), I18n.format("block_renderer.gui.progress", rendered, total, (total - rendered)), null, (float)rendered/ total); + addMessage(new TranslationTextComponent("msg.block_renderer.bulk.cancelled", rendered, spec, asClickable(folder), total)); } - if (errored > 0) addMessage(I18n.format("msg.blockrenderer.bulk.errored", errored)); + if (errored > 0) { + addMessage(""); + addMessage(new TranslationTextComponent("msg.block_renderer.bulk.errored", errored)); + } - addMessage(new TranslationTextComponent("msg.blockrenderer.bulk.time", elapsed / 1000f)); + addMessage(""); + addMessage(new TranslationTextComponent("msg.block_renderer.bulk.time", elapsed / 1000f)); renderer.teardown(); diff --git a/src/main/java/com/unascribed/blockrenderer/render/IRenderer.java b/src/main/java/com/unascribed/blockrenderer/render/IRenderer.java index d5ab7b6..9d5045d 100644 --- a/src/main/java/com/unascribed/blockrenderer/render/IRenderer.java +++ b/src/main/java/com/unascribed/blockrenderer/render/IRenderer.java @@ -62,7 +62,7 @@ default ITextComponent save(T value, File folder, String filename) { } catch (Exception e) { System.err.println("Rendering: " + getId(value)); e.printStackTrace(); - return new TranslationTextComponent("msg.blockrenderer.render.fail"); + return new TranslationTextComponent("msg.block_renderer.render.fail"); } } diff --git a/src/main/java/com/unascribed/blockrenderer/screens/BaseScreen.java b/src/main/java/com/unascribed/blockrenderer/screens/BaseScreen.java index b2afd28..1b18a3e 100644 --- a/src/main/java/com/unascribed/blockrenderer/screens/BaseScreen.java +++ b/src/main/java/com/unascribed/blockrenderer/screens/BaseScreen.java @@ -45,16 +45,16 @@ public void init() { addButton(new Button(width/2-100, height/6+120, 98, 20, I18n.format("gui.cancel"), button -> minecraft.displayGuiScreen(old))); - renderButton = addButton(new Button(width/2+2, height/6+120, 98, 20, I18n.format("blockrenderer.gui.render"), this::onRender), enabled); + renderButton = addButton(new Button(width/2+2, height/6+120, 98, 20, I18n.format("block_renderer.gui.render"), this::onRender), enabled); size = MathHelper.clamp(size, MIN_SIZE, MAX_SIZE); - SliderPercentageOption option = new SliderPercentageOption("blockrenderer.gui.renderSize", MIN_SIZE, MAX_SIZE, 1, (settings) -> size, (settings, value) -> size = round(value), this::getSliderDisplay); + SliderPercentageOption option = new SliderPercentageOption("block_renderer.gui.renderSize", MIN_SIZE, MAX_SIZE, 1, (settings) -> size, (settings, value) -> size = round(value), this::getSliderDisplay); slider = addButton(new UpdateableSliderWidget(minecraft.gameSettings, width/2-100, height/6+80, 200, 20, option), enabled); - actualSize = addButton(new HoverableTinyButtonWidget(this, width/2+104, height/6+80, I18n.format("blockrenderer.gui.actualSize"), I18n.format("blockrenderer.gui.actualSize.tooltip"), button -> slider.update((int) minecraft.getMainWindow().getGuiScaleFactor() * 16)), enabled); - useId = addButton(new HoverableCheckboxWidget(this, width/2-100, height / 6 + 144, 98, 20, I18n.format("blockrenderer.gui.useId"), I18n.format("blockrenderer.gui.useId.tooltip"), false), enabled); - addSize = addButton(new HoverableCheckboxWidget(this, width/2+2, height / 6 + 144, 98, 20, I18n.format("blockrenderer.gui.addSize"), I18n.format("blockrenderer.gui.addSize.tooltip"), false), enabled); + actualSize = addButton(new HoverableTinyButtonWidget(this, width/2+104, height/6+80, I18n.format("block_renderer.gui.actualSize"), I18n.format("block_renderer.gui.actualSize.tooltip"), button -> slider.update((int) minecraft.getMainWindow().getGuiScaleFactor() * 16)), enabled); + useId = addButton(new HoverableCheckboxWidget(this, width/2-100, height / 6 + 144, 98, 20, I18n.format("block_renderer.gui.useId"), I18n.format("block_renderer.gui.useId.tooltip"), false), enabled); + addSize = addButton(new HoverableCheckboxWidget(this, width/2+2, height / 6 + 144, 98, 20, I18n.format("block_renderer.gui.addSize"), I18n.format("block_renderer.gui.addSize.tooltip"), false), enabled); } protected int round(double value) { @@ -87,7 +87,7 @@ public void render(int mouseX, int mouseY, float partialTicks) { if (minecraft.world != null) return; - drawCenteredString(minecraft.fontRenderer, I18n.format("blockrenderer.gui.noWorld"), width/2, height/6+30, 0xFF5555); + drawCenteredString(minecraft.fontRenderer, I18n.format("block_renderer.gui.noWorld"), width/2, height/6+30, 0xFF5555); } abstract void onRender(Button button); diff --git a/src/main/java/com/unascribed/blockrenderer/screens/EnterNamespaceScreen.java b/src/main/java/com/unascribed/blockrenderer/screens/EnterNamespaceScreen.java index e6c510d..c0cb3db 100644 --- a/src/main/java/com/unascribed/blockrenderer/screens/EnterNamespaceScreen.java +++ b/src/main/java/com/unascribed/blockrenderer/screens/EnterNamespaceScreen.java @@ -12,7 +12,7 @@ public class EnterNamespaceScreen extends BaseScreen { - private static final TranslationTextComponent TITLE = new TranslationTextComponent("blockrenderer.gui.namespace"); + private static final TranslationTextComponent TITLE = new TranslationTextComponent("block_renderer.gui.namespace"); private boolean emptySpec = false; @@ -34,7 +34,7 @@ public void init() { String oldText = (text == null ? prefill : text.getText()); - text = addButton(new TextFieldWidget(minecraft.fontRenderer, width/2-100, height/6+50, 200, 20, I18n.format("blockrenderer.gui.namespace")), enabled); + text = addButton(new TextFieldWidget(minecraft.fontRenderer, width/2-100, height/6+50, 200, 20, I18n.format("block_renderer.gui.namespace")), enabled); text.setText(oldText); text.setFocused2(true); text.setCanLoseFocus(false); @@ -66,7 +66,7 @@ public void render(int mouseX, int mouseY, float partialTicks) { if (!emptySpec) return; - drawCenteredString(minecraft.fontRenderer, I18n.format("blockrenderer.gui.emptySpec"), width/2, height/6+30, 0xFF5555); + drawCenteredString(minecraft.fontRenderer, I18n.format("block_renderer.gui.emptySpec"), width/2, height/6+30, 0xFF5555); } @Override diff --git a/src/main/java/com/unascribed/blockrenderer/screens/EnterSizeScreen.java b/src/main/java/com/unascribed/blockrenderer/screens/EnterSizeScreen.java index 66e6785..934c602 100644 --- a/src/main/java/com/unascribed/blockrenderer/screens/EnterSizeScreen.java +++ b/src/main/java/com/unascribed/blockrenderer/screens/EnterSizeScreen.java @@ -11,7 +11,7 @@ public class EnterSizeScreen extends BaseScreen { - private static final TranslationTextComponent TITLE = new TranslationTextComponent("blockrenderer.gui.renderItem"); + private static final TranslationTextComponent TITLE = new TranslationTextComponent("block_renderer.gui.renderItem"); private final ItemStack stack; diff --git a/src/main/java/com/unascribed/blockrenderer/utils/MiscUtils.java b/src/main/java/com/unascribed/blockrenderer/utils/MiscUtils.java index 518b053..e02d515 100644 --- a/src/main/java/com/unascribed/blockrenderer/utils/MiscUtils.java +++ b/src/main/java/com/unascribed/blockrenderer/utils/MiscUtils.java @@ -36,7 +36,7 @@ static List collectStacks(Set namespaces) { try { item.fillItemGroup(ItemGroup.SEARCH, list); - } catch (Throwable t) { LOGGER.warn("Failed to get renderable items for {}", identifier, t); } + } catch (Throwable t) { LOGGER.warn("Failed to get render-able items for {}", identifier, t); } stacks.addAll(list); } diff --git a/src/main/java/com/unascribed/blockrenderer/utils/StringUtils.java b/src/main/java/com/unascribed/blockrenderer/utils/StringUtils.java index e7f362f..521b5ef 100644 --- a/src/main/java/com/unascribed/blockrenderer/utils/StringUtils.java +++ b/src/main/java/com/unascribed/blockrenderer/utils/StringUtils.java @@ -67,7 +67,7 @@ static List getTooltipFromItem(ItemStack stack) { } static ITextComponent getRenderSuccess(File folder, File file) { - return new TranslationTextComponent("msg.blockrenderer.render.success", asClickable(folder), asClickable(file)); + return new TranslationTextComponent("msg.block_renderer.render.success", asClickable(folder), asClickable(file)); } static ITextComponent asClickable(File file) { @@ -85,7 +85,7 @@ static ITextComponent asClickable(File file) { } } - component.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TranslationTextComponent("blockrenderer.file.tooltip"))); + component.getStyle().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TranslationTextComponent("block_renderer.file.tooltip"))); component.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, path)); component.getStyle().setUnderlined(true); diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 681cc45..e009d8d 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -2,7 +2,7 @@ modLoader="javafml" loaderVersion="[31,)" issueTrackerURL="https://github.com/AterAnimAvis/BlockRenderer/issues" [[mods]] -modId="blockrenderer" +modId="block_renderer" version="${file.jarVersion}" displayName="BlockRenderer" displayURL="https://unascribed.com" diff --git a/src/main/resources/assets/block_renderer/lang/en_us.json b/src/main/resources/assets/block_renderer/lang/en_us.json new file mode 100644 index 0000000..d9ecc85 --- /dev/null +++ b/src/main/resources/assets/block_renderer/lang/en_us.json @@ -0,0 +1,39 @@ +{ + "key.block_renderer.render":"Render", + "key.categories.block_renderer":"BlockRenderer", + + "msg.block_renderer.render.fail":"Rendering failed, see game output for details", + "msg.block_renderer.render.success":"Successfully rendered to %2$s in %1$s", + + "msg.block_renderer.bulk.cancelled":"Operation cancelled, rendered %1$s from a total of %4$s entries from %2$s in %3$s", + "msg.block_renderer.bulk.finished":"Rendered %1$s entries from %2$s in %3$s", + "msg.block_renderer.bulk.errored":"%1$s entries errored, See game output for details", + "msg.block_renderer.bulk.time":"Total time: %1$s seconds", + "msg.block_renderer.bulk.noItems":"No items for Namespace '%1$s'", + + "msg.block_renderer.slot.empty":"That slot has no item", + "msg.block_renderer.slot.absent":"There's no slot there", + "msg.block_renderer.notContainer":"Can't find an item to render", + + "block_renderer.file.tooltip":"Click to Open", + + "block_renderer.gui.renderItem":"Render Item", + "block_renderer.gui.namespace":"Enter Namespace", + "block_renderer.gui.noWorld":"You must be in a world to render items", + "block_renderer.gui.emptySpec":"You need to enter a Namespace", + + "block_renderer.gui.render":"Render", + "block_renderer.gui.renderSize":"Size", + + "block_renderer.gui.useId":"Identifier", + "block_renderer.gui.addSize":"Size", + "block_renderer.gui.actualSize":"Actual Size", + "block_renderer.gui.useId.tooltip":"Use Identifier for Filename", + "block_renderer.gui.addSize.tooltip":"Add Size to Filename", + "block_renderer.gui.actualSize.tooltip":"Set to actual size (Based on GUI Scale)", + + "block_renderer.gui.rendering":"Rendering %1$s entries from %2$s", + "block_renderer.gui.rendered":"Rendered %1$s entries from %2$s", + "block_renderer.gui.renderCancelled":"Operation cancelled", + "block_renderer.gui.progress":"(%1$s/%2$s, %3$s to go)" +} \ No newline at end of file diff --git a/src/main/resources/assets/blockrenderer/lang/en_us.json b/src/main/resources/assets/blockrenderer/lang/en_us.json deleted file mode 100644 index 07c9dce..0000000 --- a/src/main/resources/assets/blockrenderer/lang/en_us.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "key.blockrenderer.render":"Render", - "key.categories.blockrenderer":"BlockRenderer", - - "msg.blockrenderer.render.fail":"Rendering failed, see game output for details", - "msg.blockrenderer.render.success":"Successfully rendered to %2$s in %1$s", - - "msg.blockrenderer.bulk.cancelled":"Operation cancelled, rendered %1$s from a total of %4$s entries from %2$s in %3$s", - "msg.blockrenderer.bulk.finished":"Rendered %1$s entries from %2$s in %3$s", - "msg.blockrenderer.bulk.errored":"%1$s entries errored, See game output for details", - "msg.blockrenderer.bulk.time":"Total time: %1$s seconds", - "msg.blockrenderer.bulk.noItems":"No items for Namespace '%1$s'", - - "msg.blockrenderer.slot.empty":"That slot has no item", - "msg.blockrenderer.slot.absent":"There's no slot there", - "msg.blockrenderer.notContainer":"Can't find an item to render", - - "blockrenderer.file.tooltip":"Click to Open", - - "blockrenderer.gui.renderItem":"Render Item", - "blockrenderer.gui.namespace":"Enter Namespace", - "blockrenderer.gui.noWorld":"You must be in a world to render items", - "blockrenderer.gui.emptySpec":"You need to enter a Namespace", - - "blockrenderer.gui.render":"Render", - "blockrenderer.gui.renderSize":"Size", - - "blockrenderer.gui.useId":"Identifier", - "blockrenderer.gui.addSize":"Size", - "blockrenderer.gui.actualSize":"Actual Size", - "blockrenderer.gui.useId.tooltip":"Use Identifier for Filename", - "blockrenderer.gui.addSize.tooltip":"Add Size to Filename", - "blockrenderer.gui.actualSize.tooltip":"Set to actual size (Based on GUI Scale)", - - "blockrenderer.gui.rendering":"Rendering %1$s entries from %2$s", - "blockrenderer.gui.rendered":"Rendered %1$s entries from %2$s", - "blockrenderer.gui.renderCancelled":"Operation cancelled", - "blockrenderer.gui.progress":"(%1$s/%2$s, %3$s to go)" -} \ No newline at end of file