Skip to content

Commit

Permalink
Improvement: Option to hide other players while in Gunther's Race (#2655
Browse files Browse the repository at this point in the history
)

Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
  • Loading branch information
MTOnline69 and hannibal002 authored Oct 5, 2024
1 parent a517ef4 commit 96599f6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ public class GunthersRaceConfig {
@ConfigOption(name = "Monochrome Color", desc = "Set a boring monochrome color for the guide waypoints.")
@ConfigEditorColour
public Property<String> monochromeColor = Property.of("0:60:0:0:255");

@Expose
@ConfigOption(name = "Hide Other Players", desc = "Hide other players while in the race.")
@ConfigEditorBoolean
@FeatureToggle
public boolean hidePlayers = false;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.rift.area.westvillage

import at.hannibal2.skyhanni.data.jsonobjects.repo.ParkourJson
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
Expand All @@ -11,9 +12,11 @@ import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.ConditionalUtils
import at.hannibal2.skyhanni.utils.EntityUtils.isNPC
import at.hannibal2.skyhanni.utils.ParkourHelper
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

@SkyHanniModule
Expand Down Expand Up @@ -105,6 +108,18 @@ object RiftGunthersRace {
}
}

@SubscribeEvent
fun onCheckRender(event: CheckRenderEntityEvent<*>) {
if (!isEnabled()) return
if (!config.hidePlayers) return
if (!RiftAPI.inRiftRace) return

val entity = event.entity
if (entity is EntityOtherPlayerMP && !entity.isNPC()) {
event.cancel()
}
}

@SubscribeEvent
fun onRenderWorld(event: LorenzRenderWorldEvent) {
if (!isEnabled() || !RiftAPI.inRiftRace) return
Expand Down

0 comments on commit 96599f6

Please sign in to comment.