Compare commits

...

No commits in common. "fabric" and "forge" have entirely different histories.

29 changed files with 915 additions and 743 deletions

View File

@ -1 +0,0 @@
java temurin-17.0.8+101

View File

@ -1,82 +1,208 @@
buildscript {
repositories {
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
mavenCentral()
}
dependencies {
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
plugins {
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'maven-publish'
id 'eclipse'
id 'idea'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
version = project.mod_version
group = project.maven_group
apply plugin: 'org.spongepowered.mixin'
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.
}
group = mod_version
version = mod_group_id
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}"
}
processResources {
inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version
inputs.property "loader_version", project.loader_version
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.version,
"minecraft_version": project.minecraft_version,
"loader_version": project.loader_version
}
}
def targetJavaVersion = 17
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"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release = targetJavaVersion
}
base {
archivesName = mod_id
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
archivesBaseName = project.archives_base_name
// 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()
toolchain.languageVersion = JavaLanguageVersion.of(17)
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
minecraft {
// The mappings can be changed at any time and must be in the following format.
// Channel: Version:
// official MCVersion Official field/method names from Mojang mapping files
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
//
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
//
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: mapping_channel, version: mapping_version
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
// enableEclipsePrepareRuns = true
// enableIdeaPrepareRuns = true
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
// It is REQUIRED to be set to true for this template to function.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
copyIdeResources = true
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
// The folder name can be set on a run configuration using the "folderName" property.
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
// generateRunFolders = true
// This property enables access transformers for use in development.
// They will be applied to the Minecraft artifact.
// The access transformer file can be anywhere in the project.
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
// This default location is a best practice to automatically put the file in the right place in the final jar.
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
// applies to all the run configs below
configureEach {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
}
server {
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
property 'forge.enabledGameTestNamespaces', mod_id
}
data {
// example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
}
// 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.
}
}
mixin {
add sourceSets.main, "${mod_id}.refmap.json"
config "${mod_id}.mixins.json"
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
// flatDir {
// dir 'libs'
// }
}
dependencies {
// Specify the version of Minecraft to use.
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
// The "userdev" classifier will be requested and setup by ForgeGradle.
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description,
]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}}
// Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar).configure {
manifest {
attributes([
"Specification-Title": mod_id,
"Specification-Vendor": mod_authors,
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": project.jar.archiveVersion,
"Implementation-Vendor": mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
// This is the preferred method to reobfuscate your jar file
finalizedBy 'reobfJar'
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

View File

@ -1,13 +1,53 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.4
loader_version=0.14.22
# Mod Properties
mod_version = 1.0-SNAPSHOT
maven_group = dev.pfaff
archives_base_name = recipe_nope
# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=1.18.2
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.18.2,1.19)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=40.2.10
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[40,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[40,)
# The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
#
# | Channel | Version | |
# |-----------|----------------------|--------------------------------------------------------------------------------|
# | official | MCVersion | Official field/method names from Mojang mapping files |
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
#
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
#
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
mapping_channel=official
# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
mapping_version=1.18.2
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=recipe_nope
# The human-readable display name for the mod.
mod_name=Recipe Nope
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=AGPL-3.0
# The mod version. See https://semver.org/
mod_version=1.0-SNAPSHOT
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=dev.pfaff
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=Michael Pfaff <michael@pfaff.dev>
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=

Binary file not shown.

View File

@ -1,6 +1 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

245
gradlew vendored
View File

@ -1,245 +0,0 @@
#!/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/HEAD/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
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
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
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# 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" "$@"

92
gradlew.bat vendored
View File

@ -1,92 +0,0 @@
@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=.
@rem This is normally unused
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% equ 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% equ 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!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,9 +1,15 @@
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
gradlePluginPortal()
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
}
}
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
rootProject.name = 'recipe-nope'

View File

@ -1,7 +1,17 @@
package dev.pfaff.recipe_nope;
import dev.pfaff.recipe_nope.injector.UnconstrainedRedirectInjectionInfo;
import net.minecraftforge.fml.common.Mod;
import org.spongepowered.asm.mixin.injection.struct.InjectionInfo;
// The value here should match an entry in the META-INF/mods.toml file
@Mod("recipe_nope")
public final class RecipeNope {
public static RuntimeException unsupported() {
throw new UnsupportedOperationException("Recipe nope");
}
public RecipeNope() {
InjectionInfo.register(UnconstrainedRedirectInjectionInfo.class);
}
public static RuntimeException unsupported() {
throw new UnsupportedOperationException("Recipe nope");
}
}

View File

@ -1,11 +0,0 @@
package dev.pfaff.recipe_nope.injector;
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
import org.spongepowered.asm.mixin.injection.struct.InjectionInfo;
public final class Entrypoint implements PreLaunchEntrypoint {
@Override
public void onPreLaunch() {
InjectionInfo.register(UnconstrainedRedirectInjectionInfo.class);
}
}

View File

@ -1,26 +0,0 @@
package dev.pfaff.recipe_nope.injector;
import org.objectweb.asm.tree.AnnotationNode;
import org.objectweb.asm.tree.MethodNode;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.code.Injector;
import org.spongepowered.asm.mixin.injection.struct.InjectionInfo;
import org.spongepowered.asm.mixin.transformer.MixinTargetContext;
@InjectionInfo.AnnotationType(Redirect.class)
@InjectionInfo.HandlerPrefix("redirect")
public final class ForceUnconstrainedRedirectInjectionInfo extends InjectionInfo {
public ForceUnconstrainedRedirectInjectionInfo(MixinTargetContext mixin, MethodNode method, AnnotationNode annotation) {
super(mixin, method, annotation);
}
@Override
protected Injector parseInjector(AnnotationNode injectAnnotation) {
return new UnconstrainedRedirectInjector(this, "@Redirect");
}
@Override
protected String getDescription() {
return "UnconstrainedRedirector";
}
}

View File

@ -36,6 +36,7 @@ import java.util.Map;
import java.util.Set;
import java.util.StringJoiner;
import static dev.pfaff.recipe_nope.injector.util.ReflectUtil.methodDescriptor;
import static java.lang.invoke.MethodType.methodType;
public final class UnconstrainedRedirectInjector extends InvokeInjector {
@ -65,7 +66,7 @@ public final class UnconstrainedRedirectInjector extends InvokeInjector {
insns.add(new MethodInsnNode(Opcodes.INVOKESPECIAL,
owner,
"<init>",
ReflectUtil.methodDescriptor(methodType(void.class, String.class), false)
methodDescriptor(methodType(void.class, String.class))
));
insns.add(new InsnNode(Opcodes.ATHROW));
INSN_DEAD_METHOD = new InsnListReadOnly(insns);

View File

@ -1,23 +1,16 @@
package dev.pfaff.recipe_nope.injector.util;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.MappingResolver;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
public final class ReflectUtil {
public static final MappingResolver RESOLVER = FabricLoader.getInstance().getMappingResolver();
public static String typeDescriptor(String qualifiedName, boolean unmap) {
if (unmap) qualifiedName = unresolveClass(qualifiedName);
public static String typeDescriptor(String qualifiedName) {
return 'L' + qualifiedName.replace('.', '/') + ';';
}
public static String typeDescriptor(Class<?> clazz, boolean unmap) {
public static String typeDescriptor(Class<?> clazz) {
if (clazz.isPrimitive()) {
if (clazz == void.class) return "V";
if (clazz == boolean.class) return "Z";
@ -32,10 +25,10 @@ public final class ReflectUtil {
}
if (clazz.isArray()) {
return '[' + typeDescriptor(clazz.componentType(), unmap);
return '[' + typeDescriptor(clazz.componentType());
}
return typeDescriptor(clazz.getName(), unmap);
return typeDescriptor(clazz.getName());
}
public static int varInsn(Type type, int base) {
@ -59,46 +52,16 @@ public final class ReflectUtil {
return varInsn(type, Opcodes.ISTORE);
}
public static String methodDescriptor(MethodType mt, boolean unmap) {
public static String methodDescriptor(MethodType mt) {
StringBuilder sb = new StringBuilder();
sb.append('(');
for (int i = 0; i < mt.parameterCount(); i++) {
sb.append(typeDescriptor(mt.parameterType(i), unmap));
sb.append(typeDescriptor(mt.parameterType(i)));
}
sb.append(')');
sb.append(typeDescriptor(mt.returnType(), unmap));
sb.append(typeDescriptor(mt.returnType()));
return sb.toString();
}
public static String resolveClassName(String intermediaryName) {
return RESOLVER.mapClassName("intermediary", intermediaryName);
}
public static String unresolveClass(String qualifiedName) {
return RESOLVER.unmapClassName("intermediary", qualifiedName);
}
public static String unresolveClass(Class<?> clazz) {
return unresolveClass(clazz.getName());
}
public static String resolveMethodName(Class<?> owner, String intermediaryName, MethodType mt) {
return RESOLVER.mapMethodName("intermediary", unresolveClass(owner), intermediaryName, methodDescriptor(mt, true));
}
public static String resolveFieldName(Class<?> owner, String intermediaryName, MethodType mt) {
return RESOLVER.mapFieldName("intermediary", unresolveClass(owner), intermediaryName, methodDescriptor(mt, true));
}
public static MethodHandle findVirtual(MethodHandles.Lookup lookup, Class<?> clazz, String intermediaryName, MethodType mt)
throws ReflectiveOperationException {
return lookup.findVirtual(clazz, resolveMethodName(clazz, intermediaryName, mt), mt);
}
public static MethodHandle findStatic(MethodHandles.Lookup lookup, Class<?> clazz, String intermediaryName, MethodType mt)
throws ReflectiveOperationException {
return lookup.findStatic(clazz, resolveMethodName(clazz, intermediaryName, mt), mt);
}
private ReflectUtil() {}
}

View File

@ -1,21 +1,22 @@
package dev.pfaff.recipe_nope.mixin;
import dev.pfaff.recipe_nope.injector.UnconstrainedRedirect;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.recipebook.ClientRecipeBook;
import net.minecraft.recipe.Recipe;
import net.minecraft.client.ClientRecipeBook;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.world.item.crafting.Recipe;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ClientPlayNetworkHandler.class)
@Mixin(ClientPacketListener.class)
public abstract class ClientPlayNetworkHandlerMixin {
@UnconstrainedRedirect(method = "onGameJoin", at = @At(value = "NEW", target = "()Lnet/minecraft/client/recipebook/ClientRecipeBook;"))
private ClientRecipeBook onGameJoin$noRecipeBook() {
return null;
}
// for some reason the exact method name does not work outside of dev environment, and using wildcard causes game
// to freeze upon opening crafting table the first time (why then and not upon world join?)
//@UnconstrainedRedirect(method = "*", at = @At(value = "NEW", target = "()Lnet/minecraft/client/ClientRecipeBook;"))
//private ClientRecipeBook onGameJoin$noRecipeBook() {
// return null;
//}
@Redirect(method = "onSynchronizeRecipes", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/recipebook/ClientRecipeBook;reload(Ljava/lang/Iterable;)V"))
@Redirect(method = "handleUpdateRecipes", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/ClientRecipeBook;setupCollections(Ljava/lang/Iterable;)V"))
private void onSynchronizeRecipes$noRecipeBook(ClientRecipeBook instance, Iterable<Recipe<?>> recipes) {
}
}

View File

@ -1,13 +1,13 @@
package dev.pfaff.recipe_nope.mixin;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.recipe.Recipe;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.world.item.crafting.Recipe;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(ClientPlayerEntity.class)
@Mixin(LocalPlayer.class)
public abstract class ClientPlayerEntityMixin {
@Overwrite
public void onRecipeDisplayed(Recipe<?> recipe) {
public void removeRecipeHighlight(Recipe<?> recipe) {
}
}

View File

@ -0,0 +1,44 @@
package dev.pfaff.recipe_nope.mixin;
import net.minecraft.client.ClientRecipeBook;
import net.minecraft.client.RecipeBookCategories;
import net.minecraft.client.gui.screens.recipebook.RecipeCollection;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import java.util.List;
import java.util.Map;
@Mixin(ClientRecipeBook.class)
public abstract class ClientRecipeBookMixin {
@Overwrite
public void setupCollections(Iterable<Recipe<?>> p_90626_) {
}
@Overwrite
private static Map<RecipeBookCategories, List<List<Recipe<?>>>> categorizeAndGroupRecipes(Iterable<Recipe<?>> p_90643_) {
return Map.of();
}
@Overwrite
private static RecipeBookCategories getCategory(Recipe<?> p_90647_) {
return RecipeBookCategories.UNKNOWN;
}
@Overwrite
public List<RecipeCollection> getCollections() {
return List.of();
}
@Overwrite
public List<RecipeCollection> getCollection(RecipeBookCategories p_90624_) {
return List.of();
}
@Overwrite
private static Object lambda$getCategory$5(Recipe par1) {
return RecipeType.CRAFTING;
}
}

View File

@ -1,13 +1,13 @@
package dev.pfaff.recipe_nope.mixin;
import com.mojang.blaze3d.vertex.PoseStack;
import dev.pfaff.recipe_nope.injector.UnconstrainedRedirect;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.CraftingScreen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.screen.AbstractRecipeScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.CraftingScreen;
import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent;
import net.minecraft.world.inventory.RecipeBookMenu;
import net.minecraft.world.inventory.Slot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.At;
@ -16,83 +16,76 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(CraftingScreen.class)
public abstract class CraftingScreenMixin extends HandledScreen {
public abstract class CraftingScreenMixin extends AbstractContainerScreen {
public CraftingScreenMixin() {
super(null, null, null);
throw new AssertionError();
}
@UnconstrainedRedirect(method = "<init>", at = @At(value = "NEW", target = "()Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;"))
private RecipeBookWidget constructor$skipNewRecipeBook() {
return null;
}
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;init(IILnet/minecraft/client/Minecraft;ZLnet/minecraft/world/inventory/RecipeBookMenu;)V"))
private void init$skipRecipeBookInit(RecipeBookComponent instance,
int p_100310_,
int p_100311_,
Minecraft p_100312_,
boolean p_100313_,
RecipeBookMenu<?> p_100314_) {}
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;initialize(IILnet/minecraft/client/MinecraftClient;ZLnet/minecraft/screen/AbstractRecipeScreenHandler;)V"))
private void init$skipRecipeBookInit(RecipeBookWidget instance,
int parentWidth,
int parentHeight,
MinecraftClient client,
boolean narrow,
AbstractRecipeScreenHandler<?> craftingScreenHandler) {}
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;findLeftEdge(II)I"))
private int init$findLeftEdgeWithoutRecipeBook(RecipeBookWidget instance, int width, int backgroundWidth) {
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;updateScreenPosition(II)I"))
private int init$findLeftEdgeWithoutRecipeBook(RecipeBookComponent instance, int width, int backgroundWidth) {
return (width - backgroundWidth) / 2;
}
@Inject(method = "init", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;findLeftEdge(II)I"), cancellable = true)
@Inject(method = "init", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;updateScreenPosition(II)I"), cancellable = true)
private void init$cancelRest(CallbackInfo ci) {
if (((Object) this) instanceof CraftingScreen) {
this.titleX = 29;
}
this.titleLabelX = 29;
ci.cancel();
}
@Redirect(method = "handledScreenTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;update()V"))
private void init$skipRecipeBookUpdate(RecipeBookWidget instance) {}
@Redirect(method = "containerTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;tick()V"))
private void init$skipRecipeBookUpdate(RecipeBookComponent instance) {}
@Overwrite
public void refreshRecipeBook() {
public void recipesUpdated() {
}
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;isOpen()Z"))
private boolean render$recipeBookNeverOpen(RecipeBookWidget instance) {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;isVisible()Z"))
private boolean render$recipeBookNeverOpen(RecipeBookComponent instance) {
return false;
}
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V"))
private void render$skipRecipeBookRender(RecipeBookWidget instance,
MatrixStack matrices,
int mouseX,
int mouseY,
float delta) {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;render(Lcom/mojang/blaze3d/vertex/PoseStack;IIF)V"))
private void render$skipRecipeBookRender(RecipeBookComponent instance,
PoseStack p_98875_,
int p_98876_,
int p_98877_,
float p_98878_) {
}
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;drawGhostSlots(Lnet/minecraft/client/util/math/MatrixStack;IIZF)V"))
private void render$skipRecipeBookDrawGhostSlots(RecipeBookWidget instance,
MatrixStack matrices,
int x,
int y,
boolean bl,
float delta) {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;renderGhostRecipe(Lcom/mojang/blaze3d/vertex/PoseStack;IIZF)V"))
private void render$skipRecipeBookDrawGhostSlots(RecipeBookComponent instance,
PoseStack p_100323_,
int p_100324_,
int p_100325_,
boolean p_100326_,
float p_100327_) {
}
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;drawTooltip(Lnet/minecraft/client/util/math/MatrixStack;IIII)V"))
private void render$skipRecipeBookDrawTooltip(RecipeBookWidget instance,
MatrixStack matrices,
int x,
int y,
int mouseX,
int mouseY) {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;renderTooltip(Lcom/mojang/blaze3d/vertex/PoseStack;IIII)V"))
private void render$skipRecipeBookDrawTooltip(RecipeBookComponent instance,
PoseStack p_100362_,
int p_100363_,
int p_100364_,
int p_100365_,
int p_100366_) {
}
@Redirect(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;mouseClicked(DDI)Z"))
private boolean mouseClicked$skipRecipeBook(RecipeBookWidget instance, double mouseX, double mouseY, int button) {
@Redirect(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;mouseClicked(DDI)Z"))
private boolean mouseClicked$skipRecipeBook(RecipeBookComponent instance, double mouseX, double mouseY, int button) {
return false;
}
@Redirect(method = "isClickOutsideBounds", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;isClickOutsideBounds(DDIIIII)Z"))
private boolean isClickOutsideBounds$skipRecipeBook(RecipeBookWidget instance,
@Redirect(method = "hasClickedOutside", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;hasClickedOutside(DDIIIII)Z"))
private boolean isClickOutsideBounds$skipRecipeBook(RecipeBookComponent instance,
double mouseX,
double mouseY,
int x,
@ -103,11 +96,11 @@ public abstract class CraftingScreenMixin extends HandledScreen {
return true;
}
@Redirect(method = "onMouseClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;slotClicked(Lnet/minecraft/screen/slot/Slot;)V"))
private void onMouseClick$skipRecipeBook(RecipeBookWidget instance, Slot slot) {
@Redirect(method = "slotClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;slotClicked(Lnet/minecraft/world/inventory/Slot;)V"))
private void onMouseClick$skipRecipeBook(RecipeBookComponent instance, Slot p_100315_) {
}
@Redirect(method = "removed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;close()V"))
private void removed$skipRecipeBook(RecipeBookWidget instance) {
@Redirect(method = "removed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;removed()V"))
private void removed$skipRecipeBook(RecipeBookComponent instance) {
}
}

View File

@ -1,14 +1,13 @@
package dev.pfaff.recipe_nope.mixin;
import com.mojang.blaze3d.vertex.PoseStack;
import dev.pfaff.recipe_nope.injector.UnconstrainedRedirect;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.CraftingScreen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.screen.AbstractRecipeScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen;
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent;
import net.minecraft.world.inventory.RecipeBookMenu;
import net.minecraft.world.inventory.Slot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.At;
@ -17,83 +16,80 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(InventoryScreen.class)
public abstract class InventoryScreenMixin extends HandledScreen {
public abstract class InventoryScreenMixin extends EffectRenderingInventoryScreen {
public InventoryScreenMixin() {
super(null, null, null);
throw new AssertionError();
}
@UnconstrainedRedirect(method = "<init>", at = @At(value = "NEW", target = "()Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;"))
private RecipeBookWidget constructor$skipNewRecipeBook() {
@UnconstrainedRedirect(method = "<init>", at = @At(value = "NEW", target = "()Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;"))
private RecipeBookComponent constructor$skipNewRecipeBook() {
return null;
}
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;initialize(IILnet/minecraft/client/MinecraftClient;ZLnet/minecraft/screen/AbstractRecipeScreenHandler;)V"))
private void init$skipRecipeBookInit(RecipeBookWidget instance,
int parentWidth,
int parentHeight,
MinecraftClient client,
boolean narrow,
AbstractRecipeScreenHandler<?> craftingScreenHandler) {}
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;init(IILnet/minecraft/client/Minecraft;ZLnet/minecraft/world/inventory/RecipeBookMenu;)V"))
private void init$skipRecipeBookInit(RecipeBookComponent instance,
int p_100310_,
int p_100311_,
Minecraft p_100312_,
boolean p_100313_,
RecipeBookMenu<?> p_100314_) {}
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;findLeftEdge(II)I"))
private int init$findLeftEdgeWithoutRecipeBook(RecipeBookWidget instance, int width, int backgroundWidth) {
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;updateScreenPosition(II)I"))
private int init$findLeftEdgeWithoutRecipeBook(RecipeBookComponent instance, int width, int backgroundWidth) {
return (width - backgroundWidth) / 2;
}
@Inject(method = "init", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;findLeftEdge(II)I"), cancellable = true)
@Inject(method = "init", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;updateScreenPosition(II)I"), cancellable = true)
private void init$cancelRest(CallbackInfo ci) {
if (((Object) this) instanceof CraftingScreen) {
this.titleX = 29;
}
ci.cancel();
}
@Redirect(method = "handledScreenTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;update()V"))
private void init$skipRecipeBookUpdate(RecipeBookWidget instance) {}
@Redirect(method = "containerTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;tick()V"))
private void init$skipRecipeBookUpdate(RecipeBookComponent instance) {}
@Overwrite
public void refreshRecipeBook() {
public void recipesUpdated() {
}
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;isOpen()Z"))
private boolean render$recipeBookNeverOpen(RecipeBookWidget instance) {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;isVisible()Z"))
private boolean render$recipeBookNeverOpen(RecipeBookComponent instance) {
return false;
}
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V"))
private void render$skipRecipeBookRender(RecipeBookWidget instance,
MatrixStack matrices,
int mouseX,
int mouseY,
float delta) {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;render(Lcom/mojang/blaze3d/vertex/PoseStack;IIF)V"))
private void render$skipRecipeBookRender(RecipeBookComponent instance,
PoseStack p_98875_,
int p_98876_,
int p_98877_,
float p_98878_) {
}
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;drawGhostSlots(Lnet/minecraft/client/util/math/MatrixStack;IIZF)V"))
private void render$skipRecipeBookDrawGhostSlots(RecipeBookWidget instance,
MatrixStack matrices,
int x,
int y,
boolean bl,
float delta) {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;renderGhostRecipe(Lcom/mojang/blaze3d/vertex/PoseStack;IIZF)V"))
private void render$skipRecipeBookDrawGhostSlots(RecipeBookComponent instance,
PoseStack p_100323_,
int p_100324_,
int p_100325_,
boolean p_100326_,
float p_100327_) {
}
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;drawTooltip(Lnet/minecraft/client/util/math/MatrixStack;IIII)V"))
private void render$skipRecipeBookDrawTooltip(RecipeBookWidget instance,
MatrixStack matrices,
int x,
int y,
int mouseX,
int mouseY) {
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;renderTooltip(Lcom/mojang/blaze3d/vertex/PoseStack;IIII)V"))
private void render$skipRecipeBookDrawTooltip(RecipeBookComponent instance,
PoseStack p_100362_,
int p_100363_,
int p_100364_,
int p_100365_,
int p_100366_) {
}
@Redirect(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;mouseClicked(DDI)Z"))
private boolean mouseClicked$skipRecipeBook(RecipeBookWidget instance, double mouseX, double mouseY, int button) {
@Redirect(method = "mouseClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;mouseClicked(DDI)Z"))
private boolean mouseClicked$skipRecipeBook(RecipeBookComponent instance, double mouseX, double mouseY, int button) {
return false;
}
@Redirect(method = "isClickOutsideBounds", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;isClickOutsideBounds(DDIIIII)Z"))
private boolean isClickOutsideBounds$skipRecipeBook(RecipeBookWidget instance,
@Redirect(method = "hasClickedOutside", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;hasClickedOutside(DDIIIII)Z"))
private boolean isClickOutsideBounds$skipRecipeBook(RecipeBookComponent instance,
double mouseX,
double mouseY,
int x,
@ -104,11 +100,11 @@ public abstract class InventoryScreenMixin extends HandledScreen {
return true;
}
@Redirect(method = "onMouseClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;slotClicked(Lnet/minecraft/screen/slot/Slot;)V"))
private void onMouseClick$skipRecipeBook(RecipeBookWidget instance, Slot slot) {
@Redirect(method = "slotClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;slotClicked(Lnet/minecraft/world/inventory/Slot;)V"))
private void onMouseClick$skipRecipeBook(RecipeBookComponent instance, Slot p_100315_) {
}
@Redirect(method = "removed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeBookWidget;close()V"))
private void removed$skipRecipeBook(RecipeBookWidget instance) {
@Redirect(method = "removed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/recipebook/RecipeBookComponent;removed()V"))
private void removed$skipRecipeBook(RecipeBookComponent instance) {
}
}

View File

@ -1,16 +1,15 @@
package dev.pfaff.recipe_nope.mixin;
import net.minecraft.server.PlayerManager;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.network.ServerRecipeBook;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.players.PlayerList;
import net.minecraft.stats.ServerRecipeBook;
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.Redirect;
@Mixin(PlayerManager.class)
@Mixin(PlayerList.class)
public abstract class PlayerManagerMixin {
@Redirect(method = "onPlayerConnect", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerRecipeBook;sendInitRecipesPacket(Lnet/minecraft/server/network/ServerPlayerEntity;)V"))
private void onPlayerConnect$sendInitRecipesPacket(ServerRecipeBook instance, ServerPlayerEntity player) {
@Redirect(method = "placeNewPlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/stats/ServerRecipeBook;sendInitialRecipeBook(Lnet/minecraft/server/level/ServerPlayer;)V"))
private void onPlayerConnect$sendInitRecipesPacket(ServerRecipeBook instance, ServerPlayer player) {
}
}

View File

@ -0,0 +1,199 @@
package dev.pfaff.recipe_nope.mixin;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.narration.NarratableEntry;
import net.minecraft.client.gui.narration.NarrationElementOutput;
import net.minecraft.client.gui.screens.recipebook.RecipeBookComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.world.inventory.RecipeBookMenu;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.Recipe;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import javax.annotation.Nullable;
import java.util.Iterator;
import java.util.List;
@Mixin(RecipeBookComponent.class)
public abstract class RecipeBookComponentMixin {
@Shadow @Final private static Component ALL_RECIPES_TOOLTIP;
@Shadow @Final private static Component ONLY_CRAFTABLES_TOOLTIP;
@Overwrite
public void init(int p_100310_, int p_100311_, Minecraft p_100312_, boolean p_100313_, RecipeBookMenu<?> p_100314_) {
}
@Overwrite
public void initVisuals() {
}
@Overwrite
public boolean changeFocus(boolean p_100372_) {
return false;
}
@Overwrite
protected void initFilterButtonTextures() {
}
@Overwrite
public void removed() {
}
@Overwrite
public int updateScreenPosition(int p_181402_, int p_181403_) {
return (p_181402_ - p_181403_) / 2;
}
@Overwrite
public void toggleVisibility() {
}
@Overwrite
public boolean isVisible() {
return false;
}
@Overwrite
public boolean isVisibleAccordingToBookData() {
return false;
}
@Overwrite
protected void setVisible(boolean p_100370_) {
}
@Overwrite
public void slotClicked(@Nullable Slot p_100315_) {
}
@Overwrite
public void updateCollections(boolean p_100383_) {
}
@Overwrite
public void updateTabs() {
}
@Overwrite
public void tick() {
}
@Overwrite
public void updateStackedContents() {
}
@Overwrite
public void render(PoseStack p_100319_, int p_100320_, int p_100321_, float p_100322_) {
}
@Overwrite
public void renderTooltip(PoseStack p_100362_, int p_100363_, int p_100364_, int p_100365_, int p_100366_) {
}
@Overwrite
public Component getFilterButtonTooltip() {
return ALL_RECIPES_TOOLTIP;
}
@Overwrite
protected Component getRecipeFilterName() {
return ONLY_CRAFTABLES_TOOLTIP;
}
@Overwrite
public void renderGhostRecipeTooltip(PoseStack p_100375_, int p_100376_, int p_100377_, int p_100378_, int p_100379_) {
}
@Overwrite
public void renderGhostRecipe(PoseStack p_100323_, int p_100324_, int p_100325_, boolean p_100326_, float p_100327_) {
}
@Overwrite
public boolean mouseClicked(double p_100294_, double p_100295_, int p_100296_) {
return false;
}
@Overwrite
public boolean toggleFiltering() {
return false;
}
@Overwrite
public boolean hasClickedOutside(double p_100298_,
double p_100299_,
int p_100300_,
int p_100301_,
int p_100302_,
int p_100303_,
int p_100304_) {
return true;
}
@Overwrite
public boolean keyPressed(int p_100306_, int p_100307_, int p_100308_) {
return false;
}
@Overwrite
public boolean keyReleased(int p_100356_, int p_100357_, int p_100358_) {
return false;
}
@Overwrite
public boolean charTyped(char p_100291_, int p_100292_) {
return false;
}
@Overwrite
public boolean isMouseOver(double p_100353_, double p_100354_) {
return false;
}
@Overwrite
public void checkSearchStringUpdate() {
}
@Overwrite
public void pirateSpeechForThePeople(String p_100336_) {
}
@Overwrite
public boolean isOffsetNextToMainGUI() {
return false;
}
@Overwrite
public void recipesUpdated() {
}
@Overwrite
public void recipesShown(List<Recipe<?>> p_100344_) {
}
@Overwrite
public void setupGhostRecipe(Recipe<?> p_100316_, List<Slot> p_100317_) {
}
@Overwrite
public void addItemToSlot(Iterator<Ingredient> p_100338_, int p_100339_, int p_100340_, int p_100341_, int p_100342_) {
}
@Overwrite
protected void sendUpdateSettings() {
}
@Overwrite
public NarratableEntry.NarrationPriority narrationPriority() {
return NarratableEntry.NarrationPriority.NONE;
}
@Overwrite
public void updateNarration(NarrationElementOutput p_170046_) {
}
}

View File

@ -1,11 +1,12 @@
package dev.pfaff.recipe_nope.mixin;
import dev.pfaff.recipe_nope.RecipeNope;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.listener.ServerPlayPacketListener;
import net.minecraft.network.packet.c2s.play.RecipeBookDataC2SPacket;
import net.minecraft.recipe.Recipe;
import net.minecraft.util.Identifier;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.game.ServerGamePacketListener;
import net.minecraft.network.protocol.game.ServerPacketListener;
import net.minecraft.network.protocol.game.ServerboundRecipeBookSeenRecipePacket;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.Recipe;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.At;
@ -13,29 +14,24 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(RecipeBookDataC2SPacket.class)
@Mixin(ServerboundRecipeBookSeenRecipePacket.class)
public abstract class RecipeBookDataC2SPacketMixin {
@Inject(method = "<init>(Lnet/minecraft/recipe/Recipe;)V", at = @At(value = "INVOKE", target = "Ljava/lang/Object;<init>()V", shift = At.Shift.AFTER))
private void init$noWrite(Recipe recipe, CallbackInfo ci) {
throw RecipeNope.unsupported();
}
@Inject(method = "<init>(Lnet/minecraft/network/PacketByteBuf;)V", at = @At(value = "INVOKE", target = "Ljava/lang/Object;<init>()V", shift = At.Shift.AFTER))
private void init$noRead(PacketByteBuf buf, CallbackInfo ci) {
@Inject(method = "<init>(Lnet/minecraft/network/FriendlyByteBuf;)V", at = @At("TAIL"))
private void init$noRead(FriendlyByteBuf buf, CallbackInfo ci) {
buf.readerIndex(buf.writerIndex());
}
@Redirect(method = "<init>(Lnet/minecraft/network/PacketByteBuf;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/PacketByteBuf;readIdentifier()Lnet/minecraft/util/Identifier;"))
private Identifier init$noRead(PacketByteBuf instance) {
@Redirect(method = "<init>(Lnet/minecraft/network/FriendlyByteBuf;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/FriendlyByteBuf;readResourceLocation()Lnet/minecraft/resources/ResourceLocation;"))
private ResourceLocation init$noRead(FriendlyByteBuf instance) {
return null;
}
@Overwrite
public void write(PacketByteBuf buf) {
public void write(FriendlyByteBuf buf) {
throw RecipeNope.unsupported();
}
@Overwrite
public void apply(ServerPlayPacketListener serverPlayPacketListener) {
public void handle(ServerGamePacketListener serverPlayPacketListener) {
}
}

View File

@ -0,0 +1,103 @@
package dev.pfaff.recipe_nope.mixin;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.stats.RecipeBook;
import net.minecraft.stats.RecipeBookSettings;
import net.minecraft.world.inventory.RecipeBookMenu;
import net.minecraft.world.inventory.RecipeBookType;
import net.minecraft.world.item.crafting.Recipe;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import javax.annotation.Nullable;
import java.util.Set;
@Mixin(RecipeBook.class)
public abstract class RecipeBookMixin {
@Shadow @Final private RecipeBookSettings bookSettings;
@Overwrite
public void copyOverData(RecipeBook p_12686_) {
}
@Overwrite
public void add(Recipe<?> p_12701_) {
}
@Overwrite
protected void add(ResourceLocation p_12703_) {
}
@Overwrite
public boolean contains(@Nullable Recipe<?> p_12710_) {
return false;
}
@Overwrite
public boolean contains(ResourceLocation p_12712_) {
return false;
}
@Overwrite
public void remove(Recipe<?> p_12714_) {
}
@Overwrite
protected void remove(ResourceLocation p_12716_) {
}
@Overwrite
public boolean willHighlight(Recipe<?> p_12718_) {
return false;
}
@Overwrite
public void removeHighlight(Recipe<?> p_12722_) {
}
@Overwrite
public void addHighlight(Recipe<?> p_12724_) {
}
@Overwrite
protected void addHighlight(ResourceLocation p_12720_) {
}
@Overwrite
public boolean isOpen(RecipeBookType p_12692_) {
return false;
}
@Overwrite
public void setOpen(RecipeBookType p_12694_, boolean p_12695_) {
}
@Overwrite
public boolean isFiltering(RecipeBookMenu<?> p_12690_) {
return false;
}
@Overwrite
public boolean isFiltering(RecipeBookType p_12705_) {
return false;
}
@Overwrite
public void setFiltering(RecipeBookType p_12707_, boolean p_12708_) {
}
@Overwrite
public void setBookSettings(RecipeBookSettings p_12688_) {
}
@Overwrite
public RecipeBookSettings getBookSettings() {
return this.bookSettings.copy();
}
@Overwrite
public void setBookSetting(RecipeBookType p_12697_, boolean p_12698_, boolean p_12699_) {
}
}

View File

@ -1,13 +1,13 @@
package dev.pfaff.recipe_nope.mixin;
import dev.pfaff.recipe_nope.injector.UnconstrainedRedirect;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.recipe.Recipe;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.network.ServerRecipeBook;
import net.minecraft.util.Identifier;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.stats.ServerRecipeBook;
import net.minecraft.world.item.crafting.Recipe;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@ -18,40 +18,40 @@ import org.spongepowered.asm.mixin.injection.Slice;
import java.util.Collection;
@Mixin(ServerPlayerEntity.class)
@Mixin(ServerPlayer.class)
public abstract class ServerPlayerEntityMixin {
@Shadow @Final private ServerRecipeBook recipeBook;
@Shadow @Final public MinecraftServer server;
@UnconstrainedRedirect(method = "<init>", at = @At(value = "NEW", target = "()Lnet/minecraft/server/network/ServerRecipeBook;"))
@UnconstrainedRedirect(method = "<init>", at = @At(value = "NEW", target = "()Lnet/minecraft/stats/ServerRecipeBook;"))
private ServerRecipeBook init$noRecipeBook() {
return null;
}
@Overwrite
public int unlockRecipes(Collection<Recipe<?>> recipes) {
public int awardRecipes(Collection<Recipe<?>> recipes) {
return 0;
}
@Overwrite
public void unlockRecipes(Identifier[] ids) {
public void awardRecipesByKey(ResourceLocation[] ids) {
}
@Overwrite
public int lockRecipes(Collection<Recipe<?>> recipes) {
public int resetRecipes(Collection<Recipe<?>> recipes) {
return 0;
}
@Redirect(method = "writeCustomDataToNbt", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerRecipeBook;toNbt()Lnet/minecraft/nbt/NbtCompound;"))
private NbtCompound writeCustomDataToNbt$recipeBookToNbt(ServerRecipeBook instance) {
return new NbtCompound();
@Redirect(method = "addAdditionalSaveData", at = @At(value = "INVOKE", target = "Lnet/minecraft/stats/ServerRecipeBook;toNbt()Lnet/minecraft/nbt/CompoundTag;"))
private CompoundTag writeCustomDataToNbt$recipeBookToNbt(ServerRecipeBook instance) {
return new CompoundTag();
}
@Redirect(method = "writeCustomDataToNbt", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/NbtCompound;put(Ljava/lang/String;Lnet/minecraft/nbt/NbtElement;)Lnet/minecraft/nbt/NbtElement;"), slice = @Slice(
from = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerRecipeBook;toNbt()Lnet/minecraft/nbt/NbtCompound;"),
@Redirect(method = "addAdditionalSaveData", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundTag;put(Ljava/lang/String;Lnet/minecraft/nbt/Tag;)Lnet/minecraft/nbt/Tag;"), slice = @Slice(
from = @At(value = "INVOKE", target = "Lnet/minecraft/stats/ServerRecipeBook;toNbt()Lnet/minecraft/nbt/CompoundTag;"),
to = @At(value = "CONSTANT", args = "stringValue=Dimension")
))
private NbtElement writeCustomDataToNbt$putRecipeBookNbt(NbtCompound instance, String key, NbtElement element) {
private Tag writeCustomDataToNbt$putRecipeBookNbt(CompoundTag instance, String key, Tag element) {
return null;
}
}

View File

@ -0,0 +1,52 @@
package dev.pfaff.recipe_nope.mixin;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.network.protocol.game.ClientboundRecipePacket;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.stats.ServerRecipeBook;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;
@Mixin(ServerRecipeBook.class)
public abstract class ServerRecipeBookMixin {
@Overwrite
public int addRecipes(Collection<Recipe<?>> p_12792_, ServerPlayer p_12793_) {
return 0;
}
@Overwrite
public int removeRecipes(Collection<Recipe<?>> p_12807_, ServerPlayer p_12808_) {
return 0;
}
@Overwrite
private void sendRecipes(ClientboundRecipePacket.State p_12802_,
ServerPlayer p_12803_,
List<ResourceLocation> p_12804_) {
}
@Overwrite
public CompoundTag toNbt() {
return new CompoundTag();
}
@Overwrite
public void fromNbt(CompoundTag p_12795_, RecipeManager p_12796_) {
}
@Overwrite
private void loadRecipes(ListTag p_12798_, Consumer<Recipe<?>> p_12799_, RecipeManager p_12800_) {
}
@Overwrite
public void sendInitialRecipeBook(ServerPlayer p_12790_) {
}
}

View File

@ -1,12 +1,10 @@
package dev.pfaff.recipe_nope.mixin;
import com.google.common.collect.ImmutableList;
import dev.pfaff.recipe_nope.RecipeNope;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.s2c.play.UnlockRecipesS2CPacket;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.book.RecipeBookOptions;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.game.ClientboundRecipePacket;
import net.minecraft.stats.RecipeBookSettings;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.injection.At;
@ -14,52 +12,37 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Collection;
import java.util.List;
import java.util.function.Function;
@Mixin(UnlockRecipesS2CPacket.class)
@Mixin(ClientboundRecipePacket.class)
public abstract class UnlockRecipesS2CPacketMixin {
@Inject(method = "<init>(Lnet/minecraft/network/packet/s2c/play/UnlockRecipesS2CPacket$Action;Ljava/util/Collection;Ljava/util/Collection;Lnet/minecraft/recipe/book/RecipeBookOptions;)V", at = @At(value = "INVOKE", target = "Ljava/lang/Object;<init>()V", shift = At.Shift.AFTER))
private void init$noWrite(UnlockRecipesS2CPacket.Action action,
Collection recipeIdsToChange,
Collection recipeIdsToInit,
RecipeBookOptions options,
CallbackInfo ci) {
throw RecipeNope.unsupported();
}
//@Redirect(method = "<init>(Lnet/minecraft/network/packet/s2c/play/UnlockRecipesS2CPacket$Action;Ljava/util/Collection;Ljava/util/Collection;Lnet/minecraft/recipe/book/RecipeBookOptions;)V", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableList;copyOf(Ljava/util/Collection;)Lcom/google/common/collect/ImmutableList;"))
//private <E> ImmutableList<E> init$skip(Collection<? extends E> list) {
// return null;
//}
@Redirect(method = "<init>(Lnet/minecraft/network/PacketByteBuf;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/PacketByteBuf;readEnumConstant(Ljava/lang/Class;)Ljava/lang/Enum;"))
private <T extends Enum<T>> T init$skipReadAction(PacketByteBuf instance, Class<T> enumClass) {
@Redirect(method = "<init>(Lnet/minecraft/network/FriendlyByteBuf;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/FriendlyByteBuf;readEnum(Ljava/lang/Class;)Ljava/lang/Enum;"))
private <T extends Enum<T>> T init$skipReadAction(FriendlyByteBuf instance, Class<T> enumClass) {
return null;
}
@Redirect(method = "<init>(Lnet/minecraft/network/PacketByteBuf;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/recipe/book/RecipeBookOptions;fromPacket(Lnet/minecraft/network/PacketByteBuf;)Lnet/minecraft/recipe/book/RecipeBookOptions;"))
private RecipeBookOptions init$skipReadOptions(PacketByteBuf buf) {
@Redirect(method = "<init>(Lnet/minecraft/network/FriendlyByteBuf;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/stats/RecipeBookSettings;read(Lnet/minecraft/network/FriendlyByteBuf;)Lnet/minecraft/stats/RecipeBookSettings;"))
private RecipeBookSettings init$skipReadOptions(FriendlyByteBuf buf) {
return null;
}
@Redirect(method = "<init>(Lnet/minecraft/network/PacketByteBuf;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/PacketByteBuf;readList(Ljava/util/function/Function;)Ljava/util/List;"))
private <T> List<T> init$skipReadList(PacketByteBuf instance, Function<PacketByteBuf, T> entryParser) {
@Redirect(method = "<init>(Lnet/minecraft/network/FriendlyByteBuf;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/FriendlyByteBuf;readList(Ljava/util/function/Function;)Ljava/util/List;"))
private <T> List<T> init$skipReadList(FriendlyByteBuf instance, Function<FriendlyByteBuf, T> entryParser) {
return null;
}
@Inject(method = "<init>(Lnet/minecraft/network/PacketByteBuf;)V", at = @At(value = "TAIL"))
private void init$noRead(PacketByteBuf buf, CallbackInfo ci) {
@Inject(method = "<init>(Lnet/minecraft/network/FriendlyByteBuf;)V", at = @At(value = "TAIL"))
private void init$noRead(FriendlyByteBuf buf, CallbackInfo ci) {
buf.readerIndex(buf.writerIndex());
}
@Overwrite
public void write(PacketByteBuf buf) {
public void write(FriendlyByteBuf buf) {
throw RecipeNope.unsupported();
}
@Overwrite
public void apply(ClientPlayPacketListener clientPlayPacketListener) {
public void handle(ClientGamePacketListener clientPlayPacketListener) {
}
}

View File

@ -0,0 +1,55 @@
# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="${mod_license}"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="${mod_id}" #mandatory
# The version number of the mod
version="${mod_version}" #mandatory
# A display name for the mod
displayName="${mod_name}" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
#logoFile="recipe_nope.png" #optional
# A text field displayed in the mod UI
#credits="Thanks for this example mod goes to Java" #optional
# A text field displayed in the mod UI
authors="${mod_authors}" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''${mod_description}'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.${mod_id}]] #optional
# the modid of the dependency
modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="${forge_version_range}" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side="BOTH"# Here's another dependency
[[dependencies.${mod_id}]]
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="${minecraft_version_range}"
ordering="NONE"
side="BOTH"

View File

@ -1,28 +0,0 @@
{
"schemaVersion": 1,
"id": "recipe_nope",
"version": "${version}",
"name": "recipe-nope",
"description": "Completely eliminates the recipe book. Gone. Reduced to atoms.",
"authors": [
"Michael Pfaff <michael@pfaff.dev>"
],
"contact": {
"repo": "https://github.com/pessimus/recipe-nope"
},
"license": "AGPL-3.0",
"icon": "assets/recipe_nope/icon.png",
"environment": "*",
"entrypoints": {
"preLaunch": [
"dev.pfaff.recipe_nope.injector.Entrypoint"
]
},
"mixins": [
"recipe_nope.mixins.json"
],
"depends": {
"fabricloader": ">=${loader_version}",
"minecraft": "${minecraft_version}"
}
}

View File

@ -0,0 +1,8 @@
{
"pack": {
"description": "recipe_nope resources",
"pack_format": 9,
"forge:resource_pack_format": 8,
"forge:data_pack_format": 9
}
}

View File

@ -3,18 +3,23 @@
"minVersion": "0.8",
"package": "dev.pfaff.recipe_nope.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "recipe_nope.refmap.json",
"mixins": [
"InventoryScreenMixin",
"PlayerManagerMixin",
"RecipeBookDataC2SPacketMixin",
"RecipeBookMixin",
"ServerPlayerEntityMixin",
"ServerRecipeBookMixin",
"UnlockRecipesS2CPacketMixin"
],
"client": [
"ClientPlayerEntityMixin",
"ClientPlayNetworkHandlerMixin",
"ClientRecipeBookMixin",
"CraftingScreenMixin",
"InventoryScreenMixin"
"InventoryScreenMixin",
"RecipeBookComponentMixin"
],
"injectors": {
"defaultRequire": 1