Update forge mappings to 20201028-1.16.3 (#7435)

This commit is contained in:
David Quintana authored and GitHub committed 2020-10-29 01:11:57 +01:00
1 parent 6e0e67b14d
commit 53eedb0f10
93 files changed
+598 -588

No files matched your search

@@ -29,7 +29,7 @@ public class TextComponentMessageFormatHandler {
public static int handle(final TranslationTextComponent parent, final List<ITextProperties> children, final Object[] formatArgs, final String format) {
try {
StringTextComponent component = new StringTextComponent(ForgeI18n.parseFormat(format, formatArgs));
component.getStyle().func_240717_a_(parent.getStyle());
component.getStyle().mergeStyle(parent.getStyle());
children.add(component);
return format.length();
} catch (IllegalArgumentException ex) {
@@ -170,7 +170,7 @@ public class ClientHooks
}
Minecraft.getInstance().getTextureManager().bindTexture(iconSheet);
AbstractGui.func_238466_a_(mStack, x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256);
AbstractGui.blit(mStack, x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256);
if(relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26)
//TODO using StringTextComponent here is a hack, we should be using TranslationTextComponents.
@@ -103,7 +103,7 @@ public class ClientModLoader
createRunnableWithCatch(()->ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), new SpacedRunnable(earlyLoaderGUI::renderTick))).run();
if (error == null) {
ResourcePackLoader.loadResourcePacks(defaultResourcePacks, ClientModLoader::buildPackFinder);
DatapackCodec.field_234880_a_.addModPacks(ResourcePackLoader.getPackNames());
DatapackCodec.VANILLA_CODEC.addModPacks(ResourcePackLoader.getPackNames());
mcResourceManager.addReloadListener(ClientModLoader::onResourceReload);
mcResourceManager.addReloadListener(BrandingControl.resourceManagerReloadListener());
ModelLoaderRegistry.init();
@@ -215,7 +215,7 @@ public class ClientModLoader
IModInfo mod = e.getKey().getModInfos().get(0);
if (Objects.equals(mod.getModId(), "minecraft")) continue; // skip the minecraft "mod"
final String name = "mod:" + mod.getModId();
final ResourcePackInfo packInfo = ResourcePackInfo.createResourcePack(name, false, e::getValue, factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.field_232625_a_);
final ResourcePackInfo packInfo = ResourcePackInfo.createResourcePack(name, false, e::getValue, factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.PLAIN);
if (packInfo == null) {
// Vanilla only logs an error, instead of propagating, so handle null and warn that something went wrong
ModLoader.get().addWarning(new ModLoadingWarning(mod, ModLoadingStage.ERROR, "fml.modloading.brokenresources", e.getKey()));
@@ -231,7 +231,7 @@ public class ClientModLoader
}
final ResourcePackInfo packInfo = ResourcePackInfo.createResourcePack("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources",
new PackMetadataSection(new TranslationTextComponent("fml.resources.modresources", hiddenPacks.size()), 6),
hiddenPacks), factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.field_232625_a_);
hiddenPacks), factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.PLAIN);
consumer.accept(packInfo);
}
}
@@ -469,7 +469,7 @@ public class GuiUtils
for (ITextProperties textLine : textLines)
{
int textLineWidth = font.func_238414_a_(textLine);
int textLineWidth = font.getStringPropertyWidth(textLine);
if (textLineWidth > tooltipTextWidth)
tooltipTextWidth = textLineWidth;
}
@@ -504,13 +504,13 @@ public class GuiUtils
for (int i = 0; i < textLines.size(); i++)
{
ITextProperties textLine = textLines.get(i);
List<ITextProperties> wrappedLine = font.func_238420_b_().func_238362_b_(textLine, tooltipTextWidth, Style.field_240709_b_);
List<ITextProperties> wrappedLine = font.getCharacterManager().func_238362_b_(textLine, tooltipTextWidth, Style.EMPTY);
if (i == 0)
titleLinesCount = wrappedLine.size();
for (ITextProperties line : wrappedLine)
{
int lineWidth = font.func_238414_a_(line);
int lineWidth = font.getStringPropertyWidth(line);
if (lineWidth > wrappedTooltipWidth)
wrappedTooltipWidth = lineWidth;
wrappedTextLines.add(line);
@@ -638,6 +638,6 @@ public class GuiUtils
if (centerX) x += (w - boundsWidth) / 2;
}
AbstractGui.func_238466_a_(mStack, x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight);
AbstractGui.blit(mStack, x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight);
}
}
@@ -70,72 +70,72 @@ public class LoadingErrorScreen extends ErrorScreen {
}
@Override
public void func_231160_c_()
public void init()
{
super.func_231160_c_();
this.field_230710_m_.clear();
this.field_230705_e_.clear();
super.init();
this.buttons.clear();
this.children.clear();
this.errorHeader = new StringTextComponent(TextFormatting.RED + ForgeI18n.parseMessage("fml.loadingerrorscreen.errorheader", this.modLoadErrors.size()) + TextFormatting.RESET);
this.warningHeader = new StringTextComponent(TextFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadErrors.size()) + TextFormatting.RESET);
int yOffset = 46;
this.func_230480_a_(new ExtendedButton(50, this.field_230709_l_ - yOffset, this.field_230708_k_ / 2 - 55, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.open.mods.folder")), b -> Util.getOSType().openFile(modsDir.toFile())));
this.func_230480_a_(new ExtendedButton(this.field_230708_k_ / 2 + 5, this.field_230709_l_ - yOffset, this.field_230708_k_ / 2 - 55, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), b -> Util.getOSType().openFile(logFile.toFile())));
this.addButton(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.open.mods.folder")), b -> Util.getOSType().openFile(modsDir.toFile())));
this.addButton(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), b -> Util.getOSType().openFile(logFile.toFile())));
if (this.modLoadErrors.isEmpty()) {
this.func_230480_a_(new ExtendedButton(this.field_230708_k_ / 4, this.field_230709_l_ - 24, this.field_230708_k_ / 2, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.continue.launch")), b -> {
this.addButton(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.continue.launch")), b -> {
ClientHooks.logMissingTextureErrors();
this.field_230706_i_.displayGuiScreen(null);
this.minecraft.displayGuiScreen(null);
}));
} else {
this.func_230480_a_(new ExtendedButton(this.field_230708_k_ / 4, this.field_230709_l_ - 24, this.field_230708_k_ / 2, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.open.file", dumpedLocation.getFileName())), b -> Util.getOSType().openFile(dumpedLocation.toFile())));
this.addButton(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, new StringTextComponent(ForgeI18n.parseMessage("fml.button.open.file", dumpedLocation.getFileName())), b -> Util.getOSType().openFile(dumpedLocation.toFile())));
}
this.entryList = new LoadingEntryList(this, this.modLoadErrors, this.modLoadWarnings);
this.field_230705_e_.add(this.entryList);
this.func_231035_a_(this.entryList);
this.children.add(this.entryList);
this.setListener(this.entryList);
}
@Override
public void func_230430_a_(MatrixStack mStack, int mouseX, int mouseY, float partialTicks)
public void render(MatrixStack mStack, int mouseX, int mouseY, float partialTicks)
{
this.func_230446_a_(mStack);
this.entryList.func_230430_a_(mStack, mouseX, mouseY, partialTicks);
drawMultiLineCenteredString(mStack, field_230712_o_, this.modLoadErrors.isEmpty() ? warningHeader : errorHeader, this.field_230708_k_ / 2, 10);
this.field_230710_m_.forEach(button -> button.func_230430_a_(mStack, mouseX, mouseY, partialTicks));
this.renderBackground(mStack);
this.entryList.render(mStack, mouseX, mouseY, partialTicks);
drawMultiLineCenteredString(mStack, font, this.modLoadErrors.isEmpty() ? warningHeader : errorHeader, this.width / 2, 10);
this.buttons.forEach(button -> button.render(mStack, mouseX, mouseY, partialTicks));
}
private void drawMultiLineCenteredString(MatrixStack mStack, FontRenderer fr, ITextComponent str, int x, int y) {
for (IReorderingProcessor s : fr.func_238425_b_(str, this.field_230708_k_)) {
for (IReorderingProcessor s : fr.trimStringToWidth(str, this.width)) {
fr.func_238407_a_(mStack, s, (float) (x - fr.func_243245_a(s) / 2.0), y, 0xFFFFFF);
y+=fr.FONT_HEIGHT;
}
}
public static class LoadingEntryList extends ExtendedList<LoadingEntryList.LoadingMessageEntry> {
LoadingEntryList(final LoadingErrorScreen parent, final List<ModLoadingException> errors, final List<ModLoadingWarning> warnings) {
super(parent.field_230706_i_, parent.field_230708_k_, parent.field_230709_l_, 35, parent.field_230709_l_ - 50, 2 * parent.field_230706_i_.fontRenderer.FONT_HEIGHT + 8);
super(parent.minecraft, parent.width, parent.height, 35, parent.height - 50, 2 * parent.minecraft.fontRenderer.FONT_HEIGHT + 8);
boolean both = !errors.isEmpty() && !warnings.isEmpty();
if (both)
func_230513_b_(new LoadingMessageEntry(parent.errorHeader, true));
errors.forEach(e->func_230513_b_(new LoadingMessageEntry(new StringTextComponent(e.formatToString()))));
addEntry(new LoadingMessageEntry(parent.errorHeader, true));
errors.forEach(e->addEntry(new LoadingMessageEntry(new StringTextComponent(e.formatToString()))));
if (both) {
int maxChars = (this.field_230670_d_ - 10) / parent.field_230706_i_.fontRenderer.getStringWidth("-");
func_230513_b_(new LoadingMessageEntry(new StringTextComponent("\n" + Strings.repeat("-", maxChars) + "\n")));
func_230513_b_(new LoadingMessageEntry(parent.warningHeader, true));
int maxChars = (this.width - 10) / parent.minecraft.fontRenderer.getStringWidth("-");
addEntry(new LoadingMessageEntry(new StringTextComponent("\n" + Strings.repeat("-", maxChars) + "\n")));
addEntry(new LoadingMessageEntry(parent.warningHeader, true));
}
warnings.forEach(w->func_230513_b_(new LoadingMessageEntry(new StringTextComponent(w.formatToString()))));
warnings.forEach(w->addEntry(new LoadingMessageEntry(new StringTextComponent(w.formatToString()))));
}
@Override
protected int func_230952_d_()
protected int getScrollbarPosition()
{
return this.getRight() - 6;
}
@Override
public int func_230949_c_()
public int getRowWidth()
{
return this.field_230670_d_;
return this.width;
}
public class LoadingMessageEntry extends ExtendedList.AbstractListEntry<LoadingMessageEntry> {
@@ -152,13 +152,13 @@ public class LoadingErrorScreen extends ErrorScreen {
}
@Override
public void func_230432_a_(MatrixStack mStack, int entryIdx, int top, int left, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean p_194999_5_, final float partialTicks) {
public void render(MatrixStack mStack, int entryIdx, int top, int left, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean p_194999_5_, final float partialTicks) {
FontRenderer font = Minecraft.getInstance().fontRenderer;
final List<IReorderingProcessor> strings = font.func_238425_b_(message, LoadingEntryList.this.field_230670_d_);
final List<IReorderingProcessor> strings = font.trimStringToWidth(message, LoadingEntryList.this.width);
int y = top + 2;
for (int i = 0; i < Math.min(strings.size(), 2); i++) {
if (center)
font.func_238422_b_(mStack, strings.get(i), left + (field_230670_d_) - font.func_243245_a(strings.get(i)) / 2F, y, 0xFFFFFF);
font.func_238422_b_(mStack, strings.get(i), left + (width) - font.func_243245_a(strings.get(i)) / 2F, y, 0xFFFFFF);
else
font.func_238422_b_(mStack, strings.get(i), left + 5, y, 0xFFFFFF);
y += font.FONT_HEIGHT;
@@ -167,7 +167,7 @@ public class ModListScreen extends Screen
int maxTextLength = this.width - 12;
if (maxTextLength >= 0)
{
ret.addAll(LanguageMap.getInstance().func_244260_a(field_230712_o_.func_238420_b_().func_238362_b_(chat, maxTextLength, Style.field_240709_b_)));
ret.addAll(LanguageMap.getInstance().func_244260_a(font.getCharacterManager().func_238362_b_(chat, maxTextLength, Style.EMPTY)));
}
}
return ret;
@@ -177,7 +177,7 @@ public class ModListScreen extends Screen
public int getContentHeight()
{
int height = 50;
height += (lines.size() * field_230712_o_.FONT_HEIGHT);
height += (lines.size() * font.FONT_HEIGHT);
if (height < this.bottom - this.top - 8)
height = this.bottom - this.top - 8;
return height;
@@ -186,7 +186,7 @@ public class ModListScreen extends Screen
@Override
protected int getScrollAmount()
{
return field_230712_o_.FONT_HEIGHT * 3;
return font.FONT_HEIGHT * 3;
}
@Override
@@ -207,16 +207,16 @@ public class ModListScreen extends Screen
if (line != null)
{
RenderSystem.enableBlend();
ModListScreen.this.field_230712_o_.func_238407_a_(mStack, line, left + PADDING, relativeY, 0xFFFFFF);
ModListScreen.this.font.func_238407_a_(mStack, line, left + PADDING, relativeY, 0xFFFFFF);
RenderSystem.disableAlphaTest();
RenderSystem.disableBlend();
}
relativeY += field_230712_o_.FONT_HEIGHT;
relativeY += font.FONT_HEIGHT;
}
final Style component = findTextLine(mouseX, mouseY);
if (component!=null) {
ModListScreen.this.func_238653_a_(mStack, component, mouseX, mouseY);
ModListScreen.this.renderComponentHoverEffect(mStack, component, mouseX, mouseY);
}
}
@@ -228,26 +228,26 @@ public class ModListScreen extends Screen
if (offset <= 0)
return null;
int lineIdx = (int) (offset / field_230712_o_.FONT_HEIGHT);
int lineIdx = (int) (offset / font.FONT_HEIGHT);
if (lineIdx >= lines.size() || lineIdx < 1)
return null;
IReorderingProcessor line = lines.get(lineIdx-1);
if (line != null)
{
return field_230712_o_.func_238420_b_().func_243239_a(line, mouseX);
return font.getCharacterManager().func_243239_a(line, mouseX);
}
return null;
}
@Override
public boolean func_231044_a_(final double mouseX, final double mouseY, final int button) {
public boolean mouseClicked(final double mouseX, final double mouseY, final int button) {
final Style component = findTextLine((int) mouseX, (int) mouseY);
if (component != null) {
ModListScreen.this.func_230455_a_(component);
ModListScreen.this.handleComponentClicked(component);
return true;
}
return super.func_231044_a_(mouseX, mouseY, button);
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
@@ -256,50 +256,50 @@ public class ModListScreen extends Screen
}
@Override
public void func_231160_c_()
public void init()
{
for (ModInfo mod : mods)
{
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getDisplayName()) + 10);
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(MavenVersionStringHelper.artifactVersionToString(mod.getVersion())) + 5);
}
listWidth = Math.max(Math.min(listWidth, field_230708_k_/3), 100);
listWidth = Math.max(Math.min(listWidth, width/3), 100);
listWidth += listWidth % numButtons != 0 ? (numButtons - listWidth % numButtons) : 0;
int modInfoWidth = this.field_230708_k_ - this.listWidth - (PADDING * 3);
int modInfoWidth = this.width - this.listWidth - (PADDING * 3);
int doneButtonWidth = Math.min(modInfoWidth, 200);
int y = this.field_230709_l_ - 20 - PADDING;
this.func_230480_a_(new Button(((listWidth + PADDING + this.field_230708_k_ - doneButtonWidth) / 2), y, doneButtonWidth, 20,
new TranslationTextComponent("gui.done"), b -> ModListScreen.this.func_231175_as__()));
this.func_230480_a_(this.openModsFolderButton = new Button(6, y, this.listWidth, 20,
int y = this.height - 20 - PADDING;
this.addButton(new Button(((listWidth + PADDING + this.width - doneButtonWidth) / 2), y, doneButtonWidth, 20,
new TranslationTextComponent("gui.done"), b -> ModListScreen.this.closeScreen()));
this.addButton(this.openModsFolderButton = new Button(6, y, this.listWidth, 20,
new TranslationTextComponent("fml.menu.mods.openmodsfolder"), b -> Util.getOSType().openFile(FMLPaths.MODSDIR.get().toFile())));
y -= 20 + PADDING;
this.func_230480_a_(this.configButton = new Button(6, y, this.listWidth, 20,
this.addButton(this.configButton = new Button(6, y, this.listWidth, 20,
new TranslationTextComponent("fml.menu.mods.config"), b -> ModListScreen.this.displayModConfig()));
this.configButton.field_230693_o_ = false;
this.configButton.active = false;
y -= 14 + PADDING + 1;
search = new TextFieldWidget(getFontRenderer(), PADDING + 1, y, listWidth - 2, 14, new TranslationTextComponent("fml.menu.mods.search"));
int fullButtonHeight = PADDING + 20 + PADDING;
this.modList = new ModListWidget(this, listWidth, fullButtonHeight, search.field_230691_m_ - getFontRenderer().FONT_HEIGHT - PADDING);
this.modList.func_230959_g_(6);
this.modList = new ModListWidget(this, listWidth, fullButtonHeight, search.y - getFontRenderer().FONT_HEIGHT - PADDING);
this.modList.setLeftPos(6);
this.modInfo = new InfoPanel(this.field_230706_i_, modInfoWidth, this.field_230709_l_ - PADDING - fullButtonHeight, PADDING);
this.modInfo = new InfoPanel(this.minecraft, modInfoWidth, this.height - PADDING - fullButtonHeight, PADDING);
field_230705_e_.add(search);
field_230705_e_.add(modList);
field_230705_e_.add(modInfo);
children.add(search);
children.add(modList);
children.add(modInfo);
search.setFocused2(false);
search.setCanLoseFocus(true);
final int width = listWidth / numButtons;
int x = PADDING;
func_230480_a_(SortType.NORMAL.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.NORMAL.getButtonText(), b -> resortMods(SortType.NORMAL)));
addButton(SortType.NORMAL.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.NORMAL.getButtonText(), b -> resortMods(SortType.NORMAL)));
x += width + buttonMargin;
func_230480_a_(SortType.A_TO_Z.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.A_TO_Z.getButtonText(), b -> resortMods(SortType.A_TO_Z)));
addButton(SortType.A_TO_Z.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.A_TO_Z.getButtonText(), b -> resortMods(SortType.A_TO_Z)));
x += width + buttonMargin;
func_230480_a_(SortType.Z_TO_A.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.Z_TO_A.getButtonText(), b -> resortMods(SortType.Z_TO_A)));
addButton(SortType.Z_TO_A.button = new Button(x, PADDING, width - buttonMargin, 20, SortType.Z_TO_A.getButtonText(), b -> resortMods(SortType.Z_TO_A)));
resortMods(SortType.NORMAL);
updateCache();
}
@@ -309,7 +309,7 @@ public class ModListScreen extends Screen
if (selected == null) return;
try
{
ConfigGuiHandler.getGuiFactoryFor(selected.getInfo()).map(f->f.apply(this.field_230706_i_, this)).ifPresent(newScreen -> this.field_230706_i_.displayGuiScreen(newScreen));
ConfigGuiHandler.getGuiFactoryFor(selected.getInfo()).map(f->f.apply(this.minecraft, this)).ifPresent(newScreen -> this.minecraft.displayGuiScreen(newScreen));
}
catch (final Exception e)
{
@@ -318,10 +318,10 @@ public class ModListScreen extends Screen
}
@Override
public void func_231023_e_()
public void tick()
{
search.tick();
modList.func_241215_a_(selected);
modList.setSelected(selected);
if (!search.getText().equals(lastFilterText))
{
@@ -336,7 +336,7 @@ public class ModListScreen extends Screen
modList.refreshList();
if (selected != null)
{
selected = modList.func_231039_at__().stream().filter(e -> e.getInfo() == selected.getInfo()).findFirst().orElse(null);
selected = modList.getEventListeners().stream().filter(e -> e.getInfo() == selected.getInfo()).findFirst().orElse(null);
updateCache();
}
sorted = true;
@@ -362,33 +362,33 @@ public class ModListScreen extends Screen
for (SortType sort : SortType.values())
{
if (sort.button != null)
sort.button.field_230693_o_ = sortType != sort;
sort.button.active = sortType != sort;
}
sorted = false;
}
@Override
public void func_230430_a_(MatrixStack mStack, int mouseX, int mouseY, float partialTicks)
public void render(MatrixStack mStack, int mouseX, int mouseY, float partialTicks)
{
this.modList.func_230430_a_(mStack, mouseX, mouseY, partialTicks);
this.modList.render(mStack, mouseX, mouseY, partialTicks);
if (this.modInfo != null)
this.modInfo.func_230430_a_(mStack, mouseX, mouseY, partialTicks);
this.modInfo.render(mStack, mouseX, mouseY, partialTicks);
ITextComponent text = new TranslationTextComponent("fml.menu.mods.search");
int x = modList.getLeft() + ((modList.getRight() - modList.getLeft()) / 2) - (getFontRenderer().func_238414_a_(text) / 2);
getFontRenderer().func_238422_b_(mStack, text.func_241878_f(), x, search.field_230691_m_ - getFontRenderer().FONT_HEIGHT, 0xFFFFFF);
this.search.func_230430_a_(mStack, mouseX , mouseY, partialTicks);
super.func_230430_a_(mStack, mouseX, mouseY, partialTicks);
int x = modList.getLeft() + ((modList.getRight() - modList.getLeft()) / 2) - (getFontRenderer().getStringPropertyWidth(text) / 2);
getFontRenderer().func_238422_b_(mStack, text.func_241878_f(), x, search.y - getFontRenderer().FONT_HEIGHT, 0xFFFFFF);
this.search.render(mStack, mouseX , mouseY, partialTicks);
super.render(mStack, mouseX, mouseY, partialTicks);
}
public Minecraft getMinecraftInstance()
{
return field_230706_i_;
return minecraft;
}
public FontRenderer getFontRenderer()
{
return field_230712_o_;
return font;
}
public void setSelected(ModListWidget.ModEntry entry)
@@ -400,19 +400,19 @@ public class ModListScreen extends Screen
private void updateCache()
{
if (selected == null) {
this.configButton.field_230693_o_ = false;
this.configButton.active = false;
this.modInfo.clearInfo();
return;
}
ModInfo selectedMod = selected.getInfo();
this.configButton.field_230693_o_ = ConfigGuiHandler.getGuiFactoryFor(selectedMod).isPresent();
this.configButton.active = ConfigGuiHandler.getGuiFactoryFor(selectedMod).isPresent();
List<String> lines = new ArrayList<>();
VersionChecker.CheckResult vercheck = VersionChecker.getResult(selectedMod);
@SuppressWarnings("resource")
Pair<ResourceLocation, Size2i> logoData = selectedMod.getLogoFile().map(logoFile->
{
TextureManager tm = this.field_230706_i_.getTextureManager();
TextureManager tm = this.minecraft.getTextureManager();
final ModFileResourcePack resourcePack = ResourcePackLoader.getResourcePackFor(selectedMod.getModId())
.orElse(ResourcePackLoader.getResourcePackFor("forge").
orElseThrow(()->new RuntimeException("Can't find forge, WHAT!")));
@@ -486,12 +486,12 @@ public class ModListScreen extends Screen
}
@Override
public void func_231152_a_(Minecraft mc, int width, int height)
public void resize(Minecraft mc, int width, int height)
{
String s = this.search.getText();
SortType sort = this.sortType;
ModListWidget.ModEntry selected = this.selected;
this.func_231158_b_(mc, width, height);
this.init(mc, width, height);
this.search.setText(s);
this.selected = selected;
if (!this.search.getText().isEmpty())
@@ -502,8 +502,8 @@ public class ModListScreen extends Screen
}
@Override
public void func_231175_as__()
public void closeScreen()
{
this.field_230706_i_.displayGuiScreen(this.parentScreen);
this.minecraft.displayGuiScreen(this.parentScreen);
}
}
@@ -47,25 +47,25 @@ public class ExtendedButton extends Button
* Draws this button to the screen.
*/
@Override
public void func_230431_b_(MatrixStack mStack, int mouseX, int mouseY, float partial)
public void renderButton(MatrixStack mStack, int mouseX, int mouseY, float partial)
{
if (this.field_230694_p_)
if (this.visible)
{
Minecraft mc = Minecraft.getInstance();
this.field_230692_n_ = mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + this.field_230688_j_ && mouseY < this.field_230691_m_ + this.field_230689_k_;
int k = this.func_230989_a_(this.func_230449_g_());
GuiUtils.drawContinuousTexturedBox(mStack, field_230687_i_, this.field_230690_l_, this.field_230691_m_, 0, 46 + k * 20, this.field_230688_j_, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_());
this.func_230441_a_(mStack, mc, mouseX, mouseY);
this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int k = this.getYImage(this.isHovered());
GuiUtils.drawContinuousTexturedBox(mStack, WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
this.renderBg(mStack, mc, mouseX, mouseY);
ITextComponent buttonText = this.func_230458_i_();
int strWidth = mc.fontRenderer.func_238414_a_(buttonText);
ITextComponent buttonText = this.getMessage();
int strWidth = mc.fontRenderer.getStringPropertyWidth(buttonText);
int ellipsisWidth = mc.fontRenderer.getStringWidth("...");
if (strWidth > field_230688_j_ - 6 && strWidth > ellipsisWidth)
if (strWidth > width - 6 && strWidth > ellipsisWidth)
//TODO, srg names make it hard to figure out how to append to an ITextProperties from this trim operation, wraping this in StringTextComponent is kinda dirty.
buttonText = new StringTextComponent(mc.fontRenderer.func_238417_a_(buttonText, field_230688_j_ - 6 - ellipsisWidth).getString() + "...");
buttonText = new StringTextComponent(mc.fontRenderer.func_238417_a_(buttonText, width - 6 - ellipsisWidth).getString() + "...");
func_238472_a_(mStack, mc.fontRenderer, buttonText, this.field_230690_l_ + this.field_230688_j_ / 2, this.field_230691_m_ + (this.field_230689_k_ - 8) / 2, getFGColor());
drawCenteredString(mStack, mc.fontRenderer, buttonText, this.x + this.width / 2, this.y + (this.height - 8) / 2, getFGColor());
}
}
}
@@ -47,33 +47,33 @@ public class ModListWidget extends ExtendedList<ModListWidget.ModEntry>
public ModListWidget(ModListScreen parent, int listWidth, int top, int bottom)
{
super(parent.getMinecraftInstance(), listWidth, parent.field_230709_l_, top, bottom, parent.getFontRenderer().FONT_HEIGHT * 2 + 8);
super(parent.getMinecraftInstance(), listWidth, parent.height, top, bottom, parent.getFontRenderer().FONT_HEIGHT * 2 + 8);
this.parent = parent;
this.listWidth = listWidth;
this.refreshList();
}
@Override
protected int func_230952_d_()
protected int getScrollbarPosition()
{
return this.listWidth;
}
@Override
public int func_230949_c_()
public int getRowWidth()
{
return this.listWidth;
}
public void refreshList() {
this.func_230963_j_();
parent.buildModList(this::func_230513_b_, mod->new ModEntry(mod, this.parent));
this.clearEntries();
parent.buildModList(this::addEntry, mod->new ModEntry(mod, this.parent));
}
@Override
protected void func_230433_a_(MatrixStack mStack)
protected void renderBackground(MatrixStack mStack)
{
this.parent.func_230446_a_(mStack);
this.parent.renderBackground(mStack);
}
public class ModEntry extends ExtendedList.AbstractListEntry<ModEntry> {
@@ -86,7 +86,7 @@ public class ModListWidget extends ExtendedList<ModListWidget.ModEntry>
}
@Override
public void func_230432_a_(MatrixStack mStack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks)
public void render(MatrixStack mStack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks)
{
ITextComponent name = new StringTextComponent(stripControlCodes(modInfo.getDisplayName()));
ITextComponent version = new StringTextComponent(stripControlCodes(MavenVersionStringHelper.artifactVersionToString(modInfo.getVersion())));
@@ -100,16 +100,16 @@ public class ModListWidget extends ExtendedList<ModListWidget.ModEntry>
Minecraft.getInstance().getTextureManager().bindTexture(VERSION_CHECK_ICONS);
RenderSystem.color4f(1, 1, 1, 1);
RenderSystem.pushMatrix();
AbstractGui.func_238463_a_(mStack, getLeft() + field_230670_d_ - 12, top + entryHeight / 4, vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
AbstractGui.blit(mStack, getLeft() + width - 12, top + entryHeight / 4, vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
RenderSystem.popMatrix();
}
}
@Override
public boolean func_231044_a_(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_)
public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_)
{
parent.setSelected(this);
ModListWidget.this.func_241215_a_(this);
ModListWidget.this.setSelected(this);
return false;
}
@@ -82,11 +82,11 @@ public class Slider extends ExtendedButton
precision = 0;
}
func_238482_a_(new StringTextComponent("").func_230529_a_(dispString).func_240702_b_(val).func_230529_a_(suffix));
setMessage(new StringTextComponent("").append(dispString).appendString(val).append(suffix));
drawString = drawStr;
if(!drawString)
func_238482_a_(new StringTextComponent(""));
setMessage(new StringTextComponent(""));
}
public Slider(int xPos, int yPos, ITextComponent displayStr, double minVal, double maxVal, double currentVal, IPressable handler, ISlider par)
@@ -99,7 +99,7 @@ public class Slider extends ExtendedButton
* this button.
*/
@Override
public int func_230989_a_(boolean par1)
public int getYImage(boolean par1)
{
return 0;
}
@@ -108,17 +108,17 @@ public class Slider extends ExtendedButton
* Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e).
*/
@Override
protected void func_230441_a_(MatrixStack mStack, Minecraft par1Minecraft, int par2, int par3)
protected void renderBg(MatrixStack mStack, Minecraft par1Minecraft, int par2, int par3)
{
if (this.field_230694_p_)
if (this.visible)
{
if (this.dragging)
{
this.sliderValue = (par2 - (this.field_230690_l_ + 4)) / (float)(this.field_230688_j_ - 8);
this.sliderValue = (par2 - (this.x + 4)) / (float)(this.width - 8);
updateSlider();
}
GuiUtils.drawContinuousTexturedBox(mStack, field_230687_i_, this.field_230690_l_ + (int)(this.sliderValue * (float)(this.field_230688_j_ - 8)), this.field_230691_m_, 0, 66, 8, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_());
GuiUtils.drawContinuousTexturedBox(mStack, WIDGETS_LOCATION, this.x + (int)(this.sliderValue * (float)(this.width - 8)), this.y, 0, 66, 8, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
}
}
@@ -127,9 +127,9 @@ public class Slider extends ExtendedButton
* e).
*/
@Override
public void func_230982_a_(double mouseX, double mouseY)
public void onClick(double mouseX, double mouseY)
{
this.sliderValue = (mouseX - (this.field_230690_l_ + 4)) / (this.field_230688_j_ - 8);
this.sliderValue = (mouseX - (this.x + 4)) / (this.width - 8);
updateSlider();
this.dragging = true;
}
@@ -176,7 +176,7 @@ public class Slider extends ExtendedButton
if(drawString)
{
func_238482_a_(new StringTextComponent("").func_230529_a_(dispString).func_240702_b_(val).func_230529_a_(suffix));
setMessage(new StringTextComponent("").append(dispString).appendString(val).append(suffix));
}
if (parent != null)
@@ -189,7 +189,7 @@ public class Slider extends ExtendedButton
* Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e).
*/
@Override
public void func_231000_a__(double mouseX, double mouseY)
public void onRelease(double mouseX, double mouseY)
{
this.dragging = false;
}
@@ -45,37 +45,37 @@ public class UnicodeGlyphButton extends ExtendedButton
}
@Override
public void func_230430_a_(MatrixStack mStack, int mouseX, int mouseY, float partial)
public void render(MatrixStack mStack, int mouseX, int mouseY, float partial)
{
if (this.field_230694_p_)
if (this.visible)
{
Minecraft mc = Minecraft.getInstance();
this.field_230692_n_ = mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + this.field_230688_j_ && mouseY < this.field_230691_m_ + this.field_230689_k_;
int k = this.func_230989_a_(this.field_230692_n_);
GuiUtils.drawContinuousTexturedBox(mStack, Button.field_230687_i_, this.field_230690_l_, this.field_230691_m_, 0, 46 + k * 20, this.field_230688_j_, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_());
this.func_230441_a_(mStack, mc, mouseX, mouseY);
this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
int k = this.getYImage(this.isHovered);
GuiUtils.drawContinuousTexturedBox(mStack, Button.WIDGETS_LOCATION, this.x, this.y, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
this.renderBg(mStack, mc, mouseX, mouseY);
ITextComponent buttonText = this.func_230442_c_();
ITextComponent buttonText = this.getNarrationMessage();
int glyphWidth = (int) (mc.fontRenderer.getStringWidth(glyph) * glyphScale);
int strWidth = mc.fontRenderer.func_238414_a_(buttonText);
int strWidth = mc.fontRenderer.getStringPropertyWidth(buttonText);
int ellipsisWidth = mc.fontRenderer.getStringWidth("...");
int totalWidth = strWidth + glyphWidth;
if (totalWidth > field_230688_j_ - 6 && totalWidth > ellipsisWidth)
buttonText = new StringTextComponent(mc.fontRenderer.func_238417_a_(buttonText, field_230688_j_ - 6 - ellipsisWidth).getString().trim() + "...") ;
if (totalWidth > width - 6 && totalWidth > ellipsisWidth)
buttonText = new StringTextComponent(mc.fontRenderer.func_238417_a_(buttonText, width - 6 - ellipsisWidth).getString().trim() + "...") ;
strWidth = mc.fontRenderer.func_238414_a_(buttonText);
strWidth = mc.fontRenderer.getStringPropertyWidth(buttonText);
totalWidth = glyphWidth + strWidth;
mStack.push();
mStack.scale(glyphScale, glyphScale, 1.0F);
this.func_238472_a_(mStack, mc.fontRenderer, new StringTextComponent(glyph),
(int) (((this.field_230690_l_ + (this.field_230688_j_ / 2) - (strWidth / 2)) / glyphScale) - (glyphWidth / (2 * glyphScale)) + 2),
(int) (((this.field_230691_m_ + ((this.field_230689_k_ - 8) / glyphScale) / 2) - 1) / glyphScale), getFGColor());
this.drawCenteredString(mStack, mc.fontRenderer, new StringTextComponent(glyph),
(int) (((this.x + (this.width / 2) - (strWidth / 2)) / glyphScale) - (glyphWidth / (2 * glyphScale)) + 2),
(int) (((this.y + ((this.height - 8) / glyphScale) / 2) - 1) / glyphScale), getFGColor());
mStack.pop();
this.func_238472_a_(mStack, mc.fontRenderer, buttonText, (int) (this.field_230690_l_ + (this.field_230688_j_ / 2) + (glyphWidth / glyphScale)),
this.field_230691_m_ + (this.field_230689_k_ - 8) / 2, getFGColor());
this.drawCenteredString(mStack, mc.fontRenderer, buttonText, (int) (this.x + (this.width / 2) + (glyphWidth / glyphScale)),
this.y + (this.height - 8) / 2, getFGColor());
}
}
@@ -344,7 +344,7 @@ public class FMLPlayMessages
public static void encode(SyncCustomTagTypes msg, PacketBuffer buf)
{
buf.writeVarInt(msg.customTagTypeCollections.size());
msg.customTagTypeCollections.forEach((registryName, modded) -> forgeTagCollectionWrite(buf, registryName, modded.func_241833_a()));
msg.customTagTypeCollections.forEach((registryName, modded) -> forgeTagCollectionWrite(buf, registryName, modded.getIDTagMap()));
}
private static <T> void forgeTagCollectionWrite(PacketBuffer buf, ResourceLocation registryName, Map<ResourceLocation, ITag<T>> tags)
@@ -353,7 +353,7 @@ public class FMLPlayMessages
buf.writeVarInt(tags.size());
tags.forEach((name, tag) -> {
buf.writeResourceLocation(name);
List<T> elements = tag.func_230236_b_();
List<T> elements = tag.getAllElements();
buf.writeVarInt(elements.size());
for (T element : elements)
{
@@ -395,9 +395,9 @@ public class FMLPlayMessages
elementBuilder.add(element);
}
}
tags.put(name, ITag.func_232946_a_(elementBuilder.build()));
tags.put(name, ITag.getTagOf(elementBuilder.build()));
}
return ITagCollection.func_242202_a(tags);
return ITagCollection.getTagCollectionFromMap(tags);
}
public static void handle(SyncCustomTagTypes msg, Supplier<NetworkEvent.Context> ctx)
@@ -412,7 +412,7 @@ public class FMLPlayMessages
//Note: We gracefully ignore any tag types the server may have that we don't as they won't be in our tag registry
// so they won't be validated
//Override and use the tags from the packet to test for validation before we actually set them
Multimap<ResourceLocation, ResourceLocation> missingTags = TagRegistryManager.func_242198_b(ForgeTagHandler.withSpecificCustom(tagCollectionSupplier, msg.customTagTypeCollections));
Multimap<ResourceLocation, ResourceLocation> missingTags = TagRegistryManager.validateTags(ForgeTagHandler.withSpecificCustom(tagCollectionSupplier, msg.customTagTypeCollections));
if (missingTags.isEmpty())
{
//If we have no missing tags, update the custom tag types
@@ -111,7 +111,7 @@ public class ResourcePackLoader
}
@Override
public void func_230230_a_(Consumer<ResourcePackInfo> consumer, IFactory factory)
public void findPacks(Consumer<ResourcePackInfo> consumer, IFactory factory)
{
wrapped.addPackInfos(consumer, factory);
}
@@ -81,7 +81,7 @@ public class LanguageHook
private static void loadLanguage(String langName, MinecraftServer server) {
String langFile = String.format("lang/%s.json", langName);
IResourceManager resourceManager = server.getDataPackRegistries().func_240970_h_();
IResourceManager resourceManager = server.getDataPackRegistries().getResourceManager();
resourceManager.getResourceNamespaces().forEach(namespace -> {
try {
ResourceLocation langResource = new ResourceLocation(namespace, langFile);
@@ -197,7 +197,7 @@ public class ServerLifecycleHooks
IModInfo mod = e.getKey().getModInfos().get(0);
if (Objects.equals(mod.getModId(), "minecraft")) continue; // skip the minecraft "mod"
final String name = "mod:" + mod.getModId();
final ResourcePackInfo packInfo = ResourcePackInfo.createResourcePack(name, true, e::getValue, factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.field_232625_a_);
final ResourcePackInfo packInfo = ResourcePackInfo.createResourcePack(name, true, e::getValue, factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.PLAIN);
if (packInfo == null) {
// Vanilla only logs an error, instead of propagating, so handle null and warn that something went wrong
ModLoader.get().addWarning(new ModLoadingWarning(mod, ModLoadingStage.ERROR, "fml.modloading.brokenresources", e.getKey()));