Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
Johannes Frohnmeyer | 184fdb4c34 | |
Johannes Frohnmeyer | 654a70ca42 | |
Johannes Frohnmeyer | 7e995c233e | |
Johannes Frohnmeyer | 65048ebaf0 | |
Johannes Frohnmeyer | ce34f7cc1a | |
Johannes Frohnmeyer | d8a3e48931 | |
Johannes Frohnmeyer | f87479993b | |
Johannes Frohnmeyer | 08201ac873 | |
Johannes Frohnmeyer | 88b53c7654 | |
Johannes Frohnmeyer | fc9eeeb825 | |
Johannes Frohnmeyer | 4cf78fd350 | |
Johannes Frohnmeyer | 1e07944141 | |
Johannes Frohnmeyer | c0038f5e54 | |
Johannes Frohnmeyer | bb2025794b | |
Johannes Frohnmeyer | 389ca1b33b |
|
@ -1,2 +0,0 @@
|
|||
include:
|
||||
- remote: 'https://jfmods.gitlab.io/scripts/jfmod.yml'
|
|
@ -0,0 +1 @@
|
|||
#link https://pages.frohnmeyer-wds.de/scripts/jfmod.yml
|
|
@ -3,7 +3,7 @@ This can be used (for example) on servers with slow network connections to impro
|
|||
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.
|
||||
None of them can be configured, since this was originally developed for my own server and not intended to be used elsewhere.
|
||||
These features are, of course, configurable, so you can choose only the ones you want.
|
||||
|
||||
The following features are implemented:
|
||||
- Chests are never blocked
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
apply from: "https://jfmods.gitlab.io/scripts/jfmod.gradle"
|
||||
|
||||
dependencies {
|
||||
include modImplementation("io.gitlab.jfronny.libjf:libjf-base:${project.jfapi_version}")
|
||||
include modImplementation(fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version))
|
||||
}
|
|
@ -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")
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
# https://fabricmc.net/develop/
|
||||
minecraft_version=1.19
|
||||
yarn_mappings=build.4
|
||||
loader_version=0.14.8
|
||||
maven_group=io.gitlab.jfronny
|
||||
archives_base_name=YesCheat
|
||||
|
||||
jfapi_version=2.9.0
|
||||
fabric_version=0.56.3+1.19
|
||||
|
||||
modrinth_id=yescheat
|
|
@ -0,0 +1,9 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
maven("https://maven.fabricmc.net/") // FabricMC
|
||||
maven("https://maven.frohnmeyer-wds.de/artifacts") // scripts
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "yescheat"
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
}
|
||||
}
|
|
@ -1,12 +1,34 @@
|
|||
package io.gitlab.jfronny.yescheat;
|
||||
|
||||
import io.gitlab.jfronny.commons.log.Logger;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
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 = Logger.forName("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)
|
||||
))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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) {
|
|
@ -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) {
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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!
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
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;
|
||||
|
@ -9,10 +8,10 @@ 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.getString());
|
||||
// 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"))
|
|
@ -1,14 +0,0 @@
|
|||
package io.gitlab.jfronny.yescheat.mixin;
|
||||
|
||||
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(ServerPlayerInteractionManager.class)
|
||||
public class ServerPlayerInteractionManagerMixin {
|
||||
@ModifyConstant(method = "processBlockBreakingAction", constant = @Constant(doubleValue = 36D))
|
||||
private double addDistance(double original) {
|
||||
return 1024D;
|
||||
}
|
||||
}
|
|
@ -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) {
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ 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);
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -2,17 +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",
|
||||
"ServerPlayerInteractionManagerMixin",
|
||||
"ServerPlayNetworkHandlerMixin",
|
||||
"VillagerEntityMixin"
|
||||
"DistantBreaking",
|
||||
"DistantContainers3x3",
|
||||
"DistantContainerXx9",
|
||||
"IgnoreEula",
|
||||
"RemoveRubberbanding",
|
||||
"UnblockChests",
|
||||
"UncapEnchants",
|
||||
"UncapEnchants$Builder",
|
||||
"UnlockMendingInfinity",
|
||||
"VillagersFollowEmeralds1",
|
||||
"VillagersFollowEmeralds2"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"values": [
|
||||
"minecraft:emerald_block",
|
||||
"minecraft:emerald_ore",
|
||||
"minecraft:deepslate_emerald_ore",
|
||||
"#c:gems/emerald"
|
||||
]
|
||||
}
|
|
@ -4,19 +4,26 @@
|
|||
"version": "${version}",
|
||||
"name": "YesCheat",
|
||||
"description": "No more rubber-banding",
|
||||
"authors": [],
|
||||
"contact": {},
|
||||
"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.14.0",
|
||||
"minecraft": "*"
|
||||
"minecraft": "*",
|
||||
"libjf-config-core-v1": "*"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue