event base

This commit is contained in:
FatalEagler 2023-09-02 03:18:02 +00:00
parent fd9b51e9e0
commit f4d14f0b2b
10 changed files with 37214 additions and 34075 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,7 @@ package net.FatalCodes.shadow;
import de.Hero.clickgui.ClickGui;
import de.Hero.settings.SettingsManager;
import net.FatalCodes.shadow.event.Event;
import net.FatalCodes.shadow.module.ModuleManager;
public class Shadow {

View File

@ -0,0 +1,53 @@
package net.FatalCodes.shadow.event;
public class Event<T> {
public boolean cancelled;
public EventType type;
public EventDirection direction;
public boolean isCancelled() {
return cancelled;
}
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
public EventType getType() {
return type;
}
public void setType(EventType type) {
this.type = type;
}
public EventDirection getDirection() {
return direction;
}
public void setDirection(EventDirection direction) {
this.direction = direction;
}
public boolean isPre() {
if(type == null)
return false;
return type == EventType.PRE;
}
public boolean isPost() {
if(type == null)
return false;
return type == EventType.POST;
}
public boolean isIncoming() {
if(type == null)
return false;
return direction == EventDirection.INCOMING;
}
public boolean isOutgoing() {
if(type == null)
return false;
return direction == EventDirection.OUTGOING;
}
}

View File

@ -0,0 +1,6 @@
package net.FatalCodes.shadow.event;
public enum EventDirection {
OUTGOING,
INCOMING;
}

View File

@ -0,0 +1,6 @@
package net.FatalCodes.shadow.event;
public enum EventType {
PRE,
POST;
}

View File

@ -8,6 +8,7 @@ import java.util.List;
import de.Hero.settings.Setting;
import net.FatalCodes.shadow.Shadow;
import net.FatalCodes.shadow.event.Event;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.PlayerControllerMP;
@ -107,5 +108,9 @@ public class Module {
protected void sendPacket(Packet p) {
player().sendQueue.addToSendQueue(p);
}
public void onEvent(Event e) {
}
}

View File

@ -2,6 +2,7 @@ package net.FatalCodes.shadow.module;
import java.util.ArrayList;
import net.FatalCodes.shadow.event.Event;
import net.FatalCodes.shadow.module.hud.ClickGui;
import net.FatalCodes.shadow.module.hud.Drag;
import net.FatalCodes.shadow.module.pvp.AutoWtap;
@ -66,4 +67,11 @@ public class ModuleManager {
return inCategory;
}
public static void onEvent(Event e) {
for(Module m : mods) {
if(!m.isToggled())
continue;
m.onEvent(e);
}
}
}

View File

@ -1636,6 +1636,7 @@ public class Minecraft implements IThreadListener {
this.myNetworkManager.processReceivedPackets();
}
if (this.theWorld != null) {
++joinWorldTickCounter;
if (bungeeOutdatedMsgTimer > 0) {