Skip to content

Commit

Permalink
Updated to BTA 1.7.7.0-pre1
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamarine committed Mar 25, 2023
1 parent 7d5eb48 commit a717e34
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 69 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ archivesBaseName = project.mod_name
version = project.mod_version

loom {
gluedMinecraftJar()
// gluedMinecraftJar()
noIntermediateMappings()
clientOnlyMinecraftJar()
customMinecraftManifest.set("https://github.com/Turnip-Labs/bta-manifest-repo/releases/download/v${project.bta_version}/${project.bta_version}.json")
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G
# Also makes builds more reliable and less likely to randomly fail.
org.gradle.daemon=false

mod_version=1.8.6-bta.4
mod_group=io.github.prospector
mod_name=modmenu
mod_version=2.0.0-beta.1
mod_group=io.github.turniplabs
mod_name=modmenu-bta

yarn_mappings=df0e26c
bta_version=1.7.6.2_02
# yarn_mappings=df0e26c
bta_version=1.7.7.0-pre1
loader_version=0.14.6-babric.1
6 changes: 2 additions & 4 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
before_install:
- wget https://raw.githubusercontent.com/sormuras/bach/releases/11/install-jdk.sh
- source install-jdk.sh --feature 17
- jshell --version
jdk:
  - openjdk17
6 changes: 3 additions & 3 deletions src/main/java/io/github/prospector/modmenu/ModMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import net.fabricmc.loader.api.metadata.CustomValue;
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.minecraft.client.Minecraft;
import net.minecraft.src.GuiOptions;
import net.minecraft.src.GuiScreen;
import net.minecraft.core.gui.GuiScreen;
import net.minecraft.core.gui.options.GuiOptionsPageGeneral;

import java.text.NumberFormat;
import java.util.*;
Expand Down Expand Up @@ -79,7 +79,7 @@ public void onInitializeClient() {
CUSTOM_BADGE_MODS.put(api.getModId(), map);
});
});
factories.put("minecraft", (screenBase -> new GuiOptions(screenBase, ((Minecraft) FabricLoader.getInstance().getGameInstance()).gameSettings)));
factories.put("minecraft", (screenBase -> new GuiOptionsPageGeneral(screenBase, ((Minecraft) FabricLoader.getInstance().getGameInstance()).gameSettings)));
configScreenFactories = factories.build();
Collection<ModContainer> mods = FabricLoader.getInstance().getAllMods();
HardcodedUtil.initializeHardcodings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import java.util.function.Supplier;

import io.github.prospector.modmenu.util.TriConsumer;
import net.minecraft.src.GuiScreen;
import net.minecraft.core.gui.GuiScreen;
import org.jetbrains.annotations.ApiStatus;

public interface ModMenuApi {
/**
* Replaced with {@link ModMenuApi#getConfigScreen(net.minecraft.src.GuiScreen)}, with
* Replaced with {@link ModMenuApi#getConfigScreen(net.minecraft.core.gui.GuiScreen)}, with
* the ModMenuApi implemented onto a class that is added as an
* entry point to your fabric mod metadata.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import io.github.prospector.modmenu.util.RenderUtils;
import net.fabricmc.loader.api.metadata.Person;
import net.minecraft.client.Minecraft;
import net.minecraft.src.FontRenderer;
import net.minecraft.core.render.FontRenderer;

import java.util.Collection;
import java.util.List;

public class DescriptionListWidget extends EntryListWidget<DescriptionListWidget.DescriptionEntry> {
private final ModListScreen parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.MathHelper;
import net.minecraft.src.Tessellator;
import net.minecraft.core.gui.GuiScreen;
import net.minecraft.core.render.Tessellator;
import net.minecraft.core.util.helper.MathHelper;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import net.fabricmc.loader.api.ModContainer;
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.minecraft.client.Minecraft;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.Tessellator;
import net.minecraft.core.render.FontRenderer;
import net.minecraft.core.render.Tessellator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GL11;
Expand Down
21 changes: 10 additions & 11 deletions src/main/java/io/github/prospector/modmenu/gui/ModListScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.fabricmc.loader.api.metadata.Person;
import net.minecraft.client.Minecraft;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.Tessellator;
import net.minecraft.core.gui.GuiButton;
import net.minecraft.core.gui.GuiScreen;
import net.minecraft.core.render.FontRenderer;
import net.minecraft.core.render.Tessellator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.Sys;
Expand Down Expand Up @@ -68,10 +68,9 @@ public ModListScreen(GuiScreen previousGui) {
this.textTitle = "Mods";
}

@Override
public void handleMouseInput() {
super.handleMouseInput();
int dWheel = Mouse.getEventDWheel()/50;
public void handleInput() {
super.handleInput();
int dWheel = Mouse.getEventDWheel() / 50;
if (dWheel != 0) {
int mouseX = Mouse.getEventX() * this.width / this.mc.resolution.width; // field_6326_c
int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.resolution.height - 1; // field_6325_d
Expand Down Expand Up @@ -189,7 +188,7 @@ public void drawButton(Minecraft mc, int mouseX, int mouseY) {
}

@Override
protected void actionPerformed(GuiButton button) {
protected void buttonPressed(GuiButton button) {
switch (button.id) {
case CONFIGURE_BUTTON_ID: {
final String modid = Objects.requireNonNull(selected).getMetadata().getId();
Expand Down Expand Up @@ -246,7 +245,7 @@ public ModListWidget getModList() {
}

@Override
public void keyTyped(char char_1, int int_1) {
public void keyTyped(char char_1, int int_1, int mouseX, int mouseY) {
this.searchBox.textboxKeyTyped(char_1, int_1);
if (int_1 == 1) {
this.mc.displayGuiScreen(this.parent);
Expand Down Expand Up @@ -295,7 +294,7 @@ public void drawScreen(int mouseX, int mouseY, float delta) {
this.modList.render(mouseX, mouseY, delta);
this.searchBox.drawTextBox();
GL11.glDisable(GL11.GL_BLEND);
this.drawCenteredString(font, this.textTitle, this.modList.getWidth() / 2, 8, 0xffffff);
this.drawStringCentered(font, this.textTitle, this.modList.getWidth() / 2, 8, 0xffffff);
super.drawScreen(mouseX, mouseY, delta);
if (showModCount || !filterOptionsShown) {
font.drawString("Showing " + NumberFormat.getInstance().format(modList.getDisplayedCount()) + "/" + NumberFormat.getInstance().format(FabricLoader.getInstance().getAllMods().size()) + " Mods", searchBoxX, 52, 0xFFFFFF);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import net.fabricmc.loader.api.ModContainer;
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.minecraft.client.Minecraft;
import net.minecraft.src.MathHelper;
import net.minecraft.src.Tessellator;
import net.minecraft.core.render.Tessellator;
import net.minecraft.core.util.helper.MathHelper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GL11;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.prospector.modmenu.gui;

import net.minecraft.src.GuiButton;

import net.minecraft.core.gui.GuiButton;

public class ModMenuButtonWidget extends GuiButton {
public ModMenuButtonWidget(int buttonId, int x, int y, int width, int height, String text) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.github.prospector.modmenu.gui;

import net.minecraft.client.Minecraft;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.GuiButton;
import net.minecraft.src.Tessellator;
import net.minecraft.core.gui.GuiButton;
import net.minecraft.core.render.FontRenderer;
import net.minecraft.core.render.Tessellator;
import org.lwjgl.opengl.GL11;

public class ModMenuTexturedButtonWidget extends GuiButton {
Expand Down Expand Up @@ -69,11 +69,11 @@ public void render(Minecraft mc, int mouseX, int mouseY) {

this.mouseDragged(mc, mouseX, mouseY);
if (!this.enabled) {
this.drawCenteredString(font, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 0xffa0a0a0);
this.drawStringCentered(font, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 0xffa0a0a0);
} else if (hovered) {
this.drawCenteredString(font, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 0xffffa0);
this.drawStringCentered(font, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 0xffffa0);
} else {
this.drawCenteredString(font, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 0xe0e0e0);
this.drawStringCentered(font, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, 0xe0e0e0);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package io.github.prospector.modmenu.gui;

import io.github.prospector.modmenu.mixin.MinecraftAccessor;
import net.minecraft.src.EnumOS2;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.Tessellator;
import net.minecraft.src.helper.TextFieldInputHandler;
import io.github.prospector.modmenu.mixin.TextFieldEditorAccessor;
import net.minecraft.core.enums.EnumOS2;
import net.minecraft.core.gui.GuiScreen;
import net.minecraft.core.gui.text.ITextField;
import net.minecraft.core.gui.text.TextFieldEditor;
import net.minecraft.core.render.FontRenderer;
import net.minecraft.core.render.Tessellator;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;

import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.util.function.Predicate;

public class TextFieldWidget extends GuiScreen {
public class TextFieldWidget extends GuiScreen implements ITextField {
private final FontRenderer font;
private final TextFieldEditor handler;
public int x;
public int y;
/**
Expand Down Expand Up @@ -67,6 +70,7 @@ public TextFieldWidget(FontRenderer font, int x, int y, int width, int height) {
this.y = y;
this.width = width;
this.height = height;
this.handler = new TextFieldEditor(this);
}

/**
Expand Down Expand Up @@ -98,6 +102,11 @@ public String getText() {
return text;
}

@Override
public int maxLength() {
return getMaxStringLength();
}

/**
* returns the text between the cursor and selectionEnd
*/
Expand Down Expand Up @@ -303,7 +312,7 @@ public boolean textboxKeyTyped(char typedChar, int keyCode) {
return true;
} else if (isKeyComboCtrlV(keyCode)) {
if (isEnabled) {
writeText(TextFieldInputHandler.getClipboardString());
writeText(((TextFieldEditorAccessor) handler).getClipboardContentString());
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import io.github.prospector.modmenu.util.ModListSearch;
import net.fabricmc.loader.api.ModContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.Tessellator;
import net.minecraft.core.render.FontRenderer;
import net.minecraft.core.render.Tessellator;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.prospector.modmenu.mixin;

import net.minecraft.src.GuiButton;
import net.minecraft.core.gui.GuiButton;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.prospector.modmenu.mixin;

import net.minecraft.client.Minecraft;
import net.minecraft.src.EnumOS2;
import net.minecraft.core.enums.EnumOS2;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

Expand All @@ -11,5 +11,4 @@ public interface MinecraftAccessor {
static EnumOS2 getOS() {
return EnumOS2.windows;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import io.github.prospector.modmenu.ModMenu;
import io.github.prospector.modmenu.gui.ModListScreen;
import io.github.prospector.modmenu.gui.ModMenuButtonWidget;
import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiIngameMenu;
import net.minecraft.src.GuiScreen;
import net.minecraft.core.gui.GuiButton;
import net.minecraft.core.gui.GuiIngameMenu;
import net.minecraft.core.gui.GuiScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -19,7 +19,7 @@ public void drawMenuButton(CallbackInfo info) {
this.controlList.add(new ModMenuButtonWidget(100, this.width / 2 - 100, this.height / 4 + 72 - 16, 200, 20, "Mods (" + ModMenu.getFormattedModCount() + " loaded)"));
}

@Inject(method = "actionPerformed", at = @At("HEAD"))
@Inject(method = "buttonPressed", at = @At("HEAD"))
private void onActionPerformed(GuiButton button, CallbackInfo ci) {
if (button.id == 100) {
mc.displayGuiScreen(new ModListScreen(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import io.github.prospector.modmenu.ModMenu;
import io.github.prospector.modmenu.gui.ModListScreen;
import io.github.prospector.modmenu.gui.ModMenuButtonWidget;
import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiMainMenu;
import net.minecraft.src.GuiScreen;
import net.minecraft.core.gui.GuiButton;
import net.minecraft.core.gui.GuiMainMenu;
import net.minecraft.core.gui.GuiScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -24,7 +24,7 @@ public void drawMenuButton(CallbackInfo info) {
this.controlList.add(new ModMenuButtonWidget(100, this.width / 2 + 2, texturePackButton.yPosition, newWidth, 20, "Mods (" + ModMenu.getFormattedModCount() + " loaded)"));
}

@Inject(method = "actionPerformed", at = @At("HEAD"))
@Inject(method = "buttonPressed", at = @At("HEAD"))
private void onActionPerformed(GuiButton button, CallbackInfo ci) {
if (button.id == 100) {
mc.displayGuiScreen(new ModListScreen(this));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.prospector.modmenu.mixin;

import io.github.prospector.modmenu.ModMenu;
import net.minecraft.src.TexturePackBase;
import net.minecraft.src.TexturePackCustom;
import net.minecraft.core.render.texturepack.TexturePackBase;
import net.minecraft.core.render.texturepack.TexturePackCustom;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.github.prospector.modmenu.mixin;

import net.minecraft.core.gui.text.TextFieldEditor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(value = TextFieldEditor.class, remap = false)
public interface TextFieldEditorAccessor {
@Invoker("clipboardToString")
String getClipboardContentString();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.prospector.modmenu.util;

import io.github.prospector.modmenu.mixin.GuiButtonAccessor;
import net.minecraft.src.GuiButton;
import net.minecraft.core.gui.GuiButton;

public class ButtonUtil {
public static GuiButton createButton(int buttonId, int x, int y, int width, int height, String text) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.GuiScreen;
import net.minecraft.core.gui.GuiScreen;
import net.minecraft.core.render.FontRenderer;

import java.util.ArrayList;
import java.util.Collections;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"magneticflux",
"Earthcomputer",
"Ambos",
"pkstDev"
"Flamarine"
],
"description": "Adds a mod menu to view the list of mods you have installed.",
"mixins": [
Expand Down
Loading

0 comments on commit a717e34

Please sign in to comment.