Skip to content

Commit

Permalink
refactor(event): rename EyeOfEnderSurvivableEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Sep 18, 2022
1 parent 64832d2 commit 357c67a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private void use(
CallbackInfoReturnable<InteractionResultHolder> cir,
ItemStack itemstack, HitResult hitresult, ServerLevel serverlevel, BlockPos blockpos, EyeOfEnder eyeofender
) {
((IMixinEyeOfEnder) eyeofender).setSurvivable(AHServerEventFactory.fireSetEyeOfEnderSurvivableEvent((ServerPlayer) p_41185_, eyeofender));
((IMixinEyeOfEnder) eyeofender).setSurvivable(AHServerEventFactory.onEyeOfEnderSetSurvivable((ServerPlayer) p_41185_, eyeofender));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public MixinEyeOfEnder(EntityType<?> p_19870_, Level p_19871_) {
super(p_19870_, p_19871_);
}


@Shadow
private boolean surviveAfterDeath;

Expand All @@ -44,7 +43,7 @@ public void setSurvivable(Function<Random, Boolean> survivable) {
require = 1,
allow = 1
)
private void ignoreSetSurviveAfterDeathInSignalToMethod(EyeOfEnder e, boolean z) {}
private void ignorePutFiled_surviveAfterDeath(EyeOfEnder e, boolean z) {}

}

Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import javax.annotation.Nullable;
import org.apache.logging.log4j.Marker;
import org.auioc.mcmod.arnicalib.server.event.impl.CatMorningGiftChanceEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.EyeOfEnderSurvivableEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.FishingRodCastEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.ItemHurtEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.LivingEatAddEffectEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.PiglinStanceEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.ServerLoginEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.ServerPlayerSendMessageEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.SetEyeOfEnderSurvivableEvent;
import org.auioc.mcmod.arnicalib.utils.LogUtil;
import org.auioc.mcmod.arnicalib.utils.game.TextUtils;
import net.minecraft.network.Connection;
Expand Down Expand Up @@ -69,8 +69,8 @@ public static List<MobEffectInstance> onLivingEatAddEffect(LivingEntity entity,
return event.getEffects();
}

public static Function<Random, Boolean> fireSetEyeOfEnderSurvivableEvent(ServerPlayer player, EyeOfEnder eye) {
SetEyeOfEnderSurvivableEvent event = new SetEyeOfEnderSurvivableEvent(player, eye);
public static Function<Random, Boolean> onEyeOfEnderSetSurvivable(ServerPlayer player, EyeOfEnder eye) {
EyeOfEnderSurvivableEvent event = new EyeOfEnderSurvivableEvent(player, eye);
BUS.post(event);
return event.getSurvivable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.projectile.EyeOfEnder;

public class SetEyeOfEnderSurvivableEvent extends ServerPlayerEvent {
public class EyeOfEnderSurvivableEvent extends ServerPlayerEvent {

private final EyeOfEnder eye;
private Function<Random, Boolean> survivable;

public SetEyeOfEnderSurvivableEvent(ServerPlayer player, EyeOfEnder eye) {
public EyeOfEnderSurvivableEvent(ServerPlayer player, EyeOfEnder eye) {
super(player);
this.eye = eye;
this.survivable = (random) -> (random.nextInt(5) > 0);
Expand Down

0 comments on commit 357c67a

Please sign in to comment.