Skip to content

Commit

Permalink
Merge branch 'v7.46'
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Sep 27, 2024
2 parents f6fb739 + f99f172 commit de4d5f4
Show file tree
Hide file tree
Showing 96 changed files with 1,987 additions and 1,148 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
dependencies {
classpath "org.kohsuke:github-api:1.324"
classpath "org.kohsuke:github-api:1.326"
}
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ org.gradle.parallel=true
# https://modrinth.com/mod/fabric-api/versions
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.4
loader_version=0.16.5

# Fabric API
fabric_version=0.103.0+1.21.1
fabric_version=0.105.0+1.21.1

# Mod Properties
mod_version = v7.45.1-MC1.21.1
mod_version = v7.46-MC1.21.1
maven_group = net.wurstclient
archives_base_name = Wurst-Client

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/wurstclient/WurstClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public enum WurstClient
public static MinecraftClient MC;
public static IMinecraftClient IMC;

public static final String VERSION = "7.45.1";
public static final String VERSION = "7.46";
public static final String MC_VERSION = "1.21.1";

private WurstAnalytics analytics;
Expand Down
25 changes: 21 additions & 4 deletions src/main/java/net/wurstclient/WurstTranslator.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.IllegalFormatException;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;

import com.google.common.collect.Lists;
Expand All @@ -31,21 +33,25 @@ public class WurstTranslator implements SynchronousResourceReloader
private final WurstClient wurst = WurstClient.INSTANCE;
private TranslationStorage mcEnglish;

private final HashMap<String, String> englishOnlyStrings = new HashMap<>();
private final HashMap<String, String> currentLangStrings = new HashMap<>();
private Map<String, String> currentLangStrings = Map.of();
private Map<String, String> englishOnlyStrings = Map.of();

@Override
public void reload(ResourceManager manager)
{
mcEnglish = TranslationStorage.load(manager,
Lists.newArrayList("en_us"), false);

currentLangStrings.clear();
HashMap<String, String> currentLangStrings = new HashMap<>();
loadTranslations(manager, getCurrentLangCodes(),
currentLangStrings::put);
this.currentLangStrings =
Collections.unmodifiableMap(currentLangStrings);

englishOnlyStrings.clear();
HashMap<String, String> englishOnlyStrings = new HashMap<>();
loadTranslations(manager, List.of("en_us"), englishOnlyStrings::put);
this.englishOnlyStrings =
Collections.unmodifiableMap(englishOnlyStrings);
}

/**
Expand Down Expand Up @@ -146,6 +152,17 @@ public TranslationStorage getMcEnglish()
return mcEnglish;
}

public Map<String, String> getMinecraftsCurrentLanguage()
{
return currentLangStrings;
}

public Map<String, String> getWurstsCurrentLanguage()
{
return isForcedEnglish() ? englishOnlyStrings
: getMinecraftsCurrentLanguage();
}

private ArrayList<String> getCurrentLangCodes()
{
// Weird bug: Some users have their language set to "en_US" instead of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public AddAltScreen(Screen prevScreen, AltManager altManager)
@Override
protected String getDoneButtonText()
{
return "Add";
return getPassword().isEmpty() ? "Add Cracked Alt" : "Add Premium Alt";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,25 @@ public AltEditorScreen(Screen prevScreen, Text title)
@Override
public final void init()
{
nameOrEmailBox = new TextFieldWidget(textRenderer, width / 2 - 100, 60,
200, 20, Text.literal(""));
nameOrEmailBox.setMaxLength(48);
nameOrEmailBox.setFocused(true);
nameOrEmailBox.setText(getDefaultNameOrEmail());
addSelectableChild(nameOrEmailBox);

passwordBox = new TextFieldWidget(textRenderer, width / 2 - 100, 100,
200, 20, Text.literal(""));
passwordBox.setText(getDefaultPassword());
passwordBox.setRenderTextProvider((text, int_1) -> {
String stars = "";
for(int i = 0; i < text.length(); i++)
stars += "*";
return OrderedText.styledForwardsVisitedString(stars, Style.EMPTY);
});
passwordBox.setMaxLength(256);
addSelectableChild(passwordBox);

addDrawableChild(doneButton = ButtonWidget
.builder(Text.literal(getDoneButtonText()), b -> pressDoneButton())
.dimensions(width / 2 - 100, height / 4 + 72 + 12, 200, 20)
Expand Down Expand Up @@ -101,25 +120,6 @@ public final void init()
.dimensions((width / 2 - 100) / 2 - 64, height - 32, 128, 20)
.build());

nameOrEmailBox = new TextFieldWidget(textRenderer, width / 2 - 100, 60,
200, 20, Text.literal(""));
nameOrEmailBox.setMaxLength(48);
nameOrEmailBox.setFocused(true);
nameOrEmailBox.setText(getDefaultNameOrEmail());
addSelectableChild(nameOrEmailBox);

passwordBox = new TextFieldWidget(textRenderer, width / 2 - 100, 100,
200, 20, Text.literal(""));
passwordBox.setText(getDefaultPassword());
passwordBox.setRenderTextProvider((text, int_1) -> {
String stars = "";
for(int i = 0; i < text.length(); i++)
stars += "*";
return OrderedText.styledForwardsVisitedString(stars, Style.EMPTY);
});
passwordBox.setMaxLength(256);
addSelectableChild(passwordBox);

setFocused(nameOrEmailBox);
}

Expand Down Expand Up @@ -150,6 +150,7 @@ public final void tick()

doneButton.active = !nameOrEmail.isEmpty()
&& !(alex && passwordBox.getText().isEmpty());
doneButton.setMessage(Text.literal(getDoneButtonText()));

stealSkinButton.active = !alex;
}
Expand Down Expand Up @@ -358,14 +359,17 @@ public void render(DrawContext context, int mouseX, int mouseY,
AltRenderer.drawAltBody(context, nameOrEmailBox.getText(),
width - (width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256);

String accountType = getPassword().isEmpty() ? "cracked" : "premium";

// text
context.drawTextWithShadow(textRenderer, "Name (for cracked alts), or",
width / 2 - 100, 37, 10526880);
context.drawTextWithShadow(textRenderer, "E-Mail (for premium alts)",
width / 2 - 100, 47, 10526880);
context.drawTextWithShadow(textRenderer,
"Password (leave blank for cracked alts)", width / 2 - 100, 87,
10526880);
context.drawTextWithShadow(textRenderer, "Password (for premium alts)",
width / 2 - 100, 87, 10526880);
context.drawTextWithShadow(textRenderer, "Account type: " + accountType,
width / 2 - 100, 127, 10526880);

String[] lines = message.split("\n");
for(int i = 0; i < lines.length; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public DirectLoginScreen(Screen prevScreen)
@Override
protected String getDoneButtonText()
{
return "Login";
return getPassword().isEmpty() ? "Change Cracked Name"
: "Login with Password";
}

@Override
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/net/wurstclient/clickgui/ClickGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ public void render(DrawContext context, int mouseX, int mouseY,
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// GL11.glShadeModel(GL11.GL_SMOOTH);
RenderSystem.lineWidth(1);
MatrixStack matrixStack = context.getMatrices();
matrixStack.push();

tooltip = "";
for(Window window : windows)
Expand All @@ -495,12 +497,14 @@ public void render(DrawContext context, int mouseX, int mouseY,
else
window.stopDraggingScrollbar();

matrixStack.translate(0, 0, 300);
renderWindow(context, window, mouseX, mouseY, partialTicks);
}

renderPopups(context, mouseX, mouseY);
renderTooltip(context, mouseX, mouseY);

matrixStack.pop();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
}
Expand Down Expand Up @@ -598,12 +602,18 @@ public void renderPinnedWindows(DrawContext context, float partialTicks)
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderSystem.lineWidth(1);
MatrixStack matrixStack = context.getMatrices();
matrixStack.push();

for(Window window : windows)
if(window.isPinned() && !window.isInvisible())
{
matrixStack.translate(0, 0, 300);
renderWindow(context, window, Integer.MIN_VALUE,
Integer.MIN_VALUE, partialTicks);

}

matrixStack.pop();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected void openScreen()
@Override
protected String getText()
{
return setting.getName() + ": " + setting.getBlockNames().size();
return setting.getName() + ": " + setting.size();
}

@Override
Expand Down
38 changes: 4 additions & 34 deletions src/main/java/net/wurstclient/commands/BlockListCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@
*/
package net.wurstclient.commands;

import java.util.Collections;
import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.InvalidIdentifierException;
import net.wurstclient.DontBlock;
import net.wurstclient.Feature;
import net.wurstclient.command.CmdError;
Expand Down Expand Up @@ -84,15 +79,13 @@ private void add(Feature feature, BlockListSetting setting, String[] args)
throw new CmdSyntaxError();

String inputBlockName = args[3];
Block block = getBlockFromNameOrID(inputBlockName);
Block block = BlockUtils.getBlockFromNameOrID(inputBlockName);
if(block == null)
throw new CmdSyntaxError(
"\"" + inputBlockName + "\" is not a valid block.");

String blockName = BlockUtils.getName(block);
int index =
Collections.binarySearch(setting.getBlockNames(), blockName);
if(index >= 0)
if(setting.contains(blockName))
throw new CmdError(feature.getName() + " " + setting.getName()
+ " already contains " + blockName);

Expand All @@ -106,14 +99,13 @@ private void remove(Feature feature, BlockListSetting setting,
throw new CmdSyntaxError();

String inputBlockName = args[3];
Block block = getBlockFromNameOrID(inputBlockName);
Block block = BlockUtils.getBlockFromNameOrID(inputBlockName);
if(block == null)
throw new CmdSyntaxError(
"\"" + inputBlockName + "\" is not a valid block.");

String blockName = BlockUtils.getName(block);
int index =
Collections.binarySearch(setting.getBlockNames(), blockName);
int index = setting.indexOf(blockName);
if(index < 0)
throw new CmdError(feature.getName() + " " + setting.getName()
+ " does not contain " + blockName);
Expand Down Expand Up @@ -168,26 +160,4 @@ private BlockListSetting getAsBlockListSetting(Feature feature,

return (BlockListSetting)setting;
}

private Block getBlockFromNameOrID(String nameOrId)
{
if(MathUtils.isInteger(nameOrId))
{
BlockState state = Block.STATE_IDS.get(Integer.parseInt(nameOrId));
if(state == null)
return null;

return state.getBlock();
}

try
{
return Registries.BLOCK.getOrEmpty(Identifier.of(nameOrId))
.orElse(null);

}catch(InvalidIdentifierException e)
{
return null;
}
}
}
30 changes: 2 additions & 28 deletions src/main/java/net/wurstclient/commands/SetBlockCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
package net.wurstclient.commands;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.InvalidIdentifierException;
import net.wurstclient.DontBlock;
import net.wurstclient.Feature;
import net.wurstclient.command.CmdError;
Expand All @@ -20,8 +16,8 @@
import net.wurstclient.command.Command;
import net.wurstclient.settings.BlockSetting;
import net.wurstclient.settings.Setting;
import net.wurstclient.util.BlockUtils;
import net.wurstclient.util.CmdUtils;
import net.wurstclient.util.MathUtils;

@DontBlock
public final class SetBlockCmd extends Command
Expand Down Expand Up @@ -67,32 +63,10 @@ private void setBlock(BlockSetting setting, String value)
return;
}

Block block = getBlockFromNameOrID(value);
Block block = BlockUtils.getBlockFromNameOrID(value);
if(block == null)
throw new CmdSyntaxError("\"" + value + "\" is not a valid block.");

setting.setBlock(block);
}

private Block getBlockFromNameOrID(String nameOrId)
{
if(MathUtils.isInteger(nameOrId))
{
BlockState state = Block.STATE_IDS.get(Integer.parseInt(nameOrId));
if(state == null)
return null;

return state.getBlock();
}

try
{
return Registries.BLOCK.getOrEmpty(Identifier.of(nameOrId))
.orElse(null);

}catch(InvalidIdentifierException e)
{
return null;
}
}
}
Loading

0 comments on commit de4d5f4

Please sign in to comment.