Skip to content

Commit

Permalink
Merge branch 'master' into pr/IUDevman/904
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Dec 18, 2023
2 parents 660d9f5 + 1d48100 commit 28c6538
Show file tree
Hide file tree
Showing 115 changed files with 5,835 additions and 5,331 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute Gradle build
run: ./gradlew build
run: ./gradlew build spotlessCheck
- name: VirusTotal scan
if: github.event_name == 'push'
uses: crazy-max/ghaction-virustotal@v4
Expand Down
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ buildscript {
plugins {
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'maven-publish'
id 'com.diffplug.spotless' version '6.23.3'
}

def ENV = System.getenv()
Expand Down Expand Up @@ -74,6 +75,16 @@ jar {
}
}

spotless {
java {
removeUnusedImports()
indentWithTabs()
trimTrailingWhitespace()
eclipse().configFile(file("codestyle/formatter.xml"))
lineEndings('WINDOWS')
}
}

// configure the maven publication
publishing {
publications {
Expand Down
762 changes: 399 additions & 363 deletions codestyle/formatter.xml

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ org.gradle.parallel=true
# Fabric Properties
# check these at https://fabricmc.net/develop/ and
# https://www.curseforge.com/minecraft/mc-mods/fabric-api
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.14.24
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.2

#Fabric api
fabric_version=0.90.7+1.20.2
fabric_version=0.91.2+1.20.4

# Mod Properties
mod_version = v7.39.1-MC1.20.2
mod_version = v7.40-MC1.20.4
maven_group = net.wurstclient
archives_base_name = Wurst-Client

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
16 changes: 8 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down Expand Up @@ -246,4 +246,4 @@ eval "set -- $(
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
4 changes: 2 additions & 2 deletions src/main/java/net/wurstclient/FriendsList.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void middleClick(Entity entity)
if(!middleClickFriends.isChecked())
return;

String name = entity.getEntityName();
String name = entity.getName().getString();

if(contains(name))
removeAndSave(name);
Expand All @@ -75,7 +75,7 @@ public boolean contains(String name)

public boolean isFriend(Entity entity)
{
return entity != null && contains(entity.getEntityName());
return entity != null && contains(entity.getName().getString());
}

public ArrayList<String> toList()
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/wurstclient/WurstClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public enum WurstClient
public static MinecraftClient MC;
public static IMinecraftClient IMC;

public static final String VERSION = "7.39.1";
public static final String MC_VERSION = "1.20.2";
public static final String VERSION = "7.40";
public static final String MC_VERSION = "1.20.4";

private WurstAnalytics analytics;
private EventManager eventManager;
Expand Down
60 changes: 30 additions & 30 deletions src/main/java/net/wurstclient/WurstInitializer.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
/*
* Copyright (c) 2014-2023 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;

import net.fabricmc.api.ModInitializer;

public final class WurstInitializer implements ModInitializer
{
private static boolean initialized;

@Override
public void onInitialize()
{
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.

if(initialized)
throw new RuntimeException(
"WurstInitializer.onInitialize() ran twice!");

WurstClient.INSTANCE.initialize();
initialized = true;
}
}
/*
* Copyright (c) 2014-2023 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;

import net.fabricmc.api.ModInitializer;

public final class WurstInitializer implements ModInitializer
{
private static boolean initialized;

@Override
public void onInitialize()
{
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.

if(initialized)
throw new RuntimeException(
"WurstInitializer.onInitialize() ran twice!");

WurstClient.INSTANCE.initialize();
initialized = true;
}
}
2 changes: 1 addition & 1 deletion src/main/java/net/wurstclient/commands/CopyItemCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private AbstractClientPlayerEntity getPlayer(String name) throws CmdError
{
for(AbstractClientPlayerEntity player : MC.world.getPlayers())
{
if(!player.getEntityName().equalsIgnoreCase(name))
if(!player.getName().getString().equalsIgnoreCase(name))
continue;

return player;
Expand Down
178 changes: 89 additions & 89 deletions src/main/java/net/wurstclient/commands/EnchantCmd.java
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
/*
* Copyright (c) 2014-2023 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.commands;

import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.wurstclient.command.CmdError;
import net.wurstclient.command.CmdException;
import net.wurstclient.command.CmdSyntaxError;
import net.wurstclient.command.Command;
import net.wurstclient.util.ChatUtils;
import net.wurstclient.util.ItemUtils;

public final class EnchantCmd extends Command
{
public EnchantCmd()
{
super("enchant", "Enchants an item with everything,\n"
+ "except for silk touch and curses.", ".enchant");
}

@Override
public void call(String[] args) throws CmdException
{
if(!MC.player.getAbilities().creativeMode)
throw new CmdError("Creative mode only.");

if(args.length > 1)
throw new CmdSyntaxError();

enchant(getHeldItem(), 127);
ChatUtils.message("Item enchanted.");
}

private ItemStack getHeldItem() throws CmdError
{
ItemStack stack = MC.player.getMainHandStack();

if(stack.isEmpty())
stack = MC.player.getOffHandStack();

if(stack.isEmpty())
throw new CmdError("There is no item in your hand.");

return stack;
}

private void enchant(ItemStack stack, int level)
{
for(Enchantment enchantment : Registries.ENCHANTMENT)
{
// Skip curses
if(enchantment.isCursed())
continue;

// Skip Silk Touch so it doesn't remove Fortune
if(enchantment == Enchantments.SILK_TOUCH)
continue;

// Limit Quick Charge to level 5 so it doesn't break
if(enchantment == Enchantments.QUICK_CHARGE)
{
stack.addEnchantment(enchantment, Math.min(level, 5));
continue;
}

ItemUtils.addEnchantment(stack, enchantment, level);
}
}

@Override
public String getPrimaryAction()
{
return "Enchant Held Item";
}

@Override
public void doPrimaryAction()
{
WURST.getCmdProcessor().process("enchant");
}
}
/*
* Copyright (c) 2014-2023 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.commands;

import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.wurstclient.command.CmdError;
import net.wurstclient.command.CmdException;
import net.wurstclient.command.CmdSyntaxError;
import net.wurstclient.command.Command;
import net.wurstclient.util.ChatUtils;
import net.wurstclient.util.ItemUtils;

public final class EnchantCmd extends Command
{
public EnchantCmd()
{
super("enchant", "Enchants an item with everything,\n"
+ "except for silk touch and curses.", ".enchant");
}

@Override
public void call(String[] args) throws CmdException
{
if(!MC.player.getAbilities().creativeMode)
throw new CmdError("Creative mode only.");

if(args.length > 1)
throw new CmdSyntaxError();

enchant(getHeldItem(), 127);
ChatUtils.message("Item enchanted.");
}

private ItemStack getHeldItem() throws CmdError
{
ItemStack stack = MC.player.getMainHandStack();

if(stack.isEmpty())
stack = MC.player.getOffHandStack();

if(stack.isEmpty())
throw new CmdError("There is no item in your hand.");

return stack;
}

private void enchant(ItemStack stack, int level)
{
for(Enchantment enchantment : Registries.ENCHANTMENT)
{
// Skip curses
if(enchantment.isCursed())
continue;

// Skip Silk Touch so it doesn't remove Fortune
if(enchantment == Enchantments.SILK_TOUCH)
continue;

// Limit Quick Charge to level 5 so it doesn't break
if(enchantment == Enchantments.QUICK_CHARGE)
{
stack.addEnchantment(enchantment, Math.min(level, 5));
continue;
}

ItemUtils.addEnchantment(stack, enchantment, level);
}
}

@Override
public String getPrimaryAction()
{
return "Enchant Held Item";
}

@Override
public void doPrimaryAction()
{
WURST.getCmdProcessor().process("enchant");
}
}
Loading

0 comments on commit 28c6538

Please sign in to comment.