Skip to content

Commit

Permalink
1.9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipPanda committed May 29, 2024
1 parent f055578 commit d4e1a49
Show file tree
Hide file tree
Showing 251 changed files with 5,421 additions and 2,901 deletions.
41 changes: 27 additions & 14 deletions src/main/java/xyz/templecheats/templeclient/TempleClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public class TempleClient {
public static final String MODID = "templeclient";
public static final String NAME = "Temple Client";
public static final String VERSION = "1.9.3";
public static final String VERSION = "1.9.4";
public static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
public static String name = NAME + " " + VERSION;
public static AnnotatedEventManager eventBus;
Expand All @@ -55,58 +55,68 @@ public class TempleClient {
public void preInit(FMLPreInitializationEvent event) {
Display.setTitle("Loading " + name);
logger = event.getModLog();
logger.info("Pre-initialization complete.");
}

@EventHandler
public void init(FMLInitializationEvent event) {
Display.setTitle(name);
MinecraftForge.EVENT_BUS.register(new TempleClient());
MinecraftForge.EVENT_BUS.register(this);

eventBus = new AnnotatedEventManager();
logger.info("EventBus initialized.");

clientForgeEventManager = new ForgeEventManager();
MinecraftForge.EVENT_BUS.register(clientForgeEventManager);
logger.info("Forge Event Manager registered.");

configManager = new ConfigManager();
logger.info("Initialized Config!");
logger.info("Config Manager initialized.");

altManager = new AltManager();
logger.info("Alt Manager initialized.");

settingsManager = new SettingsManager();
logger.info("Settings Manager initialized.");

moduleManager = new ModuleManager();
logger.info("Module Manager Loaded.");
logger.info("Module Manager initialized.");

commandManager = new CommandManager();
logger.info("Commands Loaded.");
logger.info("Command Manager initialized.");

capeManager = new CapeManager();
logger.info("Cape Manager initialized.");

friendManager = new FriendManager();
logger.info("Friend Manager initialized.");

threadManager = new ThreadManager();
logger.info("Thread Manager initialized.");

MinecraftForge.EVENT_BUS.register(clientForgeEventManager);
MinecraftForge.EVENT_BUS.register(commandManager);

MinecraftForge.EVENT_BUS.register(new KeyUtil());
MinecraftForge.EVENT_BUS.register(new GuiEventsListener());
logger.info("KeyUtil and GuiEventsListener registered.");

FontUtils.setupFonts();
FontUtils.setupIcons();

configManager = new ConfigManager();

logger.info("Initialized Config!");
logger.info("Fonts and icons setup.");

configManager.loadAll();
logger.info("Configurations loaded.");

Runtime.getRuntime().addShutdownHook(new Thread(configManager::saveAll));
logger.info("Shutdown hook added for saving configurations.");
}

@SubscribeEvent
public void onChat(ClientChatEvent event) {
if (event.getMessage().startsWith("."))
if (commandManager.executeCommand(event.getMessage()))
if (event.getMessage().startsWith(".")) {
if (commandManager.executeCommand(event.getMessage())) {
event.setCanceled(true);
}
}
}

public static void setSession(Session s) {
Expand All @@ -116,18 +126,21 @@ public static void setSession(Session s) {
for (Field f : mc.getDeclaredFields()) {
if (f.getType().isInstance(s)) {
session = f;
break;
}
}
if (session == null) {
throw new IllegalStateException("Session Null");
throw new IllegalStateException("Session field not found.");
}
session.setAccessible(true);
session.set(Minecraft.getMinecraft(), s);
session.setAccessible(false);
name = "TempleClient 1.12.2 | User: " + Minecraft.getMinecraft().getSession().getUsername();
Display.setTitle(name);
logger.info("Session set successfully.");
} catch (Exception e) {
e.printStackTrace();
logger.error("Failed to set session.", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
import java.util.Map;

public class ConfigManager {

public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();

private final File mainDirectory;
private final File configDirectory;
private final File friendsDirectory;
Expand All @@ -31,6 +29,10 @@ public class ConfigManager {
private final File defaultConfigFile;
private final File baseFinderLogDirectory;

/****************************************************************
* Constructor
****************************************************************/

public ConfigManager() {
this.mainDirectory = new File(System.getProperty("user.dir") + File.separator + "Temple Client");
this.configDirectory = new File(this.mainDirectory, "1.12.2" + File.separator + "Config");
Expand Down Expand Up @@ -58,10 +60,18 @@ public ConfigManager() {
this.altsFile = new File(this.altsDirectory, "alt_accounts.json");
}

/****************************************************************
* Directory Getters
****************************************************************/

public File getConfigDirectory() {
return configDirectory;
}

/****************************************************************
* Save and Load Methods
****************************************************************/

public void saveAll() {
this.saveConfig(this.defaultConfigFile);
this.saveFriends();
Expand Down Expand Up @@ -177,6 +187,10 @@ public void loadConfig(File file) {
}
}

/****************************************************************
* Friend Management
****************************************************************/

private void saveFriends() {
final File friendsFile = new File(this.friendsDirectory, "friends.json");

Expand All @@ -203,7 +217,8 @@ private void loadFriends() {
try (FileReader fileReader = new FileReader(friendsFile);
JsonReader jsonReader = GSON.newJsonReader(fileReader)) {

final List<String> friendNames = GSON.fromJson(jsonReader, new TypeToken<List<String>>() {}.getType());
final List<String> friendNames = GSON.fromJson(jsonReader, new TypeToken<List<String>>() {
}.getType());

for (String name : friendNames) {
TempleClient.friendManager.addFriend(name);
Expand All @@ -214,16 +229,26 @@ private void loadFriends() {
}
}

/****************************************************************
* Alt Account Management
****************************************************************/

public List<String> loadAlts() {
if (!altsFile.exists()) return new ArrayList<>();
try (Reader reader = new FileReader(altsFile)) {
return GSON.fromJson(reader, new TypeToken<List<String>>() {}.getType());
return GSON.fromJson(reader, new TypeToken<List<String>>() {
}.getType());
} catch (IOException e) {
e.printStackTrace();
}
return new ArrayList<>();
}

/**
* Saves alt accounts to a file.
*
* @param alts The list of alt accounts to save.
*/
public void saveAlts(List<String> alts) {
try (Writer writer = new FileWriter(altsFile)) {
GSON.toJson(alts, writer);
Expand All @@ -232,6 +257,10 @@ public void saveAlts(List<String> alts) {
}
}

/****************************************************************
* Base Finder Logging
****************************************************************/

public void setupBaseFinderLogging() {
if (!baseFinderLogDirectory.exists()) {
baseFinderLogDirectory.mkdirs();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package xyz.templecheats.templeclient.event;
public class EventCancellable extends EventStageable {

public class EventCancellable extends EventStageable {
private boolean canceled;
public EventCancellable() {}

public EventCancellable() {
}

/****************************************************************
* Getters and Setters
****************************************************************/

public boolean isCanceled() {
return canceled;
}

public void setCanceled(boolean canceled) {
this.canceled = canceled;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package xyz.templecheats.templeclient.event;

public class EventStageable {

private EventStage stage;

public EventStageable() {

}

public EventStageable(EventStage stage) {
this.stage = stage;
}

/****************************************************************
* Getters and Setters
****************************************************************/

public EventStage getStage() {
return stage;
}
Expand All @@ -19,9 +23,12 @@ public void setStage(EventStage stage) {
this.stage = stage;
}

/****************************************************************
* Event Stages
****************************************************************/

public enum EventStage {
PRE,
POST
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,26 @@
import xyz.templecheats.templeclient.manager.ModuleManager;

public class ForgeEventManager {
private boolean playerLoaded;

public static long lastFrame, deltaTime;
private boolean playerLoaded;

public ForgeEventManager() {
MinecraftForge.EVENT_BUS.register(this);
playerLoaded = false;
}

/****************************************************************
* Event Handlers
****************************************************************/

@SubscribeEvent
public void onTickEvent(TickEvent.ClientTickEvent event) {
TempleClient.getModuleManager().onPlayerTick();
}

@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
//TempleClient.configManager.loadAll();
}

@SubscribeEvent
Expand All @@ -44,22 +49,16 @@ public void onRenderWorldLast(RenderWorldLastEvent event) {
if (Minecraft.getMinecraft().player == null) {
return;
}
final Render3DPrePreEvent render3DPrePreEvent = new Render3DPrePreEvent(event.getPartialTicks());
TempleClient.eventBus.dispatchEvent(render3DPrePreEvent);

final Render3DPreEvent render3DPreEvent = new Render3DPreEvent(event.getPartialTicks());
TempleClient.eventBus.dispatchEvent(render3DPreEvent);

final Render3DEvent render3dEvent = new Render3DEvent(event.getPartialTicks());
TempleClient.eventBus.dispatchEvent(render3dEvent);

final Render3DPostEvent render3dEventPost = new Render3DPostEvent(event.getPartialTicks());
TempleClient.eventBus.dispatchEvent(render3dEventPost);
TempleClient.eventBus.dispatchEvent(new Render3DPrePreEvent(event.getPartialTicks()));
TempleClient.eventBus.dispatchEvent(new Render3DPreEvent(event.getPartialTicks()));
TempleClient.eventBus.dispatchEvent(new Render3DEvent(event.getPartialTicks()));
TempleClient.eventBus.dispatchEvent(new Render3DPostEvent(event.getPartialTicks()));

deltaTime = System.currentTimeMillis() - lastFrame;
lastFrame = System.currentTimeMillis();

for (Module module: ModuleManager.getModules()) {
for (Module module : ModuleManager.getModules()) {
if (module.isToggled()) {
module.onRenderWorld(event.getPartialTicks());
}
Expand All @@ -71,4 +70,4 @@ public void onLeftClickBlock(PlayerInteractEvent.LeftClickBlock event) {
LeftClickBlockEvent leftClickBlockEvent = new LeftClickBlockEvent(event.getPos(), event.getFace());
MinecraftForge.EVENT_BUS.post(leftClickBlockEvent);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.templecheats.templeclient.event.events.render;

import xyz.templecheats.templeclient.event.EventCancellable;
import xyz.templecheats.templeclient.event.EventStageable;

public class Render3DEvent extends EventStageable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package xyz.templecheats.templeclient.event.events.render;

import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.client.renderer.chunk.RenderChunk;
import net.minecraftforge.fml.common.eventhandler.Event;

public class RenderChunkContainerEvent extends Event {
public RenderChunk RenderChunk;
public RenderChunkContainerEvent(RenderChunk renderChunk)
{

public RenderChunkContainerEvent(RenderChunk renderChunk) {
RenderChunk = renderChunk;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
public abstract class Command {
private static final Minecraft mc = Minecraft.getMinecraft();

/****************************************************************
* Abstract Methods
****************************************************************/
public abstract String getName();

public abstract void execute(String[] args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class BindCommand extends Command {
public String getName() {
return ".bind";
}

@Override
public void execute(String[] args) {
if (args.length != 3) {
Expand Down
Loading

0 comments on commit d4e1a49

Please sign in to comment.