Compare commits

...

17 Commits

Author SHA1 Message Date
Johannes Frohnmeyer 184fdb4c34
chore: update to 1.20.5
ci/woodpecker/push/jfmod Pipeline was successful Details
ci/woodpecker/tag/jfmod Pipeline was successful Details
2024-04-25 21:47:03 +02:00
Johannes Frohnmeyer 654a70ca42
chore: update to 1.20.4
ci/woodpecker/push/jfmod Pipeline was successful Details
2023-12-07 21:00:07 +01:00
Johannes Frohnmeyer 7e995c233e
chore: update to 1.20.2
ci/woodpecker/push/jfmod Pipeline was successful Details
2023-09-22 21:24:56 +02:00
Johannes Frohnmeyer 65048ebaf0
chore: remove unused variable
ci/woodpecker/push/jfmod Pipeline was successful Details
2023-07-16 15:41:56 +02:00
Johannes Frohnmeyer ce34f7cc1a
feat(villagers): Use feature implementation by enjarai
ci/woodpecker/push/jfmod Pipeline failed Details
2023-07-16 15:41:00 +02:00
Johannes Frohnmeyer d8a3e48931
build: add TAWs and fix LibJF CFG 2023-07-16 14:38:19 +02:00
Johannes Frohnmeyer f87479993b
chore: add reasons for overrides 2023-07-16 14:37:49 +02:00
Johannes Frohnmeyer 08201ac873
chore: use jfMod DSL 2023-07-16 13:58:09 +02:00
Johannes Frohnmeyer 88b53c7654
Bump to 1.20
ci/woodpecker/push/jfmod Pipeline was successful Details
ci/woodpecker/tag/jfmod Pipeline was successful Details
2023-06-09 17:27:35 +02:00
Johannes Frohnmeyer fc9eeeb825
Bump to 1.19.4
ci/woodpecker/push/jfmod Pipeline failed Details
ci/woodpecker/tag/jfmod Pipeline was successful Details
2023-03-14 22:34:54 +01:00
Johannes Frohnmeyer 4cf78fd350
Use new config compiler plugin
ci/woodpecker/push/jfmod Pipeline was successful Details
2022-12-29 14:25:02 +01:00
Johannes Frohnmeyer 1e07944141
Update to 1.19.3
ci/woodpecker/push/jfmod Pipeline was successful Details
ci/woodpecker/tag/jfmod Pipeline was successful Details
2022-12-07 22:45:31 +01:00
Johannes Frohnmeyer c0038f5e54
Update to new infrastructure
ci/woodpecker/manual/jfmod Pipeline was successful Details
2022-12-02 17:30:52 +01:00
Johannes Frohnmeyer bb2025794b
Update to LibJF 3 2022-08-28 13:09:22 +02:00
Johannes Frohnmeyer 389ca1b33b
Update to 1.19.1, add config and restructure for better readability 2022-07-28 17:16:18 +02:00
Johannes Frohnmeyer e5fbe28836
Improve the README 2022-06-25 22:40:48 +02:00
Johannes Frohnmeyer 579146c7f7
Update for 1.19 and prepare for publishing on modrinth 2022-06-25 22:31:15 +02:00
32 changed files with 363 additions and 416 deletions

View File

@ -1,2 +0,0 @@
include:
- remote: 'https://jfmods.gitlab.io/scripts/jfmod.yml'

1
.woodpecker.yml Normal file
View File

@ -0,0 +1 @@
#link https://pages.frohnmeyer-wds.de/scripts/jfmod.yml

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2020
Copyright (c) 2020-2022
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,3 +1,16 @@
# YesCheat
YesCheat provides hacky overwrites for "anticheat" methods in minecraft that do not check some aspects of the validity of inputs\
Use case: prevent a slow server from randomly moving/stopping players
This can be used (for example) on servers with slow network connections to improve rubber banding,
or when experimenting with Minecraft's features at their extremes.
Over time, the mod has also accumulated several QoL features I wanted on my server but didn't want to create a separate mod for.
These features are, of course, configurable, so you can choose only the ones you want.
The following features are implemented:
- Chests are never blocked
- Enchantments aren't capped at 255
- The EULA file is ignored
- Container screens aren't closed when moving away from them
- The mending enchantment can be applied at the same time as others
- Blocks can be broken at any distance
- Remove movement checks ("fixes" rubber banding)
- Villagers follow emerald blocks

View File

@ -1 +0,0 @@
apply from: "https://jfmods.gitlab.io/scripts/jfmod.gradle"

33
build.gradle.kts Normal file
View File

@ -0,0 +1,33 @@
plugins {
id("jfmod") version "1.6-SNAPSHOT"
}
allprojects { group = "io.gitlab.jfronny" }
base.archivesName = "yescheat"
jfMod {
minecraftVersion = "1.20.5"
yarn("build.1")
loaderVersion = "0.15.10"
libJfVersion = "3.15.5"
fabricApiVersion = "0.97.6+1.20.5"
modrinth {
projectId = "yescheat"
requiredDependencies.addAll("libjf", "fabric-api")
}
}
dependencies {
modImplementation("io.gitlab.jfronny.libjf:libjf-config-core-v2")
modImplementation("net.fabricmc.fabric-api:fabric-api")
// Dev env
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-config-ui-tiny")
modLocalRuntime("io.gitlab.jfronny.libjf:libjf-devutil")
modLocalRuntime("com.terraformersmc:modmenu:10.0.0-beta.1")
// for modmenu
modLocalRuntime("net.fabricmc.fabric-api:fabric-resource-loader-v0")
modLocalRuntime("net.fabricmc.fabric-api:fabric-screen-api-v1")
modLocalRuntime("net.fabricmc.fabric-api:fabric-key-binding-api-v1")
}

View File

@ -1,9 +0,0 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
# check these on https://fabricmc.net/versions.html
minecraft_version=1.18
yarn_mappings=build.1
loader_version=0.12.6
# Mod Properties
maven_group=io.gitlab.jfronny
archives_base_name=YesCheat

Binary file not shown.

View File

@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

234
gradlew vendored
View File

@ -1,234 +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/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" "$@"

89
gradlew.bat vendored
View File

@ -1,89 +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=.
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

9
settings.gradle.kts Normal file
View File

@ -0,0 +1,9 @@
pluginManagement {
repositories {
maven("https://maven.fabricmc.net/") // FabricMC
maven("https://maven.frohnmeyer-wds.de/artifacts") // scripts
gradlePluginPortal()
}
}
rootProject.name = "yescheat"

View File

@ -0,0 +1,19 @@
package io.gitlab.jfronny.yescheat;
import io.gitlab.jfronny.libjf.config.api.v2.Entry;
import io.gitlab.jfronny.libjf.config.api.v2.JfConfig;
@JfConfig
public class Cfg {
@Entry public static boolean antiRubberband = true;
@Entry public static boolean uncapEnchants = true;
@Entry public static boolean unblockChests = true;
@Entry public static boolean distantContainers = true;
@Entry public static boolean unlockMending = true;
@Entry public static boolean distantBreaking = true;
@Entry public static boolean villagersFollowEmeralds = true;
static {
JFC_Cfg.ensureInitialized();
}
}

View File

@ -0,0 +1,56 @@
package io.gitlab.jfronny.yescheat;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import java.util.List;
import java.util.Set;
public class Plugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {
}
@Override
public String getRefMapperConfig() {
return null;
}
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
final String prefix = "io.gitlab.jfronny.yescheat.mixin.";
if (!mixinClassName.startsWith(prefix)) throw new IllegalArgumentException("Mixin in unexpected package: " + mixinClassName);
mixinClassName = mixinClassName.substring(prefix.length());
if (mixinClassName.startsWith("Debug")) return true;
return switch (mixinClassName) {
case "UnblockChests" -> Cfg.unblockChests;
case "UncapEnchants", "UncapEnchants$Builder" -> Cfg.uncapEnchants;
case "IgnoreEula" -> true;
case "DistantContainers3x3", "DistantContainerXx9" -> Cfg.distantContainers;
case "UnlockMendingInfinity" -> Cfg.unlockMending;
case "DistantBreaking" -> Cfg.distantBreaking;
case "RemoveRubberbanding" -> Cfg.antiRubberband;
case "VillagersFollowEmeralds1", "VillagersFollowEmeralds2" -> Cfg.villagersFollowEmeralds;
default -> throw new IllegalArgumentException("Unrecognized mixin: " + mixinClassName + "! This should never happen");
};
}
@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
}
@Override
public List<String> getMixins() {
return null;
}
@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
}

View File

@ -1,13 +1,34 @@
package io.gitlab.jfronny.yescheat;
import net.fabricmc.api.ModInitializer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.entity.ai.brain.sensor.SensorType;
import net.minecraft.entity.ai.brain.sensor.TemptationsSensor;
import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.*;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
public class YesCheat implements ModInitializer {
public static final Logger LOGGER = LogManager.getLogger("yescheat");
public static final String MOD_ID = "yescheat";
private static final Identifier TEMPTATIONS_ID = new Identifier(MOD_ID, "villager_temptations");
public static SensorType<TemptationsSensor> VILLAGER_TEMPTATIONS;
@Override
public void onInitialize() {
LOGGER.info("YesCheat initialized, anticheat yeeted");
if (Cfg.villagersFollowEmeralds) {
villagersFollowEmeraldsInit();
Registry.register(Registries.SENSOR_TYPE, TEMPTATIONS_ID, VILLAGER_TEMPTATIONS);
}
}
public static synchronized void villagersFollowEmeraldsInit() {
if (!Cfg.villagersFollowEmeralds) throw new IllegalStateException("villagersFollowEmeralds is not enabled but its initializer is called");
if (VILLAGER_TEMPTATIONS == null) {
VILLAGER_TEMPTATIONS =
new SensorType<>(() -> new TemptationsSensor((Ingredient.fromTag(
TagKey.of(RegistryKeys.ITEM, TEMPTATIONS_ID)
))));
}
}
}

View File

@ -0,0 +1,26 @@
package io.gitlab.jfronny.yescheat.mixin;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.asm.mixin.*;
@Mixin(PlayerEntity.class)
public class DistantBreaking {
/**
* @author JFronny
* @reason Allow breaking blocks from any distance
*/
@Overwrite
public boolean canInteractWithBlockAt(BlockPos pos, double additionalRange) {
return true;
}
/**
* @author JFronny
* @reason Allow interacting with entities from any distance
*/
@Overwrite
public double getEntityInteractionRange() {
return Double.MAX_VALUE;
}
}

View File

@ -6,9 +6,10 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(GenericContainerScreenHandler.class)
public class GenericContainerScreenHandlerMixin {
public class DistantContainerXx9 {
/**
* @author JFronny
* @reason Containers GUIs should never be closed under any circumstances
*/
@Overwrite
public boolean canUse(PlayerEntity player) {

View File

@ -6,9 +6,10 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(Generic3x3ContainerScreenHandler.class)
public class Generic3x3ContainerScreenHandlerMixin {
public class DistantContainers3x3 {
/**
* @author JFronny
* @reason Containers GUIs should never be closed under any circumstances
*/
@Overwrite
public boolean canUse(PlayerEntity player) {

View File

@ -1,14 +0,0 @@
package io.gitlab.jfronny.yescheat.mixin;
import net.minecraft.enchantment.EnchantmentHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
@Mixin(EnchantmentHelper.class)
public class EnchantmentHelperMixin {
@ModifyArg(method = "getLevelFromNbt", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(III)I"), index = 2)
private static int injectMaxEnchantmentLevel(int x) {
return Integer.MAX_VALUE;
}
}

View File

@ -5,15 +5,17 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(EulaReader.class)
public class EulaReaderMixin {
public class IgnoreEula {
/**
* @author JFronny
* @reason Simplify setting up servers slightly and remove one file. You already agreed to the EULA, so this should be fine.
*/
@Overwrite
private boolean checkEulaAgreement() { return true; }
/**
* @author JFronny
* @reason Simplify setting up servers slightly and remove one file. You already agreed to the EULA, so this should be fine.
*/
@Overwrite
public boolean isEulaAgreedTo() {
@ -22,7 +24,10 @@ public class EulaReaderMixin {
/**
* @author JFronny
* @reason Simplify setting up servers slightly and remove one file. You already agreed to the EULA, so this should be fine.
*/
@Overwrite
private void createEulaFile() { }
private void createEulaFile() {
// Do not create anything!
}
}

View File

@ -1,17 +1,17 @@
package io.gitlab.jfronny.yescheat.mixin;
import io.gitlab.jfronny.yescheat.YesCheat;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ServerPlayNetworkHandler.class)
public abstract class ServerPlayNetworkHandlerMixin {
public abstract class RemoveRubberbanding {
@Redirect(method = "tick()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;disconnect(Lnet/minecraft/text/Text;)V"))
private void overwriteFloatingCheck(ServerPlayNetworkHandler handler, Text reason) {
YesCheat.LOGGER.info("Cancelled disconnect: " + reason.asString());
// Cancel disconnect
}
@Redirect(method = "onVehicleMove(Lnet/minecraft/network/packet/c2s/play/VehicleMoveC2SPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;isHost()Z"))
@ -19,8 +19,8 @@ public abstract class ServerPlayNetworkHandlerMixin {
return true;
}
@Redirect(method = "onPlayerMove(Lnet/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;isHost()Z"))
private boolean overwritePlayerMoveSpeedCheck(ServerPlayNetworkHandler p) {
@Redirect(method = "onPlayerMove(Lnet/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;isInTeleportationState()Z"))
private boolean overwriteTeleportationState(ServerPlayerEntity instance) {
return true;
}
}

View File

@ -7,9 +7,10 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(ChestBlock.class)
public abstract class ChestBlockMixin {
public abstract class UnblockChests {
/**
* @author JFronny
* @reason Chests should never be blocked under any circumstances
*/
@Overwrite
public static boolean isChestBlocked(WorldAccess world, BlockPos pos) {

View File

@ -0,0 +1,51 @@
package io.gitlab.jfronny.yescheat.mixin;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import net.minecraft.component.type.ItemEnchantmentsComponent;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.registry.entry.RegistryEntry;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ItemEnchantmentsComponent.class)
public class UncapEnchants {
@Final @Mutable @Shadow public static int MAX_ENCHANTMENT_LEVEL;
@ModifyArg(method = "<clinit>", at = @At(value = "INVOKE", target = "Lcom/mojang/serialization/Codec;intRange(II)Lcom/mojang/serialization/Codec;", remap = false), index = 1)
private static int injectMaxEnchantmentLevel(int x) {
return Integer.MAX_VALUE;
}
@Inject(method = "<clinit>", at = @At("TAIL"))
private static void ae(CallbackInfo ci) {
MAX_ENCHANTMENT_LEVEL = Integer.MAX_VALUE;
}
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lit/unimi/dsi/fastutil/objects/Object2IntOpenHashMap;object2IntEntrySet()Lit/unimi/dsi/fastutil/objects/Object2IntMap$FastEntrySet;", remap = false))
private Object2IntMap.FastEntrySet<RegistryEntry<Enchantment>> object2IntEntrySet(Object2IntOpenHashMap<RegistryEntry<Enchantment>> object2IntOpenHashMap) {
for (Object2IntMap.Entry<RegistryEntry<Enchantment>> entry : object2IntOpenHashMap.object2IntEntrySet()) {
int i = entry.getIntValue();
if (i >= 0) continue;
throw new IllegalArgumentException("Enchantment " + entry.getKey() + " has invalid level " + i);
}
return new Object2IntOpenHashMap<RegistryEntry<Enchantment>>().object2IntEntrySet();
}
@Mixin(ItemEnchantmentsComponent.Builder.class)
public static class Builder {
@Redirect(method = "set(Lnet/minecraft/enchantment/Enchantment;I)V", at = @At(value = "INVOKE", target = "Ljava/lang/Math;min(II)I", remap = false))
private int min(int a, int b) {
return a;
}
@Redirect(method = "add(Lnet/minecraft/enchantment/Enchantment;I)V", at = @At(value = "INVOKE", target = "Ljava/lang/Math;min(II)I", remap = false))
private int min2(int a, int b) {
return a;
}
}
}

View File

@ -9,9 +9,9 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(InfinityEnchantment.class)
public class InfinityEnchantmentMixin {
public class UnlockMendingInfinity {
@Inject(method = "canAccept", at = @At("HEAD"), cancellable = true)
private void differs(Enchantment other, CallbackInfoReturnable<Boolean> cir) {
if(other instanceof MendingEnchantment) cir.setReturnValue(true);
if (other instanceof MendingEnchantment) cir.setReturnValue(true);
}
}

View File

@ -1,26 +0,0 @@
package io.gitlab.jfronny.yescheat.mixin;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.goal.TemptGoal;
import net.minecraft.entity.passive.MerchantEntity;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.item.Items;
import net.minecraft.recipe.Ingredient;
import net.minecraft.village.VillagerType;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(VillagerEntity.class)
public abstract class VillagerEntityMixin extends MerchantEntity {
public VillagerEntityMixin(EntityType<? extends MerchantEntity> entityType, World world) {
super(entityType, world);
}
@Inject(method = "<init>(Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;Lnet/minecraft/village/VillagerType;)V", at = @At(value = "TAIL"))
private void inject(EntityType<? extends VillagerEntity> entityType, World world, VillagerType type, CallbackInfo ci) {
this.goalSelector.add(2, new TemptGoal(this, .4D, Ingredient.ofItems(Items.EMERALD_BLOCK, Items.EMERALD_ORE, Items.DEEPSLATE_EMERALD_ORE), false));
}
}

View File

@ -0,0 +1,36 @@
package io.gitlab.jfronny.yescheat.mixin;
import com.google.common.collect.ImmutableList;
import io.gitlab.jfronny.yescheat.YesCheat;
import net.minecraft.entity.ai.brain.MemoryModuleType;
import net.minecraft.entity.ai.brain.sensor.Sensor;
import net.minecraft.entity.ai.brain.sensor.SensorType;
import net.minecraft.entity.passive.VillagerEntity;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.ArrayList;
@Mixin(VillagerEntity.class)
public abstract class VillagersFollowEmeralds1 {
@Mutable @Shadow @Final private static ImmutableList<MemoryModuleType<?>> MEMORY_MODULES;
@Mutable @Shadow @Final private static ImmutableList<SensorType<? extends Sensor<? super VillagerEntity>>> SENSORS;
@Inject(method = "<clinit>", at = @At("TAIL"))
private static void addRequiredMemoryModulesAndSensors(CallbackInfo ci) {
YesCheat.villagersFollowEmeraldsInit();
var newMemoryModules = new ArrayList<>(MEMORY_MODULES);
newMemoryModules.add(MemoryModuleType.TEMPTATION_COOLDOWN_TICKS);
newMemoryModules.add(MemoryModuleType.IS_TEMPTED);
newMemoryModules.add(MemoryModuleType.TEMPTING_PLAYER);
newMemoryModules.add(MemoryModuleType.IS_PANICKING);
MEMORY_MODULES = ImmutableList.copyOf(newMemoryModules);
var newSensors = new ArrayList<>(SENSORS);
newSensors.add(YesCheat.VILLAGER_TEMPTATIONS);
SENSORS = ImmutableList.copyOf(newSensors);
}
}

View File

@ -0,0 +1,20 @@
package io.gitlab.jfronny.yescheat.mixin;
import com.mojang.datafixers.util.Pair;
import net.minecraft.entity.ai.brain.MemoryModuleType;
import net.minecraft.entity.ai.brain.task.*;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
@Mixin(VillagerTaskListProvider.class)
public abstract class VillagersFollowEmeralds2 {
@ModifyArg(method = "createCoreTasks", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableList;of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lcom/google/common/collect/ImmutableList;", remap = false))
private static Object[] addTemptationAsCoreTask(Object[] original) {
Object[] modified = new Object[original.length + 2];
System.arraycopy(original, 0, modified, 0, original.length);
modified[original.length] = Pair.of(0, new TemptTask(e -> 0.5f));
modified[original.length + 1] = Pair.of(0, new TemptationCooldownTask(MemoryModuleType.TEMPTATION_COOLDOWN_TICKS));
return modified;
}
}

View File

@ -2,16 +2,19 @@
"required": true,
"minVersion": "0.8",
"package": "io.gitlab.jfronny.yescheat.mixin",
"compatibilityLevel": "JAVA_16",
"plugin": "io.gitlab.jfronny.yescheat.Plugin",
"mixins": [
"ChestBlockMixin",
"EnchantmentHelperMixin",
"EulaReaderMixin",
"Generic3x3ContainerScreenHandlerMixin",
"GenericContainerScreenHandlerMixin",
"InfinityEnchantmentMixin",
"ServerPlayNetworkHandlerMixin",
"VillagerEntityMixin"
"DistantBreaking",
"DistantContainers3x3",
"DistantContainerXx9",
"IgnoreEula",
"RemoveRubberbanding",
"UnblockChests",
"UncapEnchants",
"UncapEnchants$Builder",
"UnlockMendingInfinity",
"VillagersFollowEmeralds1",
"VillagersFollowEmeralds2"
],
"injectors": {
"defaultRequire": 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -0,0 +1,17 @@
{
"yescheat.jfconfig.title": "YesCheat (restart after changing)",
"yescheat.jfconfig.antiRubberband": "Anti-Rubberband",
"yescheat.jfconfig.antiRubberband.tooltip": "Prevent rubber-banding by removing serverside movement checks",
"yescheat.jfconfig.uncapEnchants": "Uncap Enchantments",
"yescheat.jfconfig.uncapEnchants.tooltip": "Removes the arbitrary upper limit of 255 for enchantments",
"yescheat.jfconfig.unblockChests": "Unblock Chests",
"yescheat.jfconfig.unblockChests.tooltip": "Chests are never blocked",
"yescheat.jfconfig.distantContainers": "Distant Containers",
"yescheat.jfconfig.distantContainers.tooltip": "Distant container screens aren't closed",
"yescheat.jfconfig.unlockMending": "Unblock Mending",
"yescheat.jfconfig.unlockMending.tooltip": "Allows using mending in parallel with infinity",
"yescheat.jfconfig.distantBreaking": "Distant Breaking",
"yescheat.jfconfig.distantBreaking.tooltip": "Removes the maximum distance for breaking blocks",
"yescheat.jfconfig.villagersFollowEmeralds": "Villagers follow Emeralds",
"yescheat.jfconfig.villagersFollowEmeralds.tooltip": "Makes villagers follow emerald blocks"
}

View File

@ -0,0 +1,8 @@
{
"values": [
"minecraft:emerald_block",
"minecraft:emerald_ore",
"minecraft:deepslate_emerald_ore",
"#c:gems/emerald"
]
}

View File

@ -3,21 +3,27 @@
"id": "yescheat",
"version": "${version}",
"name": "YesCheat",
"description": "",
"authors": [],
"contact": {},
"description": "No more rubber-banding",
"authors": ["JFronny"],
"contact": {
"email": "projects.contact@frohnmeyer-wds.de",
"homepage": "https://jfronny.gitlab.io",
"issues": "https://git.frohnmeyer-wds.de/JfMods/YesCheat/issues",
"sources": "https://git.frohnmeyer-wds.de/JfMods/YesCheat"
},
"license": "MIT",
"icon": "assets/yescheat/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"io.gitlab.jfronny.yescheat.YesCheat"
]
"main": ["io.gitlab.jfronny.yescheat.YesCheat"],
"libjf:config": ["io.gitlab.jfronny.yescheat.JFC_Cfg"]
},
"mixins": [
"YesCheat.mixins.json"
],
"depends": {
"fabricloader": ">=0.12.0",
"minecraft": "*"
"fabricloader": ">=0.14.0",
"minecraft": "*",
"libjf-config-core-v1": "*"
}
}