Skip to content

Commit a79bb44

Browse files
committed
- Version: Bumped to 2.1.4
- Enhancement: Added tooltips to various screens to indicate which mod added content
1 parent 578170d commit a79bb44

File tree

14 files changed

+115
-73
lines changed

14 files changed

+115
-73
lines changed

changelog.md

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,6 @@
1-
# Version 2.1.3
1+
# Version 2.1.4
22

33
![TARDIS Refined](https://wiki.tardisrefined.net/TARDIS-Refined-Wiki/tardis_refined_v2_1.png)
44

5-
#### Bug Fixes
6-
- Bug Fix: Placing and entering TARDIS door in the overworld crashes the game with Immersive Portals [#444](https://github.com/WhoCraft/TardisRefined/issues/444)
7-
- Bug Fix: Players can land TARDIS within TARDIS with Landing Pad [#447](https://github.com/WhoCraft/TardisRefined/issues/447)
8-
- Bug Fix: Fixed TARDIS not storing Adventure Mode Dimensions correctly
9-
- Bug Fix: Fixed Dedicated Servers on Fabric having issues loading data from disk (Caused dupe TARDIS and loss of Upgrades etc)
10-
- Bug Fix: Fixed Diagonal Windows Support
11-
- Bug fix: Fixed duplication happening on logging out mid-flight (and other occasions)
12-
- Bug fix: Fixed issue where End Dragon fight would not be checked correctly
13-
- Bug fix: Potentially fixed interior door messing up on AMD cards!
14-
15-
#### Config
16-
- Added use_internal_shaders client config
17-
- Added render_vortex_in_door client config
18-
19-
#### Interiors
20-
- Added Panamax Interior
21-
22-
#### Textures and Models
23-
- Altered: Factory Console Emission Texture
24-
- Altered: Factory Console (Mint) Emission Texture
25-
- Altered: Factory Console (Vintage) Emission Texture
26-
- Altered: Factory Console (Wood) Emission Texture
27-
- Added: Victorian Console (Default) Emission Texture
28-
- Added: Victorian Console (Bronze Age) Emission Texture
29-
30-
#### API Changes
31-
- Addon mods can now freely register console models
32-
- Addon mods consoles can now have per variant models
5+
#### Enhancements
6+
- Enhancement: Added tooltips to various screens to indicate which mod added content

common/src/main/java/whocraft/tardis_refined/client/screen/components/SelectionListEntry.java

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ public class SelectionListEntry extends ObjectSelectionList.Entry<SelectionListE
1111
private final Component itemDisplayName;
1212
private final GenericListSelection press;
1313
private boolean checked = false;
14-
1514
private boolean enabled = true;
16-
1715
private int listLeft;
16+
private Component tooltip;
1817

1918
/**
2019
* @param name
@@ -40,19 +39,20 @@ public SelectionListEntry(Component name, GenericListSelection onSelection, int
4039
this.enabled = enabled;
4140
}
4241

42+
public void setTooltip(Component tooltip) {
43+
this.tooltip = tooltip;
44+
}
45+
4346
@Override
4447
public Component getNarration() {
4548
return itemDisplayName;
4649
}
4750

4851
@Override
4952
public boolean mouseClicked(double d, double e, int i) {
50-
5153
if (enabled) {
5254
press.onClick(this);
5355
}
54-
55-
5656
return super.mouseClicked(d, e, i);
5757
}
5858

@@ -70,26 +70,28 @@ public boolean mouseClicked(double d, double e, int i) {
7070
*/
7171
@Override
7272
public void render(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean isMouseOver, float partialTick) {
73-
74-
75-
int colour = isMouseOver ? ChatFormatting.YELLOW.getColor() : (this.checked ? ChatFormatting.YELLOW.getColor() : this.itemDisplayName.getStyle().getColor() != null ? this.itemDisplayName.getStyle().getColor().getValue() : ChatFormatting.GOLD.getColor());
73+
int colour = isMouseOver ? ChatFormatting.YELLOW.getColor() :
74+
(this.checked ? ChatFormatting.YELLOW.getColor() :
75+
this.itemDisplayName.getStyle().getColor() != null ?
76+
this.itemDisplayName.getStyle().getColor().getValue() :
77+
ChatFormatting.GOLD.getColor());
7678
Component text = Component.literal((this.checked ? "> " : "") + this.itemDisplayName.getString());
7779
this.renderText(guiGraphics, index, top, left, width, height, mouseX, mouseY, isMouseOver, partialTick, text, this.enabled ? colour : ChatFormatting.DARK_GRAY.getColor());
78-
}
7980

80-
public void renderText(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean isMouseOver, float partialTick, Component text, int textColour) {
81-
int textWidth = Minecraft.getInstance().font.width(text);
81+
// Render tooltip if mouse is over
82+
if (isMouseOver && this.tooltip != null) {
83+
renderTooltip(guiGraphics, mouseX, mouseY);
84+
}
85+
}
8286

83-
/*
84-
Centre aligned option
85-
int heightCentre = top + height / 2;
86-
int leftMax = left + width - 8; //Add some borders between sides of the scrollbar
87-
int leftCentre = (left + leftMax - textWidth) / 2; //Get start position for each text to render as centre aligned, taking into account of the text width
88-
int xPos = leftCentre;
89-
int yPos = heightCentre - 9 / 2;
90-
*/
87+
private void renderTooltip(GuiGraphics guiGraphics, int mouseX, int mouseY) {
88+
Minecraft minecraft = Minecraft.getInstance();
89+
if (minecraft.screen != null) {
90+
guiGraphics.renderTooltip(minecraft.font, this.tooltip, mouseX, mouseY);
91+
}
92+
}
9193

92-
/* Left Aligned */
94+
public void renderText(GuiGraphics guiGraphics, int index, int top, int left, int width, int height, int mouseX, int mouseY, boolean isMouseOver, float partialTick, Component text, int textColour) {
9395
int heightCentre = top + height / 2;
9496
int xPos = this.listLeft + 2;
9597
int yPos = heightCentre - 9 / 2;
@@ -99,4 +101,4 @@ public void renderText(GuiGraphics guiGraphics, int index, int top, int left, in
99101
public void setChecked(boolean checked) {
100102
this.checked = checked;
101103
}
102-
}
104+
}

common/src/main/java/whocraft/tardis_refined/client/screen/ponder/PonderListScreen.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package whocraft.tardis_refined.client.screen.ponder;
22

3+
import net.minecraft.ChatFormatting;
34
import net.minecraft.client.Minecraft;
45
import net.minecraft.client.gui.components.ObjectSelectionList;
56
import net.minecraft.network.chat.Component;
@@ -9,6 +10,7 @@
910
import whocraft.tardis_refined.client.screen.components.SelectionListEntry;
1011
import whocraft.tardis_refined.client.screen.main.MonitorOS;
1112
import whocraft.tardis_refined.common.crafting.astral_manipulator.ManipulatorCraftingRecipe;
13+
import whocraft.tardis_refined.common.util.Platform;
1214

1315
import java.util.List;
1416

@@ -34,11 +36,18 @@ public ObjectSelectionList<SelectionListEntry> createSelectionList() {
3436
for (ManipulatorCraftingRecipe recipe : recipes) {
3537
Component name = PonderScreen.getResultName(recipe);
3638

37-
selectionList.children().add(new SelectionListEntry(name, (entry) -> {
39+
String owner = Platform.getModName(recipe.getId().getNamespace());
40+
Component tooltip = Component.literal(ChatFormatting.BLUE + owner);
41+
42+
SelectionListEntry entry = new SelectionListEntry(name, (selectedEntry) -> {
3843
Minecraft.getInstance().setScreen(new PonderScreen(recipe));
39-
}, leftPos));
44+
}, leftPos);
45+
46+
entry.setTooltip(tooltip);
47+
selectionList.children().add(entry);
4048
}
4149

50+
4251
return selectionList;
4352
}
4453
}

common/src/main/java/whocraft/tardis_refined/client/screen/screens/DesktopSelectionScreen.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.mojang.blaze3d.systems.RenderSystem;
44
import com.mojang.blaze3d.vertex.PoseStack;
55
import com.mojang.brigadier.StringReader;
6+
import net.minecraft.ChatFormatting;
67
import net.minecraft.client.Minecraft;
78
import net.minecraft.client.gui.GuiGraphics;
89
import net.minecraft.client.gui.components.ObjectSelectionList;
@@ -20,6 +21,7 @@
2021
import whocraft.tardis_refined.common.tardis.TardisDesktops;
2122
import whocraft.tardis_refined.common.tardis.themes.DesktopTheme;
2223
import whocraft.tardis_refined.common.util.MiscHelper;
24+
import whocraft.tardis_refined.common.util.Platform;
2325
import whocraft.tardis_refined.constants.ModMessages;
2426
import whocraft.tardis_refined.registry.TRSoundRegistry;
2527

@@ -111,16 +113,17 @@ public ObjectSelectionList<SelectionListEntry> createSelectionList() {
111113
values = values.stream().sorted(Comparator.comparing(DesktopTheme::getName)).toList();
112114

113115
for (DesktopTheme desktop : values) {
114-
115116
Component name = Component.literal(MiscHelper.getCleanName(desktop.getIdentifier().getPath()));
116-
// Check for if the tellraw name is incomplete, or fails to pass.
117+
// Attempt to parse the name from JSON
117118
try {
118119
name = Component.Serializer.fromJson(new StringReader(desktop.getName()));
119120
} catch (Exception ex) {
120121
LOGGER.error("Could not process Name for datapack desktop {}", desktop.getIdentifier().toString());
121122
}
122123

123-
selectionList.children().add(new SelectionListEntry(name, (entry) -> {
124+
Component tooltip = Component.literal(ChatFormatting.BLUE + Platform.getModName(desktop.getIdentifier().getNamespace()));
125+
126+
SelectionListEntry entry = new SelectionListEntry(name, (selectedEntry) -> {
124127
previousImage = currentDesktopTheme.getPreviewTexture();
125128
this.currentDesktopTheme = desktop;
126129

@@ -129,13 +132,19 @@ public ObjectSelectionList<SelectionListEntry> createSelectionList() {
129132
current.setChecked(false);
130133
}
131134
}
132-
entry.setChecked(true);
135+
selectedEntry.setChecked(true);
133136
age = 0;
137+
134138
Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(TRSoundRegistry.STATIC.get(), (float) Math.random()));
135-
}, leftPos));
139+
}, leftPos);
140+
141+
entry.setTooltip(tooltip);
142+
143+
selectionList.children().add(entry);
136144
}
137145

138146
return selectionList;
139147
}
140148

149+
141150
}

common/src/main/java/whocraft/tardis_refined/client/screen/screens/HumSelectionScreen.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package whocraft.tardis_refined.client.screen.screens;
22

33
import com.mojang.brigadier.StringReader;
4+
import net.minecraft.ChatFormatting;
45
import net.minecraft.client.Minecraft;
56
import net.minecraft.client.gui.components.ObjectSelectionList;
67
import net.minecraft.network.chat.Component;
@@ -15,6 +16,7 @@
1516
import whocraft.tardis_refined.common.soundscape.hum.HumEntry;
1617
import whocraft.tardis_refined.common.soundscape.hum.TardisHums;
1718
import whocraft.tardis_refined.common.util.MiscHelper;
19+
import whocraft.tardis_refined.common.util.Platform;
1820
import whocraft.tardis_refined.constants.ModMessages;
1921

2022
import java.util.Collection;
@@ -69,28 +71,34 @@ public ObjectSelectionList<SelectionListEntry> createSelectionList() {
6971

7072
for (HumEntry humEntry : knownHums) {
7173
Component name = Component.literal(MiscHelper.getCleanName(humEntry.getIdentifier().getPath()));
74+
Component tooltip;
7275

73-
// Check for if the tellraw name is incomplete, or fails to pass.
7476
try {
7577
name = Component.Serializer.fromJson(new StringReader(humEntry.getNameComponent()));
78+
tooltip = Component.literal(ChatFormatting.BLUE + Platform.getModName(humEntry.getIdentifier().getNamespace()));
7679
} catch (Exception ex) {
77-
LOGGER.error("Could not process Name for hum {}", humEntry.getIdentifier().toString());
80+
LOGGER.error("Could not process Name for hum {}", humEntry.getIdentifier());
81+
tooltip = Component.literal("Unknown");
7882
}
7983

80-
selectionList.children().add(new SelectionListEntry(name, (entry) -> {
81-
// previousImage = humEntry.getPreviewTexture();
84+
SelectionListEntry entry = new SelectionListEntry(name, selectedEntry -> {
8285
this.currentHumEntry = humEntry;
8386

8487
for (Object child : selectionList.children()) {
8588
if (child instanceof SelectionListEntry current) {
8689
current.setChecked(false);
8790
}
8891
}
89-
entry.setChecked(true);
90-
}, leftPos));
92+
93+
selectedEntry.setChecked(true);
94+
}, leftPos);
95+
96+
entry.setTooltip(tooltip);
97+
selectionList.children().add(entry);
9198
}
9299

93100
return selectionList;
94101
}
95102

103+
96104
}

common/src/main/java/whocraft/tardis_refined/client/screen/screens/ShellSelectionScreen.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.mojang.blaze3d.vertex.PoseStack;
44
import com.mojang.brigadier.StringReader;
55
import com.mojang.math.Axis;
6+
import net.minecraft.ChatFormatting;
67
import net.minecraft.client.Minecraft;
78
import net.minecraft.client.gui.GuiGraphics;
89
import net.minecraft.client.gui.components.Button;
@@ -18,6 +19,7 @@
1819
import whocraft.tardis_refined.common.tardis.TardisDesktops;
1920
import whocraft.tardis_refined.common.tardis.themes.DesktopTheme;
2021
import whocraft.tardis_refined.common.tardis.themes.ShellTheme;
22+
import whocraft.tardis_refined.common.util.Platform;
2123
import whocraft.tardis_refined.constants.ModMessages;
2224
import whocraft.tardis_refined.patterns.ShellPattern;
2325
import whocraft.tardis_refined.patterns.ShellPatterns;
@@ -109,6 +111,9 @@ public GenericMonitorSelectionList<SelectionListEntry> createSelectionList() {
109111
for (Map.Entry<ResourceKey<ShellTheme>, ShellTheme> shellTheme : values) {
110112
ResourceLocation shellThemeId = ShellTheme.getKey(shellTheme.getValue());
111113

114+
String owner = Platform.getModName(shellTheme.getKey().location().getNamespace());
115+
Component tooltip = Component.literal(ChatFormatting.BLUE + owner);
116+
112117
SelectionListEntry selectionListEntry = new SelectionListEntry(shellTheme.getValue().getDisplayName(), (entry) -> {
113118
CURRENTSHELLTHEME = shellThemeId;
114119

@@ -122,15 +127,17 @@ public GenericMonitorSelectionList<SelectionListEntry> createSelectionList() {
122127

123128
boolean themeHasPatterns = PATTERNCOLLECTION.size() > 1;
124129

125-
//Hide the pattern button if there is only one pattern available for the shell, else show it. (i.e. The default)
126130
patternButton.visible = themeHasPatterns;
127131

128-
if (themeHasPatterns) //Update the button name now that we have confirmed that there is more than one pattern in the shell
132+
if (themeHasPatterns) {
129133
this.patternButton.setMessage(Component.Serializer.fromJson(new StringReader(PATTERN.name())));
134+
}
130135

131136
entry.setChecked(true);
132137
}, leftPos);
133138

139+
selectionListEntry.setTooltip(tooltip);
140+
134141
if (CURRENTSHELLTHEME.toString().equals(shellThemeId.toString())) {
135142
selectionListEntry.setChecked(true);
136143
}

common/src/main/java/whocraft/tardis_refined/client/screen/screens/VortexSelectionScreen.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.mojang.blaze3d.vertex.PoseStack;
44
import com.mojang.math.Axis;
5+
import net.minecraft.ChatFormatting;
56
import net.minecraft.client.Minecraft;
67
import net.minecraft.client.gui.GuiGraphics;
78
import net.minecraft.core.Holder;
@@ -16,6 +17,7 @@
1617
import whocraft.tardis_refined.common.VortexRegistry;
1718
import whocraft.tardis_refined.common.network.messages.C2SChangeVortex;
1819
import whocraft.tardis_refined.common.tardis.themes.ShellTheme;
20+
import whocraft.tardis_refined.common.util.Platform;
1921
import whocraft.tardis_refined.constants.ModMessages;
2022

2123
import java.util.Collection;
@@ -91,6 +93,8 @@ public GenericMonitorSelectionList<SelectionListEntry> createSelectionList() {
9193

9294
for (Map.Entry<ResourceKey<VortexRegistry>, VortexRegistry> vort : values) {
9395
ResourceLocation vortId = VortexRegistry.VORTEX_DEFERRED_REGISTRY.getKey(vort.getValue());
96+
String owner = Platform.getModName(vort.getKey().location().getNamespace());
97+
Component tooltip = Component.literal(ChatFormatting.BLUE + owner);
9498

9599
SelectionListEntry selectionListEntry = new SelectionListEntry(vort.getValue().getDisplayName(), (entry) -> {
96100
currentVortex = vortId;
@@ -104,6 +108,7 @@ public GenericMonitorSelectionList<SelectionListEntry> createSelectionList() {
104108
entry.setChecked(true);
105109
}, leftPos);
106110

111+
selectionListEntry.setTooltip(tooltip);
107112

108113
if (currentVortex.toString().equals(vortId.toString())) {
109114
selectionListEntry.setChecked(true);
@@ -114,4 +119,5 @@ public GenericMonitorSelectionList<SelectionListEntry> createSelectionList() {
114119

115120
return selectionList;
116121
}
122+
117123
}

0 commit comments

Comments
 (0)