From 8d90137b1a4f689574cefffe32357a3c5f856c72 Mon Sep 17 00:00:00 2001 From: PepperBell <44146161+PepperCode1@users.noreply.github.com> Date: Wed, 23 Jun 2021 22:32:42 -0700 Subject: [PATCH 1/2] Remove TooltipHelper.getUnformattedDeepText - Replace it with ITextComponent.getString --- .../structureMovement/IDisplayAssemblyExceptions.java | 3 ++- .../create/foundation/item/ItemDescription.java | 6 ++---- .../simibubi/create/foundation/item/TooltipHelper.java | 10 +--------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/IDisplayAssemblyExceptions.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/IDisplayAssemblyExceptions.java index 2bbd13f3a..36455b9cd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/IDisplayAssemblyExceptions.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/IDisplayAssemblyExceptions.java @@ -26,7 +26,7 @@ public interface IDisplayAssemblyExceptions { tooltip.add(IHaveGoggleInformation.componentSpacing.copy().append(Lang.translate("gui.assembly.exception").formatted(TextFormatting.GOLD))); - String text = TooltipHelper.getUnformattedDeepText(e.component); + String text = e.component.getString(); Arrays.stream(text.split("\n")) .forEach(l -> TooltipHelper.cutStringTextComponent(l, GRAY, WHITE) .forEach(c -> tooltip.add(IHaveGoggleInformation.componentSpacing.copy().append(c)))); @@ -35,4 +35,5 @@ public interface IDisplayAssemblyExceptions { } AssemblyException getLastAssemblyException(); + } diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index 6c8a9afd0..ea25a62e8 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -212,10 +212,8 @@ public class ItemDescription { boolean hasControls = !linesOnCtrl.isEmpty(); if (hasDescription || hasControls) { - String[] holdDesc = TooltipHelper.getUnformattedDeepText(Lang.translate("tooltip.holdForDescription", "$")) - .split("\\$"); - String[] holdCtrl = TooltipHelper.getUnformattedDeepText(Lang.translate("tooltip.holdForControls", "$")) - .split("\\$"); + String[] holdDesc = Lang.translate("tooltip.holdForDescription", "$").getString().split("\\$"); + String[] holdCtrl = Lang.translate("tooltip.holdForControls", "$").getString().split("\\$"); IFormattableTextComponent keyShift = Lang.translate("tooltip.keyShift"); IFormattableTextComponent keyCtrl = Lang.translate("tooltip.keyCtrl"); for (List list : Arrays.asList(lines, linesOnShift, linesOnCtrl)) { diff --git a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java index ff99d550b..29f2c2abf 100644 --- a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java +++ b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java @@ -124,7 +124,7 @@ public class TooltipHelper { public static List cutTextComponent(ITextComponent c, TextFormatting defaultColor, TextFormatting highlightColor, int indent) { - String s = getUnformattedDeepText(c); + String s = c.getString(); // Apply markup String markedUp = s;// .replaceAll("_([^_]+)_", highlightColor + "$1" + defaultColor); @@ -330,12 +330,4 @@ public class TooltipHelper { // return l.get(); // } - public static String getUnformattedDeepText(ITextComponent component) { - StringBuilder b = new StringBuilder(); - b.append(component.getString()); - component.getSiblings() - .forEach(c -> b.append(getUnformattedDeepText(c))); - return b.toString(); - } - } From 178af2061f739a44f04434634375c51c1f2580f7 Mon Sep 17 00:00:00 2001 From: PepperBell <44146161+PepperCode1@users.noreply.github.com> Date: Wed, 23 Jun 2021 23:05:31 -0700 Subject: [PATCH 2/2] Fix harvester culling - Make harvester's render box a unit cube - Expose manually animated speed through getter --- .../components/actors/HarvesterRenderer.java | 2 +- .../components/actors/HarvesterTileEntity.java | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java index 3ab34b532..652e42e85 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java @@ -36,7 +36,7 @@ public class HarvesterRenderer extends SafeTileEntityRenderer type) { super(type); } - // For simulations such as Ponder - float manuallyAnimatedSpeed; + @Override + public AxisAlignedBB getRenderBoundingBox() { + return RENDER_BOX.offset(pos); + } + + public float getAnimatedSpeed() { + return manuallyAnimatedSpeed; + } public void setAnimatedSpeed(float speed) { manuallyAnimatedSpeed = speed;