|
| 1 | +package com.gamesense.client.module.modules.exploits; |
| 2 | + |
| 3 | +import com.gamesense.client.module.Category; |
| 4 | +import com.gamesense.client.module.Module; |
| 5 | +import com.gamesense.api.util.misc.MessageBus; |
| 6 | +import com.gamesense.api.util.player.social.SocialManager; |
| 7 | +import com.mojang.realmsclient.gui.ChatFormatting; |
| 8 | +import net.minecraft.entity.Entity; |
| 9 | +import net.minecraft.entity.item.EntityEnderPearl; |
| 10 | +import net.minecraft.entity.player.EntityPlayer; |
| 11 | +import java.util.HashMap; |
| 12 | +import java.util.UUID; |
| 13 | + |
| 14 | +@Module.Declaration(name = "PearlNotify", category = Category.Combat) |
| 15 | +public class PearlNotify extends Module { |
| 16 | + |
| 17 | + private HashMap<EntityPlayer, UUID> list; |
| 18 | + private Entity enderPearl; |
| 19 | + private boolean flag; |
| 20 | + |
| 21 | + @Override |
| 22 | + public void onEnable() { |
| 23 | + flag = true; |
| 24 | + list = new HashMap<EntityPlayer, UUID>(); |
| 25 | + } |
| 26 | + |
| 27 | + @Override |
| 28 | + public void onUpdate() { |
| 29 | + if (PearlNotify.mc.world == null || PearlNotify.mc.player == null) { |
| 30 | + return; |
| 31 | + } |
| 32 | + enderPearl = null; |
| 33 | + for (final Entity e : PearlNotify.mc.world.loadedEntityList) { |
| 34 | + if (e instanceof EntityEnderPearl) { |
| 35 | + enderPearl = e; |
| 36 | + break; |
| 37 | + } |
| 38 | + } |
| 39 | + if (enderPearl == null) { |
| 40 | + flag = true; |
| 41 | + return; |
| 42 | + } |
| 43 | + EntityPlayer closestPlayer = null; |
| 44 | + for (final EntityPlayer entity : PearlNotify.mc.world.playerEntities) { |
| 45 | + if (closestPlayer == null) { |
| 46 | + closestPlayer = entity; |
| 47 | + } else { |
| 48 | + if (closestPlayer.getDistance(enderPearl) <= entity.getDistance(enderPearl)) { |
| 49 | + continue; |
| 50 | + } |
| 51 | + closestPlayer = entity; |
| 52 | + } |
| 53 | + } |
| 54 | + if (closestPlayer == PearlNotify.mc.player) { |
| 55 | + flag = false; |
| 56 | + } |
| 57 | + if (closestPlayer != null && flag) { |
| 58 | + String faceing = enderPearl.getHorizontalFacing().toString(); |
| 59 | + if (faceing.equals("WEST")) { |
| 60 | + faceing = "EAST"; |
| 61 | + } else if (faceing.equals("EAST")) { |
| 62 | + faceing = "WEST"; |
| 63 | + } |
| 64 | + MessageBus.sendClientPrefixMessage(SocialManager.isFriend(closestPlayer.getName()) ? (ChatFormatting.GREEN + closestPlayer.getName() + ChatFormatting.GRAY + |
| 65 | + " has just thrown a pearl heading " + ChatFormatting.GREEN + faceing + ChatFormatting.GRAY + "!") : (ChatFormatting.GREEN + closestPlayer.getName() + |
| 66 | + ChatFormatting.GRAY + " has just thrown a pearl heading " + ChatFormatting.GREEN + faceing + ChatFormatting.GRAY + "!")); |
| 67 | + flag = false; |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + |
| 72 | +} |
0 commit comments