My brain is smooth

This commit is contained in:
JFronny 2021-08-21 22:10:28 +02:00
parent 005953bfb5
commit 96772d9985
No known key found for this signature in database
GPG Key ID: BEC5ACBBD4EE17E5
3 changed files with 31 additions and 4 deletions

View File

@ -7,8 +7,8 @@ import org.spongepowered.asm.mixin.injection.ModifyArg;
@Mixin(EnchantmentHelper.class)
public class EnchantmentHelperMixin {
@ModifyArg(method = "getLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(III)I"), index = 2)
private static int injectMaxEnchantmentLevel(int val, int min, int max) {
return val;
@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

@ -0,0 +1,26 @@
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

@ -11,7 +11,8 @@
"Generic3x3ContainerScreenHandlerMixin",
"GenericContainerScreenHandlerMixin",
"InfinityEnchantmentMixin",
"ServerPlayNetworkHandlerMixin"
"ServerPlayNetworkHandlerMixin",
"VillagerEntityMixin"
],
"injectors": {
"defaultRequire": 1