lightning rod fix
This commit is contained in:
@@ -7,7 +7,7 @@ yarn_mappings=1.21.11+build.2
|
||||
loader_version=0.18.2
|
||||
loom_version=1.14-SNAPSHOT
|
||||
# Mod Properties
|
||||
mod_version=1.8
|
||||
mod_version=1.9
|
||||
maven_group=com.kasetoatz
|
||||
archives_base_name=SuperEnchants
|
||||
# Dependencies
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.kasetoatz.superenchants.mixin;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.projectile.TridentEntity;
|
||||
import net.minecraft.loot.condition.WeatherCheckLootCondition;
|
||||
import net.minecraft.loot.context.LootContext;
|
||||
@@ -9,14 +10,17 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Mixin(WeatherCheckLootCondition.class)
|
||||
public class WeatherCheckLootConditionMixin
|
||||
{
|
||||
@Inject(method="test(Lnet/minecraft/loot/context/LootContext;)Z", at=@At("RETURN"), cancellable=true)
|
||||
public void test(LootContext lootContext, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
Integer level = lootContext.get(LootContextParameters.ENCHANTMENT_LEVEL);
|
||||
if (lootContext.get(LootContextParameters.DIRECT_ATTACKING_ENTITY) instanceof TridentEntity && level != null && level > 1)
|
||||
Entity entity = Objects.requireNonNullElse(lootContext.get(LootContextParameters.DIRECT_ATTACKING_ENTITY), lootContext.get(LootContextParameters.THIS_ENTITY));
|
||||
Integer level = Objects.requireNonNullElse(lootContext.get(LootContextParameters.ENCHANTMENT_LEVEL), 0);
|
||||
if (entity instanceof TridentEntity && level > 1)
|
||||
{
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user