Enchantment and potions

This commit is contained in:
Aleksey 2020-10-07 17:56:28 +03:00
parent 64f4285fbb
commit b79339e5bc
13 changed files with 169 additions and 6 deletions

View file

@ -0,0 +1,16 @@
package ru.betterend.mixin.common;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
import net.minecraft.item.Item;
import net.minecraft.potion.Potion;
import net.minecraft.recipe.BrewingRecipeRegistry;
@Mixin(BrewingRecipeRegistry.class)
public interface BrewingAccessor {
@Invoker
static void callRegisterPotionRecipe(Potion input, Item item, Potion output) {
throw new AssertionError("@Invoker dummy body called");
}
}

View file

@ -0,0 +1,26 @@
package ru.betterend.mixin.common;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.mob.EndermanEntity;
import net.minecraft.entity.player.PlayerEntity;
import ru.betterend.effects.EndEnchantments;
import ru.betterend.effects.EndStatusEffects;
@Mixin(EndermanEntity.class)
public abstract class EndermanEntityMixin {
@Inject(method = "isPlayerStaring", at = @At("HEAD"), cancellable = true)
private void isPlayerStaring(PlayerEntity player, CallbackInfoReturnable<Boolean> info) {
if (player.isCreative() || player.hasStatusEffect(EndStatusEffects.END_VEIL) ||
EnchantmentHelper.getEquipmentLevel(EndEnchantments.END_VEIL, player) > 0) {
info.setReturnValue(false);
info.cancel();
}
}
}