Actually fix tooltips on 1.16

This commit is contained in:
grimmauld 2020-11-17 22:20:00 +01:00
parent 20d1403ede
commit a2e28db761
3 changed files with 40 additions and 42 deletions

View File

@ -330,7 +330,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggl
d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json
92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json 92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json
61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json 61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json
8d7e653bfd9846e684a0d3725595714a19201017 assets/create/blockstates/radial_chassis.json 5d1b30c2bab556f57c78e7780fd445b08f541a50 assets/create/blockstates/radial_chassis.json
45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json 45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json
da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json
722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json 722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json

View File

@ -29,8 +29,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "true", "axis": "x",
"axis": "x" "sticky_south": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -39,8 +39,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "true", "axis": "y",
"axis": "y" "sticky_south": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky" "model": "create:block/radial_chassis_side_y_sticky"
@ -48,8 +48,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "true", "axis": "z",
"axis": "z" "sticky_south": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -59,8 +59,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "false", "axis": "x",
"axis": "x" "sticky_south": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -69,8 +69,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "false", "axis": "y",
"axis": "y" "sticky_south": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y" "model": "create:block/radial_chassis_side_y"
@ -78,8 +78,8 @@
}, },
{ {
"when": { "when": {
"sticky_south": "false", "axis": "z",
"axis": "z" "sticky_south": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -89,8 +89,8 @@
}, },
{ {
"when": { "when": {
"sticky_west": "true", "axis": "x",
"axis": "x" "sticky_west": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -99,8 +99,8 @@
}, },
{ {
"when": { "when": {
"sticky_west": "true", "axis": "y",
"axis": "y" "sticky_west": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky", "model": "create:block/radial_chassis_side_y_sticky",
@ -109,8 +109,8 @@
}, },
{ {
"when": { "when": {
"sticky_west": "true", "axis": "z",
"axis": "z" "sticky_west": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_z_sticky", "model": "create:block/radial_chassis_side_z_sticky",
@ -119,8 +119,8 @@
}, },
{ {
"when": { "when": {
"sticky_west": "false", "axis": "x",
"axis": "x" "sticky_west": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",
@ -129,8 +129,8 @@
}, },
{ {
"when": { "when": {
"sticky_west": "false", "axis": "y",
"axis": "y" "sticky_west": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y", "model": "create:block/radial_chassis_side_y",
@ -139,8 +139,8 @@
}, },
{ {
"when": { "when": {
"sticky_west": "false", "axis": "z",
"axis": "z" "sticky_west": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_z", "model": "create:block/radial_chassis_side_z",
@ -149,8 +149,8 @@
}, },
{ {
"when": { "when": {
"sticky_north": "true", "axis": "x",
"axis": "x" "sticky_north": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky" "model": "create:block/radial_chassis_side_x_sticky"
@ -158,8 +158,8 @@
}, },
{ {
"when": { "when": {
"sticky_north": "true", "axis": "y",
"axis": "y" "sticky_north": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y_sticky", "model": "create:block/radial_chassis_side_y_sticky",
@ -168,8 +168,8 @@
}, },
{ {
"when": { "when": {
"sticky_north": "true", "axis": "z",
"axis": "z" "sticky_north": "true"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x_sticky", "model": "create:block/radial_chassis_side_x_sticky",
@ -178,8 +178,8 @@
}, },
{ {
"when": { "when": {
"sticky_north": "false", "axis": "x",
"axis": "x" "sticky_north": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x" "model": "create:block/radial_chassis_side_x"
@ -187,8 +187,8 @@
}, },
{ {
"when": { "when": {
"sticky_north": "false", "axis": "y",
"axis": "y" "sticky_north": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_y", "model": "create:block/radial_chassis_side_y",
@ -197,8 +197,8 @@
}, },
{ {
"when": { "when": {
"sticky_north": "false", "axis": "z",
"axis": "z" "sticky_north": "false"
}, },
"apply": { "apply": {
"model": "create:block/radial_chassis_side_x", "model": "create:block/radial_chassis_side_x",

View File

@ -49,9 +49,8 @@ public class TooltipHelper {
ITextComponent spacing = IHaveGoggleInformation.componentSpacing; ITextComponent spacing = IHaveGoggleInformation.componentSpacing;
tooltip.add(spacing.copy().append(Lang.translate(hintKey + ".title")).formatted(GOLD)); tooltip.add(spacing.copy().append(Lang.translate(hintKey + ".title")).formatted(GOLD));
ITextComponent hint = Lang.translate(hintKey); ITextComponent hint = Lang.translate(hintKey);
List<ITextComponent> cutComponent = TooltipHelper.cutTextComponent(spacing.copy().append(hint), GRAY, TextFormatting.WHITE); List<ITextComponent> cutComponent = TooltipHelper.cutTextComponent(hint, GRAY, TextFormatting.WHITE);
for (int i = 0; i < cutComponent.size(); i++) for (ITextComponent component : cutComponent) tooltip.add(spacing.copy().append(component));
tooltip.add((i == 0 ? StringTextComponent.EMPTY : spacing).copy().append(cutComponent.get(i)));
} }
public static void referTo(IItemProvider item, Supplier<? extends IItemProvider> itemWithTooltip) { public static void referTo(IItemProvider item, Supplier<? extends IItemProvider> itemWithTooltip) {
@ -279,8 +278,7 @@ public class TooltipHelper {
public static String getUnformattedDeepText(ITextComponent component) { public static String getUnformattedDeepText(ITextComponent component) {
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
if (!(component instanceof TranslationTextComponent)) b.append(component.getString());
b.append(component.getString());
component.getSiblings() component.getSiblings()
.forEach(c -> b.append(getUnformattedDeepText(c))); .forEach(c -> b.append(getUnformattedDeepText(c)));
return b.toString(); return b.toString();