Skip to content

Commit e2033dd

Browse files
committed
Squashed Update of forge to 47.2.30
swap back to mojang patches fix hunk heads Update forge to 47.2.30 Fix NPE when acceptableValues in defineInList() does not allow nulls, backport of #9903 (#9907) Co-authored-by: J-RAP <SrRapero720@hotmail.com> Optimise capabilities a tad, backport of #9886 (#9911) Add helper method to `OnDatapackSyncEvent`, backport of #9901 (#9919) Add CPU usage config option to early window, hide by default, backport of #9866 (#9915) Fix slightly offset mods screen link positioning, backport of #9860 (#9861) Co-authored-by: Dennis C <11262040+XFactHD@users.noreply.github.com> Make common config screen registration tasks easier, backport of #9884 (#9912) Swap back to srg patches temporarily
1 parent 49f88b5 commit e2033dd

22 files changed

+135
-69
lines changed

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[discord-widget]: https://canary.discord.com/api/guilds/1172551819138965605/widget.png
22
[discord-invite]: https://discord.kettingpowered.org/
33

4-
[forge-version]: https://img.shields.io/badge/1.20.1--47.2.23-none?logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjCGJ1kDAAACoElEQVQ4T22SeU8aURTF%2FULGtNRWWVQY9lXABWldIDPIMgVbNgEVtaa0damiqGBdipXaJcY2ofEf4ycbTt97pVAabzK5b27u%2BZ377kwXgK77QthRy7OfXbeJM%2BttqKSXN8sdwbT%2FA0L7elmsYqrPHZmROLPh5YkV4oEBwaKuHj%2ByyJptLDoAhbq3O1V1XCVObY3FL24mfn5oRPrcwSCRfQOyNWcjVjZdCbtcdwcgXrXUspdOKbDN%2FXE9tiBJMhXHT60gUIT2dMhcDLMc3NVKQklz0QIkf5qlyEcO6Qs7yPhMJB4amDMFimQSmqNlE8SKAZFzDfxHfVILIIZ10sJ3OwIbcqSuiOjchkzNCboHev9o2YhgiUP8mxnLN24I6%2F3ghYdtQG5iUMpFBuCP9iKwLsfiLyeCp2rMnZgwX3NArGoxW1Ridl%2BBzLEVKa8KSxOqNmDdz0kFnxaLHhWEgAyZigWhHXL%2BpEDy2ozsDxv8vAzTnh7w5kcghqCaFmCT10of4iPIT2mRdPUh4HoCcVwBH%2F8Ac2kzUkEV5r3EfVSOvbAJa5NDyI0r2oDtWb1EClh%2BOoC3Pg7v%2FBw7p939yI4rsRW2Y3lKh01eh7WpIRyKZqzyjjYgPdIvlaMWRqYuG7wWryYHsRM0sFolZiPvQ3jheIwSmSBPdkByG%2FB6Wi3RYiVmRX7GiAPiUCRisii8D%2BjZNKvPBrHCW1GY0bAz6WkDCtOaSyKQFsi4K5NqNiZtehN2Y5uAShETqolhBqJXpfdPuPsuWwAaRdHSkxdc11mPqkGnyY4pyKbpl1GyJ0Pel7yqBoFcF3zqno5f%2Bd8ohYy9Sx7lzQpxo1eirluCDgt%2B%2B00p6uxttrG4F%2FA39sJGZWZMfrcp6O6%2B5kaVzXJHAOj6DeSs8qw5o8oxAAAAAElFTkSuQmCC&labelColor=4e4e4e&color=2d2d2d
5-
[forge-commit]: https://github.com/MinecraftForge/MinecraftForge/commit/a8b243c
4+
[forge-version]: https://img.shields.io/badge/1.20.1--47.2.30-none?logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjCGJ1kDAAACoElEQVQ4T22SeU8aURTF%2FULGtNRWWVQY9lXABWldIDPIMgVbNgEVtaa0damiqGBdipXaJcY2ofEf4ycbTt97pVAabzK5b27u%2BZ377kwXgK77QthRy7OfXbeJM%2BttqKSXN8sdwbT%2FA0L7elmsYqrPHZmROLPh5YkV4oEBwaKuHj%2ByyJptLDoAhbq3O1V1XCVObY3FL24mfn5oRPrcwSCRfQOyNWcjVjZdCbtcdwcgXrXUspdOKbDN%2FXE9tiBJMhXHT60gUIT2dMhcDLMc3NVKQklz0QIkf5qlyEcO6Qs7yPhMJB4amDMFimQSmqNlE8SKAZFzDfxHfVILIIZ10sJ3OwIbcqSuiOjchkzNCboHev9o2YhgiUP8mxnLN24I6%2F3ghYdtQG5iUMpFBuCP9iKwLsfiLyeCp2rMnZgwX3NArGoxW1Ridl%2BBzLEVKa8KSxOqNmDdz0kFnxaLHhWEgAyZigWhHXL%2BpEDy2ozsDxv8vAzTnh7w5kcghqCaFmCT10of4iPIT2mRdPUh4HoCcVwBH%2F8Ac2kzUkEV5r3EfVSOvbAJa5NDyI0r2oDtWb1EClh%2BOoC3Pg7v%2FBw7p939yI4rsRW2Y3lKh01eh7WpIRyKZqzyjjYgPdIvlaMWRqYuG7wWryYHsRM0sFolZiPvQ3jheIwSmSBPdkByG%2FB6Wi3RYiVmRX7GiAPiUCRisii8D%2BjZNKvPBrHCW1GY0bAz6WkDCtOaSyKQFsi4K5NqNiZtehN2Y5uAShETqolhBqJXpfdPuPsuWwAaRdHSkxdc11mPqkGnyY4pyKbpl1GyJ0Pel7yqBoFcF3zqno5f%2Bd8ohYy9Sx7lzQpxo1eirluCDgt%2B%2B00p6uxttrG4F%2FA39sJGZWZMfrcp6O6%2B5kaVzXJHAOj6DeSs8qw5o8oxAAAAAElFTkSuQmCC&labelColor=4e4e4e&color=2d2d2d
5+
[forge-commit]: https://github.com/MinecraftForge/MinecraftForge/commit/1b036092
66

77
[build-status]: https://img.shields.io/github/actions/workflow/status/kettingpowered/Ketting-1-20-x/build_and_release.yml
88
[build-link]: https://github.com/kettingpowered/Ketting-1-20-x/actions

fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public enum ConfigValue {
3636
EARLY_WINDOW_FBSCALE("earlyWindowFBScale", 1, "Early window framebuffer scale"),
3737
EARLY_WINDOW_MAXIMIZED("earlyWindowMaximized", Boolean.FALSE, "Early window starts maximized"),
3838
EARLY_WINDOW_SKIP_GL_VERSIONS("earlyWindowSkipGLVersions", List.of(), "Skip specific GL versions, may help with buggy graphics card drivers"),
39-
EARLY_WINDOW_SQUIR("earlyWindowSquir", Boolean.FALSE, "Squir?")
39+
EARLY_WINDOW_SQUIR("earlyWindowSquir", Boolean.FALSE, "Squir?"),
40+
EARLY_WINDOW_SHOW_CPU("earlyWindowShowCPU", Boolean.FALSE, "Whether to show CPU usage stats in early window"),
4041
;
4142

4243
private final String entry;

fmlloader/src/main/java/net/minecraftforge/fml/loading/progress/ProgressMeter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public final class ProgressMeter {
1111
private final String name;
1212
private final int steps;
13-
private AtomicInteger current;
13+
private final AtomicInteger current;
1414
private Message label;
1515

1616
public ProgressMeter(String name, int steps, int current, Message label) {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ org.gradle.daemon=false
55

66
JAVA_VERSION=17
77
MC_VERSION=1.20.1
8-
FORGE_VERSION=47.2.23
8+
FORGE_VERSION=47.2.30
99
KETTING_VERSION=0.2.13
1010
MC_NEXT_VERSION=1.21
1111
MCP_VERSION=20230612.114412

patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@
17331733
+
17341734
+ @Override
17351735
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
1736-
+ if (this.isAlive() && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER) {
1736+
+ if (capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && this.isAlive()) {
17371737
+ if (facing == null) return handlers[2].cast();
17381738
+ else if (facing.getAxis().isVertical()) return handlers[0].cast();
17391739
+ else if (facing.getAxis().isHorizontal()) return handlers[1].cast();

patches/minecraft/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
+
125125
+ @Override
126126
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.core.Direction facing) {
127-
+ if (this.isAlive() && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && itemHandler != null)
127+
+ if (capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && itemHandler != null && this.isAlive())
128128
+ return itemHandler.cast();
129129
+ return super.getCapability(capability, facing);
130130
+ }

patches/minecraft/net/minecraft/world/entity/player/Player.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@
962962
+
963963
+ @Override
964964
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
965-
+ if (this.isAlive() && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER) {
965+
+ if (capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && this.isAlive()) {
966966
+ if (facing == null) return playerJoinedHandler.cast();
967967
+ else if (facing.getAxis().isVertical()) return playerMainHandler.cast();
968968
+ else if (facing.getAxis().isHorizontal()) return playerEquipmentHandler.cast();

patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
+
7676
+ @Override
7777
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.core.Direction facing) {
78-
+ if (this.isAlive() && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER)
78+
+ if (capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && this.isAlive())
7979
+ return itemHandler.cast();
8080
+ return super.getCapability(capability, facing);
8181
+ }

patches/minecraft/net/minecraft/world/entity/vehicle/ChestBoat.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
+
1010
+ @Override
1111
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.core.Direction facing) {
12-
+ if (this.isAlive() && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER)
12+
+ if (capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && this.isAlive())
1313
+ return itemHandler.cast();
1414
+ return super.getCapability(capability, facing);
1515
+ }

patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@
304304
});
305305
}
306306

307-
@@ -486,13 +_,69 @@
307+
@@ -486,13 +_,68 @@
308308
++i;
309309
}
310310

@@ -350,13 +350,12 @@
350350
+
351351
+ @Override
352352
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
353-
+ if (!this.remove && facing != null && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER) {
354-
+ if (facing == Direction.UP)
355-
+ return handlers[0].cast();
356-
+ else if (facing == Direction.DOWN)
357-
+ return handlers[1].cast();
358-
+ else
359-
+ return handlers[2].cast();
353+
+ if (capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && facing != null && !this.remove) {
354+
+ return switch (facing) {
355+
+ case UP -> handlers[0].cast();
356+
+ case DOWN -> handlers[1].cast();
357+
+ default -> handlers[2].cast();
358+
+ };
360359
+ }
361360
+ return super.getCapability(capability, facing);
362361
+ }

patches/minecraft/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
+ }
1818
+
1919
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> cap, @org.jetbrains.annotations.Nullable net.minecraft.core.Direction side) {
20-
+ if (!this.remove && cap == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER)
20+
+ if (cap == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && !this.remove)
2121
+ return itemHandler.cast();
2222
+ return super.getCapability(cap, side);
2323
+ }

patches/minecraft/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
}
189189
}
190190

191-
@@ -255,5 +_,34 @@
191+
@@ -255,5 +_,33 @@
192192

193193
protected AbstractContainerMenu createMenu(int p_58990_, Inventory p_58991_) {
194194
return new BrewingStandMenu(p_58990_, p_58991_, this, this.dataAccess);
@@ -199,13 +199,12 @@
199199
+
200200
+ @Override
201201
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing) {
202-
+ if (!this.remove && facing != null && capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER) {
203-
+ if (facing == Direction.UP)
204-
+ return handlers[0].cast();
205-
+ else if (facing == Direction.DOWN)
206-
+ return handlers[1].cast();
207-
+ else
208-
+ return handlers[2].cast();
202+
+ if (capability == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && facing != null && !this.remove) {
203+
+ return switch (facing) {
204+
+ case UP -> handlers[0].cast();
205+
+ case DOWN -> handlers[1].cast();
206+
+ default -> handlers[2].cast();
207+
+ };
209208
+ }
210209
+ return super.getCapability(capability, facing);
211210
+ }

patches/minecraft/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
+
5555
+ @Override
5656
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> cap, Direction side) {
57-
+ if (!this.remove && cap == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER) {
57+
+ if (cap == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && !this.remove) {
5858
+ if (this.chestHandler == null)
5959
+ this.chestHandler = net.minecraftforge.common.util.LazyOptional.of(this::createHandler);
6060
+ return this.chestHandler.cast();
@@ -64,10 +64,10 @@
6464
+
6565
+ private net.minecraftforge.items.IItemHandlerModifiable createHandler() {
6666
+ BlockState state = this.getBlockState();
67-
+ if (!(state.getBlock() instanceof ChestBlock)) {
67+
+ if (!(state.getBlock() instanceof ChestBlock chestBlock)) {
6868
+ return new net.minecraftforge.items.wrapper.InvWrapper(this);
6969
+ }
70-
+ Container inv = ChestBlock.getContainer((ChestBlock) state.getBlock(), state, getLevel(), getBlockPos(), true);
70+
+ Container inv = ChestBlock.getContainer(chestBlock, state, getLevel(), getBlockPos(), true);
7171
+ return new net.minecraftforge.items.wrapper.InvWrapper(inv == null ? this : inv);
7272
+ }
7373
+

patches/minecraft/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
+
9292
+ @Override
9393
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> cap, @org.jetbrains.annotations.Nullable net.minecraft.core.Direction side) {
94-
+ if (!this.remove && cap == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER)
94+
+ if (cap == net.minecraftforge.common.capabilities.ForgeCapabilities.ITEM_HANDLER && !this.remove)
9595
+ return itemHandler.cast();
9696
+ return super.getCapability(cap, side);
9797
+ }

src/main/java/net/minecraftforge/client/ConfigScreenHandler.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,30 @@
1313

1414
import java.util.Optional;
1515
import java.util.function.BiFunction;
16+
import java.util.function.Function;
1617

1718
public class ConfigScreenHandler
1819
{
19-
public record ConfigScreenFactory(BiFunction<Minecraft, Screen, Screen> screenFunction) implements IExtensionPoint<ConfigScreenFactory> {}
20+
/**
21+
* @param screenFunction A function that takes the {@link Minecraft} client instance and the mods screen as
22+
* arguments and returns your config screen to show when the player clicks the config button
23+
* for your mod on the mods screen.
24+
* <p>You should call {@link Minecraft#setScreen(Screen)} with the provided client instance
25+
* and mods screen for the action of your close button.</p>
26+
*/
27+
public record ConfigScreenFactory(BiFunction<Minecraft, Screen, Screen> screenFunction) implements IExtensionPoint<ConfigScreenFactory> {
28+
/**
29+
* @param screenFunction A function that takes the mods screen as an argument and returns your config screen to
30+
* show when the player clicks the config button for your mod on the mods screen.
31+
* <p>You should call {@link Minecraft#setScreen(Screen)} with the provided mods screen
32+
* for the action of your close button, using {@link Screen#minecraft} to get the client
33+
* instance.</p>
34+
*/
35+
public ConfigScreenFactory(Function<Screen, Screen> screenFunction) {
36+
this((mcClient, modsScreen) -> screenFunction.apply(modsScreen));
37+
}
38+
}
39+
2040
public static Optional<BiFunction<Minecraft, Screen, Screen>> getScreenFactoryFor(IModInfo selectedMod)
2141
{
2242
return ModList.get().getModContainerById(selectedMod.getModId()).

src/main/java/net/minecraftforge/client/gui/ModListScreen.java

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ Component getButtonText() {
8585
}
8686

8787
private static final int PADDING = 6;
88+
private static final int BUTTON_MARGIN = 1;
89+
private static final int NUM_BUTTONS = SortType.values().length;
8890

89-
private Screen parentScreen;
91+
private final Screen parentScreen;
9092

9193
private ModListWidget modList;
9294
private InfoPanel modInfo;
@@ -96,8 +98,6 @@ Component getButtonText() {
9698
private final List<IModInfo> unsortedMods;
9799
private Button configButton, openModsFolderButton, doneButton;
98100

99-
private int buttonMargin = 1;
100-
private int numButtons = SortType.values().length;
101101
private String lastFilterText = "";
102102

103103
private EditBox search;
@@ -109,8 +109,8 @@ public ModListScreen(Screen parentScreen)
109109
{
110110
super(Component.translatable("fml.menu.mods.title"));
111111
this.parentScreen = parentScreen;
112-
this.mods = Collections.unmodifiableList(ModList.get().getMods());
113-
this.unsortedMods = Collections.unmodifiableList(this.mods);
112+
this.mods = ModList.get().getMods();
113+
this.unsortedMods = List.copyOf(this.mods);
114114
}
115115

116116
class InfoPanel extends ScrollPanel {
@@ -207,18 +207,18 @@ private Style findTextLine(final int mouseX, final int mouseY) {
207207
if (!isMouseOver(mouseX, mouseY))
208208
return null;
209209

210-
double offset = (mouseY - top) + border + scrollDistance + 1;
210+
double offset = (mouseY - top - PADDING - border) + scrollDistance;
211211
if (logoPath != null) {
212212
offset -= 50;
213213
}
214214
if (offset <= 0)
215215
return null;
216216

217217
int lineIdx = (int) (offset / font.lineHeight);
218-
if (lineIdx >= lines.size() || lineIdx < 1)
218+
if (lineIdx >= lines.size() || lineIdx < 0)
219219
return null;
220220

221-
FormattedCharSequence line = lines.get(lineIdx-1);
221+
FormattedCharSequence line = lines.get(lineIdx);
222222
if (line != null)
223223
{
224224
return font.getSplitter().componentStyleAtWidth(line, mouseX - left - border);
@@ -255,7 +255,7 @@ public void init()
255255
listWidth = Math.max(listWidth,getFontRenderer().width(MavenVersionStringHelper.artifactVersionToString(mod.getVersion())) + 5);
256256
}
257257
listWidth = Math.max(Math.min(listWidth, width/3), 100);
258-
listWidth += listWidth % numButtons != 0 ? (numButtons - listWidth % numButtons) : 0;
258+
listWidth += listWidth % NUM_BUTTONS != 0 ? (NUM_BUTTONS - listWidth % NUM_BUTTONS) : 0;
259259

260260
int modInfoWidth = this.width - this.listWidth - (PADDING * 3);
261261
int doneButtonWidth = Math.min(modInfoWidth, 200);
@@ -284,13 +284,13 @@ public void init()
284284
search.setCanLoseFocus(true);
285285
configButton.active = false;
286286

287-
final int width = listWidth / numButtons;
287+
final int width = listWidth / NUM_BUTTONS;
288288
int x = PADDING;
289-
addRenderableWidget(SortType.NORMAL.button = Button.builder(SortType.NORMAL.getButtonText(), b -> resortMods(SortType.NORMAL)).bounds(x, PADDING, width - buttonMargin, 20).build());
290-
x += width + buttonMargin;
291-
addRenderableWidget(SortType.A_TO_Z.button = Button.builder(SortType.A_TO_Z.getButtonText(), b -> resortMods(SortType.A_TO_Z)).bounds(x, PADDING, width - buttonMargin, 20).build());
292-
x += width + buttonMargin;
293-
addRenderableWidget(SortType.Z_TO_A.button = Button.builder(SortType.Z_TO_A.getButtonText(), b -> resortMods(SortType.Z_TO_A)).bounds(x, PADDING, width - buttonMargin, 20).build());
289+
addRenderableWidget(SortType.NORMAL.button = Button.builder(SortType.NORMAL.getButtonText(), b -> resortMods(SortType.NORMAL)).bounds(x, PADDING, width - BUTTON_MARGIN, 20).build());
290+
x += width + BUTTON_MARGIN;
291+
addRenderableWidget(SortType.A_TO_Z.button = Button.builder(SortType.A_TO_Z.getButtonText(), b -> resortMods(SortType.A_TO_Z)).bounds(x, PADDING, width - BUTTON_MARGIN, 20).build());
292+
x += width + BUTTON_MARGIN;
293+
addRenderableWidget(SortType.Z_TO_A.button = Button.builder(SortType.Z_TO_A.getButtonText(), b -> resortMods(SortType.Z_TO_A)).bounds(x, PADDING, width - BUTTON_MARGIN, 20).build());
294294
resortMods(SortType.NORMAL);
295295
updateCache();
296296
}
@@ -341,8 +341,12 @@ public <T extends ObjectSelectionList.Entry<T>> void buildModList(Consumer<T> mo
341341

342342
private void reloadMods()
343343
{
344-
this.mods = this.unsortedMods.stream().
345-
filter(mi->StringUtils.toLowerCase(stripControlCodes(mi.getDisplayName())).contains(StringUtils.toLowerCase(search.getValue()))).collect(Collectors.toList());
344+
this.mods = this.unsortedMods
345+
.stream()
346+
.filter(mi ->
347+
StringUtils.toLowerCase(stripControlCodes(mi.getDisplayName()))
348+
.contains(StringUtils.toLowerCase(search.getValue()))
349+
).collect(Collectors.toList());
346350
lastFilterText = search.getValue();
347351
}
348352

@@ -464,7 +468,7 @@ public void upload() {
464468
}
465469
*/
466470

467-
if ((vercheck.status() == VersionChecker.Status.OUTDATED || vercheck.status() == VersionChecker.Status.BETA_OUTDATED) && vercheck.changes().size() > 0)
471+
if ((vercheck.status() == VersionChecker.Status.OUTDATED || vercheck.status() == VersionChecker.Status.BETA_OUTDATED) && !vercheck.changes().isEmpty())
468472
{
469473
lines.add(null);
470474
lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.changelogheader"));

src/main/java/net/minecraftforge/common/ForgeConfigSpec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public <T> ConfigValue<T> defineInList(List<String> path, T defaultValue, Collec
346346
return defineInList(path, () -> defaultValue, acceptableValues);
347347
}
348348
public <T> ConfigValue<T> defineInList(List<String> path, Supplier<T> defaultSupplier, Collection<? extends T> acceptableValues) {
349-
return define(path, defaultSupplier, acceptableValues::contains);
349+
return define(path, defaultSupplier, o -> o != null && acceptableValues.contains(o));
350350
}
351351
public <T> ConfigValue<List<? extends T>> defineList(String path, List<? extends T> defaultValue, Predicate<Object> elementValidator) {
352352
return defineList(split(path), defaultValue, elementValidator);

0 commit comments

Comments
 (0)