Skip to content

Commit

Permalink
Fix mixin conflict with AoA (#1285)
Browse files Browse the repository at this point in the history
  • Loading branch information
IzzelAliz committed Mar 23, 2024
1 parent 841f2b3 commit 362d93d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.izzel.arclight.common.mixin.core.world.entity;

import com.google.common.base.Function;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mojang.datafixers.util.Either;
Expand Down Expand Up @@ -95,6 +94,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;

@SuppressWarnings({"ConstantConditions", "Guava"})
@Mixin(LivingEntity.class)
Expand Down Expand Up @@ -456,16 +456,16 @@ public int getExpReward() {
}
}

@Redirect(method = "removeAllEffects", at = @At(value = "INVOKE", target = "Ljava/util/Collection;iterator()Ljava/util/Iterator;"))
private Iterator<MobEffectInstance> arclight$clearReason(Collection<MobEffectInstance> instance) {
@Redirect(method = "removeAllEffects", at = @At(value = "INVOKE", target = "Ljava/util/Map;values()Ljava/util/Collection;"))
private Collection<MobEffectInstance> arclight$clearReason(Map<MobEffect, MobEffectInstance> instance) {
var cause = bridge$getEffectCause().orElse(EntityPotionEffectEvent.Cause.UNKNOWN);
return Iterators.filter(instance.iterator(), effect -> {
return instance.values().stream().filter(effect -> {
EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent((LivingEntity) (Object) this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED);
if (event.isCancelled()) {
return false;
}
return true;
});
}).collect(Collectors.toList());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,6 @@ public abstract class ServerPlayerMixin_NeoForge extends PlayerMixin_NeoForge im
}
}

/**
* @author IzzelAliz
* @reason
*/
@Override
@Nullable
public Entity changeDimension(ServerLevel arg) {
return this.changeDimension(arg, arg.getPortalForcer());
}

/**
* @author IzzelAliz
* @reason
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.mojang.serialization.DynamicOps;
import com.mojang.serialization.JsonOps;
import io.izzel.arclight.common.bridge.core.world.item.crafting.RecipeManagerBridge;
import net.minecraft.resources.RegistryOps;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
import net.minecraft.util.GsonHelper;
Expand All @@ -31,6 +29,7 @@ public RecipeManagerMixin_NeoForge(Gson gson, String string) {

@Override
public RecipeHolder<?> bridge$platform$loadRecipe(ResourceLocation key, JsonElement element) {
return fromJson(key, GsonHelper.convertToJsonObject(element, "top element"), ConditionalOps.create(RegistryOps.create(JsonOps.INSTANCE, this.registryAccess), this.conditionContext)).orElse(null);
ConditionalOps<JsonElement> ops = this.makeConditionalOps();
return fromJson(key, GsonHelper.convertToJsonObject(element, "top element"), ops).orElse(null);
}
}

0 comments on commit 362d93d

Please sign in to comment.