-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/main/java/cqb13/NumbyHack/modules/general/RaidCaptainNotifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package cqb13.NumbyHack.modules.general; | ||
|
||
import cqb13.NumbyHack.NumbyHack; | ||
import meteordevelopment.meteorclient.events.world.TickEvent; | ||
import meteordevelopment.meteorclient.settings.BoolSetting; | ||
import meteordevelopment.meteorclient.settings.Setting; | ||
import meteordevelopment.meteorclient.settings.SettingGroup; | ||
import meteordevelopment.meteorclient.systems.modules.Module; | ||
import meteordevelopment.meteorclient.utils.player.ChatUtils; | ||
import meteordevelopment.orbit.EventHandler; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.mob.PillagerEntity; | ||
import net.minecraft.nbt.NbtCompound; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
public class RaidCaptainNotifier extends Module { | ||
private final SettingGroup sgGeneral = settings.getDefaultGroup(); | ||
|
||
private final Setting<Boolean> location = sgGeneral.add(new BoolSetting.Builder() | ||
.name("location") | ||
.description("Includes coordinates in the notification.") | ||
.defaultValue(false) | ||
.build() | ||
); | ||
|
||
private final Set<UUID> checkedPillagers = new HashSet<>(); | ||
|
||
public RaidCaptainNotifier() { | ||
super(NumbyHack.CATEGORY, "Raid Captain Notifier", "Notifies you when a raid captain spawns, good for waiting in outposts on bad servers."); | ||
} | ||
|
||
@EventHandler | ||
private void onTick(TickEvent.Pre event) { | ||
if (mc.world == null) return; | ||
|
||
for (Entity entity : mc.world.getEntities()) { | ||
if (entity instanceof PillagerEntity) { | ||
PillagerEntity pillager = (PillagerEntity) entity; | ||
UUID pillagerId = pillager.getUuid(); | ||
|
||
if (checkedPillagers.contains(pillagerId)) continue; | ||
|
||
NbtCompound nbtData = pillager.writeNbt(new NbtCompound()); | ||
String nbtString = nbtData.asString(); | ||
|
||
//TODO: Improve this when not lazy | ||
if (nbtString.contains("translate\":\"block.minecraft.ominous_banner")) { | ||
System.out.println(nbtData); | ||
if (location.get()) { | ||
ChatUtils.info("Raid Captain Spawned at " + pillager.getBlockX() + ", " + pillager.getBlockY() + ", " + pillager.getBlockZ() + "!"); | ||
} else { | ||
ChatUtils.info("Raid Captain Spawned!"); | ||
} | ||
|
||
checkedPillagers.add(pillagerId); | ||
} | ||
} | ||
} | ||
} | ||
} |