Skip to content

Commit

Permalink
Make requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGridExpert committed Aug 22, 2024
1 parent e3fca3b commit e2fa926
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
package de.teamlapen.vampirism.api.event;

import net.minecraft.client.player.LocalPlayer;
import net.neoforged.bus.api.Event;
import org.jetbrains.annotations.NotNull;

@SuppressWarnings("unused")
public class VampireFogEvent extends Event {
private final LocalPlayer player;
private float fogDistanceMultiplier;

public VampireFogEvent(@NotNull LocalPlayer player, float fogDistanceMultiplier) {
this.player = player;
public VampireFogEvent(float fogDistanceMultiplier) {
this.fogDistanceMultiplier = fogDistanceMultiplier;
}

/**
* @return The Player that is seeing the fog.
*/
@NotNull
public LocalPlayer getPlayer() {
return player;
}
/**
* @return The fog distance multiplier of vampire fog.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ public void onClientTick(ClientTickEvent.Pre event) {
vampireBiomeFogDistanceMultiplier = vampire.getLevel() > 0 ? 2 : 1;
vampireBiomeFogDistanceMultiplier += vampire.getSkillHandler().isRefinementEquipped(ModRefinements.VISTA.get()) ? VampirismConfig.BALANCE.vrVistaMod.get().floatValue() : 0;

vampireBiomeFogDistanceMultiplier = VampirismEventFactory.fireVampireFogEvent(vampireBiomeFogDistanceMultiplier);

} else {
insideFog = false;
}
Expand All @@ -162,9 +164,6 @@ public void onClientTick(ClientTickEvent.Pre event) {
vampireBiomeTicks--;
}
}

VampireFogEvent vampireFogEvent = VampirismEventFactory.fireVampireFogEvent(mc.player, vampireBiomeFogDistanceMultiplier);
vampireBiomeFogDistanceMultiplier = vampireFogEvent.getFogDistanceMultiplier();
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ public static ActionEvent.ActionUpdateEvent fireActionUpdateEvent(@NotNull IFact
return event;
}

public static VampireFogEvent fireVampireFogEvent(@NotNull LocalPlayer player, float fogDistanceMultiplier) {
VampireFogEvent event = new VampireFogEvent(player, fogDistanceMultiplier);
public static float fireVampireFogEvent(float fogDistanceMultiplier) {
VampireFogEvent event = new VampireFogEvent(fogDistanceMultiplier);
NeoForge.EVENT_BUS.post(event);
return event;
return event.getFogDistanceMultiplier();
}

}

0 comments on commit e2fa926

Please sign in to comment.