0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Update to 21w20a

This commit is contained in:
Alexander01998 2021-05-20 14:14:13 +02:00
parent c809fe4aad
commit 2909ef290a
33 changed files with 203 additions and 132 deletions

View File

@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html and
# https://www.curseforge.com/minecraft/mc-mods/fabric-api
minecraft_version=21w19a
yarn_mappings=21w19a+build.1
minecraft_version=21w20a
yarn_mappings=21w20a+build.2
loader_version=0.11.3
#Fabric api
fabric_version=0.34.4+1.17
fabric_version=0.34.5+1.17
# Mod Properties
mod_version = v7.15.1-MC21w19a
mod_version = v7.15.1-MC21w20a
maven_group = net.wurstclient
archives_base_name = Wurst-Client

View File

@ -57,7 +57,7 @@ public enum WurstClient
public static final IMinecraftClient IMC = (IMinecraftClient)MC;
public static final String VERSION = "7.15.1";
public static final String MC_VERSION = "21w19a";
public static final String MC_VERSION = "21w20a";
private WurstAnalytics analytics;
private EventManager eventManager;

View File

@ -72,23 +72,23 @@ public abstract class AltEditorScreen extends Screen
@Override
public final void init()
{
addButton(doneButton =
method_37063(doneButton =
new ButtonWidget(width / 2 - 100, height / 4 + 72 + 12, 200, 20,
new LiteralText(getDoneButtonText()), b -> pressDoneButton()));
addButton(new ButtonWidget(width / 2 - 100, height / 4 + 120 + 12, 200,
method_37063(new ButtonWidget(width / 2 - 100, height / 4 + 120 + 12, 200,
20, new LiteralText("Cancel"), b -> client.openScreen(prevScreen)));
addButton(new ButtonWidget(width / 2 - 100, height / 4 + 96 + 12, 200,
method_37063(new ButtonWidget(width / 2 - 100, height / 4 + 96 + 12, 200,
20, new LiteralText("Random Name"),
b -> emailBox.setText(NameGenerator.generateName())));
addButton(stealSkinButton =
method_37063(stealSkinButton =
new ButtonWidget(width - (width / 2 - 100) / 2 - 64, height - 32,
128, 20, new LiteralText("Steal Skin"),
b -> message = stealSkin(getEmail())));
addButton(new ButtonWidget((width / 2 - 100) / 2 - 64, height - 32, 128,
method_37063(new ButtonWidget((width / 2 - 100) / 2 - 64, height - 32, 128,
20, new LiteralText("Open Skin Folder"), b -> openSkinFolder()));
emailBox = new TextFieldWidget(textRenderer, width / 2 - 100, 60, 200,
@ -96,7 +96,7 @@ public abstract class AltEditorScreen extends Screen
emailBox.setMaxLength(48);
emailBox.setTextFieldFocused(true);
emailBox.setText(getDefaultEmail());
children.add(emailBox);
addChild(emailBox);
passwordBox = new TextFieldWidget(textRenderer, width / 2 - 100, 100,
200, 20, new LiteralText(""));
@ -108,7 +108,7 @@ public abstract class AltEditorScreen extends Screen
return OrderedText.styledForwardsVisitedString(stars, Style.EMPTY);
});
passwordBox.setMaxLength(256);
children.add(passwordBox);
addChild(passwordBox);
setInitialFocus(emailBox);
}

View File

@ -25,10 +25,11 @@ import com.google.gson.JsonObject;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.screen.ConfirmScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.GameRenderer;
@ -42,6 +43,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix4f;
import net.wurstclient.WurstClient;
import net.wurstclient.altmanager.*;
import net.wurstclient.mixinterface.IScreen;
import net.wurstclient.util.ListWidget;
import net.wurstclient.util.MultiProcessingUtils;
import net.wurstclient.util.json.JsonException;
@ -82,33 +84,33 @@ public final class AltManagerScreen extends Screen
new LiteralText("Your alt list is empty."), new LiteralText(
"Would you like some random alts to get started?")));
addButton(useButton = new ButtonWidget(width / 2 - 154, height - 52,
method_37063(useButton = new ButtonWidget(width / 2 - 154, height - 52,
100, 20, new LiteralText("Login"), b -> pressLogin()));
addButton(new ButtonWidget(width / 2 - 50, height - 52, 100, 20,
method_37063(new ButtonWidget(width / 2 - 50, height - 52, 100, 20,
new LiteralText("Direct Login"),
b -> client.openScreen(new DirectLoginScreen(this))));
addButton(new ButtonWidget(width / 2 + 54, height - 52, 100, 20,
method_37063(new ButtonWidget(width / 2 + 54, height - 52, 100, 20,
new LiteralText("Add"),
b -> client.openScreen(new AddAltScreen(this, altManager))));
addButton(starButton = new ButtonWidget(width / 2 - 154, height - 28,
method_37063(starButton = new ButtonWidget(width / 2 - 154, height - 28,
75, 20, new LiteralText("Favorite"), b -> pressFavorite()));
addButton(editButton = new ButtonWidget(width / 2 - 76, height - 28, 74,
method_37063(editButton = new ButtonWidget(width / 2 - 76, height - 28, 74,
20, new LiteralText("Edit"), b -> pressEdit()));
addButton(deleteButton = new ButtonWidget(width / 2 + 2, height - 28,
method_37063(deleteButton = new ButtonWidget(width / 2 + 2, height - 28,
74, 20, new LiteralText("Delete"), b -> pressDelete()));
addButton(new ButtonWidget(width / 2 + 80, height - 28, 75, 20,
method_37063(new ButtonWidget(width / 2 + 80, height - 28, 75, 20,
new LiteralText("Cancel"), b -> client.openScreen(prevScreen)));
addButton(importButton = new ButtonWidget(8, 8, 50, 20,
method_37063(importButton = new ButtonWidget(8, 8, 50, 20,
new LiteralText("Import"), b -> pressImportAlts()));
addButton(exportButton = new ButtonWidget(58, 8, 50, 20,
method_37063(exportButton = new ButtonWidget(58, 8, 50, 20,
new LiteralText("Export"), b -> pressExportAlts()));
}
@ -440,8 +442,11 @@ public final class AltManagerScreen extends Screen
private void renderButtonTooltip(MatrixStack matrixStack, int mouseX,
int mouseY)
{
for(AbstractButtonWidget button : buttons)
for(Drawable d : ((IScreen)(Object)this).getButtons())
{
if(!(d instanceof ClickableWidget button))
continue;
if(!button.isHovered())
continue;

View File

@ -64,19 +64,19 @@ public final class EditBlockListScreen extends Screen
blockNameField = new TextFieldWidget(client.textRenderer,
width / 2 - 152, height - 55, 150, 18, new LiteralText(""));
children.add(blockNameField);
addChild(blockNameField);
addButton(addButton = new ButtonWidget(width / 2 - 2, height - 56, 30,
method_37063(addButton = new ButtonWidget(width / 2 - 2, height - 56, 30,
20, new LiteralText("Add"), b -> {
blockList.add(blockToAdd);
blockNameField.setText("");
}));
addButton(removeButton = new ButtonWidget(width / 2 + 52, height - 56,
method_37063(removeButton = new ButtonWidget(width / 2 + 52, height - 56,
100, 20, new LiteralText("Remove Selected"),
b -> blockList.remove(listGui.selected)));
addButton(new ButtonWidget(width - 108, 8, 100, 20,
method_37063(new ButtonWidget(width - 108, 8, 100, 20,
new LiteralText("Reset to Defaults"),
b -> client.openScreen(new ConfirmScreen(b2 -> {
if(b2)
@ -85,7 +85,7 @@ public final class EditBlockListScreen extends Screen
}, new LiteralText("Reset to Defaults"),
new LiteralText("Are you sure?")))));
addButton(
method_37063(
doneButton = new ButtonWidget(width / 2 - 100, height - 28, 200, 20,
new LiteralText("Done"), b -> client.openScreen(prevScreen)));
}

View File

@ -57,13 +57,13 @@ public final class EditBlockScreen extends Screen
blockField.setText(valueString);
blockField.setSelectionStart(0);
children.add(blockField);
addChild(blockField);
setInitialFocus(blockField);
blockField.setTextFieldFocused(true);
doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
b -> done());
addButton(doneButton);
method_37063(doneButton);
}
private void done()

View File

@ -63,19 +63,19 @@ public final class EditItemListScreen extends Screen
itemNameField = new TextFieldWidget(client.textRenderer,
width / 2 - 152, height - 55, 150, 18, new LiteralText(""));
children.add(itemNameField);
addChild(itemNameField);
addButton(addButton = new ButtonWidget(width / 2 - 2, height - 56, 30,
method_37063(addButton = new ButtonWidget(width / 2 - 2, height - 56, 30,
20, new LiteralText("Add"), b -> {
itemList.add(itemToAdd);
itemNameField.setText("");
}));
addButton(removeButton = new ButtonWidget(width / 2 + 52, height - 56,
method_37063(removeButton = new ButtonWidget(width / 2 + 52, height - 56,
100, 20, new LiteralText("Remove Selected"),
b -> itemList.remove(listGui.selected)));
addButton(new ButtonWidget(width - 108, 8, 100, 20,
method_37063(new ButtonWidget(width - 108, 8, 100, 20,
new LiteralText("Reset to Defaults"),
b -> client.openScreen(new ConfirmScreen(b2 -> {
if(b2)
@ -84,7 +84,7 @@ public final class EditItemListScreen extends Screen
}, new LiteralText("Reset to Defaults"),
new LiteralText("Are you sure?")))));
addButton(
method_37063(
doneButton = new ButtonWidget(width / 2 - 100, height - 28, 200, 20,
new LiteralText("Done"), b -> client.openScreen(prevScreen)));
}

View File

@ -50,13 +50,13 @@ public final class EditSliderScreen extends Screen
valueField.setText(valueString);
valueField.setSelectionStart(0);
children.add(valueField);
addChild(valueField);
setInitialFocus(valueField);
valueField.setTextFieldFocused(true);
doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
b -> done());
addButton(doneButton);
method_37063(doneButton);
}
private void done()

View File

@ -51,14 +51,14 @@ public final class SelectFileScreen extends Screen
{
listGui = new ListGui(client, this, setting.listFiles());
addButton(new ButtonWidget(8, 8, 100, 20,
method_37063(new ButtonWidget(8, 8, 100, 20,
new LiteralText("Open Folder"), b -> openFolder()));
addButton(new ButtonWidget(width - 108, 8, 100, 20,
method_37063(new ButtonWidget(width - 108, 8, 100, 20,
new LiteralText("Reset to Defaults"), b -> askToConfirmReset()));
doneButton = addButton(new ButtonWidget(width / 2 - 102, height - 48,
doneButton = method_37063(new ButtonWidget(width / 2 - 102, height - 48,
100, 20, new LiteralText("Done"), b -> done()));
addButton(new ButtonWidget(width / 2 + 2, height - 48, 100, 20,
method_37063(new ButtonWidget(width / 2 + 2, height - 48, 100, 20,
new LiteralText("Cancel"), b -> openPrevScreen()));
}

View File

@ -10,14 +10,14 @@ package net.wurstclient.mixin;
import org.spongepowered.asm.mixin.Mixin;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.widget.AbstractPressableButtonWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.PressableWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.wurstclient.WurstClient;
@Mixin(ButtonWidget.class)
public abstract class ButtonWidgetMixin extends AbstractPressableButtonWidget
public abstract class ButtonWidgetMixin extends PressableWidget
{
public ButtonWidgetMixin(WurstClient wurst, int i, int j, int k, int l,
Text text)
@ -26,7 +26,7 @@ public abstract class ButtonWidgetMixin extends AbstractPressableButtonWidget
}
@Override
protected void renderBg(MatrixStack matrixStack, MinecraftClient client,
protected void renderBackground(MatrixStack matrixStack, MinecraftClient client,
int mouseX, int mouseY)
{
int i = getYImage(isHovered());

View File

@ -54,10 +54,10 @@ public abstract class ContainerScreen54Mixin
if(autoSteal.areButtonsVisible())
{
addButton(new ButtonWidget(x + backgroundWidth - 108, y + 4, 50, 12,
method_37063(new ButtonWidget(x + backgroundWidth - 108, y + 4, 50, 12,
new LiteralText("Steal"), b -> steal()));
addButton(new ButtonWidget(x + backgroundWidth - 56, y + 4, 50, 12,
method_37063(new ButtonWidget(x + backgroundWidth - 56, y + 4, 50, 12,
new LiteralText("Store"), b -> store()));
}

View File

@ -52,12 +52,12 @@ public class DisconnectedScreenMixin extends Screen
int backButtonY =
Math.min(height / 2 + reasonHeight / 2 + 9, height - 30);
addButton(new ButtonWidget(backButtonX, backButtonY + 24, 200, 20,
method_37063(new ButtonWidget(backButtonX, backButtonY + 24, 200, 20,
new LiteralText("Reconnect"),
b -> LastServerRememberer.reconnect(parent)));
autoReconnectButton =
addButton(new ButtonWidget(backButtonX, backButtonY + 48, 200, 20,
method_37063(new ButtonWidget(backButtonX, backButtonY + 48, 200, 20,
new LiteralText("AutoReconnect"), b -> pressAutoReconnect()));
if(WurstClient.INSTANCE.getHax().autoReconnectHack.isEnabled())

View File

@ -15,17 +15,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.screen.GameMenuScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.wurstclient.WurstClient;
import net.wurstclient.mixinterface.IScreen;
import net.wurstclient.options.WurstOptionsScreen;
@Mixin(GameMenuScreen.class)
@ -57,7 +57,7 @@ public abstract class GameMenuScreenMixin extends Screen
204, 20, new LiteralText(" Options"),
b -> openWurstOptions());
addButton(wurstOptionsButton);
method_37063(wurstOptionsButton);
}
private void openWurstOptions()
@ -67,16 +67,16 @@ public abstract class GameMenuScreenMixin extends Screen
private void removeFeedbackAndBugReportButtons()
{
buttons.removeIf(this::isFeedbackOrBugReportButton);
children.removeIf(this::isFeedbackOrBugReportButton);
((IScreen)this).getButtons().removeIf(this::isFeedbackOrBugReportButton);
children().removeIf(this::isFeedbackOrBugReportButton);
}
private boolean isFeedbackOrBugReportButton(Element element)
private boolean isFeedbackOrBugReportButton(Object element)
{
if(element == null || !(element instanceof AbstractButtonWidget))
if(element == null || !(element instanceof ClickableWidget))
return false;
AbstractButtonWidget button = (AbstractButtonWidget)element;
ClickableWidget button = (ClickableWidget)element;
String message = button.getMessage().getString();
return message != null

View File

@ -57,15 +57,15 @@ public class MultiplayerScreenMixin extends Screen implements IMultiplayerScreen
if(!WurstClient.INSTANCE.isEnabled())
return;
lastServerButton = addButton(new ButtonWidget(width / 2 - 154, 10, 100,
lastServerButton = method_37063(new ButtonWidget(width / 2 - 154, 10, 100,
20, new LiteralText("Last Server"), b -> LastServerRememberer
.joinLastServer((MultiplayerScreen)(Object)this)));
addButton(new ButtonWidget(width / 2 + 154 + 4, height - 52, 100, 20,
method_37063(new ButtonWidget(width / 2 + 154 + 4, height - 52, 100, 20,
new LiteralText("Server Finder"), b -> client.openScreen(
new ServerFinderScreen((MultiplayerScreen)(Object)this))));
addButton(new ButtonWidget(width / 2 + 154 + 4, height - 28, 100, 20,
method_37063(new ButtonWidget(width / 2 + 154 + 4, height - 28, 100, 20,
new LiteralText("Clean Up"), b -> client.openScreen(
new CleanUpScreen((MultiplayerScreen)(Object)this))));
}

View File

@ -7,7 +7,11 @@
*/
package net.wurstclient.mixin;
import java.util.List;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@ -15,15 +19,19 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.gui.AbstractParentElement;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TickableElement;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket;
import net.wurstclient.WurstClient;
import net.wurstclient.mixinterface.IScreen;
@Mixin(Screen.class)
public abstract class ScreenMixin extends AbstractParentElement
implements TickableElement, Drawable
implements Drawable, IScreen
{
@Shadow
@Final
private List<Drawable> field_33816;
@Inject(at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendChatMessage(Ljava/lang/String;)V",
ordinal = 0),
@ -49,4 +57,10 @@ public abstract class ScreenMixin extends AbstractParentElement
if(WurstClient.INSTANCE.getHax().noBackgroundHack.isEnabled())
ci.cancel();
}
@Override
public List<Drawable> getButtons()
{
return field_33816;
}
}

View File

@ -50,10 +50,10 @@ public abstract class ShulkerBoxScreenMixin
if(autoSteal.areButtonsVisible())
{
addButton(new ButtonWidget(x + backgroundWidth - 108, y + 4, 50, 12,
method_37063(new ButtonWidget(x + backgroundWidth - 108, y + 4, 50, 12,
new LiteralText("Steal"), b -> steal()));
addButton(new ButtonWidget(x + backgroundWidth - 56, y + 4, 50, 12,
method_37063(new ButtonWidget(x + backgroundWidth - 56, y + 4, 50, 12,
new LiteralText("Store"), b -> store()));
}

View File

@ -12,15 +12,17 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.StatsListener;
import net.minecraft.client.gui.screen.StatsScreen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.wurstclient.WurstClient;
import net.wurstclient.mixinterface.IScreen;
@Mixin(StatsScreen.class)
public abstract class StatsScreenMixin extends Screen implements StatsListener
@ -37,10 +39,13 @@ public abstract class StatsScreenMixin extends Screen implements StatsListener
height - 28, 150, 20, new LiteralText(""), this::toggleWurst);
updateWurstButtonText(toggleWurstButton);
addButton(toggleWurstButton);
for(AbstractButtonWidget button : buttons)
method_37063(toggleWurstButton);
for(Drawable d : ((IScreen)this).getButtons())
{
if(!(d instanceof ClickableWidget button))
continue;
if(!button.getMessage().getString()
.equals(I18n.translate("gui.done")))
continue;

View File

@ -12,15 +12,17 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.wurstclient.WurstClient;
import net.wurstclient.altmanager.screens.AltManagerScreen;
import net.wurstclient.mixinterface.IScreen;
@Mixin(TitleScreen.class)
public abstract class TitleScreenMixin extends Screen
@ -36,13 +38,16 @@ public abstract class TitleScreenMixin extends Screen
if(!WurstClient.INSTANCE.isEnabled())
return;
addButton(new ButtonWidget(width / 2 + 2, y + spacingY * 2, 98, 20,
method_37063(new ButtonWidget(width / 2 + 2, y + spacingY * 2, 98, 20,
new LiteralText("Alt Manager"),
b -> client.openScreen(new AltManagerScreen(this,
WurstClient.INSTANCE.getAltManager()))));
for(AbstractButtonWidget button : buttons)
for(Drawable d : ((IScreen)this).getButtons())
{
if(!(d instanceof ClickableWidget button))
continue;
if(!button.getMessage().getString()
.equals(I18n.translate("menu.online")))
continue;

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2014-2021 Wurst-Imperium and contributors.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.mixinterface;
import java.util.List;
import net.minecraft.client.gui.Drawable;
public interface IScreen
{
public List<Drawable> getButtons();
}

View File

@ -20,8 +20,9 @@ import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.GameRenderer;
@ -42,6 +43,7 @@ import net.wurstclient.hack.Hack;
import net.wurstclient.hacks.TooManyHaxHack;
import net.wurstclient.keybinds.Keybind;
import net.wurstclient.keybinds.PossibleKeybind;
import net.wurstclient.mixinterface.IScreen;
import net.wurstclient.settings.Setting;
import net.wurstclient.util.ChatUtils;
import net.wurstclient.util.RenderUtils;
@ -106,12 +108,12 @@ public final class NavigatorFeatureScreen extends NavigatorScreen
WurstClient.INSTANCE.getNavigator()
.addPreference(feature.getName());
});
addButton(primaryButton);
method_37063(primaryButton);
}
// help button
// if(hasHelp)
// addButton(new ButtonWidget(
// method_37063(new ButtonWidget(
// width / 2 + (hasPrimaryAction ? 2 : -151), height - 65,
// hasPrimaryAction ? 149 : 302, 20, "Help", b -> {
// MiscUtils.openLink("https://www.wurstclient.net/wiki/"
@ -331,17 +333,17 @@ public final class NavigatorFeatureScreen extends NavigatorScreen
setColorToBackground();
drawQuads(matrixStack, bgx1, bgy1, bgx2,
Math.max(bgy1, Math.min(bgy2 - (buttons.isEmpty() ? 0 : 24),
Math.max(bgy1, Math.min(bgy2 - (((IScreen)(Object)this).getButtons().isEmpty() ? 0 : 24),
bgy1 + scroll + windowComponentY)));
drawQuads(matrixStack, bgx1,
Math.max(bgy1, Math.min(bgy2 - (buttons.isEmpty() ? 0 : 24),
Math.max(bgy1, Math.min(bgy2 - (((IScreen)(Object)this).getButtons().isEmpty() ? 0 : 24),
bgy1 + scroll + windowComponentY + window.getInnerHeight())),
bgx2, bgy2);
drawBoxShadow(matrixStack, bgx1, bgy1, bgx2, bgy2);
// scissor box
RenderUtils.scissorBox(bgx1, bgy1, bgx2,
bgy2 - (buttons.isEmpty() ? 0 : 24));
bgy2 - (((IScreen)(Object)this).getButtons().isEmpty() ? 0 : 24));
GL11.glEnable(GL11.GL_SCISSOR_TEST);
// settings
@ -481,8 +483,11 @@ public final class NavigatorFeatureScreen extends NavigatorScreen
matrixStack.pop();
// buttons below scissor box
for(AbstractButtonWidget button : buttons)
for(Drawable d : ((IScreen)(Object)this).getButtons())
{
if(!(d instanceof ClickableWidget button))
continue;
// positions
int x1 = button.x;
int x2 = x1 + button.getWidth();

View File

@ -67,7 +67,7 @@ public final class NavigatorMainScreen extends NavigatorScreen
searchBar.setDrawsBackground(false);
searchBar.setMaxLength(128);
children.add(searchBar);
addChild(searchBar);
setInitialFocus(searchBar);
searchBar.setTextFieldFocused(true);

View File

@ -13,13 +13,15 @@ import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.wurstclient.WurstClient;
import net.wurstclient.keybinds.PossibleKeybind;
import net.wurstclient.mixinterface.IScreen;
import net.wurstclient.util.RenderUtils;
public class NavigatorNewKeybindScreen extends NavigatorScreen
@ -68,10 +70,10 @@ public class NavigatorNewKeybindScreen extends NavigatorScreen
}
});
okButton.active = selectedCommand != null;
addButton(okButton);
method_37063(okButton);
// cancel button
addButton(new ButtonWidget(width / 2 + 2, height - 65, 149, 18,
method_37063(new ButtonWidget(width / 2 + 2, height - 65, 149, 18,
new LiteralText("Cancel"), b -> WurstClient.MC.openScreen(parent)));
}
@ -149,7 +151,7 @@ public class NavigatorNewKeybindScreen extends NavigatorScreen
// scissor box
RenderUtils.scissorBox(bgx1, bgy1, bgx2,
bgy2 - (buttons.isEmpty() ? 0 : 24));
bgy2 - (((IScreen)this).getButtons().isEmpty() ? 0 : 24));
GL11.glEnable(GL11.GL_SCISSOR_TEST);
// possible keybinds
@ -209,8 +211,11 @@ public class NavigatorNewKeybindScreen extends NavigatorScreen
GL11.glDisable(GL11.GL_SCISSOR_TEST);
// buttons below scissor box
for(AbstractButtonWidget button : buttons)
for(Drawable d : ((IScreen)this).getButtons())
{
if(!(d instanceof ClickableWidget button))
continue;
// positions
int x1 = button.x;
int x2 = x1 + button.getWidth();

View File

@ -16,12 +16,14 @@ import org.lwjgl.opengl.GL11;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.wurstclient.WurstClient;
import net.wurstclient.keybinds.PossibleKeybind;
import net.wurstclient.mixinterface.IScreen;
import net.wurstclient.util.RenderUtils;
public class NavigatorRemoveKeybindScreen extends NavigatorScreen
@ -48,10 +50,10 @@ public class NavigatorRemoveKeybindScreen extends NavigatorScreen
removeButton = new ButtonWidget(width / 2 - 151, height - 65, 149, 18,
new LiteralText("Remove"), b -> remove());
removeButton.active = !selectedKey.isEmpty();
addButton(removeButton);
method_37063(removeButton);
// cancel button
addButton(new ButtonWidget(width / 2 + 2, height - 65, 149, 18,
method_37063(new ButtonWidget(width / 2 + 2, height - 65, 149, 18,
new LiteralText("Cancel"), b -> client.openScreen(parent)));
}
@ -130,7 +132,7 @@ public class NavigatorRemoveKeybindScreen extends NavigatorScreen
// scissor box
RenderUtils.scissorBox(bgx1, bgy1, bgx2,
bgy2 - (buttons.isEmpty() ? 0 : 24));
bgy2 - (((IScreen)this).getButtons().isEmpty() ? 0 : 24));
GL11.glEnable(GL11.GL_SCISSOR_TEST);
// possible keybinds
@ -189,8 +191,11 @@ public class NavigatorRemoveKeybindScreen extends NavigatorScreen
GL11.glDisable(GL11.GL_SCISSOR_TEST);
// buttons below scissor box
for(AbstractButtonWidget button : buttons)
for(Drawable d : ((IScreen)this).getButtons())
{
if(!(d instanceof ClickableWidget button))
continue;
// positions
int x1 = button.x;
int x2 = x1 + button.getWidth();

View File

@ -47,13 +47,13 @@ public final class EnterProfileNameScreen extends Screen
valueField.setText("");
valueField.setSelectionStart(0);
children.add(valueField);
addChild(valueField);
setInitialFocus(valueField);
valueField.setTextFieldFocused(true);
doneButton = new ButtonWidget(x1, y2, 200, 20, new LiteralText("Done"),
b -> done());
addButton(doneButton);
method_37063(doneButton);
}
private void done()

View File

@ -48,20 +48,20 @@ public final class KeybindEditorScreen extends Screen
@Override
public void init()
{
addButton(new ButtonWidget(width / 2 - 100, 60, 200, 20,
method_37063(new ButtonWidget(width / 2 - 100, 60, 200, 20,
new LiteralText("Change Key"),
b -> client.openScreen(new PressAKeyScreen(this))));
addButton(new ButtonWidget(width / 2 - 100, height / 4 + 72, 200, 20,
method_37063(new ButtonWidget(width / 2 - 100, height / 4 + 72, 200, 20,
new LiteralText("Save"), b -> save()));
addButton(new ButtonWidget(width / 2 - 100, height / 4 + 96, 200, 20,
method_37063(new ButtonWidget(width / 2 - 100, height / 4 + 96, 200, 20,
new LiteralText("Cancel"), b -> client.openScreen(prevScreen)));
commandField = new TextFieldWidget(textRenderer, width / 2 - 100, 100,
200, 20, new LiteralText(""));
commandField.setMaxLength(65536);
children.add(commandField);
addChild(commandField);
setInitialFocus(commandField);
commandField.setTextFieldFocused(true);

View File

@ -41,20 +41,20 @@ public final class KeybindManagerScreen extends Screen
{
listGui = new ListGui(client, width, height, 36, height - 56, 30);
addButton(addButton = new ButtonWidget(width / 2 - 102, height - 52,
method_37063(addButton = new ButtonWidget(width / 2 - 102, height - 52,
100, 20, new LiteralText("Add"),
b -> client.openScreen(new KeybindEditorScreen(this))));
addButton(editButton = new ButtonWidget(width / 2 + 2, height - 52, 100,
method_37063(editButton = new ButtonWidget(width / 2 + 2, height - 52, 100,
20, new LiteralText("Edit"), b -> edit()));
addButton(removeButton = new ButtonWidget(width / 2 - 102, height - 28,
method_37063(removeButton = new ButtonWidget(width / 2 - 102, height - 28,
100, 20, new LiteralText("Remove"), b -> remove()));
addButton(backButton = new ButtonWidget(width / 2 + 2, height - 28, 100,
method_37063(backButton = new ButtonWidget(width / 2 + 2, height - 28, 100,
20, new LiteralText("Back"), b -> client.openScreen(prevScreen)));
addButton(
method_37063(
new ButtonWidget(8, 8, 100, 20, new LiteralText("Reset Keybinds"),
b -> client.openScreen(new ConfirmScreen(confirmed -> {
if(confirmed)
@ -65,7 +65,7 @@ public final class KeybindManagerScreen extends Screen
"Are you sure you want to reset your keybinds?"),
new LiteralText("This cannot be undone!")))));
addButton(new ButtonWidget(width - 108, 8, 100, 20,
method_37063(new ButtonWidget(width - 108, 8, 100, 20,
new LiteralText("Profiles..."),
b -> client.openScreen(new KeybindProfilesScreen(this))));
}

View File

@ -45,17 +45,17 @@ public final class KeybindProfilesScreen extends Screen
listGui = new ListGui(client, this,
WurstClient.INSTANCE.getKeybinds().listProfiles());
addButton(new ButtonWidget(8, 8, 100, 20,
method_37063(new ButtonWidget(8, 8, 100, 20,
new LiteralText("Open Folder"), b -> openFolder()));
addButton(new ButtonWidget(width / 2 - 154, height - 48, 100, 20,
method_37063(new ButtonWidget(width / 2 - 154, height - 48, 100, 20,
new LiteralText("New Profile"), b -> client.openScreen(
new EnterProfileNameScreen(this, this::newProfile))));
loadButton = addButton(new ButtonWidget(width / 2 - 50, height - 48,
loadButton = method_37063(new ButtonWidget(width / 2 - 50, height - 48,
100, 20, new LiteralText("Load"), b -> loadSelected()));
addButton(new ButtonWidget(width / 2 + 54, height - 48, 100, 20,
method_37063(new ButtonWidget(width / 2 + 54, height - 48, 100, 20,
new LiteralText("Cancel"), b -> openPrevScreen()));
}

View File

@ -12,9 +12,10 @@ import java.util.List;
import java.util.function.Supplier;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
@ -24,6 +25,7 @@ import net.wurstclient.WurstClient;
import net.wurstclient.analytics.WurstAnalytics;
import net.wurstclient.commands.FriendsCmd;
import net.wurstclient.hacks.XRayHack;
import net.wurstclient.mixinterface.IScreen;
import net.wurstclient.other_features.VanillaSpoofOtf;
import net.wurstclient.settings.CheckboxSetting;
@ -40,7 +42,7 @@ public class WurstOptionsScreen extends Screen
@Override
public void init()
{
addButton(new ButtonWidget(width / 2 - 100, height / 4 + 144 - 16, 200,
method_37063(new ButtonWidget(width / 2 - 100, height / 4 + 144 - 16, 200,
20, new LiteralText("Back"), b -> client.openScreen(prevScreen)));
addSettingButtons();
@ -153,8 +155,11 @@ public class WurstOptionsScreen extends Screen
private void renderButtonTooltip(MatrixStack matrixStack, int mouseX,
int mouseY)
{
for(AbstractButtonWidget button : buttons)
for(Drawable d : ((IScreen)this).getButtons())
{
if(!(d instanceof ClickableWidget button))
continue;
if(!button.isHovered() || !(button instanceof WurstOptionsButton))
continue;
@ -195,7 +200,7 @@ public class WurstOptionsScreen extends Screen
this.tooltip = Arrays.asList(lines2);
}
addButton(this);
method_37063(this);
}
@Override

View File

@ -39,25 +39,25 @@ public class ZoomManagerScreen extends Screen implements PressAKeyCallback
String zoomKeyName = WurstClient.INSTANCE.getZoomKey()
.getBoundKeyTranslationKey().replace("key.keyboard.", "");
addButton(new ButtonWidget(width / 2 - 100, height / 4 + 144 - 16, 200,
method_37063(new ButtonWidget(width / 2 - 100, height / 4 + 144 - 16, 200,
20, new LiteralText("Back"), b -> client.openScreen(prevScreen)));
addButton(
method_37063(
keyButton = new ButtonWidget(width / 2 - 79, height / 4 + 24 - 16,
158, 20, new LiteralText("Zoom Key: " + zoomKeyName),
b -> client.openScreen(new PressAKeyScreen(this))));
addButton(new ButtonWidget(width / 2 - 79, height / 4 + 72 - 16, 50, 20,
method_37063(new ButtonWidget(width / 2 - 79, height / 4 + 72 - 16, 50, 20,
new LiteralText("More"), b -> level.increaseValue()));
addButton(new ButtonWidget(width / 2 - 25, height / 4 + 72 - 16, 50, 20,
method_37063(new ButtonWidget(width / 2 - 25, height / 4 + 72 - 16, 50, 20,
new LiteralText("Less"), b -> level.decreaseValue()));
addButton(new ButtonWidget(width / 2 + 29, height / 4 + 72 - 16, 50, 20,
method_37063(new ButtonWidget(width / 2 + 29, height / 4 + 72 - 16, 50, 20,
new LiteralText("Default"),
b -> level.setValue(level.getDefaultValue())));
addButton(scrollButton =
method_37063(scrollButton =
new ButtonWidget(width / 2 - 79, height / 4 + 96 - 16, 158, 20,
new LiteralText(
"Use Mouse Wheel: " + onOrOff(scroll.isChecked())),

View File

@ -14,16 +14,18 @@ import java.util.function.Supplier;
import org.lwjgl.glfw.GLFW;
import net.minecraft.SharedConstants;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.wurstclient.mixinterface.IMultiplayerScreen;
import net.wurstclient.mixinterface.IScreen;
public class CleanUpScreen extends Screen
{
@ -46,27 +48,27 @@ public class CleanUpScreen extends Screen
@Override
public void init()
{
addButton(new CleanUpButton(width / 2 - 100, height / 4 + 168 + 12,
method_37063(new CleanUpButton(width / 2 - 100, height / 4 + 168 + 12,
() -> "Cancel", "", b -> client.openScreen(prevScreen)));
addButton(cleanUpButton = new CleanUpButton(width / 2 - 100,
method_37063(cleanUpButton = new CleanUpButton(width / 2 - 100,
height / 4 + 144 + 12, () -> "Clean Up",
"Start the Clean Up with the settings\n" + "you specified above.\n"
+ "It might look like the game is not\n"
+ "responding for a couple of seconds.",
b -> cleanUp()));
addButton(new CleanUpButton(width / 2 - 100, height / 4 - 24 + 12,
method_37063(new CleanUpButton(width / 2 - 100, height / 4 - 24 + 12,
() -> "Unknown Hosts: " + removeOrKeep(cleanupUnknown),
"Servers that clearly don't exist.",
b -> cleanupUnknown = !cleanupUnknown));
addButton(new CleanUpButton(width / 2 - 100, height / 4 + 0 + 12,
method_37063(new CleanUpButton(width / 2 - 100, height / 4 + 0 + 12,
() -> "Outdated Servers: " + removeOrKeep(cleanupOutdated),
"Servers that run a different Minecraft\n" + "version than you.",
b -> cleanupOutdated = !cleanupOutdated));
addButton(new CleanUpButton(width / 2 - 100, height / 4 + 24 + 12,
method_37063(new CleanUpButton(width / 2 - 100, height / 4 + 24 + 12,
() -> "Failed Ping: " + removeOrKeep(cleanupFailed),
"All servers that failed the last ping.\n"
+ "Make sure that the last ping is complete\n"
@ -75,19 +77,19 @@ public class CleanUpScreen extends Screen
+ "all servers are done refreshing.",
b -> cleanupFailed = !cleanupFailed));
addButton(new CleanUpButton(width / 2 - 100, height / 4 + 48 + 12,
method_37063(new CleanUpButton(width / 2 - 100, height / 4 + 48 + 12,
() -> "\"Grief me\" Servers: " + removeOrKeep(cleanupGriefMe),
"All servers where the name starts with \"Grief me\"\n"
+ "Useful for removing servers found by ServerFinder.",
b -> cleanupGriefMe = !cleanupGriefMe));
addButton(new CleanUpButton(width / 2 - 100, height / 4 + 72 + 12,
method_37063(new CleanUpButton(width / 2 - 100, height / 4 + 72 + 12,
() -> "\u00a7cRemove all Servers: " + yesOrNo(removeAll),
"This will completely clear your server\n"
+ "list. \u00a7cUse with caution!\u00a7r",
b -> removeAll = !removeAll));
addButton(new CleanUpButton(width / 2 - 100, height / 4 + 96 + 12,
method_37063(new CleanUpButton(width / 2 - 100, height / 4 + 96 + 12,
() -> "Rename all Servers: " + yesOrNo(cleanupRename),
"Renames your servers to \"Grief me #1\",\n"
+ "\"Grief me #2\", etc.",
@ -211,8 +213,11 @@ public class CleanUpScreen extends Screen
private void renderButtonTooltip(MatrixStack matrixStack, int mouseX,
int mouseY)
{
for(AbstractButtonWidget button : buttons)
for(Drawable d : ((IScreen)this).getButtons())
{
if(!(d instanceof ClickableWidget button))
continue;
if(!button.isHovered() || !(button instanceof CleanUpButton))
continue;

View File

@ -46,29 +46,29 @@ public class ServerFinderScreen extends Screen
@Override
public void init()
{
addButton(searchButton =
method_37063(searchButton =
new ButtonWidget(width / 2 - 100, height / 4 + 96 + 12, 200, 20,
new LiteralText("Search"), b -> searchOrCancel()));
addButton(new ButtonWidget(width / 2 - 100, height / 4 + 120 + 12, 200,
method_37063(new ButtonWidget(width / 2 - 100, height / 4 + 120 + 12, 200,
20, new LiteralText("Tutorial"),
b -> Util.getOperatingSystem().open(
"https://www.wurstclient.net/wiki/Special_Features/Server_Finder/")));
addButton(new ButtonWidget(width / 2 - 100, height / 4 + 144 + 12, 200,
method_37063(new ButtonWidget(width / 2 - 100, height / 4 + 144 + 12, 200,
20, new LiteralText("Back"), b -> client.openScreen(prevScreen)));
ipBox = new TextFieldWidget(textRenderer, width / 2 - 100,
height / 4 + 34, 200, 20, new LiteralText(""));
ipBox.setMaxLength(200);
ipBox.setTextFieldFocused(true);
children.add(ipBox);
addChild(ipBox);
maxThreadsBox = new TextFieldWidget(textRenderer, width / 2 - 32,
height / 4 + 58, 26, 12, new LiteralText(""));
maxThreadsBox.setMaxLength(3);
maxThreadsBox.setText("128");
children.add(maxThreadsBox);
addChild(maxThreadsBox);
setInitialFocus(ipBox);
state = ServerFinderState.NOT_RUNNING;

View File

@ -48,7 +48,7 @@ public enum LastServerRememberer
if(lastServer == null)
return;
ConnectScreen.method_36877(prevScreen, WurstClient.MC,
ConnectScreen.connect(prevScreen, WurstClient.MC,
ServerAddress.parse(lastServer.address), lastServer);
}
}

View File

@ -29,7 +29,7 @@
"depends": {
"fabricloader": ">=0.11.3",
"fabric": ">=0.33.4",
"minecraft": ">=1.17-alpha.21.19.a",
"minecraft": ">=1.17-alpha.21.20.a",
"java": ">=16"
},
"suggests": {