From 23dd464f5e6ad4e6fc105c258da779ffaa81e06e Mon Sep 17 00:00:00 2001 From: white_cola Date: Sun, 28 Aug 2022 16:38:40 +0800 Subject: [PATCH] MiddleClick Module, Notification update. --- .../top/whitecola/promodule/ProModule.java | 8 ++- .../whitecola/promodule/common/Position.java | 53 ++++++++++++++ .../notification/AbstractNotification.java | 54 +++++++------- .../notification/INotificationControl.java | 3 + .../gui/notification/INotificationPos.java | 17 +++-- .../gui/notification/INotificationStyle.java | 4 +- .../gui/notification/NotificationManager.java | 6 +- .../beans/NotificationRenderEvent.java | 27 +++++++ .../notification/impls/PureNotification.java | 24 ++++++- .../modules/impls/combat/AimAssist.java | 21 +++++- .../modules/impls/movement/EagleJump.java | 29 ++++++++ .../modules/impls/movement/LegitSafeWalk.java | 31 ++++++++ .../modules/impls/movement/SafeWalk.java | 4 -- .../modules/impls/other/MiddleClick.java | 70 +++++++++++++++---- .../modules/impls/render/OldAnimation.java | 18 +++++ .../promodule/utils/PlayerSPUtils.java | 6 ++ 16 files changed, 315 insertions(+), 60 deletions(-) create mode 100644 src/main/java/top/whitecola/promodule/common/Position.java create mode 100644 src/main/java/top/whitecola/promodule/gui/notification/beans/NotificationRenderEvent.java create mode 100644 src/main/java/top/whitecola/promodule/modules/impls/movement/EagleJump.java create mode 100644 src/main/java/top/whitecola/promodule/modules/impls/movement/LegitSafeWalk.java delete mode 100644 src/main/java/top/whitecola/promodule/modules/impls/movement/SafeWalk.java diff --git a/src/main/java/top/whitecola/promodule/ProModule.java b/src/main/java/top/whitecola/promodule/ProModule.java index 6619286..4dbb61b 100644 --- a/src/main/java/top/whitecola/promodule/ProModule.java +++ b/src/main/java/top/whitecola/promodule/ProModule.java @@ -19,6 +19,8 @@ import top.whitecola.promodule.modules.ModuleManager; import top.whitecola.promodule.modules.impls.combat.*; import top.whitecola.promodule.modules.impls.movement.Eagle; +import top.whitecola.promodule.modules.impls.movement.EagleJump; +import top.whitecola.promodule.modules.impls.movement.LegitSafeWalk; import top.whitecola.promodule.modules.impls.movement.WTap; import top.whitecola.promodule.modules.impls.other.*; import top.whitecola.promodule.modules.impls.render.*; @@ -100,6 +102,10 @@ public void registerModules(){ //movement getModuleManager().addModule(new Eagle()); getModuleManager().addModule(new WTap()); +// getModuleManager().addModule(new EagleJump()); + +// getModuleManager().addModule(new LegitSafeWalk()); + //world getModuleManager().addModule(new FastPlace()); @@ -109,7 +115,7 @@ public void registerModules(){ getModuleManager().addModule(new GUIBlur()); getModuleManager().addModule(new Notification()); // getModuleManager().addModule(new Hud()); -// getModuleManager().addModule(new MiddleClick()); + getModuleManager().addModule(new MiddleClick()); } diff --git a/src/main/java/top/whitecola/promodule/common/Position.java b/src/main/java/top/whitecola/promodule/common/Position.java new file mode 100644 index 0000000..121ee0b --- /dev/null +++ b/src/main/java/top/whitecola/promodule/common/Position.java @@ -0,0 +1,53 @@ +package top.whitecola.promodule.common; + +public class Position { + public float x; + public float y; + public float x2; + public float y2; + + public Position(){} + + public Position(float x,float y,float x2,float y2){ + this.x = x; + this.y = y; + this.x2 = x2; + this.y2 = y2; + } + + public float getX() { + return x; + } + + public Position setX(float x) { + this.x = x; + return this; + } + + public float getY() { + return y; + } + + public Position setY(float y) { + this.y = y; + return this; + } + + public float getX2() { + return x2; + } + + public Position setX2(float x2) { + this.x2 = x2; + return this; + } + + public float getY2() { + return y2; + } + + public Position setY2(float y2) { + this.y2 = y2; + return this; + } +} diff --git a/src/main/java/top/whitecola/promodule/gui/notification/AbstractNotification.java b/src/main/java/top/whitecola/promodule/gui/notification/AbstractNotification.java index f3fe500..1094bce 100644 --- a/src/main/java/top/whitecola/promodule/gui/notification/AbstractNotification.java +++ b/src/main/java/top/whitecola/promodule/gui/notification/AbstractNotification.java @@ -1,14 +1,21 @@ package top.whitecola.promodule.gui.notification; +import top.whitecola.promodule.common.Position; + public abstract class AbstractNotification implements INotificationPos, INotificationStyle, INotificationControl { - protected float x; - protected float y; - protected float x2; - protected float y2; + protected Position pos; + protected Position toPos; + protected boolean isFinish; protected boolean needLeave; + protected boolean Entered; + + protected int level; + + protected long lastTime; + // @Override @@ -37,47 +44,42 @@ public boolean getFinish() { return false; } - - @Override - public void setX(float x) { - this.x = x; + public int getLevel() { + return level; } @Override - public void setY(float y) { - this.y = y; + public void setLevel(int level) { + this.level = level; } - @Override - public void setX2(float x2) { - this.x2 = x2; - } @Override - public void setY2(float y2) { - this.y2 = y2; + public Position getPos() { + return pos; } @Override - public float getY2() { - return y2; + public Position getToPos() { + return toPos; } @Override - public float getX2() { - return x2; + public void setPos(Position pos) { + this.pos = pos; } @Override - public float getX() { - return x; + public void setToPos(Position toPos) { + this.toPos = toPos; } - @Override - public float getY() { - return y; + public boolean isEntered() { + return Entered; } - + public void setEntered(boolean entered) { + Entered = entered; + } } diff --git a/src/main/java/top/whitecola/promodule/gui/notification/INotificationControl.java b/src/main/java/top/whitecola/promodule/gui/notification/INotificationControl.java index e47b949..6e38c6d 100644 --- a/src/main/java/top/whitecola/promodule/gui/notification/INotificationControl.java +++ b/src/main/java/top/whitecola/promodule/gui/notification/INotificationControl.java @@ -7,4 +7,7 @@ public interface INotificationControl { void setNeedLeave(boolean needLeave); boolean getNeedLeave(); + void setLevel(int isFinish); + int getLevel(); + } \ No newline at end of file diff --git a/src/main/java/top/whitecola/promodule/gui/notification/INotificationPos.java b/src/main/java/top/whitecola/promodule/gui/notification/INotificationPos.java index da45904..2545e70 100644 --- a/src/main/java/top/whitecola/promodule/gui/notification/INotificationPos.java +++ b/src/main/java/top/whitecola/promodule/gui/notification/INotificationPos.java @@ -1,13 +1,12 @@ package top.whitecola.promodule.gui.notification; +import top.whitecola.promodule.common.Position; + public interface INotificationPos { - void setX(float x); - void setY(float y); - float getX(); - float getY(); - - void setX2(float x); - void setY2(float y); - float getX2(); - float getY2(); + Position getPos(); + void setPos(Position pos); + + Position getToPos(); + void setToPos(Position pos); + } diff --git a/src/main/java/top/whitecola/promodule/gui/notification/INotificationStyle.java b/src/main/java/top/whitecola/promodule/gui/notification/INotificationStyle.java index c914cb8..9b1a256 100644 --- a/src/main/java/top/whitecola/promodule/gui/notification/INotificationStyle.java +++ b/src/main/java/top/whitecola/promodule/gui/notification/INotificationStyle.java @@ -1,5 +1,7 @@ package top.whitecola.promodule.gui.notification; +import top.whitecola.promodule.gui.notification.beans.NotificationRenderEvent; + public interface INotificationStyle { - void render(); + void render(NotificationRenderEvent e); } diff --git a/src/main/java/top/whitecola/promodule/gui/notification/NotificationManager.java b/src/main/java/top/whitecola/promodule/gui/notification/NotificationManager.java index 815020f..6e78d5d 100644 --- a/src/main/java/top/whitecola/promodule/gui/notification/NotificationManager.java +++ b/src/main/java/top/whitecola/promodule/gui/notification/NotificationManager.java @@ -1,5 +1,7 @@ package top.whitecola.promodule.gui.notification; +import top.whitecola.promodule.gui.notification.beans.NotificationRenderEvent; + import java.util.Iterator; import java.util.Vector; @@ -20,6 +22,8 @@ public void push(AbstractNotification notification) { notifications.get(i).setNeedLeave(true); } } + + } @Override @@ -30,7 +34,7 @@ public void renderAll() { if(notification.getFinish()){ iterator.remove(); } - notification.render(); + notification.render(new NotificationRenderEvent(notifications.indexOf(notification),line)); } } } diff --git a/src/main/java/top/whitecola/promodule/gui/notification/beans/NotificationRenderEvent.java b/src/main/java/top/whitecola/promodule/gui/notification/beans/NotificationRenderEvent.java new file mode 100644 index 0000000..809b070 --- /dev/null +++ b/src/main/java/top/whitecola/promodule/gui/notification/beans/NotificationRenderEvent.java @@ -0,0 +1,27 @@ +package top.whitecola.promodule.gui.notification.beans; + +public class NotificationRenderEvent { + private int level; + private int totalLine; + + public NotificationRenderEvent(int level,int totalLine){ + this.level = level; + this.totalLine = totalLine; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public int getTotalLine() { + return totalLine; + } + + public void setTotalLine(int totalLine) { + this.totalLine = totalLine; + } +} diff --git a/src/main/java/top/whitecola/promodule/gui/notification/impls/PureNotification.java b/src/main/java/top/whitecola/promodule/gui/notification/impls/PureNotification.java index 2ba254f..2bca0e1 100644 --- a/src/main/java/top/whitecola/promodule/gui/notification/impls/PureNotification.java +++ b/src/main/java/top/whitecola/promodule/gui/notification/impls/PureNotification.java @@ -1,13 +1,33 @@ package top.whitecola.promodule.gui.notification.impls; import top.whitecola.promodule.gui.notification.AbstractNotification; +import top.whitecola.promodule.gui.notification.beans.NotificationRenderEvent; public class PureNotification extends AbstractNotification { + protected long totalTime = 1000; - + public PureNotification(){ + + } @Override - public void render() { + public void render(NotificationRenderEvent e) { + manageTime(e.getLevel()); + if(!isEntered()){ + } } + + public void manageTime(int level){ + if(lastTime==0){ + if(level==1){ + lastTime = System.currentTimeMillis(); + } + return; + } + + if(System.currentTimeMillis() - this.lastTime>=totalTime){ + this.setNeedLeave(true); + } + }; } diff --git a/src/main/java/top/whitecola/promodule/modules/impls/combat/AimAssist.java b/src/main/java/top/whitecola/promodule/modules/impls/combat/AimAssist.java index 472e012..b111308 100644 --- a/src/main/java/top/whitecola/promodule/modules/impls/combat/AimAssist.java +++ b/src/main/java/top/whitecola/promodule/modules/impls/combat/AimAssist.java @@ -15,11 +15,13 @@ import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent; import org.lwjgl.Sys; +import top.whitecola.promodule.ProModule; import top.whitecola.promodule.annotations.ModuleSetting; import top.whitecola.promodule.events.impls.event.WorldRenderEvent; import top.whitecola.promodule.injection.wrappers.IMixinEntity; import top.whitecola.promodule.modules.AbstractModule; import top.whitecola.promodule.modules.ModuleCategory; +import top.whitecola.promodule.modules.impls.other.MiddleClick; import top.whitecola.promodule.utils.AimUtils; import top.whitecola.promodule.utils.PlayerSPUtils; import top.whitecola.promodule.utils.ServerUtils; @@ -57,6 +59,9 @@ public class AimAssist extends AbstractModule { @ModuleSetting(name = "CheckTeam",type = "select") public Boolean checkTeam = true; + @ModuleSetting(name = "CheckFriend",type = "select") + public Boolean checkFriend = true; + public long delta, lastTime; private EntityLivingBase theTarget; @@ -194,9 +199,19 @@ private EntityLivingBase getClosest(float range) { } private boolean shouldAttack(EntityLivingBase entity){ -// if(AimUtils.getRotationsDelta(entity)[0]>fieldOfView && AimUtils.getRotationsDelta(entity)[1]>fieldOfView){ -// return false; -// } + + if(checkFriend){ + MiddleClick middleClick = (MiddleClick) ProModule.getProModule().getModuleManager().getModuleByName("MiddleClick"); + if(middleClick!=null&&middleClick.isEnabled()){ + if(middleClick.getFriends().contains(entity)){ + return false; + } + } + } + + if(AimUtils.getRotationsDelta(entity)[0]>fieldOfView || AimUtils.getRotationsDelta(entity)[1]>fieldOfView){ + return false; + } if(entity.isInvisible()){ return false; diff --git a/src/main/java/top/whitecola/promodule/modules/impls/movement/EagleJump.java b/src/main/java/top/whitecola/promodule/modules/impls/movement/EagleJump.java new file mode 100644 index 0000000..3d2a67c --- /dev/null +++ b/src/main/java/top/whitecola/promodule/modules/impls/movement/EagleJump.java @@ -0,0 +1,29 @@ +package top.whitecola.promodule.modules.impls.movement; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import top.whitecola.promodule.modules.AbstractModule; +import top.whitecola.promodule.modules.ModuleCategory; + +public class EagleJump extends AbstractModule { + + @Override + public void onTick() { + + super.onTick(); + } + + @Override + public ModuleCategory getModuleType() { + return ModuleCategory.MOVEMENT; + } + + @Override + public String getModuleName() { + return "EagleJump"; + + } + +} diff --git a/src/main/java/top/whitecola/promodule/modules/impls/movement/LegitSafeWalk.java b/src/main/java/top/whitecola/promodule/modules/impls/movement/LegitSafeWalk.java new file mode 100644 index 0000000..f7e2f7d --- /dev/null +++ b/src/main/java/top/whitecola/promodule/modules/impls/movement/LegitSafeWalk.java @@ -0,0 +1,31 @@ +package top.whitecola.promodule.modules.impls.movement; + +import top.whitecola.promodule.modules.AbstractModule; +import top.whitecola.promodule.modules.ModuleCategory; +import top.whitecola.promodule.utils.PlayerSPUtils; + +import static top.whitecola.promodule.utils.MCWrapper.*; + + + +public class LegitSafeWalk extends AbstractModule { + + + + + @Override + public ModuleCategory getModuleType() { + return ModuleCategory.MOVEMENT; + } + + @Override + public String getModuleName() { + return "LegitSafeWalk"; + + } + + @Override + public String getDisplayName() { + return this.getModuleName()+" (G)"; + } +} diff --git a/src/main/java/top/whitecola/promodule/modules/impls/movement/SafeWalk.java b/src/main/java/top/whitecola/promodule/modules/impls/movement/SafeWalk.java deleted file mode 100644 index 9f5b9e7..0000000 --- a/src/main/java/top/whitecola/promodule/modules/impls/movement/SafeWalk.java +++ /dev/null @@ -1,4 +0,0 @@ -package top.whitecola.promodule.modules.impls.movement; - -public class SafeWalk { -} diff --git a/src/main/java/top/whitecola/promodule/modules/impls/other/MiddleClick.java b/src/main/java/top/whitecola/promodule/modules/impls/other/MiddleClick.java index 6b060f9..a5d8937 100644 --- a/src/main/java/top/whitecola/promodule/modules/impls/other/MiddleClick.java +++ b/src/main/java/top/whitecola/promodule/modules/impls/other/MiddleClick.java @@ -1,38 +1,79 @@ package top.whitecola.promodule.modules.impls.other; +import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import org.lwjgl.input.Mouse; import top.whitecola.promodule.annotations.ModuleSetting; import top.whitecola.promodule.modules.AbstractModule; import top.whitecola.promodule.modules.ModuleCategory; +import top.whitecola.promodule.utils.PlayerSPUtils; import java.util.Vector; +import static top.whitecola.promodule.utils.MCWrapper.mc; + public class MiddleClick extends AbstractModule { - @ModuleSetting(name = "Whitelist") - protected Boolean whitelist = true; + @ModuleSetting(name = "AddFriend",type = "select") + protected Boolean addFriend = true; - @ModuleSetting(name = "Only1World") + @ModuleSetting(name = "Only1World",type = "select") protected Boolean only1World = true; - @ModuleSetting(name = "Only1") - protected Boolean only1 = true; + @ModuleSetting(name = "Only1",type = "select") + protected Boolean only1 = false; protected Vector entities = new Vector(); + protected boolean wasClick; + + @Override + public void onTick() { + if(Minecraft.getMinecraft()==null||Minecraft.getMinecraft().theWorld==null || mc.thePlayer==null){ + return; + } + + if(!addFriend){ + return; + } + + if(!wasClick&&Mouse.isButtonDown(2)){ + Entity entity = mc.objectMouseOver.entityHit; + + if(entity==null){ + return; + } + + if(!(entity instanceof EntityLivingBase)){ + return; + } -// @Override -// public void onTick() { -// if(){ -// -// } -// super.onTick(); -// } + if(!(entity instanceof EntityPlayer)){ + return; + } + if(entities.contains((EntityLivingBase)entity)){ + this.entities.remove((EntityLivingBase) entity); + PlayerSPUtils.sendMsgToSelf("remove friend: "+entity.getDisplayName().getFormattedText()); + + }else{ + this.entities.add((EntityLivingBase) entity); + PlayerSPUtils.sendMsgToSelf("Added new friend: "+entity.getDisplayName().getFormattedText()); + + } + + } + + wasClick = Mouse.isButtonDown(2); + + super.onTick(); + } @Override public void onEntityJoinWorld(EntityJoinWorldEvent e) { - if(e.entity instanceof EntityPlayerSP){ + if(only1World && e.entity instanceof EntityPlayerSP){ entities.clear(); } @@ -50,4 +91,7 @@ public String getModuleName() { } + public Vector getFriends() { + return entities; + } } diff --git a/src/main/java/top/whitecola/promodule/modules/impls/render/OldAnimation.java b/src/main/java/top/whitecola/promodule/modules/impls/render/OldAnimation.java index 5be74eb..9c130ff 100644 --- a/src/main/java/top/whitecola/promodule/modules/impls/render/OldAnimation.java +++ b/src/main/java/top/whitecola/promodule/modules/impls/render/OldAnimation.java @@ -1,9 +1,27 @@ package top.whitecola.promodule.modules.impls.render; +import top.whitecola.promodule.annotations.ModuleSetting; import top.whitecola.promodule.modules.AbstractModule; import top.whitecola.promodule.modules.ModuleCategory; +import static top.whitecola.promodule.utils.MCWrapper.*; public class OldAnimation extends AbstractModule { + + @ModuleSetting(name = "EatingAnim",type = "select") + protected Boolean eatingAnim = true; + + @ModuleSetting(name = "SideOnly",type = "select") + protected Boolean sideOnly = true; + + @Override + public void onTick() { + + + + + super.onTick(); + } + @Override public ModuleCategory getModuleType() { return ModuleCategory.RENDERS; diff --git a/src/main/java/top/whitecola/promodule/utils/PlayerSPUtils.java b/src/main/java/top/whitecola/promodule/utils/PlayerSPUtils.java index cb7c067..bbdfcd6 100644 --- a/src/main/java/top/whitecola/promodule/utils/PlayerSPUtils.java +++ b/src/main/java/top/whitecola/promodule/utils/PlayerSPUtils.java @@ -47,4 +47,10 @@ public static BlockPos getCurrentFrontBlock(){ public static void sendMsgToSelf(String content){ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(content)); } + + + + + + }