Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cover UI crash fixes #3873

Merged
merged 5 commits into from
Jan 31, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reduce instantiation
  • Loading branch information
YannickMG committed Jan 30, 2025
commit 846d74f92b9d71696c0b98d241e4345a2b363548
Original file line number Diff line number Diff line change
@@ -66,6 +66,9 @@ public abstract class CoverableTileEntity extends BaseTileEntity implements ICov
.mapToInt(Enum::ordinal)
.mapToObj(i -> "mCoverData" + i)
.toArray(String[]::new);
private static final String[] COVER_DIRECTION_NAMES = new String[] { "GT5U.interface.coverTabs.down",
"GT5U.interface.coverTabs.up", "GT5U.interface.coverTabs.north", "GT5U.interface.coverTabs.south",
"GT5U.interface.coverTabs.west", "GT5U.interface.coverTabs.east" };

// New Cover Information
protected final CoverInfo[] coverInfos = new CoverInfo[] { null, null, null, null, null, null };
@@ -748,9 +751,6 @@ public IDrawable[] getBackground() {

@SideOnly(Side.CLIENT)
protected List<String> getCoverTabTooltip(ForgeDirection side) {
final String[] SIDE_TOOLTIPS = new String[] { "GT5U.interface.coverTabs.down", "GT5U.interface.coverTabs.up",
"GT5U.interface.coverTabs.north", "GT5U.interface.coverTabs.south", "GT5U.interface.coverTabs.west",
"GT5U.interface.coverTabs.east" };
final CoverInfo coverInfo = getCoverInfoAtSide(side);
final ItemStack coverItem = coverInfo.getDisplayStack();
if (coverItem == null) return Collections.emptyList();
@@ -761,7 +761,7 @@ protected List<String> getCoverTabTooltip(ForgeDirection side) {
final ImmutableList.Builder<String> builder = ImmutableList.builder();
builder.add(
(coverHasGUI ? EnumChatFormatting.UNDERLINE : EnumChatFormatting.DARK_GRAY)
+ StatCollector.translateToLocal(SIDE_TOOLTIPS[side.ordinal()])
+ StatCollector.translateToLocal(COVER_DIRECTION_NAMES[side.ordinal()])
+ (coverHasGUI ? EnumChatFormatting.RESET + ": " : ": " + EnumChatFormatting.RESET)
+ tooltip.get(0));
builder.addAll(coverInfo.getAdditionalTooltip(coverInfo.getCoverData()));