commit 1add9bbf9d27c96b81088c53e935571b48bc72d9 Author: Wynd Date: Sun Apr 2 20:25:30 2023 +0300 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09cd281 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +# gradle + +.gradle/ +build/ +out/ +classes/ + +# eclipse + +*.launch + +# idea + +.idea/ +*.iml +*.ipr +*.iws + +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# macos + +*.DS_Store + +# fabric + +run/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/README.md b/README.md new file mode 100644 index 0000000..66e3561 --- /dev/null +++ b/README.md @@ -0,0 +1,111 @@ +# BetterBeta + +A (Cursed) Fabric mod for Minecraft Beta 1.7.3 that adds some quality of life changes and fixes some issues. + +**There's a very high change this mod will not work in multiplayer, as of right now it is purely for singleplayer** + +## List of changes + +
Sugar canes can now be places on sand + +![sugar cane on sand](https://i.imgur.com/N7WjSx8.png) + +
+ +
Fixes selected blocks being rendered under text in containers + +Before: +![blocks being rendered under container text](https://i.imgur.com/jaGMYZy.png) + +After: +![blocks being rendered above container text](https://i.imgur.com/giD9ZTm.png) + +
+ +
Fixes the death screen's &e0 message + +Before: +![death screen displaying &e0](https://i.imgur.com/HHLeOhs.png) + +After: +![death screen displaying a yellow score of 0](https://i.imgur.com/rTHeTOk.png) + +**Note: Score will always be 0 as nothing gives score in this version** +
+ +
Made bows bigger and facing the right direction + +Before: +![player holding a bow](https://i.imgur.com/dRgyr7G.png) + +After: +![player holding a bow](https://i.imgur.com/9dgxRej.png) + +Also slightly update the skeleton's model to better hold the bow + +Before: +![skeleton holding a bow](https://i.imgur.com/4Pqe3pk.png) + +After: +![skeleton holding a bow](https://i.imgur.com/SIDJBYI.png) + +
+ +
Updated list of blocks that pickaxes and axes can mine quicker + +**Extra pickaxe blocks:** +- Cobblestone stairs +- Redstone ore +- Iron door +- Bricks +- Furnaces +- Dispensers +- Stone pressure plates +- Rails +- Detector rails +- Powered rails +- Pistons +- Sticky pistons + +**Extra axe blocks:** +- Wooden stairs +- Door +- Pressure plates +- Jukebox +- Note blocks +- Pumpkins +- Signs +- Trapdoors +- Ladders +- Crafting tables +- Fences + +
+ +
Stairs will now drop themselves rather than cobble/planks + +Before:
+
+ +
More sounds + +- Opening / closing chests +- Minecarts +- Items breaking + +**Note: The mod doesn't add any sounds by itself, all of these sounds are already present in your "resources" folder, they are automatically downloaded by Minecraft itself** + +
+ +## Troubleshooting + +**Q: My achievements screen is all messed up** +A: Its very likely you have the Cursed Legacy API installed, you do not need it for this mod to work and it might cause more problems by itself + +**Q: Entities and items don't seem to burn** +A: Check the above answer \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..0102519 --- /dev/null +++ b/build.gradle @@ -0,0 +1,111 @@ +plugins { + id 'fabric-loom' version '0d0261a' + id 'maven-publish' +} + +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + +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 some 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. + maven { + name 'Jitpack' + url 'https://jitpack.io/' + } + maven { + name 'HalfOf2' + url 'https://storage.googleapis.com/devan-maven/' + } +} + +minecraft { + // Skip old versions of libraries which Mojang use but we don't need + addLibraryFilter {library -> + return !(library.startsWith('net.minecraft:launchwrapper:') || + library.startsWith('net.sf.jopt-simple:jopt-simple:') || + library.startsWith('org.ow2.asm:asm-all:')) + } +} + +dependencies { + // To change the versions see the gradle.properties file + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "io.github.minecraft-cursed-legacy:plasma:b1.7.3-build.${project.plasma_build}" + modImplementation("io.github.minecraft-cursed-legacy:cursed-fabric-loader:${project.loader_version}") { + transitive false + } + + // API. You technically don't need it, but it's extremely useful for not having to write the same code in every mod. + // modImplementation "io.github.minecraft-cursed-legacy:cursed-legacy-api:${project.api_version}" + + // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. + // You may need to force-disable transitiveness on them. +} + +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + + // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too + // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. + // We'll use that if it's available, but otherwise we'll use the older option. + def targetVersion = 8 + if (JavaVersion.current().isJava9Compatible()) { + it.options.release = targetVersion + } +} + +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) { + // add all the jars that should be included when publishing to maven + artifact(remapJar) { + builtBy remapJar + } + artifact(sourcesJar) { + builtBy remapSourcesJar + } + } + } + + // 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..ab36d11 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,14 @@ +# Done to increase the memory available to gradle. +org.gradle.jvmargs=-Xmx1G + +# Fabric Properties + minecraft_version=b1.7.3 + loader_version=1.0.0 + plasma_build=22 + #This is actually 1.1.0, but that decided it didn't want to build on maven + api_version=1.1.0.1 + +# Mod Properties + mod_version = 1.0.0 + maven_group = xyz.pixelatedw.betterbeta + archives_base_name = betterbeta diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7454180 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..3ab0b72 --- /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-6.9.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 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..963b035 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,27 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + maven { + name 'Fabric' + url 'https://maven.fabricmc.net/' + } + maven { + name 'Jitpack' + url 'https://jitpack.io/' + } + } + resolutionStrategy { + eachPlugin { + if ( + requested.id.id == "fabric-loom" && !requested.version?.endsWith("-SNAPSHOT")) { + if ( + requested.id.id == "fabric-loom" && !requested.version?.contains("+")) { + useModule("com.github.Chocohead.Fabric-Loom:fabric-loom:${requested.version}") + } else if (requested.id.id == "fabric-loom") { + useModule("net.fabricmc:fabric-loom:${requested.version}") + } + } + } + } +} \ No newline at end of file diff --git a/src/main/java/xyz/pixelatedw/betterbeta/MainMod.java b/src/main/java/xyz/pixelatedw/betterbeta/MainMod.java new file mode 100644 index 0000000..b6a8259 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/MainMod.java @@ -0,0 +1,22 @@ +package xyz.pixelatedw.betterbeta; + +import net.fabricmc.api.ModInitializer; + +public class MainMod implements ModInitializer { + +// private static WritableConfig config; + + @Override + public void onInitialize() { +// // example config +// try { +// config = Configs.loadOrCreate(new Id("modid", "example"), +// ConfigTemplate.builder() +// .addContainer("exampleContainer", container -> container.addDataEntry("someData", "0.5")) +// .build()); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// System.out.println(config.getDoubleValue("exampleContainer.someData")); + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/WyHelper.java b/src/main/java/xyz/pixelatedw/betterbeta/WyHelper.java new file mode 100644 index 0000000..07231c3 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/WyHelper.java @@ -0,0 +1,77 @@ +package xyz.pixelatedw.betterbeta; + +import java.lang.management.ManagementFactory; +import java.util.Random; + +import net.minecraft.entity.player.Player; + +public class WyHelper { + + public static boolean isDebug() + { + return ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("-agentlib:jdwp") > 0; + } + + public static float lerp(float delta, float start, float end) { + return start + delta * (end - start); + } + + public static float clamp(float val, float min, float max) { + return val < min ? min : Math.min(val, max); + } + + public static void cheatCommand(Player player) { + Random rand = new Random(); + player.level.playSound(player, "random.break", 1, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F); + +// player.dropItem(new ItemInstance(ItemType.pickaxeGold, 1, 100), false); +// player.dropItem(new ItemInstance(Tile.STONE, 64), false); + +// player.level.playLevelEvent((Player)null, 1005, (int)player.x, (int)player.y, (int)player.z, 0); + +// player.dropItem(new ItemInstance(Tile.DOOR_WOOD, 1), false); + +// player.dropItem(new ItemInstance(Tile.JUKEBOX, 1), false); +// player.dropItem(new ItemInstance(ItemType.record_cat, 1), false); + +// player.dropItem(new ItemInstance(Tile.STONE_SLAB, 2), false); +// player.dropItem(new ItemInstance(Tile.CHEST, 2), false); +// player.dropItem(new ItemInstance(Tile.FURNACE, 1), false); +// player.dropItem(new ItemInstance(Tile.DISPENSER, 1), false); +// player.dropItem(new ItemInstance(Tile.DIRT, 64), false); +// player.dropItem(new ItemInstance(Tile.DOOR_WOOD, 1), false); +// player.dropItem(new ItemInstance(Tile.STILL_LAVA, 1), false); +// player.dropItem(new ItemInstance(ItemType.pickaxeDiamond, 1), false); +// player.dropItem(new ItemInstance(ItemType.hatchetDiamond, 1), false); +// player.dropItem(new ItemInstance(ItemType.bow, 1), false); +// player.dropItem(new ItemInstance(Tile.COBBLESTONE, 1), false); +// player.dropItem(new ItemInstance(Tile.STAIRS_STONE, 64), false); +// player.dropItem(new ItemInstance(Tile.STAIRS_WOOD, 64), false); +// player.dropItem(new ItemInstance(ItemType.boat, 1), false); +// player.dropItem(new ItemInstance(ItemType.minecart, 1), false); +// player.dropItem(new ItemInstance(ItemType.minecartChest, 1), false); +// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1), false); +// player.dropItem(new ItemInstance(Tile.RAIL, 64), false); +// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64), false); +// player.dropItem(new ItemInstance(Tile.REDSTONE_TORCH, 64), false); +// player.dropItem(new ItemInstance(Tile.BUTTON, 1), false); +// player.dropItem(new ItemInstance(Tile.REDSTONE_DUST, 64), false); + +// player.dropItem(new ItemInstance(ItemType.bootsDiamond, 1), false); +// player.dropItem(new ItemInstance(ItemType.chestplateDiamond, 1), false); +// player.dropItem(new ItemInstance(ItemType.helmetDiamond, 1), false); +// player.dropItem(new ItemInstance(ItemType.leggingsDiamond, 1), false); + +// player.dropItem(new ItemInstance(Tile.FENCE, 1), false); + +// Skeleton enemy = new Skeleton(player.level); +// enemy.setPositionAndAngles(player.x + 2, player.y, player.z, 0.0f, 0.0f); +// player.level.spawnEntity(enemy); + + player.level.setLevelTime(0); + player.level.getProperties().setRaining(false); + player.level.getProperties().setRainTime(0); + player.level.getProperties().setThundering(false); + player.level.getProperties().setThunderTime(0); + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/BipedRendererMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/BipedRendererMixin.java new file mode 100644 index 0000000..1e07519 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/BipedRendererMixin.java @@ -0,0 +1,26 @@ +package xyz.pixelatedw.betterbeta.mixin; + +import org.lwjgl.opengl.GL11; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.client.render.entity.BipedEntityRenderer; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.ItemInstance; +import net.minecraft.item.ItemType; + +@Mixin(BipedEntityRenderer.class) +public class BipedRendererMixin { + + @Inject(method = "method_827", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/HandItemRenderer;method_1862(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemInstance;)V", shift = Shift.BEFORE)) + public void playerRendering(LivingEntity entity, float f, CallbackInfo ci) { + ItemInstance item = entity.getHandRenderItem(); + if (item != null && item.itemId == ItemType.bow.id) { + GL11.glRotatef(-5, 1, 0, 0); + GL11.glTranslatef(0.2F, -0.5F, 0.2F); + } + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/BowItemMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/BowItemMixin.java new file mode 100644 index 0000000..2cc2db3 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/BowItemMixin.java @@ -0,0 +1,18 @@ +package xyz.pixelatedw.betterbeta.mixin; + +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; + +import net.minecraft.item.ItemType; +import net.minecraft.item.tool.BowItem; + +@Mixin(BowItem.class) +public class BowItemMixin { + @Inject(method = "(I)V", at = @At("TAIL")) + public void init(int i, CallbackInfo ci) { + ItemType item = ((ItemType) (Object) this); + item.method_466(); + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/ClientPlayerMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ClientPlayerMixin.java new file mode 100644 index 0000000..d1892e6 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ClientPlayerMixin.java @@ -0,0 +1,42 @@ +package xyz.pixelatedw.betterbeta.mixin; + +import java.util.Random; + +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; + +import net.minecraft.container.ChestContainer; +import net.minecraft.entity.player.ClientPlayer; +import net.minecraft.entity.player.Player; +import net.minecraft.inventory.Inventory; +import xyz.pixelatedw.betterbeta.WyHelper; + +@Mixin(ClientPlayer.class) +public class ClientPlayerMixin { + + private Random rand = new Random(); + + @Inject(method = "method_136", at = @At("TAIL")) + public void onKeyPressed(int key, boolean state, CallbackInfo ci) { + if (WyHelper.isDebug() && key == 25 && state) { + Player player = (Player) (Object) this; + WyHelper.cheatCommand(player); + } + } + + @Inject(method = "openChestScreen", at = @At("TAIL")) + public void openChestScreen(Inventory arg, CallbackInfo ci) { + Player player = (Player) (Object) this; + player.level.playSound(player, "random.chestopen", 0.5f, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + @Inject(method = "closeContainer", at = @At("HEAD")) + public void closeContainer(CallbackInfo ci) { + Player player = (Player) (Object) this; + if(player.container instanceof ChestContainer) { + player.level.playSound(player, "random.chestclosed", 0.5f, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/ContainerScreenMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ContainerScreenMixin.java new file mode 100644 index 0000000..7136bb0 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ContainerScreenMixin.java @@ -0,0 +1,56 @@ +package xyz.pixelatedw.betterbeta.mixin; + +import org.lwjgl.opengl.GL11; +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.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.client.gui.screen.container.ContainerScreen; +import net.minecraft.client.render.RenderHelper; +import net.minecraft.client.render.entity.ItemRenderer; +import net.minecraft.entity.player.PlayerInventory; + +@Mixin(ContainerScreen.class) +public class ContainerScreenMixin extends ScreenMixin { + + @Shadow + protected int containerWidth; + + @Shadow + protected int containerHeight; + + private static ItemRenderer itemRenderer = new ItemRenderer(); + + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/container/ContainerScreen;renderForeground()V", shift = Shift.AFTER)) + public void onRender(int i, int j, float f, CallbackInfo ci) { + ContainerScreen screen = ((ContainerScreen) (Object) this); + PlayerInventory selectedItem = minecraft.player.inventory; + int posX = (screen.width - this.containerWidth) / 2; + int posY = (screen.height - this.containerHeight) / 2; + + GL11.glPushMatrix(); + GL11.glRotatef(120.0F, 1.0F, 0.0F, 0.0F); + RenderHelper.enableLighting(); + GL11.glPopMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(32826); + GL11.glEnable(2896); + GL11.glEnable(2929); + + if (selectedItem.getCursorItem() != null) { + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + itemRenderer.renderItemInstance(minecraft.textRenderer, minecraft.textureManager, selectedItem.getCursorItem(), i - posX - 8, + j - posY - 8); + itemRenderer.method_1488(minecraft.textRenderer, minecraft.textureManager, selectedItem.getCursorItem(), i - posX - 8, + j - posY - 8); + } + + GL11.glDisable(32826); + RenderHelper.disableLighting(); + GL11.glDisable(2896); + GL11.glDisable(2929); + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/DeathScreenMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/DeathScreenMixin.java new file mode 100644 index 0000000..e8ade84 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/DeathScreenMixin.java @@ -0,0 +1,15 @@ +package xyz.pixelatedw.betterbeta.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +import net.minecraft.client.gui.screen.DeathScreen; + +@Mixin(DeathScreen.class) +public class DeathScreenMixin { + @ModifyConstant(method = "render", constant = @Constant(stringValue = "Score: &e")) + private String getResourcesUrl(String def) { + return def.replace('&', '\u00a7'); // Replacing & with § so the color actually displays as yellow + } +} \ No newline at end of file diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/ItemInstanceMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ItemInstanceMixin.java new file mode 100644 index 0000000..2ca3227 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ItemInstanceMixin.java @@ -0,0 +1,29 @@ +package xyz.pixelatedw.betterbeta.mixin; + +import java.util.Random; + +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; + +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemInstance; + +@Mixin(ItemInstance.class) +public class ItemInstanceMixin { + + private Random rand = new Random(); + + @Shadow + private int damage; + + @Inject(method = "applyDamage", at = @At("HEAD")) + public void applyDamage(int i, Entity arg, CallbackInfo ci) { + ItemInstance item = (ItemInstance) (Object) this; + if (this.damage + i > item.method_723()) { + arg.level.playSound(arg, "random.break", 0.5f, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/MinecartMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/MinecartMixin.java new file mode 100644 index 0000000..045dd4d --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/MinecartMixin.java @@ -0,0 +1,43 @@ +package xyz.pixelatedw.betterbeta.mixin; + +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; + +import net.minecraft.entity.Minecart; +import net.minecraft.tile.RailTile; +import net.minecraft.util.maths.MathsHelper; +import xyz.pixelatedw.betterbeta.WyHelper; + +@Mixin(Minecart.class) +public class MinecartMixin { + + @Inject(method = "tick", at = @At("TAIL")) + public void tick(CallbackInfo ci) { + Minecart minecart = (Minecart) (Object) this; + int x = MathsHelper.floor(minecart.x); + int y = MathsHelper.floor(minecart.y); + int z = MathsHelper.floor(minecart.z); + int tileId = minecart.level.getTileId(x, y, z); + if (RailTile.method_1107(tileId)) { + float speed = MathsHelper.sqrt(minecart.velocityX * minecart.velocityX + minecart.velocityZ * minecart.velocityZ); + float volume = 0; + float pitch = 0; + if (speed >= 0.01D) { + ++minecart.field_1645; + pitch = WyHelper.clamp(pitch + 0.0025F, 0.0F, 1.0F); + volume = WyHelper.lerp(WyHelper.clamp(speed, 0.0F, 0.5F), 0.0F, 0.7F); + } else { + volume = 0.0f; + pitch = 0.0f; + } + + if (speed >= 0.01D) { + if (minecart.field_1645 % 25 == 1) { + minecart.level.playSound(x, y, z, "minecart.base", volume, pitch); + } + } + } + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/MinecraftAppletMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/MinecraftAppletMixin.java new file mode 100644 index 0000000..c0a9a39 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/MinecraftAppletMixin.java @@ -0,0 +1,16 @@ +package xyz.pixelatedw.betterbeta.mixin; + +import org.objectweb.asm.Opcodes; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.MinecraftApplet; + +@Mixin(MinecraftApplet.class) +public class MinecraftAppletMixin { + @Redirect(method = "init", at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/Minecraft;isApplet:Z")) + private void disableIsApplet(Minecraft minecraft, boolean value) { + } +} \ No newline at end of file diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/MinecraftMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/MinecraftMixin.java new file mode 100644 index 0000000..53260d6 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/MinecraftMixin.java @@ -0,0 +1,24 @@ +package xyz.pixelatedw.betterbeta.mixin; + +import java.io.File; + +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; + +import net.minecraft.client.Minecraft; + +@Mixin(Minecraft.class) +public class MinecraftMixin { + @Inject(method = "loadSoundFromDir", at = @At("HEAD")) + public void loadSoundFromDir(String string, File file, CallbackInfo ci) { + Minecraft mc = (Minecraft) (Object) this; + int split = string.indexOf("/"); + String type = string.substring(0, split); + String newSound = string.substring(split + 1); + if (type.equalsIgnoreCase("sound3")) { + mc.soundHelper.method_2011(newSound, file); + } + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/PlayerRendererMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/PlayerRendererMixin.java new file mode 100644 index 0000000..55f4013 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/PlayerRendererMixin.java @@ -0,0 +1,25 @@ +package xyz.pixelatedw.betterbeta.mixin; + +import org.lwjgl.opengl.GL11; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.client.render.entity.PlayerRenderer; +import net.minecraft.entity.player.Player; +import net.minecraft.item.ItemInstance; +import net.minecraft.item.ItemType; + +@Mixin(PlayerRenderer.class) +public class PlayerRendererMixin { + + @Inject(method = "method_827", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/HandItemRenderer;method_1862(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemInstance;)V", shift = Shift.BEFORE)) + public void playerRendering(Player player, float f, CallbackInfo ci) { + ItemInstance item = player.inventory.getHeldItem(); + if (item != null && item.itemId == ItemType.bow.id) { + GL11.glTranslatef(0.0F, -0.5F, 0.0F); + } + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/ResourceDownloadThreadMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ResourceDownloadThreadMixin.java new file mode 100644 index 0000000..2b93b06 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ResourceDownloadThreadMixin.java @@ -0,0 +1,15 @@ +package xyz.pixelatedw.betterbeta.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +import net.minecraft.client.util.ResourceDownloadThread; + +@Mixin(ResourceDownloadThread.class) +public class ResourceDownloadThreadMixin { + @ModifyConstant(method = "run", constant = @Constant(stringValue = "http://s3.amazonaws.com/MinecraftResources/"), remap = false) + private String getResourcesUrl(String def) { + return "http://mcresources.modification-station.net/MinecraftResources/"; + } +} \ No newline at end of file diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/ScreenMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ScreenMixin.java new file mode 100644 index 0000000..566dffe --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ScreenMixin.java @@ -0,0 +1,19 @@ +package xyz.pixelatedw.betterbeta.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Screen; + +@Mixin(Screen.class) +public class ScreenMixin { + + @Shadow + public Minecraft minecraft; + +// @Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At("HEAD")) +// public void init(Minecraft minecraft, int i, int j, CallbackInfo ci) { +// this.instance = minecraft; +// } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/SkeletonModelMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/SkeletonModelMixin.java new file mode 100644 index 0000000..12e44c0 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/SkeletonModelMixin.java @@ -0,0 +1,22 @@ +package xyz.pixelatedw.betterbeta.mixin; + +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; + +import net.minecraft.client.render.entity.model.BipedModel; +import net.minecraft.client.render.entity.model.ZombieModel; + +@Mixin(ZombieModel.class) +public class SkeletonModelMixin { + @Inject(method = "setAngles", at = @At("TAIL")) + public void setAngles(float f, float f1, float f2, float f3, float f4, float f5, CallbackInfo ci) { + BipedModel model = ((BipedModel) (Object) this); + model.leftArm.yaw = 0.45f; + model.rightArm.yaw = -0.2f; + model.leftArm.pitch -= 0.05f; + model.rightArm.pitch -= 0.05f; + model.rightArm.roll += 0.1f; + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/StairsTileMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/StairsTileMixin.java new file mode 100644 index 0000000..36d6466 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/StairsTileMixin.java @@ -0,0 +1,32 @@ +package xyz.pixelatedw.betterbeta.mixin; + +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; + +import net.minecraft.entity.ItemEntity; +import net.minecraft.item.ItemInstance; +import net.minecraft.level.Level; +import net.minecraft.tile.StairsTile; +import net.minecraft.tile.Tile; + +@Mixin(StairsTile.class) +public class StairsTileMixin { + + @Inject(method = "beforeDestroyedByExplosion", at = @At("HEAD"), cancellable = true) + public void beforeDestroyedByExplosion(Level arg, int i, int j, int k, int i1, float f, CallbackInfo ci) { + Tile tile = ((Tile) (Object) this); + ItemInstance item = new ItemInstance(tile.id, 1, 0); + if (!arg.isClient) { + float var6 = 0.7F; + double var7 = arg.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D; + double var9 = arg.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D; + double var11 = arg.rand.nextFloat() * var6 + (1.0F - var6) * 0.5D; + ItemEntity var13 = new ItemEntity(arg, i + var7, j + var9, k + var11, item); + var13.pickupDelay = 10; + arg.spawnEntity(var13); + } + ci.cancel(); + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/SugarCaneMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/SugarCaneMixin.java new file mode 100644 index 0000000..18f2b8e --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/SugarCaneMixin.java @@ -0,0 +1,31 @@ +package xyz.pixelatedw.betterbeta.mixin; + +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; + +import net.minecraft.level.Level; +import net.minecraft.tile.SugarCane; +import net.minecraft.tile.Tile; +import net.minecraft.tile.material.Material; + +@Mixin(SugarCane.class) +public class SugarCaneMixin { + @Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true) + public void canPlaceAt(Level arg, int x, int y, int z, CallbackInfoReturnable info) { + int tileBelow = arg.getTileId(x, y - 1, z); + if (tileBelow == Tile.SAND.id) { + boolean flag = false; + // Check if there is a water block around the sand block + flag |= arg.getMaterial(x - 1, y - 1, z) == Material.WATER; + flag |= arg.getMaterial(x + 1, y - 1, z) == Material.WATER; + flag |= arg.getMaterial(x, y - 1, z - 1) == Material.WATER; + flag |= arg.getMaterial(x, y - 1, z + 1) == Material.WATER; + + if (flag) { + info.setReturnValue(true); + } + } + } +} diff --git a/src/main/java/xyz/pixelatedw/betterbeta/mixin/ToolItemMixin.java b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ToolItemMixin.java new file mode 100644 index 0000000..5e14828 --- /dev/null +++ b/src/main/java/xyz/pixelatedw/betterbeta/mixin/ToolItemMixin.java @@ -0,0 +1,43 @@ +package xyz.pixelatedw.betterbeta.mixin; + +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; + +import net.minecraft.item.tool.HatchetItem; +import net.minecraft.item.tool.PickaxeItem; +import net.minecraft.item.tool.ToolItem; +import net.minecraft.item.tool.ToolMaterial; +import net.minecraft.tile.Tile; + +@Mixin(ToolItem.class) +public class ToolItemMixin { + + private static final Tile[] PICKAXE_BLOCKS = new Tile[]{Tile.COBBLESTONE, Tile.DOUBLE_STONE_SLAB, Tile.STONE_SLAB, Tile.STONE, + Tile.SANDSTONE, Tile.MOSSY_COBBLESTONE, Tile.IRON_ORE, Tile.BLOCK_IRON, Tile.COAL_ORE, Tile.BLOCK_GOLD, Tile.GOLD_ORE, + Tile.DIAMOND_ORE, Tile.BLOCK_DIAMOND, Tile.ICE, Tile.NETHERRACK, Tile.LAPIS_LAZULI_ORE, Tile.LAPIS_LAZULI_BLOCK, + // Here starts the list of blocks that are not affected by default + Tile.STAIRS_STONE, Tile.REDSTONE_ORE, Tile.REDSTONE_ORE_LIT, Tile.DOOR_IRON, Tile.BRICK, Tile.FURNACE, Tile.FURNACE_LIT, + Tile.DISPENSER, Tile.STONE_PRESSURE_PLATE, Tile.RAIL, Tile.DETECTOR_RAIL, Tile.GOLDEN_RAIL, Tile.PISTON, Tile.STICKY_PISTON}; + + private static final Tile[] HATCHET_BLOCKS = new Tile[]{Tile.WOOD, Tile.BOOKSHELF, Tile.LOG, Tile.CHEST, + // Here starts the list of blocks that are not affected by default + Tile.STAIRS_WOOD, Tile.DOOR_WOOD, Tile.WOODEN_PRESSURE_PLATE, Tile.JUKEBOX, Tile.NOTEBLOCK, Tile.PUMPKIN, Tile.LIT_PUMPKIN, + Tile.STANDING_SIGN, Tile.WALL_SIGN, Tile.TRAPDOOR, Tile.LADDER, Tile.WORKBENCH, Tile.FENCE}; + + @Shadow + public Tile[] field_2712; + + @Inject(method = "(IILnet/minecraft/item/tool/ToolMaterial;[Lnet/minecraft/tile/Tile;)V", at = @At("TAIL")) + public void init(int i, int j, ToolMaterial arg, Tile[] args, CallbackInfo ci) { + + ToolItem tool = ((ToolItem) (Object) this); + if (tool instanceof PickaxeItem) { + this.field_2712 = PICKAXE_BLOCKS; + } else if (tool instanceof HatchetItem) { + this.field_2712 = HATCHET_BLOCKS; + } + } +} diff --git a/src/main/resources/assets/betterbeta/icon.png b/src/main/resources/assets/betterbeta/icon.png new file mode 100644 index 0000000..047b91f Binary files /dev/null and b/src/main/resources/assets/betterbeta/icon.png differ diff --git a/src/main/resources/betterbeta.mixins.json b/src/main/resources/betterbeta.mixins.json new file mode 100644 index 0000000..f0c6e04 --- /dev/null +++ b/src/main/resources/betterbeta.mixins.json @@ -0,0 +1,27 @@ +{ + "required": true, + "package": "xyz.pixelatedw.betterbeta.mixin", + "compatibilityLevel": "JAVA_8", + "mixins": [], + "client": [ + "DeathScreenMixin", + "ClientPlayerMixin", + "SugarCaneMixin", + "BowItemMixin", + "PlayerRendererMixin", + "ContainerScreenMixin", + "BipedRendererMixin", + "SkeletonModelMixin", + "ToolItemMixin", + "StairsTileMixin", + "ScreenMixin", + "ResourceDownloadThreadMixin", + "MinecraftAppletMixin", + "ItemInstanceMixin", + "MinecraftMixin", + "MinecartMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..59cc5c0 --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,23 @@ +{ + "schemaVersion": 1, + "id": "betterbeta", + "version": "${version}", + + "name": "BetterBeta", + "description": "This is an example description! Tell everyone what your mod is about!", + "authors": ["Wynd"], + "contact": {}, + + "license": "CC0-1.0", + "icon": "assets/betterbeta/icon.png", + + "environment": "*", + "entrypoints": { + "init": ["xyz.pixelatedw.betterbeta.MainMod"] + }, + "mixins": ["betterbeta.mixins.json"], + + "depends": { + "minecraft": "1.0.0-beta.7.3" + } +}