diff --git a/.gitignore b/.gitignore index a1c2a23..007f4c9 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,32 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +# gradle +.gradle/ +build/ +out/ +classes/ + +# eclipse +*.launch + +# idea +.idea/ +*.iml +*.ipr +*.iws + +# vscode +.settings/ +.vscode/ +bin/ +.classpath +.project + +# macos +*.DS_Store + +# fabric +run/ +fix_intellij.bat diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..6d30805 --- /dev/null +++ b/build.gradle @@ -0,0 +1,77 @@ +plugins { + id 'fabric-loom' version '1.0-SNAPSHOT' + id 'maven-publish' +} + +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 + +archivesBaseName = project.archives_base_name +version = project.mod_version +group = project.maven_group + +repositories { + // Add repositories to retrieve artifacts from in here. + // You should only use this when depending on other mods because + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html + // for more information about repositories. +} + +dependencies { + // To change the versions see the gradle.properties file + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + + // Fabric API. This is technically optional, but you probably want it anyway. + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + + // Uncomment the following line to enable the deprecated Fabric API modules. + // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. + + // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" +} + +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. + it.options.release = 17 +} + +java { + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() +} + +jar { + from("LICENSE") { + rename { "${it}_${project.archivesBaseName}"} + } +} + +// configure the maven publication +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..748fc93 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,16 @@ +# Done to increase the memory available to gradle. +org.gradle.jvmargs=-Xmx1G + +# Fabric Properties + # check these on https://fabricmc.net/develop + minecraft_version=1.19.2 + yarn_mappings=1.19.2+build.28 + loader_version=0.14.10 + +# Mod Properties + mod_version = 1.19.2 + maven_group = com.wubz + archives_base_name = WubzMod + +# Dependencies + fabric_version=0.66.0+1.19.2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ae04661 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..1b6c787 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# 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"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# 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. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..b02216b --- /dev/null +++ b/settings.gradle @@ -0,0 +1,10 @@ +pluginManagement { + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + mavenCentral() + gradlePluginPortal() + } +} diff --git a/src/main/java/net/wubz/wubzmod/WubzMod.java b/src/main/java/net/wubz/wubzmod/WubzMod.java new file mode 100644 index 0000000..d828768 --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/WubzMod.java @@ -0,0 +1,24 @@ +package net.wubz.wubzmod; + +import net.fabricmc.api.ModInitializer; +import net.minecraft.client.MinecraftClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WubzMod implements ModInitializer { + public static final Logger LOGGER = LoggerFactory.getLogger("wubzmod"); + public static boolean LiveOverflowBypass = true; + + + public static boolean Flying = false; + public static boolean XRay = false; + public static boolean GigaChad = false; + + public static MinecraftClient instance = MinecraftClient.getInstance(); + + + @Override + public void onInitialize() { + LOGGER.info("WubzMod 1.19.2"); + } +} diff --git a/src/main/java/net/wubz/wubzmod/gui/ModHud.java b/src/main/java/net/wubz/wubzmod/gui/ModHud.java new file mode 100644 index 0000000..b0560eb --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/gui/ModHud.java @@ -0,0 +1,76 @@ +/* + * Credits to FuFuClient + */ +package net.wubz.wubzmod.gui; + +import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.TitleScreen; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.text.Text; +import net.wubz.wubzmod.WubzMod; + +import java.util.ArrayList; +import java.util.List; + +public class ModHud extends Screen { + private final MinecraftClient client = WubzMod.instance; + private final TextRenderer fontRenderer = WubzMod.instance.textRenderer; + private ClientPlayerEntity player; + private MatrixStack matrixStack; + private String Name = "WubzMod"; + + public ModHud() { + super(Text.translatable("Mod Hud")); + + } + + public void draw(MatrixStack matrixStack) { + this.player = this.client.player; + this.matrixStack = matrixStack; + RenderSystem.enableBlend(); + this.drawWatermak(); + this.drawInfo(); + this.client.getProfiler().pop(); + } + private void drawInfo() { + List gameInfo = getGameInfo(); + int lineHeight = this.fontRenderer.fontHeight; + int height = this.height + 40; + int width = this.width + 4; + + for (String line : gameInfo) { + this.fontRenderer.drawWithShadow(this.matrixStack, line, width, height - (lineHeight), 0x00E0E0E0); + height -= lineHeight + 4; + } + } + + private void drawWatermak() { + if (this.player.getWorld().getRegistryKey().getValue().toString().equals("minecraft:overworld")) + this.Name = "\u00a7cWubz\u00a78Mod"; + else if (this.player.getWorld().getRegistryKey().getValue().toString().equals("minecraft:the_nether")) + this.Name = "\u00a7aWubz\u00a78Mod"; + this.fontRenderer.drawWithShadow(this.matrixStack, this.Name, this.width + 4, this.height + 4, 0x00E0E0E0); + } + + private List getGameInfo() { + List gameInfo = new ArrayList<>(); + String coordDirectionStatus = ""; + String direction = this.player.getHorizontalFacing().asString(); + String coordsFormat = "%.0f, %.0f, %.0f"; + + if (this.player.getWorld().getRegistryKey().getValue().toString().equals("minecraft:overworld")) + gameInfo.add("\u00a7cNether: \u00a7f" + String.format(coordsFormat, this.player.getX() / 8, this.player.getY(), this.player.getZ() / 8)); + else if (this.player.getWorld().getRegistryKey().getValue().toString().equals("minecraft:the_nether")) + gameInfo.add("\u00a7aOverworld: \u00a7f" + String.format(coordsFormat, this.player.getX() * 8, this.player.getY(), this.player.getZ() * 8)); + + coordDirectionStatus += String.format(coordsFormat, this.player.getX(), this.player.getY(), this.player.getZ()); + coordDirectionStatus += " (" + direction + ")"; + gameInfo.add("\u00a78Cords: \u00a7f"+coordDirectionStatus); + + return gameInfo; + } +} diff --git a/src/main/java/net/wubz/wubzmod/gui/ModOptions.java b/src/main/java/net/wubz/wubzmod/gui/ModOptions.java new file mode 100644 index 0000000..301cc0f --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/gui/ModOptions.java @@ -0,0 +1,83 @@ +package net.wubz.wubzmod.gui; + +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.option.GameOptions; +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; +import net.minecraft.util.math.Vec3d; +import net.wubz.wubzmod.WubzMod; +import net.wubz.wubzmod.modules.GigaChad; + +import java.util.Objects; + +public class ModOptions extends Screen { + private final Screen parent; + private final GameOptions settings; + + public ModOptions(Screen parent, GameOptions gameOptions) { + super(Text.translatable("Wubz's Tools")); + this.parent = parent; + this.settings = gameOptions; + } + + MutableText ModText(boolean modEnabled,String modName) { + if(modEnabled) + return Text.translatable(modName + " \u00a7aEnabled"); + else + return Text.translatable(modName + " \u00a7cDisabled"); + } + + protected void init() { + this.addDrawableChild(new ButtonWidget(10, 10, 90, 20, Text.translatable("Game Menu"), (button) -> { + assert this.client != null; + this.client.setScreen(this.parent); + })); + + this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 25, 60, 20, Text.translatable("TP X"), (button) -> { + Vec3d pos = WubzMod.instance.player.getPos(); + WubzMod.instance.player.setPos(pos.getX()+ 5, pos.getY(), pos.getZ()); + WubzMod.instance.player.kill(); + })); + + this.addDrawableChild(new ButtonWidget(this.width / 2 - 30, this.height / 6 + 25, 60, 20, Text.translatable("TP Y"), (button) -> { + Vec3d pos = WubzMod.instance.player.getPos(); + WubzMod.instance.player.setPos(pos.getX(), pos.getY() + 5, pos.getZ() + 5); + })); + + this.addDrawableChild(new ButtonWidget(this.width / 2 + 40, this.height / 6 + 25, 60, 20, Text.translatable("TP Z"), (button) -> { + Vec3d pos = WubzMod.instance.player.getPos(); + WubzMod.instance.player.setPos(pos.getX(), pos.getY(), pos.getZ() + 5); + })); + + this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 50, 200, 20, ModText(WubzMod.Flying, "Flying hack:"), (button) -> { + WubzMod.Flying = !WubzMod.Flying; + button.setMessage(ModText(WubzMod.Flying, "Flying hack:")); + })); + + this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 75, 200, 20, ModText(WubzMod.XRay, "XRay hack:"), (button) -> { + assert client != null; + if(client.worldRenderer.isTerrainRenderComplete()) { + WubzMod.XRay = !WubzMod.XRay; + if(WubzMod.instance.player!=null && WubzMod.instance.options!=null && WubzMod.XRay){ + WubzMod.instance.player.addStatusEffect(new StatusEffectInstance(Objects.requireNonNull(StatusEffect.byRawId(16)), + Integer.MAX_VALUE,0, false, false, false)); + } + if(WubzMod.instance.player!=null && WubzMod.instance.options!=null && !WubzMod.XRay) { + WubzMod.instance.player.removeStatusEffect(StatusEffect.byRawId(16)); + } + client.worldRenderer.reload(); + button.setMessage(ModText(WubzMod.XRay, "XRay hack:")); + } + })); + + this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 100, 200, 20, ModText(WubzMod.GigaChad, "GigaChad hack:"), (button) -> { + WubzMod.GigaChad = !WubzMod.GigaChad; + GigaChad.GigaChad(); + button.setMessage(ModText(WubzMod.GigaChad, "GigaChad hack:")); + })); + + } +} diff --git a/src/main/java/net/wubz/wubzmod/mixin/BlockMixin.java b/src/main/java/net/wubz/wubzmod/mixin/BlockMixin.java new file mode 100644 index 0000000..0c8a72b --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/mixin/BlockMixin.java @@ -0,0 +1,21 @@ +package net.wubz.wubzmod.mixin; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.BlockView; +import net.wubz.wubzmod.modules.XRay; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + + +@Mixin(Block.class) +public class BlockMixin { + @Inject(at = @At("Return"), method = "shouldDrawSide", cancellable = true) + private static void shouldRenderFace(BlockState state, BlockView world, BlockPos pos, Direction face, + BlockPos blockPos, CallbackInfoReturnable ci) { + ci.setReturnValue(XRay.XRay(state)); + } +} diff --git a/src/main/java/net/wubz/wubzmod/mixin/GameInfoMixin.java b/src/main/java/net/wubz/wubzmod/mixin/GameInfoMixin.java new file mode 100644 index 0000000..215a573 --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/mixin/GameInfoMixin.java @@ -0,0 +1,29 @@ +package net.wubz.wubzmod.mixin; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.hud.InGameHud; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.util.math.MatrixStack; +import net.wubz.wubzmod.WubzMod; +import net.wubz.wubzmod.gui.ModHud; +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; + +@Mixin(value = InGameHud.class) +public class GameInfoMixin { + private ModHud hudInfo; + + @Inject(method = "(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/render/item/ItemRenderer;)V", at = @At(value = "RETURN")) + private void onInit(MinecraftClient client, ItemRenderer render, CallbackInfo ci) { + this.hudInfo = new ModHud(); + } + + @Inject(method = "render", at = @At("HEAD")) + private void onDraw(MatrixStack matrixStack, float esp, CallbackInfo ci) { + this.hudInfo.draw(matrixStack); + } +} diff --git a/src/main/java/net/wubz/wubzmod/mixin/GameMenuScreenMixin.java b/src/main/java/net/wubz/wubzmod/mixin/GameMenuScreenMixin.java new file mode 100644 index 0000000..4b27112 --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/mixin/GameMenuScreenMixin.java @@ -0,0 +1,24 @@ +package net.wubz.wubzmod.mixin; + +import net.minecraft.client.gui.screen.GameMenuScreen; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.wubz.wubzmod.gui.ModOptions; +import net.minecraft.text.Text; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(GameMenuScreen.class) +public abstract class GameMenuScreenMixin extends Screen { + protected GameMenuScreenMixin(Text menu) { super(menu); } + + @Inject(at = @At("HEAD"), method = "initWidgets") + private void onInitWigets(CallbackInfo ci){ + this.addDrawableChild(new ButtonWidget(10, 10, 90, 20, Text.translatable("Wubz's Tools"), (button) ->{ + assert this.client != null; + this.client.setScreen(new ModOptions(this, this.client.options)); + } )); + } +} diff --git a/src/main/java/net/wubz/wubzmod/mixin/GameStateChangeS2CPacketMixin.java b/src/main/java/net/wubz/wubzmod/mixin/GameStateChangeS2CPacketMixin.java new file mode 100644 index 0000000..dc1830a --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/mixin/GameStateChangeS2CPacketMixin.java @@ -0,0 +1,25 @@ +package net.wubz.wubzmod.mixin; + +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket; +import net.wubz.wubzmod.WubzMod; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; + +@Mixin(GameStateChangeS2CPacket.class) +public class GameStateChangeS2CPacketMixin { + /** + * @author + * Wubz (dkonis) + * @reason + * Bypassing LiveOverflow's demo by not applying + * the GameStateChange Packet + */ + @Overwrite + public void apply(ClientPlayPacketListener clientPlayPacketListener) { + GameStateChangeS2CPacket packet = (GameStateChangeS2CPacket) (Object) this; + if(!WubzMod.LiveOverflowBypass){ + clientPlayPacketListener.onGameStateChange(packet); + } + } +} diff --git a/src/main/java/net/wubz/wubzmod/mixin/MinecraftClientMixin.java b/src/main/java/net/wubz/wubzmod/mixin/MinecraftClientMixin.java new file mode 100644 index 0000000..0aa89c0 --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/mixin/MinecraftClientMixin.java @@ -0,0 +1,16 @@ +package net.wubz.wubzmod.mixin; + +import net.minecraft.client.MinecraftClient; +import net.wubz.wubzmod.modules.Flying; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(MinecraftClient.class) +public class MinecraftClientMixin { + @Inject(at = @At("TAIL"), method = "tick") + private void tick(CallbackInfo ci) { + Flying.Flying(); + } +} diff --git a/src/main/java/net/wubz/wubzmod/mixin/PlayerC2SPacketPositionAndOnGroundMixin.java b/src/main/java/net/wubz/wubzmod/mixin/PlayerC2SPacketPositionAndOnGroundMixin.java new file mode 100644 index 0000000..a7dd7d8 --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/mixin/PlayerC2SPacketPositionAndOnGroundMixin.java @@ -0,0 +1,26 @@ +/* +* This solution was provided by LynJuice + */ +package net.wubz.wubzmod.mixin; + +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.wubz.wubzmod.WubzMod; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArgs; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; + +@Mixin(PlayerMoveC2SPacket.PositionAndOnGround.class) +public class PlayerC2SPacketPositionAndOnGroundMixin { + private static double roundCoordinate(double n) { + n = Math.round(n * 100) / 100d; + return Math.nextAfter(n, n + Math.signum(n)); + } + @ModifyArgs(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket;(DDDFFZZZ)V")) + private static void init(Args args) { + if(WubzMod.LiveOverflowBypass) { + args.set(0, roundCoordinate(args.get(0))); + args.set(2, roundCoordinate(args.get(2))); + } + } +} diff --git a/src/main/java/net/wubz/wubzmod/mixin/PlayerMoveC2SPacketMixin.java b/src/main/java/net/wubz/wubzmod/mixin/PlayerMoveC2SPacketMixin.java new file mode 100644 index 0000000..4df4a69 --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/mixin/PlayerMoveC2SPacketMixin.java @@ -0,0 +1,27 @@ +/* + * This solution was provided by LynJuice + */ +package net.wubz.wubzmod.mixin; + +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.wubz.wubzmod.WubzMod; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArgs; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; + +@Mixin(PlayerMoveC2SPacket.Full.class) +public abstract class PlayerMoveC2SPacketMixin { + private static double roundCoordinate(double n) { + n = Math.round(n * 100) / 100d; + return Math.nextAfter(n, n + Math.signum(n)); + } + @ModifyArgs(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket;(DDDFFZZZ)V")) + private static void init(Args args) { + if(WubzMod.LiveOverflowBypass) { + args.set(0, roundCoordinate(args.get(0))); + args.set(2, roundCoordinate(args.get(2))); + } + } +} diff --git a/src/main/java/net/wubz/wubzmod/mixin/TitleScreenMixin.java b/src/main/java/net/wubz/wubzmod/mixin/TitleScreenMixin.java new file mode 100644 index 0000000..b958cb8 --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/mixin/TitleScreenMixin.java @@ -0,0 +1,35 @@ +package net.wubz.wubzmod.mixin; + +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.TitleScreen; +import net.minecraft.client.gui.screen.world.SelectWorldScreen; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; +import net.wubz.wubzmod.WubzMod; +import net.wubz.wubzmod.gui.ModOptions; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(TitleScreen.class) +public abstract class TitleScreenMixin extends Screen { + + protected TitleScreenMixin(Text title) { super(title); } + + MutableText ModText(boolean modEnabled,String modName) { + if(modEnabled) + return Text.translatable(modName + " \u00a7aEnabled"); + else + return Text.translatable(modName + " \u00a7cDisabled"); + } + + @Inject(at = @At("HEAD"), method = "initWidgetsNormal(II)V") + private void onInitWigets(int y, int spacingY, CallbackInfo ci){ + this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, y + spacingY * 5 - 10, 200, 20, ModText(WubzMod.LiveOverflowBypass, "LiveOverflow Bypass:"), (button) -> { + WubzMod.LiveOverflowBypass = !WubzMod.LiveOverflowBypass; + button.setMessage(ModText(WubzMod.LiveOverflowBypass, "LiveOverflow Bypass:")); + })); + } +} diff --git a/src/main/java/net/wubz/wubzmod/mixin/WorldBorderInitializeS2CPacketMixin.java b/src/main/java/net/wubz/wubzmod/mixin/WorldBorderInitializeS2CPacketMixin.java new file mode 100644 index 0000000..ead28ee --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/mixin/WorldBorderInitializeS2CPacketMixin.java @@ -0,0 +1,26 @@ +package net.wubz.wubzmod.mixin; + +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket; +import net.minecraft.network.packet.s2c.play.WorldBorderInitializeS2CPacket; +import net.wubz.wubzmod.WubzMod; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; + +@Mixin(WorldBorderInitializeS2CPacket.class) +public class WorldBorderInitializeS2CPacketMixin { + /** + * @author + * Wubz (dkonis) + * @reason + * Bypassing LiveOverflow's border by not applying + * the WorldBorderInitialize Packet + */ + @Overwrite + public void apply(ClientPlayPacketListener clientPlayPacketListener) { + WorldBorderInitializeS2CPacket packet = (WorldBorderInitializeS2CPacket) (Object) this; + if(!WubzMod.LiveOverflowBypass){ + clientPlayPacketListener.onWorldBorderInitialize(packet); + } + } +} diff --git a/src/main/java/net/wubz/wubzmod/modules/Flying.java b/src/main/java/net/wubz/wubzmod/modules/Flying.java new file mode 100644 index 0000000..5bec56a --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/modules/Flying.java @@ -0,0 +1,47 @@ +package net.wubz.wubzmod.modules; + +import net.minecraft.network.ClientConnection; +import net.minecraft.network.Packet; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.minecraft.util.math.Vec3d; +import net.wubz.wubzmod.WubzMod; + +public class Flying { + private static int counter = 0; + private final static double FALL_PACKET = 0.2; + + public static void Flying(){ + if(WubzMod.instance.player!=null && WubzMod.Flying) { + enableFlying(); + } + else if (WubzMod.instance.player != null) { + disableFlying(); + } + } + + private static void enableFlying(){ + assert WubzMod.instance.player != null; + + if (!WubzMod.instance.player.getAbilities().allowFlying) { + WubzMod.instance.player.getAbilities().allowFlying = true; + } + + if(counter==0 && !WubzMod.instance.player.isOnGround()) { + ClientConnection conn = WubzMod.instance.player.networkHandler.getConnection(); + Vec3d pos = WubzMod.instance.player.getPos().subtract(0.0, FALL_PACKET, 0.0); + Packet packet = new PlayerMoveC2SPacket.PositionAndOnGround(pos.getX(), pos.getY(), pos.getZ(), false); + conn.send(packet); + } + + if(counter == 0) + counter = 20; + counter --; + + } + + private static void disableFlying(){ + assert WubzMod.instance.player != null; + if (WubzMod.instance.player.getAbilities().allowFlying) + WubzMod.instance.player.getAbilities().allowFlying = false; + } +} diff --git a/src/main/java/net/wubz/wubzmod/modules/GigaChad.java b/src/main/java/net/wubz/wubzmod/modules/GigaChad.java new file mode 100644 index 0000000..3780113 --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/modules/GigaChad.java @@ -0,0 +1,41 @@ +package net.wubz.wubzmod.modules; + +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.wubz.wubzmod.WubzMod; + +import java.util.Objects; + +public class GigaChad { + + public static void GigaChad(){ + if(WubzMod.instance.player!=null && WubzMod.GigaChad) + enableGigaChad(); + if(WubzMod.instance.player!=null && !WubzMod.GigaChad) + disableGigaChad(); + } + + private static void enableGigaChad(){ + assert WubzMod.instance.player != null; + WubzMod.instance.player.addStatusEffect(new StatusEffectInstance(Objects.requireNonNull(StatusEffect.byRawId(1)), + Integer.MAX_VALUE,2, false, false, false)); + WubzMod.instance.player.addStatusEffect(new StatusEffectInstance(Objects.requireNonNull(StatusEffect.byRawId(3)), + Integer.MAX_VALUE,2, false, false, false)); + WubzMod.instance.player.addStatusEffect(new StatusEffectInstance(Objects.requireNonNull(StatusEffect.byRawId(5)), + Integer.MAX_VALUE,2, false, false, true)); + WubzMod.instance.player.addStatusEffect(new StatusEffectInstance(Objects.requireNonNull(StatusEffect.byRawId(8)), + Integer.MAX_VALUE,0, false, false, false)); + WubzMod.instance.player.addStatusEffect(new StatusEffectInstance(Objects.requireNonNull(StatusEffect.byRawId(10)), + Integer.MAX_VALUE,2, false, false, false)); + + } + + private static void disableGigaChad(){ + assert WubzMod.instance.player != null; + WubzMod.instance.player.removeStatusEffect(StatusEffect.byRawId(1)); + WubzMod.instance.player.removeStatusEffect(StatusEffect.byRawId(3)); + WubzMod.instance.player.removeStatusEffect(StatusEffect.byRawId(5)); + WubzMod.instance.player.removeStatusEffect(StatusEffect.byRawId(8)); + WubzMod.instance.player.removeStatusEffect(StatusEffect.byRawId(10)); + } +} diff --git a/src/main/java/net/wubz/wubzmod/modules/XRay.java b/src/main/java/net/wubz/wubzmod/modules/XRay.java new file mode 100644 index 0000000..4623125 --- /dev/null +++ b/src/main/java/net/wubz/wubzmod/modules/XRay.java @@ -0,0 +1,58 @@ +package net.wubz.wubzmod.modules; + +import net.minecraft.block.BlockState; +import net.wubz.wubzmod.WubzMod; + +import java.util.HashSet; + +public class XRay { + private static final HashSet blocksToRender = new HashSet<>(); + + public static boolean XRay(BlockState state){ + + if(WubzMod.instance.player!=null && WubzMod.instance.options!=null && WubzMod.XRay){ + Blocks(); + return XRay.renderBlock(state); + } + return true; + } + + private static void Blocks(){ + blocksToRender.add("Block{minecraft:ancient_debris}"); + blocksToRender.add("Block{minecraft:diamond_ore}"); + blocksToRender.add("Block{minecraft:deepslate_diamond_ore}"); + blocksToRender.add("Block{minecraft:gold_ore}"); + blocksToRender.add("Block{minecraft:deepslate_gold_ore}"); + blocksToRender.add("Block{raw_iron_block}"); + blocksToRender.add("Block{minecraft:iron_ore}"); + blocksToRender.add("Block{minecraft:deepslate_iron_ore}"); + blocksToRender.add("Block{minecraft:coal_ore}"); + blocksToRender.add("Block{minecraft:deepslate_coal_ore}"); + blocksToRender.add("Block{minecraft:lapis_ore}"); + blocksToRender.add("Block{minecraft:deepslate_lapis_ore}"); + blocksToRender.add("Block{minecraft:redstone_ore}"); + blocksToRender.add("Block{minecraft:deepslate_redstone_ore}"); + blocksToRender.add("Block{minecraft:lit_redstone_ore}"); + blocksToRender.add("Block{minecraft:emerald_ore}"); + blocksToRender.add("Block{minecraft:deepslate_emerald_ore}"); + blocksToRender.add("Block{minecraft:chest}"); + blocksToRender.add("Block{minecraft:trapped_chest}"); + blocksToRender.add("Block{minecraft:spawner}"); + blocksToRender.add("Block{minecraft:mob_spawner}"); + blocksToRender.add("Block{minecraft:lava}"); + blocksToRender.add("Block{minecraft:water}"); + blocksToRender.add("Block{minecraft:air}"); + + //Ancient City Blockss + blocksToRender.add("Block{sculk_sensor}"); + blocksToRender.add("Block{sculk_shrieker}"); + + //amethyst + blocksToRender.add("Block{amethyst_block}"); + } + + + private static boolean renderBlock(BlockState state) { + return blocksToRender.contains(state.getBlock().toString()); + } +} diff --git a/src/main/resources/assets/modid/icon.png b/src/main/resources/assets/modid/icon.png new file mode 100644 index 0000000..047b91f Binary files /dev/null and b/src/main/resources/assets/modid/icon.png differ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..38a9d2f --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,38 @@ +{ + "schemaVersion": 1, + "id": "wubzmod", + "version": "${version}", + + "name": "WubzMod", + "description": "Hacks for Minecraft", + "authors": [ + "Wubz" + ], + "contact": { + "homepage": "https://fabricmc.net/", + "sources": "https://github.com/FabricMC/fabric-example-mod" + }, + + "license": "MIT", + "icon": "assets/modid/icon.png", + + "environment": "*", + "entrypoints": { + "main": [ + "net.wubz.wubzmod.WubzMod" + ] + }, + "mixins": [ + "wubzmod.mixins.json" + ], + + "depends": { + "fabricloader": ">=0.14.10", + "fabric-api": "*", + "minecraft": "~1.19", + "java": ">=17" + }, + "suggests": { + "another-mod": "*" + } +} diff --git a/src/main/resources/wubzmod.mixins.json b/src/main/resources/wubzmod.mixins.json new file mode 100644 index 0000000..ac90b42 --- /dev/null +++ b/src/main/resources/wubzmod.mixins.json @@ -0,0 +1,22 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "net.wubz.wubzmod.mixin", + "compatibilityLevel": "JAVA_17", + "mixins": [ + ], + "client": [ + "TitleScreenMixin", + "GameMenuScreenMixin", + "GameInfoMixin", + "MinecraftClientMixin", + "BlockMixin", + "PlayerMoveC2SPacketMixin", + "PlayerC2SPacketPositionAndOnGroundMixin", + "GameStateChangeS2CPacketMixin", + "WorldBorderInitializeS2CPacketMixin" + ], + "injectors": { + "defaultRequire": 1 + } +}