diff options
709 files changed, 13629 insertions, 11033 deletions
diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml new file mode 100644 index 00000000..b8f952d3 --- /dev/null +++ b/.github/workflows/beta.yml @@ -0,0 +1,37 @@ +name: Beta Build + +on: + push: + branches: + - 'breaking-changes-just-working-im-not-putting-all-of-these-into-3.0-but-for-the-sake-of-beta-release-this-thing-exists' + workflow_dispatch: +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 16 + uses: actions/setup-java@v3 + with: + java-version: '16' + distribution: 'adopt' + cache: 'gradle' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Download hychat as a dependency + run: mkdir jars && wget https://cdn.discordapp.com/attachments/782825804983566356/791708191519932426/Hychat-1.12.1-BETA.jar -O jars/Hychat-1.12.1-BETA.jar + - name: Build with Gradle + run: ./gradlew build + - uses: actions/upload-artifact@v2 + if: github.event_name == 'workflow_dispatch' + with: + name: Compiled-files + path: build/libs/*.jar + - name: Upload to beta webhook + env: + BETA_WEBHOOK: ${{ secrets.BETA_WEBHOOK }} + # run: curl -F "file1=@./build/lib/dungeonsguide-3.8.0.jar" "$BETA_WEBHOOK" + run: | + BUILDMODPATH=$(find ./build/ -type d -name "libs" -exec find "{}" -type f -name "dungeonsguide-*-all.jar" \;) + echo $BUILDMODPATH + curl -F "file1=@$BUILDMODPATH" "$BETA_WEBHOOK"
\ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 62f386c2..db0dc81b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,10 +3,10 @@ name: Build on: push: branches: - - '*' + - 'master' pull_request: branches: - - '*' + - 'master' workflow_dispatch: jobs: build: @@ -20,6 +20,7 @@ jobs: with: java-version: '16' distribution: 'adopt' + cache: 'gradle' - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Download hychat as a dependency @@ -30,4 +31,4 @@ jobs: if: github.event_name == 'workflow_dispatch' with: name: Compiled-files - path: build/libs/*.jar + path: build/libs/*.jar
\ No newline at end of file @@ -17,31 +17,60 @@ </p> # Dungeons Guide -The most intelligent Hypixel Skyblock Dungeons Mod +The most intelligent Hypixel Skyblock Dungeons Mod. ## Official Support Discord -Join Our Discord! https://discord.gg/vuGsXhY5Bv +Join Our [Discord!](https://discord.gg/vuGsXhY5Bv) + ## Features -- Dungeon Waypoints - - Waypoints for every things that are interactable in dungeon. - - NPC, Secret, Door, Lever, Superboom wall, Crypts - - Q. Hey is this feature bannable? - - A. No. - 0. It has been verified a admin to be safe. Check #announcement on discord for screenshot - 1. It is not Watchdog detectable since it does not modify player behaviour or packet - 2. It is not an ESP (unlike some other "secret waypoints" mods which are really just ChestESP and ItemESP). This mod bases the waypoints on a static set of coordinates from a corner of the room a player is in. This is similar to fairy soul waypoints (which Simon has confirmed are allowed) since it is not scanning for the secrets but rather displaying a waypoint over a set coordinate. - 3. It does not break any of the 4 guidelines recently posted by Fr0z3n about disallowed QOL modifications - 4. It does not provide an unfair advantage. Players who memorized secrets will always be able to find secrets faster than someone who hasn't memorized secrets and is using waypoints. -- Puzzle Solvers (ALL) - - 3 weirdos - - intelligent ice-path solver - - intelligent ice-fill solver - - intelligent box solver - - intelligent water solver (FAST SOLUTION) - - blaze solver - - creeper solver - - Bomb defuse solver (except it does not esp or xray solution) - - Teleport-pads solver - - Trivia solver -- Useful Dungeon HUDS -- All the other features could be found at [here](https://dungeonsguide.gitbook.io/) +### Solvers +- **F7 Terminal Solvers** (Shows the correct solution/order.) +- **Creeper Solver** (Shows what sea lanterns to hit.) +- **Simon Says Solver** (Shows correct buttons to hit.) +- **Blaze Room Solver** (Shows what order to kill the blazes in.) +- **Advanced Water Board Solver** (Shows you what buttons to hit.) +- **Tic-Tac-Toe Solver** (Shows the correct tic-tac-toe solution.) +- **Riddle Solver** (Tells you the correct person, requires you to click all three characters first.) +- **Ice Fill Solver** (Shows the correct path through the ice puzzle.) +- **Silverfish Solver** (Shows what way you should hit the silverfish.) +- **Bomb Defuse Solver** (Shows the path through the pressure plates. Requires you to visit the left side and press a key to save the solution first, Required to be this way to follow Hypixel rules.) +- **Secret Finder** (Creates a line from the player towards the nearest secret. [Video demonstrating this feature](https://www.youtube.com/watch?v=fhfNU13wjq0)) +- **Fairy Soul Finder** (Shows the location of dungeon fairy souls.) + +### QOL Features +- **Secrets Chest Close** (Hit any key while in a secret chest to close it.) +- **Ability Cooldown** (Shows ability cooldowns.) +- **Spirit Boots Fixer** (Fixes spirit boots changing your hand to air.) +- **Blood Room Warning** (Shows dungeon progress and if you should enter the boss arena or not.) +- **Box Secret Bats** (Creates a box around secret bats to make them easier to find, does not change their hitbox.) +- **Box Real Livid** (Creates a coloured box around the real Livid.) +- **Box Skeleton Masters** (Places a box around skeleton masters to make them easier to see.) +- **Highlight Starred Mobs** (Highlight starred mobs to make them easier to spot and kill.) +- **Dungeon Map** (See the layout of a dungeon, room progress, other players positions and the total secrets in each room.) +- **Reparty/Auto reparty** (Disbands and reinvites all members of the party.) +- **Disable Ability Messages** (Prevents messages such as *you were hit for X Damage* showing in chat.) +- **Spirit Bear Summon Percentage** (Shows how close the spirit bear is to spawning.) +- **Low-Health Warning** (Shows a player name and health if they have less than 500 hp left. +- **Custom Party Finder GUI** (A nicer party finder gui.) + +### Statistics Related Features +- **View Room Name** (Shows the name of your current room in a dungeon.) +- **Party Profile Viewer** (Hover over the view button in chat to view a persons armour, total secrets, lily weight, talismans and additional configurable statistics.) +- **Profit Calculator** (Shows how much you will profit/lose my opening a dungeons chest.) +- **Price Viewer** (Shows the BIN and AH price of an item.) +- **See Boss Health** (Allows you to see the health of most bosses in dungeons, including mini-bosses such as guardians and giants.) +- **Dungeon Items Stats** (Shows what floor the item originated from and what quality the item is (percentage).) +- **Real-Time Indicator** (Shows how much time has passed since starting the dungeon.) +- **In-Game Time Indicator** (Shows how much time Hypixel thinks has passed since starting the dungeon.) +- **Dungeon Cooldown Indicator** (Counts 20 seconds since you left the dungeon.) +- **Dungeon Death Indicator** (Shows who died and how many times, also shows the total number of deaths.) +- **Dungeon Score Pre-Calculator** (Pre-calculates dungeon score then shows how many secrets need to be found to progress to the next rank (i.e S -> S+).) +- **Obtained Secret Indicator** (Shows how many secrets have been found and exist in the current dungeon. Shown as found secrets/total secrets.) +- **Broken Crypts Indicator** (Same as what Tab-list shows, but without pressing the tab.) +- **Current Milestone Indicator** (Shows the current milestone you have achieved.) + +### Assorted Other Features +- **Discord Rich Presence** (Shows basic information in DRP. Supports ask to join.) + +## Bannable +Features such as **Secret Finder** are allowed under Hypixel rules as the waypoints are based on a static set of coordinates from a corner of the room a player is in. This is similar to fairy soul waypoints (which Simon has confirmed are allowed) since it is not scanning for the secrets but rather displaying a waypoint over a set coordinate. Dungeon Guide itself has been confirmed allowed on hypixel by an [admin](https://media.discordapp.net/attachments/781913473872560194/867454697387065354/image0.png) diff --git a/build.gradle b/build.gradle index 83f62df1..7252969e 100755..100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,147 @@ + +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +plugins { + id "idea" + id "java" + id "com.github.johnrengelman.shadow" version "7.1.2" + id "dev.architectury.architectury-pack200" version "0.1.3" + id "gg.essential.loom" version "0.10.0.+" +} + tasks.wrapper { gradleVersion = "7.4" // You can either download the binary-only version of Gradle (BIN) or // the full version (with sources and documentation) of Gradle (ALL) distributionType = Wrapper.DistributionType.ALL +} +version = "3.8.0" +group = "kr.syeyoung.dungeonsguide" +archivesBaseName = "dungeonsguide" + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(8)) +} + +loom { + launchConfigs { + client { + } + } + runs { + "client" { + property('devauth.enabled','true') + client() + } + } + forge { + pack200Provider.set(new dev.architectury.pack200.java.Pack200Adapter()) + } +} + + +sourceSets.main { + output.setResourcesDir(file("$buildDir/classes/java/main")) +} + + +repositories { + mavenCentral() + maven { url "https://jitpack.io" } + maven {url "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1"} +} + +configurations { + implementation.extendsFrom shadowImpl +} + + +dependencies { + minecraft("com.mojang:minecraft:1.8.9") + mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9") + forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9") + + + implementation 'org.jetbrains:annotations-java5:23.0.0' + implementation 'org.java-websocket:Java-WebSocket:1.5.3' + implementation "org.json:json:20220924" + implementation 'com.twelvemonkeys.imageio:imageio-bmp:3.8.3' + + compileOnly 'org.projectlombok:lombok:1.18.24' + annotationProcessor 'org.projectlombok:lombok:1.18.24' + + compileOnly files("jars/Hychat-1.12.1-BETA.jar") + + testCompileOnly "org.projectlombok:lombok:1.18.24" + testAnnotationProcessor "org.projectlombok:lombok:1.18.24" + modRuntimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0") +} + +tasks.withType(JavaCompile) { + options.encoding = "UTF-8" +} + +tasks.withType(Jar) { + archivesBaseName = "dungeonsguide" + manifest { + attributes["FMLCorePluginContainsFMLMod"] = "true" + attributes["ForceLoadAsMod"] = "true" + + // If you don't want mixins, remove these lines +// this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker" +// this["MixinConfigs"] = "mixins.examplemod.json" + } +} + + +tasks.shadowJar { + + archiveFileName = jar.archiveFileName + + relocate "org.java_websocket", "kr.syeyoung.org.java_websocket" + + dependencies { + include(dependency("org.java-websocket:Java-WebSocket:1.5.3")) + include(dependency("org.slf4j:slf4j-api:1.7.25")) + include(dependency("org.json:json:20220924")) + include(dependency("com.twelvemonkeys..*:.*")) + } +} + +tasks.named("remapJar") { + archiveClassifier = "all" + from(tasks.shadowJar) + input = tasks.shadowJar.archiveFile +} + + +tasks.assemble.dependsOn tasks.remapJar + +processResources { + inputs.property 'version', project.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + duplicatesStrategy = 'include' + include 'mcmod.info' + + // replace version and mcversion + expand 'version': project.version + } }
\ No newline at end of file diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java index 7cc0f806..921adca9 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java @@ -61,7 +61,7 @@ public class Main private static Main main; - private File configDir; + private static File configDir; private DGInterface dgInterface; private Authenticator authenticator = new Authenticator(); @@ -69,6 +69,10 @@ public class Main private List<DungeonsGuideReloadListener> listeners = new ArrayList<>(); + public static File getConfigDir() { + return configDir; + } + public void addDGReloadListener(DungeonsGuideReloadListener dungeonsGuideReloadListener) { listeners.add(Objects.requireNonNull(dungeonsGuideReloadListener)); } @@ -111,7 +115,7 @@ public class Main listener.unloadReference(); } if (currentLoader != null) { - currentLoader.unloadJar(); + currentLoader.unloadDungeonsGuide(); } currentLoader = null; } @@ -126,8 +130,7 @@ public class Main } private void partialLoad(IDGLoader newLoader) throws ClassNotFoundException, InstantiationException, IllegalAccessException { if (dgInterface != null) throw new IllegalStateException("DG is loaded"); - newLoader.loadJar(authenticator); - dgInterface = newLoader.getInstance(); + dgInterface = newLoader.loadDungeonsGuide(); currentLoader = newLoader; } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java new file mode 100644 index 00000000..23d9cf06 --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthManager.java @@ -0,0 +1,140 @@ +package kr.syeyoung.dungeonsguide.launcher.auth; + +import com.google.common.base.Throwables; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.google.gson.JsonObject; +import com.mojang.authlib.exceptions.AuthenticationException; +import kr.syeyoung.dungeonsguide.launcher.auth.authprovider.AuthProvider; +import kr.syeyoung.dungeonsguide.launcher.auth.authprovider.DgAuth.DgAuth; +import kr.syeyoung.dungeonsguide.launcher.auth.authprovider.DgAuth.DgAuthUtil; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.events.impl.AuthChangedEvent; +import kr.syeyoung.dungeonsguide.mod.stomp.StompManager; +import lombok.Setter; +import net.minecraft.client.Minecraft; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.IOException; +import java.security.KeyPair; +import java.security.NoSuchAlgorithmException; +import java.util.Objects; +import java.util.concurrent.*; + + +public class AuthManager { + Logger logger = LogManager.getLogger("AuthManger"); + + private static AuthManager INSTANCE; + + public static AuthManager getInstance() { + if(INSTANCE == null) INSTANCE = new AuthManager(); + return INSTANCE; + } + + @Setter + private String baseserverurl = "https://dungeons.guide"; + + private AuthToken currentToken = new NullToken(); + + public String getToken() { + return currentToken.getToken(); + } + + + public KeyPair getKeyPair(){ + return currentToken.getRSAKeyForAuth(); + } + + + private volatile boolean initlock = false; + + public void init() { + if (initlock) { + logger.info("Cannot init AuthManger twice"); + return; + } + + reauth(); + + initlock = true; + + + MinecraftForge.EVENT_BUS.register(this); + + ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("DgAuth Pool").build(); + final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1, namedThreadFactory); + scheduler.scheduleAtFixedRate(() -> { + if (getToken() != null) { + JsonObject obj = DgAuthUtil.getJwtPayload(getToken()); + if (!obj.get("uuid").getAsString().replace("-", "").equals(Minecraft.getMinecraft().getSession().getPlayerID())) { + shouldReAuth = true; + } + } + + + }, 10,2000, TimeUnit.MILLISECONDS); + } + + boolean shouldReAuth = true; + int tickCounter; + + @SubscribeEvent + public void onTickClientTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + if (tickCounter % 200 == 0) { + tickCounter = 0; + reauth(); + } + tickCounter++; + } + + public boolean isPlebUser(){ + return Objects.equals(getInstance().getPlanType(), "OPENSOURCE"); + } + + public String getPlanType(){ + if(getToken() == null) return null; + + + JsonObject jwt = DgAuthUtil.getJwtPayload(getToken()); + + if(!jwt.has("plan")) return null; + + return jwt.get("plan").getAsString(); + + } + + void reauth() { + if (!shouldReAuth) return; + shouldReAuth = false; + currentToken = new NullToken(); + try { + currentProvider = new DgAuth(baseserverurl).createAuthProvider(); + if (currentProvider.getToken() == null) { + shouldReAuth = true; + currentProvider = null; + ChatTransmitter.addToQueue("§eDungeons Guide §7:: §r§cDG auth failed, trying again in ten seconds", true); + logger.info("DG auth failed, trying again in a second"); + } else { + // RE-AUTHed SUCCESSFULLY HOORAY + // for some reason the forge events don't work in pre init, so I call the callback directly + StompManager.getInstance().init(); + MinecraftForge.EVENT_BUS.post(new AuthChangedEvent()); + } + } catch (NoSuchAlgorithmException | AuthenticationException | IOException e) { + + shouldReAuth = true; + currentProvider = null; + ChatTransmitter.addToQueue("§eDungeons Guide §7:: §r§cDG auth failed, trying again in ten seconds", true); + logger.error("Re-auth failed with message {}, trying again in a ten seconds", String.valueOf(Throwables.getRootCause(e))); + } + + } + + +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthToken.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthToken.java new file mode 100644 index 00000000..cb7c03da --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthToken.java @@ -0,0 +1,17 @@ +package kr.syeyoung.dungeonsguide.launcher.auth; + +import java.security.KeyPair; +import java.security.interfaces.RSAKey; +import java.time.Instant; + +public interface AuthToken { + boolean isUserVerified(); + boolean hasFullCapability(); + boolean isAuthenticated(); + + Instant getExpiryInstant(); + + KeyPair getRSAKeyForAuth(); + + String getToken(); +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthUtil.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthUtil.java new file mode 100644 index 00000000..9ce02643 --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/AuthUtil.java @@ -0,0 +1,70 @@ +package kr.syeyoung.dungeonsguide.launcher.auth; + +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; + +import javax.crypto.*; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import javax.net.ssl.HttpsURLConnection; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.security.*; + +public class AuthUtil { + private AuthUtil() {} + + public static KeyPair getKeyPair() throws NoSuchAlgorithmException { + KeyPairGenerator a = null; + a = KeyPairGenerator.getInstance("RSA"); + a.initialize(1024); + return a.generateKeyPair(); + } + + + public static JsonElement getJsonSecured(String u) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException{ + + int length = 0; + CipherInputStream cipherInputStream = null; + + HttpsURLConnection httpsURLConnection = (HttpsURLConnection) new URL(u).openConnection(); + httpsURLConnection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); + httpsURLConnection.setRequestProperty("Content-Type", "application/json"); + httpsURLConnection.setRequestMethod("GET"); + httpsURLConnection.setRequestProperty("Authorization", AuthManager.getInstance().getToken()); + httpsURLConnection.setDoInput(true); + httpsURLConnection.setDoOutput(true); + + InputStream inputStream = httpsURLConnection.getInputStream(); + byte[] lengthPayload = new byte[4]; + inputStream.read(lengthPayload); + length = ((lengthPayload[0] & 0xFF) << 24) | + ((lengthPayload[1] & 0xFF) << 16) | + ((lengthPayload[2] & 0xFF) << 8) | + ((lengthPayload[3] & 0xFF)); + while (inputStream.available() < length) ; + byte[] keyPayload = new byte[length]; + inputStream.read(keyPayload); + + Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); + cipher.init(Cipher.DECRYPT_MODE, AuthManager.getInstance().getKeyPair().getPrivate()); + byte[] AESKey = cipher.doFinal(keyPayload); + + cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec secretKeySpec = new SecretKeySpec(AESKey, "AES"); + IvParameterSpec ivParameterSpec = new IvParameterSpec(AESKey); + cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec); + cipherInputStream = new CipherInputStream(inputStream, cipher); + cipherInputStream.read(lengthPayload); + length = ((lengthPayload[0] & 0xFF) << 24) | + ((lengthPayload[1] & 0xFF) << 16) | + ((lengthPayload[2] & 0xFF) << 8) | + ((lengthPayload[3] & 0xFF)); + + httpsURLConnection.disconnect(); + + return new JsonParser().parse(new InputStreamReader(cipherInputStream)); + } +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/InvalidDungeonsGuideCredentialsException.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/InvalidDungeonsGuideCredentialsException.java new file mode 100644 index 00000000..ebe78196 --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/InvalidDungeonsGuideCredentialsException.java @@ -0,0 +1,8 @@ +package kr.syeyoung.dungeonsguide.launcher.auth; + +public class InvalidDungeonsGuideCredentialsException extends Throwable { + + public InvalidDungeonsGuideCredentialsException(String message) { + super(message); + } +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/NullToken.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/NullToken.java new file mode 100644 index 00000000..ddbfe58f --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/NullToken.java @@ -0,0 +1,36 @@ +package kr.syeyoung.dungeonsguide.launcher.auth; + +import java.security.KeyPair; +import java.time.Instant; + +public class NullToken implements AuthToken { + @Override + public boolean isUserVerified() { + return false; + } + + @Override + public boolean hasFullCapability() { + return false; + } + + @Override + public boolean isAuthenticated() { + return false; + } + + @Override + public Instant getExpiryInstant() { + return Instant.MIN; + } + + @Override + public KeyPair getRSAKeyForAuth() { + return null; + } + + @Override + public String getToken() { + return null; + } +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/ResourceManager.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/ResourceManager.java new file mode 100644 index 00000000..721b629f --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/ResourceManager.java @@ -0,0 +1,164 @@ +package kr.syeyoung.dungeonsguide.launcher.auth; + +import lombok.Setter; +import net.minecraftforge.common.MinecraftForge; +import org.apache.commons.codec.binary.Base64; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import javax.crypto.*; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import javax.net.ssl.HttpsURLConnection; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.security.*; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.X509EncodedKeySpec; +import java.util.HashMap; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +public class ResourceManager { + + Logger logger = LogManager.getLogger("ResourceManager"); + + @Setter + private String baseUrl; + @Setter + private String BASE64_X509ENCODEDKEYSPEC; + private final HashMap<String, byte[]> loadedResources = new HashMap<>(); + + + private static ResourceManager instance; + public static ResourceManager getInstance() { + if(instance == null) { + instance = new ResourceManager(); + MinecraftForge.EVENT_BUS.register(instance); + } + return instance; + } + + private ResourceManager() { + } + + public Map<String, byte[]> getResources() { + return loadedResources; + } + + + public void downloadAssets(String version) throws InvalidDungeonsGuideCredentialsException { + if(AuthManager.getInstance().getToken() == null) throw new InvalidDungeonsGuideCredentialsException("Not Authenticated while downloading assets"); + try { + // version not being null indicates that the user is "premium" + // so we download the special version + if (version != null) + downloadSafe( baseUrl + "/resource/version?v=" + version, true); + + if(!AuthManager.getInstance().isPlebUser()){ + downloadSafe(baseUrl + "/resource/roomdata", false); + } else { + logger.error("The current User is a pleb not downloading user data"); + } + + } catch (Exception t) { + t.printStackTrace(); + } + + } + + private void downloadSafe(String url, boolean isValidateSignature) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, SignatureException, InvalidKeySpecException { + HttpsURLConnection dgConnection = (HttpsURLConnection) new URL(url).openConnection(); + dgConnection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); + dgConnection.setRequestProperty("Content-Type", "application/json"); + dgConnection.setRequestMethod("GET"); + dgConnection.setRequestProperty("Authorization", AuthManager.getInstance().getToken()); + dgConnection.setDoInput(true); + dgConnection.setDoOutput(true); + + InputStream inputStream = dgConnection.getInputStream(); + byte[] lengthBytes = new byte[4]; + inputStream.read(lengthBytes); + int length = ((lengthBytes[0] & 0xFF) << 24) | + ((lengthBytes[1] & 0xFF) << 16) | + ((lengthBytes[2] & 0xFF) << 8) | + ((lengthBytes[3] & 0xFF)); + while (inputStream.available() < length) ; + byte[] keyPayload = new byte[length]; + inputStream.read(keyPayload); + + Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); + cipher.init(Cipher.DECRYPT_MODE, AuthManager.getInstance().getKeyPair().getPrivate()); + byte[] h = cipher.doFinal(keyPayload); + + cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec keySpec = new SecretKeySpec(h, "AES"); + IvParameterSpec ivSpec = new IvParameterSpec(h); + cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); + CipherInputStream cipherInputStream = new CipherInputStream(inputStream, cipher); + + cipherInputStream.read(lengthBytes); + length = ((lengthBytes[0] & 0xFF) << 24) | + ((lengthBytes[1] & 0xFF) << 16) | + ((lengthBytes[2] & 0xFF) << 8) | + ((lengthBytes[3] & 0xFF)); + + int totalLen = length; + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + byte[] buff = new byte[256]; + while (totalLen > 0) { + int len = cipherInputStream.read(buff, 0, Math.min(buff.length, totalLen)); + totalLen -= len; + bos.write(buff, 0, len); + } + byte[] body = bos.toByteArray(); + + byte[] signed; + if (isValidateSignature) { + cipherInputStream.read(lengthBytes,0 , 4); + length = ((lengthBytes[0] & 0xFF) << 24) | + ((lengthBytes[1] & 0xFF) << 16) | + ((lengthBytes[2] & 0xFF) << 8) | + ((lengthBytes[3] & 0xFF)); + + totalLen = length; + bos = new ByteArrayOutputStream(); + while (totalLen > 0) { + int len = cipherInputStream.read(buff, 0, Math.min(buff.length, totalLen)); + totalLen -= len; + bos.write(buff, 0, len); + } + signed = bos.toByteArray(); + + Signature sign = Signature.getInstance("SHA512withRSA"); + sign.initVerify(getPublicKey(BASE64_X509ENCODEDKEYSPEC)); + sign.update(body); + boolean truth = sign.verify(signed); + if (!truth) throw new SignatureException("DG SIGNATURE FORGED"); + } + + ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(body)); + ZipEntry zipEntry; + while ((zipEntry=zipInputStream.getNextEntry()) != null) { + byte[] buffer = new byte[256]; + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + int p; + while((p = zipInputStream.read(buffer)) > 0) { + byteArrayOutputStream.write(buffer, 0, p); + } + this.loadedResources.put(zipEntry.getName(), byteArrayOutputStream.toByteArray()); + } + } + + + public static PublicKey getPublicKey(String base64X509EncodedKeySpec) throws NoSuchAlgorithmException, InvalidKeySpecException { + X509EncodedKeySpec spec = new X509EncodedKeySpec(Base64.decodeBase64(base64X509EncodedKeySpec)); + + return KeyFactory.getInstance("RSA").generatePublic(spec); + } + +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/AuthProvider.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/AuthProvider.java new file mode 100644 index 00000000..d469c729 --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/AuthProvider.java @@ -0,0 +1,16 @@ +package kr.syeyoung.dungeonsguide.launcher.auth.authprovider; + +import com.mojang.authlib.exceptions.AuthenticationException; + +import java.io.IOException; +import java.security.KeyPair; +import java.security.NoSuchAlgorithmException; + +public interface AuthProvider { + String getToken(); + + KeyPair getRsaKey(); + + + AuthProvider createAuthProvider() throws NoSuchAlgorithmException, AuthenticationException, IOException; +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/DgAuth/DgAuth.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/DgAuth/DgAuth.java new file mode 100644 index 00000000..dca9ce33 --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/DgAuth/DgAuth.java @@ -0,0 +1,46 @@ +package kr.syeyoung.dungeonsguide.launcher.auth.authprovider.DgAuth; + +import com.mojang.authlib.exceptions.AuthenticationException; +import kr.syeyoung.dungeonsguide.launcher.auth.AuthUtil; +import kr.syeyoung.dungeonsguide.launcher.auth.authprovider.AuthProvider; + +import java.io.IOException; +import java.security.KeyPair; +import java.security.NoSuchAlgorithmException; + +public class DgAuth implements AuthProvider { + + private final String authServerUrl; + + public DgAuth(String authServerUrl){ + this.authServerUrl = authServerUrl; + } + + private String token; + private KeyPair rsaKey; + + @Override + public String getToken() { + return token; + } + + @Override + public KeyPair getRsaKey() { + return rsaKey; + } + + + @Override + public AuthProvider createAuthProvider() throws NoSuchAlgorithmException, AuthenticationException, IOException { + this.rsaKey = AuthUtil.getKeyPair(); + + String tempToken = DgAuthUtil.requestAuth(this.authServerUrl); + + DgAuthUtil.checkSessionAuthenticity(tempToken); + + this.token = DgAuthUtil.verifyAuth(tempToken, rsaKey.getPublic(), authServerUrl); + + return this; + } + +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/DgAuth/DgAuthUtil.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/DgAuth/DgAuthUtil.java new file mode 100644 index 00000000..53b57e1a --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/DgAuth/DgAuthUtil.java @@ -0,0 +1,88 @@ +package kr.syeyoung.dungeonsguide.launcher.auth.authprovider.DgAuth; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.exceptions.AuthenticationException; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Session; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.io.IOUtils; + +import javax.net.ssl.HttpsURLConnection; +import java.io.IOException; +import java.math.BigInteger; +import java.net.URL; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.PublicKey; + +public class DgAuthUtil { + private DgAuthUtil(){} + + public static String requestAuth(String baseurl) throws IOException { + GameProfile profile = Minecraft.getMinecraft().getSession().getProfile(); + + HttpsURLConnection connection = (HttpsURLConnection) new URL(baseurl + "/auth/requestAuth").openConnection(); + connection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); + connection.setRequestProperty("Content-Type", "application/json"); + connection.setRequestMethod("POST"); + connection.setDoInput(true); + connection.setDoOutput(true); + + connection.getOutputStream().write(("{\"uuid\":\""+profile.getId().toString()+"\",\"nickname\":\""+profile.getName()+"\"}").getBytes()); + String payload = String.join("\n", IOUtils.readLines(connection.getErrorStream() == null ? connection.getInputStream() : connection.getErrorStream())); + + JsonObject json = (JsonObject) new JsonParser().parse(payload); + + if (!"ok".equals(json.get("status").getAsString())) { + return null; + } + return json.get("data").getAsString(); + } + + public static void checkSessionAuthenticity(String tempToken) throws NoSuchAlgorithmException, AuthenticationException { + JsonObject d = getJwtPayload(tempToken); + byte[] sharedSecret = Base64.decodeBase64(d.get("sharedSecret").getAsString()); + byte[] publicKey =Base64.decodeBase64(d.get("publicKey").getAsString()); + String hash = calculateServerHash(sharedSecret, publicKey); + + Session session = Minecraft.getMinecraft().getSession(); + MinecraftSessionService yggdrasilMinecraftSessionService = Minecraft.getMinecraft().getSessionService(); + yggdrasilMinecraftSessionService.joinServer(session.getProfile(), session.getToken(), hash); + } + + public static String verifyAuth(String tempToken, PublicKey clientKey, String baseurl) throws IOException { + HttpsURLConnection urlConnection = (HttpsURLConnection) new URL(baseurl + "/auth/authenticate").openConnection(); + urlConnection.setRequestMethod("POST"); + urlConnection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); + urlConnection.setRequestProperty("Content-Type", "application/json"); + urlConnection.setDoInput(true); + urlConnection.setDoOutput(true); + + urlConnection.getOutputStream().write(("{\"jwt\":\""+tempToken+"\",\"publicKey\":\""+Base64.encodeBase64URLSafeString(clientKey.getEncoded())+"\"}").getBytes()); + String payload = String.join("\n", IOUtils.readLines(urlConnection.getErrorStream() == null ? urlConnection.getInputStream() : urlConnection.getErrorStream())); + + JsonObject jsonObject = (JsonObject) new JsonParser().parse(payload); + if (!"ok".equals(jsonObject.get("status").getAsString())) { + return null; + } + return jsonObject.get("data").getAsString(); + } + + public static JsonObject getJwtPayload(String jwt) { + String midPart = jwt.split("\\.")[1].replace("+", "-").replace("/", "_"); + String base64Decode = new String(Base64.decodeBase64(midPart)); // padding + return (JsonObject) new JsonParser().parse(base64Decode); + } + + public static String calculateServerHash(byte[] a, byte[] b) throws NoSuchAlgorithmException { + MessageDigest c = MessageDigest.getInstance("SHA-1"); + c.update("".getBytes()); + c.update(a); + c.update(b); + byte[] d = c.digest(); + return new BigInteger(d).toString(16); + } +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/NullAuth.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/NullAuth.java new file mode 100644 index 00000000..303cfb0a --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/auth/authprovider/NullAuth.java @@ -0,0 +1,62 @@ +package kr.syeyoung.dungeonsguide.launcher.auth.authprovider; + +import com.mojang.authlib.exceptions.AuthenticationException; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.IOException; +import java.security.KeyPair; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.PublicKey; + +public class NullAuth implements AuthProvider { + + Logger logger = LogManager.getLogger("NullAuth"); + + @Override + public String getToken() { + return "TOKEN"; + } + + @Override + public KeyPair getRsaKey() { + return new KeyPair(new PublicKey() { + @Override + public String getAlgorithm() { + return null; + } + + @Override + public String getFormat() { + return null; + } + + @Override + public byte[] getEncoded() { + return new byte[0]; + } + }, new PrivateKey() { + @Override + public String getAlgorithm() { + return null; + } + + @Override + public String getFormat() { + return null; + } + + @Override + public byte[] getEncoded() { + return new byte[0]; + } + }); + } + + @Override + public AuthProvider createAuthProvider() throws NoSuchAlgorithmException, AuthenticationException, IOException { + return new NullAuth(); + } + +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java deleted file mode 100755 index ac30c5e3..00000000 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.launcher.authentication; - -import com.mojang.authlib.exceptions.AuthenticationException; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import kr.syeyoung.dungeonsguide.launcher.Main; -import kr.syeyoung.dungeonsguide.launcher.exceptions.AuthServerException; -import kr.syeyoung.dungeonsguide.launcher.exceptions.PrivacyPolicyRequiredException; -import kr.syeyoung.dungeonsguide.launcher.exceptions.TokenExpiredException; -import lombok.Getter; -import net.minecraft.client.Minecraft; -import net.minecraft.util.Session; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.IOUtils; -import org.json.JSONObject; -import sun.reflect.Reflection; - -import javax.crypto.*; -import java.io.*; -import java.math.BigInteger; -import java.net.*; -import java.security.*; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.X509EncodedKeySpec; -import java.time.Instant; -import java.util.UUID; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -public class Authenticator { - private String dgAccessToken; - @Getter - private TokenStatus tokenStatus = TokenStatus.UNAUTHENTICATED; - - private final SecureRandom secureRandom = new SecureRandom(); - - private Lock authenticationLock = new ReentrantLock(); - - static { - Reflection.registerFieldsToFilter(Authenticator.class, "dgAccessToken"); // Please do not touch this field. I know there is a way to block it completely, but I won't do it here. - } - - public String getRawToken() { - return dgAccessToken; - } - public String getUnexpiredToken() { // THIS METHOD MAY BLOCK. - if (tokenStatus != TokenStatus.AUTHENTICATED) throw new IllegalStateException("Token is not available"); - long expiry = getJwtPayload(dgAccessToken).getLong("exp"); - if (System.currentTimeMillis() >= expiry-2000 || tokenStatus == TokenStatus.EXPIRED) { - tokenStatus = TokenStatus.EXPIRED; - try { - repeatAuthenticate(5); - } catch (Throwable t) { - Main.getMain().setLastFatalError(t); - throw new TokenExpiredException(t); - } - } - return dgAccessToken; - } - - - private byte[] generateSharedSecret() { - byte[] bts = new byte[32]; - secureRandom.nextBytes(bts); - return bts; - } - - public String repeatAuthenticate(int tries) { - int cnt = 0; - while(true) { - try { - reauthenticate(); - break; - } catch (IOException | AuthenticationException | NoSuchAlgorithmException e) { - e.printStackTrace(); - if (cnt == tries) throw new RuntimeException(e); - try { - Thread.sleep((long) Math.max(Math.pow(2, tries)* 100, 1000 * 10)); - } catch (InterruptedException ex) {} - } - cnt++; - } - return dgAccessToken; - } - public String reauthenticate() throws IOException, AuthenticationException, NoSuchAlgorithmException { - try { - authenticationLock.lock(); - - tokenStatus = TokenStatus.UNAUTHENTICATED; - dgAccessToken = null; - - MinecraftSessionService yggdrasilMinecraftSessionService = Minecraft.getMinecraft().getSessionService(); - - Session SECURE_USER_SESSION = Minecraft.getMinecraft().getSession(); - dgAccessToken = requestAuth(SECURE_USER_SESSION.getProfile().getId(), SECURE_USER_SESSION.getProfile().getName()); // id: uuid, name: username - - JSONObject d = getJwtPayload(dgAccessToken); - byte[] sharedSecret = generateSharedSecret(); // Notice.... shared secret is generated on the client side unlike dg 3.0. Yep, I was a stupid when making 3.0. - - String hash = calculateServerHash(sharedSecret, Base64.decodeBase64(d.getString("publicKey"))); // Public Key here is server's public key. - - byte[] encodedSharedSecret; - try { - Cipher cipher = Cipher.getInstance("RSA"); - cipher.init(Cipher.ENCRYPT_MODE, KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(Base64.decodeBase64(d.getString("publicKey"))))); - encodedSharedSecret = cipher.doFinal(sharedSecret); - } catch (NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException | - InvalidKeySpecException | - InvalidKeyException e) { - throw new RuntimeException(e); - } // Server connection is SSL but I still encrypt it using publicKey. Additional layer of security considering the request goes through cloudflare. (it's not like I don't trust cloudflare, but idk) - - yggdrasilMinecraftSessionService.joinServer(SECURE_USER_SESSION.getProfile(), SECURE_USER_SESSION.getToken(), hash); // Sent to "MOJANG" Server. - - JSONObject furtherStuff = verifyAuth(dgAccessToken, encodedSharedSecret); - - dgAccessToken = furtherStuff.getString("jwt"); - if ("TOS_PRIVACY_POLICY_ACCEPT_REQUIRED".equals(furtherStuff.getString("result"))) { - tokenStatus = TokenStatus.PP_REQUIRED; - throw new PrivacyPolicyRequiredException(); - } - tokenStatus = TokenStatus.AUTHENTICATED; - return this.dgAccessToken; - } finally { - authenticationLock.unlock(); - } - } - - public String acceptLatestTOS() throws IOException { - try { - authenticationLock.lock(); - if (tokenStatus != TokenStatus.PP_REQUIRED) throw new IllegalStateException("Already accepted TOS"); - JSONObject furtherStuff = acceptPrivacyPolicy(dgAccessToken); - dgAccessToken = furtherStuff.getString("jwt"); - if ("TOS_PRIVACY_POLICY_ACCEPT_REQUIRED".equals(furtherStuff.getString("result"))) { - tokenStatus = TokenStatus.PP_REQUIRED; - throw new PrivacyPolicyRequiredException(); - } - tokenStatus = TokenStatus.AUTHENTICATED; - return this.dgAccessToken; - } finally { - authenticationLock.unlock(); - } - } - - public JSONObject getJwtPayload(String jwt) { - String midPart = jwt.split("\\.")[1].replace("+", "-").replace("/", "_"); - String base64Decode = new String(Base64.decodeBase64(midPart)); // padding - return new JSONObject(base64Decode); - } - - private String requestAuth(UUID uuid, String nickname) throws IOException { - HttpURLConnection urlConnection = request("POST", "/auth/v2/requestAuth"); - urlConnection.setRequestProperty("Content-Type", "application/json"); - - urlConnection.getOutputStream().write(("{\"uuid\":\""+uuid.toString()+"\",\"nickname\":\""+nickname+"\"}").getBytes()); - try (InputStream is = obtainInputStream(urlConnection)) { - String payload = String.join("\n", IOUtils.readLines(is)); - if (urlConnection.getResponseCode() != 200) - System.out.println("/auth/requestAuth :: Received " + urlConnection.getResponseCode() + " along with\n" + payload); - - JSONObject json = new JSONObject(payload); - - if ("Success".equals(json.getString("status"))) { - return json.getString("data"); - } else { - throw new AuthServerException(json); - } - } - } - private JSONObject verifyAuth(String tempToken, byte[] encryptedSecret) throws IOException { - HttpURLConnection urlConnection = request("POST", "/auth/v2/authenticate"); - urlConnection.setRequestProperty("Content-Type", "application/json"); - - urlConnection.getOutputStream().write(("{\"jwt\":\""+tempToken+"\",\"sharedSecret\":\""+Base64.encodeBase64String(encryptedSecret)+"\"}").getBytes()); - try (InputStream is = obtainInputStream(urlConnection)) { - String payload = String.join("\n", IOUtils.readLines(is)); - if (urlConnection.getResponseCode() != 200) - System.out.println("/auth/authenticate :: Received " + urlConnection.getResponseCode() + " along with\n" + payload); - - JSONObject json = new JSONObject(payload); - - if ("Success".equals(json.getString("status"))) { - return json.getJSONObject("data"); - } else { - throw new AuthServerException(json); - } - } - } - private JSONObject acceptPrivacyPolicy(String tempToken) throws IOException { - HttpURLConnection urlConnection = request("POST", "/auth/v2/acceptPrivacyPolicy"); - - urlConnection.getOutputStream().write(tempToken.getBytes()); - try (InputStream is = obtainInputStream(urlConnection)) { - String payload = String.join("\n", IOUtils.readLines(is)); - if (urlConnection.getResponseCode() != 200) - System.out.println("/auth/authenticate :: Received " + urlConnection.getResponseCode() + " along with\n" + payload); - - JSONObject json = new JSONObject(payload); - - if ("Success".equals(json.getString("status"))) { - return json.getJSONObject("data"); - } else { - throw new AuthServerException(json); - } - } - } - - - private String calculateServerHash(byte[] a, byte[] b) throws NoSuchAlgorithmException { - MessageDigest c = MessageDigest.getInstance("SHA-1"); - c.update("".getBytes()); - c.update(a); - c.update(b); - byte[] d = c.digest(); - return new BigInteger(d).toString(16); - } - - public InputStream obtainInputStream(HttpURLConnection huc) { - InputStream inputStream = null; - try { - inputStream = huc.getInputStream(); - } catch (Exception e) { - inputStream = huc.getErrorStream(); - } - return inputStream; - } - - public HttpURLConnection request(String method, String url) throws IOException { - HttpURLConnection urlConnection = (HttpURLConnection) new URL(Main.DOMAIN+url).openConnection(); - urlConnection.setRequestMethod(method); // TODO: setup SSL certificate here, because.... SOME PEOPLE HAVE THAT ISSUE, I HAVE NO IDEA WHY THEY DONT HAVE CLOUDFLARE CERTS INSTALLED ON THEM - urlConnection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); - urlConnection.setDoInput(true); - urlConnection.setDoOutput(true); - urlConnection.setAllowUserInteraction(true); - if (tokenStatus == TokenStatus.AUTHENTICATED) - urlConnection.setRequestProperty("Authorization", "Bearer "+getUnexpiredToken()); - return urlConnection; - } -} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/TokenStatus.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/TokenStatus.java deleted file mode 100644 index a83818b8..00000000 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/TokenStatus.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.launcher.authentication; - -public enum TokenStatus { - UNAUTHENTICATED, - BANNED, - PP_REQUIRED, - AUTHENTICATED, - EXPIRED -} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/branch/ModDownloader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/branch/ModDownloader.java deleted file mode 100644 index 45eacee5..00000000 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/branch/ModDownloader.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.launcher.branch; - -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; -import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; -import lombok.Getter; -import net.minecraftforge.fml.common.ProgressManager; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.IOUtils; -import org.json.JSONArray; -import org.json.JSONObject; - -import javax.crypto.*; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; -import javax.net.ssl.HttpsURLConnection; -import java.io.*; -import java.net.HttpURLConnection; -import java.net.URL; -import java.security.*; -import java.security.cert.CertificateException; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.X509EncodedKeySpec; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -public class ModDownloader { - private Authenticator authenticator; - - @Getter - private List<UpdateBranch> accessibleBranches = null; - - public ModDownloader(Authenticator authenticator) { - this.authenticator = authenticator; - } - - public List<UpdateBranch> fetchAccessibleBranches() throws IOException { - HttpURLConnection urlConnection = authenticator.request("GET", "/updates/"); - try (InputStream is = authenticator.obtainInputStream(urlConnection)) { - String payload = String.join("\n", IOUtils.readLines(is)); - - JSONArray jsonArray = new JSONArray(payload); - List<UpdateBranch> branches = new ArrayList<>(); - for (Object o : jsonArray) { - if (o instanceof JSONObject) { - JSONObject branch = (JSONObject) o; - UpdateBranch updateBranch = new UpdateBranch(); - updateBranch.setId(branch.getLong("id")); - updateBranch.setName(branch.getString("name")); - updateBranch.setMetadata(branch.getJSONObject("metadata").getJSONObject("metadataSchema")); - branches.add(updateBranch); - } - } - return this.accessibleBranches = branches; - } - } - - public List<Update> fetchUpdates(Long branch, int page) throws IOException { - HttpURLConnection urlConnection = authenticator.request("GET", "/updates/"+branch+"/"); - try (InputStream is = authenticator.obtainInputStream(urlConnection)) { - String payload = String.join("\n", IOUtils.readLines(is)); - - JSONArray jsonArray = new JSONArray(payload); - List<Update> updates = new ArrayList<>(); - for (Object o : jsonArray) { - if (o instanceof JSONObject) { - JSONObject json = (JSONObject) o; - Update update = new Update(); - update.setId(json.getLong("id")); - update.setBranchId(json.getLong("branchId")); - update.setName(json.getString("versionName")); - update.setUpdateLog(json.getString("updateLog")); - update.setMetadata(json.getJSONObject("metadata")); - for (Object assets : json.getJSONObject("assets").getJSONArray("assets")) { - if (assets instanceof JSONObject) { - JSONObject a_json = (JSONObject) assets; - Update.Asset asset = new Update.Asset(); - asset.setName(a_json.getString("name")); - asset.setSize(a_json.getLong("size")); - asset.setObjectId(a_json.getString("objectId")); - asset.setAssetId(UUID.fromString(a_json.getString("assetID"))); - update.getAssets().add(asset); - } - } - updates.add(update); - } - } - return updates; - } - } - - /* - pls Close after done - */ - public InputStream fetchAsset(Update update, UUID assetId) throws IOException { - HttpURLConnection urlConnection = authenticator.request("GET", "/updates/"+update.getBranchId()+"/"+update.getId()+"/"+assetId.toString()); - try (InputStream is = authenticator.obtainInputStream(urlConnection)) { - String payload = String.join("\n", IOUtils.readLines(is)); - JSONObject object = new JSONObject(payload); - - HttpURLConnection connection = (HttpURLConnection) new URL(object.getString("url")).openConnection(); - connection.setRequestMethod(object.getString("method")); - urlConnection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); - urlConnection.setDoInput(true); - urlConnection.setDoOutput(true); - urlConnection.setAllowUserInteraction(true); - return authenticator.obtainInputStream(connection); - } - } - - - - - - - private ProgressManager.ProgressBar progressBar; - - private PublicKey dgPublicKey; - private PublicKey getDGPublicKey() throws NoSuchAlgorithmException, InvalidKeySpecException { - if (dgPublicKey != null) return dgPublicKey; - X509EncodedKeySpec spec = new X509EncodedKeySpec(Base64.decodeBase64("MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxO89qtwG67jNucQ9Y44c" + - "IUs/B+5BeJPs7G+RG2gfs4/2+tzF/c1FLDc33M7yKw8aKk99vsBUY9Oo8gxxiEPB" + - "JitP/qfon2THp94oM77ZTpHlmFoqbZMcKGZVI8yfvEL4laTM8Hw+qh5poQwtpEbK" + - "Xo47AkxygxJasUnykER2+aSTZ6kWU2D4xiNtFA6lzqN+/oA+NaYfPS0amAvyVlHR" + - "n/8IuGkxb5RrlqVssQstFnxsJuv88qdGSEqlcKq2tLeg9hb8eCnl2OFzvXmgbVER" + - "0JaV+4Z02fVG1IlR3Xo1mSit7yIU6++3usRCjx2yfXpnGGJUW5pe6YETjNew3ax+" + - "FAZ4GePWCdmS7FvBnbbABKo5pE06ZTfDUTCjQlAJQiUgoF6ntMJvQAXPu48Vr8q/" + - "mTcuZWVnI6CDgyE7nNq3WNoq3397sBzxRohMxuqzl3T19zkfPKF05iV2Ju1HQMW5" + - "I119bYrmVD240aGESZc20Sx/9g1BFpNzQbM5PGUlWJ0dhLjl2ge4ip2hHciY3OEY" + - "p2Qy2k+xEdenpKdL+WMRimCQoO9gWe2Tp4NmP5dppDXZgPjXqjZpnGs0Uxs+fXqW" + - "cwlg3MbX3rFl9so/fhVf4p9oXZK3ve7z5D6XSSDRYECvsKIa08WAxJ/U6n204E/4" + - "xUF+3ZgFPdzZGn2PU7SsnOsCAwEAAQ==")); - return dgPublicKey = KeyFactory.getInstance("RSA").generatePublic(spec); - } - - - - - private KeyPair rsaKey; - private KeyPair getKeyPair() { - KeyPairGenerator a = null; - try { - a = KeyPairGenerator.getInstance("RSA"); - } catch (NoSuchAlgorithmException b) { } - a.initialize(1024); - this.rsaKey = a.generateKeyPair(); - return this.rsaKey; - } - - - private final HashMap<String, byte[]> loadedResources = new HashMap<String, byte[]>(); - - public HashMap<String, byte[]> getResources() { - return loadedResources; - } - - private void downloadSafe(String dgToken, String url, boolean isValidateSignature) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, CertificateException, KeyStoreException, KeyManagementException, SignatureException, InvalidKeySpecException { - HttpsURLConnection dgConnection = (HttpsURLConnection) new URL(url).openConnection(); - dgConnection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); - dgConnection.setRequestProperty("Content-Type", "application/json"); - dgConnection.setRequestMethod("GET"); - dgConnection.setRequestProperty("Authorization", dgToken); - dgConnection.setDoInput(true); - dgConnection.setDoOutput(true); - - InputStream inputStream = dgConnection.getInputStream(); - byte[] lengthBytes = new byte[4]; - inputStream.read(lengthBytes); - int length = ((lengthBytes[0] & 0xFF) << 24) | - ((lengthBytes[1] & 0xFF) << 16) | - ((lengthBytes[2] & 0xFF) << 8) | - ((lengthBytes[3] & 0xFF)); - while (inputStream.available() < length) ; - byte[] keyPayload = new byte[length]; - inputStream.read(keyPayload); - - Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); - cipher.init(Cipher.DECRYPT_MODE, this.rsaKey.getPrivate()); - byte[] h = cipher.doFinal(keyPayload); - - cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - SecretKeySpec keySpec = new SecretKeySpec(h, "AES"); - IvParameterSpec ivSpec = new IvParameterSpec(h); - cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); - CipherInputStream cipherInputStream = new CipherInputStream(inputStream, cipher); - - cipherInputStream.read(lengthBytes); - length = ((lengthBytes[0] & 0xFF) << 24) | - ((lengthBytes[1] & 0xFF) << 16) | - ((lengthBytes[2] & 0xFF) << 8) | - ((lengthBytes[3] & 0xFF)); - - int totalLen = length; - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - byte[] buff = new byte[256]; - while (totalLen > 0) { - int len = cipherInputStream.read(buff, 0, Math.min(buff.length, totalLen)); - totalLen -= len; - bos.write(buff, 0, len); - } - byte[] body = bos.toByteArray(); - - byte[] signed = null; - if (isValidateSignature) { - progressBar.step("Validating Signature"); - cipherInputStream.read(lengthBytes,0 , 4); - length = ((lengthBytes[0] & 0xFF) << 24) | - ((lengthBytes[1] & 0xFF) << 16) | - ((lengthBytes[2] & 0xFF) << 8) | - ((lengthBytes[3] & 0xFF)); - - totalLen = length; - bos = new ByteArrayOutputStream(); - while (totalLen > 0) { - int len = cipherInputStream.read(buff, 0, Math.min(buff.length, totalLen)); - totalLen -= len; - bos.write(buff, 0, len); - } - signed = bos.toByteArray(); - - Signature sign = Signature.getInstance("SHA512withRSA"); - sign.initVerify(getDGPublicKey()); - sign.update(body); - boolean truth = sign.verify(signed); - if (!truth) throw new SignatureException("DG SIGNATURE FORGED"); - } - - ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(body)); - ZipEntry zipEntry; - while ((zipEntry=zipInputStream.getNextEntry()) != null) { - byte[] buffer = new byte[256]; - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - int p = 0; - while((p = zipInputStream.read(buffer)) > 0) { - byteArrayOutputStream.write(buffer, 0, p); - } - this.loadedResources.put(zipEntry.getName(), byteArrayOutputStream.toByteArray()); - } - dgConnection.disconnect(); - } - - public JsonElement getJsonSecured(String u) throws IOException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, InvalidAlgorithmParameterException, CertificateException, KeyStoreException, KeyManagementException { - HttpsURLConnection httpsURLConnection = (HttpsURLConnection) new URL(u).openConnection(); - httpsURLConnection.setRequestProperty("User-Agent", "DungeonsGuide/1.0"); - httpsURLConnection.setRequestProperty("Content-Type", "application/json"); - httpsURLConnection.setRequestMethod("GET"); - httpsURLConnection.setRequestProperty("Authorization", authenticator.getUnexpiredToken()); - httpsURLConnection.setDoInput(true); - httpsURLConnection.setDoOutput(true); - - InputStream inputStream = httpsURLConnection.getInputStream(); - byte[] lengthPayload = new byte[4]; - inputStream.read(lengthPayload); - int length = ((lengthPayload[0] & 0xFF) << 24) | - ((lengthPayload[1] & 0xFF) << 16) | - ((lengthPayload[2] & 0xFF) << 8) | - ((lengthPayload[3] & 0xFF)); - while (inputStream.available() < length) ; - byte[] keyPayload = new byte[length]; - inputStream.read(keyPayload); - - Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); - cipher.init(Cipher.DECRYPT_MODE, this.rsaKey.getPrivate()); - byte[] AESKey = cipher.doFinal(keyPayload); - - cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - SecretKeySpec secretKeySpec = new SecretKeySpec(AESKey, "AES"); - IvParameterSpec ivParameterSpec = new IvParameterSpec(AESKey); - cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec); - CipherInputStream cipherInputStream = new CipherInputStream(inputStream, cipher); - cipherInputStream.read(lengthPayload); - length = ((lengthPayload[0] & 0xFF) << 24) | - ((lengthPayload[1] & 0xFF) << 16) | - ((lengthPayload[2] & 0xFF) << 8) | - ((lengthPayload[3] & 0xFF)); - JsonElement l = new JsonParser().parse(new InputStreamReader(cipherInputStream)); - httpsURLConnection.disconnect(); - return l; - } -} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/GuiLoadingError.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/GuiLoadingError.java index f7cc5972..f699b1d7 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/GuiLoadingError.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/GuiLoadingError.java @@ -18,64 +18,34 @@ package kr.syeyoung.dungeonsguide.launcher.gui; -import kr.syeyoung.dungeonsguide.launcher.util.QRCodeGenerator; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.*; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLCommonHandler; import org.lwjgl.opengl.GL11; -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Base64; -import java.util.zip.GZIPOutputStream; +import java.io.PrintStream; public class GuiLoadingError extends GuiScreen { - private String stacktrace; - private Throwable throwable; + static Throwable cause; + private final String stacktrace; + private final GuiScreen originalGUI; + public GuiLoadingError(GuiScreen originalGUI) { - private DynamicTexture texture; - private ResourceLocation location; - private BufferedImage qrCode; - private Runnable clear; + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + PrintStream printStream = new PrintStream(byteArrayOutputStream); + cause.printStackTrace(printStream); + this.stacktrace = byteArrayOutputStream.toString(); - public GuiLoadingError(Throwable t, Runnable clear) { - this.throwable = t; - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - t.printStackTrace(pw); - stacktrace = sw.toString(); - - - try { - qrCode = QRCodeGenerator.generateQRCode(stacktrace.getBytes()); - } catch (IOException e) { - throw new RuntimeException(e); - } - texture = new DynamicTexture(qrCode.getWidth(), qrCode.getHeight()); - location = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("dg/errorqr", texture); - - qrCode.getRGB(0,0,qrCode.getWidth(), qrCode.getHeight(), texture.getTextureData(), 0, qrCode.getWidth()); - - texture.updateDynamicTexture(); - this.clear = clear; + this.originalGUI = originalGUI; } @Override public void initGui() { ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - this.buttonList.add(new GuiButton(0, sr.getScaledWidth()/2-100,sr.getScaledHeight()-40 ,"Close Minecraft")); - this.buttonList.add(new GuiButton(1, sr.getScaledWidth()/2-100,sr.getScaledHeight()-70 ,"Play Without DG")); - clear.run(); + this.buttonList.add(new GuiButton(0, sr.getScaledWidth()/2-100,sr.getScaledHeight()-70 ,"Close Minecraft")); + this.buttonList.add(new GuiButton(1, sr.getScaledWidth()/2-100,sr.getScaledHeight()-40 ,"Play Without DG")); } @Override @@ -84,7 +54,7 @@ public class GuiLoadingError extends GuiScreen { if (button.id == 0) { FMLCommonHandler.instance().exitJava(-1,true); } else if (button.id == 1) { - Minecraft.getMinecraft().displayGuiScreen(null); + Minecraft.getMinecraft().displayGuiScreen(originalGUI); } } @@ -94,8 +64,8 @@ public class GuiLoadingError extends GuiScreen { ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - fontRenderer.drawString("DungeonsGuide has ran into unknown error while loading itself", (sr.getScaledWidth()-fontRenderer.getStringWidth("DungeonsGuide has ran into unknown error while loading itself"))/2,40,0xFFFF0000); - fontRenderer.drawString("Please contact DungeonsGuide support with this screen", (sr.getScaledWidth()-fontRenderer.getStringWidth("Please contact DungeonsGuide support with this screen"))/2, (int) (40+fontRenderer.FONT_HEIGHT*1.5),0xFFFF0000); + fontRenderer.drawString("DungeonsGuide has ran into error while loading itself", (sr.getScaledWidth()-fontRenderer.getStringWidth("DungeonsGuide has ran into error while loading itself"))/2,40,0xFFFF0000); + fontRenderer.drawString("Please contact DungeonsGuide support with this screen", (sr.getScaledWidth()-fontRenderer.getStringWidth("Please contact developer with this screen"))/2, (int) (40+fontRenderer.FONT_HEIGHT*1.5),0xFFFF0000); int tenth = sr.getScaledWidth() / 10; @@ -108,27 +78,6 @@ public class GuiLoadingError extends GuiScreen { } GL11.glDisable(GL11.GL_SCISSOR_TEST); - - GlStateManager.pushMatrix(); - GlStateManager.scale(1.0/sr.getScaleFactor(), 1.0/sr.getScaleFactor(), 1); - GlStateManager.translate(0, Minecraft.getMinecraft().displayHeight - qrCode.getHeight() * 3, 0); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - float f = 0.0F; - Minecraft.getMinecraft().getTextureManager().bindTexture(this.location); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); - GlStateManager.disableAlpha(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos(0, qrCode.getHeight()*3, 0).tex(0.0D, 1.0D).endVertex(); - worldrenderer.pos(qrCode.getWidth()*3, qrCode.getHeight()*3, 0).tex(1.0D, 1.0D).endVertex(); - worldrenderer.pos(qrCode.getWidth()*3, 0, 0).tex(1.0D, 0.0D).endVertex(); - worldrenderer.pos(0, 0, 0).tex(0.0D, 0.0D).endVertex(); - tessellator.draw(); - GlStateManager.enableAlpha(); - GlStateManager.disableBlend(); - GlStateManager.popMatrix(); - super.drawScreen(mouseX, mouseY, partialTicks); } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/IDGLoader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/IDGLoader.java index 53d9b70d..820ce0c8 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/IDGLoader.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/IDGLoader.java @@ -19,21 +19,17 @@ package kr.syeyoung.dungeonsguide.launcher.loader; import kr.syeyoung.dungeonsguide.launcher.DGInterface; -import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; import kr.syeyoung.dungeonsguide.launcher.exceptions.ReferenceLeakedException; -import net.minecraftforge.common.config.Configuration; - -import java.io.InputStream; public interface IDGLoader { - void loadJar(Authenticator authenticator) throws InstantiationException, IllegalAccessException, ClassNotFoundException; + DGInterface loadDungeonsGuide() throws InstantiationException, IllegalAccessException, ClassNotFoundException; DGInterface getInstance(); - void unloadJar() throws ReferenceLeakedException; + void unloadDungeonsGuide() throws ReferenceLeakedException; boolean isUnloadable(); boolean isLoaded(); - String strategyName(); + String branchName(); String version(); } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/JarLoader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/JarLoader.java index 0b6cf124..fff63a07 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/JarLoader.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/JarLoader.java @@ -20,7 +20,6 @@ package kr.syeyoung.dungeonsguide.launcher.loader; import kr.syeyoung.dungeonsguide.launcher.DGInterface; import kr.syeyoung.dungeonsguide.launcher.Main; -import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; import kr.syeyoung.dungeonsguide.launcher.exceptions.ReferenceLeakedException; import java.io.InputStream; @@ -84,7 +83,7 @@ public class JarLoader implements IDGLoader { private JarClassLoader classLoader; @Override - public void loadJar(Authenticator authenticator) throws ClassNotFoundException, InstantiationException, IllegalAccessException { + public DGInterface loadDungeonsGuide() throws ClassNotFoundException, InstantiationException, IllegalAccessException { if (dgInterface != null) throw new IllegalStateException("Already loaded"); classLoader = new JarClassLoader(new URL[] { @@ -93,6 +92,7 @@ public class JarLoader implements IDGLoader { dgInterface = (DGInterface) classLoader.loadClassResolve("kr.syeyoung.dungeonsguide.DungeonsGuide", true).newInstance(); phantomReference = new PhantomReference<>(classLoader, refQueue); + return dgInterface; } @Override @@ -101,7 +101,7 @@ public class JarLoader implements IDGLoader { } @Override - public void unloadJar() throws ReferenceLeakedException { + public void unloadDungeonsGuide() throws ReferenceLeakedException { classLoader = null; dgInterface.unload(); dgInterface = null; @@ -123,7 +123,7 @@ public class JarLoader implements IDGLoader { } @Override - public String strategyName() { + public String branchName() { return "jar"; } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java index 1338138d..01159b34 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java @@ -19,7 +19,6 @@ package kr.syeyoung.dungeonsguide.launcher.loader; import kr.syeyoung.dungeonsguide.launcher.DGInterface; -import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; import kr.syeyoung.dungeonsguide.launcher.exceptions.ReferenceLeakedException; import java.io.InputStream; @@ -28,9 +27,9 @@ public class LocalLoader implements IDGLoader { private DGInterface dgInterface; @Override - public void loadJar(Authenticator authenticator) throws ClassNotFoundException, InstantiationException, IllegalAccessException { + public DGInterface loadDungeonsGuide() throws ClassNotFoundException, InstantiationException, IllegalAccessException { if (dgInterface != null) throw new IllegalStateException("Already loaded"); - dgInterface = (DGInterface) Class.forName("kr.syeyoung.dungeonsguide.DungeonsGuide").newInstance(); + return dgInterface = (DGInterface) Class.forName("kr.syeyoung.dungeonsguide.DungeonsGuide").newInstance(); } @Override @@ -39,7 +38,7 @@ public class LocalLoader implements IDGLoader { } @Override - public void unloadJar() throws ReferenceLeakedException { + public void unloadDungeonsGuide() throws ReferenceLeakedException { throw new UnsupportedOperationException(); } @Override @@ -53,7 +52,7 @@ public class LocalLoader implements IDGLoader { } @Override - public String strategyName() { + public String branchName() { return "local"; } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGConnection.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGConnection.java index 649dfdc5..5a310738 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGConnection.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGConnection.java @@ -1,35 +1,37 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package kr.syeyoung.dungeonsguide.launcher.url; -import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; +import kr.syeyoung.dungeonsguide.launcher.auth.ResourceManager; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.net.URL; import java.net.URLConnection; public class DGConnection extends URLConnection { - private final Authenticator authenticator; - protected DGConnection(URL url, Authenticator a) { + + protected DGConnection(URL url) { super(url); connected = false; - this.authenticator = a; } @Override @@ -37,10 +39,10 @@ public class DGConnection extends URLConnection { } @Override public InputStream getInputStream() throws IOException { - if (authenticator != null) { + if (ResourceManager.getInstance().getResources() != null) { String path = url.getPath().substring(1); -// if (!authenticator.getResources().containsKey(path)) throw new FileNotFoundException(); -// return new ByteArrayInputStream(authenticator.getResources().get(path)); + if (!ResourceManager.getInstance().getResources().containsKey(path)) throw new FileNotFoundException(); + return new ByteArrayInputStream(ResourceManager.getInstance().getResources().get(path)); } throw new FileNotFoundException(); } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGStreamHandler.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGStreamHandler.java index 82ddff18..456e7f8c 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGStreamHandler.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGStreamHandler.java @@ -1,24 +1,23 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package kr.syeyoung.dungeonsguide.launcher.url; -import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; import lombok.AllArgsConstructor; import java.io.IOException; @@ -28,9 +27,8 @@ import java.net.URLStreamHandler; @AllArgsConstructor public class DGStreamHandler extends URLStreamHandler { - private final Authenticator auth; @Override protected URLConnection openConnection(URL url) throws IOException { - return new DGConnection(url, this.auth); + return new DGConnection(url); } } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGStreamHandlerFactory.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGStreamHandlerFactory.java index a7b50046..a7eefa37 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGStreamHandlerFactory.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/url/DGStreamHandlerFactory.java @@ -1,24 +1,23 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package kr.syeyoung.dungeonsguide.launcher.url; -import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; import lombok.AllArgsConstructor; import java.net.URLStreamHandler; @@ -26,11 +25,10 @@ import java.net.URLStreamHandlerFactory; @AllArgsConstructor public class DGStreamHandlerFactory implements URLStreamHandlerFactory { - private final Authenticator auth; @Override public URLStreamHandler createURLStreamHandler(String protocol) { if ("z".equals(protocol)) { - return new DGStreamHandler(this.auth); + return new DGStreamHandler(); } return null; } diff --git a/loader/src/main/resources/mcmod.info b/loader/src/main/resources/mcmod.info index 70df65aa..2e1a5e46 100755 --- a/loader/src/main/resources/mcmod.info +++ b/loader/src/main/resources/mcmod.info @@ -4,10 +4,10 @@ "name": "Skyblock Dungeons Guide", "description": "A mod to help dungeon players to find and solve secrets and puzzles most efficiently.", "version": "${version}", - "mcversion": "${mcversion}", - "url": "", + "mcversion": "1.8.9", + "url": "https://discord.gg/dg", "updateUrl": "", - "authorList": ["syeyoung"], + "authorList": ["syeyoung", "kokoniara"], "credits": "The guild Jerry's Crew, for nothing.", "logoFile": "", "screenshots": [], diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java deleted file mode 100755 index 59078bca..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide; - -import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.commands.CommandDungeonsGuide; -import kr.syeyoung.dungeonsguide.commands.CommandReparty; -import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; -import kr.syeyoung.dungeonsguide.launcher.DGInterface; -import kr.syeyoung.dungeonsguide.launcher.Main; -import kr.syeyoung.dungeonsguide.chat.ChatProcessor; -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.config.Config; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import kr.syeyoung.dungeonsguide.eventlistener.DungeonListener; -import kr.syeyoung.dungeonsguide.eventlistener.FeatureListener; -import kr.syeyoung.dungeonsguide.eventlistener.PacketListener; -import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.resources.DGTexturePack; -import kr.syeyoung.dungeonsguide.rpc.RichPresenceManager; -import kr.syeyoung.dungeonsguide.stomp.CloseListener; -import kr.syeyoung.dungeonsguide.stomp.StompClient; -import kr.syeyoung.dungeonsguide.stomp.StompInterface; -import kr.syeyoung.dungeonsguide.utils.AhUtils; -import kr.syeyoung.dungeonsguide.utils.TimeScoreUtil; -import kr.syeyoung.dungeonsguide.utils.cursor.GLCursors; -import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache; -import lombok.Getter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IReloadableResourceManager; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourcePack; -import net.minecraft.launchwrapper.LaunchClassLoader; -import net.minecraft.util.IChatComponent; -import net.minecraftforge.client.ClientCommandHandler; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.ProgressManager; -import net.minecraftforge.fml.relauncher.ReflectionHelper; - -import javax.crypto.BadPaddingException; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import java.io.*; -import java.net.URI; -import java.security.InvalidAlgorithmParameterException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -public class DungeonsGuide implements DGInterface, CloseListener { - - private SkyblockStatus skyblockStatus; - - private static DungeonsGuide dungeonsGuide; - - @Getter - private final Authenticator authenticator; - - @Getter - private StompInterface stompConnection; - @Getter - private CosmeticsManager cosmeticsManager; - - public DungeonsGuide(Authenticator authenticator) { - this.authenticator = authenticator; - } - - public static void sendDebugChat(IChatComponent iChatComponent) { - if (FeatureRegistry.DEBUG.isEnabled()) - Minecraft.getMinecraft().thePlayer.addChatMessage(iChatComponent); - } - @Getter - CommandReparty commandReparty; - CommandDungeonsGuide commandDungeonsGuide; - - - private final String stompURL = "wss://dungeons.guide/ws"; -// private String stompURL = "ws://localhost/ws"; - public void init(File resourceDir) { - ProgressManager.ProgressBar progressbar = ProgressManager.push("DungeonsGuide", 4); - - configDir = new File(resourceDir,"dungeonsguide"); - File configFile = new File(configDir, "config.json"); - if (!configFile.exists()) { - configDir.mkdirs(); - firstTimeUsingDG = true; - } - Config.f = configFile; - Minecraft.getMinecraft().getFramebuffer().enableStencil(); - - - try { - List<IResourcePack> resourcePackList = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(),"defaultResourcePacks", "aA", "field_110449_ao"); - resourcePackList.add(new DGTexturePack()); - Minecraft.getMinecraft().refreshResources(); - } catch (Throwable t){ - t.printStackTrace(); - } - - - try { - Set<String> invalid = ReflectionHelper.getPrivateValue(LaunchClassLoader.class, (LaunchClassLoader) Main.class.getClassLoader(), "invalidClasses"); - ((LaunchClassLoader) Main.class.getClassLoader()).clearNegativeEntries(Sets.newHashSet("org.slf4j.LoggerFactory")); - invalid.clear(); - } catch (Throwable t) { - t.printStackTrace(); - } - - progressbar.step("Registering Events & Commands"); - dungeonsGuide = this; - skyblockStatus = new SkyblockStatus(); - - registerEvents(new DungeonListener()); - ClientCommandHandler.instance.registerCommand(commandDungeonsGuide = new CommandDungeonsGuide()); - registerEvents(commandDungeonsGuide); - - commandReparty = new CommandReparty(); - registerEvents(commandReparty); - - registerEvents(new FeatureListener()); - registerEvents(new PacketListener()); - registerEvents(new Keybinds()); - - registerEvents(ChatProcessor.INSTANCE); - registerEvents(PartyManager.INSTANCE); - registerEvents(StaticResourceCache.INSTANCE); - - AhUtils.registerTimer(); - - progressbar.step("Loading Roomdatas"); - try { - DungeonRoomInfoRegistry.loadAll(configDir); - } catch (BadPaddingException | InvalidKeyException | NoSuchPaddingException | IllegalBlockSizeException | IOException | NoSuchAlgorithmException | InvalidAlgorithmParameterException e) { - e.printStackTrace(); - } - progressbar.step("Opening connection"); - - cosmeticsManager = new CosmeticsManager(); - registerEvents(cosmeticsManager); - - try { - connectStomp(); - } catch (Exception e) { - throw new RuntimeException(e); - } - - - progressbar.step("Loading Config"); - try { - Config.loadConfig( null ); - } catch (IOException e) { - e.printStackTrace(); - } - - if (FeatureRegistry.ETC_REPARTY.isEnabled()) - ClientCommandHandler.instance.registerCommand(commandReparty); - if (FeatureRegistry.DISCORD_DONOTUSE.isEnabled()) - System.setProperty("dg.safe", "true"); - registerEvents(RichPresenceManager.INSTANCE); - TimeScoreUtil.init(); - - ProgressManager.pop(progressbar); - - ((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(resourceManager -> GLCursors.setupCursors()); - } - @Getter - private boolean firstTimeUsingDG = false; - private List<Object> listeners = new ArrayList<>(); - - private void registerEvents(Object obj) { - listeners.add(obj); - registerEvents(obj); - } - - @Override - public void onResourceReload(IResourceManager a) { - GLCursors.setupCursors(); - } - - @Override - public void unload() { - ClientCommandHandler.instance.getCommands().remove(commandReparty.getCommandName()); - ClientCommandHandler.instance.getCommands().remove(commandDungeonsGuide.getCommandName()); - listeners.forEach(MinecraftForge.EVENT_BUS::unregister); - stompConnection.disconnect(); - List<IResourcePack> resourcePackList = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(),"defaultResourcePacks", "aA", "field_110449_ao"); - resourcePackList.removeIf(a -> a instanceof DGTexturePack); - } - - @Getter - private File configDir; - - - public SkyblockStatus getSkyblockStatus() { - return skyblockStatus; - } - - public static DungeonsGuide getDungeonsGuide() { - return dungeonsGuide; - } - ScheduledExecutorService ex = Executors.newScheduledThreadPool(2); - @Override - public void onClose(int code, String reason, boolean remote) { - System.out.println("Stomp Connection closed, trying to reconnect - "+reason+ " - "+code); - connectStomp(); - } - - public void connectStomp() { - ex.schedule(() -> { - try { - stompConnection = new StompClient(new URI(stompURL), authenticator.getUnexpiredToken(), DungeonsGuide.this); - MinecraftForge.EVENT_BUS.post(new StompConnectedEvent(stompConnection)); - } catch (Exception e) { - e.printStackTrace(); - } - }, 5L, TimeUnit.SECONDS); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCBoolean.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCBoolean.java deleted file mode 100644 index 344984e2..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCBoolean.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.config.types; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; - -public class TCBoolean implements TypeConverter<Boolean> { - @Override - public String getTypeString() { - return "boolean"; - } - - @Override - public Boolean deserialize(JsonElement element) { - return element.getAsBoolean(); - } - - @Override - public JsonElement serialize(Boolean element) { - return new JsonPrimitive(element); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java deleted file mode 100644 index d91b75be..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.config.types; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; - -import java.awt.*; - -public class TCColor implements TypeConverter<Color> { - @Override - public String getTypeString() { - return "color"; - } - - @Override - public Color deserialize(JsonElement element) { - return new Color(element.getAsInt()); - } - - @Override - public JsonElement serialize(Color element) { - return new JsonPrimitive(element.getRGB()); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java deleted file mode 100644 index 6fc10b7d..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.config.types; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; - -public class TCFloat implements TypeConverter<Float> { - @Override - public String getTypeString() { - return "float"; - } - - @Override - public Float deserialize(JsonElement element) { - return element.getAsFloat(); - } - - @Override - public JsonElement serialize(Float element) { - return new JsonPrimitive(element); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCInteger.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCInteger.java deleted file mode 100644 index e407815c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCInteger.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.config.types; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; - -public class TCInteger implements TypeConverter<Integer> { - @Override - public String getTypeString() { - return "integer"; - } - - @Override - public Integer deserialize(JsonElement element) { - return element.getAsInt(); - } - - @Override - public JsonElement serialize(Integer element) { - return new JsonPrimitive(element); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCString.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCString.java deleted file mode 100644 index d09ae81f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCString.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.config.types; - -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; - -public class TCString implements TypeConverter<String> { - @Override - public String getTypeString() { - return "string"; - } - - @Override - public String deserialize(JsonElement element) { - return element.getAsString(); - } - - @Override - public JsonElement serialize(String element) { - return new JsonPrimitive(element); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverter.java deleted file mode 100644 index 0c954e7d..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverter.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.config.types; - -import com.google.gson.JsonElement; - -public interface TypeConverter<T> { - String getTypeString(); - - T deserialize(JsonElement element); - - JsonElement serialize(T element); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/ActiveCosmetic.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/ActiveCosmetic.java deleted file mode 100644 index c88bbbbc..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/ActiveCosmetic.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.cosmetics; - -import lombok.Data; -import java.util.UUID; - -@Data -public class ActiveCosmetic { - private UUID activityUID; - private UUID playerUID; - private UUID cosmeticData; - private String username; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/CosmeticData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/CosmeticData.java deleted file mode 100644 index 8b3ac3b4..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/CosmeticData.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.cosmetics; - - -import lombok.Data; - -import java.util.UUID; - -@Data -public class CosmeticData { - private UUID id; - private String cosmeticType; - private String reqPerm; - private String data; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java deleted file mode 100755 index ca7b2300..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java +++ /dev/null @@ -1,506 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon; - -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.EDungeonDoorType; -import kr.syeyoung.dungeonsguide.dungeon.events.DungeonMapUpdateEvent; -import kr.syeyoung.dungeonsguide.dungeon.events.DungeonNodataEvent; -import kr.syeyoung.dungeonsguide.dungeon.events.DungeonRoomDiscoverEvent; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.EDungeonDoorType; -import kr.syeyoung.dungeonsguide.dungeon.events.SerializableBlockPos; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.events.DungeonContextInitializationEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.stomp.StompPayload; -import kr.syeyoung.dungeonsguide.utils.MapUtils; -import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemMap; -import net.minecraft.item.ItemStack; -import net.minecraft.util.*; -import net.minecraft.world.storage.MapData; -import net.minecraftforge.common.MinecraftForge; -import org.json.JSONObject; - -import javax.vecmath.Vector2d; -import java.awt.*; -import java.util.List; -import java.util.Queue; -import java.util.*; - -public class MapProcessor { - - private final DungeonContext context; - - private byte[] lastMapData; - - @Getter - private MapData lastMapData2; - - @Getter - private final BiMap<String, String> mapIconToPlayerMap = HashBiMap.create(); - - @Getter @Setter - private Dimension unitRoomDimension; - @Getter @Setter - private Dimension doorDimension; // width: width of door, height: gap between rooms - @Getter @Setter - private Point topLeftMapPoint; - - @Setter - private boolean bugged = false; - - private final List<Point> roomsFound = new ArrayList<Point>(); - - private boolean axisMatch = false; - - @Getter - private boolean initialized = false; - - @Getter - private int undiscoveredRoom = 0; - - public MapProcessor(DungeonContext context) { - this.context = context; - } - - private static final Set<Vector2d> directions = Sets.newHashSet(new Vector2d(0,1), new Vector2d(0, -1), new Vector2d(1, 0), new Vector2d(-1 , 0)); - - private int waitCnt = 0; - private void buildMap(final byte[] mapData) { - final Point startroom = MapUtils.findFirstColorWithIn(mapData, (byte) 30, new Rectangle(0,0,128,128)); - if (startroom == null){ - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't retrieve map data, disabling mod for this dungeon run")); - bugged = true; - return; - } - // Determine room dimension - { - int width = MapUtils.getWidthOfColorAt(mapData, (byte) 30, startroom); - int height = MapUtils.getHeightOfColorAt(mapData, (byte) 30, startroom); - unitRoomDimension = new Dimension(width, height); - } - Vector2d doorDir = null; - // determine the gap - { - Point midStartRoom = new Point(startroom.x + unitRoomDimension.width / 2, startroom.y +unitRoomDimension.height / 2); - final int halfWidth = unitRoomDimension.width / 2 + 2; - for (Vector2d v:directions) { - byte color = MapUtils.getMapColorAt(mapData, (int)(v.x * halfWidth +midStartRoom.x), (int)(v.y *halfWidth +midStartRoom.y)); - if (color != 0) { - doorDir = v; - break; - } - } - - if (doorDir == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't determine door of the room, disabling mod for this dungeon run")); - bugged = true; - return; - } - Point basePoint = new Point(startroom.x, startroom.y); - if (doorDir.x > 0) basePoint.x += unitRoomDimension.width; - if (doorDir.x < 0) basePoint.x += -1; - if (doorDir.y > 0) basePoint.y += unitRoomDimension.height; - if (doorDir.y < 0) basePoint.y += -1; - int gap = MapUtils.getLengthOfColorExtending(mapData, (byte) 0, basePoint, doorDir); - Point pt = MapUtils.findFirstColorWithInNegate(mapData, (byte)0, new Rectangle(basePoint.x, basePoint.y, (int)Math.abs(doorDir.y) * unitRoomDimension.width + 1, (int)Math.abs(doorDir.x) * unitRoomDimension.height + 1)); - if (pt == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't determine door of the room, disabling mod for this dungeon run")); - bugged = true; - return; - } - int doorWidth = MapUtils.getLengthOfColorExtending(mapData, MapUtils.getMapColorAt(mapData, pt.x, pt.y), pt, new Vector2d((int)Math.abs(doorDir.y), (int)Math.abs(doorDir.x))); - doorDimension = new Dimension(doorWidth, gap); - } - // Determine Top Left - { - int x = startroom.x; - int y = startroom.y; - while (x >= unitRoomDimension.width + doorDimension.height) x -= unitRoomDimension.width + doorDimension.height; - while (y >= unitRoomDimension.height + doorDimension.height) y -= unitRoomDimension.height + doorDimension.height; - topLeftMapPoint = new Point(x, y); - } - // determine door location based on npc, and determine map min from there - { - DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); - if (doorFinder == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't find door processor for "+ DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName())); - bugged = true; - return; - } - BlockPos door = doorFinder.findDoor(context.getWorld(), DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); - if (door == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't determine door of the room, disabling mod for this dungeon run")); - bugged = true; - return; - } - - DungeonsGuide.sendDebugChat(new ChatComponentText("door Pos:"+door)); - - Point unitPoint = mapPointToRoomPoint(startroom); - unitPoint.translate(unitPoint.x + 1, unitPoint.y + 1); - unitPoint.translate((int)doorDir.x, (int)doorDir.y); - - Vector2d offset = doorFinder.findDoorOffset(context.getWorld(), DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); - axisMatch = doorDir.equals(offset); - - int worldX = unitPoint.x * 16; - int worldY = unitPoint.y * 16; - BlockPos worldMin = door.add(-worldX, 0, -worldY); - context.setDungeonMin(worldMin); - - } - - DungeonsGuide.sendDebugChat(new ChatComponentText("Found Green room:"+startroom)); - DungeonsGuide.sendDebugChat(new ChatComponentText("Axis match:"+axisMatch)); - DungeonsGuide.sendDebugChat(new ChatComponentText("World Min:"+context.getDungeonMin())); - DungeonsGuide.sendDebugChat(new ChatComponentText("Dimension:"+unitRoomDimension)); - DungeonsGuide.sendDebugChat(new ChatComponentText("top Left:"+topLeftMapPoint)); - DungeonsGuide.sendDebugChat(new ChatComponentText("door dimension:"+doorDimension)); - context.createEvent(new DungeonNodataEvent("MAP_PROCESSOR_INIT")); - initialized = true; - MinecraftForge.EVENT_BUS.post(new DungeonContextInitializationEvent()); - } - - public Point mapPointToRoomPoint(Point mapPoint) { - int x = (int)((mapPoint.x - topLeftMapPoint.x) / ((double)unitRoomDimension.width + doorDimension.height)); - int y = (int)((mapPoint.y - topLeftMapPoint.y) / ((double)unitRoomDimension.height + doorDimension.height)); - return new Point(x,y); - } - public BlockPos mapPointToWorldPoint(Point mapPoint) { - int x = (int)((mapPoint.x - topLeftMapPoint.x) / ((double)unitRoomDimension.width + doorDimension.height) * 32 + context.getDungeonMin().getX()); - int y = (int)((mapPoint.y - topLeftMapPoint.y) / ((double)unitRoomDimension.height + doorDimension.height) * 32 + context.getDungeonMin().getZ()); - return new BlockPos(x,70,y); - } - public Point roomPointToMapPoint(Point roomPoint) { - return new Point(roomPoint.x * (unitRoomDimension.width +doorDimension.height) + topLeftMapPoint.x, - roomPoint.y *(unitRoomDimension.height + doorDimension.height) + topLeftMapPoint.y); - } - public BlockPos roomPointToWorldPoint(Point roomPoint) { - return new BlockPos(context.getDungeonMin().getX() +(roomPoint.x * 32), context.getDungeonMin().getY(), context.getDungeonMin().getZ() +(roomPoint.y *32)); - } - public Point worldPointToRoomPoint(BlockPos worldPoint) { - if (context.getDungeonMin() == null) return null; - return new Point((worldPoint.getX() - context.getDungeonMin().getX()) / 32, (worldPoint.getZ() - context.getDungeonMin().getZ()) / 32); - } - - public Vector2d worldPointToMapPointFLOAT(Vec3 worldPoint) { - if (context.getDungeonMin() == null) return null; - double x = topLeftMapPoint.x + ((worldPoint.xCoord - context.getDungeonMin().getX()) / 32.0f * (unitRoomDimension.width + doorDimension.height)); - double y = topLeftMapPoint.y + ((worldPoint.zCoord - context.getDungeonMin().getZ()) / 32.0f * (unitRoomDimension.height + doorDimension.height)); - return new Vector2d(x, y); - } - - public Point worldPointToMapPoint(Vec3 worldPoint) { - if (context.getDungeonMin() == null) return null; - return new Point(topLeftMapPoint.x + (int)((worldPoint.xCoord - context.getDungeonMin().getX()) / 32.0f * (unitRoomDimension.width + doorDimension.height)), topLeftMapPoint.y + (int)((worldPoint.zCoord - context.getDungeonMin().getZ()) / 32.0f * (unitRoomDimension.height + doorDimension.height))); - } - - private void processMap(byte[] mapData) { - int height = (int)((128.0 - topLeftMapPoint.y) / (unitRoomDimension.height + doorDimension.height)); - int width = (int) ((128.0 - topLeftMapPoint.x) / (unitRoomDimension.width + doorDimension.height)); - if (MapUtils.getMapColorAt(mapData,0,0) != 0) return; - undiscoveredRoom = 0; - for (int y = 0; y <= height; y++){ - for (int x = 0; x <= width; x++) { - Point mapPoint = roomPointToMapPoint(new Point(x,y)); - byte color = MapUtils.getMapColorAt(mapData, mapPoint.x, mapPoint.y); - MapUtils.record(mapData, mapPoint.x, mapPoint.y, new Color(255,255,0,80)); - if (roomsFound.contains(new Point(x,y))) { - DungeonRoom dungeonRoom = context.getRoomMapper().get(new Point(x,y)); - if (color == 18 && dungeonRoom.getCurrentState() != DungeonRoom.RoomState.FINISHED) { - dungeonRoom.setCurrentState(DungeonRoom.RoomState.COMPLETE_WITHOUT_SECRETS); - dungeonRoom.setTotalSecrets(0); - } else if (color == 30) { - dungeonRoom.setCurrentState(DungeonRoom.RoomState.FINISHED); - dungeonRoom.setTotalSecrets(0); - } else if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.FINISHED){ - byte centerColor = MapUtils.getMapColorAt(mapData, mapPoint.x + unitRoomDimension.width / 2, mapPoint.y + unitRoomDimension.height / 2); - MapUtils.record(mapData, mapPoint.x + unitRoomDimension.width / 2, mapPoint.y + unitRoomDimension.height / 2, new Color(0,255,0,80)); - if (centerColor == 34) { - dungeonRoom.setCurrentState(DungeonRoom.RoomState.COMPLETE_WITHOUT_SECRETS); - } else if (centerColor == 30) { - dungeonRoom.setCurrentState(DungeonRoom.RoomState.FINISHED); - } else if (centerColor == 18) { // red - dungeonRoom.setCurrentState(DungeonRoom.RoomState.FAILED); - } - } - if (dungeonRoom.getTotalSecrets() == -1) { - if (dungeonRoom.getColor() == 82) dungeonRoom.setTotalSecrets(0); - else if (dungeonRoom.getColor() == 74) dungeonRoom.setTotalSecrets(0); - MapUtils.record(mapData, mapPoint.x, mapPoint.y +1, new Color(0,255,0,80)); - } - continue; - } - - if (color != 0 && color != 85) { - MapUtils.record(mapData, mapPoint.x, mapPoint.y, new Color(0,255,255,80)); - DungeonRoom rooms = buildRoom(mapData, new Point(x,y)); - if (rooms == null) continue; - context.createEvent(new DungeonRoomDiscoverEvent(rooms.getUnitPoints().get(0), rooms.getRoomMatcher().getRotation(), new SerializableBlockPos(rooms.getMin()), new SerializableBlockPos(rooms.getMax()), rooms.getShape(),rooms.getColor(), rooms.getDungeonRoomInfo().getUuid(), rooms.getDungeonRoomInfo().getName(), rooms.getDungeonRoomInfo().getProcessorId())); - DungeonsGuide.sendDebugChat(new ChatComponentText("New Map discovered! shape: "+rooms.getShape()+ " color: "+rooms.getColor()+" unitPos: "+x+","+y)); - DungeonsGuide.sendDebugChat(new ChatComponentText("New Map discovered! mapMin: "+rooms.getMin() + " mapMx: "+rooms.getMax())); - StringBuilder builder = new StringBuilder(); - for (int dy =0;dy<4;dy++) { - builder.append("\n"); - for (int dx = 0; dx < 4; dx ++) { - boolean isSet = ((rooms.getShape() >> (dy * 4 + dx)) & 0x1) != 0; - builder.append(isSet ? "O" : "X"); - } - } - DungeonsGuide.sendDebugChat(new ChatComponentText("Shape visual: "+ builder)); - - context.getDungeonRoomList().add(rooms); - for (Point p:rooms.getUnitPoints()) { - roomsFound.add(p); - context.getRoomMapper().put(p, rooms); - } - if (rooms.getRoomProcessor() != null && rooms.getRoomProcessor().readGlobalChat()) - context.getGlobalRoomProcessors().add(rooms.getRoomProcessor()); - } else if (color == 85){ - undiscoveredRoom++; - } - - } - } - } - - private static final Set<Vector2d> door_dirs = Sets.newHashSet(new Vector2d(0,0.5), new Vector2d(0, -0.5), new Vector2d(0.5, 0), new Vector2d(-0.5 , 0)); - private DungeonRoom buildRoom(byte[] mapData, Point unitPoint) { - Queue<Point[]> toCheck = new LinkedList<Point[]>(); - toCheck.add(new Point[] {unitPoint, unitPoint}); // requestor, target - Set<Point> checked = new HashSet<Point>(); - List<Point> ayConnected = new ArrayList<Point>(); - - int minX = Integer.MAX_VALUE, minY = Integer.MAX_VALUE; - int maxX = 0, maxY = 0; - while(toCheck.peek() != null) { - Point[] check = toCheck.poll(); - if (checked.contains(check[1])) continue; - checked.add(check[1]); - - if (checkIfConnected(mapData, check[0], check[1])) { - ayConnected.add(check[1]); - if (check[1].x < minX) minX = check[1].x; - if (check[1].y < minY) minY = check[1].y; - if (check[1].x > maxX) maxX = check[1].x; - if (check[1].y > maxY) maxY = check[1].y; - for (Vector2d dir: directions) { - Point newPt = new Point(check[1].x + (int)dir.x, check[1].y +(int)dir.y); - toCheck.add(new Point[]{check[1], newPt}); - } - } - } - - short shape = 0; - for (Point p:ayConnected) { - int localX = p.x - minX, localY = p.y - minY; - shape |= 1 <<(localY *4 + localX); - } - Set<Vector2d> doors = new HashSet<>(); - for (Point p: ayConnected) { - for (Vector2d v: door_dirs) { - Vector2d v2 = new Vector2d(p.x + v.x , p.y + v.y ); - if (doors.contains(v2)) doors.remove(v2); - else doors.add(v2); - } - } - Point pt2 = roomPointToMapPoint(ayConnected.get(0)); - byte unit1 = MapUtils.getMapColorAt(mapData, pt2.x, pt2.y); - - // 0: none 1: open door door 2. unopen door 3: wither door 4. red door - Set<Tuple<Vector2d, EDungeonDoorType>> doorsAndStates = new HashSet<>(); - final int halfWidth = unitRoomDimension.width + 4; - for (Vector2d door : doors) { - int floorX = (int)Math.floor(door.x), floorY = (int)Math.floor(door.y); - Point mapPt = roomPointToMapPoint(new Point(floorX, floorY)); - Point target = new Point(mapPt.x+ unitRoomDimension.width/2 + (int)(halfWidth*(door.x - floorX)), mapPt.y + unitRoomDimension.height/2 + (int)(halfWidth*(door.y - floorY)) ); - MapUtils.record(mapData, target.x, target.y, Color.green); - byte color = MapUtils.getMapColorAt(mapData, target.x, target.y); - - Vector2d vector2d = new Vector2d(door.x - minX, door.y - minY); - if (color == 0) { - doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.NONE)); - } else if (color == 85) { - doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.UNOPEN)); - } else if (color == 119) { - doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.WITHER)); - } else if (color == 18 && unit1 != 18) { - doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.BLOOD)); - } else { - doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.ENTRANCE)); - } - } - - - try{ - return new DungeonRoom(ayConnected, shape, unit1, roomPointToWorldPoint(new Point(minX, minY)), roomPointToWorldPoint(new Point(maxX+1, maxY+1)).add(-1, 0, -1), context, doorsAndStates); - } catch (IllegalStateException ex) { - DungeonsGuide.sendDebugChat(new ChatComponentText("Failed to load room, retrying later :: "+ex.getLocalizedMessage())); - return null; - } - } - - private boolean checkIfConnected(byte[] mapData, Point unitPoint1, Point unitPoint2) { - if (unitPoint1 == unitPoint2) return true; - if (unitPoint1.equals(unitPoint2)) return true; - - - Point high = (unitPoint2.y > unitPoint1.y) ? unitPoint2 :(unitPoint2.x > unitPoint1.x) ? unitPoint2 : unitPoint1; - Point low = high == unitPoint2 ? unitPoint1 : unitPoint2; - - int xOff = low.x - high.x; - int yOff = low.y - high.y; - Point pt = roomPointToMapPoint(high); - Point pt2 = roomPointToMapPoint(low); - byte unit1 = MapUtils.getMapColorAt(mapData, pt.x, pt.y); - byte unit2 = MapUtils.getMapColorAt(mapData, pt2.x, pt2.y); - pt.translate(xOff, yOff); - byte unit3 = MapUtils.getMapColorAt(mapData, pt.x, pt.y); - - return unit1 == unit2 && unit2 == unit3 && unit1 != 0; - } - - public boolean isThereDifference(byte[] colors1, byte[] colors) { - if (colors1 == null || colors == null) return true; - for (int i =0; i < colors.length; i++) - if (colors[i] != colors1[i]) return true; - return false; - } - private int stabilizationTick = 0; - - private boolean processed = false; - private void processFinishedMap(byte[] mapData) { - if (MapUtils.getMapColorAt(mapData, 0, 0) == 0) return; - if (processed) return; - processed = true; - MapUtils.clearMap(); - MapUtils.record(mapData, 0, 0, Color.GREEN); - - int skill = MapUtils.readNumber(mapData, 51, 35, 9); - int exp = MapUtils.readNumber(mapData, 51, 54, 9); - int time = MapUtils.readNumber(mapData, 51, 73, 9); - int bonus = MapUtils.readNumber(mapData, 51, 92, 9); - DungeonsGuide.sendDebugChat(new ChatComponentText(("skill: " + skill + " / exp: " + exp + " / time: " + time + " / bonus : " + bonus))); - JSONObject payload = new JSONObject().put("timeSB", FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()) - .put("timeR", FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) - .put("timeScore", time) - .put("completionStage", context.getBossRoomEnterSeconds() == -1 ? 0 : - context.isDefeated() ? 2 : 1) - .put("percentage", DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getPercentage() / 100.0) - .put("floor", DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); - DungeonsGuide.sendDebugChat(new ChatComponentText(payload.toString())); - - try { - String target = StaticResourceCache.INSTANCE.getResource(StaticResourceCache.DATA_COLLECTION).get().getValue(); - if (FeatureRegistry.ETC_COLLECT_SCORE.isEnabled() && !target.contains("falsefalsefalsefalse")) { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(payload.toString()).header("destination", target.replace("false", "").trim())); - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - - public void tick() { - if (waitCnt < 5) { - waitCnt++; - return; - } - if (bugged) return; - ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(8); - byte[] mapData; - if (stack == null || !(stack.getItem() instanceof ItemMap)) { - mapData = lastMapData; - } else { - MapData mapData1 = ((ItemMap)stack.getItem()).getMapData(stack, context.getWorld()); - if (mapData1 == null) mapData = lastMapData; - else { - mapData = mapData1.colors; - lastMapData2 = mapData1; - - if (isThereDifference(lastMapData, mapData)) { - stabilizationTick =0; - context.createEvent(new DungeonMapUpdateEvent(mapData)); - } else { - stabilizationTick++; - } - - if (stabilizationTick > 20) { - if (doorDimension == null) buildMap(mapData); - else processMap(mapData); - - if (context.isEnded()) { - processFinishedMap(mapData); - } - } - lastMapData = mapData; - } - - } - - - if (lastMapData2 != null && mapIconToPlayerMap.size() < context.getPlayers().size() && initialized) { - label: for (Map.Entry<String, Vec4b> stringVec4bEntry : lastMapData2.mapDecorations.entrySet()) { - if (mapIconToPlayerMap.containsValue(stringVec4bEntry.getKey())) continue; - int x = stringVec4bEntry.getValue().func_176112_b() /2 + 64; - int y = stringVec4bEntry.getValue().func_176113_c() /2 + 64; - BlockPos mapPos = mapPointToWorldPoint(new Point(x, y)); - String potentialPlayer = null; - for (String player : context.getPlayers()) { // check nearby players - if (mapIconToPlayerMap.containsKey(player)) continue; - EntityPlayer entityPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(player); - if (entityPlayer == null || entityPlayer.isInvisible()) continue; - BlockPos pos = entityPlayer.getPosition(); - int dx = mapPos.getX() - pos.getX(); - int dz = mapPos.getZ() - pos.getZ(); - if (dx * dx + dz * dz < 100) { - if (potentialPlayer != null) continue label; - potentialPlayer = player; - } - } - if (potentialPlayer == null) continue; - - for (Map.Entry<String, Vec4b> stringVec4bEntry2 : lastMapData2.mapDecorations.entrySet()) { // check nearby markers - if (mapIconToPlayerMap.containsValue(stringVec4bEntry.getKey())) continue; - if (stringVec4bEntry.getKey().equals(stringVec4bEntry2.getKey())) continue; - int x2 = stringVec4bEntry2.getValue().func_176112_b() /2 + 64; - int y2 = stringVec4bEntry2.getValue().func_176113_c() /2 + 64; - int dx = x2 - x; - int dy = y2 - y; - if (dx * dx + dy * dy < 100) { - continue label; - } - } - mapIconToPlayerMap.put(potentialPlayer, stringVec4bEntry.getKey()); - } - } - - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java deleted file mode 100755 index 2be05ff8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.actions; - -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; -import net.minecraftforge.event.entity.living.LivingDeathEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; - -import java.util.Set; - -public interface Action { - Set<Action> getPreRequisites(DungeonRoom dungeonRoom); - - void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRoute.ActionRouteProperties actionRouteProperties); - void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event, ActionRoute.ActionRouteProperties actionRouteProperties); - void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event, ActionRoute.ActionRouteProperties actionRouteProperties); - void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag); - void onRenderScreen(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties); - void onTick(DungeonRoom dungeonRoom, ActionRoute.ActionRouteProperties actionRouteProperties); - - boolean isComplete(DungeonRoom dungeonRoom); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionComplete.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionComplete.java deleted file mode 100644 index 646c2171..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionComplete.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.actions; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; - -import java.util.Collections; -import java.util.Set; - -public class ActionComplete extends AbstractAction { - @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { - return Collections.emptySet(); - } - - @Override - public boolean isComplete(DungeonRoom dungeonRoom) { - return false; - } - - @Override - public String toString() { - return "Completed"; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionRoot.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionRoot.java deleted file mode 100755 index a2527b8b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionRoot.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.actions; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import lombok.Data; - -import java.util.HashSet; -import java.util.Set; - -@Data -public class ActionRoot extends AbstractAction { - private Set<Action> preRequisite = new HashSet<Action>(); - - public ActionRoot() { - } - - @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { - return preRequisite; - } - - @Override - public boolean isComplete(DungeonRoom dungeonRoom) { - return true; - } - - @Override - public String toString() { - return "Action Root"; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java index ef25fbe1..b3947637 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java @@ -18,7 +18,7 @@ package kr.syeyoung.dungeonsguide.dungeon.data; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; import lombok.Getter; import lombok.Setter; @@ -53,8 +53,8 @@ public class DungeonRoomInfo implements Serializable { private String processorId = "default"; - private Map<String, Object> properties = new HashMap<String, Object>(); + private Map<String, Object> properties = new HashMap<>(); - private Map<String, DungeonMechanic> mechanics = new HashMap<String, DungeonMechanic>(); + private Map<String, DungeonMechanic> mechanics = new HashMap<>(); private int totalSecrets = -1; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java index 180dd76d..747f44e8 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java @@ -18,8 +18,8 @@ package kr.syeyoung.dungeonsguide.dungeon.data; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.VectorUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.VectorUtils; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.block.Block; @@ -63,25 +63,23 @@ public class OffsetPoint implements Cloneable, Serializable { } public BlockPos toRotatedRelBlockPos(DungeonRoom dungeonRoom) { - int rot = dungeonRoom.getRoomMatcher().getRotation(); - Vector2d rot2 = new Vector2d(x,z); + Vector2d rot = new Vector2d(x,z); for (int i = 0; i < dungeonRoom.getRoomMatcher().getRotation(); i++) { - rot2 = VectorUtils.rotateCounterClockwise(rot2); + rot = VectorUtils.rotateCounterClockwise(rot); if (i % 2 == 0) { - rot2.y += dungeonRoom.getMax().getZ() - dungeonRoom.getMin().getZ() + 1; // + Z + rot.y += dungeonRoom.getMax().getZ() - dungeonRoom.getMin().getZ() + 1; // + Z } else { - rot2.y += dungeonRoom.getMax().getX() - dungeonRoom.getMin().getX() + 1; // + X + rot.y += dungeonRoom.getMax().getX() - dungeonRoom.getMin().getX() + 1; // + X } } - return new BlockPos(rot2.x, y, rot2.y); + return new BlockPos(rot.x, y, rot.y); } public Block getBlock(DungeonRoom dungeonRoom) { BlockPos relBp = toRotatedRelBlockPos(dungeonRoom); - Block b = dungeonRoom.getRelativeBlockAt(relBp.getX(), relBp.getY(), relBp.getZ()); - return b; + return dungeonRoom.getRelativeBlockAt(relBp.getX(), relBp.getY(), relBp.getZ()); } public BlockPos getBlockPos(DungeonRoom dungeonRoom) { BlockPos relBp = toRotatedRelBlockPos(dungeonRoom); @@ -91,8 +89,7 @@ public class OffsetPoint implements Cloneable, Serializable { public int getData(DungeonRoom dungeonRoom) { BlockPos relBp = toRotatedRelBlockPos(dungeonRoom); - int b = dungeonRoom.getRelativeBlockDataAt(relBp.getX(), relBp.getY(), relBp.getZ()); - return b; + return dungeonRoom.getRelativeBlockDataAt(relBp.getX(), relBp.getY(), relBp.getZ()); } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java deleted file mode 100755 index 39eacbc1..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.doorfinder; - -import com.google.common.base.Predicate; -import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.*; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.*; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.world.World; - -import javax.vecmath.Vector2d; -import java.util.Collection; -import java.util.Set; - -public class CatacombDataProvider implements DungeonSpecificDataProvider { - - private static final Set<Vector2d> directions = Sets.newHashSet(new Vector2d(0,1), new Vector2d(0, -1), new Vector2d(1, 0), new Vector2d(-1 , 0)); - - @Override - public BlockPos findDoor(World w, String dungeonName) { - Collection<EntityArmorStand> armorStand = w.getEntities(EntityArmorStand.class, new Predicate<EntityArmorStand>() { - @Override - public boolean apply(EntityArmorStand input) { - return input.getName().equals("§bMort"); - } - }); - - if (armorStand.size() != 0) { - EntityArmorStand mort = armorStand.iterator().next(); - BlockPos pos = mort.getPosition(); - pos = pos.add(0, 3, 0); - for (int i = 0; i < 5; i++) { - for (Vector2d vector2d:directions) { - BlockPos test = pos.add(vector2d.x * i, 0, vector2d.y * i); - if (w.getChunkFromBlockCoords(test).getBlock(test) == Blocks.iron_bars) { - return pos.add(vector2d.x * (i + 2), -2, vector2d.y * (i+2)); - } - } - } - } - return null; - } - - @Override - public Vector2d findDoorOffset(World w, String dungeonName) { - Collection<EntityArmorStand> armorStand = w.getEntities(EntityArmorStand.class, new Predicate<EntityArmorStand>() { - @Override - public boolean apply(EntityArmorStand input) { - return input.getName().equals("§bMort"); - } - }); - - if (armorStand.size() != 0) { - EntityArmorStand mort = armorStand.iterator().next(); - BlockPos pos = mort.getPosition(); - pos = pos.add(0, 3, 0); - for (int i = 0; i < 5; i++) { - for (Vector2d vector2d:directions) { - BlockPos test = pos.add(vector2d.x * i, 0, vector2d.y * i); - if (w.getChunkFromBlockCoords(test).getBlock(test) == Blocks.iron_bars) { - return vector2d; - } - } - } - } - return null; - } - /* - * - * */ - - @Override - public BossfightProcessor createBossfightProcessor(World w, String dungeonName) { - String floor = dungeonName.substring(14).trim(); - DungeonsGuide.sendDebugChat(new ChatComponentText("Floor: "+floor+ " Building bossfight processor")); - if (floor.equals("F1")) { - return new BossfightProcessorBonzo(); - } else if (floor.equals("F2")) { - return new BossfightProcessorScarf(); - } else if (floor.equals("F3")) { - return new BossfightProcessorProf(); - } else if (floor.equals("F4")) { - return new BossfightProcessorThorn(); - } else if (floor.equals("F5")) { - return new BossfightProcessorLivid(false); - } else if (floor.equals("F6")) { - return new BossfightProcessorSadan(); - } else if (floor.equals("F7")) { - return new BossfightProcessorNecron(); - } - return null; - } - - @Override - public boolean isTrapSpawn(String dungeonName) { - String floor = dungeonName.substring(14).trim(); - if (floor.equals("F3")) { - return true; - } else if (floor.equals("F4")) { - return true; - } else if (floor.equals("F5")) { - return true; - } else if (floor.equals("F6")) { - return true; - } else return floor.equals("F7"); - } - - @Override - public double secretPercentage(String dungeonName) { - String floor = dungeonName.substring(14).trim(); - if (floor.equals("F1")) { - return 0.3; - } else if (floor.equals("F2")) { - return 0.4; - } else if (floor.equals("F3")) { - return 0.5; - } else if (floor.equals("F4")) { - return 0.6; - } else if (floor.equals("F5")) { - return 0.7; - } else if (floor.equals("F6")) { - return 0.85; - } else if (floor.equals("F7")) { - return 1.0; - } else if (floor.equals("E")) { - return 0.3; - } - return 1.0; - } - - @Override - public int speedSecond(String dungeonName) { - String floor = dungeonName.substring(14).trim(); - if (floor.equals("F1")) { - return 600; - } else if (floor.equals("F2")) { - return 600; - } else if (floor.equals("F3")) { - return 600; - } else if (floor.equals("F4")) { - return 600; - } else if (floor.equals("F5")) { - return 720; - } else if (floor.equals("F6")) { - return 600; - } else if (floor.equals("F7")) { - return 720; - } - return 600; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java deleted file mode 100755 index 9d1f63b9..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombMasterDataProvider.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.doorfinder; - -import com.google.common.base.Predicate; -import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.*; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorLivid; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.world.World; - -import javax.vecmath.Vector2d; -import java.util.Collection; -import java.util.Set; - -public class CatacombMasterDataProvider implements DungeonSpecificDataProvider { - - private static final Set<Vector2d> directions = Sets.newHashSet(new Vector2d(0,1), new Vector2d(0, -1), new Vector2d(1, 0), new Vector2d(-1 , 0)); - - @Override - public BlockPos findDoor(World w, String dungeonName) { - Collection<EntityArmorStand> armorStand = w.getEntities(EntityArmorStand.class, new Predicate<EntityArmorStand>() { - @Override - public boolean apply(EntityArmorStand input) { - return input.getName().equals("§bMort"); - } - }); - - if (armorStand.size() != 0) { - EntityArmorStand mort = armorStand.iterator().next(); - BlockPos pos = mort.getPosition(); - pos = pos.add(0, 3, 0); - for (int i = 0; i < 5; i++) { - for (Vector2d vector2d:directions) { - BlockPos test = pos.add(vector2d.x * i, 0, vector2d.y * i); - if (w.getChunkFromBlockCoords(test).getBlock(test) == Blocks.iron_bars) { - return pos.add(vector2d.x * (i + 2), -2, vector2d.y * (i+2)); - } - } - } - } - return null; - } - - @Override - public Vector2d findDoorOffset(World w, String dungeonName) { - Collection<EntityArmorStand> armorStand = w.getEntities(EntityArmorStand.class, new Predicate<EntityArmorStand>() { - @Override - public boolean apply(EntityArmorStand input) { - return input.getName().equals("§bMort"); - } - }); - - if (armorStand.size() != 0) { - EntityArmorStand mort = armorStand.iterator().next(); - BlockPos pos = mort.getPosition(); - pos = pos.add(0, 3, 0); - for (int i = 0; i < 5; i++) { - for (Vector2d vector2d:directions) { - BlockPos test = pos.add(vector2d.x * i, 0, vector2d.y * i); - if (w.getChunkFromBlockCoords(test).getBlock(test) == Blocks.iron_bars) { - return vector2d; - } - } - } - } - return null; - } - /* - * - * */ - - @Override - public BossfightProcessor createBossfightProcessor(World w, String dungeonName) { - String floor = dungeonName.substring(14).trim(); - DungeonsGuide.sendDebugChat(new ChatComponentText("Floor: Master mode "+floor+ " Building bossfight processor")); - if (floor.equals("M5")) { - return new BossfightProcessorLivid(true); - } - return null; - } - - @Override - public boolean isTrapSpawn(String dungeonName) { - String floor = dungeonName.substring(14).trim(); - if (floor.equals("M3")) { - return true; - } else if (floor.equals("M4")) { - return true; - } else if (floor.equals("M5")) { - return true; - } else if (floor.equals("M6")) { - return true; - } else return floor.equals("M7"); - } - - @Override - public double secretPercentage(String dungeonName) { - return 1.0; - } - - @Override - public int speedSecond(String dungeonName) { - return 480; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java deleted file mode 100755 index 4145188c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.doorfinder; - -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessor; -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -import javax.vecmath.Vector2d; - -public interface DungeonSpecificDataProvider { - BlockPos findDoor(World w, String dungeonName); - Vector2d findDoorOffset(World w, String dungeonName); - - BossfightProcessor createBossfightProcessor(World w, String dungeonName); - - boolean isTrapSpawn(String dungeonName); - - double secretPercentage(String dungeonName); - - int speedSecond(String dungeonName); -}
\ No newline at end of file diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonCryptBrokenEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonCryptBrokenEvent.java deleted file mode 100644 index 9e16498b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonCryptBrokenEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class DungeonCryptBrokenEvent implements DungeonEventData { - private int prevCrypts; - private int newCrypts; - - @Override - public String getEventName() { - return "CRYPTS_CHANGE"; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonDeathEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonDeathEvent.java deleted file mode 100644 index bbb2481d..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonDeathEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class DungeonDeathEvent implements DungeonEventData { - private String playerName; - private String message; - private int cnt; - - @Override - public String getEventName() { - return "PLAYER_DEATH"; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEvent.java deleted file mode 100644 index a62997bf..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEvent.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import lombok.Data; - -import java.io.Serializable; - -@Data -public class DungeonEvent implements Serializable { - private long UTCTime = System.currentTimeMillis(); - private long realTimeElapsed; - private long skyblockTimeElapsed; - - private String eventName; - private DungeonEventData data; - - public DungeonEvent(DungeonEventData eventData){ - this.data = eventData; - this.realTimeElapsed = FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed(); - this.skyblockTimeElapsed = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed(); - this.eventName = eventData.getEventName(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEventData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEventData.java deleted file mode 100644 index a75d0f02..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEventData.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import java.io.Serializable; - -public interface DungeonEventData extends Serializable { - String getEventName(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEventHolder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEventHolder.java deleted file mode 100644 index 3e431107..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonEventHolder.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import lombok.Data; - -import java.io.Serializable; -import java.util.List; -import java.util.Set; - -@Data -public class DungeonEventHolder implements Serializable { - private long date; - private Set<String> players; - private List<DungeonEvent> eventDataList; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonMapUpdateEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonMapUpdateEvent.java deleted file mode 100644 index a29d2f01..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonMapUpdateEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class DungeonMapUpdateEvent implements DungeonEventData { - private byte[] map; - - @Override - public String getEventName() { - return "MAP_UPDATE"; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonNodataEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonNodataEvent.java deleted file mode 100644 index 4db127d6..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonNodataEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class DungeonNodataEvent implements DungeonEventData { - private String eventName; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonPuzzleFailureEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonPuzzleFailureEvent.java deleted file mode 100644 index 88d6377f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonPuzzleFailureEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class DungeonPuzzleFailureEvent implements DungeonEventData { - private String playerName; - private String message; - @Override - public String getEventName() { - return "PUZZLE_FAILURE"; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonRoomDiscoverEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonRoomDiscoverEvent.java deleted file mode 100644 index 8cec640c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonRoomDiscoverEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import lombok.AllArgsConstructor; -import lombok.Data; - -import java.awt.*; -import java.util.UUID; - -@Data -@AllArgsConstructor -public class DungeonRoomDiscoverEvent implements DungeonEventData { - private Point unitPt; - private int rotation; - private SerializableBlockPos min; - private SerializableBlockPos max; - private int shape; - private int color; - private UUID roomUID; - private String roomName; - private String roomProc; - - @Override - public String getEventName() { - return "ROOM_DISCOVER"; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonSecretCountChangeEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonSecretCountChangeEvent.java deleted file mode 100644 index 702d61ba..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonSecretCountChangeEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class DungeonSecretCountChangeEvent implements DungeonEventData { - private int prevCount; - private int newCount; - private int totalSecret; - private boolean sureTotalSecret; - - @Override - public String getEventName() { - return "SECRET_CNT_CHANGE"; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonStateChangeEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonStateChangeEvent.java deleted file mode 100644 index 16cb9661..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonStateChangeEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.events; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import lombok.AllArgsConstructor; -import lombok.Data; - -import java.awt.*; - -@Data -@AllArgsConstructor -public class DungeonStateChangeEvent implements DungeonEventData { - private Point unitPt; - private String roomName; - private DungeonRoom.RoomState from; - private DungeonRoom.RoomState to; - - @Override - public String getEventName() { - return "ROOM_STATE_CHANGE"; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java index 9f11cde9..64d4dc0b 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java @@ -1,32 +1,31 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionBreakWithSuperBoom; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.RouteBlocker; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -44,10 +43,10 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { if (state.equalsIgnoreCase("navigate")) { - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); int leastY = Integer.MAX_VALUE; OffsetPoint thatPt = null; @@ -72,8 +71,8 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { if (!isBlocking(dungeonRoom)) { return Collections.emptySet(); } - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); { ActionBreakWithSuperBoom actionClick; preRequisites.add(actionClick = new ActionBreakWithSuperBoom(getRepresentingPoint(dungeonRoom))); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java index 79ab6fcf..4cf779c4 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java @@ -19,12 +19,14 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.RouteBlocker; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; @@ -42,11 +44,11 @@ public class DungeonDoor implements DungeonMechanic, RouteBlocker { @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { if (!("open".equalsIgnoreCase(state) || "closed".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for door"); if (state.equalsIgnoreCase(getCurrentState(dungeonRoom))) return Collections.emptySet(); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); { if (state.equalsIgnoreCase("open")) { for (String str : openPreRequisite) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java index 79f079c1..60ca1b3a 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java @@ -1,31 +1,29 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionClick; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; import net.minecraft.util.BlockPos; @@ -43,10 +41,10 @@ public class DungeonDummy implements DungeonMechanic { @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { // if (!"navigate".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret"); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); if (state.equalsIgnoreCase("navigate")){ ActionMove actionMove = new ActionMove(secretPoint); preRequisites.add(actionMove); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java index 1c110bb5..0bbecfbd 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java @@ -1,38 +1,43 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionInteract; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionInteract; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMove; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateArmorStand; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; +import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import java.awt.*; +import java.util.ArrayList; +import java.util.HashSet; import java.util.List; -import java.util.*; +import java.util.Set; +import java.util.function.Predicate; @Data public class DungeonFairySoul implements DungeonMechanic { @@ -42,27 +47,25 @@ public class DungeonFairySoul implements DungeonMechanic { @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { - if (!"navigate".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret"); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); - { - ActionInteract actionClick= new ActionInteract(secretPoint); - actionClick.setPredicate(PredicateArmorStand.INSTANCE); - actionClick.setRadius(3); - preRequisites.add(actionClick); - preRequisites = actionClick.getPreRequisite(); - } - { - ActionMove actionMove = new ActionMove(secretPoint); - preRequisites.add(actionMove); - preRequisites = actionMove.getPreRequisite(); - } - { - for (String str : preRequisite) { - if (str.isEmpty()) continue; - ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); - preRequisites.add(actionChangeState); + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { + if (!"navigate".equalsIgnoreCase(state)) + throw new IllegalArgumentException(state + " is not valid state for secret"); + + Set<AbstractAction> base = new HashSet<>(); + ActionInteract actionClick = new ActionInteract(secretPoint); + actionClick.setPredicate((Predicate<Entity>) PredicateArmorStand.INSTANCE); + actionClick.setRadius(3); + base.add(actionClick); + + base = actionClick.getPreRequisite(); + ActionMove actionMove = new ActionMove(secretPoint); + base.add(actionMove); + base = actionMove.getPreRequisite(); + + for (String str : preRequisite) { + if (!str.isEmpty()) { + String[] split = str.split(":"); + base.add(new ActionChangeState(split[0], split[1])); } } return base; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java index f0edc4a6..897fad3d 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java @@ -19,12 +19,13 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMove; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; import net.minecraft.util.BlockPos; @@ -42,10 +43,10 @@ public class DungeonJournal implements DungeonMechanic { @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { if (!"navigate".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret"); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); { ActionMove actionMove = new ActionMove(secretPoint); preRequisites.add(actionMove); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java index 5bc1f650..a27bd833 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java @@ -19,10 +19,11 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.*; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; import net.minecraft.util.BlockPos; @@ -37,11 +38,11 @@ public class DungeonLever implements DungeonMechanic { private String triggering = ""; @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet(); if (state.equalsIgnoreCase("navigate")) { - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom)); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); @@ -54,8 +55,8 @@ public class DungeonLever implements DungeonMechanic { } if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret"); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); if (!state.equalsIgnoreCase(getCurrentState(dungeonRoom))){ ActionClick actionClick; preRequisites.add(actionClick = new ActionClick(leverPoint)); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java deleted file mode 100755 index 677a5489..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.mechanics; - -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; - -import java.awt.*; -import java.io.Serializable; -import java.util.Set; - -public interface DungeonMechanic extends Serializable { - Set<Action> getAction(String state, DungeonRoom dungeonRoom); - - void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks); - - String getCurrentState(DungeonRoom dungeonRoom); - - Set<String> getPossibleStates(DungeonRoom dungeonRoom); - Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom); - - OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java index e1fc4bfc..4eed8f27 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java @@ -19,15 +19,17 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionInteract; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionInteract; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMove; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateArmorStand; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; +import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import java.awt.*; @@ -35,36 +37,35 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.function.Predicate; @Data public class DungeonNPC implements DungeonMechanic { private static final long serialVersionUID = -89487601113028763L; - private OffsetPoint secretPoint = new OffsetPoint(0,0,0); + private OffsetPoint secretPoint = new OffsetPoint(0, 0, 0); private List<String> preRequisite = new ArrayList<String>(); @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { - if (!"navigate".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret"); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); - { - ActionInteract actionClick= new ActionInteract(secretPoint); - actionClick.setPredicate(PredicateArmorStand.INSTANCE); - actionClick.setRadius(3); - preRequisites.add(actionClick); - preRequisites = actionClick.getPreRequisite(); - } - { - ActionMove actionMove = new ActionMove(secretPoint); - preRequisites.add(actionMove); - preRequisites = actionMove.getPreRequisite(); - } - { - for (String str : preRequisite) { - if (str.isEmpty()) continue; - ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); - preRequisites.add(actionChangeState); + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { + if (!"navigate".equalsIgnoreCase(state)) + throw new IllegalArgumentException(state + " is not valid state for secret"); + + Set<AbstractAction> base = new HashSet<>(); + ActionInteract actionClick = new ActionInteract(secretPoint); + actionClick.setPredicate((Predicate<Entity>) PredicateArmorStand.INSTANCE); + actionClick.setRadius(3); + base.add(actionClick); + + base = actionClick.getPreRequisite(); + ActionMove actionMove = new ActionMove(secretPoint); + base.add(actionMove); + base = actionMove.getPreRequisite(); + + for (String str : preRequisite) { + if (!str.isEmpty()) { + String[] split = str.split(":"); + base.add(new ActionChangeState(split[0], split[1])); } } return base; @@ -73,9 +74,9 @@ public class DungeonNPC implements DungeonMechanic { @Override public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) { BlockPos pos = getSecretPoint().getBlockPos(dungeonRoom); - RenderUtils.highlightBlock(pos, color,partialTicks); - RenderUtils.drawTextAtWorld("F-"+name, pos.getX() +0.5f, pos.getY()+0.375f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); - RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.highlightBlock(pos, color, partialTicks); + RenderUtils.drawTextAtWorld("F-" + name, pos.getX() + 0.5f, pos.getY() + 0.375f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() + 0.5f, pos.getY() + 0f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); } @@ -96,10 +97,12 @@ public class DungeonNPC implements DungeonMechanic { public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { return Sets.newHashSet("navigate"); } + @Override public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { - return Sets.newHashSet("no-state","navigate"); + return Sets.newHashSet("no-state", "navigate"); } + @Override public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) { return secretPoint; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java index b97f84d0..af4b8f65 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java @@ -19,13 +19,15 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMoveNearestAir; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.RouteBlocker; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; @@ -42,10 +44,10 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker { @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { if (state.equalsIgnoreCase("navigate")) { - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom)); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); @@ -60,8 +62,8 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker { if (!isBlocking(dungeonRoom)) { return Collections.emptySet(); } - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); { for (String str : preRequisite) { if (str.isEmpty()) continue; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java index 8403efca..f3b641e2 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java @@ -19,10 +19,11 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.*; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; import net.minecraft.util.BlockPos; @@ -38,11 +39,11 @@ public class DungeonOnewayLever implements DungeonMechanic { private String triggering = ""; @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet(); if (state.equalsIgnoreCase("navigate")) { - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom)); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); @@ -54,8 +55,8 @@ public class DungeonOnewayLever implements DungeonMechanic { return base; } if (!("triggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret"); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); { ActionClick actionClick; preRequisites.add(actionClick = new ActionClick(leverPoint)); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java index 8d79d924..936dc00c 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java @@ -19,10 +19,11 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.*; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; import net.minecraft.util.BlockPos; @@ -33,16 +34,16 @@ import java.util.List; @Data public class DungeonPressurePlate implements DungeonMechanic { private static final long serialVersionUID = 7450034718355390645L; - private OffsetPoint platePoint = new OffsetPoint(0,0,0); + private OffsetPoint platePoint = new OffsetPoint(0, 0, 0); private List<String> preRequisite = new ArrayList<String>(); private String triggering = ""; @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet(); if (state.equalsIgnoreCase("navigate")) { - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom)); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); @@ -53,37 +54,35 @@ public class DungeonPressurePlate implements DungeonMechanic { } return base; } - if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret"); + if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) + throw new IllegalArgumentException(state + " is not valid state for secret"); if (state.equalsIgnoreCase(getCurrentState(dungeonRoom))) return Collections.emptySet(); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); if ("triggered".equalsIgnoreCase(state)) { ActionDropItem actionClick; preRequisites.add(actionClick = new ActionDropItem(platePoint)); preRequisites = actionClick.getPreRequisite(); } - { - ActionMove actionMove = new ActionMove(platePoint); - preRequisites.add(actionMove); - preRequisites = actionMove.getPreRequisite(); - } - { - for (String str : preRequisite) { - if (str.isEmpty()) continue; - ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); - preRequisites.add(actionChangeState); - } + ActionMove actionMove = new ActionMove(platePoint); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); } + return base; } @Override public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) { BlockPos pos = getPlatePoint().getBlockPos(dungeonRoom); - RenderUtils.highlightBlock(pos, color,partialTicks); - RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); - RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0.25f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.highlightBlock(pos, color, partialTicks); + RenderUtils.drawTextAtWorld(name, pos.getX() + 0.5f, pos.getY() + 0.75f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() + 0.5f, pos.getY() + 0.25f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); } public DungeonPressurePlate clone() throws CloneNotSupportedException { @@ -99,8 +98,7 @@ public class DungeonPressurePlate implements DungeonMechanic { public String getCurrentState(DungeonRoom dungeonRoom) { if (triggering == null) triggering = "null"; DungeonMechanic mechanic = dungeonRoom.getMechanics().get(triggering); - if (mechanic == null) - { + if (mechanic == null) { return "undeterminable"; } else { String state = mechanic.getCurrentState(dungeonRoom); @@ -121,10 +119,12 @@ public class DungeonPressurePlate implements DungeonMechanic { return Sets.newHashSet("navigate", "triggered"); return Sets.newHashSet("navigate"); } + @Override public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { return Sets.newHashSet("triggered", "untriggered"); } + @Override public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) { return platePoint; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java index 6b0d58f8..9a3bedcc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java @@ -19,12 +19,13 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMove; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonDoor; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Getter; import net.minecraft.util.BlockPos; @@ -40,15 +41,15 @@ public class DungeonRoomDoor implements DungeonMechanic { public DungeonRoomDoor(DungeonRoom dungeonRoom, DungeonDoor doorfinder) { this.doorfinder = doorfinder; if (doorfinder.isZDir()) { - if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(0,0,2))) - offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(0,0,2)); - else if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(0,0,-2))) - offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(0,0,-2)); + if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(0, 0, 2))) + offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(0, 0, 2)); + else if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(0, 0, -2))) + offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(0, 0, -2)); } else { - if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(2,0,0))) - offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(2,0,0)); - else if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(-2,0,0))) - offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(-2,0,0)); + if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(2, 0, 0))) + offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(2, 0, 0)); + else if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(-2, 0, 0))) + offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(-2, 0, 0)); } if (offsetPoint == null) { offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition()); @@ -56,24 +57,20 @@ public class DungeonRoomDoor implements DungeonMechanic { } @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { - if (!"navigate".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret"); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); - { - ActionMove actionMove = new ActionMove(offsetPoint); - preRequisites.add(actionMove); - preRequisites = actionMove.getPreRequisite(); - } - return base; + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { + if (!"navigate".equalsIgnoreCase(state)) + throw new IllegalArgumentException(state + " is not valid state for secret"); + Set<AbstractAction> preRequisites = new HashSet<>(); + preRequisites.add(new ActionMove(offsetPoint)); + return preRequisites; } @Override public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) { BlockPos pos = offsetPoint.getBlockPos(dungeonRoom); - RenderUtils.highlightBlock(pos, color,partialTicks); - RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); - RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0.25f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.highlightBlock(pos, color, partialTicks); + RenderUtils.drawTextAtWorld(name, pos.getX() + 0.5f, pos.getY() + 0.75f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() + 0.5f, pos.getY() + 0.25f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java index b03d5b3a..48ec30f6 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java @@ -1,70 +1,78 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.*; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonActionContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateBat; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.pathfinding.NodeProcessorDungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding.NodeProcessorDungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.entity.passive.EntityBat; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; import java.awt.*; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; @Data public class DungeonSecret implements DungeonMechanic { private static final long serialVersionUID = 8784808599222706537L; - private OffsetPoint secretPoint = new OffsetPoint(0,0,0); + private OffsetPoint secretPoint = new OffsetPoint(0, 0, 0); private SecretType secretType = SecretType.CHEST; private List<String> preRequisite = new ArrayList<String>(); public void tick(DungeonRoom dungeonRoom) { if (secretType == SecretType.CHEST) { BlockPos pos = secretPoint.getBlockPos(dungeonRoom); - IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); + IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos); if (blockState.getBlock() == Blocks.chest || blockState.getBlock() == Blocks.trapped_chest) { TileEntityChest chest = (TileEntityChest) dungeonRoom.getContext().getWorld().getTileEntity(pos); - if (chest.numPlayersUsing > 0) { - dungeonRoom.getRoomContext().put("c-"+pos.toString(), 2); + if(chest != null){ + if (chest.numPlayersUsing > 0) { + dungeonRoom.getRoomContext().put("c-" + pos.toString(), 2); + } else { + dungeonRoom.getRoomContext().put("c-" + pos.toString(), 1); + } } else { - dungeonRoom.getRoomContext().put("c-"+pos.toString(), 1); + System.out.println("Expected TileEntityChest at " + pos + " to not be null"); } } } else if (secretType == SecretType.ESSENCE) { BlockPos pos = secretPoint.getBlockPos(dungeonRoom); - IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); + IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos); if (blockState.getBlock() == Blocks.skull) { - dungeonRoom.getRoomContext().put("e-"+pos.toString(), true); + dungeonRoom.getRoomContext().put("e-" + pos.toString(), true); } } else if (secretType == SecretType.ITEM_DROP) { Vec3 pos = new Vec3(secretPoint.getBlockPos(dungeonRoom)); @@ -74,7 +82,7 @@ public class DungeonSecret implements DungeonMechanic { for (int i = 0; i < player.distanceTo(pos); i++) { Vec3 vec = player.addVector(vec3.xCoord * i, vec3.yCoord * i, vec3.zCoord * i); BlockPos bpos = new BlockPos(vec); - IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(bpos); + IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(bpos); if (!NodeProcessorDungeonRoom.isValidBlock(blockState)) return; } @@ -86,9 +94,9 @@ public class DungeonSecret implements DungeonMechanic { public SecretStatus getSecretStatus(DungeonRoom dungeonRoom) { if (secretType == SecretType.CHEST) { BlockPos pos = secretPoint.getBlockPos(dungeonRoom); - IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); - if (dungeonRoom.getRoomContext().containsKey("c-"+pos.toString())) - return ((int)dungeonRoom.getRoomContext().get("c-"+pos.toString()) == 2 || blockState.getBlock() == Blocks.air) ? SecretStatus.FOUND : SecretStatus.CREATED; + IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos); + if (dungeonRoom.getRoomContext().containsKey("c-" + pos.toString())) + return ((int) dungeonRoom.getRoomContext().get("c-" + pos.toString()) == 2 || blockState.getBlock() == Blocks.air) ? SecretStatus.FOUND : SecretStatus.CREATED; if (blockState.getBlock() == Blocks.air) { return SecretStatus.DEFINITELY_NOT; @@ -98,33 +106,33 @@ public class DungeonSecret implements DungeonMechanic { TileEntityChest chest = (TileEntityChest) dungeonRoom.getContext().getWorld().getTileEntity(pos); if (chest.numPlayersUsing > 0) { return SecretStatus.FOUND; - } else{ + } else { return SecretStatus.CREATED; } } } else if (secretType == SecretType.ESSENCE) { BlockPos pos = secretPoint.getBlockPos(dungeonRoom); - IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); + IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos); if (blockState.getBlock() == Blocks.skull) { - dungeonRoom.getRoomContext().put("e-"+pos.toString(), true); + dungeonRoom.getRoomContext().put("e-" + pos.toString(), true); return SecretStatus.DEFINITELY_NOT; } else { - if (dungeonRoom.getRoomContext().containsKey("e-"+pos.toString())) + if (dungeonRoom.getRoomContext().containsKey("e-" + pos.toString())) return SecretStatus.FOUND; return SecretStatus.NOT_SURE; } } else if (secretType == SecretType.BAT) { Vec3 spawn = new Vec3(secretPoint.getBlockPos(dungeonRoom)); - for (Integer killed : DungeonActionManager.getKilleds()) { - if (DungeonActionManager.getSpawnLocation().get(killed) == null) continue; - if (DungeonActionManager.getSpawnLocation().get(killed).squareDistanceTo(spawn) < 100) { + for (Integer killed : DungeonActionContext.getKilleds()) { + if (DungeonActionContext.getSpawnLocation().get(killed) == null) continue; + if (DungeonActionContext.getSpawnLocation().get(killed).squareDistanceTo(spawn) < 100) { return SecretStatus.FOUND; } } return SecretStatus.NOT_SURE; } else { Vec3 pos = new Vec3(secretPoint.getBlockPos(dungeonRoom)); - if (dungeonRoom.getRoomContext().containsKey("i-"+ pos)) + if (dungeonRoom.getRoomContext().containsKey("i-" + pos)) return SecretStatus.FOUND; Vec3 player = Minecraft.getMinecraft().thePlayer.getPositionVector(); if (player.squareDistanceTo(pos) < 16) { @@ -132,7 +140,7 @@ public class DungeonSecret implements DungeonMechanic { for (int i = 0; i < player.distanceTo(pos); i++) { Vec3 vec = player.addVector(vec3.xCoord * i, vec3.yCoord * i, vec3.zCoord * i); BlockPos bpos = new BlockPos(vec); - IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(bpos); + IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(bpos); if (!NodeProcessorDungeonRoom.isValidBlock(blockState)) return SecretStatus.NOT_SURE; } @@ -143,10 +151,10 @@ public class DungeonSecret implements DungeonMechanic { } @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { if (state.equalsIgnoreCase("navigate")) { - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom)); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); @@ -157,43 +165,43 @@ public class DungeonSecret implements DungeonMechanic { } return base; } - if (!"found".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret"); + if (!"found".equalsIgnoreCase(state)) + throw new IllegalArgumentException(state + " is not valid state for secret"); if (state.equals("found") && getSecretStatus(dungeonRoom) == SecretStatus.FOUND) return new HashSet<>(); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>(); if (secretType == SecretType.CHEST || secretType == SecretType.ESSENCE) { ActionClick actionClick; preRequisites.add(actionClick = new ActionClick(secretPoint)); preRequisites = actionClick.getPreRequisite(); } else if (secretType == SecretType.BAT) { - ActionKill actionKill; - preRequisites.add(actionKill = new ActionKill(secretPoint)); - actionKill.setPredicate(PredicateBat.INSTANCE); + ActionKill actionKill = new ActionKill(secretPoint); + preRequisites.add(actionKill); + actionKill.setPredicate(EntityBat.class::isInstance); actionKill.setRadius(10); preRequisites = actionKill.getPreRequisite(); } - { - ActionMove actionMove = new ActionMove(secretPoint); - preRequisites.add(actionMove); - preRequisites = actionMove.getPreRequisite(); - } - { - for (String str : preRequisite) { - if (str.isEmpty()) continue; - ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); - preRequisites.add(actionChangeState); - } + + ActionMove actionMove = new ActionMove(secretPoint); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); } + return base; } @Override public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) { BlockPos pos = getSecretPoint().getBlockPos(dungeonRoom); - RenderUtils.highlightBlock(pos, color,partialTicks); - RenderUtils.drawTextAtWorld(getSecretType().name(), pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); - RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0.375f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); - RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.highlightBlock(pos, color, partialTicks); + RenderUtils.drawTextAtWorld(getSecretType().name(), pos.getX() + 0.5f, pos.getY() + 0.75f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(name, pos.getX() + 0.5f, pos.getY() + 0.375f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() + 0.5f, pos.getY() + 0f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); } public enum SecretType { @@ -228,10 +236,12 @@ public class DungeonSecret implements DungeonMechanic { if (status == SecretStatus.FOUND) return Sets.newHashSet("navigate"); else return Sets.newHashSet("found", "navigate"); } + @Override public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { return Sets.newHashSet("found"/*, "definitely_not", "not_sure", "created", "error"*/); } + @Override public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) { return secretPoint; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java index e4dc79cb..b14ffaf3 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java @@ -1,32 +1,31 @@ /* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionBreakWithSuperBoom; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.RouteBlocker; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -40,14 +39,14 @@ import java.util.List; public class DungeonTomb implements DungeonMechanic, RouteBlocker { private static final long serialVersionUID = -7347076019472222115L; private OffsetPointSet secretPoint = new OffsetPointSet(); - private List<String> preRequisite = new ArrayList<String>(); + private List<String> preRequisite = new ArrayList<>(); @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) { if (state.equalsIgnoreCase("navigate")) { - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<>(); ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom)); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); @@ -58,29 +57,28 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { } return base; } - if (!"open".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for tomb"); + if (!"open".equalsIgnoreCase(state)) { + throw new IllegalArgumentException(state + " is not valid state for tomb"); + } if (!isBlocking(dungeonRoom)) { return Collections.emptySet(); } - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); - { - ActionBreakWithSuperBoom actionClick; - preRequisites.add(actionClick = new ActionBreakWithSuperBoom(secretPoint.getOffsetPointList().get(0))); - preRequisites = actionClick.getPreRequisite(); - } - { - ActionMoveNearestAir actionMove = new ActionMoveNearestAir(secretPoint.getOffsetPointList().get(0)); - preRequisites.add(actionMove); - preRequisites = actionMove.getPreRequisite(); - } - { - for (String str : preRequisite) { - if (str.isEmpty()) continue; - ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); - preRequisites.add(actionChangeState); - } + Set<AbstractAction> base; + Set<AbstractAction> preRequisites = base = new HashSet<>(); + + ActionBreakWithSuperBoom actionClick = new ActionBreakWithSuperBoom(secretPoint.getOffsetPointList().get(0)); + preRequisites.add(actionClick); + preRequisites = actionClick.getPreRequisite(); + + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(secretPoint.getOffsetPointList().get(0)); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); } + return base; } @@ -89,11 +87,11 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { if (secretPoint.getOffsetPointList().isEmpty()) return; OffsetPoint firstpt = secretPoint.getOffsetPointList().get(0); BlockPos pos = firstpt.getBlockPos(dungeonRoom); - RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); - RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0.25f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(name, pos.getX() + 0.5f, pos.getY() + 0.75f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() + 0.5f, pos.getY() + 0.25f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color,partialTicks); + RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color, partialTicks); } } @@ -108,7 +106,7 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { public DungeonTomb clone() throws CloneNotSupportedException { DungeonTomb dungeonSecret = new DungeonTomb(); dungeonSecret.secretPoint = (OffsetPointSet) secretPoint.clone(); - dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); + dungeonSecret.preRequisite = new ArrayList<>(preRequisite); return dungeonSecret; } @@ -117,13 +115,14 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { Block b = Blocks.air; if (!secretPoint.getOffsetPointList().isEmpty()) b = secretPoint.getOffsetPointList().get(0).getBlock(dungeonRoom); - return b == Blocks.air ?"open" :"closed"; + return b == Blocks.air ? "open" : "closed"; } @Override public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { return isBlocking(dungeonRoom) ? Sets.newHashSet("open", "navigate") : Sets.newHashSet("navigate"); } + @Override public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { return Sets.newHashSet("open", "closed"); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/RouteBlocker.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/RouteBlocker.java deleted file mode 100755 index e12d1269..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/RouteBlocker.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.dungeon.mechanics; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; - -public interface RouteBlocker { - boolean isBlocking(DungeonRoom dungeonRoom); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/DungeonMechanic.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/DungeonMechanic.java new file mode 100755 index 00000000..9aa18701 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/DungeonMechanic.java @@ -0,0 +1,40 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic; + +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; + +import java.awt.*; +import java.io.Serializable; +import java.util.Set; + +public interface DungeonMechanic extends Serializable { + Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom); + + void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks); + + String getCurrentState(DungeonRoom dungeonRoom); + + Set<String> getPossibleStates(DungeonRoom dungeonRoom); + Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom); + + OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/RouteBlocker.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/RouteBlocker.java new file mode 100755 index 00000000..faad723a --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/RouteBlocker.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; + +public interface RouteBlocker { + boolean isBlocking(DungeonRoom dungeonRoom); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java deleted file mode 100755 index ba126ac7..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ /dev/null @@ -1,579 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.eventlistener; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.Config; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.events.*; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor; -import kr.syeyoung.dungeonsguide.utils.MapUtils; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import lombok.Getter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.passive.EntityBat; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.Vec3; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import net.minecraftforge.event.entity.living.LivingDeathEvent; -import net.minecraftforge.event.entity.living.LivingEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.world.WorldEvent; -import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException; -import net.minecraftforge.fml.common.eventhandler.EventPriority; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.relauncher.Side; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -public class DungeonListener { - @SubscribeEvent - public void onWorldLoad(WorldEvent.Unload event) { - try { - Config.saveConfig(); - } catch (IOException e) { - e.printStackTrace(); - } - DungeonActionManager.getSpawnLocation().clear(); - DungeonActionManager.getKilleds().clear(); - } - - @SubscribeEvent - public void onPostDraw(GuiScreenEvent.DrawScreenEvent.Post e) { - try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - if (!skyblockStatus.isOnDungeon()) return; - - if (skyblockStatus.getContext() != null) { - DungeonContext context = skyblockStatus.getContext(); - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - if (thePlayer == null) return; - if (context.getBossfightProcessor() != null) context.getBossfightProcessor().onPostGuiRender(e); - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom != null && dungeonRoom.getRoomProcessor() != null) { - dungeonRoom.getRoomProcessor().onPostGuiRender(e); - } - } - GlStateManager.enableBlend(); - GlStateManager.color(1,1,1,1); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.enableAlpha(); - } catch (Throwable e2) {e2.printStackTrace(); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cDG HAS RAN INTO ERROR WHILE RENDERING SCREEN! Please report to support channel"));} - } - @SubscribeEvent - public void onEntityUpdate(LivingEvent.LivingUpdateEvent e) { - try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - if (!skyblockStatus.isOnDungeon()) return; - - if (skyblockStatus.getContext() != null) { - DungeonContext context = skyblockStatus.getContext(); - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - if (thePlayer == null) return; - if (context.getBossfightProcessor() != null) context.getBossfightProcessor().onEntityUpdate(e); - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom != null && dungeonRoom.getRoomProcessor() != null) { - dungeonRoom.getRoomProcessor().onEntityUpdate(e); - } - } - } catch (Throwable e2) {e2.printStackTrace();} - } - - boolean wasOnHypixel = false; - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent ev) throws Throwable { - try { - if (ev.side == Side.SERVER) return; - if (ev.phase == TickEvent.Phase.START) { - - - - - - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - { - boolean isOnDungeon = skyblockStatus.isOnDungeon(); - boolean isOnSkyblock = skyblockStatus.isOnSkyblock(); - skyblockStatus.updateStatus(); - - if (!wasOnHypixel && skyblockStatus.isOnHypixel()) { - MinecraftForge.EVENT_BUS.post(new HypixelJoinedEvent()); - } - wasOnHypixel = skyblockStatus.isOnHypixel(); - - if (isOnSkyblock && !skyblockStatus.isOnSkyblock()) { - MinecraftForge.EVENT_BUS.post(new SkyblockLeftEvent()); - } else if (!isOnSkyblock && skyblockStatus.isOnSkyblock()) { - MinecraftForge.EVENT_BUS.post(new SkyblockJoinedEvent()); - } - - if ((isOnDungeon && !skyblockStatus.isOnDungeon())) { - MinecraftForge.EVENT_BUS.post(new DungeonLeftEvent()); - skyblockStatus.setContext(null); - if (!FeatureRegistry.ADVANCED_DEBUGGABLE_MAP.isEnabled()) - MapUtils.clearMap(); - return; - } - if (isOnSkyblock) { - if (skyblockStatus.getContext() != null) { - skyblockStatus.getContext().tick(); - } else if (skyblockStatus.isOnDungeon()){ - skyblockStatus.setContext(new DungeonContext(Minecraft.getMinecraft().thePlayer.worldObj)); - MinecraftForge.EVENT_BUS.post(new DungeonStartedEvent()); - } - } - } - - if (!skyblockStatus.isOnDungeon()) return; - - if (skyblockStatus.getContext() != null) { - DungeonContext context = skyblockStatus.getContext(); - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - if (thePlayer == null) return; - if (context.getBossfightProcessor() != null) context.getBossfightProcessor().tick(); - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom != null && dungeonRoom.getRoomProcessor() != null) { - dungeonRoom.getRoomProcessor().tick(); - } - } - } - } catch (Throwable e2) { - if (e2 instanceof CustomModLoadingErrorDisplayException) throw e2; - e2.printStackTrace(); - } - } - - - @SubscribeEvent - public void onHypixelJoin(HypixelJoinedEvent skyblockJoinedEvent) { - if (DungeonsGuide.getDungeonsGuide().isFirstTimeUsingDG()) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fThank you for installing DungeonsGuide, the most intelligent skyblock dungeon mod!")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fThe gui for relocating GUI Elements and enabling or disabling features can be opened by typing §e/dg")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fType §e/dg help §fto view full list of commands offered by dungeons guide!")); - } - } - - @SubscribeEvent - public void onRender(RenderGameOverlayEvent.Post postRender) { - try { - if (!(postRender.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || postRender.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) return; - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnDungeon()) return; - - if (skyblockStatus.getContext() != null) { - DungeonContext context = skyblockStatus.getContext(); - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - if (context.getBossfightProcessor() != null) context.getBossfightProcessor().drawScreen(postRender.partialTicks); - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom != null) { - if (dungeonRoom.getRoomProcessor() != null) { - dungeonRoom.getRoomProcessor().drawScreen(postRender.partialTicks); - } - } - - } - GlStateManager.enableBlend(); - GlStateManager.color(1,1,1,1); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - Minecraft.getMinecraft().entityRenderer.setupOverlayRendering(); - GlStateManager.enableAlpha(); - } catch (Throwable e) { - e.printStackTrace();Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cDG HAS RAN INTO ERROR WHILE RENDERING SCREEN! Please report to support channel")); - } - } - - @SubscribeEvent(receiveCanceled = true, priority = EventPriority.HIGHEST) - public void onChatReceived(ClientChatReceivedEvent clientChatReceivedEvent) { - try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnDungeon()) return; - - if (clientChatReceivedEvent.type != 2 && clientChatReceivedEvent.message.getFormattedText().contains("§6> §e§lEXTRA STATS §6<")) { - MinecraftForge.EVENT_BUS.post(new DungeonEndedEvent()); - } - - DungeonContext context = skyblockStatus.getContext(); - - if (skyblockStatus.getContext() != null) { - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - try { - context.onChat(clientChatReceivedEvent); - } catch (Throwable t) { - t.printStackTrace(); - } - - if (context.getBossfightProcessor() != null) { - if (clientChatReceivedEvent.type == 2) - context.getBossfightProcessor().actionbarReceived(clientChatReceivedEvent.message); - else - context.getBossfightProcessor().chatReceived(clientChatReceivedEvent.message); - } - RoomProcessor roomProcessor = null; - try { - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom != null) { - if (dungeonRoom.getRoomProcessor() != null) { - if (clientChatReceivedEvent.type == 2) { - dungeonRoom.getRoomProcessor().actionbarReceived(clientChatReceivedEvent.message); - roomProcessor = dungeonRoom.getRoomProcessor(); - } else { - dungeonRoom.getRoomProcessor().chatReceived(clientChatReceivedEvent.message); - roomProcessor = dungeonRoom.getRoomProcessor(); - } - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - if (clientChatReceivedEvent.type == 2) return; - for (RoomProcessor globalRoomProcessor : context.getGlobalRoomProcessors()) { - if (globalRoomProcessor == roomProcessor) continue; - try { - globalRoomProcessor.chatReceived(clientChatReceivedEvent.message); - } catch (Throwable t) { - t.printStackTrace(); - } - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - - - @SubscribeEvent - public void onWorldRender(RenderWorldLastEvent renderWorldLastEvent) { - try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnDungeon()) return; - - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return; - if (FeatureRegistry.DEBUG.isEnabled()) { - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - for(DungeonDoor door : dungeonRoom.getDoors()) { - RenderUtils.renderDoor(door, renderWorldLastEvent.partialTicks); - } - } - } - - - if (skyblockStatus.getContext() != null) { - - if (context.getBossfightProcessor() != null) { - context.getBossfightProcessor().drawWorld(renderWorldLastEvent.partialTicks); - } - - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - if (dungeonRoom != null) { - if (dungeonRoom.getRoomProcessor() != null) { - dungeonRoom.getRoomProcessor().drawWorld(renderWorldLastEvent.partialTicks); - } - } - - if (FeatureRegistry.DEBUG.isEnabled() && dungeonRoom !=null) { - - Vec3 player = Minecraft.getMinecraft().thePlayer.getPositionVector(); - BlockPos real = new BlockPos(player.xCoord * 2, player.yCoord * 2, player.zCoord * 2); - for (BlockPos allInBox : BlockPos.getAllInBox(real.add(-1, -1, -1), real.add(1, 1, 1))) { - boolean blocked = dungeonRoom.isBlocked(allInBox.getX(), allInBox.getY(), allInBox.getZ()); - - RenderUtils.highlightBox( - AxisAlignedBB.fromBounds( - allInBox.getX() / 2.0 - 0.1, allInBox.getY() / 2.0 - 0.1, allInBox.getZ() / 2.0 - 0.1, - allInBox.getX() / 2.0 + 0.1, allInBox.getY() / 2.0 + 0.1, allInBox.getZ() / 2.0 + 0.1 - ), blocked ? new Color(0x55FF0000, true) : new Color(0x3300FF00, true), renderWorldLastEvent.partialTicks, false); - - } - } - - } - - if (EditingContext.getEditingContext() != null) { - GuiScreen guiScreen = EditingContext.getEditingContext().getCurrent(); - if (guiScreen instanceof GuiDungeonParameterEdit) { - ValueEdit valueEdit = ((GuiDungeonParameterEdit) guiScreen).getValueEdit(); - if (valueEdit != null) { - valueEdit.renderWorld(renderWorldLastEvent.partialTicks); - } - } else if (guiScreen instanceof GuiDungeonValueEdit) { - ValueEdit valueEdit = ((GuiDungeonValueEdit) guiScreen).getValueEdit(); - if (valueEdit != null) { - valueEdit.renderWorld(renderWorldLastEvent.partialTicks); - } - } else if (guiScreen instanceof GuiDungeonAddSet) { - ((GuiDungeonAddSet) guiScreen).onWorldRender(renderWorldLastEvent.partialTicks); - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - @SubscribeEvent() - public void onKey2(KeyBindPressedEvent keyInputEvent) { - try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnDungeon()) return; - - DungeonContext context = skyblockStatus.getContext(); - - if (skyblockStatus.getContext() != null) { - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - if (context.getBossfightProcessor() != null) { - context.getBossfightProcessor().onKeybindPress(keyInputEvent); - } - RoomProcessor roomProcessor = null; - try { - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom != null) { - if (dungeonRoom.getRoomProcessor() != null) { - dungeonRoom.getRoomProcessor().onKeybindPress(keyInputEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - @SubscribeEvent() - public void onInteract(PlayerInteractEntityEvent interact) { - try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnDungeon()) return; - - DungeonContext context = skyblockStatus.getContext(); - - if (skyblockStatus.getContext() != null) { - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - if (context.getBossfightProcessor() != null) { - context.getBossfightProcessor().onInteract(interact); - } - RoomProcessor roomProcessor = null; - try { - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom != null) { - if (dungeonRoom.getRoomProcessor() != null) { - dungeonRoom.getRoomProcessor().onInteract(interact); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - - @SubscribeEvent() - public void onBlockChange(BlockUpdateEvent.Post postInteract) { - try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnDungeon()) return; - - DungeonContext context = skyblockStatus.getContext(); - - if (skyblockStatus.getContext() != null) { - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - if (context.getBossfightProcessor() != null) { - context.getBossfightProcessor().onBlockUpdate(postInteract); - } - RoomProcessor roomProcessor = null; - try { - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom != null) { - if (dungeonRoom.getRoomProcessor() != null) { - dungeonRoom.getRoomProcessor().onBlockUpdate(postInteract); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - - @SubscribeEvent - public void onKeyInput(KeyBindPressedEvent keyInputEvent) { - if (FeatureRegistry.DEBUG.isEnabled() && FeatureRegistry.ADVANCED_ROOMEDIT.isEnabled() && keyInputEvent.getKey() == FeatureRegistry.ADVANCED_ROOMEDIT.<Integer>getParameter("key").getValue() ){ - EditingContext ec = EditingContext.getEditingContext(); - if (ec == null) { - DungeonContext context = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext(); - if (context == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Not in dungeons")); - return; - } - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - - if (dungeonRoom == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Can't determine the dungeon room you're in")); - return; - } - - if (EditingContext.getEditingContext() != null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("There is an editing session currently open.")); - return; - } - - EditingContext.createEditingContext(dungeonRoom); - EditingContext.getEditingContext().openGui(new GuiDungeonRoomEdit(dungeonRoom)); - } else ec.reopen(); - } - } - @SubscribeEvent - public void onInteract(PlayerInteractEvent keyInputEvent) { - try { - if (!keyInputEvent.world.isRemote) return; - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnDungeon()) return; - - DungeonContext context = skyblockStatus.getContext(); - - if (skyblockStatus.getContext() != null) { - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - if (context.getBossfightProcessor() != null) { - context.getBossfightProcessor().onInteractBlock(keyInputEvent); - } - RoomProcessor roomProcessor = null; - try { - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom != null) { - if (dungeonRoom.getRoomProcessor() != null) { - dungeonRoom.getRoomProcessor().onInteractBlock(keyInputEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - - @Getter - private final Map<Integer, Vec3> entityIdToPosMap = new HashMap<Integer, Vec3>(); - @SubscribeEvent - public void onEntitySpawn(EntityJoinWorldEvent spawn) { - DungeonActionManager.getSpawnLocation().put(spawn.entity.getEntityId(), new Vec3(spawn.entity.posX, spawn.entity.posY, spawn.entity.posZ)); - } - - - @SubscribeEvent - public void onEntityDeSpawn(LivingDeathEvent deathEvent) { - if (deathEvent.entityLiving instanceof EntityBat) - DungeonActionManager.getKilleds().add(deathEvent.entity.getEntityId()); - - try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnDungeon()) return; - - DungeonContext context = skyblockStatus.getContext(); - - if (skyblockStatus.getContext() != null) { - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - - if (context.getBossfightProcessor() != null) { - context.getBossfightProcessor().onEntityDeath(deathEvent); - } - RoomProcessor roomProcessor = null; - try { - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom != null) { - if (dungeonRoom.getRoomProcessor() != null) { - dungeonRoom.getRoomProcessor().onEntityDeath(deathEvent); - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - - if (!(deathEvent.entityLiving instanceof EntityBat)) - DungeonActionManager.getSpawnLocation().remove(deathEvent.entity.getEntityId()); - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/BossroomEnterEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/BossroomEnterEvent.java deleted file mode 100644 index d02e8f84..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/BossroomEnterEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import net.minecraftforge.fml.common.eventhandler.Event; - -public class BossroomEnterEvent extends Event { -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonContextInitializationEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonContextInitializationEvent.java deleted file mode 100644 index 81ceffed..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonContextInitializationEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import net.minecraftforge.fml.common.eventhandler.Event; - -public class DungeonContextInitializationEvent extends Event { -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonEndedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonEndedEvent.java deleted file mode 100644 index 7430389f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonEndedEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import net.minecraftforge.fml.common.eventhandler.Event; - -public class DungeonEndedEvent extends Event { -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonLeftEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonLeftEvent.java deleted file mode 100644 index a0abaea8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonLeftEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import net.minecraftforge.fml.common.eventhandler.Event; - -public class DungeonLeftEvent extends Event { -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonStartedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonStartedEvent.java deleted file mode 100644 index 6fc7dd02..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DungeonStartedEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import net.minecraftforge.fml.common.eventhandler.Event; - -public class DungeonStartedEvent extends Event { -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/HypixelJoinedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/HypixelJoinedEvent.java deleted file mode 100644 index c442ca62..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/HypixelJoinedEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import net.minecraftforge.fml.common.eventhandler.Event; - -public class HypixelJoinedEvent extends Event { -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/PlayerInteractEntityEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/PlayerInteractEntityEvent.java deleted file mode 100644 index e11bf0cb..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/PlayerInteractEntityEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.entity.Entity; -import net.minecraftforge.fml.common.eventhandler.Event; - -@AllArgsConstructor -public class PlayerInteractEntityEvent extends Event { - - @Getter @Setter - private boolean attack; - @Getter @Setter - private Entity entity; - - @Override - public boolean isCancelable() { - return true; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockJoinedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockJoinedEvent.java deleted file mode 100644 index 4a04d55c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockJoinedEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import net.minecraftforge.fml.common.eventhandler.Event; - -public class SkyblockJoinedEvent extends Event { -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockLeftEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockLeftEvent.java deleted file mode 100644 index 5055b1bc..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/SkyblockLeftEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import net.minecraftforge.fml.common.eventhandler.Event; - -public class SkyblockLeftEvent extends Event { -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/StompConnectedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/StompConnectedEvent.java deleted file mode 100644 index 50eba951..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/StompConnectedEvent.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import kr.syeyoung.dungeonsguide.stomp.StompInterface; -import lombok.AllArgsConstructor; -import lombok.Data; -import net.minecraftforge.fml.common.eventhandler.Event; - -@Data -@AllArgsConstructor -public class StompConnectedEvent extends Event { - private StompInterface stompInterface; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/TitleEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/TitleEvent.java deleted file mode 100644 index 0559524c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/TitleEvent.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import lombok.AllArgsConstructor; -import lombok.Data; -import net.minecraft.network.play.server.S45PacketTitle; -import net.minecraftforge.fml.common.eventhandler.Event; - -@Data -@AllArgsConstructor -public class TitleEvent extends Event { - S45PacketTitle packetTitle; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/WindowUpdateEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/events/WindowUpdateEvent.java deleted file mode 100644 index 5715687b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/WindowUpdateEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.events; - -import lombok.AllArgsConstructor; -import lombok.Data; -import net.minecraft.network.play.server.S2FPacketSetSlot; -import net.minecraft.network.play.server.S30PacketWindowItems; -import net.minecraftforge.fml.common.eventhandler.Event; - -@Data -@AllArgsConstructor -public class WindowUpdateEvent extends Event { - S30PacketWindowItems windowItems; - S2FPacketSetSlot packetSetSlot; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java deleted file mode 100644 index b7beb540..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features; - -import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureDebug; -import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureDebuggableMap; -import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomCoordDisplay; -import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomDebugInfo; -import kr.syeyoung.dungeonsguide.features.impl.boss.*; -import kr.syeyoung.dungeonsguide.features.impl.boss.terminal.FeatureSimonSaysSolver; -import kr.syeyoung.dungeonsguide.features.impl.boss.terminal.FeatureTerminalSolvers; -import kr.syeyoung.dungeonsguide.features.impl.cosmetics.FeatureNicknameColor; -import kr.syeyoung.dungeonsguide.features.impl.cosmetics.FeatureNicknamePrefix; -import kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer.PartyInviteViewer; -import kr.syeyoung.dungeonsguide.features.impl.discord.onlinealarm.PlayingDGAlarm; -import kr.syeyoung.dungeonsguide.features.impl.dungeon.*; -import kr.syeyoung.dungeonsguide.features.impl.etc.*; -import kr.syeyoung.dungeonsguide.features.impl.etc.ability.FeatureAbilityCooldown; -import kr.syeyoung.dungeonsguide.features.impl.party.APIKey; -import kr.syeyoung.dungeonsguide.features.impl.party.FeaturePartyList; -import kr.syeyoung.dungeonsguide.features.impl.party.FeaturePartyReady; -import kr.syeyoung.dungeonsguide.features.impl.party.customgui.FeatureCustomPartyFinder; -import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.FeatureViewPlayerOnJoin; -import kr.syeyoung.dungeonsguide.features.impl.secret.*; -import kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser.FeatureMechanicBrowse; -import kr.syeyoung.dungeonsguide.features.impl.solvers.*; -import kr.syeyoung.dungeonsguide.features.impl.dungeon.*; -import kr.syeyoung.dungeonsguide.features.impl.solvers.*; -import lombok.Getter; -import org.lwjgl.input.Keyboard; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class FeatureRegistry { - @Getter - private static final List<AbstractFeature> featureList = new ArrayList<AbstractFeature>(); - private static final Map<String, AbstractFeature> featureByKey = new HashMap<String, AbstractFeature>(); - @Getter - private static final Map<String, List<AbstractFeature>> featuresByCategory = new HashMap<String, List<AbstractFeature>>(); - @Getter - private static final Map<String, String> categoryDescription = new HashMap<>(); - - public static AbstractFeature getFeatureByKey(String key) { - return featureByKey.get(key); - } - - public static <T extends AbstractFeature> T register(T abstractFeature) { - if (featureByKey.containsKey(abstractFeature.getKey())) throw new IllegalArgumentException("DUPLICATE FEATURE DEFINITION"); - featureList.add(abstractFeature); - featureByKey.put(abstractFeature.getKey(), abstractFeature); - List<AbstractFeature> features = featuresByCategory.get(abstractFeature.getCategory()); - if (features == null) - features = new ArrayList<AbstractFeature>(); - features.add(abstractFeature); - featuresByCategory.put(abstractFeature.getCategory(), features); - - return abstractFeature; - } - - - - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_GLOBAL = register(new PathfindLineProperties("Dungeon Secrets", "Global Line Settings", "Global Line Settings", "secret.lineproperties.global", true, null)); - - - public static final FeatureMechanicBrowse SECRET_BROWSE = register(new FeatureMechanicBrowse()); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_SECRET_BROWSER = register(new PathfindLineProperties("Dungeon Secrets.Secret Browser", "Line Settings", "Line Settings when pathfinding using Secret Browser", "secret.lineproperties.secretbrowser", true, SECRET_LINE_PROPERTIES_GLOBAL)); - public static final FeatureActions SECRET_ACTIONS = register(new FeatureActions()); - - public static final FeaturePathfindStrategy SECRET_PATHFIND_STRATEGY = register(new FeaturePathfindStrategy()); - public static final FeatureTogglePathfind SECRET_TOGGLE_KEY = register(new FeatureTogglePathfind()); - public static final FeatureFreezePathfind SECRET_FREEZE_LINES = register(new FeatureFreezePathfind()); - public static final FeatureCreateRefreshLine SECRET_CREATE_REFRESH_LINE = register(new FeatureCreateRefreshLine()); - static { - categoryDescription.put("ROOT.Dungeon Secrets.Keybinds", "Useful keybinds / Toggle Pathfind lines, Freeze Pathfind lines, Refresh pathfind line or Trigger pathfind (you would want to use it, if you're using Pathfind to All)"); - } - - - public static final SimpleFeature SECRET_AUTO_BROWSE_NEXT = register(new SimpleFeature("Dungeon Secrets.Legacy AutoPathfind", "Auto Pathfind to next secret", "Auto browse best next secret after current one completes.\nthe first pathfinding of first secret needs to be triggered first in order for this option to work", "secret.autobrowse", false)); - public static final SimpleFeature SECRET_AUTO_START = register(new SimpleFeature("Dungeon Secrets.Legacy AutoPathfind", "Auto pathfind to new secret", "Auto browse best secret upon entering the room.", "secret.autouponenter", false)); - public static final SimpleFeature SECRET_NEXT_KEY = register(new SimpleFeature("Dungeon Secrets.Legacy AutoPathfind", "Auto Pathfind to new secret upon pressing a key", "Auto browse the best next secret when you press key.\nPress settings to edit the key", "secret.keyfornext", false) { - { - parameters.put("key", new FeatureParameter<Integer>("key", "Key","Press to navigate to next best secret", Keyboard.KEY_NONE, "keybind")); - } - }); - - public static final SimpleFeature SECRET_BLOOD_RUSH = register(new FeatureBloodRush()); - public static final PathfindLineProperties SECRET_BLOOD_RUSH_LINE_PROPERTIES = register(new PathfindLineProperties("Dungeon Secrets.Blood Rush", "Blood Rush Line Settings", "Line Settings to be used", "secret.lineproperties.bloodrush", false, SECRET_LINE_PROPERTIES_GLOBAL)); - - - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_AUTOPATHFIND = register(new PathfindLineProperties("Dungeon Secrets.Legacy AutoPathfind", "Line Settings", "Line Settings when pathfinding using above features", "secret.lineproperties.autopathfind", true, SECRET_LINE_PROPERTIES_GLOBAL)); - - public static final FeaturePathfindToAll SECRET_PATHFIND_ALL = register(new FeaturePathfindToAll()); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Parent Line Settings", "Line Settings to be used by default", "secret.lineproperties.apf.parent", false, SECRET_LINE_PROPERTIES_GLOBAL)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_BAT = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Bat Line Settings", "Line Settings when pathfind to Bat, when using above feature", "secret.lineproperties.apf.bat", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_CHEST = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Chest Line Settings", "Line Settings when pathfind to Chest, when using above feature", "secret.lineproperties.apf.chest", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_ESSENCE = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Essence Line Settings", "Line Settings when pathfind to Essence, when using above feature", "secret.lineproperties.apf.essence", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_ITEM_DROP = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Item Drop Line Settings", "Line Settings when pathfind to Item Drop, when using above feature", "secret.lineproperties.apf.itemdrop", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); - - public static final FeatureSolverRiddle SOLVER_RIDDLE = register(new FeatureSolverRiddle()); - public static final FeatureSolverTictactoe SOLVER_TICTACTOE = register(new FeatureSolverTictactoe()); - public static final SimpleFeature SOLVER_WATERPUZZLE = register(new SimpleFeature("Solver.Any Floor", "Waterboard (Advanced)", "Calculates solution for waterboard puzzle and displays it to user", "solver.waterboard")); - public static final SimpleFeature SOLVER_CREEPER = register(new SimpleFeature("Solver.Any Floor", "Creeper", "Draws line between prismarine lamps in creeper room", "solver.creeper")); - public static final FeatureSolverTeleport SOLVER_TELEPORT = register(new FeatureSolverTeleport()); - public static final FeatureSolverBlaze SOLVER_BLAZE = register(new FeatureSolverBlaze()); - public static final FeatureSolverIcefill SOLVER_ICEPATH = register(new FeatureSolverIcefill()); - public static final FeatureSolverSilverfish SOLVER_SILVERFISH = register(new FeatureSolverSilverfish()); - public static final FeatureSolverBox SOLVER_BOX = register(new FeatureSolverBox()); - public static final FeatureSolverKahoot SOLVER_KAHOOT = register(new FeatureSolverKahoot()); - public static final FeatureSolverBombdefuse SOLVER_BOMBDEFUSE = register(new FeatureSolverBombdefuse()); - - - public static final FeatureDungeonMap DUNGEON_MAP = register(new FeatureDungeonMap()); - public static final FeatureDungeonRoomName DUNGEON_ROOMNAME = register(new FeatureDungeonRoomName()); - public static final FeaturePressAnyKeyToCloseChest DUNGEON_CLOSECHEST = register(new FeaturePressAnyKeyToCloseChest()); - public static final FeatureBoxSkelemaster DUNGEON_BOXSKELEMASTER = register(new FeatureBoxSkelemaster()); - public static final FeatureBoxBats DUNGEON_BOXBAT = register(new FeatureBoxBats()); - public static final FeatureBoxStarMobs DUNGEON_BOXSTARMOBS = register(new FeatureBoxStarMobs()); - public static final FeatureWatcherWarning DUNGEON_WATCHERWARNING = register(new FeatureWatcherWarning()); - public static final FeatureDungeonDeaths DUNGEON_DEATHS = register(new FeatureDungeonDeaths()); - public static final FeatureDungeonMilestone DUNGEON_MILESTONE = register(new FeatureDungeonMilestone()); - public static final FeatureDungeonRealTime DUNGEON_REALTIME = register(new FeatureDungeonRealTime()); - public static final FeatureDungeonSBTime DUNGEON_SBTIME = register(new FeatureDungeonSBTime()); - public static final FeatureDungeonSecrets DUNGEON_SECRETS = register(new FeatureDungeonSecrets()); - public static final FeatureDungeonCurrentRoomSecrets DUNGEON_SECRETS_ROOM = register(new FeatureDungeonCurrentRoomSecrets()); - public static final FeatureDungeonTombs DUNGEON_TOMBS = register(new FeatureDungeonTombs()); - public static final FeatureDungeonScore DUNGEON_SCORE = register(new FeatureDungeonScore()); - public static final FeatureWarnLowHealth DUNGEON_LOWHEALTH_WARN = register(new FeatureWarnLowHealth()); - public static final SimpleFeature DUNGEON_INTERMODCOMM = register(new SimpleFeature("Dungeon.Teammates", "Communicate With Other's Dungeons Guide", "Sends total secret in the room to others\nSo that they can use the data to calculate total secret in dungeon run\n\nThis automates player chatting action, (chatting data) Thus it might be against hypixel's rules.\nBut mods like auto-gg which also automate player action and is kinda allowed mod exist so I'm leaving this feature.\nThis option is use-at-your-risk and you'll be responsible for ban if you somehow get banned because of this feature\n(Although it is not likely to happen)\nDefaults to off", "dungeon.intermodcomm", false)); - public static final FeaturePlayerESP DUNGEON_PLAYERESP = register(new FeaturePlayerESP()); - public static final FeatureHideNameTags DUNGEON_HIDENAMETAGS = register(new FeatureHideNameTags()); - public static final FeatureSoulRoomWarning DUNGEON_FAIRYSOUL = register(new FeatureSoulRoomWarning()); - - public static final FeatureWarningOnPortal BOSSFIGHT_WARNING_ON_PORTAL = register(new FeatureWarningOnPortal()); - public static final SimpleFeature BOSSFIGHT_CHESTPRICE = register(new FeatureChestPrice()); - public static final FeatureAutoReparty BOSSFIGHT_AUTOREPARTY = register(new FeatureAutoReparty()); - public static final FeatureBossHealth BOSSFIGHT_HEALTH = register(new FeatureBossHealth()); - public static final FeatureHideAnimals BOSSFIGHT_HIDE_ANIMALS = register(new FeatureHideAnimals()); - public static final FeatureThornBearPercentage BOSSFIGHT_BEAR_PERCENT = register(new FeatureThornBearPercentage()); - public static final FeatureThornSpiritBowTimer BOSSFIGHT_BOW_TIMER = register(new FeatureThornSpiritBowTimer()); - public static final FeatureBoxRealLivid BOSSFIGHT_BOX_REALLIVID = register(new FeatureBoxRealLivid()); - public static final FeatureTerracotaTimer BOSSFIGHT_TERRACOTTA_TIMER = register(new FeatureTerracotaTimer()); - public static final FeatureCurrentPhase BOSSFIGHT_CURRENT_PHASE = register(new FeatureCurrentPhase()); - public static final FeatureTerminalSolvers BOSSFIGHT_TERMINAL_SOLVERS = register(new FeatureTerminalSolvers()); - public static final FeatureSimonSaysSolver BOSSFIGHT_SIMONSAYS_SOLVER = register(new FeatureSimonSaysSolver()); - - public static final APIKey PARTYKICKER_APIKEY = register(new APIKey()); - public static final FeatureViewPlayerOnJoin PARTYKICKER_VIEWPLAYER = register(new FeatureViewPlayerOnJoin()); - public static final FeatureCustomPartyFinder PARTYKICKER_CUSTOM = register(new FeatureCustomPartyFinder()); - public static final FeaturePartyList PARTY_LIST = register(new FeaturePartyList()); - public static final FeaturePartyReady PARTY_READY = register(new FeaturePartyReady()); - - public static final FeatureTooltipDungeonStat ETC_DUNGEONSTAT = register(new FeatureTooltipDungeonStat()); - public static final FeatureTooltipPrice ETC_PRICE = register(new FeatureTooltipPrice()); - public static final FeatureAbilityCooldown ETC_ABILITY_COOLDOWN = register(new FeatureAbilityCooldown()); - public static final FeatureCooldownCounter ETC_COOLDOWN = register(new FeatureCooldownCounter()); - public static final FeatureRepartyCommand ETC_REPARTY = register(new FeatureRepartyCommand()); - public static final FeatureDecreaseExplosionSound ETC_EXPLOSION_SOUND = register(new FeatureDecreaseExplosionSound()); - public static final FeatureAutoAcceptReparty ETC_AUTO_ACCEPT_REPARTY = register(new FeatureAutoAcceptReparty()); - public static final FeatureUpdateAlarm ETC_TEST = register(new FeatureUpdateAlarm()); - - public static final SimpleFeature FIX_SPIRIT_BOOTS = register(new SimpleFeature("Misc", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true)); - public static final FeatureDisableMessage FIX_MESSAGES = register(new FeatureDisableMessage()); - - public static final FeatureCopyMessages ETC_COPY_MSG = register(new FeatureCopyMessages()); - - public static final FeaturePenguins ETC_PENGUIN = register(new FeaturePenguins()); - - public static final FeatureCollectScore ETC_COLLECT_SCORE = register(new FeatureCollectScore()); - - - - - - public static final FeatureNicknamePrefix COSMETIC_PREFIX = register(new FeatureNicknamePrefix()); - public static final FeatureNicknameColor COSMETIC_NICKNAMECOLOR = register(new FeatureNicknameColor()); - - - - public static final SimpleFeature DISCORD_RICHPRESENCE = register(new SimpleFeature("Discord", "Discord RPC", "Enable Discord rich presence", "advanced.richpresence", true) { - { - parameters.put("disablenotskyblock", new FeatureParameter<Boolean>("disablenotskyblock", "Disable When not on Skyblock", "Disable When not on skyblock", false, "boolean")); - } - }); - public static final PartyInviteViewer DISCORD_ASKTOJOIN = register(new PartyInviteViewer()); - public static final PlayingDGAlarm DISCORD_ONLINEALARM = register(new PlayingDGAlarm()); - public static final SimpleFeature DISCORD_DONOTUSE = register(new SimpleFeature("Discord", "Disable Native Library", "Disables usage of jna for discord rpc support.\nBreaks any discord related feature in the mod.\nRequires mod restart to get affected.\n\nThis feature is only for those whose minecraft crashes due to discord gamesdk crash.", "discord.rpc", false)); - - - public static final SimpleFeature DEBUG = register(new FeatureDebug()); - public static final SimpleFeature ADVANCED_ROOMEDIT = register(new SimpleFeature("Advanced", "Room Edit", "Allow editing dungeon rooms\n\nWarning: using this feature can break or freeze your Minecraft\nThis is only for advanced users only", "advanced.roomedit", false){ - { - parameters.put("key", new FeatureParameter<Integer>("key", "Key","Press to edit room", Keyboard.KEY_R, "keybind")); - } - }); - - public static final FeatureRoomDebugInfo ADVANCED_DEBUG_ROOM = register(new FeatureRoomDebugInfo()); - public static final FeatureDebuggableMap ADVANCED_DEBUGGABLE_MAP = register(new FeatureDebuggableMap()); - public static final FeatureRoomCoordDisplay ADVANCED_COORDS = register(new FeatureRoomCoordDisplay()); - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/SimpleFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/SimpleFeature.java deleted file mode 100644 index 11adeb67..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/SimpleFeature.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features; - -public class SimpleFeature extends AbstractFeature { - protected SimpleFeature(String category, String name, String key) { - this(category, name, name, key); - } - protected SimpleFeature(String category, String name, String description, String key) { - this(category, name, description, key, true); - } - - protected SimpleFeature(String category, String name, String description, String key, boolean enabled) { - super(category, name, description, key); - this.setEnabled(enabled); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebug.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebug.java deleted file mode 100644 index 3e8b0a09..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebug.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.advanced; - -import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; - -public class FeatureDebug extends SimpleFeature { - public FeatureDebug() { - super("Advanced", "Debug", "Toggles debug mode", "debug", false); - parameters.put("Key", new FeatureParameter<String>("Key", "Secret Key given by syeyoung", "Put the debug enable key here to enable debug mode", "","string")); - } - @Override - public boolean isEnabled() { - return "just hide it".equals(this.<String>getParameter("Key").getValue()); - } - @Override - public boolean isDisyllable() { - return false; - } - - @Override - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { - @Override - public MPanel get() { - MFeatureEdit featureEdit = new MFeatureEdit(FeatureDebug.this, rootConfigPanel); - for (FeatureParameter parameter: getParameters()) { - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureDebug.this, parameter, rootConfigPanel)); - } - featureEdit.addParameterEdit("IsEnabled", new MParameterEdit(FeatureDebug.this, new FeatureParameter("Key Status", "Key Status", "Key Enabled? Or not?", "", "idk"), rootConfigPanel, new MLabel() { - @Override - public String getText() { - return isEnabled() ? "Enabled!" : "Incorrect Key"; - } - }, (a) -> false)); - return featureEdit; - } - }); - return "base." + getKey() ; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java deleted file mode 100644 index 837b3d71..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.EntityLivingRenderListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; -import net.minecraft.entity.passive.*; -import net.minecraftforge.client.event.RenderLivingEvent; - - -public class FeatureHideAnimals extends SimpleFeature implements EntityLivingRenderListener { - public FeatureHideAnimals() { - super("Bossfight.Floor 4", "Hide animals on f4", "Hide Spirit Animals on F4. \nClick on Edit for precise setting", "bossfight.hideanimals", false); - parameters.put("sheep", new FeatureParameter<Boolean>("sheep", "Hide Sheeps", "Hide Sheeps", true, "boolean")); - parameters.put("cow", new FeatureParameter<Boolean>("cow", "Hide Cows", "Hide Cows", true, "boolean")); - parameters.put("chicken", new FeatureParameter<Boolean>("chicken", "Hide Chickens", "Hide Chickens", true, "boolean")); - parameters.put("wolf", new FeatureParameter<Boolean>("wolf", "Hide Wolves", "Hide Wolves", true, "boolean")); - parameters.put("rabbit", new FeatureParameter<Boolean>("rabbit", "Hide Rabbits", "Hide Rabbits", true, "boolean")); - } - - - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - @Override - public void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent) { - if (!isEnabled()) return; - if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null) return; - if (skyblockStatus.getContext().getBossfightProcessor() == null) return; - if (!(skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; - - if (renderPlayerEvent.entity instanceof EntitySheep && this.<Boolean>getParameter("sheep").getValue()) { - renderPlayerEvent.setCanceled(true); - } else if (renderPlayerEvent.entity instanceof EntityCow && this.<Boolean>getParameter("cow").getValue() ) { - renderPlayerEvent.setCanceled(true); - } else if (renderPlayerEvent.entity instanceof EntityChicken && this.<Boolean>getParameter("chicken").getValue()) { - renderPlayerEvent.setCanceled(true); - } else if (renderPlayerEvent.entity instanceof EntityWolf && this.<Boolean>getParameter("wolf").getValue()) { - renderPlayerEvent.setCanceled(true); - } else if (renderPlayerEvent.entity instanceof EntityRabbit && this.<Boolean>getParameter("rabbit").getValue()) { - renderPlayerEvent.setCanceled(true); - } - } - - @Override - public void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent) { - - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolution.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolution.java deleted file mode 100644 index a3f3f558..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolution.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import lombok.Data; -import net.minecraft.inventory.Slot; - -import java.util.List; - -@Data -public class TerminalSolution { - private List<Slot> currSlots; - private List<Slot> nextSlots; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolutionProvider.java deleted file mode 100644 index b04b5094..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolutionProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.Slot; - -import java.util.List; - -public interface TerminalSolutionProvider { - TerminalSolution provideSolution(ContainerChest chest, List<Slot> clicked); - boolean isApplicable(ContainerChest chest); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureCollectScore.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureCollectScore.java deleted file mode 100644 index 897d8b64..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureCollectScore.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureCollectScore extends SimpleFeature { - public FeatureCollectScore() { - super("Misc", "Collect Speed Score", "Collect Speed score, run time, and floor and send that to developer's server for speed formula. This data is completely anonymous, opt out of the feature by disabling this feature", "misc.gatherscoredata", true); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java deleted file mode 100644 index 62074c32..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import com.google.common.collect.ComparisonChain; -import com.google.common.collect.Ordering; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.BossroomEnterListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.BossroomEnterListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.block.material.MapColor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EnumPlayerModelParts; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec4b; -import net.minecraft.world.WorldSettings; -import net.minecraft.world.storage.MapData; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.jetbrains.annotations.Nullable; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import javax.vecmath.Vector2d; -import java.awt.*; -import java.util.Comparator; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, DungeonStartListener, BossroomEnterListener { - public FeatureDungeonMap() { - super("Dungeon", "Dungeon Map", "Display dungeon map!", "dungeon.map", true, 128, 128); - this.setEnabled(false); - parameters.put("scale", new FeatureParameter<>("scale", "Scale map", "Whether to scale map to fit screen", true, "boolean")); - parameters.put("playerCenter", new FeatureParameter<>("playerCenter", "Center map at player", "Render you in the center", false, "boolean")); - parameters.put("rotate", new FeatureParameter<>("rotate", "Rotate map centered at player", "Only works with Center map at player enabled", false, "boolean")); - parameters.put("postScale", new FeatureParameter<>("postScale", "Scale factor of map", "Only works with Center map at player enabled", 1.0f, "float")); - parameters.put("useplayerheads", new FeatureParameter<>("useplayerheads", "Use player heads instead of arrows", "Option to use player heads instead of arrows", true, "boolean")); - parameters.put("showotherplayers", new FeatureParameter<>("showotherplayers", "Show other players", "Option to show other players in map", true, "boolean")); - parameters.put("showtotalsecrets", new FeatureParameter<>("showtotalsecrets", "Show Total secrets in the room", "Option to overlay total secrets in the specific room", true, "boolean")); - parameters.put("playerheadscale", new FeatureParameter<>("playerheadscale", "Player head scale", "Scale factor of player heads, defaults to 1", 1.0f, "float")); - parameters.put("textScale", new FeatureParameter<>("textScale", "Text scale", "Scale factor of texts on map, defaults to 1", 1.0f, "float")); - - parameters.put("border_color", new FeatureParameter<>("border_color", "Color of the border", "Same as name", new AColor(255, 255, 255, 255), "acolor")); - parameters.put("background_color", new FeatureParameter<>("background_color", "Color of the background", "Same as name", new AColor(0x22000000, true), "acolor")); - parameters.put("player_color", new FeatureParameter<>("player_color", "Color of the player border", "Same as name", new AColor(255, 255, 255, 0), "acolor")); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - public static final Ordering<NetworkPlayerInfo> field_175252_a = Ordering.from(new PlayerComparator()); - - private boolean on = false; - - @Override - public void onDungeonEnd() { - on = false; - } - - @Override - public void onDungeonStart() { - on = true; - } - - @Override - public void onBossroomEnter() { - on = false; - } - - @SideOnly(Side.CLIENT) - static class PlayerComparator implements Comparator<NetworkPlayerInfo> { - private PlayerComparator() { - } - - public int compare(NetworkPlayerInfo compare1, NetworkPlayerInfo compare2) { - ScorePlayerTeam scoreplayerteam = compare1.getPlayerTeam(); - ScorePlayerTeam scoreplayerteam1 = compare2.getPlayerTeam(); - return ComparisonChain.start().compareTrueFirst(compare1.getGameType() != WorldSettings.GameType.SPECTATOR, compare2.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(compare1.getGameProfile().getName(), compare2.getGameProfile().getName()).result(); - } - } - - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) - return; - if (!on) return; - - DungeonContext context = skyblockStatus.getContext(); - MapProcessor mapProcessor = context.getMapProcessor(); - MapData mapData = mapProcessor.getLastMapData2(); - Rectangle featureRect = getFeatureRect().getRectangle(); - Gui.drawRect(0, 0, featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.<AColor>getParameter("background_color").getValue())); - GlStateManager.color(1, 1, 1, 1); - GlStateManager.pushMatrix(); - if (mapData == null) { - Gui.drawRect(0, 0, featureRect.width, featureRect.height, 0xFFFF0000); - } else { - renderMap(partialTicks, mapProcessor, mapData, context); - } - GlStateManager.popMatrix(); - GL11.glLineWidth(2); - RenderUtils.drawUnfilledBox(0, 0, featureRect.width, featureRect.height, this.<AColor>getParameter("border_color").getValue()); - } - - @Override - public void drawDemo(float partialTicks) { - if (skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getMapProcessor().isInitialized() && on) { - drawHUD(partialTicks); - return; - } - Rectangle featureRect = getFeatureRect().getRectangle(); - Gui.drawRect(0, 0, featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.<AColor>getParameter("background_color").getValue())); - FontRenderer fr = getFontRenderer(); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Please join a dungeon to see preview", featureRect.width / 2 - fr.getStringWidth("Please join a dungeon to see preview") / 2, featureRect.height / 2 - fr.FONT_HEIGHT / 2, 0xFFFFFFFF); - GL11.glLineWidth(2); - RenderUtils.drawUnfilledBox(0, 0, featureRect.width, featureRect.height, this.<AColor>getParameter("border_color").getValue()); - } - - public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context) { - float postScale; - if (this.<Boolean>getParameter("playerCenter").getValue()) { - postScale = this.<Float>getParameter("postScale").getValue(); - } else { - postScale = 1; - } - Rectangle featureRect = getFeatureRect().getRectangle(); - int width = featureRect.width; - float scale; - if (this.<Boolean>getParameter("scale").getValue()) { - scale = width / 128.0f; - } else { - scale = 1; - } - GlStateManager.translate(width / 2d, width / 2d, 0); - GlStateManager.scale(scale, scale, 0); - GlStateManager.scale(postScale, postScale, 0); - EntityPlayer p = Minecraft.getMinecraft().thePlayer; - - Vector2d pt = mapProcessor.worldPointToMapPointFLOAT(p.getPositionEyes(partialTicks)); - double yaw = p.rotationYaw; - if (this.<Boolean>getParameter("playerCenter").getValue()) { - if (this.<Boolean>getParameter("rotate").getValue()) { - GlStateManager.rotate((float) (180.0 - yaw), 0, 0, 1); - } - GlStateManager.translate(-pt.x, -pt.y, 0); - } else { - GlStateManager.translate(-64, -64, 0); - } - updateMapTexture(mapData.colors, mapProcessor, context.getDungeonRoomList()); - render(); - - - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); - - if (this.<Boolean>getParameter("useplayerheads").getValue()) { - renderHeads(mapProcessor, mapData, scale, postScale, partialTicks); - } else { - renderArrows(mapData, scale, postScale); - } - - - FontRenderer fr = getFontRenderer(); - if (this.<Boolean>getParameter("showtotalsecrets").getValue()) { - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - GlStateManager.pushMatrix(); - - Point mapPt = mapProcessor.roomPointToMapPoint(dungeonRoom.getUnitPoints().get(0)); - GlStateManager.translate(mapPt.x + mapProcessor.getUnitRoomDimension().width / 2d, mapPt.y + mapProcessor.getUnitRoomDimension().height / 2d, 0); - - if (this.<Boolean>getParameter("playerCenter").getValue() && this.<Boolean>getParameter("rotate").getValue()) { - GlStateManager.rotate((float) (yaw - 180), 0, 0, 1); - } - GlStateManager.scale(1 / scale, 1 / scale, 0); - GlStateManager.scale(1 / postScale, 1 / postScale, 0); - float s = this.<Float>getParameter("textScale").getValue(); - GlStateManager.scale(s, s, 0); - String str = ""; - str += dungeonRoom.getTotalSecrets() == -1 ? "?" : String.valueOf(dungeonRoom.getTotalSecrets()); - str += " "; - if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FINISHED) { - str += "✔"; - } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.COMPLETE_WITHOUT_SECRETS) { - str += "☑"; - } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) { - str += "☐"; - } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FAILED) { - str += "❌"; - } - - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FINISHED) - fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xFF00FF00); - else { - if (dungeonRoom.getColor() == 74) - fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xff000000); - else fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xFFFFFFFF); - } - - GlStateManager.popMatrix(); - } - } - - } - - - private final DynamicTexture mapTexture = new DynamicTexture(128, 128); - private final ResourceLocation location = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("dungeonmap/map", mapTexture); - private final int[] mapTextureData = mapTexture.getTextureData(); - - private void updateMapTexture(byte[] colors, MapProcessor mapProcessor, List<DungeonRoom> dungeonRooms) { - for (int i = 0; i < 16384; ++i) { - int j = colors[i] & 255; - - if (j / 4 == 0) { - this.mapTextureData[i] = 0x00000000; - } else { - this.mapTextureData[i] = MapColor.mapColorArray[j / 4].getMapColor(j & 3); - } - } - - if (this.<Boolean>getParameter("showtotalsecrets").getValue()) { - for (DungeonRoom dungeonRoom : dungeonRooms) { - for (Point pt : dungeonRoom.getUnitPoints()) { - for (int y1 = 0; y1 < mapProcessor.getUnitRoomDimension().height; y1++) { - for (int x1 = 0; x1 < mapProcessor.getUnitRoomDimension().width; x1++) { - int x = MathHelper.clamp_int(pt.x * (mapProcessor.getUnitRoomDimension().width + mapProcessor.getDoorDimension().height) + x1 + mapProcessor.getTopLeftMapPoint().x, 0, 128); - int y = MathHelper.clamp_int(pt.y * (mapProcessor.getUnitRoomDimension().height + mapProcessor.getDoorDimension().height) + y1 + mapProcessor.getTopLeftMapPoint().y, 0, 128); - int i = y * 128 + x; - int j = dungeonRoom.getColor(); - - if (j / 4 == 0) { - this.mapTextureData[i] = 0x00000000; - } else { - this.mapTextureData[i] = MapColor.mapColorArray[j / 4].getMapColor(j & 3); - } - } - } - } - } - } - - - this.mapTexture.updateDynamicTexture(); - } - - - private void renderHeads(MapProcessor mapProcessor, MapData mapData, float scale, float postScale, float partialTicks) { - List<NetworkPlayerInfo> list = field_175252_a.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); - if (list.size() < 40) return; - - // 19 iterations bc we only want to scan the player part of tab list - for (int i = 1; i < 20; i++) { - NetworkPlayerInfo networkPlayerInfo = list.get(i); - - String name = getPlayerNameWithChecks(networkPlayerInfo); - if (name == null) continue; - - - EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(name); - - Vector2d pt2; - double yaw2; - - - if (entityplayer != null && (!entityplayer.isInvisible() || entityplayer == Minecraft.getMinecraft().thePlayer)) { - pt2 = mapProcessor.worldPointToMapPointFLOAT(entityplayer.getPositionEyes(partialTicks)); - yaw2 = entityplayer.prevRotationYawHead + (entityplayer.rotationYawHead - entityplayer.prevRotationYawHead) * partialTicks; - } else { - String iconName = mapProcessor.getMapIconToPlayerMap().get(name); - if (iconName == null) continue; - Vec4b vec = mapData.mapDecorations.get(iconName); - if (vec == null) { - continue; - } else { - pt2 = new Vector2d(vec.func_176112_b() / 2d + 64, vec.func_176113_c() / 2d + 64); - yaw2 = vec.func_176111_d() * 360 / 16.0f; - } - } - - GlStateManager.pushMatrix(); - - boolean showOtherPlayers = this.<Boolean>getParameter("showotherplayers").getValue(); - - if (entityplayer == Minecraft.getMinecraft().thePlayer || showOtherPlayers) { - boolean flag1 = entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.CAPE); - GlStateManager.enableTexture2D(); - Minecraft.getMinecraft().getTextureManager().bindTexture(networkPlayerInfo.getLocationSkin()); - int l2 = 8 + (flag1 ? 8 : 0); - int i3 = 8 * (flag1 ? -1 : 1); - - GlStateManager.translate(pt2.x, pt2.y, 0); - GlStateManager.rotate((float) yaw2, 0, 0, 1); - - GlStateManager.scale(1 / scale, 1 / scale, 0); - GlStateManager.scale(1 / postScale, 1 / postScale, 0); - - float s = this.<Float>getParameter("playerheadscale").getValue(); - GlStateManager.scale(s, s, 0); - - // cutting out the player head out of the skin texture - Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, l2, 8, i3, 8, 8, 64.0F, 64.0F); - GL11.glLineWidth(1); - RenderUtils.drawUnfilledBox(-4, -4, 4, 4, this.<AColor>getParameter("player_color").getValue()); - } - GlStateManager.popMatrix(); - } - } - - final Pattern tabListRegex = Pattern.compile("\\*[a-zA-Z0-9_]{2,16}\\*", Pattern.MULTILINE); - - /** - * We make sure that the player is alive and regex their name out - * @param networkPlayerInfo the network player info of player - * @return the username of player - */ - @Nullable - private String getPlayerNameWithChecks(NetworkPlayerInfo networkPlayerInfo) { - String name; - if (networkPlayerInfo.getDisplayName() != null) { - name = networkPlayerInfo.getDisplayName().getFormattedText(); - } else { - name = ScorePlayerTeam.formatPlayerName( - networkPlayerInfo.getPlayerTeam(), - networkPlayerInfo.getGameProfile().getName() - ); - } - - if (name.trim().equals("§r") || name.startsWith("§r ")) return null; - - name = TextUtils.stripColor(name); - - if(name.contains("(DEAD)")) { - return null; - } - - name = name.replace(" ", "*"); - - Matcher matcher = tabListRegex.matcher(name); - if (!matcher.find()) return null; - - name = matcher.group(0); - name = name.substring(0, name.length() - 1); - name = name.substring(1); - return name; - } - - - private static final ResourceLocation mapIcons = new ResourceLocation("textures/map/map_icons.png"); - - private void renderArrows(MapData mapData, float scale, float postScale) { - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - int k = 0; - Minecraft.getMinecraft().getTextureManager().bindTexture(mapIcons); - for (Vec4b vec4b : mapData.mapDecorations.values()) { - if (vec4b.func_176110_a() == 1 || this.<Boolean>getParameter("showotherplayers").getValue()) { - GlStateManager.pushMatrix(); - GlStateManager.translate(vec4b.func_176112_b() / 2.0F + 64.0F, vec4b.func_176113_c() / 2.0F + 64.0F, -0.02F); - GlStateManager.rotate((vec4b.func_176111_d() * 360) / 16.0F, 0.0F, 0.0F, 1.0F); - - GlStateManager.scale(1 / scale, 1 / scale, 0); - GlStateManager.scale(1 / postScale, 1 / postScale, 0); - float s = this.<Float>getParameter("playerheadscale").getValue(); - GlStateManager.scale(s * 5, s * 5, 0); - - GlStateManager.translate(-0.125F, 0.125F, 0.0F); - byte b0 = vec4b.func_176110_a(); - float f1 = (b0 % 4) / 4.0F; - float f2 = (b0 / 4f) / 4.0F; - float f3 = (b0 % 4 + 1) / 4.0F; - float f4 = (b0 / 4f + 1) / 4.0F; - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos(-1.0D, 1.0D, k * -0.001F).tex(f1, f2).endVertex(); - worldrenderer.pos(1.0D, 1.0D, k * -0.001F).tex(f3, f2).endVertex(); - worldrenderer.pos(1.0D, -1.0D, k * -0.001F).tex(f3, f4).endVertex(); - worldrenderer.pos(-1.0D, -1.0D, k * -0.001F).tex(f1, f4).endVertex(); - tessellator.draw(); - GlStateManager.popMatrix(); - ++k; - } - } - } - - private void render() { - int i = 0; - int j = 0; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - float f = 0.0F; - Minecraft.getMinecraft().getTextureManager().bindTexture(this.location); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); - GlStateManager.disableAlpha(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos((i) + f, (j + 128) - f, -0.009999999776482582D).tex(0.0D, 1.0D).endVertex(); - worldrenderer.pos((i + 128) - f, (j + 128) - f, -0.009999999776482582D).tex(1.0D, 1.0D).endVertex(); - worldrenderer.pos((i + 128) - f, (j) + f, -0.009999999776482582D).tex(1.0D, 0.0D).endVertex(); - worldrenderer.pos((i) + f, (j) + f, -0.009999999776482582D).tex(0.0D, 0.0D).endVertex(); - tessellator.draw(); - GlStateManager.enableAlpha(); - GlStateManager.disableBlend(); - - GlStateManager.pushMatrix(); - GlStateManager.translate(0.0F, 0.0F, -0.04F); - GlStateManager.scale(1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureRepartyCommand.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureRepartyCommand.java deleted file mode 100644 index e4eb8a22..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureRepartyCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureRepartyCommand extends SimpleFeature { - public FeatureRepartyCommand() { - super("Party.Reparty", "Enable Reparty Command From DG", "if you disable, /dg reparty will still work, Auto reparty will still work\nRequires Restart to get applied", "qol.reparty"); - parameters.put("command", new FeatureParameter<String>("command", "The Command", "Command that the reparty will be bound to", "reparty", "string")); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/SkyblockAbility.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/SkyblockAbility.java deleted file mode 100644 index 6869e8f7..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/SkyblockAbility.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc.ability; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class SkyblockAbility { - private String name; - private int manaCost; - private int cooldown; - - private String itemId; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/UsedAbility.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/UsedAbility.java deleted file mode 100644 index 9bd998d8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/UsedAbility.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc.ability; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@AllArgsConstructor -public class UsedAbility { - private SkyblockAbility ability; - @EqualsAndHashCode.Exclude - private long cooldownEnd; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonClass.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonClass.java deleted file mode 100644 index a840d29e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonClass.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.HashMap; -import java.util.Map; - -@Getter -@AllArgsConstructor -public enum DungeonClass { - MAGE("mage", "Mage"), ARCHER("archer","Archer"), HEALER("healer", "Healer"), TANK("tank", "Tank"), BERSERK("berserk", "Berserk"); - - - private final String jsonName; - private final String familarName; - private static final Map<String, DungeonClass> jsonNameToClazz = new HashMap<>(); - static { - for (DungeonClass value : values()) { - jsonNameToClazz.put(value.getJsonName(), value); - } - } - - public static DungeonClass getClassByJsonName(String name) { - return jsonNameToClazz.get(name); - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonSpecificData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonSpecificData.java deleted file mode 100644 index 56230e1f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonSpecificData.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public class DungeonSpecificData<T> { - private final DungeonType type; - private final T data; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonType.java deleted file mode 100644 index f1c443e4..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonType.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import com.google.common.collect.Sets; -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Set; - -@Getter -@AllArgsConstructor -public enum DungeonType { - CATACOMBS("catacombs", "The Catacombs", - Sets.newHashSet(0,1,2,3,4,5,6,7)), - MASTER_CATACOMBS("master_catacombs", "MasterMode Catacombs", Sets.newHashSet( - 1,2,3,4,5,6 - )); - - private final String jsonName; - private final String familiarName; - private final Set<Integer> validFloors ; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/FloorSpecificData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/FloorSpecificData.java deleted file mode 100644 index 18641c79..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/FloorSpecificData.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public class FloorSpecificData<T> { - private final int floor; - private final T data; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Skill.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Skill.java deleted file mode 100644 index f0d8e88b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Skill.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public enum Skill { - RUNECRAFTING("runecrafting", "Runecrafting"), COMBAT("combat", "Combat"), MINING("mining", "Mining"), ALCHEMY("alchemy", "Alchemy"), FARMING("farming", "Farming"), TAMING("taming", "Taming"), ENCHANTING("enchanting", "Enchanting"), FISHING("fishing", "Fishing"), FORAGING("foraging", "Foraging"), CARPENTRY("carpentry", "Carpentry"); - - private final String jsonName; - private final String friendlyName; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderer.java deleted file mode 100644 index 406963e6..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderer.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; - -import java.awt.*; - -public interface DataRenderer { - Dimension renderData(PlayerProfile playerProfile); - void onHover(PlayerProfile playerProfile, int mouseX, int mouseY); - - - Dimension renderDummy(); - - Dimension getDimension(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java deleted file mode 100644 index 17df170c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import com.google.common.base.Supplier; -import com.mojang.authlib.GameProfile; -import io.github.moulberry.hychat.HyChat; -import io.github.moulberry.hychat.chat.ChatManager; -import io.github.moulberry.hychat.gui.GuiChatBox; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.impl.party.api.ApiFetchur; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.features.impl.party.api.SkinFetchur; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener; -import kr.syeyoung.dungeonsguide.chat.ChatProcessor; -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import lombok.Getter; -import lombok.Setter; -import lombok.SneakyThrows; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.client.gui.*; -import net.minecraft.client.gui.inventory.GuiInventory; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.resources.DefaultPlayerSkin; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.event.HoverEvent; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Team; -import net.minecraft.util.*; -import net.minecraft.world.World; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.common.Loader; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.util.*; -import java.util.List; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -public class FeatureViewPlayerOnJoin extends SimpleFeature implements GuiPostRenderListener, ChatListener, GuiClickListener { - - public FeatureViewPlayerOnJoin() { - super("Party", "View player stats when join", "view player rendering when joining/someone joins the party", "partykicker.viewstats", true); - this.parameters.put("datarenderers", new FeatureParameter<List<String>>("datarenderers", "DataRenderers","Datarenderssdasd", new ArrayList<>(Arrays.asList( - "catalv", "selected_class_lv", "dungeon_catacombs_higheststat", "dungeon_master_catacombs_higheststat", "skill_combat_lv", "skill_foraging_lv", "skill_mining_lv", "fairysouls", "dummy" - )), "stringlist")); - } - - private Rectangle popupRect; - private String lastuid; // actually current uid - private Future<Optional<PlayerProfile>> profileFuture; - private Future<Optional<GameProfile>> gfFuture; - private Future<SkinFetchur.SkinSet> skinFuture; - private FakePlayer fakePlayer; - private boolean drawInv = false; - @SneakyThrows - @Override - public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { - if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChat)) { - cancelRender(); - return; - } - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - IChatComponent ichatcomponent = getHoveredComponent(scaledResolution); - String uid = null; - if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() instanceof HoverEventRenderPlayer) { - uid = ((HoverEventRenderPlayer) ichatcomponent.getChatStyle().getChatHoverEvent()).getUuid(); - } - reqRender(uid); - } - - public void cancelRender() { - popupRect = null; - profileFuture = null; - lastuid = null; - gfFuture = null; - skinFuture= null; - fakePlayer= null; - drawInv = false; - } - - public void reqRender(String uid) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - int width = scaledResolution.getScaledWidth(); - int height = scaledResolution.getScaledHeight(); - int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; - int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; - - - if (!((popupRect != null && (popupRect.contains(mouseX, mouseY) || drawInv)) || uid != null && uid.equals(lastuid))) { - cancelRender(); - } - - if (uid != null && !uid.equals(lastuid) && (popupRect==null || (!popupRect.contains(mouseX, mouseY) && !drawInv)) ) { - cancelRender(); - lastuid = uid; - } - if (lastuid == null) return; - - - if (popupRect == null) { - popupRect = new Rectangle(mouseX, mouseY, 220, 220); - if (popupRect.y + popupRect.height > scaledResolution.getScaledHeight()) { - popupRect.y -= popupRect.y + popupRect.height - scaledResolution.getScaledHeight(); - } - } - - if (profileFuture == null) { - profileFuture = ApiFetchur.fetchMostRecentProfileAsync(lastuid, FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey()); - } - - if (gfFuture == null) { - gfFuture = ApiFetchur.getSkinGameProfileByUUIDAsync(lastuid); - } - boolean plsSetAPIKEY = false; - if (skinFuture == null && gfFuture.isDone()) { - try { - skinFuture = SkinFetchur.getSkinSet(gfFuture.get().orElse(null)); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } - } - - try { - if (fakePlayer == null && skinFuture != null && profileFuture != null && skinFuture.isDone() && profileFuture.isDone() && profileFuture.get().isPresent()) { - fakePlayer = new FakePlayer(gfFuture.get().orElse(null), skinFuture.get(), profileFuture.get().orElse(null)); - } - } catch (InterruptedException | ExecutionException e) { - plsSetAPIKEY = true; - } - - - try { - render(popupRect, scaledResolution, mouseX, mouseY, plsSetAPIKEY ? null : (profileFuture.isDone() ? profileFuture.get() : null), plsSetAPIKEY); - } catch (InterruptedException | ExecutionException e) { - } - - } - - public static void clip(ScaledResolution resolution, int x, int y, int width, int height) { - if (width < 0 || height < 0) return; - - int scale = resolution.getScaleFactor(); - GL11.glScissor((x ) * scale, Minecraft.getMinecraft().displayHeight - (y + height) * scale, (width) * scale, height * scale); - } - private void render(Rectangle popupRect, ScaledResolution scaledResolution, int mouseX, int mouseY, Optional<PlayerProfile> playerProfile, boolean apiKeyPlsSet) { - - GlStateManager.pushMatrix(); - GlStateManager.translate(popupRect.x, popupRect.y, 0); - Gui.drawRect(0,0, popupRect.width, popupRect.height, 0xFF23272a); - Gui.drawRect(2,2, popupRect.width-2, popupRect.height-2, 0XFF2c2f33); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (apiKeyPlsSet) { - Minecraft.getMinecraft().fontRendererObj.drawString("Please set API KEY on /dg -> Party Kicker", 5,5, 0xFFFFFFFF); - GlStateManager.popMatrix(); - return; - } - if (playerProfile == null) { - Minecraft.getMinecraft().fontRendererObj.drawString("Fetching data...", 5,5, 0xFFFFFFFF); - GlStateManager.popMatrix(); - return; - } - if (!playerProfile.isPresent()) { - Minecraft.getMinecraft().fontRendererObj.drawString("User could not be found", 5,5, 0xFFFFFFFF); - GlStateManager.popMatrix(); - return; - } - int relX = mouseX - popupRect.x; - int relY = mouseY - popupRect.y; - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - - GL11.glEnable(GL11.GL_SCISSOR_TEST); - clip(scaledResolution, popupRect.x, popupRect.y, popupRect.width, popupRect.height); - - Gui.drawRect(0,168, 90, 195, 0xFF23272a); - Gui.drawRect(2,170, 88, 193, new Rectangle(2,170,86,23).contains(relX, relY) ? 0xFFff7777 : 0xFFFF3333); - - Gui.drawRect(0,193, 90, 220, 0xFF23272a); - Gui.drawRect(2,195, 88, 218, new Rectangle(2,195,86,23).contains(relX, relY) ? 0xFF859DF0 : 0xFF7289da); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Kick", (90 - fr.getStringWidth("Kick")) / 2,(364 - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); - fr.drawString("Invite", (90 - fr.getStringWidth("Invite")) / 2,(414 - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); - - GlStateManager.pushMatrix(); - - GlStateManager.translate(95, 5, 0); - int culmutativeY = 5; - DataRenderer dataRendererToHover = null; - for (String datarenderers : this.<List<String>>getParameter("datarenderers").getValue()) { - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); - Dimension dim; - if (dataRenderer == null) { - fr.drawString("Couldn't find Datarenderer", 0,0, 0xFFFF0000); - fr.drawString(datarenderers, 0,fr.FONT_HEIGHT, 0xFFFF0000); - dim = new Dimension(0, fr.FONT_HEIGHT * 2); - } else { - GlStateManager.pushMatrix(); - dim = dataRenderer.renderData(playerProfile.get()); - GlStateManager.popMatrix(); - } - if (relX >= 95 && relX <= popupRect.width && relY >= culmutativeY && relY < culmutativeY+dim.height && dataRenderer != null) { - dataRendererToHover = dataRenderer; - } - culmutativeY += dim.height; - GlStateManager.translate(0,dim.height,0); - } - - GlStateManager.popMatrix(); - - Gui.drawRect(0,0, 90, 170, 0xFF23272a); - Gui.drawRect(2,2, 88, 168, 0xFF444444); - Gui.drawRect(80,159, 90, 170, 0xFF23272a); - Gui.drawRect(82,161, 88, 168, 0xFF444444); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("§eI", 83,161,-1); - GlStateManager.color(1, 1, 1, 1.0F); - if (fakePlayer != null) { - clip(scaledResolution, popupRect.x+2, popupRect.y+2, 86, 166); - GuiInventory.drawEntityOnScreen(45, 150, 60, -(mouseX - popupRect.x - 75), 0, fakePlayer); - - String toDraw = fakePlayer.getName(); - List<ActiveCosmetic> activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayer().get(UUID.fromString(TextUtils.insertDashUUID(playerProfile.get().getMemberUID()))); - CosmeticData prefix = null, color = null; - if (activeCosmetics != null) { - for (ActiveCosmetic activeCosmetic : activeCosmetics) { - CosmeticData cosmeticData = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getCosmeticDataMap().get(activeCosmetic.getCosmeticData()); - if (cosmeticData != null) { - if (cosmeticData.getCosmeticType().equals("prefix")) prefix = cosmeticData; - if (cosmeticData.getCosmeticType().equals("color")) color = cosmeticData; - } - } - } - toDraw = (color == null ? "§e" : color.getData().replace("&", "§"))+toDraw; - if (prefix != null) toDraw = prefix.getData().replace("&", "§") + " "+toDraw; - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString(toDraw, (90 - fr.getStringWidth(toDraw)) / 2, 15, -1); - - ItemStack toHover = null; - if (relX > 20 && relX < 70) { - if (33<=relY && relY <= 66) { - toHover = fakePlayer.getInventory()[3]; - } else if (66 <= relY && relY <= 108) { - toHover = fakePlayer.getInventory()[2]; - } else if (108 <= relY && relY <= 130) { - toHover = fakePlayer.getInventory()[1]; - } else if (130 <= relY && relY <= 154) { - toHover = fakePlayer.getInventory()[0]; - } - } else if (relX > 0 && relX <= 20) { - if (80 <= relY && relY <= 120) { - toHover = fakePlayer.inventory.mainInventory[fakePlayer.inventory.currentItem]; - } - } - - if (toHover != null) { - List<String> list = toHover.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); - for (int i = 0; i < list.size(); ++i) { - if (i == 0) { - list.set(i, toHover.getRarity().rarityColor + list.get(i)); - } else { - list.set(i, EnumChatFormatting.GRAY + list.get(i)); - } - } - FontRenderer font = toHover.getItem().getFontRenderer(toHover); - GlStateManager.popMatrix(); - GL11.glDisable(GL11.GL_SCISSOR_TEST); - FontRenderer theRenderer = (font == null ? fr : font); - GuiUtils.drawHoveringText(list,mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, theRenderer); - GL11.glEnable(GL11.GL_SCISSOR_TEST); - GlStateManager.pushMatrix(); - GlStateManager.translate(popupRect.x, popupRect.y, 0); - } - clip(scaledResolution, popupRect.x, popupRect.y, popupRect.width, popupRect.height); - } else { - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Loading", 5,35, 0xFFEFFF00); - } - - GlStateManager.popMatrix(); - GL11.glDisable(GL11.GL_SCISSOR_TEST); - if (dataRendererToHover != null && !drawInv) { - dataRendererToHover.onHover(playerProfile.get(), mouseX, mouseY); - } - GL11.glEnable(GL11.GL_SCISSOR_TEST); - GlStateManager.pushMatrix(); - GlStateManager.translate(popupRect.x, popupRect.y, 0); - - if (drawInv) { - int startX = 81; - int startY = 86; - clip(scaledResolution, popupRect.x+startX-1, popupRect.y+startY-1, 164, 74); - GlStateManager.translate(startX,startY,1); - Gui.drawRect(-1,-1,163,73, 0xFF000000); - GlStateManager.disableLighting(); - ItemStack toHover = null; - int rx = relX - startX; - int ry = relY - startY; - - if (playerProfile.get().getInventory() != null) { - GlStateManager.disableRescaleNormal(); - RenderHelper.enableGUIStandardItemLighting(); - GlStateManager.disableLighting(); - for (int i = 0; i < playerProfile.get().getInventory().length; i++) { - int x = (i%9) * 18; - int y = (i/9) * 18; - if (x <= rx && rx<x+18 && y<=ry&&ry<y+18) { - toHover = playerProfile.get().getInventory()[(i+9) % 36]; - } - Gui.drawRect(x,y,x+18,y+18, 0xFF000000); - Gui.drawRect(x+1,y+1,x+17,y+17, 0xFF666666); - GlStateManager.color(1, 1, 1, 1.0F); - - Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(playerProfile.get().getInventory()[(i+9) % 36], (i%9) * 18+1,(i/9) * 18+1); - } - - if (toHover != null) { - List<String> list = toHover.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); - for (int i = 0; i < list.size(); ++i) { - if (i == 0) { - list.set(i, toHover.getRarity().rarityColor + list.get(i)); - } else { - list.set(i, EnumChatFormatting.GRAY + list.get(i)); - } - } - FontRenderer font = toHover.getItem().getFontRenderer(toHover); - GlStateManager.popMatrix(); - GL11.glDisable(GL11.GL_SCISSOR_TEST); - FontRenderer theRenderer = (font == null ? fr : font); - GuiUtils.drawHoveringText(list,mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, theRenderer); - GL11.glEnable(GL11.GL_SCISSOR_TEST); - GlStateManager.pushMatrix(); - } - } else { - Gui.drawRect(0,0,162,72, 0xFF666666); - fr.drawSplitString("Player has disabled Inventory API", 5,5, 142, -1); - } - - } - GL11.glDisable(GL11.GL_SCISSOR_TEST); - - - GlStateManager.popMatrix(); // 33 66 108 130 154 // 5 75 - } - @Override - public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - int width = scaledResolution.getScaledWidth(); - int height = scaledResolution.getScaledHeight(); - int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; - int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; - - if (Mouse.getEventButton() != -1 && Mouse.isButtonDown(Mouse.getEventButton()) && drawInv) drawInv = false; - if (popupRect == null || !popupRect.contains(mouseX, mouseY)) return; - - mouseInputEvent.setCanceled(true); - - int relX = mouseX - popupRect.x; - int relY = mouseY - popupRect.y; - - - try { - PlayerProfile playerProfile = profileFuture.isDone() ? profileFuture.get().orElse(null) : null; - if (playerProfile == null) return; - if (Mouse.getEventButton() != -1 && Mouse.isButtonDown(Mouse.getEventButton())) { - if (new Rectangle(2, 195, 86, 23).contains(relX, relY)) { - // invite - ChatProcessor.INSTANCE.addToChatQueue("/p invite " + ApiFetchur.fetchNicknameAsync(playerProfile.getMemberUID()).get().orElse("-"), () -> {}, true); - } else if (new Rectangle(2, 170, 86, 23).contains(relX, relY)) { - // kick - ChatProcessor.INSTANCE.addToChatQueue("/p kick " + ApiFetchur.fetchNicknameAsync(playerProfile.getMemberUID()).get().orElse("-"), () -> {}, true); - } else if (new Rectangle(80,159,10,11).contains(relX, relY)) { - drawInv = true; - } - } - - } catch (InterruptedException | ExecutionException e) { - } - - - } - - public IChatComponent getHoveredComponent(ScaledResolution scaledResolution) { - IChatComponent ichatcomponent = null; - if (Loader.isModLoaded("hychat")) { - try { - ChatManager chatManager = HyChat.getInstance().getChatManager(); - GuiChatBox guiChatBox = chatManager.getFocusedChat(); - - int x = guiChatBox.getX(scaledResolution); - int y = guiChatBox.getY(scaledResolution); - ichatcomponent = guiChatBox.chatArray.getHoveredComponent(guiChatBox.getSelectedTab().getChatLines(), Mouse.getX(), Mouse.getY(), x, y); - } catch (Throwable t) {} - } - if (ichatcomponent == null) { - ichatcomponent = Minecraft.getMinecraft().ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY()); - } - return ichatcomponent; - } - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (!isEnabled()) return; - String str = clientChatReceivedEvent.message.getFormattedText(); - if (str.contains("§r§ejoined the dungeon group! (§r§b")) { - String username = TextUtils.stripColor(str).split(" ")[3]; - if (username.equalsIgnoreCase(Minecraft.getMinecraft().getSession().getUsername())) { - PartyManager.INSTANCE.requestPartyList((context) -> { - if (context == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cBugged Dungeon Party ")); - } else { - - for (String member : context.getPartyRawMembers()) { - ApiFetchur.fetchUUIDAsync(member) - .thenAccept((a) -> { - if (a == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+member+"§f's Profile §cCouldn't fetch uuid")); - } else { - ApiFetchur.fetchMostRecentProfileAsync(a.get(), FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey()); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+member+"§f's Profile ").appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new FeatureViewPlayerOnJoin.HoverEventRenderPlayer(a.orElse(null)))))); - } - }); - } - } - }); - } else { - ApiFetchur.fetchUUIDAsync(username) - .thenAccept(a -> { - if (a == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+username+"§f's Profile §cCouldn't fetch uuid")); - return; - } - ApiFetchur.fetchMostRecentProfileAsync(a.get(), FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey()); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+username+"§f's Profile ").appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new FeatureViewPlayerOnJoin.HoverEventRenderPlayer(a.orElse(null)))))); - }); - } - } - } - - - public static class HoverEventRenderPlayer extends HoverEvent { - @Getter - private final String uuid; - public HoverEventRenderPlayer(String uuid) { - super(Action.SHOW_TEXT, new ChatComponentText("")); - this.uuid = uuid; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - HoverEventRenderPlayer that = (HoverEventRenderPlayer) o; - return Objects.equals(uuid, that.uuid); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), uuid); - } - - private IChatComponent cached; - - @Override - public IChatComponent getValue() { - if (cached == null) - return cached = new ChatComponentText("").setChatStyle(new ChatStyle().setChatHoverEvent(new HoverEvent(Action.SHOW_TEXT, new ChatComponentText(uuid)))); - return cached; - } - } - - public static class FakePlayer extends EntityOtherPlayerMP { - @Setter - @Getter - private PlayerProfile skyblockProfile; - private final SkinFetchur.SkinSet skinSet; - private final PlayerProfile.Armor armor; - private FakePlayer(World w) { - super(w, null); - throw new UnsupportedOperationException("what"); - } - public FakePlayer(GameProfile playerProfile, SkinFetchur.SkinSet skinSet, PlayerProfile skyblockProfile) { - super(Minecraft.getMinecraft().theWorld, playerProfile); - this.skyblockProfile = skyblockProfile; - this.skinSet = skinSet; - armor= skyblockProfile.getCurrentArmor(); - this.inventory.armorInventory = skyblockProfile.getCurrentArmor().getArmorSlots(); - - int highestDungeonScore = Integer.MIN_VALUE; - if (skyblockProfile.getInventory() != null) { - ItemStack highestItem = null; - for (ItemStack itemStack : skyblockProfile.getInventory()) { - if (itemStack == null) continue; - NBTTagCompound display = itemStack.getTagCompound().getCompoundTag("display"); - if (display == null) continue; - NBTTagList nbtTagList = display.getTagList("Lore", 8); - if (nbtTagList == null) continue; - for (int i = 0; i < nbtTagList.tagCount(); i++) { - String str = nbtTagList.getStringTagAt(i); - if (TextUtils.stripColor(str).startsWith("Gear")) { - int dungeonScore = Integer.parseInt(TextUtils.keepIntegerCharactersOnly(TextUtils.stripColor(str).split(" ")[2])); - if (dungeonScore > highestDungeonScore) { - highestItem = itemStack; - highestDungeonScore = dungeonScore; - } - } - } - } - - this.inventory.mainInventory[0] = highestItem; - this.inventory.currentItem = 0; - } - } - - public String getSkinType() { - return this.skinSet == null ? DefaultPlayerSkin.getSkinType(getGameProfile().getId()) : this.skinSet.getSkinType(); - } - - public ResourceLocation getLocationSkin() { - return com.google.common.base.Objects.firstNonNull(skinSet.getSkinLoc(), DefaultPlayerSkin.getDefaultSkin(getGameProfile().getId())); - } - - public ResourceLocation getLocationCape() { - return skinSet.getCapeLoc(); - } - - @Override - public ItemStack[] getInventory() { - return this.inventory.armorInventory; - } - - @Override - public boolean isInvisibleToPlayer(EntityPlayer player) { - return true; - } - - @Override - public Team getTeam() { - return new ScorePlayerTeam(null, null) { - @Override - public EnumVisible getNameTagVisibility() { - return EnumVisible.NEVER; - } - }; - } - } - - - - @Override - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { - @Override - public MPanel get() { - - MFeatureEdit featureEdit = new MFeatureEdit(FeatureViewPlayerOnJoin.this, rootConfigPanel); - featureEdit.addParameterEdit("datarenderers", new DataRendererEditor(FeatureViewPlayerOnJoin.this)); - for (FeatureParameter parameter: getParameters()) { - if (parameter.getKey().equals("datarenderers")) continue; - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureViewPlayerOnJoin.this, parameter, rootConfigPanel)); - } - return featureEdit; - } - }); - return "base." + getKey() ; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java deleted file mode 100644 index 225a7850..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import kr.syeyoung.dungeonsguide.features.listener.KeybindPressedListener; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; -import org.lwjgl.input.Keyboard; - -public class FeatureFreezePathfind extends SimpleFeature implements KeybindPressedListener { - public FeatureFreezePathfind() { - super("Dungeon Secrets.Keybinds", "Global Freeze Pathfind", "Freeze Pathfind, meaning the pathfind lines won't change when you move.\nPress settings to edit the key", "secret.freezepathfind", false); - this.parameters.put("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle freeze pathfind", Keyboard.KEY_NONE, "keybind")); - } - - @Override - public void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent) { - if (keyBindPressedEvent.getKey() == this.<Integer>getParameter("key").getValue()) { - setEnabled(!isEnabled()); - try { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fToggled Pathfind Freeze to §e"+(FeatureRegistry.SECRET_FREEZE_LINES.isEnabled() ? "on":"off"))); - } catch (Exception ignored) {} - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBlaze.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBlaze.java deleted file mode 100644 index 1e698414..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBlaze.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.solvers; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureSolverBlaze extends SimpleFeature { - public FeatureSolverBlaze() { - super("Solver.Floor 2+", "Blaze", "Highlights the blaze that needs to be killed in an blaze room", "solver.blaze"); - parameters.put("normBlazeColor", new FeatureParameter<AColor>("blazecolor", "Normal Blaze Color", "Normal Blaze Color", new AColor(255,255,255,255), "acolor")); - parameters.put("nextBlazeColor", new FeatureParameter<AColor>("blazecolor", "Next Blaze Color", "Next Blaze Color", new AColor(0,255,0,255), "acolor")); - parameters.put("nextUpBlazeColor", new FeatureParameter<AColor>("blazecolor", "Next Up Blaze Color", "Color of blaze after next blaze", new AColor(255,255,0,255), "acolor")); - parameters.put("blazeborder", new FeatureParameter<AColor>("blazeborder", "Blaze Border Color", "Blaze border color", new AColor(255,255,255,0), "acolor")); - } - - public AColor getBlazeColor() { - return this.<AColor>getParameter("normBlazeColor").getValue(); - } - public AColor getNextBlazeColor() { - return this.<AColor>getParameter("nextBlazeColor").getValue(); - } - public AColor getNextUpBlazeColor() { - return this.<AColor>getParameter("nextUpBlazeColor").getValue(); - } - public AColor getBorder() { - return this.<AColor>getParameter("blazeborder").getValue(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/BossroomEnterListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/BossroomEnterListener.java deleted file mode 100644 index bb1934b0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/BossroomEnterListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface BossroomEnterListener { - void onBossroomEnter(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListener.java deleted file mode 100644 index 88d8cd2b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -public interface ChatListener { - void onChat(ClientChatReceivedEvent clientChatReceivedEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListenerGlobal.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListenerGlobal.java deleted file mode 100644 index 4f8f61de..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListenerGlobal.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -public interface ChatListenerGlobal { - void onChat(ClientChatReceivedEvent clientChatReceivedEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonContextInitializationListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonContextInitializationListener.java deleted file mode 100644 index 53cea3c3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonContextInitializationListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface DungeonContextInitializationListener { - void onDungeonInitialize(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonEndListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonEndListener.java deleted file mode 100644 index ba8ba263..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonEndListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface DungeonEndListener { - void onDungeonEnd(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonQuitListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonQuitListener.java deleted file mode 100644 index 120d773e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonQuitListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface DungeonQuitListener { - void onDungeonQuit(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonStartListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonStartListener.java deleted file mode 100644 index d7497c63..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonStartListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface DungeonStartListener { - void onDungeonStart(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/EntityLivingRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/EntityLivingRenderListener.java deleted file mode 100644 index 7b982a7f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/EntityLivingRenderListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.RenderLivingEvent; - -public interface EntityLivingRenderListener { - void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent); - void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiBackgroundRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiBackgroundRenderListener.java deleted file mode 100644 index 03e525bc..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiBackgroundRenderListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiBackgroundRenderListener { - void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiClickListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiClickListener.java deleted file mode 100644 index f860e39f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiClickListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiClickListener { - void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiOpenListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiOpenListener.java deleted file mode 100644 index a28ea7a6..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiOpenListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiOpenEvent; - -public interface GuiOpenListener { - void onGuiOpen(GuiOpenEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPostRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPostRenderListener.java deleted file mode 100644 index c6c66f99..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPostRenderListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiPostRenderListener { - void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPreRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPreRenderListener.java deleted file mode 100644 index 08a44009..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPreRenderListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiPreRenderListener { - void onGuiPreRender(GuiScreenEvent.DrawScreenEvent.Pre rendered); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiUpdateListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiUpdateListener.java deleted file mode 100644 index 2e6389f0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiUpdateListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent; - -public interface GuiUpdateListener { - void onGuiUpdate(WindowUpdateEvent windowUpdateEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/InteractListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/InteractListener.java deleted file mode 100644 index 4b2fac80..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/InteractListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.event.entity.player.PlayerInteractEvent; - -public interface InteractListener { - void onInteract(PlayerInteractEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeyInputListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeyInputListener.java deleted file mode 100644 index 80ec57d8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeyInputListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface KeyInputListener { - void onKeyInput(GuiScreenEvent.KeyboardInputEvent keyboardInputEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/PlayerRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/PlayerRenderListener.java deleted file mode 100644 index 33c91fb8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/PlayerRenderListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.RenderPlayerEvent; - -public interface PlayerRenderListener { - void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent ); - void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent ); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ScreenRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ScreenRenderListener.java deleted file mode 100644 index 0f8fec79..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ScreenRenderListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface ScreenRenderListener { - void drawScreen(float partialTicks); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockJoinListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockJoinListener.java deleted file mode 100644 index 67a44f6b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockJoinListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface SkyblockJoinListener { - void onSkyblockJoin(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockLeaveListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockLeaveListener.java deleted file mode 100644 index b38c0b75..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockLeaveListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface SkyblockLeaveListener { - void onSkyblockQuit(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SoundListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SoundListener.java deleted file mode 100644 index 1b8da9c4..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SoundListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.sound.PlaySoundEvent; - -public interface SoundListener { - void onSound(PlaySoundEvent playSoundEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/StompConnectedListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/StompConnectedListener.java deleted file mode 100644 index e52d0642..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/StompConnectedListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; - -public interface StompConnectedListener { - void onStompConnected(StompConnectedEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TextureStichListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TextureStichListener.java deleted file mode 100644 index 8ecb2315..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TextureStichListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.TextureStitchEvent; - -public interface TextureStichListener { - void onTextureStitch(TextureStitchEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TickListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TickListener.java deleted file mode 100644 index cd3a21a5..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TickListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface TickListener { - void onTick(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TitleListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TitleListener.java deleted file mode 100644 index ac3e5f48..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TitleListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraft.network.play.server.S45PacketTitle; - -public interface TitleListener { - void onTitle(S45PacketTitle renderPlayerEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TooltipListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TooltipListener.java deleted file mode 100644 index 5bb78da0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TooltipListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.event.entity.player.ItemTooltipEvent; - -public interface TooltipListener { - void onTooltip(ItemTooltipEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/WorldRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/WorldRenderListener.java deleted file mode 100644 index ee4aeb5c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/WorldRenderListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface WorldRenderListener { - void drawWorld(float partialTicks); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledText.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledText.java deleted file mode 100644 index 074243b9..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledText.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.text; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class StyledText { - private String text; - private String group; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextProvider.java deleted file mode 100644 index 2b68e4a3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.text; - -import java.util.List; -import java.util.Map; - -public interface StyledTextProvider { - List<StyledText> getDummyText(); - List<StyledText> getText(); - - List<TextStyle> getStyles(); - Map<String, TextStyle> getStylesMap(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java deleted file mode 100644 index 4bf87649..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.text; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class TextStyle { - private String groupName; - private AColor color; - private AColor background; - private boolean shadow = false; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/ArrayUtils.java index 1afb8597..035542b1 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/ArrayUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/ArrayUtils.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; +package kr.syeyoung.dungeonsguide.mod.utils; public class ArrayUtils { public static int[][] rotateCounterClockwise(int[][] arr) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/resources/DGTexturePack.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DGTexturePack.java index 3fecfa35..78949d5f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/resources/DGTexturePack.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DGTexturePack.java @@ -16,10 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.resources; +package kr.syeyoung.dungeonsguide.mod; import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; -import kr.syeyoung.dungeonsguide.launcher.loader.IDGLoader; import lombok.AllArgsConstructor; import net.minecraft.client.resources.IResourcePack; import net.minecraft.client.resources.data.IMetadataSection; @@ -27,7 +26,6 @@ import net.minecraft.client.resources.data.IMetadataSerializer; import net.minecraft.util.ResourceLocation; import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Collections; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java new file mode 100755 index 00000000..4f50ac84 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java @@ -0,0 +1,258 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod; + +import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.Main; +import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.commands.CommandDgDebug; +import kr.syeyoung.dungeonsguide.mod.commands.CommandDungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.commands.CommandReparty; +import kr.syeyoung.dungeonsguide.mod.config.Config; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.discord.rpc.RichPresenceManager; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonFacade; +import kr.syeyoung.dungeonsguide.mod.events.listener.FeatureListener; +import kr.syeyoung.dungeonsguide.mod.events.listener.PacketListener; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; +import kr.syeyoung.dungeonsguide.mod.utils.AhUtils; +import kr.syeyoung.dungeonsguide.mod.utils.BlockCache; +import kr.syeyoung.dungeonsguide.mod.utils.TimeScoreUtil; +import kr.syeyoung.dungeonsguide.mod.utils.TitleRender; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.GLCursors; +import kr.syeyoung.dungeonsguide.mod.wsresource.StaticResourceCache; +import lombok.Getter; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.*; +import net.minecraft.client.resources.IReloadableResourceManager; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.launchwrapper.LaunchClassLoader; +import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.ProgressManager; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.ReflectionHelper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +public class DungeonsGuide implements IDungeonGuide { + + @Getter + private static boolean firstTimeUsingDG = false; + Logger logger = LogManager.getLogger("DungeonsGuide"); + + public boolean verbose = false; + private SkyblockStatus skyblockStatus; + + @Getter + private CosmeticsManager cosmeticsManager; + @Getter + private DungeonFacade dungeonFacade; + + @Getter + private BlockCache blockCache; + + public DungeonsGuide(){ + instance = this; + } + private static DungeonsGuide instance; + + public static DungeonsGuide getDungeonsGuide() { + return instance; + } + + @Getter + CommandReparty commandReparty; + + + + + public void init() { + ProgressManager.ProgressBar progressbar = ProgressManager.push("DungeonsGuide", 4); + MinecraftForge.EVENT_BUS.register(this); + + progressbar.step("Registering Events & Commands"); + + skyblockStatus = new SkyblockStatus(); + + MinecraftForge.EVENT_BUS.register(skyblockStatus); + + + (new FeatureRegistry()).init(); + + new ChatTransmitter(); + + try { + Set<String> invalid = ReflectionHelper.getPrivateValue(LaunchClassLoader.class, (LaunchClassLoader) Main.class.getClassLoader(), "invalidClasses"); + ((LaunchClassLoader) Main.class.getClassLoader()).clearNegativeEntries(Sets.newHashSet("org.slf4j.LoggerFactory")); + invalid.clear(); + } catch (Exception e) { + e.printStackTrace(); + } + + + this.blockCache = new BlockCache(); + + this.dungeonFacade = new DungeonFacade(); + dungeonFacade.init(); + + + + TitleRender.getInstance(); + + CommandDungeonsGuide commandDungeonsGuide = new CommandDungeonsGuide(); + CommandDgDebug command = new CommandDgDebug(); + + ClientCommandHandler.instance.registerCommand(commandDungeonsGuide); + ClientCommandHandler.instance.registerCommand(command); + + MinecraftForge.EVENT_BUS.register(command); + MinecraftForge.EVENT_BUS.register(commandDungeonsGuide); + + commandReparty = new CommandReparty(); + MinecraftForge.EVENT_BUS.register(commandReparty); + + MinecraftForge.EVENT_BUS.register(new FeatureListener()); + MinecraftForge.EVENT_BUS.register(new PacketListener()); + MinecraftForge.EVENT_BUS.register(new Keybinds()); + + MinecraftForge.EVENT_BUS.register(PartyManager.INSTANCE); + MinecraftForge.EVENT_BUS.register(ChatProcessor.INSTANCE); + MinecraftForge.EVENT_BUS.register(StaticResourceCache.INSTANCE); + + MinecraftForge.EVENT_BUS.register(new AhUtils()); + + + progressbar.step("Opening connection"); + cosmeticsManager = new CosmeticsManager(); + MinecraftForge.EVENT_BUS.register(cosmeticsManager); + + + progressbar.step("Loading Config"); + try { + Config.loadConfig(null); + } catch (IOException e) { + e.printStackTrace(); + } + + if (FeatureRegistry.ETC_REPARTY.isEnabled()) { + ClientCommandHandler.instance.registerCommand(commandReparty); + } + + if (FeatureRegistry.DISCORD_DONOTUSE.isEnabled()) { + System.setProperty("dg.safe", "true"); + } + + MinecraftForge.EVENT_BUS.register(RichPresenceManager.INSTANCE); + TimeScoreUtil.init(); + + Main.finishUpProgressBar(progressbar); + + ProgressManager.pop(progressbar); + + ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(resourceManager -> GLCursors.setupCursors()); + } + + private boolean showedStartUpGuide; + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent guiOpenEvent){ + if(!showedStartUpGuide){ + showedStartUpGuide = true; + + if(isFirstTimeUsingDG()){ + GuiScreen originalGUI = guiOpenEvent.gui; + guiOpenEvent.gui = new GuiScreen() { + final String welcomeText = "Thank you for installing §eDungeonsGuide§f, the most intelligent skyblock dungeon mod!\nThe gui for relocating GUI Elements and enabling or disabling features can be opened by typing §e/dg\nType §e/dg help §fto view full list of commands offered by dungeons guide!"; + + @Override + public void initGui() { + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + this.buttonList.add(new GuiButton(0, sr.getScaledWidth()/2-100,sr.getScaledHeight()-70 ,"Continue")); + } + + @Override + protected void actionPerformed(GuiButton button) throws IOException { + super.actionPerformed(button); + if (button.id == 0) { + Minecraft.getMinecraft().displayGuiScreen(originalGUI); + } + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + super.drawBackground(1); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; + fontRenderer.drawString("§eWelcome To DungeonsGuide", (sr.getScaledWidth()-fontRenderer.getStringWidth("Welcome To DungeonsGuide"))/2,40,0xFFFF0000); + int tenth = sr.getScaledWidth() / 10; + Gui.drawRect(tenth, 70,sr.getScaledWidth()-tenth, sr.getScaledHeight()-80, 0xFF5B5B5B); + + String[] split = welcomeText.split("\n"); + for (int i = 0; i < split.length; i++) { + fontRenderer.drawString(split[i].replace("\t", " "), tenth + 2,i*fontRenderer.FONT_HEIGHT + 72, 0xFFFFFFFF); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + }; + } + + } + } + + + public void preinit(){ + + File configFile = new File(Main.getConfigDir(), "config.json"); + if (!configFile.exists()) { + Main.getConfigDir().mkdirs(); + firstTimeUsingDG = true; + } + + Config.f = configFile; + Minecraft.getMinecraft().getFramebuffer().enableStencil(); + + try { + List<IResourcePack> resourcePackList = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "aA", "field_110449_ao"); + resourcePackList.add(new DGTexturePack()); + Minecraft.getMinecraft().refreshResources(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + public SkyblockStatus getSkyblockStatus() { + return skyblockStatus; + } + + + + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/IDungeonGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/IDungeonGuide.java new file mode 100644 index 00000000..d4ee724d --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/IDungeonGuide.java @@ -0,0 +1,10 @@ +package kr.syeyoung.dungeonsguide.mod; + +/** + * This exists, so we can reload the mod/ download a more recent version + */ +public interface IDungeonGuide { + void init(); + void preinit(); + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/Keybinds.java index 8b65c27f..61abafd1 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/Keybinds.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/Keybinds.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide; +package kr.syeyoung.dungeonsguide.mod; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/SkyblockStatus.java index 516e1eaf..ad8ba028 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/SkyblockStatus.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/SkyblockStatus.java @@ -16,41 +16,84 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide; +package kr.syeyoung.dungeonsguide.mod; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.HypixelJoinedEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.SkyblockJoinedEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.SkyblockLeftEvent; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; -import net.minecraft.scoreboard.*; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.relauncher.Side; import java.util.Collection; import java.util.Set; public class SkyblockStatus { - @Getter - private boolean isOnSkyblock; - private boolean isOnDungeon; + boolean wasOnHypixel = false; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent ev) { + if (ev.side == Side.SERVER || ev.phase != TickEvent.Phase.START) return; + + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); + boolean isOnDungeonPrev = isOnDungeon(); + boolean isOnSkyblockPrev = isOnSkyblock(); + skyblockStatus.updateStatus(); + + if (!wasOnHypixel && skyblockStatus.isOnHypixel()) { + MinecraftForge.EVENT_BUS.post(new HypixelJoinedEvent()); + } + wasOnHypixel = skyblockStatus.isOnHypixel(); + + if (isOnSkyblockPrev && !isOnSkyblock()) { + MinecraftForge.EVENT_BUS.post(new SkyblockLeftEvent()); + } else if (!isOnSkyblockPrev && isOnSkyblock()) { + MinecraftForge.EVENT_BUS.post(new SkyblockJoinedEvent()); + } + + if (isOnDungeonPrev && !isOnDungeon()) { + MinecraftForge.EVENT_BUS.post(new DungeonLeftEvent()); + } + + - public boolean isOnDungeon() { - return forceIsOnDungeon || isOnDungeon; } - @Getter @Setter - private boolean forceIsOnDungeon; - @Getter - @Setter - private DungeonContext context; + public static boolean isOnSkyblock(){ + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); + + return skyblockStatus != null && skyblockStatus.isOnSkyblock; + } + + public static boolean isOnDungeon() { + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); + + + + return skyblockStatus != null && (skyblockStatus.forceIsOnDungeon || skyblockStatus.isOnDungeon); + } + + + private boolean isOnSkyblock; + private boolean isOnDungeon; @Getter @Setter - private int percentage; - - @Getter @Setter - private String dungeonName; + private boolean forceIsOnDungeon; public boolean isOnHypixel() { Minecraft mc = Minecraft.getMinecraft(); @@ -92,18 +135,23 @@ public class SkyblockStatus { Collection<Score> scores = scoreboard.getSortedScores(scoreObjective); boolean foundDungeon = false; - for (Score sc:scores) { + for (Score sc : scores) { ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim(); if (strippedLine.contains("Cleared: ")) { foundDungeon = true; - percentage = Integer.parseInt(strippedLine.substring(9).split(" ")[0]); + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if(context != null){ + context.setPercentage(Integer.parseInt(strippedLine.substring(9).split(" ")[0])); + } } if (ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()).startsWith(" §7⏣")) { - dungeonName = strippedLine.trim(); + DungeonContext.setDungeonName(strippedLine.trim()); } } isOnDungeon = foundDungeon; } + } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/YoMamaOutdated.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/YoMamaOutdated.java new file mode 100644 index 00000000..88bc10f0 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/YoMamaOutdated.java @@ -0,0 +1,110 @@ +package kr.syeyoung.dungeonsguide.mod; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.*; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.opengl.GL11; + +import java.io.IOException; + +public class YoMamaOutdated { + + Logger logger = LogManager.getLogger("YoMamaOutdated"); + + public boolean isUsingOutdatedDg = true; + String outdatedMessage; + + public YoMamaOutdated() { + MinecraftForge.EVENT_BUS.register(this); + this.check(); + } + + void check() { + + isUsingOutdatedDg = false; + +// try (CloseableHttpClient httpclient = HttpClients.createDefault()) { +// HttpGet httpget = new HttpGet( "https://dungeonsguide.kingstefan26.workers.dev/outdated"); +// Header[] haeders = {new BasicHeader("User-Agent", "DungeonsGuide/" + Main.VERSION)}; +// httpget.setHeaders(haeders); +// HttpResponse httpresponse = httpclient.execute(httpget); +// +// if (httpresponse.getStatusLine().getStatusCode() != 200) { +// outdatedMessage = IOUtils.toString(httpresponse.getEntity().getContent(), StandardCharsets.UTF_8); +// }else { +// isUsingOutdatedDg = false; +// } +// +// } catch (Exception ignored) { +// } + + } + + private boolean showedError = false; + + @SubscribeEvent + public void onGuiOpen(GuiOpenEvent event) { + if (!showedError && isUsingOutdatedDg) { + showedError = true; + + GuiScreen ogGui = event.gui; + + event.gui = new GuiScreen() { + @Override + public void initGui() { + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + this.buttonList.add(new GuiButton(0, sr.getScaledWidth()/2-100,sr.getScaledHeight()-70 ,"Close Minecraft")); + this.buttonList.add(new GuiButton(1, sr.getScaledWidth()/2-100,sr.getScaledHeight()-40 ,"Ignore")); + } + + @Override + protected void actionPerformed(GuiButton button) throws IOException { + super.actionPerformed(button); + if (button.id == 0) { + FMLCommonHandler.instance().exitJava(-1,true); + } else if (button.id == 1) { + Minecraft.getMinecraft().displayGuiScreen(ogGui); + } + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + super.drawBackground(1); + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; + String text = "This DungeonsGuide installation seems to be invalid"; + fontRenderer.drawString(text, (sr.getScaledWidth()-fontRenderer.getStringWidth(text))/2,40,0xFFFF0000); + String text1 = "Message from our server:"; + fontRenderer.drawString(text1, (sr.getScaledWidth()-fontRenderer.getStringWidth(text1))/2, (int) (40+fontRenderer.FONT_HEIGHT*1.5),0xFFFF0000); + + int tenth = sr.getScaledWidth() / 10; + + Gui.drawRect(tenth, 70,sr.getScaledWidth()-tenth, sr.getScaledHeight()-80, 0xFF5B5B5B); + clip(sr, tenth, 70,sr.getScaledWidth()-2*tenth, sr.getScaledHeight()-150); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + + + fontRenderer.drawString(outdatedMessage, tenth+2,fontRenderer.FONT_HEIGHT + 72, 0xFFFFFFFF); + + GL11.glDisable(GL11.GL_SCISSOR_TEST); + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + public void clip(ScaledResolution resolution, int x, int y, int width, int height) { + if (width < 0 || height < 0) return; + + int scale = resolution.getScaleFactor(); + GL11.glScissor((x ) * scale, Minecraft.getMinecraft().displayHeight - (y + height) * scale, (width) * scale, height * scale); + } + }; + } + } + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/chat/ChatProcessResult.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessResult.java index 94bafa95..bacd7c4b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/chat/ChatProcessResult.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessResult.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.chat; +package kr.syeyoung.dungeonsguide.mod.chat; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/chat/ChatProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessor.java index e781ffef..b65e64aa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/chat/ChatProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessor.java @@ -16,9 +16,8 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.chat; +package kr.syeyoung.dungeonsguide.mod.chat; -import kr.syeyoung.dungeonsguide.DungeonsGuide; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiNewChat; import net.minecraft.util.ChatComponentText; @@ -33,13 +32,16 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.simple.SimpleLogger; -import java.util.*; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; public class ChatProcessor { public static final ChatProcessor INSTANCE = new ChatProcessor(); - private static final Logger logger = LogManager.getLogger(); + private static final Logger logger = LogManager.getLogger("DG-ChatProcessor"); private ChatProcessor() { Logger l = LogManager.getLogger(GuiNewChat.class); if (l instanceof SimpleLogger) { @@ -52,6 +54,7 @@ public class ChatProcessor { private Queue<ChatSubscriber> chatSubscriberQueue = new ConcurrentLinkedQueue<>(); private Queue<Tuple<String, Runnable>> chatQueue = new ConcurrentLinkedQueue<>(); + public void subscribe(ChatSubscriber chatSubscribed) { chatSubscriberQueue.add(chatSubscribed); } @@ -73,8 +76,9 @@ public class ChatProcessor { if (tuple.getSecond() != null) tuple.getSecond().run(); minimumNext = System.currentTimeMillis() + 200; - DungeonsGuide.sendDebugChat(new ChatComponentText("Sending " + tuple.getFirst() + " Secretly")); + ChatTransmitter.sendDebugChat(new ChatComponentText("Sending " + tuple.getFirst() + " Secretly")); } + } } catch (Throwable e) { e.printStackTrace(); @@ -86,7 +90,7 @@ public class ChatProcessor { public void onMessage(ClientChatReceivedEvent chatReceivedEvent) { if (chatReceivedEvent.type == 2) return; String txt = chatReceivedEvent.message.getFormattedText(); - logger.log(Level.INFO, "[CHAT] "+txt); + logger.info("[CHAT] {}", txt); int processed = 0; int listenened = 0; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/chat/ChatSubscriber.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatSubscriber.java index 72879eb0..fa7e70af 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/chat/ChatSubscriber.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatSubscriber.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.chat; +package kr.syeyoung.dungeonsguide.mod.chat; import java.util.Map; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatTransmitter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatTransmitter.java new file mode 100644 index 00000000..bfdbd5db --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatTransmitter.java @@ -0,0 +1,69 @@ +package kr.syeyoung.dungeonsguide.mod.chat; + +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; + +public class ChatTransmitter { + + public static final String PREFIX = "§eDungeons Guide §7:: "; + public static String prefix = "§eDungeons Guide §7:: "; + + public ChatTransmitter() { + MinecraftForge.EVENT_BUS.register(this); + } + + static Queue<ChatComponentText> receiveQueue = new ConcurrentLinkedQueue<>(); + + public static void addToQueue(String chat, boolean noDupe) { + addToQueue(new ChatComponentText(chat), noDupe); + } + + public static void addToQueue(ChatComponentText chat) { + addToQueue(chat, false); + } + public static void addToQueue(ChatComponentText chat, boolean noDupe) { + if(noDupe && receiveQueue.stream().anyMatch(a -> a.equals(chat))) return; + receiveQueue.add(chat); + } + + public static void addToQueue(String s) { + addToQueue(s, false); + } + + public static void sendDebugChat(IChatComponent iChatComponent) { + if(FeatureRegistry.DEBUG == null) return; + if (FeatureRegistry.DEBUG.isEnabled()) + addToQueue((ChatComponentText) iChatComponent); + } + + public static void sendDebugChat(String text) { + sendDebugChat(new ChatComponentText(text)); + } + + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent clientTickEvent) { + if(clientTickEvent.phase != TickEvent.Phase.START && Minecraft.getMinecraft().thePlayer == null) return; + + if (!receiveQueue.isEmpty()) { + ClientChatReceivedEvent event = new ClientChatReceivedEvent((byte) 1, receiveQueue.poll()); + MinecraftForge.EVENT_BUS.post(event); + if (!event.isCanceled()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(event.message); + } + } + + + } + + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java index b0b29e89..e28df7e1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java @@ -16,55 +16,48 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.commands; +package kr.syeyoung.dungeonsguide.mod.commands; -import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.events.DungeonEventHolder; import kr.syeyoung.dungeonsguide.dungeon.mechanics.*; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.chat.PartyContext; -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.rpc.RichPresenceManager; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfigV2; -import kr.syeyoung.dungeonsguide.config.guiconfig.NestedCategory; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import kr.syeyoung.dungeonsguide.events.DungeonLeftEvent; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.FeatureViewPlayerOnJoin; -import kr.syeyoung.dungeonsguide.features.impl.party.api.ApiFetchur; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessor; -import kr.syeyoung.dungeonsguide.stomp.StompPayload; -import kr.syeyoung.dungeonsguide.utils.AhUtils; -import kr.syeyoung.dungeonsguide.utils.MapUtils; -import kr.syeyoung.dungeonsguide.utils.ShortUtils; -import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.launcher.Main; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.NestedCategory; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.MapProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonSpecificDataProvider; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventHolder; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonRoomEdit; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessor; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonLeftEvent; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.party.PartyContext; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; +import kr.syeyoung.dungeonsguide.mod.utils.*; +import kr.syeyoung.dungeonsguide.mod.wsresource.StaticResourceCache; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.*; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.Tuple; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import org.json.JSONObject; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; @@ -72,95 +65,105 @@ import javax.crypto.NoSuchPaddingException; import javax.vecmath.Vector2d; import java.awt.*; import java.io.*; +import java.nio.file.Files; import java.security.*; import java.security.cert.CertificateException; -import java.text.SimpleDateFormat; -import java.util.*; import java.util.List; +import java.util.*; import java.util.regex.Pattern; -public class CommandDungeonsGuide extends CommandBase { +public class CommandDgDebug extends CommandBase { @Override public String getCommandName() { - return "assets/dg"; + return "dgdebug"; } @Override public String getCommandUsage(ICommandSender sender) { - return "assets/dg"; + + return "dgdebug"; } @Override - public void processCommand(ICommandSender sender, String[] args) { - if (args.length == 0) { - openConfig = true; - } else if (args[0].equalsIgnoreCase("saverooms")) { - DungeonRoomInfoRegistry.saveAll(DungeonsGuide.getDungeonsGuide().getConfigDir()); + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + if (args.length == 0) return; + String arg = args[0].toLowerCase(); + + + if ("scoreboard".equals(arg)) { + ScoreBoardUtils.forEachLine(l -> { + ChatTransmitter.addToQueue("LINE: " + l, false); + }); + } else if ("scoreboardclean".equals(arg)) { + ScoreBoardUtils.forEachLineClean(l -> { + ChatTransmitter.addToQueue("LINE: " + l, false); + }); + } else if ("title".equals(arg)) { + if (args.length == 2) { + System.out.println("Displayuing title:" + args[1]); + TitleRender.displayTitle(args[1], "", 10, 40, 20); + } + } else if ("mockdungeonstart".equals(arg)) { + if (!Minecraft.getMinecraft().isSingleplayer()) { + ChatTransmitter.addToQueue("This only works in singlepauer", false); + return; + } + + if (args.length == 2) { + int time = Integer.parseInt(args[1]); + ChatTransmitter.addToQueue("§r§aDungeon starts in " + time + " seconds.§r", false); + return; + } + + + (new Thread(() -> { + try { + ChatTransmitter.addToQueue("§r§aDungeon starts in 15 seconds.§r", false); + Thread.sleep(6000); + ChatTransmitter.addToQueue("§r§aDungeon starts in 10 seconds.§r", false); + Thread.sleep(700); + ChatTransmitter.addToQueue("§r§aDungeon starts in 5 seconds.§r", false); + Thread.sleep(1000); + ChatTransmitter.addToQueue("§r§aDungeon starts in 4 seconds.§r", false); + Thread.sleep(1000); + ChatTransmitter.addToQueue("§r§aDungeon starts in 3 seconds.§r", false); + Thread.sleep(1000); + ChatTransmitter.addToQueue("§r§aDungeon starts in 2 seconds.§r", false); + Thread.sleep(1000); + ChatTransmitter.addToQueue("§r§aDungeon starts in 1 seconds.§r", false); + } catch (InterruptedException ignored) { + } + })).start(); + } else if ("saverooms".equals(arg)) { + DungeonRoomInfoRegistry.saveAll(Main.getConfigDir()); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully saved user generated roomdata")); - } else if (args[0].equalsIgnoreCase("loadrooms")) { + } else if ("loadrooms".equals(arg)) { try { - DungeonRoomInfoRegistry.loadAll(DungeonsGuide.getDungeonsGuide().getConfigDir()); + DungeonRoomInfoRegistry.loadAll(Main.getConfigDir()); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully loaded roomdatas")); return; - } catch (BadPaddingException e) { - e.printStackTrace(); - } catch (InvalidAlgorithmParameterException e) { - e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (IllegalBlockSizeException e) { - e.printStackTrace(); - } catch (NoSuchPaddingException e) { - e.printStackTrace(); - } catch (InvalidKeyException e) { + } catch (BadPaddingException | InvalidKeyException | InvalidAlgorithmParameterException | + NoSuchAlgorithmException | IOException | IllegalBlockSizeException | + NoSuchPaddingException e) { e.printStackTrace(); } sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cAn error has occurred while loading roomdata")); - } else if (args[0].equalsIgnoreCase("reloadah")) { + } else if ("reloadah".equals(arg)) { try { AhUtils.loadAuctions(); - } catch (CertificateException e) { - e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (InvalidKeyException e) { - e.printStackTrace(); - } catch (InvalidAlgorithmParameterException e) { - e.printStackTrace(); - } catch (NoSuchPaddingException e) { - e.printStackTrace(); - } catch (BadPaddingException e) { - e.printStackTrace(); - } catch (KeyStoreException e) { - e.printStackTrace(); - } catch (IllegalBlockSizeException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { + } catch (CertificateException | NoSuchAlgorithmException | InvalidKeyException | + InvalidAlgorithmParameterException | NoSuchPaddingException | BadPaddingException | + KeyStoreException | IllegalBlockSizeException | KeyManagementException e) { e.printStackTrace(); } sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fReloaded Ah data")); - } else if (args[0].equalsIgnoreCase("brand")) { + } else if ("brand".equals(arg)) { String serverBrand = Minecraft.getMinecraft().thePlayer.getClientBrand(); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e" + serverBrand)); - } else if (args[0].equalsIgnoreCase("reparty")) { - if (!DungeonsGuide.getDungeonsGuide().getCommandReparty().requestReparty(false)) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCurrently Repartying")); - } - } else if (args[0].equalsIgnoreCase("gui")) { - openConfig = true; - } else if (args[0].equalsIgnoreCase("info")) { - JSONObject obj = DungeonsGuide.getDungeonsGuide().getAuthenticator().getJwtPayload(DungeonsGuide.getDungeonsGuide().getAuthenticator().getRawToken()); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fUser Id§7: §e" + obj.get("userid"))); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fBound to§7: §e" + obj.get("nickname"))); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fBound uuid§7: §e" + obj.get("uuid"))); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSession Expire§7: §e" + sdf.format(new Date(obj.getLong("exp") * 1000)))); - } else if (args[0].equalsIgnoreCase("pathfind")) { + + } else if ("pathfind".equals(arg)) { try { - DungeonContext context = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; if (thePlayer == null) return; if (context.getBossfightProcessor() != null) context.getBossfightProcessor().tick(); @@ -172,10 +175,10 @@ public class CommandDungeonsGuide extends CommandBase { } catch (Throwable t) { t.printStackTrace(); } - } else if (args[0].equals("process") && Minecraft.getMinecraft().getSession().getPlayerID().replace("-", "").equals("e686fe0aab804a71ac7011dc8c2b534c")) { - File root = DungeonsGuide.getDungeonsGuide().getConfigDir(); - File dir = new File(root, "processorinput"); - File outsecret = new File(root, "processoroutsecret"); + } else if ("process".equals(arg)) { + File fileRoot = Main.getConfigDir(); + File dir = new File(fileRoot, "processorinput"); + File outsecret = new File(fileRoot, "processoroutsecret"); for (File f : dir.listFiles()) { if (!f.getName().endsWith(".roomdata")) continue; try { @@ -195,9 +198,9 @@ public class CommandDungeonsGuide extends CommandBase { e.printStackTrace(); } } - } else if (args[0].equals("check") && Minecraft.getMinecraft().getSession().getPlayerID().replace("-", "").equals("e686fe0aab804a71ac7011dc8c2b534c")) { - File root = DungeonsGuide.getDungeonsGuide().getConfigDir(); - for (File f : root.listFiles()) { + } else if ("check".equals(arg)) { + File fileroot = Main.getConfigDir(); + for (File f : fileroot.listFiles()) { if (!f.getName().endsWith(".roomdata")) continue; try { InputStream fis = new FileInputStream(f); @@ -256,117 +259,28 @@ public class CommandDungeonsGuide extends CommandBase { e.printStackTrace(); } } - } else if (args[0].equals("reloaddungeon") && Minecraft.getMinecraft().getSession().getPlayerID().replace("-", "").equals("e686fe0aab804a71ac7011dc8c2b534c")) { + } else if ("reloaddungeon".equals(arg)) { try { MinecraftForge.EVENT_BUS.post(new DungeonLeftEvent()); - DungeonsGuide.getDungeonsGuide().getSkyblockStatus().setContext(null); + + DungeonsGuide.getDungeonsGuide().getDungeonFacade().setContext(null); MapUtils.clearMap(); } catch (Throwable t) { t.printStackTrace(); } - } else if (args[0].equalsIgnoreCase("pvall")) { - PartyManager.INSTANCE.requestPartyList((context) -> { - if (context == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cNot in Party")); - return; - } - for (String member : context.getPartyRawMembers()) { - ApiFetchur.fetchUUIDAsync(member) - .thenAccept(a -> { - if (a == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+member+"§f's Profile §cCouldn't fetch uuid")); - } else { - ApiFetchur.fetchMostRecentProfileAsync(a.get(), FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey()); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e" + member + "§f's Profile ").appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new FeatureViewPlayerOnJoin.HoverEventRenderPlayer(a.orElse(null)))))); - } - }); - } - }); -// } else if (args[0].equals("fixschematic")) { -// File root = new File(e.getDungeonsGuide().getConfigDir(), "schematics"); -// Method method = null; -// try { -// method = NBTTagCompound.class.getDeclaredMethod("write", DataOutput.class); -// method.setAccessible(true); -// } catch (NoSuchMethodException e) { -// e.printStackTrace(); -// return; -// } -// for (File f : root.listFiles()) { -// try { -// NBTTagCompound nbtTagCompound = CompressedStreamTools.readCompressed(new FileInputStream(f)); -// if (nbtTagCompound.getKeySet().isEmpty()) { -// System.out.println("ah"); -// return; -// } -// nbtTagCompound.setString("Materials","Alpha"); -// FileOutputStream fos = new FileOutputStream(f); -// DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(fos))); -// -// try -// { -// dataoutputstream.writeByte(nbtTagCompound.getId()); -// -// dataoutputstream.writeUTF("Schematic"); -// method.invoke(nbtTagCompound, dataoutputstream); -// } -// finally -// { -// dataoutputstream.close(); -// } -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } - } else if (args[0].equalsIgnoreCase("asktojoin") || args[0].equalsIgnoreCase("atj")) { - if (RichPresenceManager.INSTANCE.getLastSetupCode() == -9999) { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cDiscord GameSDK has been disabled, or it failed to load!")); - return; - } - if (!PartyManager.INSTANCE.canInvite()) { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cYou don't have perms in the party to invite people!")); - } else { - PartyManager.INSTANCE.toggleAllowAskToJoin(); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fToggled Ask to join to " + (PartyManager.INSTANCE.getAskToJoinSecret() != null ? "§eon" : "§coff"))); - } - - if (!FeatureRegistry.DISCORD_RICHPRESENCE.isEnabled()) { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cDiscord Rich Presence is disabled! Enable at /dg -> Discord ")); - } - if (!FeatureRegistry.DISCORD_ASKTOJOIN.isEnabled()) { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cDiscord Invite Viewer is disabled! Enable at /dg -> Discord ")); // how - } - } else if (args[0].equalsIgnoreCase("partymax") || args[0].equalsIgnoreCase("pm")) { - if (args.length == 1) { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fCurrent party max is §e" + PartyManager.INSTANCE.getMaxParty())); - } else if (args.length == 2) { - try { - int partyMax = Integer.parseInt(args[1]); - if (partyMax < 2) { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cparty max can't be smaller than 2")); - return; - } - - PartyManager.INSTANCE.setMaxParty(partyMax); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully set partymax to §e" + PartyManager.INSTANCE.getMaxParty())); - } catch (Exception e) { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §c" + args[1] + " is not valid number.")); - return; - } - } - } else if (args[0].equals("partyid")) { + } else if ("partyid".equals(arg)) { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fInternal Party id: " + Optional.ofNullable(PartyManager.INSTANCE.getPartyContext()).map(PartyContext::getPartyID).orElse(null))); - } else if (args[0].equalsIgnoreCase("loc")) { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fYou're in " + DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName())); - } else if (args[0].equalsIgnoreCase("saverun")) { + } else if ("loc".equals(arg)) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fYou're in " + DungeonContext.getDungeonName())); + } else if ("saverun".equals(arg)) { try { - File f = DungeonsGuide.getDungeonsGuide().getConfigDir(); + File f = Main.getConfigDir(); File runDir = new File(f, "dungeonruns"); runDir.mkdirs(); File runFile = new File(runDir, UUID.randomUUID() + ".dgrun"); - DungeonContext dungeonContext = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext(); + DungeonContext dungeonContext = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (dungeonContext == null) { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCouldn't find dungeon to save!")); return; @@ -377,7 +291,7 @@ public class CommandDungeonsGuide extends CommandBase { dungeonEventHolder.setEventDataList(dungeonContext.getEvents()); - ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(runFile)); + ObjectOutputStream oos = new ObjectOutputStream(Files.newOutputStream(runFile.toPath())); oos.writeObject(dungeonEventHolder); oos.flush(); oos.close(); @@ -386,47 +300,13 @@ public class CommandDungeonsGuide extends CommandBase { sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cAn error occured while writing rundata " + e.getMessage())); e.printStackTrace(); } - } else if (args[0].equals("pv")) { - try { - ApiFetchur.fetchUUIDAsync(args[1]) - .thenAccept(a -> { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e" + args[1] + "§f's Profile ").appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new FeatureViewPlayerOnJoin.HoverEventRenderPlayer(a.orElse(null)))))); - }); - } catch (Exception e) { - e.printStackTrace(); - } - } else if (args[0].equals("purge")) { - ApiFetchur.purgeCache(); - CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); - cosmeticsManager.requestPerms(); - cosmeticsManager.requestCosmeticsList(); - cosmeticsManager.requestActiveCosmetics(); - StaticResourceCache.INSTANCE.purgeCache(); - FeatureRegistry.DISCORD_ASKTOJOIN.imageMap.clear(); - FeatureRegistry.DISCORD_ASKTOJOIN.futureMap.clear(); - - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully purged API Cache!")); - } else if (args[0].equals("pbroadcast")) { - try { - String[] payload = new String[args.length - 1]; - System.arraycopy(args, 1, payload, 0, payload.length); - String actualPayload = String.join(" ", payload).replace("$C$", "§"); - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().header("destination", "/app/party.broadcast").payload( - new JSONObject().put("partyID", PartyManager.INSTANCE.getPartyContext().getPartyID()) - .put("payload", actualPayload).toString() - )); - } catch (Exception e) { - e.printStackTrace(); - } - } else if (args[0].equals("requeststaticresource")) { + } else if ("requeststaticresource".equals(arg)) { UUID uid = UUID.fromString(args[1]); StaticResourceCache.INSTANCE.getResource(uid).thenAccept(a -> { sender.addChatMessage(new ChatComponentText(a.getResourceID() + ": " + a.getValue() + ": " + a.isExists())); }); - } else if (args[0].equals("createFakeRoom") && Minecraft.getMinecraft().getSession().getPlayerID().replace("-", "").equals("e686fe0aab804a71ac7011dc8c2b534c")) { - - // load schematic - File f = new File(DungeonsGuide.getDungeonsGuide().getConfigDir(), "schematics/new roonm-b2df250c-4af2-4201-963c-0ee1cb6bd3de-5efb1f0c-c05f-4064-bde7-cad0874fdf39.schematic"); + } else if ("createfakeroom".equals(arg)) {// load schematic + File f = new File(Main.getConfigDir(), "schematics/new roonm-b2df250c-4af2-4201-963c-0ee1cb6bd3de-5efb1f0c-c05f-4064-bde7-cad0874fdf39.schematic"); NBTTagCompound compound; try { compound = CompressedStreamTools.readCompressed(new FileInputStream(f)); @@ -480,15 +360,14 @@ public class CommandDungeonsGuide extends CommandBase { return 0; } }); - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - skyblockStatus.setDungeonName("TEST DG"); + DungeonContext.setDungeonName("TEST DG"); DungeonContext fakeContext = new DungeonContext(Minecraft.getMinecraft().theWorld); - skyblockStatus.setContext(fakeContext); - skyblockStatus.setForceIsOnDungeon(true); + DungeonsGuide.getDungeonsGuide().getDungeonFacade().setContext(fakeContext); + DungeonsGuide.getDungeonsGuide().getSkyblockStatus().setForceIsOnDungeon(true); MapProcessor mapProcessor = fakeContext.getMapProcessor(); mapProcessor.setUnitRoomDimension(new Dimension(16, 16)); mapProcessor.setBugged(false); - mapProcessor.setDoorDimension(new Dimension(4, 4)); + mapProcessor.setDoorDimensions(new Dimension(4, 4)); mapProcessor.setTopLeftMapPoint(new Point(0, 0)); fakeContext.setDungeonMin(new BlockPos(0, 70, 0)); @@ -501,14 +380,15 @@ public class CommandDungeonsGuide extends CommandBase { EditingContext.createEditingContext(dungeonRoom); EditingContext.getEditingContext().openGui(new GuiDungeonRoomEdit(dungeonRoom)); - } else if (args[0].equals("CloseContext")) { + } else if ("closecontext".equals(arg)) { DungeonsGuide.getDungeonsGuide().getSkyblockStatus().setForceIsOnDungeon(false); - DungeonsGuide.getDungeonsGuide().getSkyblockStatus().setContext(null); - } else if (args[0].equals("dumpsettings")) { - NestedCategory root = new NestedCategory("ROOT"); + + DungeonsGuide.getDungeonsGuide().getDungeonFacade().setContext(null); + } else if ("dumpsettings".equals(arg)) { + NestedCategory nestedCategory = new NestedCategory("ROOT"); for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { String category = abstractFeature.getCategory(); - NestedCategory currentRoot = root; + NestedCategory currentRoot = nestedCategory; for (String s : category.split("\\.")) { NestedCategory finalCurrentRoot = currentRoot; if (currentRoot.children().containsKey(s)) @@ -523,7 +403,7 @@ public class CommandDungeonsGuide extends CommandBase { StringBuilder stringBuilder2 = new StringBuilder(); Stack<Tuple<NestedCategory, Integer>> stak = new Stack<>(); - stak.push(new Tuple<>(root, 0)); + stak.push(new Tuple<>(nestedCategory, 0)); Set<NestedCategory> discovered = new HashSet<>(); while (!stak.isEmpty()) { Tuple<NestedCategory, Integer> n = stak.pop(); @@ -549,11 +429,11 @@ public class CommandDungeonsGuide extends CommandBase { } System.out.println(stringBuilder.toString()); System.out.println(stringBuilder2.toString()); - } else if (args[0].equals("readMap")) { + } else if ("readmap".equals(arg)) { try { int fromX = Integer.parseInt(args[1]); int fromY = Integer.parseInt(args[2]); - sender.addChatMessage(new ChatComponentText(MapUtils.readDigit(MapUtils.getColors(), fromX, fromY)+"-")); + sender.addChatMessage(new ChatComponentText(MapUtils.readDigit(MapUtils.getColors(), fromX, fromY) + "-")); // int cntY = Integer.parseInt(args[3]); // int target = Integer.parseInt(args[4]); // StringBuilder sb = new StringBuilder("{"); @@ -573,37 +453,15 @@ public class CommandDungeonsGuide extends CommandBase { e.printStackTrace(); } } else { - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui")); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui")); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg help §7-§fShows command help")); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg saverooms §7-§f Saves usergenerated dungeon roomdata.")); + sender.addChatMessage(new ChatComponentText("ain't gonna find much anything here")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg loadrooms §7-§f Reloads dungeon roomdata.")); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg reloadah §7-§f Reloads price data from server.")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg brand §7-§f View server brand.")); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg reparty §7-§f Reparty.")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg info §7-§f View Current DG User info.")); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg asktojoin or /dg atj §7-§f Toggle ask to join §cRequires Discord Rich Presence enabled. (/dg -> Advanced)")); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg partymax [number] or /dg pm [number] §7-§f Sets partymax §7(maximum amount people in party, for discord rpc)")); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg pv [ign] §7-§f Profile Viewer")); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg pvall §7-§f Profile Viewer For all people on party")); - sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg purge §7-§f Purge api cache.")); sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg saverun §7-§f Save run to be sent to developer.")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg saverooms §7-§f Saves usergenerated dungeon roomdata.")); } } - private boolean openConfig = false; - - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent e) { - try { - if (openConfig && e.phase == TickEvent.Phase.START ) { - openConfig = false; - Minecraft.getMinecraft().displayGuiScreen(new GuiConfigV2()); - } - } catch (Throwable t) { - t.printStackTrace(); - } - } @Override public int getRequiredPermissionLevel() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java new file mode 100644 index 00000000..9b9811cd --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java @@ -0,0 +1,172 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.commands; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.GuiConfigV2; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.discord.rpc.RichPresenceManager; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.FeatureViewPlayerStatsOnJoin; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; +import kr.syeyoung.dungeonsguide.mod.stomp.StompManager; +import kr.syeyoung.dungeonsguide.mod.stomp.StompPayload; +import kr.syeyoung.dungeonsguide.mod.wsresource.StaticResourceCache; +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import org.json.JSONObject; + +public class CommandDungeonsGuide extends CommandBase { + private boolean openConfig = false; + + @Override + public String getCommandName() { + return "dg"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "dg"; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (args.length == 0) { + openConfig = true; + } else if (args[0].equalsIgnoreCase("reparty")) { + if (!DungeonsGuide.getDungeonsGuide().getCommandReparty().requestReparty(false)) { + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §cCurrently Repartying")); + } + } else if (args[0].equalsIgnoreCase("gui")) { + openConfig = true; + } else if (args[0].equalsIgnoreCase("pvall")) { + PartyManager.INSTANCE.requestPartyList((context) -> { + if (context == null) { + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §cNot in Party")); + return; + } + FeatureViewPlayerStatsOnJoin.processPartyMembers(context); + }); + } else if (args[0].equalsIgnoreCase("asktojoin") || args[0].equalsIgnoreCase("atj")) { + if (RichPresenceManager.INSTANCE.getLastSetupCode() == -9999) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cDiscord GameSDK has been disabled, or it failed to load!")); + return; + } + if (!PartyManager.INSTANCE.canInvite()) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cYou don't have perms in the party to invite people!")); + } else { + PartyManager.INSTANCE.toggleAllowAskToJoin(); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fToggled Ask to join to " + (PartyManager.INSTANCE.getAskToJoinSecret() != null ? "§eon" : "§coff"))); + } + + if (!FeatureRegistry.DISCORD_RICHPRESENCE.isEnabled()) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cDiscord Rich Presence is disabled! Enable at /dg -> Discord ")); + } + if (!FeatureRegistry.DISCORD_ASKTOJOIN.isEnabled()) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cDiscord Invite Viewer is disabled! Enable at /dg -> Discord ")); // how + } + } else if (args[0].equals("pv")) { + try { + ApiFetcher.fetchUUIDAsync(args[1]) + .thenAccept(a -> { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e" + args[1] + "§f's Profile ").appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new FeatureViewPlayerStatsOnJoin.HoverEventRenderPlayer(a.orElse(null)))))); + }); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (args[0].equals("purge")) { + ApiFetcher.purgeCache(); + CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); + cosmeticsManager.requestPerms(); + cosmeticsManager.requestCosmeticsList(); + cosmeticsManager.requestActiveCosmetics(); + StaticResourceCache.INSTANCE.purgeCache(); + FeatureRegistry.DISCORD_ASKTOJOIN.imageMap.clear(); + FeatureRegistry.DISCORD_ASKTOJOIN.futureMap.clear(); + + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully purged API Cache!")); + } else if (args[0].equals("pbroadcast")) { + try { + String[] payload = new String[args.length - 1]; + System.arraycopy(args, 1, payload, 0, payload.length); + String actualPayload = String.join(" ", payload).replace("$C$", "§"); + StompManager.getInstance().send(new StompPayload().header("destination", "/app/party.broadcast").payload( + new JSONObject().put("partyID", PartyManager.INSTANCE.getPartyContext().getPartyID()) + .put("payload", actualPayload).toString() + )); + } catch (Exception e) { + e.printStackTrace(); + } + + + } else if (args[0].equals("partymax") || args[0].equals("pm")) { + if (args.length == 1) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fCurrent party max is §e" + PartyManager.INSTANCE.getMaxParty())); + } else if (args.length == 2) { + try { + int partyMax = Integer.parseInt(args[1]); + if (partyMax < 2) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cparty max can't be smaller than 2")); + return; + } + + PartyManager.INSTANCE.setMaxParty(partyMax); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully set partymax to §e" + PartyManager.INSTANCE.getMaxParty())); + } catch (Exception e) { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §c" + args[1] + " is not valid number.")); + } + } + } else { + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg help §7-§fShows command help")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg reloadah §7-§f Reloads price data from server.")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg reparty §7-§f Reparty.")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg asktojoin or /dg atj §7-§f Toggle ask to join §cRequires Discord Rich Presence enabled. (/dg -> Advanced)")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg partymax [number] or /dg pm [number] §7-§f Sets partymax §7(maximum amount people in party, for discord rpc)")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg pv [ign] §7-§f Profile Viewer")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg pvall §7-§f Profile Viewer For all people on party")); + sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg purge §7-§f Purge api cache.")); + } + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent e) { + try { + if (openConfig && e.phase == TickEvent.Phase.START) { + openConfig = false; + Minecraft.getMinecraft().displayGuiScreen(new GuiConfigV2()); + } + } catch (Throwable t) { + t.printStackTrace(); + } + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandReparty.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandReparty.java index c9857b8e..b5c7965f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandReparty.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandReparty.java @@ -16,11 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.commands; +package kr.syeyoung.dungeonsguide.mod.commands; -import kr.syeyoung.dungeonsguide.chat.ChatProcessor; -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import net.minecraft.client.Minecraft; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; @@ -48,7 +49,7 @@ public class CommandReparty extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) { if (!requestReparty(false)) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cCurrently Repartying")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §cCurrently Repartying")); } } @@ -64,30 +65,30 @@ public class CommandReparty extends CommandBase { PartyManager.INSTANCE.requestPartyList(pc -> { if (pc == null) { if (!noerror) - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cNot in Party")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §cNot in Party")); reparting = false; return; } if (!pc.hasLeader(Minecraft.getMinecraft().getSession().getUsername())) { if (!noerror) - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cYou're not leader")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §cYou're not leader")); reparting = false; return; } if (pc.isSelfSolo()) { if (!noerror) - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cYou can not reparty yourself")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §cYou can not reparty yourself")); reparting = false; return; } String members = pc.getPartyRawMembers().stream().filter(a -> !a.equalsIgnoreCase(Minecraft.getMinecraft().getSession().getUsername())).collect(Collectors.joining(" ")); String command = "/p invite "+members; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eDisbanding Party...")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §eDisbanding Party...")); ChatProcessor.INSTANCE.addToChatQueue("/p disband", () -> { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eRunning invite command §f"+command)); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §eRunning invite command §f"+command)); ChatProcessor.INSTANCE.addToChatQueue(command, () -> { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eSuccessfully repartied!§f")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §eSuccessfully repartied!§f")); reparting = false; }, false); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/Config.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/Config.java index 193b65b6..e851f8a6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/Config.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/Config.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config; +package kr.syeyoung.dungeonsguide.mod.config; import com.google.gson.Gson; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import java.io.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/ConfigPanelCreator.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/ConfigPanelCreator.java index d02680bf..da3974a3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/ConfigPanelCreator.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/ConfigPanelCreator.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; import com.google.common.base.Function; import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import org.jetbrains.annotations.Nullable; import java.util.HashMap; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfigV2.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/GuiConfigV2.java index d1888283..0f6be522 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfigV2.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/GuiConfigV2.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; -import kr.syeyoung.dungeonsguide.gui.MGui; +import kr.syeyoung.dungeonsguide.mod.gui.MGui; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.util.MathHelper; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MCategory.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategory.java index 77111fe7..c4561c09 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MCategory.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategory.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MCategoryElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategoryElement.java index 22934fca..74f5f352 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MCategoryElement.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategoryElement.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.FontRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java index 49f637a5..070f4fce 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; - -import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; + +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MToggleButton; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeatureEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeatureEdit.java index 22bb60fa..c7a1e6ab 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeatureEdit.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeatureEdit.java @@ -16,14 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MList; -import kr.syeyoung.dungeonsguide.gui.elements.MModalConfirmation; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.gui.MPanel; + +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MList; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MModalConfirmation; import java.awt.*; import java.util.HashMap; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MNotFound.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MNotFound.java index a6ab6821..b63c4e90 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MNotFound.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MNotFound.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MPanelCategory.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MPanelCategory.java index 1a7cbc74..435940d3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MPanelCategory.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MPanelCategory.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; -import kr.syeyoung.dungeonsguide.gui.elements.MList; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MList; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameterEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MParameterEdit.java index db223fe9..9cf5a6ed 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameterEdit.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MParameterEdit.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; + + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/NestedCategory.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/NestedCategory.java index aaa401bf..28a3d4d1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/NestedCategory.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/NestedCategory.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/RootConfigPanel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java index f7eed53b..8637bb76 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/RootConfigPanel.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java @@ -16,16 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig; import com.google.common.base.Function; -import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -264,6 +265,11 @@ public class RootConfigPanel extends MPanelScaledGUI { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + + if(AuthManager.getInstance().getToken() == null) { + fr.drawString("ERROR CONNECTING TO DG, YOUR COSMETICS ARE NOT VISIBLE",(effectiveDim.width - fr.getStringWidth("ERROR CONNECTING TO DG, YOUR COSMETICS ARE NOT VISIBLE"))/2, (10 - fr.FONT_HEIGHT)/2, 0xFFFF0000); + } + fr.drawString("DungeonsGuide By syeyoung", (effectiveDim.width - fr.getStringWidth("DungeonsGuide By syeyoung"))/2, (25 - fr.FONT_HEIGHT)/2, 0xFF02EE67); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/GuiGuiLocationConfig.java index 48c046c3..0b4193da 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/GuiGuiLocationConfig.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig.location; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig.location; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.gui.MGui; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.gui.MGui; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/Marker.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/Marker.java index 7a0b9c58..10683425 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/Marker.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/Marker.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig.location; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig.location; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/PanelDelegate.java index d9c402ba..fe3ebfcc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/location/PanelDelegate.java @@ -16,14 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.guiconfig.location; - -import kr.syeyoung.dungeonsguide.config.types.GUIRectangle; -import kr.syeyoung.dungeonsguide.gui.elements.MPopupMenu; -import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; +package kr.syeyoung.dungeonsguide.mod.config.guiconfig.location; + + +import kr.syeyoung.dungeonsguide.mod.config.types.GUIRectangle; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MPopupMenu; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTooltip; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/AColor.java index cdf86be4..d46e3c40 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/AColor.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.types; +package kr.syeyoung.dungeonsguide.mod.config.types; import lombok.Getter; import lombok.Setter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/GUIRectangle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/GUIRectangle.java index 4ee947b3..c5b31caa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/GUIRectangle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/GUIRectangle.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.types; +package kr.syeyoung.dungeonsguide.mod.config.types; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCAColor.java index 49b162c0..7f6f4b93 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCAColor.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.types; +package kr.syeyoung.dungeonsguide.mod.config.types; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCBoolean.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCBoolean.java new file mode 100644 index 00000000..f973f495 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCBoolean.java @@ -0,0 +1,39 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.types; + +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; + +public class TCBoolean implements TypeConverter<Boolean> { + @Override + public String getTypeString() { + return "boolean"; + } + + @Override + public Boolean deserialize(JsonElement element) { + return element.getAsBoolean(); + } + + @Override + public JsonElement serialize(Boolean element) { + return new JsonPrimitive(element); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCColor.java new file mode 100644 index 00000000..2544a4f3 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCColor.java @@ -0,0 +1,41 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.types; + +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; + +import java.awt.*; + +public class TCColor implements TypeConverter<Color> { + @Override + public String getTypeString() { + return "color"; + } + + @Override + public Color deserialize(JsonElement element) { + return new Color(element.getAsInt()); + } + + @Override + public JsonElement serialize(Color element) { + return new JsonPrimitive(element.getRGB()); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCFloat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCFloat.java new file mode 100644 index 00000000..2f2aa72f --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCFloat.java @@ -0,0 +1,39 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.types; + +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; + +public class TCFloat implements TypeConverter<Float> { + @Override + public String getTypeString() { + return "float"; + } + + @Override + public Float deserialize(JsonElement element) { + return element.getAsFloat(); + } + + @Override + public JsonElement serialize(Float element) { + return new JsonPrimitive(element); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCGUIRectangle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCGUIRectangle.java index 61d21c93..9a9a9a79 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCGUIRectangle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCGUIRectangle.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.types; +package kr.syeyoung.dungeonsguide.mod.config.types; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCInteger.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCInteger.java new file mode 100644 index 00000000..e895345d --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCInteger.java @@ -0,0 +1,39 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.types; + +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; + +public class TCInteger implements TypeConverter<Integer> { + @Override + public String getTypeString() { + return "integer"; + } + + @Override + public Integer deserialize(JsonElement element) { + return element.getAsInt(); + } + + @Override + public JsonElement serialize(Integer element) { + return new JsonPrimitive(element); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCKeybind.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCKeybind.java index 4ae89395..5b3bb09b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCKeybind.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCKeybind.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.types; +package kr.syeyoung.dungeonsguide.mod.config.types; import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCRectangle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCRectangle.java index 4d42de4d..46d7de16 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCRectangle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCRectangle.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.types; +package kr.syeyoung.dungeonsguide.mod.config.types; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCString.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCString.java new file mode 100644 index 00000000..b2f9dab4 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCString.java @@ -0,0 +1,39 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.types; + +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; + +public class TCString implements TypeConverter<String> { + @Override + public String getTypeString() { + return "string"; + } + + @Override + public String deserialize(JsonElement element) { + return element.getAsString(); + } + + @Override + public JsonElement serialize(String element) { + return new JsonPrimitive(element); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCStringList.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCStringList.java index 58bf838d..24327cfa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCStringList.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCStringList.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.types; +package kr.syeyoung.dungeonsguide.mod.config.types; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCTextStyle.java index 9589b12b..b66133cc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCTextStyle.java @@ -16,11 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.types; +package kr.syeyoung.dungeonsguide.mod.config.types; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; + + public class TCTextStyle implements TypeConverter<TextStyle> { @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCTextStyleList.java index 22068453..12a570bd 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCTextStyleList.java @@ -16,11 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.types; +package kr.syeyoung.dungeonsguide.mod.config.types; import com.google.gson.JsonArray; import com.google.gson.JsonElement; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; + + import java.util.ArrayList; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TypeConverter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TypeConverter.java new file mode 100644 index 00000000..eb4c7a27 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TypeConverter.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.config.types; + +import com.google.gson.JsonElement; + +public interface TypeConverter<T> { + String getTypeString(); + + T deserialize(JsonElement element); + + JsonElement serialize(T element); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TypeConverterRegistry.java index cadc71cc..9dbafe05 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TypeConverterRegistry.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.config.types; +package kr.syeyoung.dungeonsguide.mod.config.types; import java.util.HashMap; import java.util.Map; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/ActiveCosmetic.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/ActiveCosmetic.java new file mode 100644 index 00000000..b71a003c --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/ActiveCosmetic.java @@ -0,0 +1,12 @@ +package kr.syeyoung.dungeonsguide.mod.cosmetics; + +import lombok.Data; +import java.util.UUID; + +@Data +public class ActiveCosmetic { + private UUID activityUID; + private UUID playerUID; + private UUID cosmeticData; + private String username; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticData.java new file mode 100644 index 00000000..7626b119 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticData.java @@ -0,0 +1,14 @@ +package kr.syeyoung.dungeonsguide.mod.cosmetics; + + +import lombok.Data; + +import java.util.UUID; + +@Data +public class CosmeticData { + private UUID id; + private String cosmeticType; + private String reqPerm; + private String data; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/CosmeticsManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java index 790a3bee..3b23e0b8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/CosmeticsManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java @@ -16,14 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.cosmetics; - -import kr.syeyoung.dungeonsguide.cosmetics.chatreplacers.*; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.cosmetics.chatreplacers.*; -import kr.syeyoung.dungeonsguide.events.PlayerListItemPacketEvent; -import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; -import kr.syeyoung.dungeonsguide.stomp.*; +package kr.syeyoung.dungeonsguide.mod.cosmetics; + + +import kr.syeyoung.dungeonsguide.mod.cosmetics.chatreplacers.*; +import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerListItemPacketEvent; + import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -44,7 +42,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; -public class CosmeticsManager implements StompMessageHandler { +public class CosmeticsManager { @Getter private Map<UUID, CosmeticData> cosmeticDataMap = new ConcurrentHashMap<>(); @Getter @@ -59,44 +57,63 @@ public class CosmeticsManager implements StompMessageHandler { private Set<String> perms = new CopyOnWriteArraySet<>(); public void requestActiveCosmetics() { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload() + StompManager.getInstance().send(new StompPayload() .method(StompHeader.SEND) - .header("destination", "/app/cosmetic.activelist") + .destination("/app/cosmetic.activelist") ); } public void requestCosmeticsList() { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload() + StompManager.getInstance().send(new StompPayload() .method(StompHeader.SEND) - .header("destination", "/app/cosmetic.list") + .destination("/app/cosmetic.list") ); } public void requestPerms() { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload() + StompManager.getInstance().send(new StompPayload() .method(StompHeader.SEND) - .header("destination", "/app/user.perms") + .destination("/app/user.perms") ); } public void setCosmetic(CosmeticData cosmetic) { if (!perms.contains(cosmetic.getReqPerm())) return; - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload() + StompManager.getInstance().send(new StompPayload() .method(StompHeader.SEND) - .header("destination", "/app/cosmetic.set") + .destination("/app/cosmetic.set") .payload(cosmetic.getId().toString()) ); } public void removeCosmetic(ActiveCosmetic activeCosmetic) { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload() + StompManager.getInstance().send(new StompPayload() .method(StompHeader.SEND) - .header("destination", "/app/cosmetic.remove") + .destination("/app/cosmetic.remove") .payload(activeCosmetic.getActivityUID().toString()) ); } - @Override - public void handle(StompInterface stompInterface, StompPayload stompPayload) { - String destination = stompPayload.headers().get("destination"); - if (destination.equals("/topic/cosmetic.set")) { - JSONObject jsonObject = new JSONObject(stompPayload.payload()); + private void rebuildCaches() { + activeCosmeticByType = new HashMap<>(); + activeCosmeticByPlayer = new HashMap<>(); + Map<String, List<ActiveCosmetic>> activeCosmeticByPlayerName = new HashMap<>(); + for (ActiveCosmetic value : activeCosmeticMap.values()) { + CosmeticData cosmeticData = cosmeticDataMap.get(value.getCosmeticData()); + if (cosmeticData != null) { + List<ActiveCosmetic> cosmeticsByTypeList = activeCosmeticByType.computeIfAbsent(cosmeticData.getCosmeticType(), a-> new CopyOnWriteArrayList<>()); + cosmeticsByTypeList.add(value); + } + List<ActiveCosmetic> activeCosmetics = activeCosmeticByPlayer.computeIfAbsent(value.getPlayerUID(), a-> new CopyOnWriteArrayList<>()); + activeCosmetics.add(value); + activeCosmetics = activeCosmeticByPlayerName.computeIfAbsent(value.getUsername().toLowerCase(), a-> new CopyOnWriteArrayList<>()); + activeCosmetics.add(value); + } + + this.activeCosmeticByPlayerNameLowerCase = activeCosmeticByPlayerName; + } + + @SubscribeEvent + public void stompConnect(StompConnectedEvent e) { + + e.getStompInterface().subscribe("/topic/cosmetic.set", (stompClient, payload) -> { + JSONObject jsonObject = new JSONObject(payload); ActiveCosmetic activeCosmetic = new ActiveCosmetic(); activeCosmetic.setActivityUID(UUID.fromString(jsonObject.getString("activityUID"))); activeCosmetic.setPlayerUID(UUID.fromString(jsonObject.getString("playerUID"))); @@ -141,18 +158,24 @@ public class CosmeticsManager implements StompMessageHandler { EntityPlayer entityPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByUUID(activeCosmetic.getPlayerUID()); if (entityPlayer != null) entityPlayer.refreshDisplayName(); } - } catch (Exception e) {e.printStackTrace();} + } catch (Exception exception) {exception.printStackTrace();} + }); - } else if (destination.equals("/user/queue/reply/user.perms")) { - JSONArray object = new JSONArray(stompPayload.payload()); + + e.getStompInterface().subscribe("/user/queue/reply/user.perms", (stompClient ,payload) -> { + JSONArray object = new JSONArray(payload); Set<String> cache = new HashSet<>(); for (Object o : object) { cache.add((String) o); } this.perms = cache; - } else if (destination.equals("/user/queue/reply/cosmetic.activelist")) { - Map<UUID, ActiveCosmetic> activeCosmeticMap = new HashMap<>(); - JSONArray object = new JSONArray(stompPayload.payload()); + }); + + + + e.getStompInterface().subscribe("/user/queue/reply/cosmetic.activelist", (stompClient, payload) -> { + activeCosmeticMap = new HashMap<>(); + JSONArray object = new JSONArray(payload); for (Object o : object) { JSONObject jsonObject = (JSONObject) o; ActiveCosmetic cosmeticData = new ActiveCosmetic(); @@ -167,12 +190,15 @@ public class CosmeticsManager implements StompMessageHandler { EntityPlayer entityPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByUUID(cosmeticData.getPlayerUID()); if (entityPlayer != null) entityPlayer.refreshDisplayName(); } - } catch (Exception e) {e.printStackTrace();} + } catch (Exception exception) {exception.printStackTrace();} } - this.activeCosmeticMap = activeCosmeticMap; rebuildCaches(); - } else if (destination.equals("/user/queue/reply/cosmetic.list")) { - JSONArray object = new JSONArray(stompPayload.payload()); + }); + + + + e.getStompInterface().subscribe("/user/queue/reply/cosmetic.list", (stompClient ,payload) -> { + JSONArray object = new JSONArray(payload); Map<UUID, CosmeticData> newCosmeticList = new HashMap<>(); for (Object o : object) { JSONObject jsonObject = (JSONObject) o; @@ -187,40 +213,8 @@ public class CosmeticsManager implements StompMessageHandler { cosmeticDataMap = newCosmeticList; rebuildCaches(); - } - } - - private void rebuildCaches() { - Map<String, List<ActiveCosmetic>> activeCosmeticByType = new HashMap<>(); - Map<UUID, List<ActiveCosmetic>> activeCosmeticByPlayer = new HashMap<>(); - Map<String, List<ActiveCosmetic>> activeCosmeticByPlayerName = new HashMap<>(); - for (ActiveCosmetic value : activeCosmeticMap.values()) { - CosmeticData cosmeticData = cosmeticDataMap.get(value.getCosmeticData()); - if (cosmeticData != null) { - List<ActiveCosmetic> cosmeticsByTypeList = activeCosmeticByType.computeIfAbsent(cosmeticData.getCosmeticType(), a-> new CopyOnWriteArrayList<>()); - cosmeticsByTypeList.add(value); - } - List<ActiveCosmetic> activeCosmetics = activeCosmeticByPlayer.computeIfAbsent(value.getPlayerUID(), a-> new CopyOnWriteArrayList<>()); - activeCosmetics.add(value); - activeCosmetics = activeCosmeticByPlayerName.computeIfAbsent(value.getUsername().toLowerCase(), a-> new CopyOnWriteArrayList<>()); - activeCosmetics.add(value); - } - - this.activeCosmeticByPlayerNameLowerCase = activeCosmeticByPlayerName; - this.activeCosmeticByPlayer = activeCosmeticByPlayer; - this.activeCosmeticByType = activeCosmeticByType; - } + }); - @SubscribeEvent - public void stompConnect(StompConnectedEvent stompConnectedEvent) { - stompConnectedEvent.getStompInterface().subscribe(StompSubscription.builder() - .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/topic/cosmetic.set").build()); - stompConnectedEvent.getStompInterface().subscribe(StompSubscription.builder() - .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/user/queue/reply/user.perms").build()); - stompConnectedEvent.getStompInterface().subscribe(StompSubscription.builder() - .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/user/queue/reply/cosmetic.activelist").build()); - stompConnectedEvent.getStompInterface().subscribe(StompSubscription.builder() - .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/user/queue/reply/cosmetic.list").build()); requestCosmeticsList(); requestActiveCosmetics(); @@ -272,7 +266,8 @@ public class CosmeticsManager implements StompMessageHandler { public void nameFormat(PlayerEvent.NameFormat nameFormat) { List<ActiveCosmetic> activeCosmetics = activeCosmeticByPlayer.get(nameFormat.entityPlayer.getGameProfile().getId()); if (activeCosmetics == null) return; - CosmeticData color=null, prefix=null; + CosmeticData color=null; + CosmeticData prefix=null; for (ActiveCosmetic activeCosmetic : activeCosmetics) { CosmeticData cosmeticData = cosmeticDataMap.get(activeCosmetic.getCosmeticData()); if (cosmeticData !=null && cosmeticData.getCosmeticType().equals("color")) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/CustomNetworkPlayerInfo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CustomNetworkPlayerInfo.java index cfbf1fc0..7be9a1ca 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/CustomNetworkPlayerInfo.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CustomNetworkPlayerInfo.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.cosmetics; +package kr.syeyoung.dungeonsguide.mod.cosmetics; import com.mojang.authlib.GameProfile; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.network.play.server.S38PacketPlayerListItem; import net.minecraft.scoreboard.ScorePlayerTeam; @@ -30,56 +30,58 @@ import net.minecraft.util.IChatComponent; import java.util.List; public class CustomNetworkPlayerInfo extends NetworkPlayerInfo { - public CustomNetworkPlayerInfo(GameProfile p_i46294_1_) { - super(p_i46294_1_); + public CustomNetworkPlayerInfo(GameProfile gameProfile) { + super(gameProfile); } - public CustomNetworkPlayerInfo(S38PacketPlayerListItem.AddPlayerData p_i46295_1_) { - super(p_i46295_1_); + public CustomNetworkPlayerInfo(S38PacketPlayerListItem.AddPlayerData playerData) { + super(playerData); setDisplayName(super.getDisplayName()); } private IChatComponent displayName; - private String playernameLowercase; - private String unformatted; - private String actualName; + private String unformattedDisplayText; + private String playerNameWithoutColor; + @Override public void setDisplayName(IChatComponent displayNameIn) { displayName = displayNameIn; if (displayName == null) { - playernameLowercase = null; - unformatted = null; + unformattedDisplayText = null; return; } - unformatted = displayName.getUnformattedText(); + unformattedDisplayText = displayName.getUnformattedTextForChat(); - actualName = ""; - for (String s : unformatted.split(" ")) { + playerNameWithoutColor = ""; + for (String s : unformattedDisplayText.split(" ")) { String strippped = TextUtils.stripColor(s); - if (strippped.startsWith("[")) continue; - actualName = strippped; + if (strippped.startsWith("[")) { + continue; + } + playerNameWithoutColor = strippped; break; } - playernameLowercase = actualName.toLowerCase(); } public IChatComponent getDisplayName() { - String semi_name; + String rawPlayerString; String actualName; List<ActiveCosmetic> activeCosmetics; - if (playernameLowercase != null) { - activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayerNameLowerCase().get(playernameLowercase); - semi_name = unformatted; - actualName = this.actualName; + + // in case that the set player name is not called we do this + if (playerNameWithoutColor != null) { + activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayerNameLowerCase().get(playerNameWithoutColor.toLowerCase()); + rawPlayerString = unformattedDisplayText; + actualName = this.playerNameWithoutColor; } else { - semi_name = ScorePlayerTeam.formatPlayerName(super.getPlayerTeam(), super.getGameProfile().getName()); + rawPlayerString = ScorePlayerTeam.formatPlayerName(super.getPlayerTeam(), super.getGameProfile().getName()); actualName = ""; - for (String s : semi_name.split(" ")) { + for (String s : rawPlayerString.split(" ")) { String strippped = TextUtils.stripColor(s); if (strippped.startsWith("[")) continue; actualName = strippped; @@ -96,8 +98,11 @@ public class CustomNetworkPlayerInfo extends NetworkPlayerInfo { if (cosmeticData.getCosmeticType().equals("color")) color = cosmeticData; } - if (color != null) semi_name = semi_name.replace(actualName, color.getData()+actualName); - - return new ChatComponentText(semi_name); + if (color != null) { + String coloredName = color.getData() + actualName; + return new ChatComponentText(rawPlayerString.replace(actualName, coloredName)); + } else { + return new ChatComponentText(rawPlayerString); + } } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/CustomPacketPlayerListItem.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CustomPacketPlayerListItem.java index 1aa71d58..541ec392 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/CustomPacketPlayerListItem.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CustomPacketPlayerListItem.java @@ -16,9 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.cosmetics; +package kr.syeyoung.dungeonsguide.mod.cosmetics; + + +import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerListItemPacketEvent; -import kr.syeyoung.dungeonsguide.events.PlayerListItemPacketEvent; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraft.network.play.server.S38PacketPlayerListItem; import net.minecraftforge.common.MinecraftForge; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/IChatReplacer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/IChatReplacer.java index b2bcfc0e..483fadcf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/IChatReplacer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/IChatReplacer.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.cosmetics; +package kr.syeyoung.dungeonsguide.mod.cosmetics; import net.minecraftforge.client.event.ClientChatReceivedEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerChatByMe.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerChatByMe.java index 8c99847a..4e50b110 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerChatByMe.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerChatByMe.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.cosmetics.chatreplacers; +package kr.syeyoung.dungeonsguide.mod.cosmetics.chatreplacers; -import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.cosmetics.IChatReplacer; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.cosmetics.IChatReplacer; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatStyle; import net.minecraft.util.IChatComponent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerCoop.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerCoop.java index a1491dd5..df003ec7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerCoop.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerCoop.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.cosmetics.chatreplacers; +package kr.syeyoung.dungeonsguide.mod.cosmetics.chatreplacers; -import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.cosmetics.IChatReplacer; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.cosmetics.IChatReplacer; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; import net.minecraft.util.Tuple; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerMessage.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerMessage.java index b7c772f1..e819ca7f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerMessage.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerMessage.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.cosmetics.chatreplacers; +package kr.syeyoung.dungeonsguide.mod.cosmetics.chatreplacers; -import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.cosmetics.IChatReplacer; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.cosmetics.IChatReplacer; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatStyle; import net.minecraft.util.IChatComponent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerPV.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerPV.java index e5e4053f..b4e1b777 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerPV.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerPV.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.cosmetics.chatreplacers; +package kr.syeyoung.dungeonsguide.mod.cosmetics.chatreplacers; -import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.cosmetics.IChatReplacer; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.cosmetics.IChatReplacer; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerSocialOptions.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerSocialOptions.java index adf70075..acbdf623 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerSocialOptions.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerSocialOptions.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.cosmetics.chatreplacers; +package kr.syeyoung.dungeonsguide.mod.cosmetics.chatreplacers; -import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.cosmetics.IChatReplacer; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.cosmetics.IChatReplacer; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerViewProfile.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerViewProfile.java index dd5bbd70..28d1d3d0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerViewProfile.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/chatreplacers/ChatReplacerViewProfile.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.cosmetics.chatreplacers; +package kr.syeyoung.dungeonsguide.mod.cosmetics.chatreplacers; -import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.cosmetics.IChatReplacer; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.cosmetics.IChatReplacer; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; import net.minecraft.util.Tuple; @@ -30,7 +30,6 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; import java.util.ArrayList; import java.util.List; -import java.util.UUID; public class ChatReplacerViewProfile implements IChatReplacer { @Override @@ -47,7 +46,10 @@ public class ChatReplacerViewProfile implements IChatReplacer { for (IChatComponent sibling : event.message.getSiblings()) { if (sibling.getChatStyle() != null && sibling.getChatStyle().getChatClickEvent() != null && sibling.getChatStyle().getChatClickEvent().getValue().startsWith("/viewprofile ")) { String uid = sibling.getChatStyle().getChatClickEvent().getValue().split(" ")[1]; - List<ActiveCosmetic> cDatas = cosmeticsManager.getActiveCosmeticByPlayer().get(UUID.fromString(uid)); + // TODO: make cosmeticsManager handle usernames instead of uuids + // apperantly now hypixels /viewprofile command gives the nickname +// List<ActiveCosmetic> cDatas = cosmeticsManager.getActiveCosmeticByPlayer().get(UUID.fromString(uid)); + List<ActiveCosmetic> cDatas = null; if (cDatas != null) { CosmeticData color=null, prefix=null; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/GameSDK.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/GameSDK.java index 1a2f519e..70d8b8b7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/GameSDK.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/GameSDK.java @@ -16,13 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.Platform; -import kr.syeyoung.dungeonsguide.gamesdk.jna.GameSDKTypeMapper; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; + +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.GameSDKTypeMapper; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; + import lombok.Getter; import java.io.File; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/GameSDKTypeMapper.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/GameSDKTypeMapper.java index d9848c55..b7e2c6b6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/GameSDKTypeMapper.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/GameSDKTypeMapper.java @@ -16,11 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna; import com.sun.jna.DefaultTypeMapper; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.*; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.*; + +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.*; + public class GameSDKTypeMapper extends DefaultTypeMapper { public static final GameSDKTypeMapper INSTANCE = new GameSDKTypeMapper(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/NativeGameSDK.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/NativeGameSDK.java index 59fc0339..b11f141c 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/NativeGameSDK.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/NativeGameSDK.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna; import com.sun.jna.Callback; import com.sun.jna.Library; import com.sun.jna.Pointer; import com.sun.jna.ptr.PointerByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordCreateParams; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordVersion; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordCreateParams; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordVersion; public interface NativeGameSDK extends Library { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordActivity.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordActivity.java index 71b43431..3bd0c612 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordActivity.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordActivity.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.Int64; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordActivityType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.Int64; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordActivityAssets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordActivityAssets.java index 03b64f46..fe9bf1ca 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordActivityAssets.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordActivityAssets.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordActivityParty.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordActivityParty.java index b9a20db3..ee0730af 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordActivityParty.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordActivityParty.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordActivitySecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordActivitySecrets.java index 2975f97f..6a43412c 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordActivitySecrets.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordActivitySecrets.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordActivityTimestamps.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordActivityTimestamps.java index 4765ffb9..8a8d06b8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordActivityTimestamps.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordActivityTimestamps.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordTimestamp; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordTimestamp; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordCreateParams.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordCreateParams.java index 0183637e..f1c4590d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordCreateParams.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordCreateParams.java @@ -16,16 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct.*; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct.*; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordClientID; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordVersion; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt64; + +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct.*; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordClientID; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordVersion; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt64; + import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordEntitlement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordEntitlement.java index 6e0f29ac..85ef593b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordEntitlement.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordEntitlement.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordEntitlementType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordEntitlementType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordFileStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordFileStat.java index a7e38b37..40f72b6c 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordFileStat.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordFileStat.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt64; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt64; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordImageDimensions.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordImageDimensions.java index d3247b07..c6a55c42 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordImageDimensions.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordImageDimensions.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordImageHandle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordImageHandle.java index 2ca33f46..c52dfebc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordImageHandle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordImageHandle.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordImageType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.Int64; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordImageType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.Int64; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordInputMode.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordInputMode.java index 8a69f53a..d0b8589b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordInputMode.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordInputMode.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordInputModeType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordInputModeType; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordLobby.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordLobby.java index 18453004..c89dc1cf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordLobby.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordLobby.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordLobbyType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordLobbyType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordOAuth2Token.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordOAuth2Token.java index f870f830..937b23de 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordOAuth2Token.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordOAuth2Token.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordTimestamp; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordTimestamp; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordPartySize.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordPartySize.java index 43c40723..522efeaa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordPartySize.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordPartySize.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.Int32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.Int32; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordPresence.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordPresence.java index 4e12f175..b5fc0f0e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordPresence.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordPresence.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordStatus; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordStatus; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordRelationship.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordRelationship.java index 03cbae4a..4115e684 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordRelationship.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordRelationship.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordRelationshipType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordRelationshipType; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordSku.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordSku.java index 2e9aaf1d..bfd90e22 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordSku.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordSku.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordSkuType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordSkuType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordSkuPrice.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordSkuPrice.java index 6eea0924..c69ca97a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordSkuPrice.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordSkuPrice.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordStruct.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordStruct.java index bd120046..c95680a5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordStruct.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordStruct.java @@ -16,12 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Library; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.GameSDKTypeMapper; + +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.GameSDKTypeMapper; + import java.util.Collections; import java.util.Map; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordUser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordUser.java index bf52860e..62144977 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordUser.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordUser.java @@ -16,11 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; + +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; + import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordUserAchievement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordUserAchievement.java index c12dcf56..db13ab77 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/datastruct/DiscordUserAchievement.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/datastruct/DiscordUserAchievement.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordActivityActionType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordActivityActionType.java index d46fdfc6..9004c339 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordActivityActionType.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordActivityActionType.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordActivityJoinRequestReply.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordActivityJoinRequestReply.java index a8deda60..43f0c0ef 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordActivityJoinRequestReply.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordActivityJoinRequestReply.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordActivityType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordActivityType.java index 9328758a..7ed2ec54 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordActivityType.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordActivityType.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordCreateFlags.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordCreateFlags.java index 29598b47..60606213 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordCreateFlags.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordCreateFlags.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordEntitlementType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordEntitlementType.java index d155fbc6..85150f0a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordEntitlementType.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordEntitlementType.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordImageType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordImageType.java index db4258db..f516e1a9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordImageType.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordImageType.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordInputModeType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordInputModeType.java index 1cc49b7e..aeba1c22 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordInputModeType.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordInputModeType.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordLobbySearchCast.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordLobbySearchCast.java index 5bd97267..d2c78f39 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordLobbySearchCast.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordLobbySearchCast.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordLobbySearchComparison.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordLobbySearchComparison.java index 5cc8f934..9a8819d4 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordLobbySearchComparison.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordLobbySearchComparison.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordLobbySearchDistance.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordLobbySearchDistance.java index e8a920ea..5e4927ee 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordLobbySearchDistance.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordLobbySearchDistance.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordLobbyType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordLobbyType.java index d8353d59..62b7c154 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordLobbyType.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordLobbyType.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordLogLevel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordLogLevel.java index 0fa0f3ab..8487a0e6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordLogLevel.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordLogLevel.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordPremiumType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordPremiumType.java index 4ca426d5..139264b1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordPremiumType.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordPremiumType.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordRelationshipType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordRelationshipType.java index b2edb714..ddc5cadb 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordRelationshipType.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordRelationshipType.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordResult.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordResult.java index cb0541bf..9447fc58 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordResult.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordResult.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordSkuType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordSkuType.java index ba174a17..69442f2d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordSkuType.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordSkuType.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordStatus.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordStatus.java index b788aa62..0ef1892e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordStatus.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordStatus.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordUserFlag.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordUserFlag.java index 242e5f1e..1ba8f40f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/enumuration/EDiscordUserFlag.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/enumuration/EDiscordUserFlag.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration; import com.sun.jna.FromNativeContext; import com.sun.jna.ToNativeContext; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/GameSDKCallback.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/GameSDKCallback.java index 6f139163..e997e699 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/GameSDKCallback.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/GameSDKCallback.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Callback; import com.sun.jna.Library; -import kr.syeyoung.dungeonsguide.gamesdk.jna.GameSDKTypeMapper; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.GameSDKTypeMapper; import java.util.Collections; import java.util.Map; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordAchievementEvents.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordAchievementEvents.java index b1262022..a75e0186 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordAchievementEvents.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordAchievementEvents.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordUserAchievement; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordUserAchievement; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordAchievementManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordAchievementManager.java index afa18700..40d37327 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordAchievementManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordAchievementManager.java @@ -16,18 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.ptr.IntByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.Int32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt8; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordUserAchievement; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.Int32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt8; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordUserAchievement; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordActivityEvents.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordActivityEvents.java index 3e5cba71..d340e544 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordActivityEvents.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordActivityEvents.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityActionType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordActivity; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordUser; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordActivityActionType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordActivity; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordUser; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordActivityManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordActivityManager.java index 6e566719..2cab2538 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordActivityManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordActivityManager.java @@ -16,18 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityActionType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordActivity; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityJoinRequestReply; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordActivityActionType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordActivity; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordActivityJoinRequestReply; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordApplicationManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordApplicationManager.java index ba43432f..ff07aec8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordApplicationManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordApplicationManager.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordOAuth2Token; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordOAuth2Token; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordCore.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordCore.java index 9bc1bb49..95e4ad16 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordCore.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordCore.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.TypeMapper; -import kr.syeyoung.dungeonsguide.gamesdk.jna.GameSDKTypeMapper; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.GameSDKTypeMapper; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordLogLevel; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordLogLevel; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordImageManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordImageManager.java index df4d9d02..322d4a79 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordImageManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordImageManager.java @@ -16,15 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; + +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; + import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordImageDimensions; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordImageHandle; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordImageDimensions; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordImageHandle; import java.nio.ByteBuffer; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordLobbyEvents.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordLobbyEvents.java index 6d2babd5..72ee2293 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordLobbyEvents.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordLobbyEvents.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.ptr.ByteByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt8; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.Int64; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt8; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.Int64; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordLobbyManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordLobbyManager.java index f5ffcbd0..08bfba44 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordLobbyManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordLobbyManager.java @@ -16,21 +16,21 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.ptr.ByteByReference; import com.sun.jna.ptr.IntByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordLobby; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.Int32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt8; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordUser; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordLobby; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.Int32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt8; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordUser; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordLobbyMemberTransaction.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordLobbyMemberTransaction.java index ccb80ecd..43834182 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordLobbyMemberTransaction.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordLobbyMemberTransaction.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordLobbySearchQuery.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordLobbySearchQuery.java index 371872ef..83019eb6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordLobbySearchQuery.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordLobbySearchQuery.java @@ -16,16 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordLobbySearchComparison; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordLobbySearchDistance; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordLobbySearchCast; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordLobbySearchComparison; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordLobbySearchDistance; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordLobbySearchCast; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordLobbyTransaction.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordLobbyTransaction.java index 2434e787..0005c2bf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordLobbyTransaction.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordLobbyTransaction.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordLobbyType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordLobbyType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordNetworkEvents.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordNetworkEvents.java index cafadcbd..2f08f975 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordNetworkEvents.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordNetworkEvents.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.ptr.ByteByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordNetworkChannelId; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordNetworkPeerId; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordNetworkChannelId; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordNetworkPeerId; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordNetworkManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordNetworkManager.java index 49296684..7ec25896 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordNetworkManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordNetworkManager.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Pointer; import com.sun.jna.Structure; import com.sun.jna.ptr.ByteByReference; import com.sun.jna.ptr.LongByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordNetworkChannelId; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordNetworkPeerId; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordNetworkChannelId; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordNetworkPeerId; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordOverlayEvents.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordOverlayEvents.java index 2c17e3f1..f4a1d544 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordOverlayEvents.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordOverlayEvents.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordOverlayManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordOverlayManager.java index 76c33590..3283d21e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordOverlayManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordOverlayManager.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.ptr.ByteByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityActionType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordActivityActionType; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordRelationshipEvents.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordRelationshipEvents.java index 86d3c9a3..97da94ee 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordRelationshipEvents.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordRelationshipEvents.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordRelationship; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordRelationship; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordRelationshipManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordRelationshipManager.java index 62422933..e0084c98 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordRelationshipManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordRelationshipManager.java @@ -16,16 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.ptr.IntByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordRelationship; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordRelationship; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordStorageManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordStorageManager.java index 8e610285..035ee652 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordStorageManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordStorageManager.java @@ -16,19 +16,19 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.ptr.ByteByReference; import com.sun.jna.ptr.IntByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.Int32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordFileStat; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt64; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.Int32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordFileStat; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt64; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordStoreEvents.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordStoreEvents.java index 3b7cec62..e6df07d0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordStoreEvents.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordStoreEvents.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordEntitlement; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordEntitlement; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordStoreManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordStoreManager.java index 2e78e736..3e387923 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordStoreManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordStoreManager.java @@ -16,19 +16,19 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.ptr.ByteByReference; import com.sun.jna.ptr.IntByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordSku; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordEntitlement; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.Int32; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordSku; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordEntitlement; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.Int32; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordUserEvents.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordUserEvents.java index 260d8890..0e80acb1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordUserEvents.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordUserEvents.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordUserManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordUserManager.java index cbdc780f..14b2e8c9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordUserManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordUserManager.java @@ -16,17 +16,19 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.ptr.ByteByReference; import com.sun.jna.ptr.IntByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordUserFlag; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; + +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordUser; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordUserFlag; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordUser; + import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordVoiceEvents.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordVoiceEvents.java index f9f59528..0e4b4731 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordVoiceEvents.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordVoiceEvents.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordVoiceManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordVoiceManager.java index 7e101640..833a1ca4 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/interfacestruct/IDiscordVoiceManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/interfacestruct/IDiscordVoiceManager.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct; import com.sun.jna.Structure; import com.sun.jna.ptr.ByteByReference; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordStruct; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordStruct; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.UInt8; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordInputMode; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordResult; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.UInt8; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordInputMode; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; import java.util.Arrays; import java.util.List; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordClientID.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordClientID.java index 0ada5f77..74f3a6c2 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordClientID.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordClientID.java @@ -16,7 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; + +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; + public class DiscordClientID extends Int64 { public DiscordClientID() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordNetworkChannelId.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordNetworkChannelId.java index a8711776..577e1c11 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordNetworkChannelId.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordNetworkChannelId.java @@ -16,7 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; + +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; + public class DiscordNetworkChannelId extends UInt8 { public DiscordNetworkChannelId() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordNetworkPeerId.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordNetworkPeerId.java index 38632ee1..810d81ac 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordNetworkPeerId.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordNetworkPeerId.java @@ -16,7 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; + +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; + public class DiscordNetworkPeerId extends UInt64 { public DiscordNetworkPeerId() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordSnowflake.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordSnowflake.java index 0d746919..11f26340 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordSnowflake.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordSnowflake.java @@ -16,7 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; + +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; + public class DiscordSnowflake extends Int64 { public DiscordSnowflake() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordTimestamp.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordTimestamp.java index de021e0b..69600825 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordTimestamp.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordTimestamp.java @@ -16,7 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; + +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; + public class DiscordTimestamp extends Int64 { public DiscordTimestamp() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordVersion.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordVersion.java index b38d99a6..58625b55 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/DiscordVersion.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/DiscordVersion.java @@ -16,7 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; + +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; + public class DiscordVersion extends Int32 { public DiscordVersion() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/Int32.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/Int32.java index 581aed96..84210e6b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/Int32.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/Int32.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; import com.sun.jna.IntegerType; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/Int64.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/Int64.java index a8dff873..7ee7e61a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/Int64.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/Int64.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; import com.sun.jna.IntegerType; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/UInt32.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/UInt32.java index 98a903c6..ff7db8a8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/UInt32.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/UInt32.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; import com.sun.jna.IntegerType; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/UInt64.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/UInt64.java index a0265b34..360a80ee 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/UInt64.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/UInt64.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; import com.sun.jna.IntegerType; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/UInt8.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/UInt8.java index 1b10c5a2..f48ebd06 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gamesdk/jna/typedef/UInt8.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/gamesdk/jna/typedef/UInt8.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gamesdk.jna.typedef; +package kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef; import com.sun.jna.IntegerType; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/rpc/JDiscordActivity.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/rpc/JDiscordActivity.java index f25022f2..76b11178 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/rpc/JDiscordActivity.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/rpc/JDiscordActivity.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.rpc; +package kr.syeyoung.dungeonsguide.mod.discord.rpc; -import kr.syeyoung.dungeonsguide.gamesdk.GameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordActivity; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.GameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordActivity; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordActivityType; import lombok.Data; @Data diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/rpc/JDiscordRelation.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/rpc/JDiscordRelation.java index 3086c936..ae7ed1a6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/rpc/JDiscordRelation.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/rpc/JDiscordRelation.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.rpc; +package kr.syeyoung.dungeonsguide.mod.discord.rpc; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordRelationship; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordRelationshipType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordStatus; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordRelationship; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordRelationshipType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordStatus; import lombok.Data; @Data diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/rpc/JDiscordUser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/rpc/JDiscordUser.java index 635ac405..a56cd884 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/rpc/JDiscordUser.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/rpc/JDiscordUser.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.rpc; +package kr.syeyoung.dungeonsguide.mod.discord.rpc; -import kr.syeyoung.dungeonsguide.gamesdk.GameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordUser; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.GameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordUser; import lombok.Data; @Data diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/rpc/RichPresenceManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/rpc/RichPresenceManager.java index ef794b14..6e3c4b48 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/rpc/RichPresenceManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/rpc/RichPresenceManager.java @@ -16,28 +16,27 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.rpc; +package kr.syeyoung.dungeonsguide.mod.discord.rpc; import com.sun.jna.Pointer; import com.sun.jna.ptr.IntByReference; import com.sun.jna.ptr.PointerByReference; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.chat.PartyContext; -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.events.DiscordUserJoinRequestEvent; -import kr.syeyoung.dungeonsguide.events.DiscordUserUpdateEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gamesdk.GameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.NativeGameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.*; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityJoinRequestReply; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordCreateFlags; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordLogLevel; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordResult; -import kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct.*; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.*; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.party.PartyContext; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserJoinRequestEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserUpdateEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.GameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.NativeGameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.*; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.*; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct.*; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.*; + import lombok.Getter; import net.minecraftforge.common.MinecraftForge; @@ -182,7 +181,7 @@ public class RichPresenceManager implements Runnable { activityManager.ClearActivity.clearActivity(activityManager, Pointer.NULL, (callbackData, result) -> { }); } else { - String name = skyblockStatus.getDungeonName() == null ? "" : skyblockStatus.getDungeonName(); + String name = DungeonContext.getDungeonName() == null ? "" : DungeonContext.getDungeonName(); if (!skyblockStatus.isOnSkyblock()) name ="Somewhere on Hypixel"; if (name.trim().equals("Your Island")) name = "Private Island"; @@ -200,13 +199,13 @@ public class RichPresenceManager implements Runnable { latestDiscordActivity.party.discordActivityParty.current_size = new Int32(Optional.ofNullable(PartyManager.INSTANCE.getPartyContext()).map(PartyContext::getPartyRawMembers).map(Set::size).orElse(1)); latestDiscordActivity.party.discordActivityParty.max_size = new Int32(PartyManager.INSTANCE.getMaxParty()); - if (skyblockStatus.getContext() != null) { - DungeonContext dungeonContext = skyblockStatus.getContext(); - long init = dungeonContext.getInit(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (context != null) { + long init = context.getInit(); latestDiscordActivity.timestamps.start = new DiscordTimestamp(init); - if (dungeonContext.getBossfightProcessor() != null) { - GameSDK.writeString(latestDiscordActivity.details, "Fighting "+dungeonContext.getBossfightProcessor().getBossName()+": "+dungeonContext.getBossfightProcessor().getCurrentPhase()); + if (context.getBossfightProcessor() != null) { + GameSDK.writeString(latestDiscordActivity.details, "Fighting "+context.getBossfightProcessor().getBossName()+": "+context.getBossfightProcessor().getCurrentPhase()); } else { GameSDK.writeString(latestDiscordActivity.details, "Clearing Rooms"); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonActionContext.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonActionContext.java new file mode 100644 index 00000000..f9541a3d --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonActionContext.java @@ -0,0 +1,35 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon; + +import lombok.Getter; +import net.minecraft.util.Vec3; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DungeonActionContext { + @Getter + private static final Map<Integer, Vec3> spawnLocation = new HashMap<>(); + + @Getter + private static final List<Integer> killeds = new ArrayList<>(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonContext.java index fd2b8770..257e7cc0 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/DungeonContext.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonContext.java @@ -16,25 +16,29 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon; - -import kr.syeyoung.dungeonsguide.dungeon.events.*; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; -import kr.syeyoung.dungeonsguide.dungeon.events.*; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.events.BossroomEnterEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.impl.dungeon.FeatureDungeonMap; -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessor; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonSpecificDataProvider; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEvent; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventData; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.impl.DungeonCryptBrokenEvent; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.impl.DungeonNodataEvent; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.impl.DungeonPuzzleFailureEvent; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.impl.DungeonSecretCountChangeEvent; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessor; +import kr.syeyoung.dungeonsguide.mod.events.impl.BossroomEnterEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.utils.TabListUtil; + +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; @@ -43,10 +47,21 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.common.MinecraftForge; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; public class DungeonContext { + /** + * This is static because its used in the constructor, + * it means we cannot set the name without having an object, + * and we cannot create an object without the name + * so its static :) + */ + @Getter @Setter + private static String dungeonName; + @Getter + @Setter + public int percentage; @Getter private final World world; @Getter @@ -57,17 +72,17 @@ public class DungeonContext { private BlockPos dungeonMin; @Getter - private final Map<Point, DungeonRoom> roomMapper = new HashMap<Point, DungeonRoom>(); + private final Map<Point, DungeonRoom> roomMapper = new HashMap<>(); @Getter - private final List<DungeonRoom> dungeonRoomList = new ArrayList<DungeonRoom>(); + private final List<DungeonRoom> dungeonRoomList = new ArrayList<>(); @Getter - private final List<RoomProcessor> globalRoomProcessors = new ArrayList<RoomProcessor>(); + private final List<RoomProcessor> globalRoomProcessors = new ArrayList<>(); @Getter - private final Map<String, Integer> deaths = new HashMap<String, Integer>(); + private final Map<String, Integer> deaths = new HashMap<>(); @Getter - private final List<String[]> milestoneReached = new ArrayList<String[]>(); + private final List<String[]> milestoneReached = new ArrayList<>(); @Getter @Setter private long BossRoomEnterSeconds = -1; @@ -104,56 +119,53 @@ public class DungeonContext { private BossfightProcessor bossfightProcessor; @Getter - private final Set<String> players = new HashSet<String>(); + private final Set<String> players = new HashSet<>(); @Getter - private final List<DungeonEvent> events = new ArrayList<DungeonEvent>(); + private final List<DungeonEvent> events = new ArrayList<>(); public DungeonContext(World world) { this.world = world; createEvent(new DungeonNodataEvent("DUNGEON_CONTEXT_CREATION")); mapProcessor = new MapProcessor(this); - DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(getDungeonName()); if (doorFinder != null) { - trapRoomGen = doorFinder.isTrapSpawn(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + trapRoomGen = doorFinder.isTrapSpawn(getDungeonName()); - secretPercentage = doorFinder.secretPercentage(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); - maxSpeed = doorFinder.speedSecond(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); - } else mapProcessor.setBugged(true); + secretPercentage = doorFinder.secretPercentage(getDungeonName()); + maxSpeed = doorFinder.speedSecond(getDungeonName()); + } else { + mapProcessor.setBugged(true); + } init = System.currentTimeMillis(); } public void createEvent(DungeonEventData eventData) { - events.add(new DungeonEvent(eventData)); +// events.add(new DungeonEvent(eventData)); } - private final Rectangle roomBoundary = new Rectangle(-10,-10,138,138); + private final Rectangle roomBoundary = new Rectangle(-10, -10, 138, 138); public void tick() { - mapProcessor.tick(); + if (mapProcessor.isInitialized() && BossRoomEnterSeconds == -1 && !roomBoundary.contains(mapProcessor.worldPointToMapPoint(Minecraft.getMinecraft().thePlayer.getPositionVector()))) { BossRoomEnterSeconds = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000; bossroomSpawnPos = Minecraft.getMinecraft().thePlayer.getPosition(); MinecraftForge.EVENT_BUS.post(new BossroomEnterEvent()); createEvent(new DungeonNodataEvent("BOSSROOM_ENTER")); - DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(getDungeonName()); if (doorFinder != null) { - bossfightProcessor = doorFinder.createBossfightProcessor(world, DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + bossfightProcessor = doorFinder.createBossfightProcessor(world, getDungeonName()); } else { - DungeonsGuide.sendDebugChat(new ChatComponentText("Error:: Null Data Providier")); + ChatTransmitter.sendDebugChat(new ChatComponentText("Error:: Null Data Providier")); } } - List<NetworkPlayerInfo> list = FeatureDungeonMap.field_175252_a.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); - try { - for (int i = 1; i < 20; i++) { - NetworkPlayerInfo networkPlayerInfo = list.get(i); - String name = networkPlayerInfo.getDisplayName() != null ? networkPlayerInfo.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfo.getPlayerTeam(), networkPlayerInfo.getGameProfile().getName()); - if (name.trim().equals("§r") || name.startsWith("§r ")) continue; - players.add(TextUtils.stripColor(name).trim().split(" ")[0]); - } - } catch (Exception e) {} + + players.clear(); + players.addAll(TabListUtil.getPlayersInDungeon()); + if (latestSecretCnt != FeatureRegistry.DUNGEON_SECRETS.getSecretsFound()) { int newSecretCnt = FeatureRegistry.DUNGEON_SECRETS.getSecretsFound(); @@ -175,6 +187,7 @@ public class DungeonContext { private boolean ended = false; @Getter private boolean defeated = false; + public void onChat(ClientChatReceivedEvent event) { IChatComponent component = event.message; String formatted = component.getFormattedText(); @@ -187,8 +200,8 @@ public class DungeonContext { int x = Integer.parseInt(coords.split("/")[0]); int z = Integer.parseInt(coords.split("/")[1]); int secrets2 = Integer.parseInt(secrets); - Point roomPt = mapProcessor.worldPointToRoomPoint(new BlockPos(x,70,z)); - DungeonsGuide.sendDebugChat(new ChatComponentText("Message from Other dungeons guide :: "+roomPt.x+" / " + roomPt.y + " total secrets "+secrets2)); + Point roomPt = mapProcessor.worldPointToRoomPoint(new BlockPos(x, 70, z)); + ChatTransmitter.sendDebugChat(new ChatComponentText("Message from Other dungeons guide :: " + roomPt.x + " / " + roomPt.y + " total secrets " + secrets2)); DungeonRoom dr = roomMapper.get(roomPt); if (dr != null) { dr.setTotalSecrets(secrets2); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonFacade.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonFacade.java new file mode 100644 index 00000000..96a951fd --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/DungeonFacade.java @@ -0,0 +1,35 @@ +package kr.syeyoung.dungeonsguide.mod.dungeon; + +import kr.syeyoung.dungeonsguide.Main; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.mod.events.listener.DungeonListener; +import lombok.Getter; +import lombok.Setter; +import net.minecraftforge.common.MinecraftForge; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import java.io.IOException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +public class DungeonFacade { + + @Getter + @Setter + private DungeonContext context; + + public void init() { + DungeonListener dgEventListener = new DungeonListener(); + MinecraftForge.EVENT_BUS.register(dgEventListener); + + try { + DungeonRoomInfoRegistry.loadAll(Main.getConfigDir()); + } catch (BadPaddingException | InvalidKeyException | NoSuchPaddingException | IllegalBlockSizeException | + IOException | NoSuchAlgorithmException | InvalidAlgorithmParameterException e) { + e.printStackTrace(); + } + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/MapProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/MapProcessor.java new file mode 100755 index 00000000..6ae4b5c2 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/MapProcessor.java @@ -0,0 +1,541 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.Sets; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.EDungeonDoorType; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.SerializableBlockPos; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.impl.DungeonMapUpdateEvent; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.impl.DungeonRoomDiscoverEvent; +import kr.syeyoung.dungeonsguide.mod.dungeon.map.DungeonMapData; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.utils.MapUtils; +import lombok.Getter; +import lombok.Setter; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemStack; +import net.minecraft.util.*; +import net.minecraft.world.storage.MapData; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import javax.vecmath.Vector2d; +import java.awt.*; +import java.util.List; +import java.util.Queue; +import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class MapProcessor { + + private static final Set<Vector2d> directions = Sets.newHashSet(new Vector2d(0, 1), new Vector2d(0, -1), new Vector2d(1, 0), new Vector2d(-1, 0)); + private static final Set<Vector2d> door_dirs = Sets.newHashSet(new Vector2d(0, 0.5), new Vector2d(0, -0.5), new Vector2d(0.5, 0), new Vector2d(-0.5, 0)); + private static final Minecraft mc = Minecraft.getMinecraft(); + private final DungeonContext context; + @Getter + private final BiMap<String, String> mapIconToPlayerMap = HashBiMap.create(); + private final List<Point> roomsFound = new ArrayList<>(); + Logger logger = LogManager.getLogger("MapProcessor"); + /** + * If the player on the map is closer than value this it won't save it + * this should be done with render-distance but whateva + */ + int clossnessDistance = 50; + @Getter + @Setter + private Dimension unitRoomDimension; + @Getter @Setter + private Dimension doorDimensions; // width: width of door, height: gap between rooms + @Getter + @Setter + private Point topLeftMapPoint; + @Setter + private boolean bugged = false; + @Getter + private boolean initialized = false; + @Getter + private int undiscoveredRoom = 0; + private boolean processed = false; + @Getter + private MapData latestMapData; + private int waitDelay = 0; + private boolean processlock; + + public MapProcessor(DungeonContext context) { + this.context = context; + } + + private static void error(String prefix) { + ChatTransmitter.addToQueue(new ChatComponentText(ChatTransmitter.prefix + prefix)); + } + + + ExecutorService es = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Dg-MapProcessor-%d").build()); + + + int processMapThroddle; + + public void tick() { + if (waitDelay < 5) { + waitDelay++; + return; + } + if (bugged) { + return; + } + ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(8); + + if (stack == null || !(stack.getItem() instanceof ItemMap)) { + return; + } + + MapData mapData = ((ItemMap) stack.getItem()).getMapData(stack, mc.theWorld); + + if (mapData != null) { + + if(processMapThroddle > 5 && !processlock){ + processMapData(mapData); + processMapThroddle = 0; + } + processMapThroddle++; + + } + + latestMapData = mapData; + + if (latestMapData != null && mapIconToPlayerMap.size() < context.getPlayers().size() && initialized) { + getPlayersFromMap(latestMapData); + } + + } + + private void processMapData(MapData mapData) { + byte[] mapColorData = mapData.colors; + + // i just cant get this to work sad + if (isThereDifference(latestMapData, mapColorData)) { + context.createEvent(new DungeonMapUpdateEvent(mapColorData)); + + es.execute(() -> { + processlock = true; + if (doorDimensions == null || !initialized) { + assembleMap(mapColorData); + } else { + processMap(mapColorData); + } + + if (context.isEnded()) { + processFinishedMap(mapColorData); + } + processlock = false; + }); + + } + + } + + void assembleMap(final byte[] mapData){ + DungeonMapData data = new DungeonMapData(context, Minecraft.getMinecraft()); + + data.eat(mapData); + + bugged = data.bugged; + + unitRoomDimension = data.unitRoomDimension; + + topLeftMapPoint = data.topLeftMapPoint; + + initialized = data.initialized; + + doorDimensions = data.doorDimensions; + + } + + + public static Point mapPointToRoomPoint(Point mapPoint, Point topLeftMapPoint, Dimension unitRoomDimension, Dimension doorDimensions) { + int x = (int) ((mapPoint.x - topLeftMapPoint.x) / ((double) unitRoomDimension.width + doorDimensions.height)); + int y = (int) ((mapPoint.y - topLeftMapPoint.y) / ((double) unitRoomDimension.height + doorDimensions.height)); + return new Point(x, y); + } + + public BlockPos mapPointToWorldPoint(Point mapPoint) { + int x = (int) ((mapPoint.x - topLeftMapPoint.x) / ((double) unitRoomDimension.width + doorDimensions.height) * 32 + context.getDungeonMin().getX()); + int y = (int) ((mapPoint.y - topLeftMapPoint.y) / ((double) unitRoomDimension.height + doorDimensions.height) * 32 + context.getDungeonMin().getZ()); + return new BlockPos(x, 70, y); + } + + public Point roomPointToMapPoint(Point roomPoint) { + return new Point(roomPoint.x * (unitRoomDimension.width + doorDimensions.height) + topLeftMapPoint.x, roomPoint.y * (unitRoomDimension.height + doorDimensions.height) + topLeftMapPoint.y); + } + + public BlockPos roomPointToWorldPoint(Point roomPoint) { + return new BlockPos(context.getDungeonMin().getX() + (roomPoint.x * 32), context.getDungeonMin().getY(), context.getDungeonMin().getZ() + (roomPoint.y * 32)); + } + + public Point worldPointToRoomPoint(BlockPos worldPoint) { + if (context.getDungeonMin() == null) return null; + return new Point((worldPoint.getX() - context.getDungeonMin().getX()) / 32, (worldPoint.getZ() - context.getDungeonMin().getZ()) / 32); + } + + public Point worldPointToMapPoint(Vec3 worldPoint) { + if (context.getDungeonMin() == null) return null; + return new Point(topLeftMapPoint.x + (int) ((worldPoint.xCoord - context.getDungeonMin().getX()) / 32.0f * (unitRoomDimension.width + doorDimensions.height)), topLeftMapPoint.y + (int) ((worldPoint.zCoord - context.getDungeonMin().getZ()) / 32.0f * (unitRoomDimension.height + doorDimensions.height))); + } + + public Vector2d worldPointToMapPointFLOAT(Vec3 worldPoint) { + if (context.getDungeonMin() == null) return null; + double x = topLeftMapPoint.x + ((worldPoint.xCoord - context.getDungeonMin().getX()) / 32.0f * (unitRoomDimension.width + doorDimensions.height)); + double y = topLeftMapPoint.y + ((worldPoint.zCoord - context.getDungeonMin().getZ()) / 32.0f * (unitRoomDimension.height + doorDimensions.height)); + return new Vector2d(x, y); + } + + private void processMap(byte[] mapData) { + int roomHeight = (int) ((128.0 - topLeftMapPoint.y) / (unitRoomDimension.height + doorDimensions.height)); + int roomWidth = (int) ((128.0 - topLeftMapPoint.x) / (unitRoomDimension.width + doorDimensions.height)); + if (MapUtils.getMapColorAt(mapData, 0, 0) != 0) return; + undiscoveredRoom = 0; + for (int y = 0; y <= roomHeight; y++) { + for (int x = 0; x <= roomWidth; x++) { + Point mapPoint = roomPointToMapPoint(new Point(x, y)); + byte color = MapUtils.getMapColorAt(mapData, mapPoint.x, mapPoint.y); + MapUtils.record(mapData, mapPoint.x, mapPoint.y, new Color(255, 255, 0, 80)); + if (roomsFound.contains(new Point(x, y))) { + DungeonRoom dungeonRoom = context.getRoomMapper().get(new Point(x, y)); + if (color == 18 && dungeonRoom.getCurrentState() != DungeonRoom.RoomState.FINISHED) { + dungeonRoom.setCurrentState(DungeonRoom.RoomState.COMPLETE_WITHOUT_SECRETS); + dungeonRoom.setTotalSecrets(0); + } else if (color == 30) { + dungeonRoom.setCurrentState(DungeonRoom.RoomState.FINISHED); + dungeonRoom.setTotalSecrets(0); + } else if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.FINISHED) { + byte centerColor = MapUtils.getMapColorAt(mapData, mapPoint.x + unitRoomDimension.width / 2, mapPoint.y + unitRoomDimension.height / 2); + MapUtils.record(mapData, mapPoint.x + unitRoomDimension.width / 2, mapPoint.y + unitRoomDimension.height / 2, new Color(0, 255, 0, 80)); + if (centerColor == 34) { + dungeonRoom.setCurrentState(DungeonRoom.RoomState.COMPLETE_WITHOUT_SECRETS); + } else if (centerColor == 30) { + dungeonRoom.setCurrentState(DungeonRoom.RoomState.FINISHED); + } else if (centerColor == 18) { // red + dungeonRoom.setCurrentState(DungeonRoom.RoomState.FAILED); + } + } + if (dungeonRoom.getTotalSecrets() == -1) { + if (dungeonRoom.getColor() == 82 || dungeonRoom.getColor() == 74) { + dungeonRoom.setTotalSecrets(0); + } + MapUtils.record(mapData, mapPoint.x, mapPoint.y + 1, new Color(0, 255, 0, 80)); + } + continue; + } + + if (color != 0 && color != 85) { + MapUtils.record(mapData, mapPoint.x, mapPoint.y, new Color(0, 255, 255, 80)); + DungeonRoom room = buildRoom(mapData, new Point(x, y)); + + + // USELESS DEBUG CODE + context.createEvent(new DungeonRoomDiscoverEvent(room.getUnitPoints().get(0), room.getRoomMatcher().getRotation(), new SerializableBlockPos(room.getMin()), new SerializableBlockPos(room.getMax()), room.getShape(), room.getColor(), room.getDungeonRoomInfo().getUuid(), room.getDungeonRoomInfo().getName(), room.getDungeonRoomInfo().getProcessorId())); + ChatTransmitter.sendDebugChat(new ChatComponentText("New Map discovered! shape: " + room.getShape() + " color: " + room.getColor() + " unitPos: " + x + "," + y)); + ChatTransmitter.sendDebugChat(new ChatComponentText("New Map discovered! mapMin: " + room.getMin() + " mapMx: " + room.getMax())); + StringBuilder builder = new StringBuilder(); + for (int dy = 0; dy < 4; dy++) { + builder.append("\n"); + for (int dx = 0; dx < 4; dx++) { + boolean isSet = ((room.getShape() >> (dy * 4 + dx)) & 0x1) != 0; + builder.append(isSet ? "O" : "X"); + } + } + ChatTransmitter.sendDebugChat(new ChatComponentText("Shape visual: " + builder)); + // END + + + context.getDungeonRoomList().add(room); + for (Point p : room.getUnitPoints()) { + roomsFound.add(p); + context.getRoomMapper().put(p, room); + } + if (room.getRoomProcessor() != null && room.getRoomProcessor().readGlobalChat()) { + context.getGlobalRoomProcessors().add(room.getRoomProcessor()); + } + } else if (color == 85) { + undiscoveredRoom++; + } + + } + } + } + + private DungeonRoom buildRoom(byte[] mapData, Point unitPoint) { + Queue<Point[]> toCheck = new LinkedList<>(); + toCheck.add(new Point[]{unitPoint, unitPoint}); // requestor, target + Set<Point> checked = new HashSet<>(); + List<Point> ayConnected = new ArrayList<>(); + + int minX = Integer.MAX_VALUE; + int minY = Integer.MAX_VALUE; + int maxX = 0; + int maxY = 0; + while (toCheck.peek() != null) { + Point[] check = toCheck.poll(); + if (checked.contains(check[1])) { + continue; + } + checked.add(check[1]); + + if (checkIfConnected(mapData, check[0], check[1])) { + ayConnected.add(check[1]); + if (check[1].x < minX) minX = check[1].x; + if (check[1].y < minY) minY = check[1].y; + if (check[1].x > maxX) maxX = check[1].x; + if (check[1].y > maxY) maxY = check[1].y; + for (Vector2d dir : directions) { + Point newPt = new Point(check[1].x + (int) dir.x, check[1].y + (int) dir.y); + toCheck.add(new Point[]{check[1], newPt}); + } + } + } + + short shape = 0; + for (Point p : ayConnected) { + int localX = p.x - minX; + int localY = p.y - minY; + shape |= 1 << (localY * 4 + localX); + } + Set<Vector2d> doors = new HashSet<>(); + for (Point p : ayConnected) { + for (Vector2d v : door_dirs) { + Vector2d v2 = new Vector2d(p.x + v.x, p.y + v.y); + if (doors.contains(v2)) doors.remove(v2); + else doors.add(v2); + } + } + Point pt2 = roomPointToMapPoint(ayConnected.get(0)); + byte unit1 = MapUtils.getMapColorAt(mapData, pt2.x, pt2.y); + + // 0: none 1: open door 2. unopen door 3: wither door 4. red door + Set<Tuple<Vector2d, EDungeonDoorType>> doorsAndStates = new HashSet<>(); + final int halfWidth = unitRoomDimension.width + 4; + for (Vector2d door : doors) { + int floorX = (int) Math.floor(door.x); + int floorY = (int) Math.floor(door.y); + Point mapPt = roomPointToMapPoint(new Point(floorX, floorY)); + Point target = new Point(mapPt.x + unitRoomDimension.width / 2 + (int) (halfWidth * (door.x - floorX)), mapPt.y + unitRoomDimension.height / 2 + (int) (halfWidth * (door.y - floorY))); + MapUtils.record(mapData, target.x, target.y, Color.green); + + byte color = MapUtils.getMapColorAt(mapData, target.x, target.y); + + Vector2d vector2d = new Vector2d(door.x - minX, door.y - minY); + + if (color == 0) { + doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.NONE)); + } else if (color == 85) { + doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.UNOPEN)); + } else if (color == 119) { + doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.WITHER)); + } else if (color == 18 && unit1 != 18) { + doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.BLOOD)); + } else { + doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.ENTRANCE)); + } + + } + + + return new DungeonRoom(ayConnected, shape, unit1, roomPointToWorldPoint(new Point(minX, minY)), roomPointToWorldPoint(new Point(maxX + 1, maxY + 1)).add(-1, 0, -1), context, doorsAndStates); + + } + + private boolean checkIfConnected(byte[] mapData, Point unitPoint1, Point unitPoint2) { + if (unitPoint1 == unitPoint2) return true; + if (unitPoint1.equals(unitPoint2)) return true; + + + Point high; + if (unitPoint2.y > unitPoint1.y) { + high = unitPoint2; + } else { + if (unitPoint2.x > unitPoint1.x) { + high = unitPoint2; + } else { + high = unitPoint1; + } + } + + Point low; + if (high == unitPoint2) { + low = unitPoint1; + } else { + low = unitPoint2; + } + + int xOff = low.x - high.x; + int yOff = low.y - high.y; + Point pt = roomPointToMapPoint(high); + Point pt2 = roomPointToMapPoint(low); + byte unit1 = MapUtils.getMapColorAt(mapData, pt.x, pt.y); + byte unit2 = MapUtils.getMapColorAt(mapData, pt2.x, pt2.y); + pt.translate(xOff, yOff); + byte unit3 = MapUtils.getMapColorAt(mapData, pt.x, pt.y); + + return unit1 == unit2 && unit2 == unit3 && unit1 != 0; + } + + public boolean isThereDifference(MapData latestMapData, byte[] colorData1) { + byte[] colorData = null; + + if(latestMapData != null){ + colorData = latestMapData.colors; + } + + return true; +// boolean equals = Arrays.equals(colorData1, colorData); +// +// boolean foundDIffrentThen0 = false; +// +// +// for (byte colorDatum : colorData) { +// if(colorDatum != 0){ +// foundDIffrentThen0 = true; +// break; +// } +// } +// +// +// return !(equals && foundDIffrentThen0); + } + + private void processFinishedMap(byte[] mapData) { + if (MapUtils.getMapColorAt(mapData, 0, 0) == 0) { + return; + } + if (processed) { + return; + } + processed = true; + + MapUtils.clearMap(); + MapUtils.record(mapData, 0, 0, Color.GREEN); + + + FeatureRegistry.ETC_COLLECT_SCORE.collectDungeonRunData(mapData, context); + + } + + private void getPlayersFromMap(MapData mapdata) { + + if (DungeonsGuide.getDungeonsGuide().verbose) logger.info("Getting players from map"); + + for (Map.Entry<String, Vec4b> stringVec4bEntry : mapdata.mapDecorations.entrySet()) { + String mapDecString = stringVec4bEntry.getKey(); + Vec4b vec4 = stringVec4bEntry.getValue(); + + if (!mapIconToPlayerMap.containsValue(mapDecString)) { + if (DungeonsGuide.getDungeonsGuide().verbose) logger.info("mapIconToPlayerMap dosent have Player"); + + int x = vec4.func_176112_b() / 2 + 64; + int y = vec4.func_176113_c() / 2 + 64; + BlockPos mapPos = mapPointToWorldPoint(new Point(x, y)); + String potentialPlayer = null; + + for (String player : context.getPlayers()) { + if (DungeonsGuide.getDungeonsGuide().verbose) + logger.info("Player: {} isNear: {} ", player, isPlayerNear(player, mapPos)); +// if (!mapIconToPlayerMap.containsKey(player) && isPlayerNear(player, mapPos)) { + if (!mapIconToPlayerMap.containsKey(player)) { + if (DungeonsGuide.getDungeonsGuide().verbose) logger.info("Potential profile is: " + player); + potentialPlayer = player; + break; + } + } + + + if (potentialPlayer != null) { + if (DungeonsGuide.getDungeonsGuide().verbose) logger.info("potentialPlayer is not null"); + boolean shouldSave = true; + + for (Map.Entry<String, Vec4b> vec4bEntry : mapdata.mapDecorations.entrySet()) { +// String aaa = vec4bEntry.getKey(); + Vec4b bbb = vec4bEntry.getValue(); + +// if (mapIconToPlayerMap.containsValue(aaa) || mapDecString.equals(aaa)) { +// shouldSave = false; +// break; +// } +// else { + int x2 = bbb.func_176112_b() / 2 + 64; + int y2 = bbb.func_176113_c() / 2 + 64; + int dx = x2 - x; + int dy = y2 - y; + if (dx * dx + dy * dy < clossnessDistance) { + shouldSave = false; + break; + } +// } + } + + if (shouldSave) { + if (DungeonsGuide.getDungeonsGuide().verbose) + logger.info("added {} to mapIconPlayerMap with {}", potentialPlayer, stringVec4bEntry.getKey()); + if (mapIconToPlayerMap.containsKey(potentialPlayer)) { + mapIconToPlayerMap.replace(potentialPlayer, stringVec4bEntry.getKey()); + } else { + mapIconToPlayerMap.put(potentialPlayer, stringVec4bEntry.getKey()); + } + if (DungeonsGuide.getDungeonsGuide().verbose) logger.info("mapIconToPlayerMap:"); + if (DungeonsGuide.getDungeonsGuide().verbose) + mapIconToPlayerMap.forEach((key, value) -> logger.info(" {}: {}", key, value)); + } else { + if (DungeonsGuide.getDungeonsGuide().verbose) logger.info("shouldSave is false"); + } + + + } else { + if (DungeonsGuide.getDungeonsGuide().verbose) logger.info("potentialPlayer is null"); + } + + } else { + if (DungeonsGuide.getDungeonsGuide().verbose) logger.info("mapIconToPlayerMap has player "); + } + } + + + } + + private boolean isPlayerNear(String player, BlockPos mapPos) { + EntityPlayer entityPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(player); + + if (entityPlayer != null && !entityPlayer.isInvisible()) { + BlockPos pos = entityPlayer.getPosition(); + int dx = mapPos.getX() - pos.getX(); + int dz = mapPos.getZ() - pos.getZ(); + return dx * dx + dz * dz < clossnessDistance; + + } + + return false; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/AbstractAction.java index c9a8ac9a..42f43bb9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/AbstractAction.java @@ -16,42 +16,46 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerInteractEntityEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -public abstract class AbstractAction implements Action { - @Override - public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) { +import java.util.Set; + +public abstract class AbstractAction { + public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRouteProperties actionRouteProperties){ } - @Override - public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) { + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties, boolean flag) { } - @Override - public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event, ActionRouteProperties actionRouteProperties) { } - @Override - public void onRenderScreen(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void onRenderScreen(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties) { } - @Override - public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event, ActionRouteProperties actionRouteProperties) { } - @Override - public void onTick(DungeonRoom dungeonRoom, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void onTick(DungeonRoom dungeonRoom, ActionRouteProperties actionRouteProperties) { + + } + + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { + return null; + } + public boolean isComplete(DungeonRoom dungeonRoom) { + return false; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionBreakWithSuperBoom.java index b9307e0c..478a8c40 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionBreakWithSuperBoom.java @@ -16,13 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.GlStateManager; @@ -39,26 +40,27 @@ import java.util.HashSet; import java.util.Set; @Data +@EqualsAndHashCode(callSuper=false) public class ActionBreakWithSuperBoom extends AbstractAction { - private Set<Action> preRequisite = new HashSet<Action>(); + private Set<AbstractAction> preRequisite = new HashSet<AbstractAction>(); private OffsetPoint target; - public ActionBreakWithSuperBoom(OffsetPoint target) { - this.target = target; - } - @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { return preRequisite; } @Override public boolean isComplete(DungeonRoom dungeonRoom) { - return target.getBlock(dungeonRoom) == Blocks.air; + return false; + } + + public ActionBreakWithSuperBoom(OffsetPoint target) { + this.target = target; } @Override - public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) { + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties, boolean flag) { Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); BlockPos blockpos = target.getBlockPos(dungeonRoom); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionChangeState.java index f88a3826..0a0722dd 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionChangeState.java @@ -16,12 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonDummy; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; + + import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import lombok.Data; import lombok.EqualsAndHashCode; @@ -29,9 +31,10 @@ import java.util.HashSet; import java.util.Set; @Data -public class ActionChangeState extends AbstractAction{ +@EqualsAndHashCode(callSuper=false) +public class ActionChangeState extends AbstractAction { @EqualsAndHashCode.Exclude - private Set<Action> preRequisite2 = new HashSet<Action>(); + private Set<AbstractAction> preRequisite2 = new HashSet<AbstractAction>(); private String mechanicName; private String state; @@ -42,9 +45,8 @@ public class ActionChangeState extends AbstractAction{ } @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { - Set<Action> set = new HashSet<Action>(); - set.addAll(preRequisite2); + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { + Set<AbstractAction> set = new HashSet<>(preRequisite2); DungeonMechanic mechanic = dungeonRoom.getMechanics().get(mechanicName); if (mechanic!= null) set.addAll(mechanic.getAction(state, dungeonRoom)); @@ -58,14 +60,18 @@ public class ActionChangeState extends AbstractAction{ @Override public boolean isComplete(DungeonRoom dungeonRoom) { DungeonMechanic mechanic = dungeonRoom.getMechanics().get(mechanicName); - if (state.equalsIgnoreCase("navigate")) + if (state.equalsIgnoreCase("navigate")) { return true; - if (mechanic== null) + } + if (mechanic == null) { return false; - if (mechanic instanceof DungeonSecret && ((DungeonSecret) mechanic).getSecretType() != DungeonSecret.SecretType.CHEST) + } + if (mechanic instanceof DungeonSecret && ((DungeonSecret) mechanic).getSecretType() != DungeonSecret.SecretType.CHEST) { return true; - if (mechanic instanceof DungeonDummy) + } + if (mechanic instanceof DungeonDummy) { return true; + } return mechanic.getCurrentState(dungeonRoom).equalsIgnoreCase(state); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionClick.java index a903bcee..b6fa0e89 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionClick.java @@ -16,15 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -34,8 +36,9 @@ import java.util.HashSet; import java.util.Set; @Data +@EqualsAndHashCode(callSuper=false) public class ActionClick extends AbstractAction { - private Set<Action> preRequisite = new HashSet<Action>(); + private Set<AbstractAction> preRequisite = new HashSet<AbstractAction>(); private OffsetPoint target; private Predicate<ItemStack> predicate = Predicates.alwaysTrue(); @@ -46,7 +49,7 @@ public class ActionClick extends AbstractAction { } @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { return preRequisite; } @@ -56,15 +59,16 @@ public class ActionClick extends AbstractAction { } @Override - public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRouteProperties actionRouteProperties) { if (clicked) return; if (target.getBlockPos(dungeonRoom).equals(event.pos) && (predicate == null || predicate.apply(event.entityLiving.getHeldItem()))) { clicked = true; + ChatTransmitter.sendDebugChat("ACTION FINISHED: CLICK"); } } @Override - public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) { + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties, boolean flag) { BlockPos pos = target.getBlockPos(dungeonRoom); RenderUtils.highlightBlock(pos, new Color(0, 255,255,50),partialTicks, true); RenderUtils.drawTextAtWorld("Click", pos.getX() + 0.5f, pos.getY() + 0.3f, pos.getZ() + 0.5f, 0xFFFFFF00, 0.02f, false, false, partialTicks); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionClickSet.java index 24bad024..f4b26e3a 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionClickSet.java @@ -16,16 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -33,19 +32,21 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import java.awt.*; import java.util.HashSet; import java.util.Set; +import java.util.function.Predicate; @Data +@EqualsAndHashCode(callSuper=false) public class ActionClickSet extends AbstractAction { - private Set<Action> preRequisite = new HashSet<Action>(); + private Set<AbstractAction> preRequisite = new HashSet<>(); private OffsetPointSet target; - private Predicate<ItemStack> predicate = Predicates.alwaysTrue(); + private Predicate<ItemStack> predicate = stack -> true; public ActionClickSet(OffsetPointSet target) { this.target = target; } @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { return preRequisite; } @@ -56,11 +57,10 @@ public class ActionClickSet extends AbstractAction { private boolean clicked = false; @Override - public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event, ActionRouteProperties actionRouteProperties) { if (clicked) return; for (OffsetPoint pt2: target.getOffsetPointList()) { - if (pt2.getBlockPos(dungeonRoom).equals(event.pos) && - (predicate == null || predicate.apply(event.entityLiving.getHeldItem()))) { + if (pt2.getBlockPos(dungeonRoom).equals(event.pos) && predicate.test(event.entityLiving.getHeldItem())) { clicked = true; } } @@ -68,7 +68,7 @@ public class ActionClickSet extends AbstractAction { } @Override - public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) { + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties, boolean flag) { float xAcc = 0; float yAcc = 0; float zAcc = 0; @@ -83,7 +83,6 @@ public class ActionClickSet extends AbstractAction { RenderUtils.drawTextAtWorld("Click", xAcc / size, yAcc / size, zAcc / size, 0xFFFFFF00, 0.02f, false, false, partialTicks); } - @Override public boolean isComplete(DungeonRoom dungeonRoom) { return clicked; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionComplete.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionComplete.java new file mode 100644 index 00000000..32d6bfc3 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionComplete.java @@ -0,0 +1,41 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; + +import java.util.Collections; +import java.util.Set; + +public class ActionComplete extends AbstractAction { + @Override + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { + return Collections.emptySet(); + } + + @Override + public boolean isComplete(DungeonRoom dungeonRoom) { + return false; + } + + @Override + public String toString() { + return "Completed"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionDropItem.java index 9d246fc8..065015d2 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionDropItem.java @@ -16,15 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; import com.google.common.base.Predicate; import com.google.common.base.Predicates; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.entity.item.EntityItem; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; @@ -35,8 +36,9 @@ import java.util.List; import java.util.Set; @Data +@EqualsAndHashCode(callSuper = false) public class ActionDropItem extends AbstractAction { - private Set<Action> preRequisite = new HashSet<Action>(); + private Set<AbstractAction> preRequisite = new HashSet<>(); private OffsetPoint target; private Predicate<EntityItem> predicate = Predicates.alwaysTrue(); @@ -45,27 +47,36 @@ public class ActionDropItem extends AbstractAction { } @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { return preRequisite; } @Override public boolean isComplete(DungeonRoom dungeonRoom) { - BlockPos pos = target.getBlockPos(dungeonRoom); + BlockPos secretLocation = target.getBlockPos(dungeonRoom); List<EntityItem> item = dungeonRoom.getContext().getWorld().getEntitiesWithinAABB(EntityItem.class, - AxisAlignedBB.fromBounds(pos.getX(), pos.getY(), pos.getZ(), pos.getX()+1, pos.getY() + 1, pos.getZ() + 1)); - if (item.size() == 0) return false; + AxisAlignedBB.fromBounds( + secretLocation.getX(), + secretLocation.getY(), + secretLocation.getZ(), + secretLocation.getX() + 1, + secretLocation.getY() + 1, + secretLocation.getZ() + 1)); + if (item.isEmpty()) { + return false; + } return (predicate == null || predicate.apply(item.get(0))); } @Override - public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) { + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties, boolean flag) { BlockPos pos = target.getBlockPos(dungeonRoom); - RenderUtils.highlightBlock(pos, new Color(0, 255,255,50),partialTicks, true); + RenderUtils.highlightBlock(pos, new Color(0, 255, 255, 50), partialTicks, true); RenderUtils.drawTextAtWorld("Drop Item", pos.getX() + 0.5f, pos.getY() + 0.3f, pos.getZ() + 0.5f, 0xFFFFFF00, 0.02f, false, false, partialTicks); } + @Override public String toString() { - return "DropItem\n- target: "+target.toString()+"\n- predicate: "+predicate.getClass().getSimpleName(); + return "DropItem\n- target: " + target.toString() + "\n- predicate: " + predicate.getClass().getSimpleName(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionInteract.java index 9b5a22be..eac3c3ce 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionInteract.java @@ -16,17 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonActionContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerInteractEntityEvent; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; @@ -34,12 +35,14 @@ import net.minecraft.util.Vec3; import java.awt.*; import java.util.HashSet; import java.util.Set; +import java.util.function.Predicate; @Data +@EqualsAndHashCode(callSuper=false) public class ActionInteract extends AbstractAction { - private Set<Action> preRequisite = new HashSet<Action>(); + private Set<AbstractAction> preRequisite = new HashSet<>(); private OffsetPoint target; - private Predicate<Entity> predicate = Predicates.alwaysFalse(); + private Predicate<Entity> predicate = entity -> false; private int radius; public ActionInteract(OffsetPoint target) { @@ -47,7 +50,7 @@ public class ActionInteract extends AbstractAction { } @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { return preRequisite; } @@ -58,17 +61,24 @@ public class ActionInteract extends AbstractAction { private boolean interacted = false; @Override - public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event, ActionRouteProperties actionRouteProperties) { if (interacted) return; - Vec3 spawnLoc = DungeonActionManager.getSpawnLocation().get(event.getEntity().getEntityId()); - if (spawnLoc == null) return; - if (target.getBlockPos(dungeonRoom).distanceSq(spawnLoc.xCoord, spawnLoc.yCoord, spawnLoc.zCoord) > radius * radius) return; - if (!predicate.apply(event.getEntity())) return; + Vec3 spawnLoc = DungeonActionContext.getSpawnLocation().get(event.getEntity().getEntityId()); + if (spawnLoc == null) { + return; + } + if (target.getBlockPos(dungeonRoom).distanceSq(spawnLoc.xCoord, spawnLoc.yCoord, spawnLoc.zCoord) > radius * radius) { + return; + } + if (!predicate.test(event.getEntity())) { + return; + } interacted = true; } + @Override - public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) { + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties, boolean flag) { BlockPos pos = target.getBlockPos(dungeonRoom); RenderUtils.highlightBlock(pos, new Color(0, 255,255,50),partialTicks, true); RenderUtils.drawTextAtWorld("Interact", pos.getX() + 0.5f, pos.getY() + 0.3f, pos.getZ() + 0.5f, 0xFFFFFF00, 0.02f, false, false, partialTicks); @@ -76,6 +86,6 @@ public class ActionInteract extends AbstractAction { @Override public String toString() { - return "InteractEntity\n- target: "+target.toString()+"\n- radius: "+radius+"\n- predicate: "+(predicate == null ? "null" : predicate.getClass().getSimpleName()); + return "InteractEntity\n- target: "+target.toString()+"\n- radius: "+radius+"\n- predicate: "+(predicate.test(null) ? "null" : predicate.getClass().getSimpleName()); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionKill.java index a048bdf6..8beaec1c 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionKill.java @@ -16,16 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonActionContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; @@ -34,12 +35,14 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent; import java.awt.*; import java.util.HashSet; import java.util.Set; +import java.util.function.Predicate; @Data +@EqualsAndHashCode(callSuper=false) public class ActionKill extends AbstractAction { - private Set<Action> preRequisite = new HashSet<Action>(); + private Set<AbstractAction> preRequisite = new HashSet<AbstractAction>(); private OffsetPoint target; - private Predicate<Entity> predicate = Predicates.alwaysFalse(); + private Predicate<Entity> predicate = entity -> false; private int radius; public ActionKill(OffsetPoint target) { @@ -47,16 +50,16 @@ public class ActionKill extends AbstractAction { } @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { return preRequisite; } @Override public boolean isComplete(DungeonRoom dungeonRoom) { Vec3 spawn = new Vec3(target.getBlockPos(dungeonRoom)); - for (Integer killed : DungeonActionManager.getKilleds()) { - if (DungeonActionManager.getSpawnLocation().get(killed) == null) continue; - if (DungeonActionManager.getSpawnLocation().get(killed).squareDistanceTo(spawn) < 100) { + for (Integer killed : DungeonActionContext.getKilleds()) { + if (DungeonActionContext.getSpawnLocation().get(killed) == null) continue; + if (DungeonActionContext.getSpawnLocation().get(killed).squareDistanceTo(spawn) < 100) { return true; } } @@ -66,17 +69,17 @@ public class ActionKill extends AbstractAction { private boolean killed = false; @Override - public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event, ActionRouteProperties actionRouteProperties) { if (killed) return; - Vec3 spawnLoc = DungeonActionManager.getSpawnLocation().get(event.entity.getEntityId()); + Vec3 spawnLoc = DungeonActionContext.getSpawnLocation().get(event.entity.getEntityId()); if (spawnLoc == null) return; if (target.getBlockPos(dungeonRoom).distanceSq(spawnLoc.xCoord, spawnLoc.yCoord, spawnLoc.zCoord) > radius * radius) return; - if (!predicate.apply(event.entity)) return; + if (!predicate.test(event.entity)) return; killed = true; } @Override - public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) { + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties, boolean flag) { BlockPos pos = target.getBlockPos(dungeonRoom); RenderUtils.highlightBlock(pos, new Color(0, 255,255,50),partialTicks, true); RenderUtils.drawTextAtWorld("Spawn", pos.getX() + 0.5f, pos.getY() + 0.3f, pos.getZ() + 0.5f, 0xFFFFFF00, 0.02f, false, false, partialTicks); @@ -84,6 +87,6 @@ public class ActionKill extends AbstractAction { @Override public String toString() { - return "KillEntity\n- target: "+target.toString()+"\n- radius: "+radius+"\n- predicate: "+(predicate == null ? "null" : predicate.getClass().getSimpleName()); + return "KillEntity\n- target: "+target.toString()+"\n- radius: "+radius+"\n- predicate: "+(predicate.test(null) ? "null" : predicate.getClass().getSimpleName()); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java index 6f04b44d..fb05ecc5 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java @@ -16,28 +16,32 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; + -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; + +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.client.Minecraft; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import java.util.HashSet; -import java.util.Set; import java.util.List; +import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @Data +@EqualsAndHashCode(callSuper=false) public class ActionMove extends AbstractAction { - private Set<Action> preRequisite = new HashSet<Action>(); + private Set<AbstractAction> preRequisite = new HashSet<>(); private OffsetPoint target; public ActionMove(OffsetPoint target) { @@ -45,7 +49,7 @@ public class ActionMove extends AbstractAction { } @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { return preRequisite; } @@ -55,7 +59,11 @@ public class ActionMove extends AbstractAction { } @Override - public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) { + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties, boolean flag) { + draw(dungeonRoom, partialTicks, actionRouteProperties, flag, target, poses); + } + + static void draw(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties, boolean flag, OffsetPoint target, List<Vec3> poses) { BlockPos pos = target.getBlockPos(dungeonRoom); float distance = MathHelper.sqrt_double(pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())); @@ -64,10 +72,14 @@ public class ActionMove extends AbstractAction { float scale = 0.45f * multiplier; scale *= 25.0 / 6.0; if (actionRouteProperties.isBeacon()) { - RenderUtils.renderBeaconBeam(pos.getX(), pos.getY(), pos.getZ(), actionRouteProperties.getBeaconBeamColor(), partialTicks); + if(!FeatureRegistry.RENDER_BREACONS.isEnabled()){ + RenderUtils.renderBeaconBeam(pos.getX(), pos.getY(), pos.getZ(), actionRouteProperties.getBeaconBeamColor(), partialTicks); + } RenderUtils.highlightBlock(pos, actionRouteProperties.getBeaconColor(), partialTicks); } - RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, pos.getY() + 0.5f + scale, pos.getZ() + 0.5f, 0xFF00FF00, flag ? 2f : 1f, true, false, partialTicks); + if(!FeatureRegistry.RENDER_DESTENATION_TEXT.isEnabled()){ + RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, pos.getY() + 0.5f + scale, pos.getZ() + 0.5f, 0xFF00FF00, flag ? 2f : 1f, true, false, partialTicks); + } RenderUtils.drawTextAtWorld(String.format("%.2f",MathHelper.sqrt_double(pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())))+"m", pos.getX() + 0.5f, pos.getY() + 0.5f - scale, pos.getZ() + 0.5f, 0xFFFFFF00, flag ? 2f : 1f, true, false, partialTicks); if (!FeatureRegistry.SECRET_TOGGLE_KEY.isEnabled() || !FeatureRegistry.SECRET_TOGGLE_KEY.togglePathfindStatus) { @@ -82,7 +94,7 @@ public class ActionMove extends AbstractAction { private Future<List<Vec3>> latestFuture; @Override - public void onTick(DungeonRoom dungeonRoom, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void onTick(DungeonRoom dungeonRoom, ActionRouteProperties actionRouteProperties) { tick = (tick+1) % Math.max(1, actionRouteProperties.getLineRefreshRate()); if (latestFuture != null && latestFuture.isDone()) { try { @@ -94,16 +106,16 @@ public class ActionMove extends AbstractAction { } if (tick == 0 && actionRouteProperties.isPathfind() && latestFuture == null) { - if (!FeatureRegistry.SECRET_FREEZE_LINES.isEnabled() || poses == null) + if (!FeatureRegistry.SECRET_FREEZE_LINES.isEnabled() || poses == null) { latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, 10000); + } } } public void forceRefresh(DungeonRoom dungeonRoom) { - try { - if (latestFuture != null) return; - } catch (Exception ignored) {} - latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, 10000); + if (latestFuture == null) { + latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, 10000); + } } @Override public String toString() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMoveNearestAir.java index 1535d574..e98efce9 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMoveNearestAir.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.client.Minecraft; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import java.util.HashSet; @@ -36,8 +36,9 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @Data +@EqualsAndHashCode(callSuper=false) public class ActionMoveNearestAir extends AbstractAction { - private Set<Action> preRequisite = new HashSet<Action>(); + private Set<AbstractAction> preRequisite = new HashSet<>(); private OffsetPoint target; public ActionMoveNearestAir(OffsetPoint target) { @@ -45,7 +46,7 @@ public class ActionMoveNearestAir extends AbstractAction { } @Override - public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { return preRequisite; } @@ -53,35 +54,16 @@ public class ActionMoveNearestAir extends AbstractAction { public boolean isComplete(DungeonRoom dungeonRoom) { return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 25; } - @Override - public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRoute.ActionRouteProperties actionRouteProperties, boolean flag) { - BlockPos pos = target.getBlockPos(dungeonRoom); - - float distance = MathHelper.sqrt_double(pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())); - float multiplier = distance / 120f; //mobs only render ~120 blocks away - if (flag) multiplier *= 2.0f; - float scale = 0.45f * multiplier; - scale *= 25.0 / 6.0; - if (actionRouteProperties.isBeacon()) { - RenderUtils.renderBeaconBeam(pos.getX(), pos.getY(), pos.getZ(), actionRouteProperties.getBeaconBeamColor(), partialTicks); - RenderUtils.highlightBlock(pos, actionRouteProperties.getBeaconColor(), partialTicks); - } - RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, pos.getY() + 0.5f + scale, pos.getZ() + 0.5f, 0xFF00FF00, flag ? 2f : 1f, true, false, partialTicks); - RenderUtils.drawTextAtWorld(String.format("%.2f",MathHelper.sqrt_double(pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())))+"m", pos.getX() + 0.5f, pos.getY() + 0.5f - scale, pos.getZ() + 0.5f, 0xFFFFFF00, flag ? 2f : 1f, true, false, partialTicks); - - if (!FeatureRegistry.SECRET_TOGGLE_KEY.isEnabled() || !FeatureRegistry.SECRET_TOGGLE_KEY.togglePathfindStatus) { - if (poses != null){ - RenderUtils.drawLinesVec3(poses, actionRouteProperties.getLineColor(), actionRouteProperties.getLineWidth(), partialTicks, true); - } - } + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks, ActionRouteProperties actionRouteProperties, boolean flag) { + ActionMove.draw(dungeonRoom, partialTicks, actionRouteProperties, flag, target, poses); } private int tick = -1; private List<Vec3> poses; private Future<List<Vec3>> latestFuture; @Override - public void onTick(DungeonRoom dungeonRoom, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void onTick(DungeonRoom dungeonRoom, ActionRouteProperties actionRouteProperties) { tick = (tick+1) % Math.max(1, actionRouteProperties.getLineRefreshRate()); if (latestFuture != null && latestFuture.isDone()) { try { @@ -93,17 +75,17 @@ public class ActionMoveNearestAir extends AbstractAction { } if (tick == 0 && actionRouteProperties.isPathfind() && latestFuture == null) { - if (!FeatureRegistry.SECRET_FREEZE_LINES.isEnabled() || poses == null) + if (!FeatureRegistry.SECRET_FREEZE_LINES.isEnabled() || poses == null) { latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, 10000); + } } } public void forceRefresh(DungeonRoom dungeonRoom) { - try { - if (latestFuture != null) return; - } catch (Exception ignored) {} - latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, 10000); + if (latestFuture == null) { + latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, 10000); + } } @Override public String toString() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionRoot.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionRoot.java new file mode 100755 index 00000000..23b9fdce --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionRoot.java @@ -0,0 +1,47 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.actions; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.HashSet; +import java.util.Set; + +@Data +@EqualsAndHashCode(callSuper=false) +public class ActionRoot extends AbstractAction { + private Set<AbstractAction> preRequisite = new HashSet<>(); + + @Override + public Set<AbstractAction> getPreRequisites(DungeonRoom dungeonRoom) { + return preRequisite; + } + + @Override + public boolean isComplete(DungeonRoom dungeonRoom) { + return true; + } + + @Override + public String toString() { + return "Action Root"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRoute.java index bba5fb4d..c6903e7b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRoute.java @@ -16,13 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions.tree; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.actions.*; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; -import lombok.Data; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerInteractEntityEvent; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraftforge.event.entity.living.LivingDeathEvent; @@ -39,7 +38,7 @@ public class ActionRoute { @Getter private int current; @Getter - private final List<Action> actions; + private final List<AbstractAction> actions; private final DungeonRoom dungeonRoom; @@ -51,27 +50,40 @@ public class ActionRoute { this.state = state; this.actionRouteProperties = actionRouteProperties; + System.out.println("Creating Action Route with mechanic:" + mechanic + " State:" + state); ActionChangeState actionChangeState = new ActionChangeState(mechanic, state); ActionTree tree= ActionTree.buildActionTree(actionChangeState, dungeonRoom); actions = ActionTreeUtil.linearifyActionTree(tree); actions.add(new ActionComplete()); + ChatTransmitter.sendDebugChat("Created ActionRoute with " + actions.size() + " steps"); + ChatTransmitter.sendDebugChat("========== STEPS =========="); + for (AbstractAction action : actions) { + ChatTransmitter.sendDebugChat(action.toString()); + } + ChatTransmitter.sendDebugChat("=========== END ==========="); + + current = 0; this.dungeonRoom = dungeonRoom; } - public Action next() { + public AbstractAction next() { current ++; - if (current >= actions.size()) current = actions.size() - 1; - return actions.get(current); + if (current >= actions.size()) { + current = actions.size() - 1; + } + return getCurrentAction(); } - public Action prev() { + public AbstractAction prev() { current --; - if (current < 0) current = 0; - return actions.get(current); + if (current < 0) { + current = 0; + } + return getCurrentAction(); } - public Action getCurrentAction() { + public AbstractAction getCurrentAction() { return actions.get(current); } @@ -84,9 +96,19 @@ public class ActionRoute { getCurrentAction().onLivingDeath(dungeonRoom, event, actionRouteProperties ); } public void onRenderWorld(float partialTicks, boolean flag) { - if (current -1 >= 0 && ( - (actions.get(current-1) instanceof ActionMove && ((ActionMove) actions.get(current-1)).getTarget().getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) >= 25) - || (actions.get(current-1) instanceof ActionMoveNearestAir && ((ActionMoveNearestAir) actions.get(current-1)).getTarget().getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) >= 25))) actions.get(current-1).onRenderWorld(dungeonRoom, partialTicks, actionRouteProperties, flag ); + + + if (current -1 >= 0) { + AbstractAction abstractAction = actions.get(current - 1); + if(((abstractAction instanceof ActionMove && ((ActionMove) abstractAction).getTarget().getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) >= 25) + || (abstractAction instanceof ActionMoveNearestAir && ((ActionMoveNearestAir) abstractAction).getTarget().getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) >= 25))){ + abstractAction.onRenderWorld(dungeonRoom, partialTicks, actionRouteProperties, flag ); + } + } + getCurrentAction().onRenderWorld(dungeonRoom, partialTicks, actionRouteProperties, flag); + + + getCurrentAction().onRenderWorld(dungeonRoom, partialTicks, actionRouteProperties, flag); } @@ -95,30 +117,22 @@ public class ActionRoute { } public void onTick() { - Action current = getCurrentAction(); + AbstractAction currentAction = getCurrentAction(); - current.onTick(dungeonRoom, actionRouteProperties); + currentAction.onTick(dungeonRoom, actionRouteProperties); if (this.current -1 >= 0 && (actions.get(this.current-1) instanceof ActionMove || actions.get(this.current-1) instanceof ActionMoveNearestAir)) actions.get(this.current-1).onTick(dungeonRoom, actionRouteProperties ); if (dungeonRoom.getMechanics().get(mechanic).getCurrentState(dungeonRoom).equals(state)) { this.current = actions.size() - 1; } - if (current.isComplete(dungeonRoom)) + if (currentAction.isComplete(dungeonRoom)) { next(); + } } - public void onLivingInteract(PlayerInteractEntityEvent event) { getCurrentAction().onLivingInteract(dungeonRoom, event, actionRouteProperties ); } - - @Data - public static class ActionRouteProperties { - private boolean pathfind; - private int lineRefreshRate; - private AColor lineColor; - private float lineWidth; - - private boolean beacon; - private AColor beaconColor; - private AColor beaconBeamColor; + public void onLivingInteract(PlayerInteractEntityEvent event) { + getCurrentAction().onLivingInteract(dungeonRoom, event, actionRouteProperties ); } + } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRouteProperties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRouteProperties.java new file mode 100644 index 00000000..df32e718 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionRouteProperties.java @@ -0,0 +1,16 @@ +package kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import lombok.Data; + +@Data +public class ActionRouteProperties { + private boolean pathfind; + private int lineRefreshRate; + private AColor lineColor; + private float lineWidth; + + private boolean beacon; + private AColor beaconColor; + private AColor beaconBeamColor; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionTree.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionTree.java index 0fdb97f6..d5becd43 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionTree.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionTree.java @@ -16,51 +16,55 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions.tree; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionRoot; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionRoot; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import lombok.Data; import lombok.EqualsAndHashCode; +import org.jetbrains.annotations.NotNull; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; @Data public class ActionTree implements Cloneable { @EqualsAndHashCode.Exclude private Set<ActionTree> parent; - private Action current; + private AbstractAction current; private Set<ActionTree> children; @Override public int hashCode() { return current == null ? 0 : current.hashCode(); } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ActionTree that = (ActionTree) o; + return Objects.equals(parent, that.parent) && Objects.equals(current, that.current) && Objects.equals(children, that.children); + } - public static ActionTree buildActionTree(Set<Action> actions, DungeonRoom dungeonRoom) { + public static ActionTree buildActionTree(Set<AbstractAction> actions, DungeonRoom dungeonRoom) { ActionRoot root = new ActionRoot(); root.setPreRequisite(actions); ActionTree tree = new ActionTree(); - tree.setParent(new HashSet<ActionTree>()); + tree.setParent(new HashSet<>()); tree.setCurrent(root); - HashSet<ActionTree> set = new HashSet(); - for (Action action : actions) { - set.add(buildActionTree(tree, action, dungeonRoom, new HashMap<Action, ActionTree>())); + HashSet<ActionTree> set = new HashSet<>(); + for (AbstractAction action : actions) { + set.add(buildActionTree(tree, action, dungeonRoom, new HashMap<>())); } tree.setChildren(set); return tree; } - public static ActionTree buildActionTree(Action actions, DungeonRoom dungeonRoom) { - return buildActionTree(null, actions, dungeonRoom, new HashMap<Action, ActionTree>()); + public static ActionTree buildActionTree(AbstractAction actions, DungeonRoom dungeonRoom) { + return buildActionTree(null, actions, dungeonRoom, new HashMap<>()); } - private static ActionTree buildActionTree(ActionTree parent, Action action, DungeonRoom dungeonRoom, Map<Action, ActionTree> alreadyBuilt) { - if (action == null) return null; + private static ActionTree buildActionTree(ActionTree parent, @NotNull AbstractAction action,@NotNull DungeonRoom dungeonRoom, @NotNull Map<AbstractAction, ActionTree> alreadyBuilt) { if (alreadyBuilt.containsKey(action)) { ActionTree tree = alreadyBuilt.get(action); tree.getParent().add(parent); @@ -69,14 +73,21 @@ public class ActionTree implements Cloneable { ActionTree tree = new ActionTree(); alreadyBuilt.put(action, tree); - tree.setParent(new HashSet<ActionTree>()); - if (parent != null) + tree.setParent(new HashSet<>()); + if (parent != null) { tree.getParent().add(parent); + } tree.setCurrent(action); - HashSet<ActionTree> set = new HashSet(); - for (Action action2 : action.getPreRequisites(dungeonRoom)) { - set.add(buildActionTree(tree, action2, dungeonRoom, alreadyBuilt)); + HashSet<ActionTree> set = new HashSet<>(); + + Set<AbstractAction> preRequisites = action.getPreRequisites(dungeonRoom); + if(preRequisites != null){ + for (AbstractAction action2 : preRequisites) { + ActionTree e = buildActionTree(tree, action2, dungeonRoom, alreadyBuilt); + set.add(e); + } } + tree.setChildren(set); return tree; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionTreeUtil.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionTreeUtil.java index 4054f00d..59da2e46 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionTreeUtil.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/tree/ActionTreeUtil.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.actions.tree; +package kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; import java.util.*; public class ActionTreeUtil { - public static List<Action> linearifyActionTree(ActionTree input) { + public static List<AbstractAction> linearifyActionTree(ActionTree input) { ActionTree tree = copyActionTree(input); - List<Action> actions = new ArrayList<Action>(); + List<AbstractAction> actions = new ArrayList<AbstractAction>(); int plsHalt = 0; while (tree.getChildren().size() != 0) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonDoor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/DungeonDoor.java index d0b61120..502d21a8 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonDoor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/DungeonDoor.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.doorfinder; +package kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder; import com.google.common.collect.Sets; import lombok.Getter; @@ -31,7 +31,7 @@ import java.util.Set; public class DungeonDoor { private final World w; private final BlockPos position; - private EDungeonDoorType type; + private final EDungeonDoorType type; private boolean isZDir; private static final Set<Block> legalBlocks = Sets.newHashSet(Blocks.coal_block, Blocks.barrier, Blocks.monster_egg, Blocks.air, Blocks.stained_hardened_clay); @@ -45,33 +45,39 @@ public class DungeonDoor { this.type = type; boolean exist = type.isExist(); - for (int x = -1; x<=1; x++) - for (int y = -1; y<=1; y++) + for (int x = -1; x<=1; x++) { + for (int y = -1; y<=1; y++) { for (int z = -1; z<=1; z++) { BlockPos pos2 = pos.add(x,y,z); Block block = world.getChunkFromBlockCoords(pos2).getBlock(pos2); if (itshouldbeall != block) exist = false; } + } + } if (exist) { BlockPos ZCheck = pos.add(0,0,2); isZDir = world.getChunkFromBlockCoords(ZCheck).getBlock(ZCheck) == Blocks.air; if (isZDir) { - for (int x = -1; x<=1; x++) - for (int y = -1; y<=1; y++) + for (int x = -1; x<=1; x++) { + for (int y = -1; y<=1; y++) { for (int z = -2; z<=2; z+=4) { BlockPos pos2 = pos.add(x,y,z); Block block = world.getChunkFromBlockCoords(pos2).getBlock(pos2); if (block != Blocks.air) exist = false; } + } + } } else { - for (int x = -2; x<=2; x+=4) - for (int y = -1; y<=1; y++) + for (int x = -2; x<=2; x+=4) { + for (int y = -1; y<=1; y++) { for (int z = -1; z<=1; z++) { BlockPos pos2 = pos.add(x,y,z); Block block = world.getChunkFromBlockCoords(pos2).getBlock(pos2); if (block != Blocks.air) exist = false; } + } + } } } if (!exist) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/DungeonSpecificDataProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/DungeonSpecificDataProvider.java new file mode 100755 index 00000000..b34986eb --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/DungeonSpecificDataProvider.java @@ -0,0 +1,39 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessor; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +import javax.vecmath.Vector2d; + +public interface DungeonSpecificDataProvider { + + BlockPos findDoor(World w, String dungeonName); + + Vector2d findDoorOffset(World w, String dungeonName); + BossfightProcessor createBossfightProcessor(World w, String dungeonName); + + boolean isTrapSpawn(String dungeonName); + + double secretPercentage(String dungeonName); + + int speedSecond(String dungeonName); +}
\ No newline at end of file diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProviderRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/DungeonSpecificDataProviderRegistry.java index 7421728e..2d3a0bf2 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonSpecificDataProviderRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/DungeonSpecificDataProviderRegistry.java @@ -16,18 +16,21 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.doorfinder; +package kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder; + +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.catacombs.impl.NormalModeDataProvider; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.catacombs.impl.MasterModeDataProvider; import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; public class DungeonSpecificDataProviderRegistry { - public static final Map<Pattern, DungeonSpecificDataProvider> doorFinders = new HashMap<Pattern, DungeonSpecificDataProvider>(); + public static final Map<Pattern, DungeonSpecificDataProvider> doorFinders = new HashMap<>(); static { - doorFinders.put(Pattern.compile("The Catacombs (?:F[0-9]|E)"), new CatacombDataProvider()); - doorFinders.put(Pattern.compile("The Catacombs (?:M[0-9])"), new CatacombMasterDataProvider()); + doorFinders.put(Pattern.compile("The Catacombs (?:F[0-9]|E)"), new NormalModeDataProvider()); + doorFinders.put(Pattern.compile("The Catacombs (?:M[0-9])"), new MasterModeDataProvider()); } public static DungeonSpecificDataProvider getDoorFinder(String dungeonName) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/EDungeonDoorType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/EDungeonDoorType.java index 3a07629e..05915a1a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/EDungeonDoorType.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/EDungeonDoorType.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.doorfinder; +package kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder; import lombok.AllArgsConstructor; import lombok.Getter; @@ -24,10 +24,15 @@ import lombok.Getter; @AllArgsConstructor @Getter public enum EDungeonDoorType { - NONE(false, false, false,"?"), ENTRANCE(true, false, false, "entrance"), WITHER(true, true,true,"withergate"),WITHER_FAIRY(true, false,true,"wither-fairy-gate"), BLOOD(true, true,true, "bloodgate"), UNOPEN(true, false, false,"gate"); + NONE(false, false, false,"?"), ENTRANCE(true, false, false, "entrance"), + WITHER(true, true,true,"withergate"), + WITHER_FAIRY(true, false,true,"wither-fairy-gate"), + BLOOD(true, true,true, "bloodgate"), + UNOPEN(true, false, false,"gate"); - private boolean exist; - private boolean keyRequired; - private boolean headToBlood; - private String name; + + private final boolean exist; + private final boolean keyRequired; + private final boolean headToBlood; + private final String name; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/catacombs/CatacombsDataProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/catacombs/CatacombsDataProvider.java new file mode 100644 index 00000000..b9052353 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/catacombs/CatacombsDataProvider.java @@ -0,0 +1,75 @@ +package kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.catacombs; + +import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonSpecificDataProvider; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; + +import javax.vecmath.Vector2d; +import java.util.Collection; +import java.util.Set; + +public abstract class CatacombsDataProvider implements DungeonSpecificDataProvider { + + private static final Set<Vector2d> directions = Sets.newHashSet(new Vector2d(0,1), new Vector2d(0, -1), new Vector2d(1, 0), new Vector2d(-1 , 0)); + + @Nullable + static Vector2d getVector2d(World w, Collection<EntityArmorStand> armorStand, Set<Vector2d> directions) { + EntityArmorStand mort = armorStand.iterator().next(); + BlockPos pos = mort.getPosition(); + pos = pos.add(0, 3, 0); + for (int i = 0; i < 5; i++) { + for (Vector2d vector2d: directions) { + BlockPos test = pos.add(vector2d.x * i, 0, vector2d.y * i); + if (w.getChunkFromBlockCoords(test).getBlock(test) == Blocks.iron_bars) { + return vector2d; + } + } + } + return null; + } + + public static Collection<EntityArmorStand> getMorts(World w){ + return w.getEntities(EntityArmorStand.class, input -> input.getName().equals("§bMort")); + } + + /** + * This gets all morts checks for iron bars near him + * and based on iron bars determine the door location + * + * @param w World that we are going to look for the door in + * world is explicitly specified instead of mc.theWorld bc we can use cached worlds + * @param dungeonName dungeon type eg master mode, currently unused + * @return Block pos of the dungeon entrance + */ + public BlockPos findDoor(World w, String dungeonName) { + Collection<EntityArmorStand> armorStand = getMorts(w); + + if (!armorStand.isEmpty()) { + EntityArmorStand mort = armorStand.iterator().next(); + BlockPos pos = mort.getPosition(); + pos = pos.add(0, 3, 0); + for (int i = 0; i < 5; i++) { + for (Vector2d vector2d:directions) { + BlockPos test = pos.add(vector2d.x * i, 0, vector2d.y * i); + if (w.getChunkFromBlockCoords(test).getBlock(test) == Blocks.iron_bars) { + return pos.add(vector2d.x * (i + 2), -2, vector2d.y * (i+2)); + } + } + } + } + return null; + } + + public Vector2d findDoorOffset(World w, String dungeonName) { + Collection<EntityArmorStand> armorStand = getMorts(w); + + if (!armorStand.isEmpty()) { + return getVector2d(w, armorStand, directions); + } + return null; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/catacombs/impl/MasterModeDataProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/catacombs/impl/MasterModeDataProvider.java new file mode 100755 index 00000000..ab3f5df3 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/catacombs/impl/MasterModeDataProvider.java @@ -0,0 +1,64 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.catacombs.impl; + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.catacombs.CatacombsDataProvider; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorLivid; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; + +public class MasterModeDataProvider extends CatacombsDataProvider { + + + @Override + public BossfightProcessor createBossfightProcessor(World w, String dungeonName) { + String floor = dungeonName.substring(14).trim(); + ChatTransmitter.sendDebugChat(new ChatComponentText("Floor: Master mode "+floor+ " Building bossfight processor")); + if (floor.equals("M5")) { + return new BossfightProcessorLivid(true); + } + return null; + } + + @Override + public boolean isTrapSpawn(String dungeonName) { + String floor = dungeonName.substring(14).trim(); + switch (floor) { + case "M3": + case "M4": + case "M5": + case "M6": + return true; + default: + return floor.equals("M7"); + } + } + + @Override + public double secretPercentage(String dungeonName) { + return 1.0; + } + + @Override + public int speedSecond(String dungeonName) { + return 480; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/catacombs/impl/NormalModeDataProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/catacombs/impl/NormalModeDataProvider.java new file mode 100755 index 00000000..880cf473 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/doorfinder/catacombs/impl/NormalModeDataProvider.java @@ -0,0 +1,101 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.catacombs.impl; + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.catacombs.CatacombsDataProvider; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.*; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; + +public class NormalModeDataProvider extends CatacombsDataProvider { + + + @Override + public BossfightProcessor createBossfightProcessor(World w, String dungeonName) { + String floor = dungeonName.substring(14).trim(); + ChatTransmitter.sendDebugChat(new ChatComponentText("Floor: "+floor+ " Building bossfight processor")); + switch (floor) { + case "F1": + return new BossfightProcessorBonzo(); + case "F2": + return new BossfightProcessorScarf(); + case "F3": + return new BossfightProcessorProf(); + case "F4": + return new BossfightProcessorThorn(); + case "F5": + return new BossfightProcessorLivid(false); + case "F6": + return new BossfightProcessorSadan(); + case "F7": + return new BossfightProcessorNecron(); + default: + return null; + } + } + + @Override + public boolean isTrapSpawn(String dungeonName) { + String floor = dungeonName.substring(14).trim(); + switch (floor) { + case "F3": + case "F4": + case "F5": + case "F6": + return true; + default: + return floor.equals("F7"); + } + } + + @Override + public double secretPercentage(String dungeonName) { + String floor = dungeonName.substring(14).trim(); + switch (floor) { + case "F1": + case "E": + return 0.3; + case "F2": + return 0.4; + case "F3": + return 0.5; + case "F4": + return 0.6; + case "F5": + return 0.7; + case "F6": + return 0.85; + default: + return 1.0; + } + } + + @Override + public int speedSecond(String dungeonName) { + String floor = dungeonName.substring(14).trim(); + switch (floor) { + case "F5": + case "F7": + return 720; + default: + return 600; + } + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/DungeonEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/DungeonEvent.java new file mode 100644 index 00000000..0e71a65e --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/DungeonEvent.java @@ -0,0 +1,41 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events; + +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DungeonEvent implements Serializable { + private long UTCTime = System.currentTimeMillis(); + private long realTimeElapsed; + private long skyblockTimeElapsed; + + private String eventName; + private DungeonEventData data; + + public DungeonEvent(DungeonEventData eventData){ + this.data = eventData; + this.realTimeElapsed = FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed(); + this.skyblockTimeElapsed = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed(); + this.eventName = eventData.getEventName(); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/DungeonEventData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/DungeonEventData.java new file mode 100644 index 00000000..812e1488 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/DungeonEventData.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events; + +import java.io.Serializable; + +public interface DungeonEventData extends Serializable { + String getEventName(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/DungeonEventHolder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/DungeonEventHolder.java new file mode 100644 index 00000000..58799f80 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/DungeonEventHolder.java @@ -0,0 +1,32 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +@Data +public class DungeonEventHolder implements Serializable { + private long date; + private Set<String> players; + private List<DungeonEvent> eventDataList; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/SerializableBlockPos.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/SerializableBlockPos.java index ab1031e7..d70ba2c2 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/SerializableBlockPos.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/SerializableBlockPos.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.events; +package kr.syeyoung.dungeonsguide.mod.dungeon.events; import lombok.AllArgsConstructor; import lombok.Data; @@ -26,7 +26,9 @@ import java.io.Serializable; @Data @AllArgsConstructor public class SerializableBlockPos implements Serializable { - private int x, y, z; + private int x; + private int y; + private int z; public SerializableBlockPos(BlockPos pos) { this.x = pos.getX(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonCryptBrokenEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonCryptBrokenEvent.java new file mode 100644 index 00000000..c2a4f71e --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonCryptBrokenEvent.java @@ -0,0 +1,35 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events.impl; + +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventData; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class DungeonCryptBrokenEvent implements DungeonEventData { + private int prevCrypts; + private int newCrypts; + + @Override + public String getEventName() { + return "CRYPTS_CHANGE"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonDeathEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonDeathEvent.java new file mode 100644 index 00000000..09877b80 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonDeathEvent.java @@ -0,0 +1,36 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events.impl; + +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventData; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class DungeonDeathEvent implements DungeonEventData { + private String playerName; + private String message; + private int cnt; + + @Override + public String getEventName() { + return "PLAYER_DEATH"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonMapUpdateEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonMapUpdateEvent.java new file mode 100644 index 00000000..023902c8 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonMapUpdateEvent.java @@ -0,0 +1,34 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events.impl; + +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventData; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class DungeonMapUpdateEvent implements DungeonEventData { + private byte[] map; + + @Override + public String getEventName() { + return "MAP_UPDATE"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonNodataEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonNodataEvent.java new file mode 100644 index 00000000..531f5990 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonNodataEvent.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events.impl; + +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventData; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class DungeonNodataEvent implements DungeonEventData { + private String eventName; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonPuzzleFailureEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonPuzzleFailureEvent.java new file mode 100644 index 00000000..64621339 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonPuzzleFailureEvent.java @@ -0,0 +1,34 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events.impl; + +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventData; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class DungeonPuzzleFailureEvent implements DungeonEventData { + private String playerName; + private String message; + @Override + public String getEventName() { + return "PUZZLE_FAILURE"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonRoomDiscoverEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonRoomDiscoverEvent.java new file mode 100644 index 00000000..09fd64a5 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonRoomDiscoverEvent.java @@ -0,0 +1,46 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events.impl; + +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventData; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.SerializableBlockPos; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.awt.*; +import java.util.UUID; + +@Data +@AllArgsConstructor +public class DungeonRoomDiscoverEvent implements DungeonEventData { + private Point unitPt; + private int rotation; + private SerializableBlockPos min; + private SerializableBlockPos max; + private int shape; + private int color; + private UUID roomUID; + private String roomName; + private String roomProc; + + @Override + public String getEventName() { + return "ROOM_DISCOVER"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonSecretCountChangeEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonSecretCountChangeEvent.java new file mode 100644 index 00000000..21ea853c --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonSecretCountChangeEvent.java @@ -0,0 +1,37 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events.impl; + +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventData; +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class DungeonSecretCountChangeEvent implements DungeonEventData { + private int prevCount; + private int newCount; + private int totalSecret; + private boolean sureTotalSecret; + + @Override + public String getEventName() { + return "SECRET_CNT_CHANGE"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonStateChangeEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonStateChangeEvent.java new file mode 100644 index 00000000..f1cb1167 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/events/impl/DungeonStateChangeEvent.java @@ -0,0 +1,40 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.events.impl; + +import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventData; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.awt.*; + +@Data +@AllArgsConstructor +public class DungeonStateChangeEvent implements DungeonEventData { + private Point unitPt; + private String roomName; + private DungeonRoom.RoomState from; + private DungeonRoom.RoomState to; + + @Override + public String getEventName() { + return "ROOM_STATE_CHANGE"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/map/DungeonMapData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/map/DungeonMapData.java new file mode 100644 index 00000000..9687d554 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/map/DungeonMapData.java @@ -0,0 +1,121 @@ +package kr.syeyoung.dungeonsguide.mod.dungeon.map; + +import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.MapProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonSpecificDataProvider; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.impl.DungeonNodataEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.DungeonContextInitializationEvent; +import kr.syeyoung.dungeonsguide.mod.utils.MapUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.common.MinecraftForge; + +import javax.vecmath.Vector2d; +import java.awt.*; +import java.util.Set; + +public class DungeonMapData { + private static final Set<Vector2d> directions = Sets.newHashSet(new Vector2d(0, 1), new Vector2d(0, -1), new Vector2d(1, 0), new Vector2d(-1, 0)); + private static final Set<Vector2d> door_dirs = Sets.newHashSet(new Vector2d(0, 0.5), new Vector2d(0, -0.5), new Vector2d(0.5, 0), new Vector2d(-0.5, 0)); + public Dimension unitRoomDimension; + public boolean bugged; + public Dimension doorDimensions; + public Point topLeftMapPoint; + private final DungeonContext context; + private final Minecraft mc; + public boolean initialized; + + public DungeonMapData(DungeonContext context, Minecraft mc) { + this.context = context; + this.mc = mc; + } + + + public void eat(final byte[] mapData){ + final Point firstRoom = MapUtils.findFirstColorWithIn(mapData, (byte) 30, new Rectangle(0, 0, 128, 128)); + // Determine room dimension + int width = MapUtils.getWidthOfColorAt(mapData, (byte) 30, firstRoom); + int height = MapUtils.getHeightOfColorAt(mapData, (byte) 30, firstRoom); + unitRoomDimension = new Dimension(width, height); + Vector2d doorDir = null; + Point midfirstRoom = new Point(firstRoom.x + unitRoomDimension.width / 2, firstRoom.y + unitRoomDimension.height / 2); + final int halfWidth = unitRoomDimension.width / 2 + 2; + for (Vector2d v : directions) { + byte color = MapUtils.getMapColorAt(mapData, (int) (v.x * halfWidth + midfirstRoom.x), (int) (v.y * halfWidth + midfirstRoom.y)); + if (color != 0) { + doorDir = v; + break; + } + } + + if (doorDir == null) { + bugged = true; + return; + } + + Point basePoint = new Point(firstRoom.x, firstRoom.y); + if (doorDir.x > 0) basePoint.x += unitRoomDimension.width; + if (doorDir.x < 0) basePoint.x -= 1; + if (doorDir.y > 0) basePoint.y += unitRoomDimension.height; + if (doorDir.y < 0) basePoint.y -= 1; + int gap = MapUtils.getLengthOfColorExtending(mapData, (byte) 0, basePoint, doorDir); + Point pt = MapUtils.findFirstColorWithInNegate(mapData, (byte) 0, new Rectangle(basePoint.x, basePoint.y, (int) Math.abs(doorDir.y) * unitRoomDimension.width + 1, (int) Math.abs(doorDir.x) * unitRoomDimension.height + 1)); + if (pt == null) { + bugged = true; + return; + } + int doorWidth = MapUtils.getLengthOfColorExtending(mapData, MapUtils.getMapColorAt(mapData, pt.x, pt.y), pt, new Vector2d((int) Math.abs(doorDir.y), (int) Math.abs(doorDir.x))); + doorDimensions = new Dimension(doorWidth, gap); + + // Determine Top Left + int topLeftX = firstRoom.x; + int topLeftY = firstRoom.y; + while (topLeftX >= unitRoomDimension.width + doorDimensions.height) + topLeftX -= unitRoomDimension.width + doorDimensions.height; + while (topLeftY >= unitRoomDimension.height + doorDimensions.height) + topLeftY -= unitRoomDimension.height + doorDimensions.height; + topLeftMapPoint = new Point(topLeftX, topLeftY); + // determine door location based on npc, and determine map min from there + DungeonSpecificDataProvider doorFinder = DungeonSpecificDataProviderRegistry.getDoorFinder(DungeonContext.getDungeonName()); + if (doorFinder == null) { + bugged = true; + return; + } + BlockPos door = doorFinder.findDoor(mc.theWorld, DungeonContext.getDungeonName()); + if (door == null) { + bugged = true; + return; + } + + ChatTransmitter.sendDebugChat(new ChatComponentText("door Pos:" + door)); + + Point unitPoint = MapProcessor.mapPointToRoomPoint(firstRoom, topLeftMapPoint, unitRoomDimension, doorDimensions); + unitPoint.translate(unitPoint.x + 1, unitPoint.y + 1); + unitPoint.translate((int) doorDir.x, (int) doorDir.y); + + Vector2d offset = doorFinder.findDoorOffset(mc.theWorld, DungeonContext.getDungeonName()); + boolean axisMatch = doorDir.equals(offset); + + int worldX = unitPoint.x * 16; + int worldY = unitPoint.y * 16; + BlockPos worldMin = door.add(-worldX, 0, -worldY); + context.setDungeonMin(worldMin); + + ChatTransmitter.sendDebugChat(new ChatComponentText("Found Green room:" + firstRoom)); + ChatTransmitter.sendDebugChat(new ChatComponentText("Axis match:" + axisMatch)); + ChatTransmitter.sendDebugChat(new ChatComponentText("World Min:" + context.getDungeonMin())); + ChatTransmitter.sendDebugChat(new ChatComponentText("Dimension:" + unitRoomDimension)); + ChatTransmitter.sendDebugChat(new ChatComponentText("top Left:" + topLeftMapPoint)); + ChatTransmitter.sendDebugChat(new ChatComponentText("door dimension:" + doorDimensions)); + context.createEvent(new DungeonNodataEvent("MAP_PROCESSOR_INIT")); + initialized = true; + MinecraftForge.EVENT_BUS.post(new DungeonContextInitializationEvent()); + + + } + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/AStarCornerCut.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/AStarCornerCut.java index ee71f90b..f6ac1777 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/AStarCornerCut.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/AStarCornerCut.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.pathfinding; +package kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/AStarFineGrid.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/AStarFineGrid.java index 94fa8a87..8cb49a10 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/AStarFineGrid.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/AStarFineGrid.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.pathfinding; +package kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/CachedWorld.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/CachedWorld.java index 1291f794..9d9644c6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/CachedWorld.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/CachedWorld.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.pathfinding; +package kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding; import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/JPSPathfinder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/JPSPathfinder.java index 12aa1828..0a4e1b7d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/JPSPathfinder.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/JPSPathfinder.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.pathfinding; +package kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/NodeProcessorDungeonRoom.java index d037c3a6..6ab911a2 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/NodeProcessorDungeonRoom.java @@ -16,10 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.pathfinding; +package kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; @@ -28,6 +29,7 @@ import net.minecraft.pathfinding.PathPoint; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3i; +import net.minecraft.world.World; import net.minecraft.world.pathfinder.NodeProcessor; import java.util.Set; @@ -35,6 +37,7 @@ import java.util.Set; public class NodeProcessorDungeonRoom extends NodeProcessor { private final DungeonRoom dungeonRoom; private final BlockPos sub; + public NodeProcessorDungeonRoom(DungeonRoom dungeonRoom) { this.dungeonRoom = dungeonRoom; sub = dungeonRoom.getMax().subtract(dungeonRoom.getMin()); @@ -42,41 +45,44 @@ public class NodeProcessorDungeonRoom extends NodeProcessor { @Override public PathPoint getPathPointTo(Entity entityIn) { - return openPoint((int)entityIn.posX - dungeonRoom.getMin().getX(), (int)entityIn.posY - dungeonRoom.getMin().getY(), - (int)entityIn.posZ - dungeonRoom.getMin().getZ()); + return openPoint((int) entityIn.posX - dungeonRoom.getMin().getX(), (int) entityIn.posY - dungeonRoom.getMin().getY(), + (int) entityIn.posZ - dungeonRoom.getMin().getZ()); } @Override public PathPoint getPathPointToCoords(Entity entityIn, double x, double y, double z) { - return openPoint((int)x- dungeonRoom.getMin().getX(), (int)y - dungeonRoom.getMin().getY(), - (int)z - dungeonRoom.getMin().getZ()); + return openPoint((int) x - dungeonRoom.getMin().getX(), (int) y - dungeonRoom.getMin().getY(), + (int) z - dungeonRoom.getMin().getZ()); } - private static final EnumFacing[] values2 = new EnumFacing[6]; - static { - values2[0] = EnumFacing.DOWN; - values2[1] = EnumFacing.NORTH; - values2[2] = EnumFacing.SOUTH; - values2[3] = EnumFacing.EAST; - values2[4] = EnumFacing.WEST; - values2[5] = EnumFacing.UP; - } + private static final EnumFacing[] values2 = new EnumFacing[] { + EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.UP + }; + + @Override public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) { int i = 0; - for (EnumFacing ef:values2) { + for (EnumFacing ef : values2) { Vec3i dir = ef.getDirectionVec(); int newX = currentPoint.xCoord + dir.getX(); int newY = currentPoint.yCoord + dir.getY(); int newZ = currentPoint.zCoord + dir.getZ(); + if (newX < 0 || newZ < 0) continue; - if (newX > sub.getX()|| newZ > sub.getZ()) continue; - IBlockState curr = entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ)); - IBlockState up = entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY + 1, newZ)); - if (isValidBlock(curr) - && isValidBlock(up )) { + if (newX > sub.getX() || newZ > sub.getZ()) continue; + + BlockPos add1 = dungeonRoom.getMin().add(newX, newY, newZ); + World playerWorld = entityIn.getEntityWorld(); + + IBlockState curr = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(add1); + + + IBlockState up = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(dungeonRoom.getMin().add(newX, newY + 1, newZ)); + + if (isValidBlock(curr) && isValidBlock(up)) { PathPoint pt = openPoint(newX, newY, newZ); if (pt.visited) continue; pathOptions[i++] = pt; @@ -85,12 +91,12 @@ public class NodeProcessorDungeonRoom extends NodeProcessor { if (curr.getBlock() == Blocks.air) { if (up.getBlock() == Blocks.stone_slab - || up.getBlock() == Blocks.wooden_slab - || up.getBlock() == Blocks.stone_slab2) { - IBlockState up2 = entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY -1, newZ)); + || up.getBlock() == Blocks.wooden_slab + || up.getBlock() == Blocks.stone_slab2) { + IBlockState up2 = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(dungeonRoom.getMin().add(newX, newY - 1, newZ)); if (up2.getBlock() == Blocks.stone_slab - || up2.getBlock() == Blocks.wooden_slab - || up2.getBlock() == Blocks.stone_slab2) { + || up2.getBlock() == Blocks.wooden_slab + || up2.getBlock() == Blocks.stone_slab2) { PathPoint pt = openPoint(newX, newY, newZ); if (pt.visited) continue; pathOptions[i++] = pt; @@ -99,23 +105,21 @@ public class NodeProcessorDungeonRoom extends NodeProcessor { } } - if (dir.getY() == 0 && curr.getBlock() == Blocks.iron_bars && up.getBlock() == Blocks.air && - entityIn.getEntityWorld().getBlockState(new BlockPos(currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord)).getBlock() != Blocks.iron_bars) { + if (dir.getY() == 0 + && curr.getBlock() == Blocks.iron_bars + && up.getBlock() == Blocks.air + && DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(new BlockPos(currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord)).getBlock() != Blocks.iron_bars) { + boolean theFlag = false; if (dir.getZ() == 0) { - if (entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ) - .add(0,0,1)).getBlock() == Blocks.air) { - theFlag = true; - } else if (entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ) - .add(0,0,-1)).getBlock() == Blocks.air) { + if (DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState( + add1.add(0, 0, 1)).getBlock() == Blocks.air || + DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(add1.add(0, 0, -1)).getBlock() == Blocks.air) { theFlag = true; } } else if (dir.getX() == 0) { - if (entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ) - .add(-1,0,0)).getBlock() == Blocks.air) { - theFlag = true; - } else if (entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ) - .add(1,0,0)).getBlock() == Blocks.air) { + if (DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(add1.add(-1, 0, 0)).getBlock() == Blocks.air || + DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(add1.add(1, 0, 0)).getBlock() == Blocks.air) { theFlag = true; } } @@ -123,7 +127,6 @@ public class NodeProcessorDungeonRoom extends NodeProcessor { PathPoint pt = openPoint(newX, newY, newZ); if (pt.visited) continue; pathOptions[i++] = pt; - continue; } } } @@ -131,11 +134,11 @@ public class NodeProcessorDungeonRoom extends NodeProcessor { } public static final Set<Block> allowed = Sets.newHashSet(Blocks.air, Blocks.water, Blocks.lava, Blocks.flowing_water, Blocks.flowing_lava, Blocks.vine, Blocks.ladder - , Blocks.standing_sign, Blocks.wall_sign, Blocks.trapdoor, Blocks.iron_trapdoor, Blocks.wooden_button, Blocks.stone_button, Blocks.fire, + , Blocks.standing_sign, Blocks.wall_sign, Blocks.trapdoor, Blocks.iron_trapdoor, Blocks.wooden_button, Blocks.stone_button, Blocks.fire, Blocks.torch, Blocks.rail, Blocks.golden_rail, Blocks.activator_rail, Blocks.detector_rail, Blocks.carpet, Blocks.redstone_torch); public static final IBlockState preBuilt = Blocks.stone.getStateFromMeta(2); + public static boolean isValidBlock(IBlockState state) { - Block b = state.getBlock(); - return state.equals(preBuilt) || allowed.contains(b); + return state.equals(preBuilt) || allowed.contains(state.getBlock()); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/ThetaStar.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/ThetaStar.java index 032223f0..4a4cf786 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/ThetaStar.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/ThetaStar.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.pathfinding; +package kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import lombok.*; import net.minecraft.util.*; import net.minecraft.world.World; @@ -190,11 +190,9 @@ public class ThetaStar { return MathHelper.sqrt_float(x * x + y * y + z * z); } - @RequiredArgsConstructor @Data public static final class Node { @Data - @RequiredArgsConstructor public static final class Coordinate { private final int x, y, z; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/EditingContext.java index 59a5d880..e38a0e82 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/EditingContext.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/EditingContext.java @@ -16,10 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonRoomEdit; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/Parameter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/Parameter.java new file mode 100755 index 00000000..850cbe11 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/Parameter.java @@ -0,0 +1,39 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit; + +import lombok.Data; + +@Data +public class Parameter { + private String name; + private Object previousData; + private Object newData; + + public Parameter(String name, Object previousData, Object newData) { + this.name = name; this.previousData = previousData; this.newData = newData; + } + + private Runnable onSetNewData; + + public void setNewData(Object newData) { + this.newData = newData; + if (onSetNewData != null) onSetNewData.run(); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/gui/GuiDungeonAddSet.java index 3d356451..1cec4c54 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/gui/GuiDungeonAddSet.java @@ -16,16 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.gui; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.gui.MGui; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditOffsetPointSet; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.gui.MGui; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditOffsetPointSet; + import lombok.Getter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/gui/GuiDungeonParameterEdit.java index b38fd5dc..a210cc0f 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/gui/GuiDungeonParameterEdit.java @@ -16,19 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.gui; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MGui; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.panes.DynamicEditor; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.gui.MGui; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditRegistry; + import lombok.Getter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/gui/GuiDungeonRoomEdit.java index 386a9b37..6f8ef2bd 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/gui/GuiDungeonRoomEdit.java @@ -16,13 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.gui; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.gui.MGui; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTabbedPane; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.panes.*; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MGui; -import kr.syeyoung.dungeonsguide.gui.elements.MTabbedPane; -import kr.syeyoung.dungeonsguide.roomedit.panes.*; -import kr.syeyoung.dungeonsguide.roomedit.panes.*; import lombok.Getter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/gui/GuiDungeonValueEdit.java index 65105830..130001c6 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/gui/GuiDungeonValueEdit.java @@ -16,19 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.gui; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MGui; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.gui.MGui; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditRegistry; + import lombok.Getter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditBreakableWall.java index 1ae2541a..69406793 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditBreakableWall.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditBreakableWall.java @@ -16,19 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonBreakableWall; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; + import net.minecraft.init.Blocks; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditDoor.java index 949e5c2e..b5792316 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDoor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditDoor.java @@ -16,19 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonDoor; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; + import net.minecraft.init.Blocks; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDummy.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditDummy.java index c0cae9b8..8faa5c4f 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditDummy.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditDummy.java @@ -16,20 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonDummy; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTextField; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MValue; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; + import java.awt.*; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditFairySoul.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditFairySoul.java index 8deb8d85..f029c413 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditFairySoul.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditFairySoul.java @@ -16,21 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonFairySoul; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; + import java.awt.*; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditJournal.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditJournal.java index aa82763a..f1907a7e 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditJournal.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditJournal.java @@ -16,20 +16,20 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonJournal; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTextField; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MValue; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEdit; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditCreator; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import java.awt.*; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditLever.java index 145209a5..ec535dc5 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditLever.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditLever.java @@ -16,21 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonLever; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; + import java.awt.*; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditNPC.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditNPC.java index 83c9e69c..349da046 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditNPC.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditNPC.java @@ -16,20 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonNPC; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTextField; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MValue; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; + import java.awt.*; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayDoor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditOnewayDoor.java index cd9a8427..48c52021 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayDoor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditOnewayDoor.java @@ -16,19 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonOnewayDoor; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; + import net.minecraft.init.Blocks; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditOnewayLever.java index 1c1588de..fcb46dad 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditOnewayLever.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditOnewayLever.java @@ -16,20 +16,20 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonOnewayLever; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTextField; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MValue; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEdit; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditCreator; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import java.awt.*; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditPressurePlate.java index ffab9440..44275e64 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditPressurePlate.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditPressurePlate.java @@ -16,20 +16,20 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonPressurePlate; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTextField; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MValue; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEdit; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditCreator; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import java.awt.*; import java.util.Arrays; import java.util.Collections; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditSecret.java index aed8e10a..c60e512d 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditSecret.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditSecret.java @@ -16,18 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; + import java.awt.*; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditTomb.java index 291883b0..9111959d 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/mechanicedit/ValueEditTomb.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/mechanicedit/ValueEditTomb.java @@ -16,21 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.mechanicedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonTomb; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; + import java.awt.*; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/ActionDisplayPane.java index 40be4c3e..9be69a8d 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionDisplayPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/ActionDisplayPane.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.panes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.panes; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionTree; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionTree; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; -import kr.syeyoung.dungeonsguide.gui.elements.*; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/ActionTreeDisplayPane.java index be0d294c..7dc1d955 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/ActionTreeDisplayPane.java @@ -16,13 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.panes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.panes; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionTree; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionTreeUtil; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionTree; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionTreeUtil; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -43,14 +45,14 @@ public class ActionTreeDisplayPane extends MPanel { private final DungeonRoom dungeonRoom; private final ActionTree tree; - private List<Action> linearified; + private List<AbstractAction> linearified; public ActionTreeDisplayPane(DungeonRoom dungeonRoom, ActionTree tree) { this.dungeonRoom = dungeonRoom; this.tree = tree; try { this.linearified = ActionTreeUtil.linearifyActionTree(tree); } catch (Exception e) { - linearified = new ArrayList<Action>(); + linearified = new ArrayList<AbstractAction>(); e.printStackTrace(); } scale = 1.0f; @@ -130,11 +132,11 @@ public class ActionTreeDisplayPane extends MPanel { return Math.max(xOff, dim.width); } - public void renderLinearified(List<Action> actions, int x, int y, FontRenderer fr) { + public void renderLinearified(List<AbstractAction> actions, int x, int y, FontRenderer fr) { Point lastPt = null; int y2 = y; - for (Action action : actions) { + for (AbstractAction action : actions) { Dimension dim = renderAction(action, x, y2, fr); if (lastPt != null) { GlStateManager.pushMatrix(); @@ -164,7 +166,7 @@ public class ActionTreeDisplayPane extends MPanel { } } - public Dimension renderAction(Action action, int x, int y, FontRenderer fr) { + public Dimension renderAction(AbstractAction action, int x, int y, FontRenderer fr) { String[] lines = action.toString().split("\n"); int maxWidth = 0; for (String line : lines) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/DynamicEditor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/DynamicEditor.java new file mode 100755 index 00000000..5be67660 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/DynamicEditor.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.panes; + +import kr.syeyoung.dungeonsguide.mod.gui.elements.MParameter; + +import java.util.List; + +public interface DynamicEditor { + void delete(MParameter parameter); + + List<String> allowedClass(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/GeneralEditPane.java index 0abda1c0..1e82757f 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/GeneralEditPane.java @@ -16,19 +16,21 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.panes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.panes; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.Main; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.ProcessorFactory; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.roomprocessor.ProcessorFactory; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; @@ -151,7 +153,7 @@ public class GeneralEditPane extends MPanel { try { NBTTagCompound nbtTagCompound2 = createNBT(); - File f=new File(DungeonsGuide.getDungeonsGuide().getConfigDir(), "schematics/"+ + File f=new File(Main.getConfigDir(), "schematics/"+ dungeonRoom.getDungeonRoomInfo().getName()+"-"+dungeonRoom.getDungeonRoomInfo().getUuid().toString()+"-"+ UUID.randomUUID()+".schematic"); Method method = null; @@ -176,7 +178,7 @@ public class GeneralEditPane extends MPanel { { dataoutputstream.close(); } - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSaved to "+f.getName())); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §fSaved to "+f.getName())); } catch (Throwable e) { e.printStackTrace(); } @@ -237,7 +239,7 @@ public class GeneralEditPane extends MPanel { for (int z = 0; z < compound.getShort("Length"); z++) { int index = x + (y * compound.getShort("Length") + z) * compound.getShort("Width"); BlockPos pos = dungeonRoom.getRelativeBlockPosAt(x,y - 70,z); - IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); + IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos); boolean acc = dungeonRoom.canAccessRelative(x,z); int id = Block.getIdFromBlock(blockState.getBlock()); blocks[index] = acc ? (byte) id : 0; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/ProcessorParameterEditPane.java index 57038f3b..21e2c5cc 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ProcessorParameterEditPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/ProcessorParameterEditPane.java @@ -16,16 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.panes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.panes; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MParameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MParameter; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditCreator; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditRegistry; import java.awt.*; import java.util.ArrayList; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/RoomDataDisplayPane.java index cae9637b..ad8bab43 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/RoomDataDisplayPane.java @@ -16,10 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.panes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.panes; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/RoomMatchDisplayPane.java index 7a75b01d..4b4b373a 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/RoomMatchDisplayPane.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.panes; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; -import kr.syeyoung.dungeonsguide.gui.elements.MTooltipText; -import kr.syeyoung.dungeonsguide.utils.ArrayUtils; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.panes; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTooltip; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTooltipText; +import kr.syeyoung.dungeonsguide.mod.utils.ArrayUtils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoommatchingPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/RoommatchingPane.java index ac2c2696..35c1728d 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoommatchingPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/RoommatchingPane.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.panes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.panes; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTextField; import java.awt.*; import java.util.UUID; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/SecretEditPane.java index 12af8f8a..b1d844ee 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/SecretEditPane.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.panes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.panes; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MParameter; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditCreator; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditRegistry; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MParameter; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditCreator; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditRegistry; import java.awt.*; import java.util.ArrayList; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEdit.java new file mode 100755 index 00000000..d52094de --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEdit.java @@ -0,0 +1,27 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; + +public interface ValueEdit<T extends Object> { + void setParameter(Parameter parameter); + + void renderWorld(float partialTicks); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditAColor.java index ef310b3d..da15583a 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditAColor.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.valueedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MColor; -import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MColor; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MFloatSelectionButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditBoolean.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditBoolean.java index ab6a9ada..2db2aecf 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditBoolean.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditBoolean.java @@ -16,13 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.valueedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; + + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MStringSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; import java.awt.*; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditColor.java index 8acec6f4..9c3b2ac7 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditColor.java @@ -16,14 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.valueedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; + + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MColor; -import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditCreator.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditCreator.java new file mode 100755 index 00000000..5d37040b --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditCreator.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; + +public interface ValueEditCreator<T extends ValueEdit> { + T createValueEdit(Parameter parameter); + + Object createDefaultValue(Parameter parameter); + + Object cloneObj(Object object); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditFloat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditFloat.java index 66fa4c54..2bd11448 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditFloat.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditFloat.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.valueedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MFloatSelectionButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditInteger.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditInteger.java index 37430077..46ebff3d 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditInteger.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditInteger.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.valueedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MIntegerSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MIntegerSelectionButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditNull.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditNull.java new file mode 100755 index 00000000..0868470e --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditNull.java @@ -0,0 +1,38 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; + +public class ValueEditNull implements ValueEditCreator { + @Override + public ValueEdit createValueEdit(Parameter parameter) { + return null; + } + + @Override + public Cloneable createDefaultValue(Parameter parameter) { + return null; + } + + @Override + public Object cloneObj(Object object) { + return null; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPoint.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditOffsetPoint.java index 978ead50..858f34f0 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPoint.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditOffsetPoint.java @@ -16,18 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.valueedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MIntegerSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditOffsetPointSet.java index cdc32448..bd210cd1 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditOffsetPointSet.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditOffsetPointSet.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.valueedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MValue; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MValue; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonAddSet; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Getter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditRegistry.java index 611dc533..25e10bda 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditRegistry.java @@ -16,14 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.valueedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; + + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.mechanicedit.*; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.*; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.roomedit.mechanicedit.*; -import kr.syeyoung.dungeonsguide.roomedit.mechanicedit.*; import java.awt.*; import java.util.ArrayList; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditString.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditString.java index 2eeca0fb..19cdf461 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditString.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/valueedit/ValueEditString.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomedit.valueedit; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MTextField; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTextField; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomfinder/DungeonRoom.java index dfdd59cb..3a356db3 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomfinder/DungeonRoom.java @@ -16,24 +16,26 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.roomfinder; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder; import com.google.common.collect.Sets; + import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.EDungeonDoorType; -import kr.syeyoung.dungeonsguide.dungeon.events.DungeonStateChangeEvent; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonRoomDoor; -import kr.syeyoung.dungeonsguide.features.impl.secret.FeaturePathfindStrategy; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.pathfinding.*; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomprocessor.ProcessorFactory; -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessorGenerator; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.MapProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonDoor; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.EDungeonDoorType; +import kr.syeyoung.dungeonsguide.mod.dungeon.events.impl.DungeonStateChangeEvent; +import kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding.*; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.ProcessorFactory; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessorGenerator; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.secret.FeaturePathfindStrategy; + import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; @@ -50,8 +52,8 @@ import net.minecraft.world.World; import javax.vecmath.Vector2d; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; @@ -69,7 +71,7 @@ public class DungeonRoom { private final DungeonContext context; - private final List<DungeonDoor> doors = new ArrayList<DungeonDoor>(); + private final List<DungeonDoor> doors = new ArrayList<>(); private DungeonRoomInfo dungeonRoomInfo; @@ -83,10 +85,10 @@ public class DungeonRoom { private Map<String, DungeonMechanic> cached = null; @Getter - private World cachedWorld; + private final World cachedWorld; public Map<String, DungeonMechanic> getMechanics() { if (cached == null || EditingContext.getEditingContext() != null) { - cached = new HashMap<String, DungeonMechanic>(dungeonRoomInfo.getMechanics()); + cached = new HashMap<>(dungeonRoomInfo.getMechanics()); int index = 0; for (DungeonDoor door : doors) { if (door.getType().isExist()) cached.put((door.getType().getName())+"-"+(++index), new DungeonRoomDoor(this, door)); @@ -100,47 +102,43 @@ public class DungeonRoom { this.currentState = currentState; } - private Map<BlockPos, AStarFineGrid> activeBetterAStar = new HashMap<>(); - private Map<BlockPos, AStarCornerCut> activeBetterAStarCornerCut = new HashMap<>(); - private Map<BlockPos, ThetaStar> activeThetaStar = new HashMap<>(); + private final Map<BlockPos, AStarFineGrid> activeBetterAStar = new HashMap<>(); + private final Map<BlockPos, AStarCornerCut> activeBetterAStarCornerCut = new HashMap<>(); + private final Map<BlockPos, ThetaStar> activeThetaStar = new HashMap<>(); public ScheduledFuture<List<Vec3>> createEntityPathTo(IBlockAccess blockaccess, Entity entityIn, BlockPos targetPos, float dist, int timeout) { FeaturePathfindStrategy.PathfindStrategy pathfindStrategy = FeatureRegistry.SECRET_PATHFIND_STRATEGY.getPathfindStrat(); if (pathfindStrategy == FeaturePathfindStrategy.PathfindStrategy.JPS_LEGACY) { - ScheduledFuture<List<Vec3>> sf = asyncPathFinder.schedule(() -> { + return asyncPathFinder.schedule(() -> { BlockPos min = new BlockPos(getMin().getX(), 0, getMin().getZ()); BlockPos max= new BlockPos(getMax().getX(), 255, getMax().getZ()); JPSPathfinder pathFinder = new JPSPathfinder(this); pathFinder.pathfind(entityIn.getPositionVector(), new Vec3(targetPos).addVector(0.5, 0.5, 0.5), 1.5f,timeout); return pathFinder.getRoute(); }, 0, TimeUnit.MILLISECONDS); - return sf; } else if (pathfindStrategy == FeaturePathfindStrategy.PathfindStrategy.A_STAR_FINE_GRID) { - ScheduledFuture<List<Vec3>> sf = asyncPathFinder.schedule(() -> { + return asyncPathFinder.schedule(() -> { AStarFineGrid pathFinder = activeBetterAStar.computeIfAbsent(targetPos, (pos) -> new AStarFineGrid(this, new Vec3(pos.getX(), pos.getY(), pos.getZ()).addVector(0.5, 0.5, 0.5))); pathFinder.pathfind(entityIn.getPositionVector(),timeout); return pathFinder.getRoute(); }, 0, TimeUnit.MILLISECONDS); - return sf; }else if (pathfindStrategy == FeaturePathfindStrategy.PathfindStrategy.A_STAR_DIAGONAL) { - ScheduledFuture<List<Vec3>> sf = asyncPathFinder.schedule(() -> { + return asyncPathFinder.schedule(() -> { AStarCornerCut pathFinder = activeBetterAStarCornerCut.computeIfAbsent(targetPos, (pos) -> new AStarCornerCut(this, new Vec3(pos.getX(), pos.getY(), pos.getZ()).addVector(0.5, 0.5, 0.5))); pathFinder.pathfind(entityIn.getPositionVector(),timeout); return pathFinder.getRoute(); }, 0, TimeUnit.MILLISECONDS); - return sf; } else if (pathfindStrategy == FeaturePathfindStrategy.PathfindStrategy.THETA_STAR) { - ScheduledFuture<List<Vec3>> sf = asyncPathFinder.schedule(() -> { + return asyncPathFinder.schedule(() -> { ThetaStar pathFinder = activeThetaStar.computeIfAbsent(targetPos, (pos) -> new ThetaStar(this, new Vec3(pos.getX(), pos.getY(), pos.getZ()).addVector(0.5, 0.5, 0.5))); pathFinder.pathfind(entityIn.getPositionVector(),timeout); return pathFinder.getRoute(); }, 0, TimeUnit.MILLISECONDS); - return sf; } else { - ScheduledFuture<List<Vec3>> sf = asyncPathFinder.schedule(() -> { + return asyncPathFinder.schedule(() -> { PathFinder pathFinder = new PathFinder(nodeProcessorDungeonRoom); PathEntity latest = pathFinder.createEntityPathTo(blockaccess, entityIn, targetPos, dist); if (latest != null) { @@ -153,7 +151,6 @@ public class DungeonRoom { } return new ArrayList<>(); }, 0, TimeUnit.MILLISECONDS); - return sf; } } @@ -162,7 +159,7 @@ public class DungeonRoom { private final NodeProcessorDungeonRoom nodeProcessorDungeonRoom; @Getter - private final Map<String, Object> roomContext = new HashMap<String, Object>(); + private final Map<String, Object> roomContext = new HashMap<>(); @AllArgsConstructor @Getter @@ -302,9 +299,14 @@ public class DungeonRoom { - long arr[]; + long[] arr; // These values are doubled - private final int minx, miny, minz, maxx, maxy, maxz; + private final int minx; + private final int miny; + private final int minz; + private final int maxx; + private final int maxy; + private final int maxz; private final int lenx, leny, lenz; private static final float playerWidth = 0.3f; public boolean isBlocked(int x,int y, int z) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomfinder/DungeonRoomInfoRegistry.java index a97efa43..6a881dc1 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomfinder/DungeonRoomInfoRegistry.java @@ -16,14 +16,19 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.roomfinder; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder; import com.google.common.io.Files; + +import com.google.gson.Gson; +import kr.syeyoung.dungeonsguide.Main; + import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; import kr.syeyoung.dungeonsguide.launcher.Main; import lombok.Getter; import net.minecraft.client.Minecraft; import org.apache.commons.io.IOUtils; +import org.jetbrains.annotations.NotNull; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; @@ -41,8 +46,23 @@ public class DungeonRoomInfoRegistry { private static final Map<Short, List<DungeonRoomInfo>> shapeMap = new HashMap<Short, List<DungeonRoomInfo>>(); private static final Map<UUID, DungeonRoomInfo> uuidMap = new HashMap<UUID, DungeonRoomInfo>(); - public static void register(DungeonRoomInfo dungeonRoomInfo) { - if (dungeonRoomInfo == null) throw new NullPointerException("what the fak parameter is noll?"); + static Gson gson = new Gson(); + + public static void register(@NotNull DungeonRoomInfo dungeonRoomInfo) { + +// System.out.println("Loading room: " + dungeonRoomInfo.getUuid()); +// +// File file = new File(Main.getConfigDir() + "/" + "rooms" + "/" + dungeonRoomInfo.getUuid() + ".json"); +// if(!file.exists()){ +// try { +// FileUtils.writeStringToFile(file, gson.toJson(dungeonRoomInfo)); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// } + + + if (uuidMap.containsKey(dungeonRoomInfo.getUuid())) { DungeonRoomInfo dri1 = uuidMap.get(dungeonRoomInfo.getUuid()); registered.remove(dri1); @@ -53,7 +73,9 @@ public class DungeonRoomInfoRegistry { registered.add(dungeonRoomInfo); uuidMap.put(dungeonRoomInfo.getUuid(), dungeonRoomInfo); List<DungeonRoomInfo> roomInfos = shapeMap.get(dungeonRoomInfo.getShape()); - if (roomInfos == null) roomInfos = new ArrayList<DungeonRoomInfo>(); + if (roomInfos == null) { + roomInfos = new ArrayList<>(); + } roomInfos.add(dungeonRoomInfo); shapeMap.put(dungeonRoomInfo.getShape(), roomInfos); } @@ -80,8 +102,8 @@ public class DungeonRoomInfoRegistry { public static void saveAll(File dir) { dir.mkdirs(); boolean isDev = Minecraft.getMinecraft().getSession().getPlayerID().replace("-","").equals("e686fe0aab804a71ac7011dc8c2b534c"); - String nameidstring = "name,uuid,processsor,secrets"; - String ids = ""; + StringBuilder nameidstring = new StringBuilder("name,uuid,processsor,secrets"); + StringBuilder ids = new StringBuilder(); for (DungeonRoomInfo dungeonRoomInfo : registered) { try { if (!dungeonRoomInfo.isUserMade() && !isDev) continue; @@ -91,14 +113,14 @@ public class DungeonRoomInfoRegistry { oos.flush(); oos.close(); - nameidstring += "\n"+dungeonRoomInfo.getName()+","+dungeonRoomInfo.getUuid() +","+dungeonRoomInfo.getProcessorId()+","+dungeonRoomInfo.getTotalSecrets(); - ids += "roomdata/"+dungeonRoomInfo.getUuid() +".roomdata\n"; + nameidstring.append("\n").append(dungeonRoomInfo.getName()).append(",").append(dungeonRoomInfo.getUuid()).append(",").append(dungeonRoomInfo.getProcessorId()).append(",").append(dungeonRoomInfo.getTotalSecrets()); + ids.append("roomdata/").append(dungeonRoomInfo.getUuid()).append(".roomdata\n"); } catch (Exception e) {e.printStackTrace();} } try { - Files.write(nameidstring, new File(dir, "roomidmapping.csv"), Charset.defaultCharset()); - Files.write(ids, new File(dir, "datas.txt"), Charset.defaultCharset()); + Files.write(nameidstring.toString(), new File(dir, "roomidmapping.csv"), Charset.defaultCharset()); + Files.write(ids.toString(), new File(dir, "datas.txt"), Charset.defaultCharset()); } catch (IOException e) { e.printStackTrace(); } @@ -124,7 +146,9 @@ public class DungeonRoomInfoRegistry { e.printStackTrace(); } } - } catch (Exception e) {e.printStackTrace();} + } catch (Exception e) { + e.printStackTrace(); + } for (File f : dir.listFiles()) { if (!f.getName().endsWith(".roomdata")) continue; try { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomfinder/RoomMatcher.java index f0da1f35..860b2bfc 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomfinder/RoomMatcher.java @@ -16,32 +16,32 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.dungeon.roomfinder; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; -import kr.syeyoung.dungeonsguide.utils.ArrayUtils; -import kr.syeyoung.dungeonsguide.utils.ShortUtils; +import kr.syeyoung.dungeonsguide.mod.utils.ArrayUtils; +import kr.syeyoung.dungeonsguide.mod.utils.ShortUtils; import lombok.Getter; import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import net.minecraft.world.World; + +import net.minecraft.util.ChatComponentText; + import java.util.List; public class RoomMatcher { private final DungeonRoom dungeonRoom; - @Getter private DungeonRoomInfo match; @Getter private int rotation; // how much the "found room" has to rotate clockwise to match the given dungeon room info. ! private boolean triedMatch = false; - private final World w; public RoomMatcher(DungeonRoom dungeonRoom) { this.dungeonRoom = dungeonRoom; - w = dungeonRoom.getContext().getWorld(); } public DungeonRoomInfo match() { @@ -52,8 +52,7 @@ public class RoomMatcher { for (int z = 0; z < zz; z ++) { for (int x = 0; x < xx; x++) { if (x % 8 == 0 && z % 8 == 0 && dungeonRoom.getContext().getWorld().getChunkFromBlockCoords(dungeonRoom.getRelativeBlockPosAt(x, 0, z)).isEmpty()) { - throw new IllegalStateException("chunk is not loaded"); - + ChatTransmitter.sendDebugChat(new ChatComponentText("Chunk Not loaded in Room Matcher")); } } } @@ -120,16 +119,10 @@ public class RoomMatcher { int maxZ = dungeonRoom.getMax().getZ(); int minX = dungeonRoom.getMin().getX(); int minZ = dungeonRoom.getMin().getZ(); - int widthX = maxX - minX + 2; - int heightZ = maxZ - minZ + 2; int[][] data = new int[dungeonRoom.getMax().getZ() - dungeonRoom.getMin().getZ() +2][dungeonRoom.getMax().getX() - dungeonRoom.getMin().getX() + 2]; for (int z = 0; z < data.length; z++) { for (int x = 0; x < data[0].length; x++) { -// if (!(offset < x && widthX - offset > x && offset < z && heightZ - offset > z)) { -// data[z][x] = -1; -// continue; -// } if (!(dungeonRoom.canAccessRelative(x + offset, z + offset) && dungeonRoom.canAccessRelative(x - offset -1 , z - offset-1) && dungeonRoom.canAccessRelative(x + offset , z - offset-1) diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/GeneralRoomProcessor.java index 6a9dd3d2..aaedbf59 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/GeneralRoomProcessor.java @@ -16,29 +16,26 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionComplete; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonRoomDoor; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; -import kr.syeyoung.dungeonsguide.events.BlockUpdateEvent; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.pathfinding.NodeProcessorDungeonRoom; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonAddSet; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; -import kr.syeyoung.dungeonsguide.utils.VectorUtils; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonActionContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMove; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMoveNearestAir; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRoute; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.events.impl.BlockUpdateEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding.NodeProcessorDungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonAddSet; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonRoomEdit; + import lombok.Getter; import lombok.Setter; import net.minecraft.block.state.IBlockState; @@ -76,9 +73,9 @@ public class GeneralRoomProcessor implements RoomProcessor { @Override public void tick() { - if (!ticked && FeatureRegistry.SECRET_AUTO_START.isEnabled()) + if (!ticked && FeatureRegistry.SECRET_AUTO_START.isEnabled()) { searchForNextTarget(); - if (!ticked && FeatureRegistry.SECRET_PATHFIND_ALL.isEnabled()) { + }else if (!ticked && FeatureRegistry.SECRET_PATHFIND_ALL.isEnabled()) { for (Map.Entry<String, DungeonMechanic> value : getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) { if (value.getValue() instanceof DungeonSecret && ((DungeonSecret) value.getValue()).getSecretStatus(dungeonRoom) != DungeonSecret.SecretStatus.FOUND) { DungeonSecret dungeonSecret = (DungeonSecret) value.getValue(); @@ -92,8 +89,7 @@ public class GeneralRoomProcessor implements RoomProcessor { pathfind(value.getKey(), "found", FeatureRegistry.SECRET_LINE_PROPERTIES_PATHFINDALL_ITEM_DROP.getRouteProperties()); } } - } - if (!ticked && FeatureRegistry.SECRET_BLOOD_RUSH.isEnabled()) { + } else if (!ticked && FeatureRegistry.SECRET_BLOOD_RUSH.isEnabled()) { for (Map.Entry<String, DungeonMechanic> value : getDungeonRoom().getMechanics().entrySet()) { if (value.getValue() instanceof DungeonRoomDoor) { DungeonRoomDoor dungeonDoor = (DungeonRoomDoor) value.getValue(); @@ -177,11 +173,11 @@ public class GeneralRoomProcessor implements RoomProcessor { if (en == null) return; ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - if (DungeonActionManager.getSpawnLocation().containsKey(en.getEntityId())) { + if (DungeonActionContext.getSpawnLocation().containsKey(en.getEntityId())) { GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Spawned at " + DungeonActionManager.getSpawnLocation().get(en.getEntityId()), sr.getScaledWidth() / 2, sr.getScaledHeight() / 2, 0xFFFFFFFF); + fr.drawString("Spawned at " + DungeonActionContext.getSpawnLocation().get(en.getEntityId()), sr.getScaledWidth() / 2, sr.getScaledHeight() / 2, 0xFFFFFFFF); } } } @@ -246,11 +242,12 @@ public class GeneralRoomProcessor implements RoomProcessor { public void actionbarReceived(IChatComponent chat) { if (!DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; if (dungeonRoom.getTotalSecrets() == -1) { - DungeonsGuide.sendDebugChat(new ChatComponentText(chat.getFormattedText().replace('§', '&') + " - received")); + ChatTransmitter.sendDebugChat(new ChatComponentText(chat.getFormattedText().replace('§', '&') + " - received")); } if (!chat.getFormattedText().contains("/")) return; BlockPos pos = Minecraft.getMinecraft().thePlayer.getPosition(); - DungeonContext context = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext(); + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); Point pt1 = context.getMapProcessor().worldPointToRoomPoint(pos.add(2, 0, 2)); Point pt2 = context.getMapProcessor().worldPointToRoomPoint(pos.add(-2, 0, -2)); if (!pt1.equals(pt2)) { @@ -300,12 +297,12 @@ public class GeneralRoomProcessor implements RoomProcessor { return path.get(id); } - public String pathfind(String mechanic, String state, ActionRoute.ActionRouteProperties actionRouteProperties) { - String str; - pathfind(str = UUID.randomUUID().toString(), mechanic, state, actionRouteProperties); + public String pathfind(String mechanic, String state, ActionRouteProperties actionRouteProperties) { + String str = UUID.randomUUID().toString(); + pathfind(str, mechanic, state, actionRouteProperties); return str; } - public void pathfind(String id, String mechanic, String state, ActionRoute.ActionRouteProperties actionRouteProperties) { + public void pathfind(String id, String mechanic, String state, ActionRouteProperties actionRouteProperties) { path.put(id, new ActionRoute(getDungeonRoom(), mechanic, state, actionRouteProperties)); } public void cancelAll() { @@ -337,6 +334,8 @@ public class GeneralRoomProcessor implements RoomProcessor { searchForNextTarget(); } else if (FeatureRegistry.SECRET_CREATE_REFRESH_LINE.getKeybind() == keyInputEvent.getKey() && FeatureRegistry.SECRET_CREATE_REFRESH_LINE.isEnabled()) { ActionRoute actionRoute = getBestFit(0); + // Because no route found! + if (actionRoute == null) return; // actually do force refresh because of force freeze pathfind if (actionRoute.getCurrentAction() instanceof ActionMove) { ActionMove ac = (ActionMove) actionRoute.getCurrentAction(); @@ -409,7 +408,7 @@ public class GeneralRoomProcessor implements RoomProcessor { DungeonSecret secret = new DungeonSecret(); secret.setSecretType(DungeonSecret.SecretType.BAT); secret.setSecretPoint(new OffsetPoint(dungeonRoom, - DungeonActionManager.getSpawnLocation().get(deathEvent.entity.getEntityId()) + DungeonActionContext.getSpawnLocation().get(deathEvent.entity.getEntityId()) )); ((GuiDungeonRoomEdit) screen).getSep().createNewMechanic("BAT-"+ UUID.randomUUID(), secret); @@ -420,7 +419,7 @@ public class GeneralRoomProcessor implements RoomProcessor { DungeonSecret secret = new DungeonSecret(); secret.setSecretType(DungeonSecret.SecretType.BAT); secret.setSecretPoint(new OffsetPoint(dungeonRoom, - DungeonActionManager.getSpawnLocation().get(deathEvent.entity.getEntityId()) + DungeonActionContext.getSpawnLocation().get(deathEvent.entity.getEntityId()) )); ((GuiDungeonRoomEdit) EditingContext.getEditingContext().getCurrent()).getSep().createNewMechanic("BAT-"+ UUID.randomUUID(), secret); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/ProcessorFactory.java index 6c09b1c2..1784795e 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/ProcessorFactory.java @@ -16,19 +16,19 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.boxpuzzle.RoomProcessorBoxSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.icefill.RoomProcessorIcePath2; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.RoomProcessorWaterPuzzle; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.boxpuzzle.RoomProcessorBoxSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.icefill.RoomProcessorIcePath2; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.RoomProcessorWaterPuzzle; import java.util.HashMap; import java.util.Map; import java.util.Set; public class ProcessorFactory { - private static final Map<String, RoomProcessorGenerator> map = new HashMap<String, RoomProcessorGenerator>(); + private static final Map<String, RoomProcessorGenerator> map = new HashMap<>(); public static RoomProcessorGenerator getRoomProcessorGenerator(String processorId) { return map.get(processorId); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessor.java index f4a26f77..c78cd857 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessor.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; -import kr.syeyoung.dungeonsguide.events.BlockUpdateEvent; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.BlockUpdateEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerInteractEntityEvent; import net.minecraft.util.IChatComponent; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorBlazeSolver.java index aa7dc3a9..88df3aeb 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorBlazeSolver.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; + + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorButtonSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorButtonSolver.java index e46472e5..1f97c025 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorButtonSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorButtonSolver.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.util.BlockPos; import net.minecraft.util.IChatComponent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorCreeperSolver.java index 954197ac..09cdf2ca 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorCreeperSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorCreeperSolver.java @@ -16,11 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; @@ -61,7 +63,7 @@ public class RoomProcessorCreeperSolver extends GeneralRoomProcessor { ); for (BlockPos pos : BlockPos.getAllInBox(low, high)) { - Block b = w.getBlockState(pos).getBlock(); + Block b = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos).getBlock(); if (b == Blocks.prismarine || b == Blocks.sea_lantern) { for (EnumFacing face:EnumFacing.VALUES) { if (w.getBlockState(pos.offset(face)).getBlock() == Blocks.air) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorGenerator.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorGenerator.java new file mode 100755 index 00000000..969424d9 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorGenerator.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; + +public interface RoomProcessorGenerator<T extends RoomProcessor> { + T createNew(DungeonRoom dungeonRoom); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorIcePath.java index b0f09a0e..5ac3697f 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorIcePath.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; import com.google.common.base.Predicate; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.AllArgsConstructor; import lombok.Getter; import net.minecraft.entity.Entity; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRedRoom.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorRedRoom.java index 327b98f6..f51eb957 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRedRoom.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorRedRoom.java @@ -16,15 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureWarningOnPortal; -import kr.syeyoung.dungeonsguide.features.text.StyledTextRenderer; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonDoor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.boss.FeatureWarningOnPortal; +import kr.syeyoung.dungeonsguide.mod.features.text.StyledTextRenderer; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderManager; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorRiddle.java index 96192ef7..39a39855 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorRiddle.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; import com.google.common.base.Predicate; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; + import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; @@ -70,7 +70,7 @@ public class RoomProcessorRiddle extends GeneralRoomProcessor { } } if (foundMatch) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eRiddle §7:: "+ch2.split(":")[0].trim()+" §fhas the reward!")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §eRiddle §7:: "+ch2.split(":")[0].trim()+" §fhas the reward!")); final String name = TextUtils.stripColor(ch2.split(":")[0]).replace("[NPC] ","").trim(); final BlockPos low = getDungeonRoom().getMin(); final BlockPos high = getDungeonRoom().getMax(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTeleportMazeSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorTeleportMazeSolver.java index cadd3024..8d327b7a 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTeleportMazeSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorTeleportMazeSolver.java @@ -16,11 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -29,11 +30,13 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; public class RoomProcessorTeleportMazeSolver extends GeneralRoomProcessor { + @Nullable private BlockPos lastPlayerLocation; public RoomProcessorTeleportMazeSolver(DungeonRoom dungeonRoom) { @@ -84,7 +87,9 @@ public class RoomProcessorTeleportMazeSolver extends GeneralRoomProcessor { if (b == Blocks.stone_slab || b == Blocks.stone_slab2) { boolean teleport = false; - if (lastPlayerLocation.distanceSq(pos2) < 3) return; + if (lastPlayerLocation != null && lastPlayerLocation.distanceSq(pos2) < 3) { + return; + } for (BlockPos allInBox : BlockPos.getAllInBox(lastPlayerLocation, pos2)) { if (w.getChunkFromBlockCoords(allInBox).getBlock(allInBox) == Blocks.iron_bars) { teleport = true; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTicTacToeSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorTicTacToeSolver.java index d63d432f..f0f5f389 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTicTacToeSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorTicTacToeSolver.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.init.Blocks; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorTrivia.java index 3f979c41..abfeb0b0 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/RoomProcessorTrivia.java @@ -16,16 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor; + + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.SkyblockUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache; -import net.minecraft.client.Minecraft; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.SkyblockUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.wsresource.StaticResourceCache; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; @@ -34,7 +36,7 @@ import org.apache.commons.lang3.math.NumberUtils; import org.json.JSONObject; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -105,11 +107,11 @@ public class RoomProcessorTrivia extends GeneralRoomProcessor { else theRealAnswer = semi_answers; } if (theRealAnswer == null) - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eTrivia §7:: §cCouldn't determine the answer! (no question found)")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §eTrivia §7:: §cCouldn't determine the answer! (no question found)")); else if (theRealAnswer.length() >1) - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eTrivia §7:: §cCouldn't determine the answer! ("+theRealAnswer+")")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §eTrivia §7:: §cCouldn't determine the answer! ("+theRealAnswer+")")); else - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eTrivia §7:: "+theRealAnswer+"§f is the correct answer!")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §eTrivia §7:: "+theRealAnswer+"§f is the correct answer!")); correctAnswer = theRealAnswer; }); } @@ -117,7 +119,7 @@ public class RoomProcessorTrivia extends GeneralRoomProcessor { private String takeCareOfPlaceHolders(String input) { String str = input; if (str.contains("$year")) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §fuses §eInventiveTalent§7(https://github.com/InventivetalentDev)§e's Skyblock Api §fto fetch current skyblock year!")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §fuses §eInventiveTalent§7(https://github.com/InventivetalentDev)§e's Skyblock Api §fto fetch current skyblock year!")); try { str = str.replace("$year", SkyblockUtils.getSkyblockYear()+""); } catch (IOException e) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java index 993f0c2b..46e7cf9a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java @@ -16,29 +16,23 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessorGenerator; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.DummyDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.arrow.ArrowProcessorMatcher; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.bugged.ImpossibleMatcher; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.color.ColorProcessorMatcher; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.creeper.CreeperProcessorMatcher; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.goldenpath.GoldenPathProcessorMatcher; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.maze.MazeProcessorMatcher; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.number.NumberProcessorMatcher; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse; + + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.arrow.ArrowProcessorMatcher; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.bugged.ImpossibleMatcher; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.color.ColorProcessorMatcher; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.creeper.CreeperProcessorMatcher; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.goldenpath.GoldenPathProcessorMatcher; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.maze.MazeProcessorMatcher; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.number.NumberProcessorMatcher; + import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; @@ -176,7 +170,7 @@ public class RoomProcessorBombDefuseSolver extends GeneralRoomProcessor { } } catch (IOException e2) { e2.printStackTrace(); - DungeonsGuide.sendDebugChat(new ChatComponentText("Failed to send Bomb Defuse Chat")); + ChatTransmitter.sendDebugChat(new ChatComponentText("Failed to send Bomb Defuse Chat")); } } @@ -206,7 +200,7 @@ public class RoomProcessorBombDefuseSolver extends GeneralRoomProcessor { } } catch (Throwable t) { t.printStackTrace(); - DungeonsGuide.sendDebugChat(new ChatComponentText("Failed to analyze Bomb Defuse Chat")); + ChatTransmitter.sendDebugChat(new ChatComponentText("Failed to analyze Bomb Defuse Chat")); } } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/BDChamber.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/BDChamber.java index aa6cb469..98962ace 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/BDChamber.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/BDChamber.java @@ -16,12 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers; import com.google.common.base.Predicate; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.block.state.IBlockState; @@ -54,7 +55,7 @@ public class BDChamber { public IBlockState getBlock(int x, int y, int z) { BlockPos pos = getBlockPos(x,y,z); - return room.getContext().getWorld().getBlockState(pos); + return DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos); } public boolean isWithinAbsolute(int x, int y, int z) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/BombDefuseChamberGenerator.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/BombDefuseChamberGenerator.java new file mode 100644 index 00000000..8c43ca36 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/BombDefuseChamberGenerator.java @@ -0,0 +1,30 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; + +public interface BombDefuseChamberGenerator { + boolean match(BDChamber left, BDChamber right); + + String getName(); + + ChamberProcessor createLeft(BDChamber left, RoomProcessorBombDefuseSolver solver); + ChamberProcessor createRight(BDChamber right, RoomProcessorBombDefuseSolver solver); +}
\ No newline at end of file diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/ChamberProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/ChamberProcessor.java new file mode 100644 index 00000000..c4d63f42 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/ChamberProcessor.java @@ -0,0 +1,27 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessor; +import net.minecraft.nbt.NBTTagCompound; + +public interface ChamberProcessor extends RoomProcessor { + void onDataRecieve(NBTTagCompound compound); + String getName(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/DummyDefuseChamberProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/DummyDefuseChamberProcessor.java new file mode 100644 index 00000000..d7056dbf --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/DummyDefuseChamberProcessor.java @@ -0,0 +1,32 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; + +public class DummyDefuseChamberProcessor extends GeneralDefuseChamberProcessor { + public DummyDefuseChamberProcessor(RoomProcessorBombDefuseSolver solver, BDChamber chamber) { + super(solver, chamber); + } + + @Override + public String getName() { + return "dummy"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java index 70c0c31f..32d11819 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/GeneralDefuseChamberProcessor.java @@ -16,13 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers; + + +import kr.syeyoung.dungeonsguide.mod.events.impl.BlockUpdateEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.events.BlockUpdateEvent; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/arrow/ArrowLeftProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/arrow/ArrowLeftProcessor.java index 70792c4e..06677020 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/arrow/ArrowLeftProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/arrow/ArrowLeftProcessor.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.arrow; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.arrow; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/arrow/ArrowProcessorMatcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/arrow/ArrowProcessorMatcher.java index 8ab6fd64..0aaf7d4a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/arrow/ArrowProcessorMatcher.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/arrow/ArrowProcessorMatcher.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.arrow; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.arrow; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.ChamberProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.ChamberProcessor; import net.minecraft.init.Blocks; public class ArrowProcessorMatcher implements BombDefuseChamberGenerator { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/arrow/ArrowRightProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/arrow/ArrowRightProcessor.java index cc87315f..c2cf228f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/arrow/ArrowRightProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/arrow/ArrowRightProcessor.java @@ -16,14 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.arrow; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.arrow; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; + import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/bugged/ImpossibleMatcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/bugged/ImpossibleMatcher.java index a7ef6e13..ad0f898e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/bugged/ImpossibleMatcher.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/bugged/ImpossibleMatcher.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.bugged; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.bugged; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.ChamberProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.ChamberProcessor; import net.minecraft.init.Blocks; public class ImpossibleMatcher implements BombDefuseChamberGenerator { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/color/ColorLeftProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/color/ColorLeftProcessor.java index 64bd2add..a899af5f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/color/ColorLeftProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/color/ColorLeftProcessor.java @@ -16,15 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.color; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.color; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; + import net.minecraft.block.Block; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.item.ItemStack; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/color/ColorProcessorMatcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/color/ColorProcessorMatcher.java index ad0e01e1..583cc03c 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/color/ColorProcessorMatcher.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/color/ColorProcessorMatcher.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.color; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.color; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.ChamberProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.ChamberProcessor; import net.minecraft.init.Blocks; public class ColorProcessorMatcher implements BombDefuseChamberGenerator { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/color/ColorRightProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/color/ColorRightProcessor.java index 93b82626..87ce135f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/color/ColorRightProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/color/ColorRightProcessor.java @@ -16,15 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.color; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.color; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; + import net.minecraft.block.Block; import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.item.EntityArmorStand; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/creeper/CreeperLeftProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/creeper/CreeperLeftProcessor.java index 9b4b3d25..b22daeb9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/creeper/CreeperLeftProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/creeper/CreeperLeftProcessor.java @@ -16,12 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.creeper; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.creeper; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/creeper/CreeperProcessorMatcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/creeper/CreeperProcessorMatcher.java index 16a95e98..ec335f8b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/creeper/CreeperProcessorMatcher.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/creeper/CreeperProcessorMatcher.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.creeper; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.creeper; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.ChamberProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.ChamberProcessor; import net.minecraft.init.Blocks; public class CreeperProcessorMatcher implements BombDefuseChamberGenerator { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/creeper/CreeperRightProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/creeper/CreeperRightProcessor.java index 0d99f2bb..dcdd5187 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/creeper/CreeperRightProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/creeper/CreeperRightProcessor.java @@ -16,12 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.creeper; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.creeper; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathLeftProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathLeftProcessor.java index 009fba06..2681abbf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathLeftProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathLeftProcessor.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.goldenpath; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.goldenpath; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathProcessorMatcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathProcessorMatcher.java index 241b8a62..90e95427 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathProcessorMatcher.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathProcessorMatcher.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.goldenpath; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.goldenpath; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.ChamberProcessor; import net.minecraft.init.Blocks; public class GoldenPathProcessorMatcher implements BombDefuseChamberGenerator { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathRightProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathRightProcessor.java index 17f584c5..d36f355f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathRightProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/goldenpath/GoldenPathRightProcessor.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.goldenpath; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.goldenpath; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.IChatComponent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/maze/MazeLeftProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/maze/MazeLeftProcessor.java index 435b3ef4..6f6eceed 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/maze/MazeLeftProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/maze/MazeLeftProcessor.java @@ -16,12 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.maze; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.maze; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -51,8 +54,7 @@ public class MazeLeftProcessor extends GeneralDefuseChamberProcessor { MovingObjectPosition pos = Minecraft.getMinecraft().objectMouseOver; if (pos.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) return; - BlockPos block = pos.getBlockPos(); - Block b = getChamber().getRoom().getContext().getWorld().getBlockState(block).getBlock(); + Block b = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos.getBlockPos()).getBlock(); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/maze/MazeProcessorMatcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/maze/MazeProcessorMatcher.java index a5fe57bc..ff874d5a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/maze/MazeProcessorMatcher.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/maze/MazeProcessorMatcher.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.maze; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.maze; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.ChamberProcessor; import net.minecraft.init.Blocks; public class MazeProcessorMatcher implements BombDefuseChamberGenerator { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/maze/MazeRightProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/maze/MazeRightProcessor.java index 5fdf15b9..81c9e244 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/maze/MazeRightProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/maze/MazeRightProcessor.java @@ -16,12 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.maze; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.maze; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/number/NumberLeftProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/number/NumberLeftProcessor.java index 2a2a42c5..f929041f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/number/NumberLeftProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/number/NumberLeftProcessor.java @@ -16,14 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.number; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.number; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; + import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/number/NumberProcessorMatcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/number/NumberProcessorMatcher.java index 4ea82f82..7fc905e0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/number/NumberProcessorMatcher.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/number/NumberProcessorMatcher.java @@ -16,12 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.number; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.number; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.ChamberProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BombDefuseChamberGenerator; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.ChamberProcessor; import net.minecraft.init.Blocks; public class NumberProcessorMatcher implements BombDefuseChamberGenerator { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/number/NumberRightProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/number/NumberRightProcessor.java index 673d4f22..ed09f94f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/number/NumberRightProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/chambers/number/NumberRightProcessor.java @@ -16,14 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.number; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.number; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.BDChamber; -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.BDChamber; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bombdefuse.chambers.GeneralDefuseChamberProcessor; + import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessor.java new file mode 100644 index 00000000..12ef6bdf --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessor.java @@ -0,0 +1,33 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessor; + +import java.util.List; + +public interface BossfightProcessor extends RoomProcessor { + List<String> getPhases(); + String getCurrentPhase(); + List<String> getNextPhases(); + + List<HealthData> getHealths(); + + String getBossName(); +}
\ No newline at end of file diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorBonzo.java index 8c8a3408..a65e0efe 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorBonzo.java @@ -16,9 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; + + -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.entity.item.EntityArmorStand; import net.minecraftforge.event.entity.living.LivingEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorLivid.java index 25570d10..dfe0acfe 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorLivid.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorLivid.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import lombok.Getter; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.entity.item.EntityArmorStand; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorNecron.java index 16fdb0fa..000e9590 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorNecron.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; import net.minecraft.entity.boss.BossStatus; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorProf.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorProf.java index bde85c6e..fdf268ed 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorProf.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorProf.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.entity.item.EntityArmorStand; import net.minecraftforge.event.entity.living.LivingEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorSadan.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorSadan.java index 0415996d..e34a78da 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorSadan.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorSadan.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.entity.item.EntityArmorStand; import net.minecraftforge.event.entity.living.LivingEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorScarf.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorScarf.java index c1ef8180..5113780e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorScarf.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorScarf.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.entity.item.EntityArmorStand; import net.minecraftforge.event.entity.living.LivingEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorThorn.java index c7ab91af..58574c2d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorThorn.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/BossfightProcessorThorn.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.entity.boss.BossStatus; import net.minecraft.init.Blocks; @@ -40,8 +40,7 @@ public class BossfightProcessorThorn extends GeneralBossfightProcessor { addPhase(GeneralBossfightProcessor.PhaseData.builder() .phase("fight").build() ); - - w= DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getWorld(); + w= DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getWorld(); } private final Set<BlockPos> progressBar = new HashSet<BlockPos>(); private final World w; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/GeneralBossfightProcessor.java index 10b6fea8..383707af 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/GeneralBossfightProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/GeneralBossfightProcessor.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; -import kr.syeyoung.dungeonsguide.events.BlockUpdateEvent; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.BlockUpdateEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerInteractEntityEvent; import lombok.*; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/HealthData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/HealthData.java new file mode 100644 index 00000000..ace9b39b --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bossfight/HealthData.java @@ -0,0 +1,33 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class HealthData { + private String name; + private int health; + private int maxHealth; + private boolean attackable; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/BoxPuzzleSolvingThread.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/BoxPuzzleSolvingThread.java index f1d06554..a77c2dfa 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/BoxPuzzleSolvingThread.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/BoxPuzzleSolvingThread.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.boxpuzzle; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.boxpuzzle; import lombok.Getter; import lombok.Setter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java index f4eb1d3d..848d5e1c 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java @@ -16,15 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.boxpuzzle; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.boxpuzzle; + + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; -import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessorGenerator; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessorGenerator; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -139,7 +142,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { if (calcDone2) { BoxPuzzleSolvingThread.Route semi_solution = puzzleSolvingThread.solution; if (semi_solution == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eBox Solver §7:: §cCouldn't find solution involving less than 20 box moves within 3m concurrent possibility")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §eBox Solver §7:: §cCouldn't find solution involving less than 20 box moves within 3m concurrent possibility")); step = 0; calcDone2 = false; pathFindReq = true; @@ -149,7 +152,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { return; } else{ solution = semi_solution.boxMoves; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eBox Solver §7:: Solution Found!")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §eBox Solver §7:: Solution Found!")); } step = 0; lastState = currboard; @@ -316,10 +319,10 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { if (chat.getFormattedText().toLowerCase().contains("recalc")) { if (calcDone) { calcReq = true; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: Recalculating Route...")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide :::: Recalculating Route...")); } else { calcReq = true; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: Currently Calculating Route...")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide :::: Currently Calculating Route...")); } } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/icefill/RoomProcessorIcePath2.java index 5cc6a1cb..e3354a02 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/icefill/RoomProcessorIcePath2.java @@ -16,31 +16,29 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.icefill; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.icefill; + + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessorGenerator; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessorGenerator; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; import java.awt.*; -import java.util.Queue; import java.util.Arrays; import java.util.LinkedList; import java.util.List; -import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CopyOnWriteArrayList; public class RoomProcessorIcePath2 extends GeneralRoomProcessor { private final List<List<BlockPos>> solution = new CopyOnWriteArrayList<List<BlockPos>>(); - private final Queue<String> messageQueue = new ConcurrentLinkedQueue<String>(); public RoomProcessorIcePath2(DungeonRoom dungeonRoom) { @@ -75,7 +73,7 @@ public class RoomProcessorIcePath2 extends GeneralRoomProcessor { public void run() { List<Point> hamiltonianPath = findFirstHamiltonianPath(map, startX, startY, endX, endY); if (hamiltonianPath == null) { - messageQueue.add("§eDungeons Guide §7:: §eIcePath §7:: §cCouldn't find solution for floor "+s); + ChatTransmitter.addToQueue("§eDungeons Guide §7:: §eIcePath §7:: §cCouldn't find solution for floor "+s); return; } hamiltonianPath.add(0,new Point(startX, startY)); @@ -97,9 +95,6 @@ public class RoomProcessorIcePath2 extends GeneralRoomProcessor { public void tick() { super.tick(); if (!FeatureRegistry.SOLVER_ICEPATH.isEnabled()) return; - while (!messageQueue.isEmpty()){ - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(messageQueue.poll())); - } } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/LeverState.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/LeverState.java new file mode 100755 index 00000000..e86fdd5c --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/LeverState.java @@ -0,0 +1,33 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class LeverState { + private String blockId; + private boolean requiredState; + + public LeverState invert() { + return new LeverState(blockId, !requiredState); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/LeverStateContradict.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/LeverStateContradict.java new file mode 100755 index 00000000..a574d6bf --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/LeverStateContradict.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle; + +public class LeverStateContradict extends LeverState { + public LeverStateContradict() { + super("contradict", true); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java index 4d51ce4b..be560f96 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/RoomProcessorWaterPuzzle.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessorGenerator; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessorGenerator; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.util.BlockPos; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/Route.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/Route.java index ef6fb6af..a9f73ae2 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/Route.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/Route.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.nodes.WaterNodeEnd; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.nodes.WaterNodeEnd; import lombok.Data; import org.jetbrains.annotations.NotNull; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/SwitchData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/SwitchData.java index 53bb2bb8..881716d8 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/SwitchData.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/SwitchData.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.nodes.WaterNodeStart; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.nodes.WaterNodeToggleable; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.nodes.WaterNodeStart; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.nodes.WaterNodeToggleable; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.util.BlockPos; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/WaterBoard.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/WaterBoard.java index 35979738..3519c2a8 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/WaterBoard.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/WaterBoard.java @@ -16,12 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.nodes.*; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.nodes.*; + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.nodes.*; + import lombok.Getter; import net.minecraft.block.Block; import net.minecraft.block.BlockLever; @@ -416,7 +418,7 @@ public class WaterBoard { private boolean isSwitchActive(SwitchData switchData) { BlockPos switch2 = switchData.getSwitchLoc(); World w= waterPuzzle.getDungeonRoom().getContext().getWorld(); - boolean bool = w.getBlockState(switch2).getValue(BlockLever.POWERED); + boolean bool = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(switch2).getValue(BlockLever.POWERED); return bool; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/WaterNode.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/WaterNode.java new file mode 100755 index 00000000..cbcb1cb0 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/WaterNode.java @@ -0,0 +1,36 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle; + +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public interface WaterNode { + boolean canWaterGoThrough(); + + // condition for water go + LeverState getCondition(); + + boolean isWaterFilled(World w); + + BlockPos getBlockPos(); + + int getX(); + int getY(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/nodes/WaterNodeAir.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/nodes/WaterNodeAir.java index 3c654b12..ffb8b65a 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/nodes/WaterNodeAir.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/nodes/WaterNodeAir.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.nodes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.nodes; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.LeverState; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.WaterNode; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.LeverState; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.WaterNode; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.block.Block; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/nodes/WaterNodeEnd.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/nodes/WaterNodeEnd.java index 12e1b608..22a62a00 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/nodes/WaterNodeEnd.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/nodes/WaterNodeEnd.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.nodes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.nodes; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.LeverState; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.WaterNode; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.LeverState; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.WaterNode; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.block.Block; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/nodes/WaterNodeStart.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/nodes/WaterNodeStart.java index b03e3a16..e067cf9b 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/nodes/WaterNodeStart.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/nodes/WaterNodeStart.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.nodes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.nodes; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.LeverState; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.WaterNode; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.LeverState; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.WaterNode; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.block.Block; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/nodes/WaterNodeToggleable.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/nodes/WaterNodeToggleable.java index e4459f30..7235e269 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/nodes/WaterNodeToggleable.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/nodes/WaterNodeToggleable.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.nodes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.nodes; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.LeverState; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.WaterNode; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.LeverState; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.WaterNode; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.block.Block; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/nodes/WaterNodeWall.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/nodes/WaterNodeWall.java index 7e68bffd..0f2b9a44 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/nodes/WaterNodeWall.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/waterpuzzle/nodes/WaterNodeWall.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.nodes; +package kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.nodes; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.LeverState; -import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.WaterNode; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.LeverState; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.waterpuzzle.WaterNode; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.block.Block; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/AuthChangedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/AuthChangedEvent.java new file mode 100644 index 00000000..f0fd11ee --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/AuthChangedEvent.java @@ -0,0 +1,6 @@ +package kr.syeyoung.dungeonsguide.mod.events.impl; + + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class AuthChangedEvent extends Event { } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/BlockUpdateEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/BlockUpdateEvent.java index 81480223..41b9cace 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/BlockUpdateEvent.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/BlockUpdateEvent.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.events; +package kr.syeyoung.dungeonsguide.mod.events.impl; import lombok.Getter; import lombok.Setter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/BossroomEnterEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/BossroomEnterEvent.java new file mode 100644 index 00000000..aeab26d9 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/BossroomEnterEvent.java @@ -0,0 +1,24 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class BossroomEnterEvent extends Event { +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DiscordUserJoinRequestEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DiscordUserJoinRequestEvent.java index 80a9315a..28452eed 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DiscordUserJoinRequestEvent.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DiscordUserJoinRequestEvent.java @@ -16,14 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.events; +package kr.syeyoung.dungeonsguide.mod.events.impl; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordUser; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordUser; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraftforge.fml.common.eventhandler.Event; -@Data @AllArgsConstructor +@Data +@EqualsAndHashCode(callSuper=false) +@AllArgsConstructor public class DiscordUserJoinRequestEvent extends Event { private DiscordUser discordUser; private boolean isInvite; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DiscordUserUpdateEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DiscordUserUpdateEvent.java index 858da5bf..839071a3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/DiscordUserUpdateEvent.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DiscordUserUpdateEvent.java @@ -16,14 +16,19 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.events; +package kr.syeyoung.dungeonsguide.mod.events.impl; + + +import kr.syeyoung.dungeonsguide.mod.discord.rpc.JDiscordRelation; -import kr.syeyoung.dungeonsguide.rpc.JDiscordRelation; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraftforge.fml.common.eventhandler.Event; -@Data @AllArgsConstructor +@Data +@EqualsAndHashCode(callSuper=false) +@AllArgsConstructor public class DiscordUserUpdateEvent extends Event { private JDiscordRelation prev, current; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonContextInitializationEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonContextInitializationEvent.java new file mode 100644 index 00000000..5d53dc5a --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonContextInitializationEvent.java @@ -0,0 +1,24 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class DungeonContextInitializationEvent extends Event { +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonEndedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonEndedEvent.java new file mode 100644 index 00000000..8bfe89d0 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonEndedEvent.java @@ -0,0 +1,24 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class DungeonEndedEvent extends Event { +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonLeftEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonLeftEvent.java new file mode 100644 index 00000000..c43fa94f --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonLeftEvent.java @@ -0,0 +1,24 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class DungeonLeftEvent extends Event { +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonStartedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonStartedEvent.java new file mode 100644 index 00000000..3807524c --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/DungeonStartedEvent.java @@ -0,0 +1,24 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class DungeonStartedEvent extends Event { +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/HypixelJoinedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/HypixelJoinedEvent.java new file mode 100644 index 00000000..bab30968 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/HypixelJoinedEvent.java @@ -0,0 +1,24 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class HypixelJoinedEvent extends Event { +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/KeyBindPressedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/KeyBindPressedEvent.java index c277b227..bdb5a41a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/KeyBindPressedEvent.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/KeyBindPressedEvent.java @@ -16,13 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.events; +package kr.syeyoung.dungeonsguide.mod.events.impl; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraftforge.fml.common.eventhandler.Event; -@Data @AllArgsConstructor +@Data +@EqualsAndHashCode(callSuper=false) +@AllArgsConstructor public class KeyBindPressedEvent extends Event { private int key; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/PlayerInteractEntityEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/PlayerInteractEntityEvent.java new file mode 100644 index 00000000..6f549bcb --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/PlayerInteractEntityEvent.java @@ -0,0 +1,39 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import net.minecraft.entity.Entity; +import net.minecraftforge.fml.common.eventhandler.Event; + +@AllArgsConstructor +public class PlayerInteractEntityEvent extends Event { + + @Getter @Setter + private boolean attack; + @Getter @Setter + private Entity entity; + + @Override + public boolean isCancelable() { + return true; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/PlayerListItemPacketEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/PlayerListItemPacketEvent.java index 65e936f0..e0f7b2c3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/events/PlayerListItemPacketEvent.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/PlayerListItemPacketEvent.java @@ -16,14 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.events; +package kr.syeyoung.dungeonsguide.mod.events.impl; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import net.minecraft.network.play.server.S38PacketPlayerListItem; import net.minecraftforge.fml.common.eventhandler.Event; @Data +@EqualsAndHashCode(callSuper=false) @AllArgsConstructor public class PlayerListItemPacketEvent extends Event { private S38PacketPlayerListItem packetPlayerListItem; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/SkyblockJoinedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/SkyblockJoinedEvent.java new file mode 100644 index 00000000..27cb10c4 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/SkyblockJoinedEvent.java @@ -0,0 +1,24 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class SkyblockJoinedEvent extends Event { +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/SkyblockLeftEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/SkyblockLeftEvent.java new file mode 100644 index 00000000..529e251c --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/SkyblockLeftEvent.java @@ -0,0 +1,24 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import net.minecraftforge.fml.common.eventhandler.Event; + +public class SkyblockLeftEvent extends Event { +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/StompConnectedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/StompConnectedEvent.java new file mode 100644 index 00000000..554197bb --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/StompConnectedEvent.java @@ -0,0 +1,32 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import kr.syeyoung.dungeonsguide.mod.stomp.StompClient; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Data +@EqualsAndHashCode(callSuper=false) +@AllArgsConstructor +public class StompConnectedEvent extends Event { + private StompClient stompInterface; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/TitleEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/TitleEvent.java new file mode 100644 index 00000000..7450dcdc --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/TitleEvent.java @@ -0,0 +1,32 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import net.minecraft.network.play.server.S45PacketTitle; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Data +@EqualsAndHashCode(callSuper=false) +@AllArgsConstructor +public class TitleEvent extends Event { + S45PacketTitle packetTitle; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/WindowUpdateEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/WindowUpdateEvent.java new file mode 100644 index 00000000..412b4d82 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/impl/WindowUpdateEvent.java @@ -0,0 +1,34 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.impl; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import net.minecraft.network.play.server.S2FPacketSetSlot; +import net.minecraft.network.play.server.S30PacketWindowItems; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Data +@EqualsAndHashCode(callSuper=false) +@AllArgsConstructor +public class WindowUpdateEvent extends Event { + S30PacketWindowItems windowItems; + S2FPacketSetSlot packetSetSlot; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java new file mode 100755 index 00000000..247a9284 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java @@ -0,0 +1,513 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.events.listener; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.config.Config; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonActionContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonDoor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonAddSet; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonParameterEdit; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonRoomEdit; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonValueEdit; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEdit; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.RoomProcessor; +import kr.syeyoung.dungeonsguide.mod.events.impl.*; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.utils.MapUtils; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import lombok.Getter; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.Vec3; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.relauncher.Side; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; + +import java.awt.*; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +public class DungeonListener { + + + @SubscribeEvent + public void onWorldLoad(WorldEvent.Unload event) { + try { + Config.saveConfig(); + } catch (IOException e) { + e.printStackTrace(); + } + DungeonActionContext.getSpawnLocation().clear(); + DungeonActionContext.getKilleds().clear(); + } + + @SubscribeEvent + public void onPostDraw(GuiScreenEvent.DrawScreenEvent.Post e) { + if (!SkyblockStatus.isOnDungeon()) return; + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + + if (context != null) { + + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + if (thePlayer == null) { + return; + } + if (context.getBossfightProcessor() != null) { + context.getBossfightProcessor().onPostGuiRender(e); + } + + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null && dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().onPostGuiRender(e); + } + } + + GlStateManager.enableBlend(); + GlStateManager.color(1, 1, 1, 1); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.enableAlpha(); + } + + @SubscribeEvent + public void onEntityUpdate(LivingEvent.LivingUpdateEvent e) { + if (!SkyblockStatus.isOnDungeon()) return; + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (context != null) { + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + if (thePlayer == null) return; + if (context.getBossfightProcessor() != null) context.getBossfightProcessor().onEntityUpdate(e); + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null && dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().onEntityUpdate(e); + } + } + } + + @SubscribeEvent + public void onDungeonLeave(DungeonLeftEvent ev) { + DungeonsGuide.getDungeonsGuide().getDungeonFacade().setContext(null); + if (!FeatureRegistry.ADVANCED_DEBUGGABLE_MAP.isEnabled()) { + MapUtils.clearMap(); + } + } + + + + + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent ev) { + if (ev.side == Side.SERVER || ev.phase != TickEvent.Phase.START) return; + + + if (SkyblockStatus.isOnSkyblock()) { + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (context != null) { + context.getMapProcessor().tick(); + context.tick(); + } else { + if (SkyblockStatus.isOnDungeon()) { + DungeonsGuide.getDungeonsGuide().getDungeonFacade().setContext(new DungeonContext(Minecraft.getMinecraft().thePlayer.worldObj)); + MinecraftForge.EVENT_BUS.post(new DungeonStartedEvent()); + } + } + } + + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (SkyblockStatus.isOnDungeon() && context != null) { + + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + if (thePlayer == null) { + return; + } + + + if (context.getBossfightProcessor() != null) { + context.getBossfightProcessor().tick(); + } + + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + + if (dungeonRoom != null && dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().tick(); + } + + } + + } + + + @SubscribeEvent + public void onRender(RenderGameOverlayEvent.Post postRender) { + if (!(postRender.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || postRender.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) + return; + + if (!SkyblockStatus.isOnDungeon()) return; + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (context != null) { + + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + if (context.getBossfightProcessor() != null) + context.getBossfightProcessor().drawScreen(postRender.partialTicks); + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null) { + if (dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().drawScreen(postRender.partialTicks); + } + } + + } + GlStateManager.enableBlend(); + GlStateManager.color(1, 1, 1, 1); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + Minecraft.getMinecraft().entityRenderer.setupOverlayRendering(); + GlStateManager.enableAlpha(); + } + + @SubscribeEvent(receiveCanceled = true, priority = EventPriority.HIGHEST) + public void onChatReceived(ClientChatReceivedEvent clientChatReceivedEvent) { + if (!SkyblockStatus.isOnDungeon()) return; + + if (clientChatReceivedEvent.type != 2 && clientChatReceivedEvent.message.getFormattedText().contains("§6> §e§lEXTRA STATS §6<")) { + MinecraftForge.EVENT_BUS.post(new DungeonEndedEvent()); + } + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + + if (context != null) { + + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + context.onChat(clientChatReceivedEvent); + + if (context.getBossfightProcessor() != null) { + if (clientChatReceivedEvent.type == 2) { + context.getBossfightProcessor().actionbarReceived(clientChatReceivedEvent.message); + } else { + context.getBossfightProcessor().chatReceived(clientChatReceivedEvent.message); + } + } + + RoomProcessor roomProcessor = null; + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null) { + if (dungeonRoom.getRoomProcessor() != null) { + if (clientChatReceivedEvent.type == 2) { + dungeonRoom.getRoomProcessor().actionbarReceived(clientChatReceivedEvent.message); + roomProcessor = dungeonRoom.getRoomProcessor(); + } else { + dungeonRoom.getRoomProcessor().chatReceived(clientChatReceivedEvent.message); + roomProcessor = dungeonRoom.getRoomProcessor(); + } + } + } + if (clientChatReceivedEvent.type == 2) { + return; + } + for (RoomProcessor globalRoomProcessor : context.getGlobalRoomProcessors()) { + if (globalRoomProcessor != roomProcessor) { + globalRoomProcessor.chatReceived(clientChatReceivedEvent.message); + } + } + } + } + + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent renderWorldLastEvent) { + if (!SkyblockStatus.isOnDungeon()) return; + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (context == null) { + return; + } + + if (FeatureRegistry.DEBUG.isEnabled()) { + for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { + for (DungeonDoor door : dungeonRoom.getDoors()) { + RenderUtils.renderDoor(door, renderWorldLastEvent.partialTicks); + } + } + } + + + if (context.getBossfightProcessor() != null) { + context.getBossfightProcessor().drawWorld(renderWorldLastEvent.partialTicks); + } + + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null) { + if (dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().drawWorld(renderWorldLastEvent.partialTicks); + } + } + + if (FeatureRegistry.DEBUG.isEnabled() && dungeonRoom != null) { + + Vec3 player = Minecraft.getMinecraft().thePlayer.getPositionVector(); + BlockPos real = new BlockPos(player.xCoord * 2, player.yCoord * 2, player.zCoord * 2); + for (BlockPos allInBox : BlockPos.getAllInBox(real.add(-1, -1, -1), real.add(1, 1, 1))) { + boolean blocked = dungeonRoom.isBlocked(allInBox.getX(), allInBox.getY(), allInBox.getZ()); + + RenderUtils.highlightBox( + AxisAlignedBB.fromBounds( + allInBox.getX() / 2.0 - 0.1, allInBox.getY() / 2.0 - 0.1, allInBox.getZ() / 2.0 - 0.1, + allInBox.getX() / 2.0 + 0.1, allInBox.getY() / 2.0 + 0.1, allInBox.getZ() / 2.0 + 0.1 + ), blocked ? new Color(0x55FF0000, true) : new Color(0x3300FF00, true), renderWorldLastEvent.partialTicks, false); + + } + } + + if (EditingContext.getEditingContext() != null) { + GuiScreen guiScreen = EditingContext.getEditingContext().getCurrent(); + if (guiScreen instanceof GuiDungeonParameterEdit) { + ValueEdit valueEdit = ((GuiDungeonParameterEdit) guiScreen).getValueEdit(); + if (valueEdit != null) { + valueEdit.renderWorld(renderWorldLastEvent.partialTicks); + } + } else if (guiScreen instanceof GuiDungeonValueEdit) { + ValueEdit valueEdit = ((GuiDungeonValueEdit) guiScreen).getValueEdit(); + if (valueEdit != null) { + valueEdit.renderWorld(renderWorldLastEvent.partialTicks); + } + } else if (guiScreen instanceof GuiDungeonAddSet) { + ((GuiDungeonAddSet) guiScreen).onWorldRender(renderWorldLastEvent.partialTicks); + } + } + } + + @SubscribeEvent() + public void onKey2(KeyBindPressedEvent keyInputEvent) { + if (!SkyblockStatus.isOnDungeon()) return; + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null) { + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + if (context.getBossfightProcessor() != null) { + context.getBossfightProcessor().onKeybindPress(keyInputEvent); + } + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null) { + if (dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().onKeybindPress(keyInputEvent); + } + } + } + } + + @SubscribeEvent() + public void onInteract(PlayerInteractEntityEvent interact) { + if (!SkyblockStatus.isOnDungeon()) return; + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null) { + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + if (context.getBossfightProcessor() != null) { + context.getBossfightProcessor().onInteract(interact); + } + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null) { + if (dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().onInteract(interact); + } + } + } + } + + + String getCurrentRoomName(){ + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(player.getPosition()); + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + String in = "unknown"; + if (dungeonRoom != null){ + in = dungeonRoom.getDungeonRoomInfo().getName(); + } + + return in; + } + + @SubscribeEvent + public void onBlockChange(BlockUpdateEvent.Post postInteract) { + if (!SkyblockStatus.isOnDungeon()) return; + + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null) { + + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + if (context.getBossfightProcessor() != null) { + context.getBossfightProcessor().onBlockUpdate(postInteract); + } + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null) { + if (dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().onBlockUpdate(postInteract); + } + } + } + } + + @SubscribeEvent + public void onKeyInput(KeyBindPressedEvent keyInputEvent) { + if (FeatureRegistry.DEBUG.isEnabled() && FeatureRegistry.ADVANCED_ROOMEDIT.isEnabled() && keyInputEvent.getKey() == FeatureRegistry.ADVANCED_ROOMEDIT.<Integer>getParameter("key").getValue()) { + EditingContext ec = EditingContext.getEditingContext(); + if (ec == null) { + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (context == null) { + ChatTransmitter.addToQueue(new ChatComponentText("Not in dungeons")); + return; + } + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + + if (dungeonRoom == null) { + ChatTransmitter.addToQueue(new ChatComponentText("Can't determine the dungeon room you're in")); + return; + } + + if (EditingContext.getEditingContext() != null) { + ChatTransmitter.addToQueue(new ChatComponentText("There is an editing session currently open.")); + return; + } + + EditingContext.createEditingContext(dungeonRoom); + EditingContext.getEditingContext().openGui(new GuiDungeonRoomEdit(dungeonRoom)); + } else ec.reopen(); + } + } + + @SubscribeEvent + public void onInteract(PlayerInteractEvent keyInputEvent) { + if (!keyInputEvent.world.isRemote) return; + if (!SkyblockStatus.isOnDungeon()) return; + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + + if (context != null) { + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + if (context.getBossfightProcessor() != null) { + context.getBossfightProcessor().onInteractBlock(keyInputEvent); + } + + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null) { + if (dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().onInteractBlock(keyInputEvent); + } + } + } + } + + @Getter + private final Map<Integer, Vec3> entityIdToPosMap = new HashMap<>(); + + @SubscribeEvent + public void onEntitySpawn(EntityJoinWorldEvent spawn) { + DungeonActionContext.getSpawnLocation().put(spawn.entity.getEntityId(), new Vec3(spawn.entity.posX, spawn.entity.posY, spawn.entity.posZ)); + } + + + @SubscribeEvent + public void onEntityDeSpawn(LivingDeathEvent deathEvent) { + if (deathEvent.entityLiving instanceof EntityBat) + DungeonActionContext.getKilleds().add(deathEvent.entity.getEntityId()); + + if (!SkyblockStatus.isOnDungeon()) return; + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade() != null) { + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); + + if (context.getBossfightProcessor() != null) { + context.getBossfightProcessor().onEntityDeath(deathEvent); + } + DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); + if (dungeonRoom != null) { + if (dungeonRoom.getRoomProcessor() != null) { + dungeonRoom.getRoomProcessor().onEntityDeath(deathEvent); + } + } + } + + if (!(deathEvent.entityLiving instanceof EntityBat)) + DungeonActionContext.getSpawnLocation().remove(deathEvent.entity.getEntityId()); + } + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/FeatureListener.java index 9df4498a..0929def7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/FeatureListener.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.eventlistener; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.events.*; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.*; -import kr.syeyoung.dungeonsguide.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.features.listener.*; +package kr.syeyoung.dungeonsguide.mod.events.listener; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.mod.events.impl.*; +import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.*; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.client.event.*; @@ -44,8 +44,8 @@ public class FeatureListener { boolean isLocConfig = Minecraft.getMinecraft().currentScreen instanceof GuiGuiLocationConfig; if (!(postRender.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || postRender.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) return; - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof ScreenRenderListener && (!isLocConfig || !(abstractFeature instanceof GuiFeature))) { @@ -134,8 +134,8 @@ public class FeatureListener { @SubscribeEvent public void onWindowUpdate(WindowUpdateEvent windowUpdateEvent) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof GuiUpdateListener) { ((GuiUpdateListener) abstractFeature).onGuiUpdate(windowUpdateEvent); @@ -148,8 +148,8 @@ public class FeatureListener { @SubscribeEvent public void onRender(RenderLivingEvent.Pre preRender) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof EntityLivingRenderListener) { @@ -164,8 +164,8 @@ public class FeatureListener { @SubscribeEvent public void onSound(PlaySoundEvent soundEvent) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof SoundListener) { @@ -180,8 +180,8 @@ public class FeatureListener { @SubscribeEvent public void onRender(RenderLivingEvent.Post preRender) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof EntityLivingRenderListener) { @@ -195,8 +195,8 @@ public class FeatureListener { @SubscribeEvent public void onRender(TitleEvent titleEvent) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof TitleListener) { @@ -210,8 +210,8 @@ public class FeatureListener { @SubscribeEvent public void onRender(RenderPlayerEvent.Pre preRender) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof PlayerRenderListener) { @@ -225,8 +225,8 @@ public class FeatureListener { @SubscribeEvent public void onRender(RenderPlayerEvent.Post preRender) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof PlayerRenderListener) { @@ -242,8 +242,8 @@ public class FeatureListener { @SubscribeEvent public void onRenderWorld(RenderWorldLastEvent postRender) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof WorldRenderListener) { @@ -257,8 +257,8 @@ public class FeatureListener { @SubscribeEvent public void onInteract(PlayerInteractEvent postRender) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof InteractListener) { @@ -274,8 +274,8 @@ public class FeatureListener { @SubscribeEvent public void onRenderWorld(ClientChatReceivedEvent postRender) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof ChatListener) { @@ -303,8 +303,8 @@ public class FeatureListener { @SubscribeEvent public void dungeonTooltip(ItemTooltipEvent event) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof TooltipListener) { @@ -320,8 +320,8 @@ public class FeatureListener { public void onTick(TickEvent.ClientTickEvent tick) { if (tick.phase == TickEvent.Phase.END && tick.type == TickEvent.Type.CLIENT ) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof TickListener) { @@ -336,8 +336,8 @@ public class FeatureListener { @SubscribeEvent public void onGuiOpen(GuiOpenEvent tick) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof GuiOpenListener) { @@ -351,8 +351,8 @@ public class FeatureListener { @SubscribeEvent public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Post render) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof GuiPostRenderListener) { @@ -367,8 +367,8 @@ public class FeatureListener { @SubscribeEvent public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Pre render) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof GuiPreRenderListener) { @@ -383,8 +383,8 @@ public class FeatureListener { @SubscribeEvent public void onGuiRender(GuiScreenEvent.BackgroundDrawnEvent render) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof GuiBackgroundRenderListener) { @@ -400,8 +400,8 @@ public class FeatureListener { @SubscribeEvent(receiveCanceled = true, priority = EventPriority.HIGH) public void onGuiEvent(GuiScreenEvent.MouseInputEvent.Pre input) { try { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnSkyblock()) return; + + if (!SkyblockStatus.isOnSkyblock()) return; for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { if (abstractFeature instanceof GuiClickListener) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketListener.java index 183f7f6c..f4e0bae9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/PacketListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketListener.java @@ -16,20 +16,19 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.eventlistener; +package kr.syeyoung.dungeonsguide.mod.events.listener; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.cosmetics.CustomPacketPlayerListItem; -import kr.syeyoung.dungeonsguide.events.BlockUpdateEvent; -import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent; -import kr.syeyoung.dungeonsguide.events.TitleEvent; -import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CustomPacketPlayerListItem; +import kr.syeyoung.dungeonsguide.mod.events.impl.BlockUpdateEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; + import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.network.Packet; @@ -110,13 +109,20 @@ public class PacketListener extends ChannelDuplexHandler { @Override public void processPacket(INetHandlerPlayClient handler) { + BlockUpdateEvent blockUpdateEvent = new BlockUpdateEvent.Pre(); blockUpdateEvent.getUpdatedBlocks().add(new Tuple<>(getBlockPosition(),getBlockState())); - MinecraftForge.EVENT_BUS.post(blockUpdateEvent); + + + MinecraftForge.EVENT_BUS.post(blockUpdateEvent); super.processPacket(handler); blockUpdateEvent = new BlockUpdateEvent.Post(); blockUpdateEvent.getUpdatedBlocks().add(new Tuple<>(getBlockPosition(), getBlockState())); - MinecraftForge.EVENT_BUS.post(blockUpdateEvent); + MinecraftForge.EVENT_BUS.post(blockUpdateEvent); + + + + } @Override @@ -138,17 +144,21 @@ public class PacketListener extends ChannelDuplexHandler { } @Override public void processPacket(INetHandlerPlayClient handler) { + + BlockUpdateEvent blockUpdateEvent = new BlockUpdateEvent.Pre(); for (S22PacketMultiBlockChange.BlockUpdateData changedBlock : getChangedBlocks()) { blockUpdateEvent.getUpdatedBlocks().add(new Tuple<>(changedBlock.getPos(), changedBlock.getBlockState())); } - MinecraftForge.EVENT_BUS.post(blockUpdateEvent); + MinecraftForge.EVENT_BUS.post(blockUpdateEvent); super.processPacket(handler); blockUpdateEvent = new BlockUpdateEvent.Post(); for (S22PacketMultiBlockChange.BlockUpdateData changedBlock : getChangedBlocks()) { blockUpdateEvent.getUpdatedBlocks().add(new Tuple<>(changedBlock.getPos(), changedBlock.getBlockState())); } - MinecraftForge.EVENT_BUS.post(blockUpdateEvent); + MinecraftForge.EVENT_BUS.post(blockUpdateEvent); + + } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractFeature.java index 9eea3694..a246a417 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/AbstractFeature.java @@ -16,18 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features; +package kr.syeyoung.dungeonsguide.mod.features; import com.google.common.base.Supplier; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.config.types.TypeConverter; -import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MFeatureEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.mod.config.types.TypeConverter; +import kr.syeyoung.dungeonsguide.mod.config.types.TypeConverterRegistry; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; import lombok.Setter; @@ -47,6 +47,11 @@ public abstract class AbstractFeature { protected Map<String, FeatureParameter> parameters = new HashMap<String, FeatureParameter>(); + protected void addParameter(String name, FeatureParameter f){ + parameters.put(name, f); + } + + protected AbstractFeature(String category, String name, String description, String key) { this.category = category; this.name = name; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureParameter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureParameter.java index eabfe218..bb8fd85a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureParameter.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureParameter.java @@ -16,28 +16,42 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features; +package kr.syeyoung.dungeonsguide.mod.features; -import kr.syeyoung.dungeonsguide.config.types.TypeConverter; -import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry; +import kr.syeyoung.dungeonsguide.mod.config.types.TypeConverter; +import kr.syeyoung.dungeonsguide.mod.config.types.TypeConverterRegistry; import lombok.AllArgsConstructor; import lombok.Data; +import java.util.function.Consumer; + @Data @AllArgsConstructor public class FeatureParameter<T> { private String key; - private String name; private String description; - private T value; + + private T default_value; private String value_type; + private Consumer<T> changedCallback; public FeatureParameter(String key, String name, String description, T default_value, String value_type) { - this.key = key; this.name = name; this.default_value = default_value; - this.description = description; this.value_type = value_type; + this(key, name, description,default_value, value_type, null); + } + + public FeatureParameter(String key, String name, String description, T default_value, String value_type, Consumer<T> changedCallback) { + this.key = key; + this.name = name; + this.default_value = default_value; + this.description = description; + this.value_type = value_type; + if(changedCallback != null){ + this.changedCallback = changedCallback; + changedCallback.accept(default_value); + } } public void setToDefault() { @@ -48,4 +62,11 @@ public class FeatureParameter<T> { public T getValue() { return value == null ? default_value : value; } + + public void setValue(T newValue){ + value = newValue; + if(changedCallback != null){ + changedCallback.accept(value); + } + } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java new file mode 100644 index 00000000..b8ff6bbc --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java @@ -0,0 +1,337 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features; + +import kr.syeyoung.dungeonsguide.mod.features.impl.advanced.*; +import kr.syeyoung.dungeonsguide.mod.features.impl.boss.*; +import kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal.FeatureSimonSaysSolver; +import kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal.FeatureTerminalSolvers; +import kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics.FeatureNicknameColor; +import kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics.FeatureNicknamePrefix; +import kr.syeyoung.dungeonsguide.mod.features.impl.discord.inviteViewer.PartyInviteViewer; +import kr.syeyoung.dungeonsguide.mod.features.impl.discord.onlinealarm.PlayingDGAlarm; +import kr.syeyoung.dungeonsguide.mod.features.impl.dungeon.*; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.*; +import kr.syeyoung.dungeonsguide.mod.features.impl.etc.ability.FeatureAbilityCooldown; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.APIKey; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.FeaturePartyList; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.FeaturePartyReady; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.customgui.FeatureCustomPartyFinder; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.FeatureViewPlayerStatsOnJoin; +import kr.syeyoung.dungeonsguide.mod.features.impl.secret.*; +import kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser.FeatureMechanicBrowse; +import kr.syeyoung.dungeonsguide.mod.features.impl.solvers.*; +import lombok.Getter; +import org.lwjgl.input.Keyboard; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FeatureRegistry { + @Getter + private static final List<AbstractFeature> featureList = new ArrayList<AbstractFeature>(); + private static final Map<String, AbstractFeature> featureByKey = new HashMap<String, AbstractFeature>(); + @Getter + private static final Map<String, List<AbstractFeature>> featuresByCategory = new HashMap<String, List<AbstractFeature>>(); + @Getter + private static final Map<String, String> categoryDescription = new HashMap<>(); + + public static AbstractFeature getFeatureByKey(String key) { + return featureByKey.get(key); + } + + public static <T extends AbstractFeature> T register(T abstractFeature) { + if (featureByKey.containsKey(abstractFeature.getKey())) throw new IllegalArgumentException("DUPLICATE FEATURE DEFINITION"); + featureList.add(abstractFeature); + featureByKey.put(abstractFeature.getKey(), abstractFeature); + List<AbstractFeature> features = featuresByCategory.get(abstractFeature.getCategory()); + if (features == null) + features = new ArrayList<AbstractFeature>(); + features.add(abstractFeature); + featuresByCategory.put(abstractFeature.getCategory(), features); + + return abstractFeature; + } + + + + public static PathfindLineProperties SECRET_LINE_PROPERTIES_GLOBAL; + + public static FeatureMechanicBrowse SECRET_BROWSE; + public static PathfindLineProperties SECRET_LINE_PROPERTIES_SECRET_BROWSER; + public static FeatureActions SECRET_ACTIONS; + + public static FeaturePathfindStrategy SECRET_PATHFIND_STRATEGY; + public static FeatureTogglePathfind SECRET_TOGGLE_KEY; + public static FeatureFreezePathfind SECRET_FREEZE_LINES; + public static FeatureCreateRefreshLine SECRET_CREATE_REFRESH_LINE; + + public static SimpleFeature SECRET_AUTO_BROWSE_NEXT; + public static SimpleFeature SECRET_AUTO_START; + public static SimpleFeature SECRET_NEXT_KEY; + + public static SimpleFeature SECRET_BLOOD_RUSH; + public static PathfindLineProperties SECRET_BLOOD_RUSH_LINE_PROPERTIES; + + + public static PathfindLineProperties SECRET_LINE_PROPERTIES_AUTOPATHFIND; + + public static FeaturePathfindToAll SECRET_PATHFIND_ALL; + public static PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT; + + public static PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_BAT; + public static PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_CHEST; + public static PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_ESSENCE; + public static PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_ITEM_DROP; + + public static FeatureSolverRiddle SOLVER_RIDDLE; + public static FeatureSolverTictactoe SOLVER_TICTACTOE; + public static SimpleFeature SOLVER_WATERPUZZLE; + public static SimpleFeature SOLVER_CREEPER; + public static FeatureSolverTeleport SOLVER_TELEPORT; + public static FeatureSolverBlaze SOLVER_BLAZE; + public static FeatureSolverIcefill SOLVER_ICEPATH; + public static FeatureSolverSilverfish SOLVER_SILVERFISH; + public static FeatureSolverBox SOLVER_BOX; + public static FeatureSolverKahoot SOLVER_KAHOOT; + public static FeatureSolverBombdefuse SOLVER_BOMBDEFUSE; + + + public static FeatureDungeonMap DUNGEON_MAP; + public static FeatureTestPepole TEST_PEPOLE; + public static FeatureDungeonRoomName DUNGEON_ROOMNAME; + public static FeaturePressAnyKeyToCloseChest DUNGEON_CLOSECHEST; + public static FeatureBoxSkelemaster DUNGEON_BOXSKELEMASTER; + public static FeatureBoxBats DUNGEON_BOXBAT; + public static FeatureBoxStarMobs DUNGEON_BOXSTARMOBS; + public static FeatureWatcherWarning DUNGEON_WATCHERWARNING; + public static FeatureDungeonDeaths DUNGEON_DEATHS; + public static FeatureDungeonMilestone DUNGEON_MILESTONE; + public static FeatureDungeonRealTime DUNGEON_REALTIME; + public static FeatureDungeonSBTime DUNGEON_SBTIME; + public static FeatureDungeonSecrets DUNGEON_SECRETS; + public static FeatureDungeonCurrentRoomSecrets DUNGEON_SECRETS_ROOM; + public static FeatureDungeonTombs DUNGEON_TOMBS; + public static FeatureDungeonScore DUNGEON_SCORE; + public static FeatureWarnLowHealth DUNGEON_LOWHEALTH_WARN; + public static SimpleFeature DUNGEON_INTERMODCOMM; + public static FeaturePlayerESP DUNGEON_PLAYERESP; + public static FeatureHideNameTags DUNGEON_HIDENAMETAGS; + public static FeatureSoulRoomWarning DUNGEON_FAIRYSOUL; + + public static FeatureWarningOnPortal BOSSFIGHT_WARNING_ON_PORTAL; + public static SimpleFeature BOSSFIGHT_CHESTPRICE; + public static FeatureAutoReparty BOSSFIGHT_AUTOREPARTY; + public static FeatureBossHealth BOSSFIGHT_HEALTH; + public static FeatureHideAnimals BOSSFIGHT_HIDE_ANIMALS; + public static FeatureThornBearPercentage BOSSFIGHT_BEAR_PERCENT; + public static FeatureThornSpiritBowTimer BOSSFIGHT_BOW_TIMER; + public static FeatureBoxRealLivid BOSSFIGHT_BOX_REALLIVID; + public static FeatureTerracotaTimer BOSSFIGHT_TERRACOTTA_TIMER; + public static FeatureCurrentPhase BOSSFIGHT_CURRENT_PHASE; + public static FeatureTerminalSolvers BOSSFIGHT_TERMINAL_SOLVERS; + public static FeatureSimonSaysSolver BOSSFIGHT_SIMONSAYS_SOLVER; + + public static APIKey PARTYKICKER_APIKEY; + public static FeatureViewPlayerStatsOnJoin PARTYKICKER_VIEWPLAYER; + public static FeatureCustomPartyFinder PARTYKICKER_CUSTOM; + public static FeaturePartyList PARTY_LIST; + public static FeaturePartyReady PARTY_READY; + + public static FeatureTooltipDungeonStat ETC_DUNGEONSTAT; + public static FeatureTooltipPrice ETC_PRICE; + public static FeatureAbilityCooldown ETC_ABILITY_COOLDOWN; + public static FeatureCooldownCounter ETC_COOLDOWN; + public static FeatureRepartyCommand ETC_REPARTY; + public static FeatureDecreaseExplosionSound ETC_EXPLOSION_SOUND; + public static FeatureAutoAcceptReparty ETC_AUTO_ACCEPT_REPARTY; + public static FeatureUpdateAlarm ETC_TEST; + + public static SimpleFeature FIX_SPIRIT_BOOTS; + public static FeatureDisableMessage FIX_MESSAGES; + + public static FeatureCopyMessages ETC_COPY_MSG; + + public static FeatureEpicCountdown EPIC_COUNTDOWN; + + public static FeaturePenguins ETC_PENGUIN; + + public static FeatureCollectScore ETC_COLLECT_SCORE; + + + + + + public static FeatureNicknamePrefix COSMETIC_PREFIX; + public static FeatureNicknameColor COSMETIC_NICKNAMECOLOR; + + + + public static SimpleFeature DISCORD_RICHPRESENCE; + public static PartyInviteViewer DISCORD_ASKTOJOIN; + public static PlayingDGAlarm DISCORD_ONLINEALARM; + public static SimpleFeature DISCORD_DONOTUSE; + + + public static SimpleFeature DEBUG; + public static SimpleFeature ADVANCED_ROOMEDIT; + + public static FeatureRoomDebugInfo ADVANCED_DEBUG_ROOM; + + public static FeatureDebuggableMap ADVANCED_DEBUGGABLE_MAP; + + public static FeatureRoomCoordDisplay ADVANCED_COORDS; + + private static FeatureDebugTrap ADVANCED_BAT; + + public static SimpleFeature RENDER_BREACONS; + + public static SimpleFeature RENDER_DESTENATION_TEXT; + + public static SimpleFeature DEBUG_BLOCK_CACHING; + + public void init(){ + try { + SECRET_LINE_PROPERTIES_GLOBAL = register(new PathfindLineProperties("Dungeon.Secrets.Preferences", "Global Line Settings", "Global Line Settings", "secret.lineproperties.global", true, null)); + SECRET_CREATE_REFRESH_LINE = register(new FeatureCreateRefreshLine()); + SECRET_FREEZE_LINES = register(new FeatureFreezePathfind()); + SECRET_TOGGLE_KEY = register(new FeatureTogglePathfind()); + SECRET_PATHFIND_STRATEGY = register(new FeaturePathfindStrategy()); + SECRET_ACTIONS = register(new FeatureActions()); + SECRET_LINE_PROPERTIES_SECRET_BROWSER = register(new PathfindLineProperties("Dungeon.Secrets.Secret Browser", "Line Settings", "Line Settings when pathfinding using Secret Browser", "secret.lineproperties.secretbrowser", true, SECRET_LINE_PROPERTIES_GLOBAL)); + SECRET_BROWSE = register(new FeatureMechanicBrowse()); + categoryDescription.put("ROOT.Secrets.Keybinds", "Useful keybinds / Toggle Pathfind lines, Freeze Pathfind lines, Refresh pathfind line or Trigger pathfind (you would want to use it, if you're using Pathfind to All)"); + SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT = register(new PathfindLineProperties("Dungeon.Secrets.Pathfind To All", "Parent Line Settings", "Line Settings to be used by default", "secret.lineproperties.apf.parent", false, SECRET_LINE_PROPERTIES_GLOBAL)); + DUNGEON_FAIRYSOUL = register(new FeatureSoulRoomWarning()); + DUNGEON_HIDENAMETAGS = register(new FeatureHideNameTags()); + DUNGEON_PLAYERESP = register(new FeaturePlayerESP()); + DUNGEON_INTERMODCOMM = register(new SimpleFeature("Dungeon.Teammates", "Communicate With Other's Dungeons Guide", "Sends total secret in the room to others\nSo that they can use the data to calculate total secret in dungeon run\n\nThis automates player chatting action, (chatting data) Thus it might be against hypixel's rules.\nBut mods like auto-gg which also automate player action and is kinda allowed mod exist so I'm leaving this feature.\nThis option is use-at-your-risk and you'll be responsible for ban if you somehow get banned because of this feature\n(Although it is not likely to happen)\nDefaults to off", "dungeon.intermodcomm", false)); + DUNGEON_LOWHEALTH_WARN = register(new FeatureWarnLowHealth()); + DUNGEON_SCORE = register(new FeatureDungeonScore()); + DUNGEON_TOMBS = register(new FeatureDungeonTombs()); + DUNGEON_SECRETS_ROOM = register(new FeatureDungeonCurrentRoomSecrets()); + DUNGEON_SECRETS = register(new FeatureDungeonSecrets()); + DUNGEON_SBTIME = register(new FeatureDungeonSBTime()); + DUNGEON_REALTIME = register(new FeatureDungeonRealTime()); + DUNGEON_MILESTONE = register(new FeatureDungeonMilestone()); + DUNGEON_DEATHS = register(new FeatureDungeonDeaths()); + DUNGEON_WATCHERWARNING = register(new FeatureWatcherWarning()); + DUNGEON_BOXSTARMOBS = register(new FeatureBoxStarMobs()); + DUNGEON_BOXBAT = register(new FeatureBoxBats()); + DUNGEON_BOXSKELEMASTER = register(new FeatureBoxSkelemaster()); + DUNGEON_CLOSECHEST = register(new FeaturePressAnyKeyToCloseChest()); + DUNGEON_ROOMNAME = register(new FeatureDungeonRoomName()); +// TEST_PEPOLE = register(new FeatureTestPepole()); + DUNGEON_MAP = register(new FeatureDungeonMap()); + SOLVER_BOMBDEFUSE = register(new FeatureSolverBombdefuse()); + SOLVER_KAHOOT = register(new FeatureSolverKahoot()); + SOLVER_BOX = register(new FeatureSolverBox()); + SOLVER_SILVERFISH = register(new FeatureSolverSilverfish()); + SOLVER_ICEPATH = register(new FeatureSolverIcefill()); + SOLVER_BLAZE = register(new FeatureSolverBlaze()); + SOLVER_TELEPORT = register(new FeatureSolverTeleport()); + SOLVER_CREEPER = register(new SimpleFeature("Dungeon.Solvers.Any Floor", "Creeper", "Draws line between prismarine lamps in creeper room", "solver.creeper")); + SOLVER_WATERPUZZLE = register(new SimpleFeature("Dungeon.Solvers.Any Floor", "Waterboard (Advanced)", "Calculates solution for waterboard puzzle and displays it to user", "solver.waterboard")); + SOLVER_TICTACTOE = register(new FeatureSolverTictactoe()); + SOLVER_RIDDLE = register(new FeatureSolverRiddle()); + SECRET_LINE_PROPERTIES_PATHFINDALL_ITEM_DROP = register(new PathfindLineProperties("Dungeon.Secrets.Pathfind To All", "Item Drop Line Settings", "Line Settings when pathfind to Item Drop, when using above feature", "secret.lineproperties.apf.itemdrop", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); + SECRET_LINE_PROPERTIES_PATHFINDALL_ESSENCE = register(new PathfindLineProperties("Dungeon.Secrets.Pathfind To All", "Essence Line Settings", "Line Settings when pathfind to Essence, when using above feature", "secret.lineproperties.apf.essence", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); + SECRET_LINE_PROPERTIES_PATHFINDALL_CHEST = register(new PathfindLineProperties("Dungeon.Secrets.Pathfind To All", "Chest Line Settings", "Line Settings when pathfind to Chest, when using above feature", "secret.lineproperties.apf.chest", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); + SECRET_LINE_PROPERTIES_PATHFINDALL_BAT = register(new PathfindLineProperties("Dungeon.Secrets.Pathfind To All", "Bat Line Settings", "Line Settings when pathfind to Bat, when using above feature", "secret.lineproperties.apf.bat", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); + SECRET_PATHFIND_ALL = register(new FeaturePathfindToAll()); + SECRET_LINE_PROPERTIES_AUTOPATHFIND = register(new PathfindLineProperties("Dungeon.Secrets.Legacy AutoPathfind", "Line Settings", "Line Settings when pathfinding using above features", "secret.lineproperties.autopathfind", true, SECRET_LINE_PROPERTIES_GLOBAL)); + SECRET_BLOOD_RUSH_LINE_PROPERTIES = register(new PathfindLineProperties("Dungeon.Secrets.Blood Rush", "Blood Rush Line Settings", "Line Settings to be used", "secret.lineproperties.bloodrush", false, SECRET_LINE_PROPERTIES_GLOBAL)); + SECRET_BLOOD_RUSH = register(new FeatureBloodRush()); + SECRET_NEXT_KEY = register(new SimpleFeature("Dungeon.Secrets.Legacy AutoPathfind", "Auto Pathfind to new secret upon pressing a key", "Auto browse the best next secret when you press key.\nPress settings to edit the key", "secret.keyfornext", false) {{ + addParameter("key", new FeatureParameter<Integer>("key", "Key", "Press to navigate to next best secret", Keyboard.KEY_NONE, "keybind")); + }}); + + EPIC_COUNTDOWN = register(new FeatureEpicCountdown()); + + RENDER_BREACONS = register(new SimpleFeature("Dungeon.Secrets.Preferences", "Render beacons", "Should the mod not render beacons on secret", "secret.beacons", false)); + DEBUG_BLOCK_CACHING = register(new SimpleFeature("Debug","Enable block getBlockCaching", "Cache all world.getBlockState callls", "debug.blockcache")); + RENDER_DESTENATION_TEXT = register(new SimpleFeature("Dungeon.Secrets.Preferences", "Render Destination text", "Should the mod not render \"destination\" on secrets", "secret.desttext", false)); + SECRET_AUTO_START = register(new SimpleFeature("Dungeon.Secrets.Legacy AutoPathfind", "Auto pathfind to new secret", "Auto browse best secret upon entering the room.", "secret.autouponenter", false)); + SECRET_AUTO_BROWSE_NEXT = register(new SimpleFeature("Dungeon.Secrets.Legacy AutoPathfind", "Auto Pathfind to next secret", "Auto browse best next secret after current one completes.\nthe first pathfinding of first secret needs to be triggered first in order for this option to work", "secret.autobrowse", false)); + BOSSFIGHT_WARNING_ON_PORTAL = register(new FeatureWarningOnPortal()); + BOSSFIGHT_CHESTPRICE = register(new FeatureChestPrice()); + BOSSFIGHT_AUTOREPARTY = register(new FeatureAutoReparty()); + BOSSFIGHT_HEALTH = register(new FeatureBossHealth()); + BOSSFIGHT_HIDE_ANIMALS = register(new FeatureHideAnimals()); + BOSSFIGHT_BEAR_PERCENT = register(new FeatureThornBearPercentage()); + BOSSFIGHT_BOW_TIMER = register(new FeatureThornSpiritBowTimer()); + BOSSFIGHT_BOX_REALLIVID = register(new FeatureBoxRealLivid()); + BOSSFIGHT_TERRACOTTA_TIMER = register(new FeatureTerracotaTimer()); + BOSSFIGHT_CURRENT_PHASE = register(new FeatureCurrentPhase()); + BOSSFIGHT_TERMINAL_SOLVERS = register(new FeatureTerminalSolvers()); + BOSSFIGHT_SIMONSAYS_SOLVER = register(new FeatureSimonSaysSolver()); + PARTYKICKER_APIKEY = register(new APIKey()); + PARTYKICKER_VIEWPLAYER = register(new FeatureViewPlayerStatsOnJoin()); + PARTYKICKER_CUSTOM = register(new FeatureCustomPartyFinder()); + PARTY_LIST = register(new FeaturePartyList()); + PARTY_READY = register(new FeaturePartyReady()); + ETC_DUNGEONSTAT = register(new FeatureTooltipDungeonStat()); + ETC_PRICE = register(new FeatureTooltipPrice()); + ETC_ABILITY_COOLDOWN = register(new FeatureAbilityCooldown()); + ETC_COOLDOWN = register(new FeatureCooldownCounter()); + ETC_REPARTY = register(new FeatureRepartyCommand()); + ETC_EXPLOSION_SOUND = register(new FeatureDecreaseExplosionSound()); + ETC_AUTO_ACCEPT_REPARTY = register(new FeatureAutoAcceptReparty()); + ETC_TEST = register(new FeatureUpdateAlarm()); + FIX_SPIRIT_BOOTS = register(new SimpleFeature("Misc", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true)); + FIX_MESSAGES = register(new FeatureDisableMessage()); + ETC_COPY_MSG = register(new FeatureCopyMessages()); + ETC_PENGUIN = register(new FeaturePenguins()); + ETC_COLLECT_SCORE = register(new FeatureCollectScore()); + COSMETIC_NICKNAMECOLOR = register(new FeatureNicknameColor()); + COSMETIC_PREFIX = register(new FeatureNicknamePrefix()); + DISCORD_RICHPRESENCE = register(new SimpleFeature("Discord", "Discord RPC", "Enable Discord rich presence", "advanced.richpresence", true) { + { + addParameter("disablenotskyblock", new FeatureParameter<Boolean>("disablenotskyblock", "Disable When not on Skyblock", "Disable When not on skyblock", false, "boolean")); + } + }); + DISCORD_ASKTOJOIN = register(new PartyInviteViewer()); + DISCORD_ONLINEALARM = register(new PlayingDGAlarm()); + DISCORD_DONOTUSE = register(new SimpleFeature("Discord", "Disable Native Library", "Disables usage of jna for discord rpc support.\nBreaks any discord related feature in the mod.\nRequires mod restart to get affected.\n\nThis feature is only for those whose minecraft crashes due to discord gamesdk crash.", "discord.rpc", false)); + DEBUG = register(new FeatureDebug()); + ADVANCED_ROOMEDIT = register(new SimpleFeature("Debug", "Room Edit", "Allow editing dungeon rooms\n\nWarning: using this feature can break or freeze your Minecraft\nThis is only for advanced users only", "advanced.roomedit", false) { + { + addParameter("key", new FeatureParameter<Integer>("key", "Key", "Press to edit room", Keyboard.KEY_R, "keybind")); + } + }); + ADVANCED_DEBUG_ROOM = register(new FeatureRoomDebugInfo()); + ADVANCED_DEBUGGABLE_MAP = register(new FeatureDebuggableMap()); + ADVANCED_COORDS = register(new FeatureRoomCoordDisplay()); + ADVANCED_BAT = register(new FeatureDebugTrap()); + } catch (Exception e) { + System.out.println(e); + throw new RuntimeException(e); + } + + + for (AbstractFeature abstractFeature : featureList) { + if(abstractFeature == null){ + throw new IllegalStateException("Feature " + abstractFeature.getKey() + " is null, this cannot happen!!!"); + } + } + + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/GuiFeature.java index 527a1054..437d1844 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/GuiFeature.java @@ -16,20 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features; +package kr.syeyoung.dungeonsguide.mod.features; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfigV2; -import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.config.types.GUIRectangle; -import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry; -import kr.syeyoung.dungeonsguide.features.listener.ScreenRenderListener; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; + +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.GuiConfigV2; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.mod.config.types.GUIRectangle; +import kr.syeyoung.dungeonsguide.mod.config.types.TypeConverterRegistry; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; + import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/SimpleFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/SimpleFeature.java new file mode 100644 index 00000000..b8d20c5c --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/SimpleFeature.java @@ -0,0 +1,33 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features; + +public class SimpleFeature extends AbstractFeature { + protected SimpleFeature(String category, String name, String key) { + this(category, name, name, key); + } + protected SimpleFeature(String category, String name, String description, String key) { + this(category, name, description, key, true); + } + + protected SimpleFeature(String category, String name, String description, String key, boolean enabled) { + super(category, name, description, key); + this.setEnabled(enabled); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/LeverStateContradict.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebug.java index 71165847..fe917ece 100755..100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/LeverStateContradict.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebug.java @@ -16,10 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle; +package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; + + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; + +public class FeatureDebug extends SimpleFeature { + + public FeatureDebug() { + super("Debug", "Debug", "Toggles debug mode", "debug", false); + -public class LeverStateContradict extends LeverState { - public LeverStateContradict() { - super("contradict", true); } + + } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebugTrap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebugTrap.java new file mode 100644 index 00000000..92a47949 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebugTrap.java @@ -0,0 +1,80 @@ +package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityBat; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class FeatureDebugTrap extends TextHUDFeature { + public FeatureDebugTrap() { + super("Debug", "Display the current amount of bat entities", "", "advanced.bat", false, getFontRenderer().getStringWidth("Bats: 9999"), getFontRenderer().FONT_HEIGHT); + getStyles().add(new TextStyle("base", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); + getStyles().add(new TextStyle("batsamm", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); + } + + + + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); + + private static final List<StyledText> dummyText= new ArrayList<>(); + static { + dummyText.add(new StyledText("Bats: ","base")); + dummyText.add(new StyledText("9999","batsamm")); + } + + + static List<Long> avgStorage = new ArrayList<>(); + + public static void updateVal(long timeItTookForThePacketToProcess){ + System.out.println(timeItTookForThePacketToProcess); + if(avgStorage.size() > 5){ + avgStorage.remove( 0); + } + + avgStorage.add(timeItTookForThePacketToProcess); + } + + + static long getAvgTimeItTookToPAcket(){ + return (long) avgStorage.stream().mapToLong(val -> val).average().orElse(0.0); + } + + @Override + public boolean isHUDViewable() { + return skyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getMapProcessor() != null; + } + + @Override + public List<String> getUsedTextStyle() { + return Arrays.asList("batsamm", "base"); + } + + @Override + public List<StyledText> getDummyText() { + return dummyText; + } + + @Override + public List<StyledText> getText() { + + List<Entity> bats = Minecraft.getMinecraft().theWorld.getEntities(EntityBat.class, e -> true); + + + List<StyledText> actualBit = new ArrayList<>(); + actualBit.add(new StyledText("Bats: ","base")); + + + actualBit.add(new StyledText(String.valueOf(getAvgTimeItTookToPAcket()),"batsamm")); + + return actualBit; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java index d2c3b7f6..36a361e0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.advanced; +package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.utils.MapUtils; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiChat; @@ -40,7 +40,7 @@ import java.util.Arrays; public class FeatureDebuggableMap extends GuiFeature { public FeatureDebuggableMap() { - super("Advanced", "Display Debug Info included map", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.map", true, 128, 128); + super("Debug", "Display Debug Info included map", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.map", true, 128, 128); this.setEnabled(false); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomCoordDisplay.java index 9762893b..6d7eacb5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomCoordDisplay.java @@ -16,15 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.advanced; +package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; -import kr.syeyoung.dungeonsguide.SkyblockStatus; + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -37,17 +39,20 @@ import java.awt.*; public class FeatureRoomCoordDisplay extends GuiFeature { public FeatureRoomCoordDisplay() { - super("Advanced", "Display Coordinate Relative to the Dungeon Room and room's rotation", "X: 0 Y: 3 Z: 5 Facing: Z+" , "advanced.coords", false, getFontRenderer().getStringWidth("X: 48 Y: 100 Z: 48 Facing: Z+"), 10); + super("Debug", "Display Coordinate Relative to the Dungeon Room and room's rotation", "X: 0 Y: 3 Z: 5 Facing: Z+" , "advanced.coords", false, getFontRenderer().getStringWidth("X: 48 Y: 100 Z: 48 Facing: Z+"), 10); this.setEnabled(false); - parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.yellow, "color")); + addParameter("color", new FeatureParameter<>("color", "Color", "Color of text", Color.yellow, "color", nval -> color = nval.getRGB())); } + + int color = 0; + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); private static final String[] facing = {"Z+", "X-", "Z-", "X+"}; @Override public void drawHUD(float partialTicks) { if (!skyblockStatus.isOnDungeon()) return; - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (context == null) return; EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; @@ -68,8 +73,6 @@ public class FeatureRoomCoordDisplay extends GuiFeature { double scale = getFeatureRect().getRectangle().getHeight() / fontRenderer.FONT_HEIGHT; GlStateManager.scale(scale, scale, 0); - int color = this.<Color>getParameter("color").getValue().getRGB(); - GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomDebugInfo.java index 8ad1b470..e3e2c09b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureRoomDebugInfo.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.advanced; +package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -37,23 +37,24 @@ import java.awt.*; public class FeatureRoomDebugInfo extends GuiFeature { public FeatureRoomDebugInfo() { - super("Advanced", "Display Room Debug Info", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.roominfo", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); + super("Debug", "Display Room Debug Info", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.roominfo", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); this.setEnabled(false); - parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.white, "color")); + addParameter("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.white, "color", nval -> color = nval.getRGB())); } + int color = 0; + SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void drawHUD(float partialTicks) { if (!skyblockStatus.isOnDungeon()) return; if (!FeatureRegistry.DEBUG.isEnabled()) return; - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (context == null) return; EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - int color = this.<Color>getParameter("color").getValue().getRGB(); GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -84,11 +85,11 @@ public class FeatureRoomDebugInfo extends GuiFeature { GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Line 1", 0,0, this.<Color>getParameter("color").getValue().getRGB()); - fr.drawString("Line 2", 0,10, this.<Color>getParameter("color").getValue().getRGB()); - fr.drawString("Line 3", 0,20, this.<Color>getParameter("color").getValue().getRGB()); - fr.drawString("Line 4", 0,30, this.<Color>getParameter("color").getValue().getRGB()); - fr.drawString("Line 5", 0,40, this.<Color>getParameter("color").getValue().getRGB()); + fr.drawString("Line 1", 0,0, color); + fr.drawString("Line 2", 0,10, color); + fr.drawString("Line 3", 0,20, color); + fr.drawString("Line 4", 0,30, color); + fr.drawString("Line 5", 0,40, color); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java new file mode 100644 index 00000000..cc2f911a --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureTestPepole.java @@ -0,0 +1,460 @@ +package kr.syeyoung.dungeonsguide.mod.features.impl.advanced; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonStartListener; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; +import kr.syeyoung.dungeonsguide.mod.stomp.StompManager; +import kr.syeyoung.dungeonsguide.mod.stomp.StompPayload; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.client.resources.SkinManager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.relauncher.ReflectionHelper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.json.JSONObject; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.regex.Pattern; + +import static kr.syeyoung.dungeonsguide.mod.utils.TabListUtil.getString; + +public class FeatureTestPepole extends GuiFeature implements ChatListener, DungeonStartListener { + + Logger logger = LogManager.getLogger("FeatureTestPepole"); + private Float scale; + private Set<String> lastmebersRaw; + private boolean broadcastLock; + + public FeatureTestPepole() { + super("Dungeon", "Feuture test", "NOU", "", false, 200, 100); + + + addParameter("scale", new FeatureParameter<>("scale", "Scale", "Scale", 2.0f, "float", nval -> this.scale = nval)); + MinecraftForge.EVENT_BUS.register(this); + +// (new Thread(() -> { +// while (true){ +// handleSelfBroadcasts(); +// } +// }) ).start(); + } + + public static void handlePartyBroadCast(String playload) { + String[] messagge = playload.substring(2).split(":"); + +// String random = messagge[1]; + String username = messagge[0]; + System.out.println("Broadcast was a self broadcast with: " + username); + PartyManager.INSTANCE.getPartyContext().addDgUser(username); + +// String actualPayload = "ACK" + random + ":" + username + ":" + Minecraft.getMinecraft().getSession().getUsername(); +// StompManager.getInstance().send(new StompPayload().header("destination", "/app/party.broadcast").payload( +// new JSONObject().put("partyID", PartyManager.INSTANCE.getPartyContext().getPartyID()) +// .put("payload", actualPayload).toString() +// )); + +// } else if (playload.startsWith("ACK")){ +// String ACKnick = playload.substring(3); +// String[] nicks = ACKnick.split(":"); +// if(Objects.equals(nicks[0], Minecraft.getMinecraft().getSession().getUsername())) { +// FeatureTestPepole.addACK(new Tuple<String, String>(nicks[1], nicks[2])); +// } + } + +// static List<Tuple<String, String>> acknicks = new ArrayList<>(); +// +// static List<Tuple<Integer, Long>> sentContros = new ArrayList<>(); + +// public static void addACK(Tuple<String,String> acKnick) { +// acknicks.add(acKnick); +// } + + public void broadcastYourself() { + if (PartyManager.INSTANCE.getPartyContext().getPartyID() == null) { + return; + } + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + logger.info("Sending self broadcast"); +// int control = (new Random()).nextInt(1000); + String actualPayload = "C:" + Minecraft.getMinecraft().getSession().getUsername() + ":" + 222; + StompManager.getInstance().send(new StompPayload().header("destination", "/app/party.broadcast").payload( + new JSONObject().put("partyID", PartyManager.INSTANCE.getPartyContext().getPartyID()) + .put("payload", actualPayload).toString() + )); +// sentContros.add(new Tuple<>(control, System.currentTimeMillis())); + broadcastLock = false; + } + + public void handleSelfBroadcasts(){ + if(broadcastLock) { + broadcastYourself(); + return; + } + + +// for (Tuple<String, String> acknick : acknicks) { +// int a = Integer.parseInt(acknick.getFirst()); +// for (Tuple<Integer, Long> sentContro : sentContros) { +// if(sentContro.getFirst() == a){ +// acknicks.remove(acknick); +// sentContros.remove(a); +// if(sentContro.getSecond() + 500 > System.currentTimeMillis()){ +// broadcastLock = true; +// broadcastYourself(); +// break; +// } +// } +// } +// +// } + + + if(PartyManager.INSTANCE.getPartyContext() == null) return; + + if(lastmebersRaw == null ) { + lastmebersRaw = PartyManager.INSTANCE.getPartyContext().getPartyRawMembers(); + return; + } + + Set<String> membersRaw = PartyManager.INSTANCE.getPartyContext().getPartyRawMembers(); + + if(!membersRaw.equals(lastmebersRaw)){ + logger.info("members changed unlocking locking broadcast"); + broadcastLock = true; + broadcastYourself(); + lastmebersRaw = membersRaw; + } + } + + + HashMap<String, ItemStack> SkullCashe = new HashMap<>(); + + + + ExecutorService executor = Executors.newFixedThreadPool(5); + + + public ItemStack getSkullByUserName(String username) { + if (SkullCashe.containsKey(username)) return SkullCashe.get(username); + ItemStack stack = new ItemStack(Items.skull, 1, 3); + + executor.submit(() -> { + EntityPlayer playerEntityByName = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(username); + if(playerEntityByName == null || playerEntityByName.getGameProfile() == null) { + stack.setTagCompound(new NBTTagCompound()); + stack.getTagCompound().setTag("SkullOwner", new NBTTagString(username)); + return; + } + + // this line should trick mineshaft to caching the player skin + // im doing this bc just setting SkullOwner downloads the skin on main thread + // thus causing a lag spike + Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Minecraft.getMinecraft().getSkinManager().loadSkinFromCache(playerEntityByName.getGameProfile()); + + if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) { + Minecraft.getMinecraft().getSkinManager().loadSkin((MinecraftProfileTexture)map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN); + } + + + + stack.setTagCompound(new NBTTagCompound()); + stack.getTagCompound().setTag("SkullOwner", new NBTTagString(username)); + + }); + + SkullCashe.put(username, stack); + return stack; + } + + private Set<String> ready = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); + + private static final List<String> readyPhrase = Arrays.asList("r", "rdy", "ready"); + private static final List<String> negator = Arrays.asList("not ", "not", "n", "n "); + private static final Map<String, Boolean> readynessIndicator = new HashMap<>(); + + static { + readyPhrase.forEach(val -> readynessIndicator.put(val, true)); + for (String s : negator) { + readyPhrase.forEach(val -> readynessIndicator.put(s + val, false)); + } + readynessIndicator.put("dont start", false); + readynessIndicator.put("don't start", false); + readynessIndicator.put("dont go", false); + readynessIndicator.put("don't go", false); + readynessIndicator.put("start", true); + readynessIndicator.put("go", true); + } + + @Override + public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { + String txt = clientChatReceivedEvent.message.getFormattedText(); + if (!txt.startsWith("§r§9Party §8>")) return; + + String chat = TextUtils.stripColor(txt.substring(txt.indexOf(":") + 1)).trim().toLowerCase(); + + + String usernamearea = TextUtils.stripColor(txt.substring(13, txt.indexOf(":"))); + String username = null; + for (String s : usernamearea.split(" ")) { + if (s.isEmpty()) continue; + if (s.startsWith("[")) continue; + username = s; + break; + } + + Boolean status = null; + String longestMatch = ""; + for (Map.Entry<String, Boolean> stringBooleanEntry : readynessIndicator.entrySet()) { + if (chat.startsWith(stringBooleanEntry.getKey()) || chat.endsWith(stringBooleanEntry.getKey()) || (stringBooleanEntry.getKey().length() >= 3 && chat.contains(stringBooleanEntry.getKey()))) { + if (stringBooleanEntry.getKey().length() > longestMatch.length()) { + longestMatch = stringBooleanEntry.getKey(); + status = stringBooleanEntry.getValue(); + } + } + } + if (status == null) ; + else if (status) ready.add(username); + else ready.remove(username); + + } + + @Override + public void onDungeonStart() { + ready.clear(); + } + + boolean isAloneInParty() { + if (PartyManager.INSTANCE.getPartyContext() != null) { + return PartyManager.INSTANCE.getPartyContext().getPartyRawMembers().size() == 1; + } + return false; + } + + final Pattern tabListRegex = Pattern.compile("\\*[a-zA-Z0-9_]{2,16}\\*", Pattern.MULTILINE); + + /** + * We regex their name out + * @param networkPlayerInfo the network player info of player + * @return the username of player + */ + private String getPlayerNameWithChecks(NetworkPlayerInfo networkPlayerInfo) { + String name; + if (networkPlayerInfo.getDisplayName() != null) { + name = networkPlayerInfo.getDisplayName().getFormattedText(); + } else { + name = ScorePlayerTeam.formatPlayerName( + networkPlayerInfo.getPlayerTeam(), + networkPlayerInfo.getGameProfile().getName() + ); + } + + if (name.trim().equals("§r") || name.startsWith("§r ")) return null; + + name = TextUtils.stripColor(name); + + return getString(name, tabListRegex); + } + + boolean isPlayerInDungeon(String username) { + + List<NetworkPlayerInfo> list = new ArrayList<>(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); + + // 19 iterations bc we only want to scan the player part of tab list + for (int i = 1; i < 20; i++) { + if(list.size() < i) break; + NetworkPlayerInfo networkPlayerInfo = list.get(i); + + String name = getPlayerNameWithChecks(networkPlayerInfo); + if (name == null) continue; + + EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(name); + + + if (entityplayer != null && (!entityplayer.isInvisible())) { + if (name == username) return true; + } + + + } + return false; + } + + + public final Map<String, Boolean> cachedProfiles = new HashMap<>(); + + + void renderItem(GameProfile stack, int x, int y){ + + +// GameProfile a = new GameProfile(); + + GameProfile toDraw = cachedProfiles.get(stack.getName()) ? stack : null; + + TileEntitySkullRenderer.instance.renderSkull(x, y, -0.5F, EnumFacing.UP, 180.0F, 1, stack, -1); + + if(toDraw == null && !cachedProfiles.containsKey(stack.getName())){ + cachedProfiles.put(stack.getName(), false); + new Thread(() -> { + Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Minecraft.getMinecraft().getSkinManager().loadSkinFromCache(stack); + + if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) { + + MinecraftProfileTexture profileTexture = map.get(MinecraftProfileTexture.Type.SKIN); + + final ResourceLocation resourceLocation = new ResourceLocation("skins/" + profileTexture.getHash()); + ITextureObject iTextureObject = Minecraft.getMinecraft().getTextureManager().getTexture(resourceLocation); + if (iTextureObject == null) { + + String skinCacheDir = ReflectionHelper.getPrivateValue(SkinManager.class, Minecraft.getMinecraft().getSkinManager(), "field_152796_d", "skinCacheDir"); + + File file = new File(skinCacheDir, profileTexture.getHash().length() > 2 ? profileTexture.getHash().substring(0, 2) : "xx"); + File file2 = new File(file, profileTexture.getHash()); + final IImageBuffer iImageBuffer = new ImageBufferDownload(); + ThreadDownloadImageData threadDownloadImageData = new ThreadDownloadImageData(file2, profileTexture.getUrl(), DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer() { + + public BufferedImage parseUserSkin(BufferedImage image) { + if (iImageBuffer != null) { + image = iImageBuffer.parseUserSkin(image); + } + + return image; + } + + public void skinAvailable() { + if (iImageBuffer != null) { + iImageBuffer.skinAvailable(); + } + } + }); + Minecraft.getMinecraft().getTextureManager().loadTexture(resourceLocation, threadDownloadImageData); + } + } + + cachedProfiles.replace(stack.getName(), true); + }).start(); + } + + + + } + + @Override + public void drawHUD(float partialTicks) { + + if (PartyManager.INSTANCE.getPartyContext() == null) return; + if (!PartyManager.INSTANCE.getPartyContext().isPartyExistHypixel()) return; +// if(isAloneInParty()) return; + + ResourceLocation logoLoc = new ResourceLocation("dungeonsguide:textures/dglogox32.png"); + + FontRenderer fr = getFontRenderer(); + + + int y = 0; + for (String partyRawMember : PartyManager.INSTANCE.getPartyContext().getPartyRawMembers()) { + + boolean isDgUser = isDgUser(partyRawMember); + + int xOffset = isDgUser ? 9 : -2; + + GlStateManager.pushMatrix(); + + + GlStateManager.scale(scale, scale, 1F); + + Gui.drawRect(15 + xOffset, 5 + y, fr.getStringWidth(partyRawMember + genPlayerText(partyRawMember)) + 20 + xOffset, 15 + y, getColorTextColor(partyRawMember)); + + RenderHelper.enableStandardItemLighting(); + renderItem(Minecraft.getMinecraft().theWorld.getPlayerEntityByName(partyRawMember).getGameProfile(), 0, y + 1); +// Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(getSkullByUserName(partyRawMember), 0, y + 1); + RenderHelper.disableStandardItemLighting(); + + fr.drawString(partyRawMember, 15 + xOffset, y + 5, 0xffffff); + + + fr.drawString(genPlayerText(partyRawMember), 16 + fr.getStringWidth(partyRawMember) + xOffset, y + 5, 0xf9f9fa); + + if (isDgUser) { + + GlStateManager.translate(xOffset + 5, y + 3.5F, 200F); + GlStateManager.scale(0.32F, 0.32F, 1F); + Minecraft.getMinecraft().getTextureManager().bindTexture(logoLoc); + Gui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 32, 32, 32, 32); + } + + + GlStateManager.popMatrix(); + + y += 12; + } + + } + + private boolean isDgUser(String partyRawMember) { + if (Objects.equals(partyRawMember, Minecraft.getMinecraft().getSession().getUsername())) return true; + return PartyManager.INSTANCE.getPartyContext().isDgUser(partyRawMember); + } + + + private int getColorTextColor(String partyRawMember) { + if (Objects.equals(genPlayerText(partyRawMember), ": Ready") || Objects.equals(genPlayerText(partyRawMember), ": Not Ready")) { + boolean isPlayerReady = ready.contains(partyRawMember); + return isPlayerReady ? 0xFF12bc00 : 0xFFd70022; + } + + + return 0xFF38383d; + } + + + String genPlayerText(String username) { + + if (DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) { + if (Objects.equals(username, Minecraft.getMinecraft().getSession().getUsername())) { + return ": In Dungeon"; + } else if (isPlayerInDungeon(username)) { + return ": In Dungeon"; + } else { + return ": Somewhere"; + } + } else { + if (ready.contains(username)) { + return ": Ready"; + } + + return ": Not Ready"; + } + } + + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureAutoReparty.java index 418b1654..6b2f98b2 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureAutoReparty.java @@ -16,15 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; public class FeatureAutoReparty extends SimpleFeature implements DungeonQuitListener { public FeatureAutoReparty() { - super("Party.Reparty", "Auto reparty when dungeon finishes","Auto reparty on dungeon finish\n\nThis automates player chatting action, (disbanding, repartying) Thus it might be against hypixel's rules.\nBut mods like auto-gg exist so I'm leaving this feature.\nThis option is use-at-your-risk and you'll be responsible for ban if you somehow get banned because of this feature\n(Although it is not likely to happen)\nDefaults to off", "bossfight.autoreparty", false); + super("Party.Reparty", "Auto reparty when dungeon finishes","Auto reparty on dungeon finish\n\nThis automates player chatting action, (disbanding, repartying) Thus it might be against hypixel's rules.\nBut mods like auto-gg exist so I'm leaving this feature.\nThis option is use-at-your-risk and you'll be responsible for ban if you somehow get banned because of this feature\n(Although it is not likely to happen)\nDefaults to off", "party.autoreparty", false); } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBossHealth.java index fb858adf..589dbda9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBossHealth.java @@ -16,17 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.HealthData; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; + import java.util.ArrayList; import java.util.Arrays; @@ -34,11 +32,11 @@ import java.util.List; public class FeatureBossHealth extends TextHUDFeature { public FeatureBossHealth() { - super("Bossfight", "Display Boss Health(s)", "Show the health of boss and minibosses in bossfight (Guardians, Priests..)", "bossfight.health", false, getFontRenderer().getStringWidth("The Professor: 4242m"), getFontRenderer().FONT_HEIGHT * 5); + super("Dungeon.Bossfight", "Display Boss(es) Health", "Show the health of boss and minibosses in bossfight (Guardians, Priests..)", "bossfight.health", false, getFontRenderer().getStringWidth("The Professor: 4242m"), getFontRenderer().FONT_HEIGHT * 5); this.setEnabled(true); - parameters.put("totalHealth", new FeatureParameter<Boolean>("totalHealth", "show total health", "Show total health along with current health", false, "boolean")); - parameters.put("formatHealth", new FeatureParameter<Boolean>("formatHealth", "format health", "1234568 -> 1m", true, "boolean")); - parameters.put("ignoreInattackable", new FeatureParameter<Boolean>("ignoreInattackable", "Don't show health of in-attackable enemy", "For example, do not show guardians health when they're not attackable", false, "boolean")); + addParameter("totalHealth", new FeatureParameter<Boolean>("totalHealth", "show total health", "Show total health along with current health", false, "boolean", nval -> totalHealth = nval)); + addParameter("formatHealth", new FeatureParameter<Boolean>("formatHealth", "format health", "1234568 -> 1m", true, "boolean", nval -> formatHealth = nval)); + addParameter("ignoreInattackable", new FeatureParameter<Boolean>("ignoreInattackable", "Don't show health of in-attackable enemy", "For example, do not show guardians health when they're not attackable", false, "boolean", nval -> ignoreInattackable = nval)); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); @@ -47,7 +45,11 @@ public class FeatureBossHealth extends TextHUDFeature { getStyles().add(new TextStyle("maxHealth", new AColor(0x55, 0x55,0xFF,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); + + boolean totalHealth; + boolean formatHealth; + boolean ignoreInattackable; + @Override @@ -57,7 +59,7 @@ public class FeatureBossHealth extends TextHUDFeature { @Override public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() != null; + return SkyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() != null; } @Override @@ -77,24 +79,21 @@ public class FeatureBossHealth extends TextHUDFeature { } public void addLine(HealthData data, List<StyledText> actualBit) { - boolean format = this.<Boolean>getParameter("formatHealth").getValue(); - boolean total = this.<Boolean>getParameter("totalHealth").getValue(); - boolean ignore = this.<Boolean>getParameter("ignoreInattackable").getValue(); - if (ignore && !data.isAttackable()) return; + if (ignoreInattackable && !data.isAttackable()) return; actualBit.add(new StyledText(data.getName(),"title")); actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText( (format ? TextUtils.format(data.getHealth()) : data.getHealth()) + (total ? "" : "\n"),"health")); - if (total) { + actualBit.add(new StyledText( (formatHealth ? TextUtils.format(data.getHealth()) : data.getHealth()) + (totalHealth ? "" : "\n"),"health")); + if (totalHealth) { actualBit.add(new StyledText("/", "separator2")); - actualBit.add(new StyledText( (format ? TextUtils.format(data.getMaxHealth()) : data.getMaxHealth()) +"\n","maxHealth")); + actualBit.add(new StyledText( (formatHealth ? TextUtils.format(data.getMaxHealth()) : data.getMaxHealth()) +"\n","maxHealth")); } } @Override public java.util.List<StyledText> getText() { List<StyledText> actualBit = new ArrayList<StyledText>(); - List<HealthData> healths = skyblockStatus.getContext().getBossfightProcessor().getHealths(); + List<HealthData> healths = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor().getHealths(); for (HealthData heal : healths) { addLine(heal, actualBit); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBoxRealLivid.java index f70ced10..d102fb37 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureBoxRealLivid.java @@ -16,39 +16,40 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorLivid; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorLivid; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.util.AxisAlignedBB; public class FeatureBoxRealLivid extends SimpleFeature implements WorldRenderListener { public FeatureBoxRealLivid() { - super("Bossfight.Floor 5", "Box Real Livid", "Box Real Livid in bossfight", "bossfight.realLividBox", true); - parameters.put("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Livid", new AColor(0,255,0,150), "acolor")); + super("Dungeon.Bossfight.Floor 5", "Box Real Livid", "Box Real Livid in bossfight", "Dungeon.Bossfight.realLividBox", true); + addParameter("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Livid", new AColor(0,255,0,150), "acolor", nval -> color = nval)); } + AColor color = null; private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void drawWorld(float partialTicks) { if (!isEnabled()) return; if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null) return; - if (skyblockStatus.getContext().getBossfightProcessor() == null) return; - if (!(skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorLivid)) return; - EntityOtherPlayerMP playerMP = ((BossfightProcessorLivid) skyblockStatus.getContext().getBossfightProcessor()).getRealLivid(); + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() == null) return; + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() == null) return; + if (!(DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() instanceof BossfightProcessorLivid)) return; + EntityOtherPlayerMP playerMP = ((BossfightProcessorLivid) DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor()).getRealLivid(); - AColor c = this.<AColor>getParameter("color").getValue(); if (playerMP != null) - RenderUtils.highlightBox(playerMP, AxisAlignedBB.fromBounds(-0.4,0,-0.4,0.4,1.8,0.4), c, partialTicks, true); + RenderUtils.highlightBox(playerMP, AxisAlignedBB.fromBounds(-0.4,0,-0.4,0.4,1.8,0.4), color, partialTicks, true); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureChestPrice.java index de3873ba..402f5ec6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureChestPrice.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.listener.GuiBackgroundRenderListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.AhUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.GuiBackgroundRenderListener; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -43,7 +43,7 @@ import java.util.TreeSet; public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRenderListener { public FeatureChestPrice() { - super("Bossfight", "Show Profit of Dungeon Chests","Show Profit of Dungeon Chests", "bossfight.profitchest", false); + super("Dungeon", "Show Profit of Dungeon Reward Chests","Show Profit of Dungeon Chests", "bossfight.profitchest", false); } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureCurrentPhase.java index 5c199c61..51c1bef9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureCurrentPhase.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; import java.util.ArrayList; import java.util.Arrays; @@ -31,7 +31,7 @@ import java.util.List; public class FeatureCurrentPhase extends TextHUDFeature { public FeatureCurrentPhase() { - super("Bossfight", "Display Current Phase", "Displays the current phase of bossfight", "bossfight.phasedisplay", false, getFontRenderer().getStringWidth("Current Phase: fight-2-idk-howlng"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.Bossfight", "Display Current Phase", "Displays the current phase of bossfight", "bossfight.phasedisplay", false, getFontRenderer().getStringWidth("Current Phase: fight-2-idk-howlng"), getFontRenderer().FONT_HEIGHT); this.setEnabled(true); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); @@ -48,7 +48,7 @@ public class FeatureCurrentPhase extends TextHUDFeature { } @Override public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() != null; + return skyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() != null; } @Override @@ -63,7 +63,7 @@ public class FeatureCurrentPhase extends TextHUDFeature { @Override public List<StyledText> getText() { - String currentPhsae =skyblockStatus.getContext().getBossfightProcessor().getCurrentPhase(); + String currentPhsae = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor().getCurrentPhase(); List<StyledText> actualBit = new ArrayList<StyledText>(); actualBit.add(new StyledText("Current Phase","title")); actualBit.add(new StyledText(": ","separator")); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureHideAnimals.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureHideAnimals.java new file mode 100644 index 00000000..c12d0c00 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureHideAnimals.java @@ -0,0 +1,78 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.boss; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorThorn; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.EntityLivingRenderListener; +import net.minecraft.entity.passive.*; +import net.minecraftforge.client.event.RenderLivingEvent; + + +public class FeatureHideAnimals extends SimpleFeature implements EntityLivingRenderListener { + public FeatureHideAnimals() { + super("Dungeon.Bossfight.Floor 4", "Hide animals on f4", "Hide Spirit Animals on F4. \nClick on Edit for precise setting", "bossfight.hideanimals", false); + addParameter("sheep", new FeatureParameter<Boolean>("sheep", "Hide Sheeps", "Hide Sheeps", true, "boolean", nval -> sheep = nval)); + addParameter("cow", new FeatureParameter<Boolean>("cow", "Hide Cows", "Hide Cows", true, "boolean", nval -> cow = nval)); + addParameter("chicken", new FeatureParameter<Boolean>("chicken", "Hide Chickens", "Hide Chickens", true, "boolean", nval -> chicken = nval)); + addParameter("wolf", new FeatureParameter<Boolean>("wolf", "Hide Wolves", "Hide Wolves", true, "boolean", nval -> wolf = nval)); + addParameter("rabbit", new FeatureParameter<Boolean>("rabbit", "Hide Rabbits", "Hide Rabbits", true, "boolean", nval -> rabbit = nval)); + } + + boolean sheep; + boolean cow; + boolean chicken; + boolean wolf; + boolean rabbit; + + + + private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); + + @Override + public void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent) { + if (!isEnabled()) return; + if (!skyblockStatus.isOnDungeon()) return; + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() == null) return; + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() == null) return; + if (!(DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; + + if (renderPlayerEvent.entity instanceof EntitySheep && sheep) { + renderPlayerEvent.setCanceled(true); + } else if (renderPlayerEvent.entity instanceof EntityCow && cow ) { + renderPlayerEvent.setCanceled(true); + } else if (renderPlayerEvent.entity instanceof EntityChicken && chicken) { + renderPlayerEvent.setCanceled(true); + } else if (renderPlayerEvent.entity instanceof EntityWolf && wolf) { + renderPlayerEvent.setCanceled(true); + } else if (renderPlayerEvent.entity instanceof EntityRabbit && rabbit) { + renderPlayerEvent.setCanceled(true); + } + } + + @Override + public void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent) { + + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureTerracotaTimer.java index a581ad0f..5bb06711 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureTerracotaTimer.java @@ -16,16 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorSadan; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorSadan; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.entity.boss.BossStatus; import java.util.ArrayList; @@ -34,7 +33,7 @@ import java.util.List; public class FeatureTerracotaTimer extends TextHUDFeature { public FeatureTerracotaTimer() { - super("Bossfight.Floor 6", "Display Terracotta phase timer", "Displays Terracotta phase timer", "bossfight.terracota", true, getFontRenderer().getStringWidth("Terracottas: 1m 99s"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.Bossfight.Floor 6", "Display Terracotta phase timer", "Displays Terracotta phase timer", "bossfight.terracota", true, getFontRenderer().getStringWidth("Terracottas: 1m 99s"), getFontRenderer().FONT_HEIGHT); this.setEnabled(true); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); @@ -51,8 +50,8 @@ public class FeatureTerracotaTimer extends TextHUDFeature { } @Override public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorSadan && - "fight-1".equalsIgnoreCase(skyblockStatus.getContext().getBossfightProcessor().getCurrentPhase()); + return skyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() instanceof BossfightProcessorSadan && + "fight-1".equalsIgnoreCase(DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor().getCurrentPhase()); } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornBearPercentage.java index c9249df9..a66527b8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornBearPercentage.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorThorn; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; import java.util.ArrayList; import java.util.Arrays; @@ -32,7 +32,7 @@ import java.util.List; public class FeatureThornBearPercentage extends TextHUDFeature { public FeatureThornBearPercentage() { - super("Bossfight.Floor 4", "Display Spirit Bear Summon Percentage", "Displays spirit bear summon percentage in hud", "bossfight.spiritbear", true, getFontRenderer().getStringWidth("Spirit Bear: 100%"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.Bossfight.Floor 4", "Display Spirit Bear Summon Percentage", "Displays spirit bear summon percentage in hud", "bossfight.spiritbear", true, getFontRenderer().getStringWidth("Spirit Bear: 100%"), getFontRenderer().FONT_HEIGHT); this.setEnabled(true); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); @@ -51,7 +51,7 @@ public class FeatureThornBearPercentage extends TextHUDFeature { } @Override public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn; + return skyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() instanceof BossfightProcessorThorn; } @Override @@ -66,7 +66,7 @@ public class FeatureThornBearPercentage extends TextHUDFeature { @Override public java.util.List<StyledText> getText() { - int percentage = (int) (((BossfightProcessorThorn) skyblockStatus.getContext().getBossfightProcessor()).calculatePercentage() * 100); + int percentage = (int) (((BossfightProcessorThorn) DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor()).calculatePercentage() * 100); List<StyledText> actualBit = new ArrayList<StyledText>(); actualBit.add(new StyledText("Spirit Bear","title")); actualBit.add(new StyledText(": ","separator")); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornSpiritBowTimer.java index c6470692..b155ca39 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureThornSpiritBowTimer.java @@ -16,18 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorThorn; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.TitleListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.network.play.server.S45PacketTitle; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -37,7 +34,7 @@ import java.util.List; public class FeatureThornSpiritBowTimer extends TextHUDFeature implements ChatListener, TitleListener { public FeatureThornSpiritBowTimer() { - super("Bossfight.Floor 4", "Display Spirit bow timer", "Displays how long until spirit bow gets destroyed", "bossfight.spiritbowdisplay", false, getFontRenderer().getStringWidth("Spirit Bow Destruction: 2m 00s"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.Bossfight.Floor 4", "Display Spirit bow timer", "Displays how long until spirit bow gets destroyed", "bossfight.spiritbowdisplay", false, getFontRenderer().getStringWidth("Spirit Bow Destruction: 2m 00s"), getFontRenderer().FONT_HEIGHT); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("time", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); @@ -53,7 +50,7 @@ public class FeatureThornSpiritBowTimer extends TextHUDFeature implements ChatLi } @Override public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn && time > System.currentTimeMillis(); + return skyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() instanceof BossfightProcessorThorn && time > System.currentTimeMillis(); } @Override @@ -78,7 +75,7 @@ public class FeatureThornSpiritBowTimer extends TextHUDFeature implements ChatLi @Override public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (!(skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; + if (!(skyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; String text = clientChatReceivedEvent.message.getFormattedText(); if (text.equals("§r§a§lThe §r§5§lSpirit Bow §r§a§lhas dropped!§r")) { time = System.currentTimeMillis() + 16000; @@ -102,7 +99,7 @@ public class FeatureThornSpiritBowTimer extends TextHUDFeature implements ChatLi @Override public void onTitle(S45PacketTitle renderPlayerEvent) { - if (!(skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; + if (!(skyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; if (renderPlayerEvent.getMessage().getFormattedText().contains("picked up")) { time = System.currentTimeMillis() + 21000; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureWarningOnPortal.java index 555c982d..31c2e0cb 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/FeatureWarningOnPortal.java @@ -16,36 +16,34 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss; import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.impl.dungeon.FeatureDungeonScore; -import kr.syeyoung.dungeonsguide.features.text.PanelTextParameterConfig; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.StyledTextProvider; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.text.*; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MFeatureEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.impl.dungeon.FeatureDungeonScore; +import kr.syeyoung.dungeonsguide.mod.features.text.*; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; + import java.util.*; public class FeatureWarningOnPortal extends SimpleFeature implements StyledTextProvider { public FeatureWarningOnPortal() { super("Dungeon.Blood Room", "Score Warning on Watcher portal", "Display warnings such as\n- 'NOT ALL ROOMS DISCOVERED'\n- 'NOT ALL ROOMS COMPLETED'\n- 'Expected Score: 304'\n- 'MISSING 3 CRYPTS'\non portal", "bossfight.warningonportal"); - this.parameters.put("textStyles", new FeatureParameter<List<TextStyle>>("textStyles", "", "", new ArrayList<TextStyle>(), "list_textStyle")); + addParameter("textStyles", new FeatureParameter<List<TextStyle>>("textStyles", "", "", new ArrayList<TextStyle>(), "list_textStyle")); getStyles().add(new TextStyle("warning", new AColor(255, 0,0,255), new AColor(255, 255,255,255), false)); getStyles().add(new TextStyle("field_name", new AColor(255, 72,255,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("field_separator", new AColor(204, 204,204,255), new AColor(0, 0,0,0), false)); @@ -107,7 +105,7 @@ public class FeatureWarningOnPortal extends SimpleFeature implements StyledTextP @Override public List<StyledText> getText() { ArrayList<StyledText> texts = new ArrayList<StyledText>(); - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); FeatureDungeonScore.ScoreCalculation scoreCalculation = FeatureRegistry.DUNGEON_SCORE.calculateScore(); boolean failed = context.getDungeonRoomList().stream().anyMatch(a -> a.getCurrentState() == DungeonRoom.RoomState.FAILED); @@ -153,7 +151,7 @@ public class FeatureWarningOnPortal extends SimpleFeature implements StyledTextP texts.add(new StyledText("Explorer","field_name")); texts.add(new StyledText(": ","field_separator")); texts.add(new StyledText(scoreCalculation.getExplorer()+" ","field_value")); - texts.add(new StyledText("("+FeatureRegistry.DUNGEON_SCORE.getPercentage()+"% + secrets)\n","field_etc")); + texts.add(new StyledText("("+ DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getPercentage() +"% + secrets)\n","field_etc")); texts.add(new StyledText("Time","field_name")); texts.add(new StyledText(": ","field_separator")); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/CorrectThePaneSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/CorrectThePaneSolutionProvider.java index a4172158..c8894a14 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/CorrectThePaneSolutionProvider.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/CorrectThePaneSolutionProvider.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal; import net.minecraft.init.Blocks; import net.minecraft.inventory.ContainerChest; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureSimonSaysSolver.java index bd90f724..5d7de49f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureSimonSaysSolver.java @@ -16,17 +16,19 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.InteractListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorNecron; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.bossfight.BossfightProcessorNecron; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.InteractListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.TickListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; @@ -40,7 +42,7 @@ import java.util.List; public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRenderListener, TickListener, InteractListener { public FeatureSimonSaysSolver() { - super("Solver.Floor 7+.Bossfight","Simon Says Solver","Solver for Simon says puzzle", "bossfight.simonsays2"); + super("Dungeon.Bossfight.Floor 7+","Simon Says Solver","Solver for Simon says puzzle", "Dungeon.Bossfight.simonsays2"); } private final SkyblockStatus ss = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @@ -50,7 +52,7 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender @Override public void drawWorld(float partialTicks) { if (!isEnabled()) return; - DungeonContext dc = ss.getContext(); + DungeonContext dc = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (dc == null) { return; } @@ -66,20 +68,18 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender private boolean wasButton = false; @Override public void onTick() { - DungeonContext dc = ss.getContext(); + DungeonContext dc = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (dc == null) { wasButton = false; return; } if (!(dc.getBossfightProcessor() instanceof BossfightProcessorNecron)) return; - World w = dc.getWorld(); - - if (wasButton && w.getBlockState(new BlockPos(309, 123, 291)).getBlock() == Blocks.air) { + if (wasButton && DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(new BlockPos(309, 123, 291)).getBlock() == Blocks.air) { orderclick.clear(); orderbuild.clear(); wasButton = false; - } else if (!wasButton && w.getBlockState(new BlockPos(309, 123, 291)).getBlock() == Blocks.stone_button){ + } else if (!wasButton && DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(new BlockPos(309, 123, 291)).getBlock() == Blocks.stone_button){ orderclick.addAll(orderbuild); wasButton = true; } @@ -87,7 +87,7 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender if (!wasButton) { for (BlockPos allInBox : BlockPos.getAllInBox(new BlockPos(310, 123, 291), new BlockPos(310, 120, 294))) { - if (w.getBlockState(allInBox).getBlock() == Blocks.sea_lantern && !orderbuild.contains(allInBox)) { + if (DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(allInBox).getBlock() == Blocks.sea_lantern && !orderbuild.contains(allInBox)) { orderbuild.add(allInBox); } } @@ -98,7 +98,7 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender public void onInteract(PlayerInteractEvent event) { if (!isEnabled()) return; - DungeonContext dc = ss.getContext(); + DungeonContext dc = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (dc == null) return; if (!(dc.getBossfightProcessor() instanceof BossfightProcessorNecron)) return; if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) return; @@ -106,7 +106,7 @@ public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRender BlockPos pos = event.pos.add(1,0,0); if (120 <= pos.getY() && pos.getY() <= 123 && pos.getX() == 310 && 291 <= pos.getZ() && pos.getZ() <= 294) { - if (w.getBlockState(event.pos).getBlock() != Blocks.stone_button) return; + if (DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(event.pos).getBlock() != Blocks.stone_button) return; if (pos.equals(orderclick.peek())) { orderclick.poll(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureTerminalSolvers.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java index e6e03318..64b1509d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureTerminalSolvers.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java @@ -16,11 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal; -import kr.syeyoung.dungeonsguide.features.listener.*; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.*; + + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.*; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.inventory.GuiChest; @@ -37,7 +38,7 @@ import java.util.List; public class FeatureTerminalSolvers extends SimpleFeature implements GuiOpenListener, TickListener, GuiPostRenderListener, GuiClickListener, TooltipListener { public FeatureTerminalSolvers() { - super("Solver.Floor 7+.Bossfight","F7 GUI Terminal Solver", "Solve f7 gui terminals. (color, startswith, order, navigate, correct panes)", "bossfight.terminals"); + super("Dungeon.Bossfight.Floor 7+","F7 GUI Terminal Solver", "Solve f7 gui terminals. (color, startswith, order, navigate, correct panes)", "bossfight.terminals"); } public static final List<TerminalSolutionProvider> solutionProviders = new ArrayList<TerminalSolutionProvider>(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/NavigateMazeSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/NavigateMazeSolutionProvider.java index 78a64733..3dbd4ecf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/NavigateMazeSolutionProvider.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/NavigateMazeSolutionProvider.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal; import net.minecraft.init.Blocks; import net.minecraft.inventory.ContainerChest; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectAllColorSolutionProivider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/SelectAllColorSolutionProivider.java index 36a1834f..3a6c20e0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectAllColorSolutionProivider.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/SelectAllColorSolutionProivider.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal; import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectInOrderSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/SelectInOrderSolutionProvider.java index 7295a899..03c9cc3a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectInOrderSolutionProvider.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/SelectInOrderSolutionProvider.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal; import net.minecraft.init.Blocks; import net.minecraft.inventory.ContainerChest; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/TerminalSolution.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/TerminalSolution.java new file mode 100644 index 00000000..3d76aa44 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/TerminalSolution.java @@ -0,0 +1,30 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal; + +import lombok.Data; +import net.minecraft.inventory.Slot; + +import java.util.List; + +@Data +public class TerminalSolution { + private List<Slot> currSlots; + private List<Slot> nextSlots; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/TerminalSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/TerminalSolutionProvider.java new file mode 100644 index 00000000..e2534d16 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/TerminalSolutionProvider.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal; + +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.Slot; + +import java.util.List; + +public interface TerminalSolutionProvider { + TerminalSolution provideSolution(ContainerChest chest, List<Slot> clicked); + boolean isApplicable(ContainerChest chest); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/WhatStartsWithSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/WhatStartsWithSolutionProvider.java index dc9828fb..8ff86193 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/WhatStartsWithSolutionProvider.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/WhatStartsWithSolutionProvider.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; +package kr.syeyoung.dungeonsguide.mod.features.impl.boss.terminal; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknameColor.java index 89d80ca5..ce4599f5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknameColor.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.cosmetics; +package kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; public class FeatureNicknameColor extends SimpleFeature { public FeatureNicknameColor() { super("Cosmetics", "Nickname Color", "Click on Edit to choose nickname color cosmetic", "cosmetic.nickname"); - this.parameters.put("dummy", new FeatureParameter("dummy", "dummy", "dummy", "dummy", "string")); + addParameter("dummy", new FeatureParameter("dummy", "dummy", "dummy", "dummy", "string")); } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknamePrefix.java index 78a9c1c8..698eabb9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/FeatureNicknamePrefix.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.cosmetics; +package kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; public class FeatureNicknamePrefix extends SimpleFeature { public FeatureNicknamePrefix() { super("Cosmetics", "Nickname Prefix", "Click on Edit to choose prefix cosmetic", "cosmetic.prefix"); - this.parameters.put("dummy", new FeatureParameter("dummy", "dummy", "dummy", "dummy", "string")); + addParameter("dummy", new FeatureParameter("dummy", "dummy", "dummy", "dummy", "string")); } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/PrefixSelectorGUI.java index 4750831e..6cbcfe15 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/cosmetics/PrefixSelectorGUI.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.cosmetics; +package kr.syeyoung.dungeonsguide.mod.features.impl.cosmetics; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/ImageTexture.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/ImageTexture.java index 730fe355..3a4c226a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/ImageTexture.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/ImageTexture.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer; +package kr.syeyoung.dungeonsguide.mod.features.impl.discord.inviteViewer; import lombok.Data; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyInviteViewer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java index ad40a91c..18408fb6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyInviteViewer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java @@ -16,16 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.listener.*; -import kr.syeyoung.dungeonsguide.events.DiscordUserJoinRequestEvent; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.*; -import kr.syeyoung.dungeonsguide.rpc.RichPresenceManager; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityJoinRequestReply; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.discord.inviteViewer; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserJoinRequestEvent; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.*; +import kr.syeyoung.dungeonsguide.mod.discord.rpc.RichPresenceManager; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordActivityJoinRequestReply; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyJoinRequest.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyJoinRequest.java index de025698..a50966dc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyJoinRequest.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyJoinRequest.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer; +package kr.syeyoung.dungeonsguide.mod.features.impl.discord.inviteViewer; -import kr.syeyoung.dungeonsguide.gamesdk.GameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordUser; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.GameSDK; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.datastruct.DiscordUser; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInvite.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/invteTooltip/MTooltipInvite.java index fdeda8d3..29d8c7c5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInvite.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/invteTooltip/MTooltipInvite.java @@ -16,20 +16,20 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.discord.invteTooltip; +package kr.syeyoung.dungeonsguide.mod.features.impl.discord.invteTooltip; import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityActionType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordRelationshipType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct.IDiscordActivityManager; -import kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct.IDiscordCore; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.rpc.JDiscordRelation; -import kr.syeyoung.dungeonsguide.rpc.RichPresenceManager; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordActivityActionType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordRelationshipType; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct.IDiscordActivityManager; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.interfacestruct.IDiscordCore; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.typedef.DiscordSnowflake; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; +import kr.syeyoung.dungeonsguide.mod.discord.rpc.JDiscordRelation; +import kr.syeyoung.dungeonsguide.mod.discord.rpc.RichPresenceManager; + import net.minecraft.client.renderer.GlStateManager; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInviteElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/invteTooltip/MTooltipInviteElement.java index 9a7cad07..23954512 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInviteElement.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/invteTooltip/MTooltipInviteElement.java @@ -16,14 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.discord.invteTooltip; +package kr.syeyoung.dungeonsguide.mod.features.impl.discord.invteTooltip; + + +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.discord.inviteViewer.ImageTexture; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; +import kr.syeyoung.dungeonsguide.mod.discord.rpc.JDiscordRelation; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer.ImageTexture; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.rpc.JDiscordRelation; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/onlinealarm/PlayingDGAlarm.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/onlinealarm/PlayingDGAlarm.java index c475ce36..d9281374 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/onlinealarm/PlayingDGAlarm.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/onlinealarm/PlayingDGAlarm.java @@ -16,20 +16,21 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.discord.onlinealarm; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.listener.DiscordUserUpdateListener; -import kr.syeyoung.dungeonsguide.features.listener.ScreenRenderListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.events.DiscordUserUpdateEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer.ImageTexture; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordRelationshipType; -import kr.syeyoung.dungeonsguide.rpc.JDiscordActivity; -import kr.syeyoung.dungeonsguide.rpc.JDiscordRelation; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.discord.onlinealarm; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserUpdateEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.impl.discord.inviteViewer.ImageTexture; +import kr.syeyoung.dungeonsguide.mod.features.listener.DiscordUserUpdateListener; +import kr.syeyoung.dungeonsguide.mod.discord.gamesdk.jna.enumuration.EDiscordRelationshipType; +import kr.syeyoung.dungeonsguide.mod.discord.rpc.JDiscordActivity; +import kr.syeyoung.dungeonsguide.mod.discord.rpc.JDiscordRelation; + +import kr.syeyoung.dungeonsguide.mod.features.listener.ScreenRenderListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.TickListener; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxBats.java index c8ed9cd3..35949374 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxBats.java @@ -16,16 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import com.google.common.base.Predicate; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.entity.passive.EntityBat; import net.minecraft.util.BlockPos; @@ -37,8 +39,8 @@ import java.util.List; public class FeatureBoxBats extends SimpleFeature implements WorldRenderListener { public FeatureBoxBats() { super("Dungeon.Mobs", "Box Bats", "Box bats in dungeons\nDoes not appear through walls", "dungeon.batbox", true); - parameters.put("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and bats to be boxed", 20, "integer")); - parameters.put("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Bats", new AColor(255,0,0,50), "acolor")); + addParameter("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and bats to be boxed", 20, "integer")); + addParameter("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Bats", new AColor(255,0,0,50), "acolor")); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxSkelemaster.java index f21de67b..8e75d96e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxSkelemaster.java @@ -16,16 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import com.google.common.base.Predicate; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.util.BlockPos; @@ -37,8 +39,8 @@ import java.util.List; public class FeatureBoxSkelemaster extends SimpleFeature implements WorldRenderListener { public FeatureBoxSkelemaster() { super("Dungeon.Mobs", "Box Skeleton Masters", "Box skeleton masters in dungeons", "dungeon.skeletonmasterbox", true); - parameters.put("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and skeletonmaster to be boxed", 20, "integer")); - parameters.put("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Skeleton master", new AColor(255,0,0,50), "acolor")); + addParameter("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and skeletonmaster to be boxed", 20, "integer")); + addParameter("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Skeleton master", new AColor(255,0,0,50), "acolor")); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxStarMobs.java index eeda16d0..d45a7b14 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureBoxStarMobs.java @@ -16,16 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; import com.google.common.base.Predicate; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.WorldRenderListener; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.util.BlockPos; @@ -37,8 +39,8 @@ import java.util.List; public class FeatureBoxStarMobs extends SimpleFeature implements WorldRenderListener { public FeatureBoxStarMobs() { super("Dungeon.Mobs", "Box Starred mobs", "Box Starred mobs in dungeons", "dungeon.starmobbox", false); - parameters.put("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and starred mobs to be boxed", 20, "integer")); - parameters.put("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Starred mobs", new AColor(0,255,255,50), "acolor")); + addParameter("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and starred mobs to be boxed", 20, "integer")); + addParameter("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Starred mobs", new AColor(0,255,255,50), "acolor")); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureCollectScore.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureCollectScore.java new file mode 100644 index 00000000..f9ea3a49 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureCollectScore.java @@ -0,0 +1,77 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.stomp.StompManager; +import kr.syeyoung.dungeonsguide.mod.stomp.StompPayload; +import kr.syeyoung.dungeonsguide.mod.utils.MapUtils; +import kr.syeyoung.dungeonsguide.mod.wsresource.StaticResourceCache; +import net.minecraft.util.ChatComponentText; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.json.JSONObject; + +import java.util.concurrent.ExecutionException; + +public class FeatureCollectScore extends SimpleFeature { + Logger logger = LogManager.getLogger("FeatureCollectScore"); + public FeatureCollectScore() { + super("Misc", "Collect Speed Score", "Collect Speed score, run time, and floor and send that to developer's server for speed formula. This data is completely anonymous, opt out of the feature by disabling this feature", "misc.gatherscoredata", true); + } + + public void collectDungeonRunData(byte[] mapData, DungeonContext context) { + int skill = MapUtils.readNumber(mapData, 51, 35, 9); + int exp = MapUtils.readNumber(mapData, 51, 54, 9); + int time = MapUtils.readNumber(mapData, 51, 73, 9); + int bonus = MapUtils.readNumber(mapData, 51, 92, 9); + ChatTransmitter.sendDebugChat(new ChatComponentText(("skill: " + skill + " / exp: " + exp + " / time: " + time + " / bonus : " + bonus))); + JSONObject payload = new JSONObject().put("timeSB", FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()) + .put("timeR", FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + .put("timeScore", time) + .put("completionStage", context.getBossRoomEnterSeconds() == -1 ? 0 : + context.isDefeated() ? 2 : 1) + .put("percentage", DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getPercentage() / 100.0) + .put("floor", DungeonContext.getDungeonName()); + ChatTransmitter.sendDebugChat(new ChatComponentText(payload.toString())); + + if(!StompManager.getInstance().isStompConnected()){ + logger.warn("Error stomp is not connected while trying to send dungeons scored"); + return; + } + + String target = null; + try { + target = StaticResourceCache.INSTANCE.getResource(StaticResourceCache.DATA_COLLECTION).get().getValue(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + + if (FeatureRegistry.ETC_COLLECT_SCORE.isEnabled() && !target.contains("falsefalsefalsefalse")) { + StompManager.getInstance().send(new StompPayload().payload(payload.toString()).destination(target.replace("false", "").trim())); + } + } + + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java index 5f68187e..6cb9052a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java @@ -16,15 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; + import net.minecraftforge.client.event.ClientChatReceivedEvent; import java.util.ArrayList; @@ -33,7 +32,7 @@ import java.util.List; public class FeatureDungeonCurrentRoomSecrets extends TextHUDFeature implements ChatListener { public FeatureDungeonCurrentRoomSecrets() { - super("Dungeon.Dungeon Information", "Display # Secrets in current room", "Display what your actionbar says", "dungeon.stats.secretsroom", true, getFontRenderer().getStringWidth("Secrets In Room: 8/8"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.HUDs", "Display # Secrets in current room", "Display what your actionbar says", "dungeon.stats.secretsroom", true, getFontRenderer().getStringWidth("Secrets In Room: 8/8"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); @@ -75,7 +74,7 @@ public class FeatureDungeonCurrentRoomSecrets extends TextHUDFeature implements @Override public List<StyledText> getText() { - if (skyblockStatus.getContext().getBossfightProcessor() != null) return new ArrayList<StyledText>(); + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getBossfightProcessor() != null) return new ArrayList<StyledText>(); List<StyledText> actualBit = new ArrayList<StyledText>(); actualBit.add(new StyledText("Secrets In Room","title")); actualBit.add(new StyledText(": ","separator")); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonDeaths.java index 3dafd79e..c19ddfbe 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonDeaths.java @@ -16,18 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.events.DungeonDeathEvent; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; + import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.scoreboard.ScorePlayerTeam; @@ -41,7 +39,7 @@ import java.util.regex.Pattern; public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener { public FeatureDungeonDeaths() { - super("Dungeon.Dungeon Information", "Display Deaths", "Display names of player and death count in dungeon run", "dungeon.stats.deaths", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); + super("Dungeon.HUDs", "Display Deaths", "Display names of player and death count in dungeon run", "dungeon.stats.deaths", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); this.setEnabled(false); getStyles().add(new TextStyle("username", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("total", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); @@ -54,7 +52,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener @Override public boolean isHUDViewable() { if (!skyblockStatus.isOnDungeon()) return false; - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); return context != null; } @@ -73,7 +71,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener List<StyledText> text= new ArrayList<StyledText>(); - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); Map<String, Integer> deaths = context.getDeaths(); int i = 0; int deathsCnt = 0; @@ -127,7 +125,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener return Integer.parseInt(whatever); } } - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (context == null) return 0; int d = 0; for (Integer value : context.getDeaths().values()) { @@ -143,7 +141,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.type == 2) return; if (!skyblockStatus.isOnDungeon()) return; - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (context == null) return; String txt = clientChatReceivedEvent.message.getFormattedText(); @@ -153,7 +151,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener int deaths = context.getDeaths().getOrDefault(nickname, 0); context.getDeaths().put(nickname, deaths + 1); context.createEvent(new DungeonDeathEvent(nickname, txt, deaths)); - DungeonsGuide.sendDebugChat(new ChatComponentText("Death verified :: "+nickname+" / "+(deaths + 1))); + ChatTransmitter.sendDebugChat(new ChatComponentText("Death verified :: "+nickname+" / "+(deaths + 1))); } Matcher m2 = meDeathPattern.matcher(txt); if (m2.matches()) { @@ -161,7 +159,7 @@ public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener int deaths = context.getDeaths().getOrDefault(nickname, 0); context.getDeaths().put(nickname, deaths + 1); context.createEvent(new DungeonDeathEvent(Minecraft.getMinecraft().thePlayer.getName(), txt, deaths)); - DungeonsGuide.sendDebugChat(new ChatComponentText("Death verified :: me / "+(deaths + 1))); + ChatTransmitter.sendDebugChat(new ChatComponentText("Death verified :: me / "+(deaths + 1))); } } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java new file mode 100644 index 00000000..135696e1 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMap.java @@ -0,0 +1,508 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + +import com.google.common.collect.ComparisonChain; +import com.google.common.collect.Ordering; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.MapProcessor; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.BossroomEnterListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonEndListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonStartListener; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TabListUtil; +import net.minecraft.block.material.MapColor; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.*; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.storage.MapData; +import org.jetbrains.annotations.Nullable; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; + +import javax.vecmath.Vector2d; +import java.awt.*; +import java.util.List; + +public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, DungeonStartListener, BossroomEnterListener { + private AColor backgroudColor; + private AColor playerColor; + private boolean shouldCacheMap; + private float playerHeadScale; + private boolean shouldShowOtherPlayers; + private float textScale; + private boolean showSecretCount; + private boolean showPlayerHeads; + private boolean shouldRotateWithPlayer; + private boolean shouldScale; + private float postscaleOfMap; + private boolean centerMapOnPlayer; + + public FeatureDungeonMap() { + super("Dungeon", "Dungeon Map", "Display dungeon map!", "dungeon.map", true, 128, 128); + this.setEnabled(false); + addParameter("scale", new FeatureParameter<>("scale", "Scale map", "Whether to scale map to fit screen", true, "boolean", nval -> shouldScale = nval)); + addParameter("cacheMap", new FeatureParameter<>("cacheMap", "Should cache map data", "name", true, "boolean", nval -> shouldCacheMap = nval)); + addParameter("playerCenter", new FeatureParameter<>("playerCenter", "Center map at player", "Render you in the center", false, "boolean", nval -> centerMapOnPlayer = nval)); + addParameter("rotate", new FeatureParameter<>("rotate", "Rotate map centered at player", "Only works with Center map at player enabled", false, "boolean", nval -> shouldRotateWithPlayer = nval)); + addParameter("postScale", new FeatureParameter<>("postScale", "Scale factor of map", "Only works with Center map at player enabled", 1.0f, "float", nval -> postscaleOfMap = nval)); + addParameter("useplayerheads", new FeatureParameter<>("useplayerheads", "Use player heads instead of arrows", "Option to use player heads instead of arrows", true, "boolean", nval -> showPlayerHeads = nval)); + addParameter("showotherplayers", new FeatureParameter<>("showotherplayers", "Show other players", "Option to show other players in map", true, "boolean", nval -> shouldShowOtherPlayers = nval)); + addParameter("showtotalsecrets", new FeatureParameter<>("showtotalsecrets", "Show Total secrets in the room", "Option to overlay total secrets in the specific room", true, "boolean", nval -> showSecretCount = nval)); + addParameter("playerheadscale", new FeatureParameter<>("playerheadscale", "Player head scale", "Scale factor of player heads, defaults to 1", 1.0f, "float", nval -> playerHeadScale = nval)); + addParameter("textScale", new FeatureParameter<>("textScale", "Text scale", "Scale factor of texts on map, defaults to 1", 1.0f, "float", nval -> textScale = nval)); + + addParameter("border_color", new FeatureParameter<>("border_color", "Color of the border", "Same as name", new AColor(255, 255, 255, 255), "acolor")); + addParameter("background_color", new FeatureParameter<>("background_color", "Color of the background", "Same as name", new AColor(0x22000000, true), "acolor", nval -> backgroudColor = nval)); + addParameter("player_color", new FeatureParameter<>("player_color", "Color of the player border", "Same as name", new AColor(255, 255, 255, 0), "acolor", nval -> playerColor = nval)); + } + + public static final Ordering<NetworkPlayerInfo> sorter = Ordering.from((compare1, compare2) -> { + ScorePlayerTeam scoreplayerteam = compare1.getPlayerTeam(); + ScorePlayerTeam scoreplayerteam1 = compare2.getPlayerTeam(); + return ComparisonChain.start().compareTrueFirst(compare1.getGameType() != WorldSettings.GameType.SPECTATOR, compare2.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(compare1.getGameProfile().getName(), compare2.getGameProfile().getName()).result(); + }); + + private boolean on = false; + + @Override + public void onDungeonEnd() { + on = false; + } + + @Override + public void onDungeonStart() { + on = true; + } + + @Override + public void onBossroomEnter() { + on = false; + } + + @Override + public void drawHUD(float partialTicks) { + if (!on) return; + if (!DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; + + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (context == null || !context.getMapProcessor().isInitialized()) return; + + MapProcessor mapProcessor = context.getMapProcessor(); + MapData mapData = mapProcessor.getLatestMapData(); + Rectangle featureRect = getFeatureRect().getRectangle(); + Gui.drawRect(0, 0, featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, backgroudColor)); + GlStateManager.color(1, 1, 1, 1); + GlStateManager.pushMatrix(); + if (mapData == null) { + Gui.drawRect(0, 0, featureRect.width, featureRect.height, 0xFFFF0000); + } else { + renderMap(partialTicks, mapProcessor, mapData, context); + } + GlStateManager.popMatrix(); + GL11.glLineWidth(2); + RenderUtils.drawUnfilledBox(0, 0, featureRect.width, featureRect.height, this.<AColor>getParameter("border_color").getValue()); + } + + @Override + public void drawDemo(float partialTicks) { + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); + if (DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon() && context != null && context.getMapProcessor().isInitialized() && on) { + drawHUD(partialTicks); + return; + } + Rectangle featureRect = getFeatureRect().getRectangle(); + Gui.drawRect(0, 0, featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, backgroudColor)); + FontRenderer fr = getFontRenderer(); + + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + fr.drawString("Please join a dungeon to see preview", featureRect.width / 2 - fr.getStringWidth("Please join a dungeon to see preview") / 2, featureRect.height / 2 - fr.FONT_HEIGHT / 2, 0xFFFFFFFF); + GL11.glLineWidth(2); + RenderUtils.drawUnfilledBox(0, 0, featureRect.width, featureRect.height, this.<AColor>getParameter("border_color").getValue()); + } + + public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context) { + EntityPlayer p = Minecraft.getMinecraft().thePlayer; + + float postScale = this.centerMapOnPlayer ? postscaleOfMap : 1; + + Rectangle featureRect = getFeatureRect().getRectangle(); + int width = featureRect.width; + + float scale = shouldScale ? width / 128.0f : 1; + + GlStateManager.translate(width / 2d, width / 2d, 0); + GlStateManager.scale(scale, scale, 0); + GlStateManager.scale(postScale, postScale, 0); + + Vector2d pt = mapProcessor.worldPointToMapPointFLOAT(p.getPositionEyes(partialTicks)); + double yaw = p.rotationYaw; + if (this.centerMapOnPlayer) { + if (this.shouldRotateWithPlayer) { + GlStateManager.rotate((float) (180.0 - yaw), 0, 0, 1); + } + GlStateManager.translate(-pt.x, -pt.y, 0); + } else { + GlStateManager.translate(-64, -64, 0); + } + + updateMapTexture(mapData.colors, mapProcessor, context.getDungeonRoomList()); + + render(); + + + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); + + if (this.showPlayerHeads) { + renderHeads(mapProcessor, mapData, scale, postScale, partialTicks); + } else { + renderArrows(mapData, scale, postScale); + } + + + FontRenderer fr = getFontRenderer(); + if (this.showSecretCount) { + for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { + GlStateManager.pushMatrix(); + + Point mapPt = mapProcessor.roomPointToMapPoint(dungeonRoom.getUnitPoints().get(0)); + GlStateManager.translate(mapPt.x + mapProcessor.getUnitRoomDimension().width / 2d, mapPt.y + mapProcessor.getUnitRoomDimension().height / 2d, 0); + + if (this.centerMapOnPlayer && this.shouldRotateWithPlayer) { + GlStateManager.rotate((float) (yaw - 180), 0, 0, 1); + } + GlStateManager.scale(1 / scale, 1 / scale, 0); + GlStateManager.scale(1 / postScale, 1 / postScale, 0); + GlStateManager.scale(textScale, textScale, 0); + String str = ""; + if (dungeonRoom.getTotalSecrets() == -1) { + str += "? "; + } else if (dungeonRoom.getTotalSecrets() != 0) { + str += dungeonRoom.getTotalSecrets() + " "; + } + + DungeonRoom.RoomState currentState = dungeonRoom.getCurrentState(); + switch (currentState) { + case FINISHED: + case COMPLETE_WITHOUT_SECRETS: + str += "✔"; + break; + case DISCOVERED: + str += "☐"; + break; + case FAILED: + str += "❌"; + break; + } + + + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + if (currentState == DungeonRoom.RoomState.FINISHED) { + fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xFF00FF00); + } else { + if (dungeonRoom.getColor() == 74) { + fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xff000000); + } else { + fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xFFFFFFFF); + } + } + + GlStateManager.popMatrix(); + } + } + + } + + + private final DynamicTexture mapTexture = new DynamicTexture(128, 128); + private final ResourceLocation generatedMapTexture = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("dungeonmap/map", mapTexture); + private final int[] mapTextureData = mapTexture.getTextureData(); + + private void updateMapTexture(byte[] colors, MapProcessor mapProcessor, List<DungeonRoom> dungeonRooms) { + + if(shouldCacheMap){ + if(!didMapChange(dungeonRooms)){ + return; + } + } + + + for (int i = 0; i < 16384; ++i) { + int j = colors[i] & 255; + + if (j / 4 == 0) { + this.mapTextureData[i] = 0x00000000; + } else { + this.mapTextureData[i] = MapColor.mapColorArray[j / 4].getMapColor(j & 3); + } + } + + if (this.showSecretCount) { + for (DungeonRoom dungeonRoom : dungeonRooms) { + for (Point pt : dungeonRoom.getUnitPoints()) { + for (int y1 = 0; y1 < mapProcessor.getUnitRoomDimension().height; y1++) { + for (int x1 = 0; x1 < mapProcessor.getUnitRoomDimension().width; x1++) { + int x = MathHelper.clamp_int(pt.x * (mapProcessor.getUnitRoomDimension().width + mapProcessor.getDoorDimensions().height) + x1 + mapProcessor.getTopLeftMapPoint().x, 0, 128); + int y = MathHelper.clamp_int(pt.y * (mapProcessor.getUnitRoomDimension().height + mapProcessor.getDoorDimensions().height) + y1 + mapProcessor.getTopLeftMapPoint().y, 0, 128); + int i = y * 128 + x; + int j = dungeonRoom.getColor(); + + if (j / 4 == 0) { + this.mapTextureData[i] = 0x00000000; + } else { + this.mapTextureData[i] = MapColor.mapColorArray[j / 4].getMapColor(j & 3); + } + } + } + } + } + } + + + this.mapTexture.updateDynamicTexture(); + } + + int[] lastRoomColors = new int[50]; + + int[] lastRoomSecrets = new int[50]; + + private boolean didMapChange(List<DungeonRoom> dungeonRooms) { + int[] currentRoomColors = new int[50]; + int[] currentRoomSecrets = new int[50]; + + for (int i = 0; i < dungeonRooms.size(); i++) { + DungeonRoom dungeonRoom = dungeonRooms.get(i); + + currentRoomSecrets[i] = dungeonRoom.getTotalSecrets(); + currentRoomColors[i] = dungeonRoom.getColor(); + + } + + for (int i = 0; i < 50; i++) { + if(lastRoomColors[i] != currentRoomColors[i] || lastRoomSecrets[i] != currentRoomSecrets[i]) { + lastRoomColors = currentRoomColors; + lastRoomSecrets = currentRoomSecrets; + return true; + } + } + + lastRoomColors = currentRoomColors; + lastRoomSecrets = currentRoomSecrets; + return false; + } + + @Nullable + public Tuple<String[], List<NetworkPlayerInfo>> loadPlayerList() { + String[] names = new String[21]; + + List<NetworkPlayerInfo> networkList = sorter.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); + if (networkList.size() < 40) return null; + + for (int i = 0; i < 20; i++) { + names[i] = TabListUtil.getPlayerNameWithChecks(networkList.get(i)); + } + + return new Tuple<>(names, networkList); + } + + long nextRefresh; + + Tuple<String[], List<NetworkPlayerInfo>> playerListCached; + + public Tuple<String[], List<NetworkPlayerInfo>> getPlayerListCached(){ + if(playerListCached == null || nextRefresh <= System.currentTimeMillis()){ + ChatTransmitter.sendDebugChat("Refreshing players on map"); + playerListCached = loadPlayerList(); + nextRefresh = System.currentTimeMillis() + 10000; + } + return playerListCached; + } + + + private void renderHeads(MapProcessor mapProcessor, MapData mapData, float scale, float postScale, float partialTicks) { + EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; + + Tuple<String[], List<NetworkPlayerInfo>> playerList = getPlayerListCached(); + + List<NetworkPlayerInfo> networkList = playerList.getSecond(); + String[] names = playerList.getFirst(); + + + + // 21 iterations bc we only want to scan the player part of tab list + for (int i = 1; i < 20; i++) { + NetworkPlayerInfo networkPlayerInfo = networkList.get(i); + + String name = names[i]; + if (name == null) continue; + + + EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(name); + + Vector2d pt2 = null; + double yaw2 = 0; + + if (entityplayer != null && (!entityplayer.isInvisible() || entityplayer == thePlayer)) { + // getting location from player entity + pt2 = mapProcessor.worldPointToMapPointFLOAT(entityplayer.getPositionEyes(partialTicks)); + yaw2 = entityplayer.prevRotationYawHead + (entityplayer.rotationYawHead - entityplayer.prevRotationYawHead) * partialTicks; + if(DungeonsGuide.getDungeonsGuide().verbose) System.out.println("Got player location from entity"); + } +// else { +// // getting player location from map +// String iconName = mapProcessor.getMapIconToPlayerMap().get(name); +// if (iconName != null) { +// Vec4b vec = mapData.mapDecorations.get(iconName); +// if (vec != null) { +// System.out.println("Got player location from map"); +// pt2 = new Vector2d(vec.func_176112_b() / 2d + 64, vec.func_176113_c() / 2d + 64); +// yaw2 = vec.func_176111_d() * 360 / 16.0f; +// } else { +// System.out.println("Failed getting location from map, vec is null"); +// } +// } else { +// System.out.println("Failed getting location from map, icon name is null"); +// } +// } + + if(pt2 == null) return; + + if (entityplayer == thePlayer || shouldShowOtherPlayers) { + drawHead(scale, postScale, networkPlayerInfo, entityplayer, pt2, (float) yaw2); + } + + } + } + + /** + * @param scale Scale of the map + * @param postScale + * @param networkPlayerInfo + * @param entityplayer + * @param pt2 + * @param yaw2 + */ + private void drawHead(float scale, float postScale, NetworkPlayerInfo networkPlayerInfo, EntityPlayer entityplayer, Vector2d pt2, float yaw2) { + GlStateManager.pushMatrix(); + boolean flag1 = entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.CAPE); + GlStateManager.enableTexture2D(); + Minecraft.getMinecraft().getTextureManager().bindTexture(networkPlayerInfo.getLocationSkin()); + int l2 = 8 + (flag1 ? 8 : 0); + int i3 = 8 * (flag1 ? -1 : 1); + + GlStateManager.translate(pt2.x, pt2.y, 0); + GlStateManager.rotate(yaw2, 0, 0, 1); + + GlStateManager.scale(1 / scale, 1 / scale, 0); + GlStateManager.scale(1 / postScale, 1 / postScale, 0); + + GlStateManager.scale(playerHeadScale, playerHeadScale, 0); + + // cutting out the player head out of the skin texture + Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, l2, 8, i3, 8, 8, 64.0F, 64.0F); + GL11.glLineWidth(1); + RenderUtils.drawUnfilledBox(-4, -4, 4, 4, this.playerColor); + GlStateManager.popMatrix(); + } + + + private static final ResourceLocation mapIcons = new ResourceLocation("textures/map/map_icons.png"); + + private void renderArrows(MapData mapData, float scale, float postScale) { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int k = 0; + Minecraft.getMinecraft().getTextureManager().bindTexture(mapIcons); + for (Vec4b vec4b : mapData.mapDecorations.values()) { + if (vec4b.func_176110_a() == 1 || this.shouldShowOtherPlayers) { + GlStateManager.pushMatrix(); + GlStateManager.translate(vec4b.func_176112_b() / 2.0F + 64.0F, vec4b.func_176113_c() / 2.0F + 64.0F, -0.02F); + GlStateManager.rotate((vec4b.func_176111_d() * 360) / 16.0F, 0.0F, 0.0F, 1.0F); + + GlStateManager.scale(1 / scale, 1 / scale, 0); + GlStateManager.scale(1 / postScale, 1 / postScale, 0); + GlStateManager.scale(this.playerHeadScale * 5, this.playerHeadScale * 5, 0); + + GlStateManager.translate(-0.125F, 0.125F, 0.0F); + byte b0 = vec4b.func_176110_a(); + float f1 = (b0 % 4) / 4.0F; + float f2 = (b0 / 4f) / 4.0F; + float f3 = (b0 % 4 + 1) / 4.0F; + float f4 = (b0 / 4f + 1) / 4.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(-1.0D, 1.0D, k * -0.001F).tex(f1, f2).endVertex(); + worldrenderer.pos(1.0D, 1.0D, k * -0.001F).tex(f3, f2).endVertex(); + worldrenderer.pos(1.0D, -1.0D, k * -0.001F).tex(f3, f4).endVertex(); + worldrenderer.pos(-1.0D, -1.0D, k * -0.001F).tex(f1, f4).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + ++k; + } + } + } + + private void render() { + int i = 0; + int j = 0; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + float f = 0.0F; + Minecraft.getMinecraft().getTextureManager().bindTexture(this.generatedMapTexture); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); + GlStateManager.disableAlpha(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((i) + f, (j + 128) - f, -0.009999999776482582D).tex(0.0D, 1.0D).endVertex(); + worldrenderer.pos((i + 128) - f, (j + 128) - f, -0.009999999776482582D).tex(1.0D, 1.0D).endVertex(); + worldrenderer.pos((i + 128) - f, (j) + f, -0.009999999776482582D).tex(1.0D, 0.0D).endVertex(); + worldrenderer.pos((i) + f, (j) + f, -0.009999999776482582D).tex(0.0D, 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.enableAlpha(); + GlStateManager.disableBlend(); + + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, -0.04F); + GlStateManager.scale(1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMilestone.java index 5fe72cc9..68c11234 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonMilestone.java @@ -16,18 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.scoreboard.ScorePlayerTeam; @@ -41,7 +40,7 @@ import java.util.regex.Pattern; public class FeatureDungeonMilestone extends TextHUDFeature implements ChatListener { public FeatureDungeonMilestone() { - super("Dungeon.Dungeon Information", "Display Current Class Milestone", "Display current class milestone of yourself", "dungeon.stats.milestone", true, getFontRenderer().getStringWidth("Milestone: 12"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.HUDs", "Display Current Class Milestone", "Display current class milestone of yourself", "dungeon.stats.milestone", true, getFontRenderer().getStringWidth("Milestone: 12"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); @@ -95,7 +94,7 @@ public class FeatureDungeonMilestone extends TextHUDFeature implements ChatListe public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.type == 2) return; if (!skyblockStatus.isOnDungeon()) return; - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (context == null) return; String txt = clientChatReceivedEvent.message.getFormattedText(); if (milestone_pattern.matcher(txt).matches()) { @@ -103,7 +102,7 @@ public class FeatureDungeonMilestone extends TextHUDFeature implements ChatListe TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()), TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()) }); - DungeonsGuide.sendDebugChat(new ChatComponentText("Reached Milestone At " + TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + " / "+TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()))); + ChatTransmitter.sendDebugChat(new ChatComponentText("Reached Milestone At " + TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + " / "+TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()))); } } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRealTime.java index 88bfe8fe..460e92aa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRealTime.java @@ -16,15 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import java.util.ArrayList; import java.util.Arrays; @@ -32,7 +29,7 @@ import java.util.List; public class FeatureDungeonRealTime extends TextHUDFeature implements DungeonStartListener, DungeonQuitListener { public FeatureDungeonRealTime() { - super("Dungeon.Dungeon Information", "Display Real Time-Dungeon Time", "Display how much real time has passed since dungeon run started", "dungeon.stats.realtime", true, getFontRenderer().getStringWidth("Time(Real): 59m 59s"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.HUDs", "Display Real Time-Dungeon Time", "Display how much real time has passed since dungeon run started", "dungeon.stats.realtime", true, getFontRenderer().getStringWidth("Time(Real): 59m 59s"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("discriminator", new AColor(0xAA,0xAA,0xAA,255), new AColor(0, 0,0,0), false)); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRoomName.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRoomName.java index 512ec964..1ae490aa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRoomName.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonRoomName.java @@ -16,16 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -36,7 +36,7 @@ import java.util.List; public class FeatureDungeonRoomName extends TextHUDFeature { public FeatureDungeonRoomName() { - super("Dungeon.Dungeon Information", "Display name of the room you are in", "Display name of the room you are in", "dungeon.roomname", false, getFontRenderer().getStringWidth("You're in puzzle-tictactoe"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.HUDs", "Display name of the room you are in", "Display name of the room you are in", "dungeon.roomname", false, getFontRenderer().getStringWidth("You're in puzzle-tictactoe"), getFontRenderer().FONT_HEIGHT); getStyles().add(new TextStyle("in", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("roomname", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); } @@ -44,7 +44,7 @@ public class FeatureDungeonRoomName extends TextHUDFeature { SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); public int getTotalSecretsInt() { - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); int totalSecrets = 0; for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { if (dungeonRoom.getTotalSecrets() != -1) @@ -61,7 +61,7 @@ public class FeatureDungeonRoomName extends TextHUDFeature { @Override public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getMapProcessor() != null; + return skyblockStatus.isOnDungeon() && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() != null && DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getMapProcessor() != null; } @Override @@ -78,8 +78,8 @@ public class FeatureDungeonRoomName extends TextHUDFeature { public List<StyledText> getText() { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - Point roomPt = skyblockStatus.getContext().getMapProcessor().worldPointToRoomPoint(player.getPosition()); - DungeonRoom dungeonRoom = skyblockStatus.getContext().getRoomMapper().get(roomPt); + Point roomPt = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getMapProcessor().worldPointToRoomPoint(player.getPosition()); + DungeonRoom dungeonRoom = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getRoomMapper().get(roomPt); List<StyledText> actualBit = new ArrayList<StyledText>(); actualBit.add(new StyledText("You're in ","in")); if (dungeonRoom == null) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSBTime.java index 00928806..dfe67f9e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSBTime.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; @@ -41,7 +41,7 @@ public class FeatureDungeonSBTime extends TextHUDFeature { private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); public FeatureDungeonSBTime() { - super("Dungeon.Dungeon Information", "Display Ingame Dungeon Time", "Display how much time skyblock thinks has passed since dungeon run started", "dungeon.stats.igtime", true, getFontRenderer().getStringWidth("Time(IG): 1h 59m 59s"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.HUDs", "Display Ingame Dungeon Time", "Display how much time skyblock thinks has passed since dungeon run started", "dungeon.stats.igtime", true, getFontRenderer().getStringWidth("Time(IG): 1h 59m 59s"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("discriminator", new AColor(0xAA,0xAA,0xAA,255), new AColor(0, 0,0,0), false)); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonScore.java index b62df644..1cdd8d0e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonScore.java @@ -16,22 +16,20 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.TimeScoreUtil; -import kr.syeyoung.dungeonsguide.wsresource.StaticResource; -import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.wsresource.StaticResource; +import kr.syeyoung.dungeonsguide.mod.wsresource.StaticResourceCache; + import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.client.Minecraft; @@ -47,9 +45,9 @@ import java.util.concurrent.ExecutionException; public class FeatureDungeonScore extends TextHUDFeature { public FeatureDungeonScore() { - super("Dungeon.Dungeon Information", "Display Current Score", "Calculate and Display current score\nThis data is from pure calculation and can be different from actual score.", "dungeon.stats.score", false, 200, getFontRenderer().FONT_HEIGHT * 4); + super("Dungeon.HUDs", "Display Current Score", "Calculate and Display current score\nThis data is from pure calculation and can be different from actual score.", "dungeon.stats.score", false, 200, getFontRenderer().FONT_HEIGHT * 4); this.setEnabled(false); - parameters.put("verbose", new FeatureParameter<Boolean>("verbose", "Show each score instead of sum", "Skill: 100 Explore: 58 S->S+(5 tombs) instead of Score: 305", true, "boolean")); + addParameter("verbose", new FeatureParameter<Boolean>("verbose", "Show each score instead of sum", "Skill: 100 Explore: 58 S->S+(5 tombs) instead of Score: 305", true, "boolean")); getStyles().add(new TextStyle("scorename", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); @@ -175,9 +173,6 @@ public class FeatureDungeonScore extends TextHUDFeature { private int deaths; } - public int getPercentage() { - return skyblockStatus.getPercentage(); - } public int getCompleteRooms() { for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); @@ -191,7 +186,7 @@ public class FeatureDungeonScore extends TextHUDFeature { public int getTotalRooms() { int compRooms = getCompleteRooms(); if (compRooms == 0) return 100; - return (int) (100 * (compRooms / (double)getPercentage())); + return (int) (100 * (compRooms / (double) DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getPercentage())); } public int getUndiscoveredPuzzles() { int cnt = 0; @@ -206,7 +201,7 @@ public class FeatureDungeonScore extends TextHUDFeature { public ScoreCalculation calculateScore() { if (!skyblockStatus.isOnDungeon()) return null; - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (context == null) return null; if (!context.getMapProcessor().isInitialized()) return null; @@ -266,7 +261,7 @@ public class FeatureDungeonScore extends TextHUDFeature { totalSecretsKnown = FeatureRegistry.DUNGEON_SECRETS.sureOfTotalSecrets(); fullyCleared = completed >= getTotalRooms() && context.getMapProcessor().getUndiscoveredRoom() == 0; - explorer += MathHelper.clamp_int((int) Math.floor(6.0 / 10.0 * (context.getMapProcessor().getUndiscoveredRoom() != 0 ? getPercentage() : completed / total * 100)), 0, 60); + explorer += MathHelper.clamp_int((int) Math.floor(6.0 / 10.0 * (context.getMapProcessor().getUndiscoveredRoom() != 0 ? DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getPercentage() : completed / total * 100)), 0, 60); explorer += MathHelper.clamp_int((int) Math.floor(40 * (secrets = FeatureRegistry.DUNGEON_SECRETS.getSecretsFound()) / Math.ceil(totalSecrets * context.getSecretPercentage())),0,40); } int time = 0; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSecrets.java index 11de62a3..2e53e6f1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonSecrets.java @@ -16,17 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; + import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.scoreboard.ScorePlayerTeam; @@ -37,7 +36,7 @@ import java.util.List; public class FeatureDungeonSecrets extends TextHUDFeature { public FeatureDungeonSecrets() { - super("Dungeon.Dungeon Information", "Display Total # of Secrets", "Display how much total secrets have been found in a dungeon run.\n+ sign means DG does not know the correct number, but it's somewhere above that number.", "dungeon.stats.secrets", true, getFontRenderer().getStringWidth("Secrets: 999/999+ of 999+"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.HUDs", "Display Total # of Secrets", "Display how much total secrets have been found in a dungeon run.\n+ sign means DG does not know the correct number, but it's somewhere above that number.", "dungeon.stats.secrets", true, getFontRenderer().getStringWidth("Secrets: 999/999+ of 999+"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); @@ -71,7 +70,7 @@ public class FeatureDungeonSecrets extends TextHUDFeature { public int getTotalSecretsInt() { if (getSecretsFound() != 0) return (int) Math.ceil (getSecretsFound() / getSecretPercentage() * 100); - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); int totalSecrets = 0; for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { if (dungeonRoom.getTotalSecrets() != -1) @@ -81,7 +80,7 @@ public class FeatureDungeonSecrets extends TextHUDFeature { } public boolean sureOfTotalSecrets() { if (getSecretsFound() != 0) return true; - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (context.getMapProcessor().getUndiscoveredRoom() > 0) return false; boolean allknown = true; for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { @@ -91,7 +90,7 @@ public class FeatureDungeonSecrets extends TextHUDFeature { } public String getTotalSecrets() { - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (context == null) return "?"; int totalSecrets = 0; boolean allknown = true; @@ -136,7 +135,8 @@ public class FeatureDungeonSecrets extends TextHUDFeature { actualBit.add(new StyledText(": ","separator")); actualBit.add(new StyledText(getSecretsFound() +"","currentSecrets")); actualBit.add(new StyledText("/","separator2")); - actualBit.add(new StyledText((int)Math.ceil(getTotalSecretsInt() * DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getSecretPercentage())+" of "+getTotalSecretsInt(),"totalSecrets")); + + actualBit.add(new StyledText((int)Math.ceil(getTotalSecretsInt() * DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getSecretPercentage())+" of "+getTotalSecretsInt(),"totalSecrets")); actualBit.add(new StyledText(getTotalSecrets().contains("+") ? "+" : "","unknown")); return actualBit; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonTombs.java index 59c669bf..bc28b098 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureDungeonTombs.java @@ -16,15 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.scoreboard.ScorePlayerTeam; @@ -35,7 +34,7 @@ import java.util.List; public class FeatureDungeonTombs extends TextHUDFeature { public FeatureDungeonTombs() { - super("Dungeon.Dungeon Information", "Display # of Crypts", "Display how much total crypts have been blown up in a dungeon run", "dungeon.stats.tombs", true, getFontRenderer().getStringWidth("Crypts: 42"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.HUDs", "Display # of Crypts", "Display how much total crypts have been blown up in a dungeon run", "dungeon.stats.tombs", true, getFontRenderer().getStringWidth("Crypts: 42"), getFontRenderer().FONT_HEIGHT); this.setEnabled(false); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureHideNameTags.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureHideNameTags.java index b8985a78..3420581a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureHideNameTags.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureHideNameTags.java @@ -16,12 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.EntityLivingRenderListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.EntityLivingRenderListener; import net.minecraft.entity.item.EntityArmorStand; import net.minecraftforge.client.event.RenderLivingEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePlayerESP.java index 273a9bca..8f884547 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePlayerESP.java @@ -16,13 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.PlayerRenderListener; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.PlayerRenderListener; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; @@ -50,7 +52,7 @@ public class FeaturePlayerESP extends SimpleFeature implements PlayerRenderListe if (!isEnabled()) return; - DungeonContext dungeonContext = skyblockStatus.getContext(); + DungeonContext dungeonContext = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (dungeonContext == null) return; if (!dungeonContext.getPlayers().contains(renderPlayerEvent.entityPlayer.getName())) { return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java index ffff3a08..fd26085c 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java @@ -16,14 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.features.listener.KeyInputListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureChestPrice; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.impl.boss.FeatureChestPrice; + +import kr.syeyoung.dungeonsguide.mod.features.listener.GuiClickListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.KeyInputListener; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiChest; @@ -35,7 +37,7 @@ import org.lwjgl.input.Mouse; public class FeaturePressAnyKeyToCloseChest extends SimpleFeature implements KeyInputListener, GuiClickListener { public FeaturePressAnyKeyToCloseChest() { super("Dungeon", "Press Any Mouse Button or Key to close Secret Chest", "dungeon.presskeytoclose"); - parameters.put("threshold", new FeatureParameter<Integer>("threshold", "Price Threshold", "The maximum price of item for chest to be closed. Default 1m", 1000000, "integer")); + addParameter("threshold", new FeatureParameter<Integer>("threshold", "Price Threshold", "The maximum price of item for chest to be closed. Default 1m", 1000000, "integer")); } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java index 15f02e86..2466643a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWarnLowHealth.java @@ -16,16 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; + import net.minecraft.client.Minecraft; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; @@ -40,7 +39,7 @@ import java.util.List; public class FeatureWarnLowHealth extends TextHUDFeature { public FeatureWarnLowHealth() { super("Dungeon.Teammates", "Low Health Warning", "Warn if someone is on low health", "dungeon.lowhealthwarn", false, 500, 20); - parameters.put("threshold", new FeatureParameter<Integer>("threshold", "Health Threshold", "Health Threshold for this feature to be toggled. default to 500", 500, "integer")); + addParameter("threshold", new FeatureParameter<Integer>("threshold", "Health Threshold", "Health Threshold for this feature to be toggled. default to 500", 500, "integer")); getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("number", new AColor(0xFF, 0x55,0x55,255), new AColor(0, 0,0,0), false)); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWatcherWarning.java index bc48d51f..ba49886b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeatureWatcherWarning.java @@ -16,18 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.dungeon; +package kr.syeyoung.dungeonsguide.mod.features.impl.dungeon; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import net.minecraftforge.client.event.ClientChatReceivedEvent; import java.util.ArrayList; @@ -71,7 +69,7 @@ public class FeatureWatcherWarning extends TextHUDFeature implements ChatListene public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.message.getFormattedText().equals("§r§c[BOSS] The Watcher§r§f: That will be enough for now.§r")) { warning = System.currentTimeMillis() + 2500; - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); if (context ==null) return; for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { if (dungeonRoom != null && dungeonRoom.getColor() == 18) diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureAutoAcceptReparty.java index 7be4b22b..6fe5a5a6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureAutoAcceptReparty.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.etc; +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.chat.ChatProcessor; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; import net.minecraftforge.client.event.ClientChatReceivedEvent; public class FeatureAutoAcceptReparty extends SimpleFeature implements ChatListener { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCooldownCounter.java index 5499353a..e7712d3f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCooldownCounter.java @@ -16,14 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.etc; +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiOpenListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.listener.DungeonQuitListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.GuiOpenListener; +import kr.syeyoung.dungeonsguide.mod.features.text.StyledText; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.features.text.TextStyle; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.inventory.ContainerChest; import net.minecraftforge.client.event.GuiOpenEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCopyMessages.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCopyMessages.java index d2b23e48..b3270543 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCopyMessages.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureCopyMessages.java @@ -16,11 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.etc; +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.event.ClickEvent; import net.minecraft.event.HoverEvent; import net.minecraft.util.ChatComponentText; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDecreaseExplosionSound.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDecreaseExplosionSound.java index 2786ca53..e4c1c3c1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDecreaseExplosionSound.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDecreaseExplosionSound.java @@ -16,27 +16,26 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.etc; +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.SoundListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.SoundListener; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraftforge.client.event.sound.PlaySoundEvent; public class FeatureDecreaseExplosionSound extends SimpleFeature implements SoundListener { public FeatureDecreaseExplosionSound() { super("Misc", "Decrease Explosion sound effect", "Decreases volume of explosions while on skyblock", "qol.explosionsound"); - parameters.put("sound", new FeatureParameter<Float>("sound", "Sound Multiplier %", "The volume of explosion effect will be multiplied by this value. 0~100", 10.0f, "float")); + addParameter("sound", new FeatureParameter<Float>("sound", "Sound Multiplier %", "The volume of explosion effect will be multiplied by this value. 0~100", 10.0f, "float")); } - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override public void onSound(PlaySoundEvent soundEvent) { - if (!skyblockStatus.isOnSkyblock()) return; + if (!SkyblockStatus.isOnSkyblock()) return; if (soundEvent.name.equalsIgnoreCase("random.explode") && soundEvent.result instanceof PositionedSoundRecord) { PositionedSoundRecord positionedSoundRecord = (PositionedSoundRecord) soundEvent.result; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDisableMessage.java index 0e65f849..22785ae9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureDisableMessage.java @@ -16,13 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.etc; +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListener; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -57,17 +58,16 @@ public class FeatureDisableMessage extends SimpleFeature implements ChatListener public FeatureDisableMessage() { super("Misc.Chat", "Disable ability messages", "Do not let ability messages show up in chatbox\nclick on Edit for more precise settings", "fixes.messagedisable", true); for (MessageData messageData : PRE_DEFINED) { - this.parameters.put(messageData.key, new FeatureParameter<Boolean>(messageData.key, messageData.name, messageData.description, true, "boolean")); + addParameter(messageData.key, new FeatureParameter<Boolean>(messageData.key, messageData.name, messageData.description, true, "boolean")); } } - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { if (clientChatReceivedEvent.type == 2) return; if (!isEnabled()) return; - if (!skyblockStatus.isOnSkyblock()) return; + if (!SkyblockStatus.isOnSkyblock()) return; String msg = clientChatReceivedEvent.message.getFormattedText(); for (MessageData md:PRE_DEFINED) { if (this.<Boolean>getParameter(md.key).getValue() && md.pattern.matcher(msg).matches()) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java new file mode 100644 index 00000000..f88b2884 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java @@ -0,0 +1,156 @@ +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessResult; +import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.utils.ScoreBoardUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TitleRender; +import net.minecraft.client.Minecraft; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.Map; +import java.util.Objects; + +import static kr.syeyoung.dungeonsguide.mod.chat.ChatProcessResult.NONE; +import static kr.syeyoung.dungeonsguide.mod.chat.ChatProcessResult.REMOVE_CHAT; + +/** + * CREDITS FOR THE COUNTDOWN SOUNDTRACK: <a href="https://www.youtube.com/watch?v=acCqrA-JxAw">...</a> + */ +public class FeatureEpicCountdown extends SimpleFeature { + + static volatile long updatedAt; + static volatile int secondsLeft; + private static boolean cleanChat; + private boolean sfxenabled; + + int actualSecondsLeft; + + public FeatureEpicCountdown() { + super("Dungeon.HUDs", "Epic Dungeon Start Countdown", "Shows a cool dungeon start instead of the chat messages", "etc.dungeoncountdown", true); + addParameter("cleanchat", new FeatureParameter<>("cleanchat", "Clean Dungeon Chat", "^^^", true, "boolean", nval -> cleanChat = nval)); + addParameter("sounds", new FeatureParameter<>("sounds", "Countdown SFX", "^^^", true, "boolean", nval -> sfxenabled = nval)); + + lastSec = GO_TEXT; + + ChatProcessor.INSTANCE.subscribe(FeatureEpicCountdown::processChat); + MinecraftForge.EVENT_BUS.register(this); + } + + public static ChatProcessResult processChat(String txt, Map<String, Object> context) { + if(cleanChat){ + if(txt.startsWith("§e[NPC] §bMort§f: §rTalk to me to change your class and ready up.§r")){ + return REMOVE_CHAT; + } + if(txt.startsWith("§r§aYour active Potion Effects have been paused and stored.")){ + return REMOVE_CHAT; + } + if(txt.startsWith("§e[NPC] §bMort§f: §rGood luck.§r")){ + return REMOVE_CHAT; + } + if(txt.startsWith("§e[NPC] §bMort§f: §rYou should find it useful if you get lost.§r")){ + return REMOVE_CHAT; + } + if(TextUtils.stripColor(txt).contains("[NPC] Mort: Here, I found this map")){ + return REMOVE_CHAT; + } + if(txt.startsWith("§r§a[Berserk] §r§f")){ + return REMOVE_CHAT; + } + } + + + if (txt.startsWith("§r§aDungeon starts in")) { + String striped = TextUtils.stripColor(txt); + + String secondsStr = striped.replace("Dungeon starts in ", ""); + secondsStr = secondsStr.replace(" seconds.", ""); + secondsStr = secondsStr.replace(" second.", ""); + + secondsLeft = Integer.parseInt(secondsStr); + updatedAt = System.currentTimeMillis(); + + return REMOVE_CHAT; + } + + return NONE; + + } + + static final String GO_TEXT = "GO!!!"; + String lastSec; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent e){ + if(e.phase != TickEvent.Phase.START || !isEnabled() || !DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; + + + ScoreBoardUtils.forEachLineClean(line -> { + if(line.contains("Starting in:")){ + String time = line.replace("Starting in: ", "").replace("§r", "").replace("0:", ""); + if(!time.isEmpty()){ + secondsLeft = Integer.parseInt(time); + updatedAt = System.currentTimeMillis(); + } + } + }); + + +// www.hypixel.net§r +// §r +// Starting in: 0:57§r +// §r +// B kokoniara Lv25§r +// §r +// The Catacombs F3§r +// Late Winter 3rd§r +// §r +// 10/22/22 m65G 28266§r + + } + + + @SubscribeEvent + public void onRender(RenderGameOverlayEvent.Post postRender) { + if (!isEnabled()) return; + if (!(postRender.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || postRender.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) + return; + + long timepassed = System.currentTimeMillis() - updatedAt; + + long secs = timepassed / 1000; + + int actualSecondspassed = (int) secs; + actualSecondsLeft = secondsLeft - actualSecondspassed; + if (actualSecondsLeft <= 0) { + if(!Objects.equals(lastSec, GO_TEXT)){ + lastSec = GO_TEXT; + TitleRender.displayTitle(lastSec, "", 2, 25, 15); + } + return; + } + + String string = "§c" + actualSecondsLeft; + + if(!Objects.equals(string, lastSec)){ + if(actualSecondsLeft == 3 && sfxenabled){ + Minecraft.getMinecraft().thePlayer.playSound("skyblock_dungeons_guide:readysetgo", 1F, 1F); + } + if(actualSecondsLeft > 5){ + TitleRender.displayTitle(string, "", 1, 10, 8); + }else{ + TitleRender.displayTitle(string, "", 1, 6, 4); + } + lastSec = string; + } + + } + + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeaturePenguins.java index ce65a273..53a5b600 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeaturePenguins.java @@ -16,14 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.etc; +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; import com.google.common.collect.ImmutableMap; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.PlayerRenderListener; -import kr.syeyoung.dungeonsguide.features.listener.TextureStichListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.PlayerRenderListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.TextureStichListener; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureRepartyCommand.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureRepartyCommand.java new file mode 100644 index 00000000..0392d663 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureRepartyCommand.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; + +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; + +public class FeatureRepartyCommand extends SimpleFeature { + public FeatureRepartyCommand() { + super("Party.Reparty", "Enable Reparty Command From DG", "if you disable, /dg reparty will still work, Auto reparty will still work\nRequires Restart to get applied", "qol.reparty"); + addParameter("command", new FeatureParameter<String>("command", "The Command", "Command that the reparty will be bound to", "reparty", "string")); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipDungeonStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipDungeonStat.java index 533400aa..0835e3ec 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipDungeonStat.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipDungeonStat.java @@ -16,10 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.etc; +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; -import kr.syeyoung.dungeonsguide.features.listener.TooltipListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; + + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.TooltipListener; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.event.entity.player.ItemTooltipEvent; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipPrice.java index aaf4c01b..a0821dae 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureTooltipPrice.java @@ -16,13 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.etc; +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; -import kr.syeyoung.dungeonsguide.features.listener.TooltipListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.AhUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; + +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.TooltipListener; +import kr.syeyoung.dungeonsguide.mod.utils.AhUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.event.entity.player.ItemTooltipEvent; @@ -35,7 +37,7 @@ import java.util.TreeSet; public class FeatureTooltipPrice extends SimpleFeature implements TooltipListener { public FeatureTooltipPrice() { super("Misc.API Features", "Item Price", "Shows price of items", "tooltip.price"); - parameters.put("reqShift", new FeatureParameter<Boolean>("reqShift", "Require Shift", "If shift needs to be pressed in order for this feature to be activated", false, "boolean")); + addParameter("reqShift", new FeatureParameter<Boolean>("reqShift", "Require Shift", "If shift needs to be pressed in order for this feature to be activated", false, "boolean")); setEnabled(false); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureUpdateAlarm.java index eec4b40b..6056b845 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureUpdateAlarm.java @@ -16,34 +16,25 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.features.listener.StompConnectedListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.stomp.StompInterface; -import kr.syeyoung.dungeonsguide.stomp.StompMessageHandler; -import kr.syeyoung.dungeonsguide.stomp.StompPayload; -import kr.syeyoung.dungeonsguide.stomp.StompSubscription; +package kr.syeyoung.dungeonsguide.mod.features.impl.etc; + + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; import net.minecraft.client.Minecraft; import net.minecraft.util.ChatComponentText; -public class FeatureUpdateAlarm extends SimpleFeature implements StompConnectedListener, StompMessageHandler, TickListener { +public class FeatureUpdateAlarm extends SimpleFeature implements StompConnectedListener, TickListener { public FeatureUpdateAlarm() { super("Misc", "Update Alarm","Show a warning in chat when a version has been released.", "etc.updatealarm", true); } - private StompPayload stompPayload; - @Override - public void handle(StompInterface stompInterface, StompPayload stompPayload) { - this.stompPayload = stompPayload; - } - + private String stompPayload; @Override public void onTick() { if (stompPayload != null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(stompPayload.payload())); + ChatTransmitter.addToQueue(new ChatComponentText(stompPayload)); stompPayload = null; Minecraft.getMinecraft().thePlayer.playSound("random.successful_hit", 1f,1f); } @@ -51,13 +42,14 @@ public class FeatureUpdateAlarm extends SimpleFeature implements StompConnectedL @Override public void onStompConnected(StompConnectedEvent event) { - event.getStompInterface().subscribe(StompSubscription.builder() - .destination("/topic/updates") - .ackMode(StompSubscription.AckMode.AUTO) - .stompMessageHandler(this).build()); - event.getStompInterface().subscribe(StompSubscription.builder() - .destination("/user/queue/messages") - .ackMode(StompSubscription.AckMode.AUTO) - .stompMessageHandler(this).build()); + + event.getStompInterface().subscribe("/topic/updates", (stompClient ,payload) -> { + this.stompPayload = payload; + }); + + event.getStompInterface().subscribe("/user/queue/messages", (stompClient ,payload) -> { + this.stompPayload = payload; + }); + } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/FeatureAbilityCooldown.java index 667b1cd4..3fd22912 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/FeatureAbilityCooldown.java @@ -16,18 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.etc.ability; +package kr.syeyoung.dungeonsguide.mod.features.impl.etc.ability; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.item.ItemStack; @@ -40,7 +36,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class FeatureAbilityCooldown extends TextHUDFeature implements ChatListener, TickListener { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); public FeatureAbilityCooldown() { super("Misc", "View Ability Cooldowns", "A handy hud for viewing cooldown abilities", "etc.abilitycd2", false, 100, getFontRenderer().FONT_HEIGHT * 5); @@ -49,13 +44,13 @@ public class FeatureAbilityCooldown extends TextHUDFeature implements ChatListen getStyles().add(new TextStyle("number", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("unit",new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("ready",new AColor(0xDF, 0x00,0x67,255), new AColor(0, 0,0,0), false)); - this.parameters.put("disable", new FeatureParameter<Boolean>("disable", "Disable outside of dungeon", "Disable the feature when out of dungeon", false, "boolean")); - this.parameters.put("decimal", new FeatureParameter<Integer>("decimal", "Decimal places", "ex) 2 -> Cooldown: 3.21 3-> Cooldown: 3.210", 0, "integer")); + addParameter("disable", new FeatureParameter<Boolean>("disable", "Disable outside of dungeon", "Disable the feature when out of dungeon", false, "boolean")); + addParameter("decimal", new FeatureParameter<Integer>("decimal", "Decimal places", "ex) 2 -> Cooldown: 3.21 3-> Cooldown: 3.210", 0, "integer")); } @Override public boolean isHUDViewable() { - return skyblockStatus.isOnSkyblock() && (!this.<Boolean>getParameter("disable").getValue() || (this.<Boolean>getParameter("disable").getValue() && skyblockStatus.isOnDungeon())); + return SkyblockStatus.isOnSkyblock() && (!this.<Boolean>getParameter("disable").getValue() || (this.<Boolean>getParameter("disable").getValue() && SkyblockStatus.isOnSkyblock())); } @Override @@ -209,6 +204,8 @@ public class FeatureAbilityCooldown extends TextHUDFeature implements ChatListen register(new SkyblockAbility("Rejuvenate", -1, -1, "VAMPIRE_WITCH_MASK")); register(new SkyblockAbility("Terrain Toss", 250, 1, "YETI_SWORD")); register(new SkyblockAbility("Instant Transmission", 50, -1, "ASPECT_OF_THE_END")); + register(new SkyblockAbility("Ether Transmission", 180, -1, "ASPECT_OF_THE_END")); + register(new SkyblockAbility("Ether Transmission", 180, -1, "ASPECT_OF_THE_VOID")); register(new SkyblockAbility("Detonate", -1, 60, "CREEPER_LEGGINGS")); register(new SkyblockAbility("Extreme Focus", -1, -1, "END_STONE_SWORD")); register(new SkyblockAbility("Leap", 50, 1, "LEAPING_SWORD")); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/SkyblockAbility.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/SkyblockAbility.java new file mode 100644 index 00000000..95dd76a6 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/SkyblockAbility.java @@ -0,0 +1,32 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.etc.ability; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class SkyblockAbility { + private String name; + private int manaCost; + private int cooldown; + + private String itemId; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/UsedAbility.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/UsedAbility.java new file mode 100644 index 00000000..c25d8fd9 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/ability/UsedAbility.java @@ -0,0 +1,31 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.etc.ability; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@AllArgsConstructor +public class UsedAbility { + private SkyblockAbility ability; + @EqualsAndHashCode.Exclude + private long cooldownEnd; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/APIKey.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/APIKey.java index 829010dc..7f9153e1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/APIKey.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/APIKey.java @@ -16,13 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party; +package kr.syeyoung.dungeonsguide.mod.features.impl.party; -import kr.syeyoung.dungeonsguide.features.listener.ChatListenerGlobal; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.ChatListenerGlobal; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -30,7 +32,7 @@ public class APIKey extends SimpleFeature implements ChatListenerGlobal { public APIKey() { super("Misc.API Features", "API KEY", "Sets api key","partykicker.apikey"); - parameters.put("apikey", new FeatureParameter<String>("apikey", "API Key", "API key", "","string")); + addParameter("apikey", new FeatureParameter<String>("apikey", "API Key", "API key", "","string")); } public String getAPIKey() { @@ -44,7 +46,7 @@ public class APIKey extends SimpleFeature implements ChatListenerGlobal { String str = clientChatReceivedEvent.message.getFormattedText(); if (str.startsWith("§aYour new API key is §r§b")) { String apiKeys = TextUtils.stripColor(str.split(" ")[5]); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fAutomatically Configured Hypixel API Key")); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §fAutomatically Configured Hypixel API Key")); this.<String>getParameter("apikey").setValue(apiKeys); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeatureGoodParties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java index dbdcdd3f..7c3a6832 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeatureGoodParties.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java @@ -16,11 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party; +package kr.syeyoung.dungeonsguide.mod.features.impl.party; + + -import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyList.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyList.java index 55ea699c..af4cec63 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyList.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyList.java @@ -16,14 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party; +package kr.syeyoung.dungeonsguide.mod.features.impl.party; + + +import kr.syeyoung.dungeonsguide.mod.party.PartyContext; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.chat.PartyContext; -import kr.syeyoung.dungeonsguide.chat.PartyManager; import java.util.ArrayList; import java.util.Arrays; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyReady.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyReady.java index f7d16167..3211a1f1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyReady.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeaturePartyReady.java @@ -16,18 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.chat.PartyContext; -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.party; + + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.party.PartyContext; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; + import net.minecraftforge.client.event.ClientChatReceivedEvent; import java.util.*; @@ -45,7 +42,7 @@ public class FeaturePartyReady extends TextHUDFeature implements ChatListener, D @Override public boolean isHUDViewable() { - return PartyManager.INSTANCE.getPartyContext() != null && PartyManager.INSTANCE.getPartyContext().isPartyExistHypixel() && "Dungeon Hub".equals(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); + return PartyManager.INSTANCE.getPartyContext() != null && PartyManager.INSTANCE.getPartyContext().isPartyExistHypixel() && "Dungeon Hub".equals(DungeonContext.getDungeonName()); } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/CachedData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/api/CachedData.java index 9213e2e5..5fcfc73e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/CachedData.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/api/CachedData.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.api; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.api; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ClassSpecificData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/api/ClassSpecificData.java index d1df192b..dde851e7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ClassSpecificData.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/api/ClassSpecificData.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.api; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.api; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Pet.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/api/Pet.java index 99004cc1..7a3b62f8 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Pet.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/api/Pet.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.api; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.api; import lombok.Data; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/FeatureCustomPartyFinder.java index 98605169..e09ccdc9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/FeatureCustomPartyFinder.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.customgui; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.customgui; -import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.GuiOpenListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiUpdateListener; -import kr.syeyoung.dungeonsguide.features.listener.*; + + +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.GuiOpenListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.GuiUpdateListener; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/GuiCustomPartyFinder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/GuiCustomPartyFinder.java index a42b946f..d6ab22b9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/GuiCustomPartyFinder.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/GuiCustomPartyFinder.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.customgui; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.customgui; -import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent; -import kr.syeyoung.dungeonsguide.gui.MGui; +import kr.syeyoung.dungeonsguide.mod.events.impl.WindowUpdateEvent; +import kr.syeyoung.dungeonsguide.mod.gui.MGui; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/PanelPartyFinder.java index 7a07ba2e..d0bf90e7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/PanelPartyFinder.java @@ -16,18 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.customgui; - -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfigV2; -import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.impl.discord.invteTooltip.MTooltipInvite; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.rpc.RichPresenceManager; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.customgui; + + +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.GuiConfigV2; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.discord.invteTooltip.MTooltipInvite; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; +import kr.syeyoung.dungeonsguide.mod.discord.rpc.RichPresenceManager; + import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/PanelPartyFinderSettings.java index d59d1640..81e254ba 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/PanelPartyFinderSettings.java @@ -16,16 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.customgui; - -import kr.syeyoung.dungeonsguide.chat.ChatProcessor; -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.customgui; + + +import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.gui.elements.*; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; + import lombok.Getter; -import lombok.Setter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -51,7 +50,7 @@ public class PanelPartyFinderSettings extends MPanelScaledGUI { private MTextField filterWhitelist, filterBlacklist, highlightNote, blacklistClassTxt; private MIntegerSelectionButton integerSelection; - @Getter @Setter + @Getter boolean delistable = false; public void setDelistable(boolean delistable) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/PanelPartyListElement.java index 67771f46..154c5e8d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/customgui/PanelPartyListElement.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.customgui; - -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; -import kr.syeyoung.dungeonsguide.gui.elements.MTooltipText; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.customgui; + +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTooltip; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTooltipText; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FakePlayer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FakePlayer.java new file mode 100644 index 00000000..4304ea8a --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FakePlayer.java @@ -0,0 +1,101 @@ +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview; + +import com.google.common.base.Objects; +import com.mojang.authlib.GameProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.SkinFetcher; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; +import lombok.Getter; +import lombok.Setter; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Team; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class FakePlayer extends EntityOtherPlayerMP { + @Setter + @Getter + private PlayerProfile skyblockProfile; + private final SkinFetcher.SkinSet skinSet; + private final PlayerProfile.Armor armor; + @Getter + private final int profileNumber; + + private FakePlayer(World w) { + super(w, null); + throw new UnsupportedOperationException("what"); + } + + public FakePlayer(GameProfile playerProfile, SkinFetcher.SkinSet skinSet, PlayerProfile skyblockProfile, int profileNumber) { + super(Minecraft.getMinecraft().theWorld, playerProfile); + this.profileNumber = profileNumber; + this.skyblockProfile = skyblockProfile; + this.skinSet = skinSet; + armor = skyblockProfile.getCurrentArmor(); + this.inventory.armorInventory = skyblockProfile.getCurrentArmor().getArmorSlots(); + + int highestDungeonScore = Integer.MIN_VALUE; + if (skyblockProfile.getInventory() != null) { + ItemStack highestItem = null; + for (ItemStack itemStack : skyblockProfile.getInventory()) { + if (itemStack == null) continue; + NBTTagCompound display = itemStack.getTagCompound().getCompoundTag("display"); + if (display == null) continue; + NBTTagList nbtTagList = display.getTagList("Lore", 8); + if (nbtTagList == null) continue; + for (int i = 0; i < nbtTagList.tagCount(); i++) { + String str = nbtTagList.getStringTagAt(i); + if (TextUtils.stripColor(str).startsWith("Gear")) { + int dungeonScore = Integer.parseInt(TextUtils.keepIntegerCharactersOnly(TextUtils.stripColor(str).split(" ")[2])); + if (dungeonScore > highestDungeonScore) { + highestItem = itemStack; + highestDungeonScore = dungeonScore; + } + } + } + } + + this.inventory.mainInventory[0] = highestItem; + this.inventory.currentItem = 0; + } + } + + public String getSkinType() { + return this.skinSet == null ? DefaultPlayerSkin.getSkinType(getGameProfile().getId()) : this.skinSet.getSkinType(); + } + + public ResourceLocation getLocationSkin() { + return Objects.firstNonNull(skinSet.getSkinLoc(), DefaultPlayerSkin.getDefaultSkin(getGameProfile().getId())); + } + + public ResourceLocation getLocationCape() { + return skinSet.getCapeLoc(); + } + + @Override + public ItemStack[] getInventory() { + return this.inventory.armorInventory; + } + + @Override + public boolean isInvisibleToPlayer(EntityPlayer player) { + return true; + } + + @Override + public Team getTeam() { + return new ScorePlayerTeam(null, null) { + @Override + public EnumVisible getNameTagVisibility() { + return EnumVisible.NEVER; + } + }; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java new file mode 100644 index 00000000..89761fd8 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java @@ -0,0 +1,682 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview; + +import com.mojang.authlib.GameProfile; +import io.github.moulberry.hychat.HyChat; +import io.github.moulberry.hychat.chat.ChatManager; +import io.github.moulberry.hychat.gui.GuiChatBox; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessResult; +import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MFeatureEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic; +import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.PlayerSkyblockData; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.SkinFetcher; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.DataRendererEditor; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.DataRendererRegistry; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; +import kr.syeyoung.dungeonsguide.mod.features.listener.GuiClickListener; +import kr.syeyoung.dungeonsguide.mod.features.listener.GuiPostRenderListener; +import kr.syeyoung.dungeonsguide.mod.party.PartyContext; +import kr.syeyoung.dungeonsguide.mod.party.PartyManager; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; +import lombok.Getter; +import lombok.Setter; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.fml.client.config.GuiUtils; +import net.minecraftforge.fml.common.Loader; +import org.jetbrains.annotations.NotNull; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; + +import java.awt.*; +import java.util.List; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +public class FeatureViewPlayerStatsOnJoin extends SimpleFeature implements GuiPostRenderListener, GuiClickListener { + + static Minecraft mc = Minecraft.getMinecraft(); + protected Rectangle popupRect; + ChangeProfileWidget profileButtonWidget = new ChangeProfileWidget(); + private String lastuid; // actually current uid + private CompletableFuture<Optional<PlayerSkyblockData>> profileFuture; + private Future<Optional<GameProfile>> gameProfileFuture; + private Future<SkinFetcher.SkinSet> skinFuture; + private FakePlayer fakePlayer; + private boolean shouldDraw = false; + public FeatureViewPlayerStatsOnJoin() { + super("Party", "View player stats when join", "view player rendering when joining/someone joins the party", "partykicker.viewstats", true); + + + addParameter("datarenderers", new FeatureParameter<List<String>>("datarenderers", "DataRenderers", "Datarenderssdasd", new ArrayList<>(Arrays.asList( + "catalv", "selected_class_lv", "dungeon_catacombs_higheststat", "dungeon_master_catacombs_higheststat", "skill_combat_lv", "skill_foraging_lv", "skill_mining_lv", "fairysouls", "dummy" + )), "stringlist")); + + + ChatProcessor.INSTANCE.subscribe(((txt, messageContext) -> { + + if (isEnabled() && txt.contains("§r§ejoined the dungeon group! (§r§b")) { + String username = TextUtils.stripColor(txt).split(" ")[3]; + if (username.equalsIgnoreCase(mc.getSession().getUsername())) { + PartyManager.INSTANCE.requestPartyList(context -> { + if (context == null) { + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §cBugged Dungeon Party ")); + } else { + processPartyMembers(context); + } + }); + } else { + processMemberJoin(username); + } + + + } + + + return ChatProcessResult.NONE; + })); + + } + + public static void clip(ScaledResolution resolution, int x, int y, int width, int height) { + if (width < 0 || height < 0) return; + + int scale = resolution.getScaleFactor(); + GL11.glScissor((x) * scale, mc.displayHeight - (y + height) * scale, (width) * scale, height * scale); + } + + public static void processPartyMembers(PartyContext context) { + for (String member : context.getPartyRawMembers()) { + processMemberJoin(member); + } + } + + private static void processMemberJoin(@NotNull String username) { + ApiFetcher.fetchUUIDAsync(username) + .thenAccept(a -> { + if (a == null) { + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §e" + username + "§f's Profile §cCouldn't fetch uuid")); + return; + } + + + ApiFetcher.fetchMostRecentProfileAsync(a.get(), FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey()); + + IChatComponent comp = new ChatComponentText("§eDungeons Guide §7:: §e" + username + "§f's Profile ") + .appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new HoverEventRenderPlayer(a.orElse(null))))); + + ChatTransmitter.addToQueue((ChatComponentText) comp); + + + }); + } + + @Override + public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { + if (!(mc.currentScreen instanceof GuiChat)) { + cancelRender(); + return; + } + + ScaledResolution scaledResolution = new ScaledResolution(mc); + + IChatComponent ichatcomponent = getHoveredComponent(scaledResolution); + String uid = null; + if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() instanceof HoverEventRenderPlayer) { + uid = ((HoverEventRenderPlayer) ichatcomponent.getChatStyle().getChatHoverEvent()).getUuid(); + } + + int width = scaledResolution.getScaledWidth(); + int height = scaledResolution.getScaledHeight(); + int mouseX = Mouse.getX() * width / mc.displayWidth; + int mouseY = height - Mouse.getY() * height / mc.displayHeight - 1; + + shouldCancelRendering(uid, mouseX, mouseY); + + if (lastuid == null) return; + + + if (popupRect == null) { + popupRect = new Rectangle(mouseX, mouseY, 220, 220); + if (popupRect.y + popupRect.height > scaledResolution.getScaledHeight()) { + popupRect.y -= popupRect.y + popupRect.height - scaledResolution.getScaledHeight(); + } + } + + if (profileFuture == null) { + profileFuture = ApiFetcher.fetchMostRecentProfileAsync(lastuid, FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey()); + } + + if (gameProfileFuture == null) { + gameProfileFuture = ApiFetcher.getSkinGameProfileByUUIDAsync(lastuid); + } + boolean plsSetAPIKEY = false; + if (skinFuture == null && gameProfileFuture.isDone()) { + try { + skinFuture = SkinFetcher.getSkinSet(gameProfileFuture.get().orElse(null)); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + } + + try { + if (fakePlayer == null && skinFuture != null && profileFuture != null && skinFuture.isDone() && profileFuture.isDone() && profileFuture.get().isPresent()) { + if (profileButtonWidget.getCurrentrySelectedProfile(profileFuture.get().get()) != null) { + if (skinFuture.get() != null) { + profileButtonWidget.setCurrentyselectedprofile(profileFuture.get().get().getLastestprofileArrayIndex()); + fakePlayer = new FakePlayer(gameProfileFuture.get().orElse(null), skinFuture.get(), profileButtonWidget.getCurrentrySelectedProfile(profileFuture.get().get()), profileButtonWidget.getCurrentyselectedprofile()); + } + } + } else if (fakePlayer != null) { + if (fakePlayer.getProfileNumber() != profileButtonWidget.getCurrentyselectedprofile()) { + fakePlayer = new FakePlayer(gameProfileFuture.get().orElse(null), skinFuture.get(), profileButtonWidget.getCurrentrySelectedProfile(profileFuture.get().get()), profileButtonWidget.getCurrentyselectedprofile()); + } + } + } catch (InterruptedException | ExecutionException e) { + plsSetAPIKEY = true; + } + + + Optional<PlayerProfile> playerProfile; + if (plsSetAPIKEY || !profileFuture.isDone()) { + playerProfile = null; + } else { + PlayerSkyblockData data = null; + try { + data = profileFuture.get().get(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + PlayerProfile currentlySelectedProfile = profileButtonWidget.getCurrentrySelectedProfile(data); + playerProfile = Optional.ofNullable(currentlySelectedProfile); + } + + + draw(scaledResolution, mouseX, mouseY, plsSetAPIKEY, playerProfile); + } + + private void draw(ScaledResolution scaledResolution, int mouseX, int mouseY, boolean plsSetAPIKEY, Optional<PlayerProfile> playerProfile) { + GlStateManager.pushMatrix(); + GlStateManager.translate(popupRect.x, popupRect.y, 0); + int backroundGuiColor = 0xFF23272a; + Gui.drawRect(0, 0, popupRect.width, popupRect.height, backroundGuiColor); + Gui.drawRect(2, 2, popupRect.width - 2, popupRect.height - 2, 0XFF2c2f33); + + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + if (plsSetAPIKEY) { + mc.fontRendererObj.drawString("Please set API KEY on /dg -> Party Kicker", 5, 5, 0xFFFFFFFF); + GlStateManager.popMatrix(); + } else if (playerProfile == null) { + mc.fontRendererObj.drawString("Fetching data...", 5, 5, 0xFFFFFFFF); + GlStateManager.popMatrix(); + } else if (!playerProfile.isPresent()) { + mc.fontRendererObj.drawString("User could not be found", 5, 5, 0xFFFFFFFF); + GlStateManager.popMatrix(); + } else { + int relX = mouseX - popupRect.x; + int relY = mouseY - popupRect.y; + FontRenderer fr = mc.fontRendererObj; + GL11.glEnable(GL11.GL_SCISSOR_TEST); + clip(scaledResolution, popupRect.x, popupRect.y, popupRect.width, popupRect.height); + + Gui.drawRect(0, 168, 90, 195, backroundGuiColor); + Gui.drawRect(2, 170, 88, 193, new Rectangle(2, 170, 86, 23).contains(relX, relY) ? 0xFFff7777 : 0xFFFF3333); + + Gui.drawRect(0, 193, 90, 220, backroundGuiColor); + Gui.drawRect(2, 195, 88, 218, new Rectangle(2, 195, 86, 23).contains(relX, relY) ? 0xFF859DF0 : 0xFF7289da); + + + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + fr.drawString("Kick", (90 - fr.getStringWidth("Kick")) / 2, (364 - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); + fr.drawString("Invite", (90 - fr.getStringWidth("Invite")) / 2, (414 - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); + + GlStateManager.pushMatrix(); + GlStateManager.translate(95, 5, 0); + int culmutativeY = 5; + IDataRenderer dataRendererToHover = null; + for (String datarenderers : this.<List<String>>getParameter("datarenderers").getValue()) { + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); + Dimension dim; + if (dataRenderer == null) { + fr.drawString("Couldn't find Datarenderer", 0, 0, 0xFFFF0000); + fr.drawString(datarenderers, 0, fr.FONT_HEIGHT, 0xFFFF0000); + dim = new Dimension(0, fr.FONT_HEIGHT * 2); + } else { + GlStateManager.pushMatrix(); + dim = dataRenderer.renderData(playerProfile.get()); + GlStateManager.popMatrix(); + } + if (relX >= 95 && relX <= popupRect.width && relY >= culmutativeY && relY < culmutativeY + dim.height && dataRenderer != null) { + dataRendererToHover = dataRenderer; + } + culmutativeY += dim.height; + GlStateManager.translate(0, dim.height, 0); + } + GlStateManager.popMatrix(); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + Gui.drawRect(0, 0, 90, 170, backroundGuiColor); + Gui.drawRect(2, 2, 88, 168, 0xFF444444); + + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + + profileButtonWidget.drawChangeProfileButton(relX, relY); + + + Gui.drawRect(78, 156, 90, 170, backroundGuiColor); + fr.drawString("§eI", 82, 159, -1); + + + GlStateManager.color(1, 1, 1, 1.0F); + if (fakePlayer != null) { + drawFakePlayer(scaledResolution, mouseX, mouseY, playerProfile, relX, relY, fr); + } else { + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + fr.drawString("Loading", 5, 35, 0xFFEFFF00); + } + GlStateManager.popMatrix(); + GL11.glDisable(GL11.GL_SCISSOR_TEST); + if (dataRendererToHover != null && !shouldDraw) { + dataRendererToHover.onHover(playerProfile.get(), mouseX, mouseY); + } + GL11.glEnable(GL11.GL_SCISSOR_TEST); + GlStateManager.pushMatrix(); + GlStateManager.translate(popupRect.x, popupRect.y, 0); + if (shouldDraw) { + int startX = 81; + int startY = 86; + clip(scaledResolution, popupRect.x + startX - 1, popupRect.y + startY - 1, 164, 74); + GlStateManager.translate(startX, startY, 1); + Gui.drawRect(-1, -1, 163, 73, 0xFF000000); + GlStateManager.disableLighting(); + ItemStack toHover = null; + int rx = relX - startX; + int ry = relY - startY; + + if (playerProfile.get().getInventory() != null) { + GlStateManager.disableRescaleNormal(); + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.disableLighting(); + for (int i = 0; i < playerProfile.get().getInventory().length; i++) { + int x = (i % 9) * 18; + int y = (i / 9) * 18; + if (x <= rx && rx < x + 18 && y <= ry && ry < y + 18) { + toHover = playerProfile.get().getInventory()[(i + 9) % 36]; + } + Gui.drawRect(x, y, x + 18, y + 18, 0xFF000000); + Gui.drawRect(x + 1, y + 1, x + 17, y + 17, 0xFF666666); + GlStateManager.color(1, 1, 1, 1.0F); + + mc.getRenderItem().renderItemAndEffectIntoGUI(playerProfile.get().getInventory()[(i + 9) % 36], (i % 9) * 18 + 1, (i / 9) * 18 + 1); + } + + if (toHover != null) { + drawItemStackToolTip(scaledResolution, mouseX, mouseY, fr, toHover); + } + } else { + Gui.drawRect(0, 0, 162, 72, 0xFF666666); + fr.drawSplitString("Player has disabled Inventory API", 5, 5, 142, -1); + } + + } + GL11.glDisable(GL11.GL_SCISSOR_TEST); + GlStateManager.popMatrix(); // 33 66 108 130 154 // 5 75 + } + + + } + + private void drawFakePlayer(ScaledResolution scaledResolution, int mouseX, int mouseY, Optional<PlayerProfile> playerProfile, int relX, int relY, FontRenderer fr) { + clip(scaledResolution, popupRect.x + 2, popupRect.y + 2, 86, 166); + GuiInventory.drawEntityOnScreen(45, 150, 60, -(mouseX - popupRect.x - 75), 0, fakePlayer); + + String toDraw = fakePlayer.getName(); + List<ActiveCosmetic> activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayer().get(UUID.fromString(TextUtils.insertDashUUID(playerProfile.get().getMemberUID()))); + CosmeticData prefix = null; + CosmeticData color = null; + if (activeCosmetics != null) { + for (ActiveCosmetic activeCosmetic : activeCosmetics) { + CosmeticData cosmeticData = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getCosmeticDataMap().get(activeCosmetic.getCosmeticData()); + if (cosmeticData != null) { + if (cosmeticData.getCosmeticType().equals("prefix")) prefix = cosmeticData; + if (cosmeticData.getCosmeticType().equals("color")) color = cosmeticData; + } + } + } + toDraw = (color == null ? "§e" : color.getData().replace("&", "§")) + toDraw; + if (prefix != null) toDraw = prefix.getData().replace("&", "§") + " " + toDraw; + + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + + + String profileName = "on §6" + playerProfile.get().getProfileName(); + fr.drawString(profileName, (90 - fr.getStringWidth(profileName)) / 2, 15, -1); + + + fr.drawString(toDraw, (90 - fr.getStringWidth(toDraw)) / 2, 10 - (fr.FONT_HEIGHT / 2), -1); + + ItemStack toHover = null; + if (relX > 20 && relX < 70) { + if (33 <= relY && relY <= 66) { + toHover = fakePlayer.getInventory()[3]; + } else if (66 <= relY && relY <= 108) { + toHover = fakePlayer.getInventory()[2]; + } else if (108 <= relY && relY <= 130) { + toHover = fakePlayer.getInventory()[1]; + } else if (130 <= relY && relY <= 154) { + toHover = fakePlayer.getInventory()[0]; + } + } else if (relX > 0 && relX <= 20) { + if (80 <= relY && relY <= 120) { + toHover = fakePlayer.inventory.mainInventory[fakePlayer.inventory.currentItem]; + } + } + + if (toHover != null) { + drawItemStackToolTip(scaledResolution, mouseX, mouseY, fr, toHover); + GlStateManager.translate(popupRect.x, popupRect.y, 0); + } + clip(scaledResolution, popupRect.x, popupRect.y, popupRect.width, popupRect.height); + } + + public void drawItemStackToolTip(ScaledResolution scaledResolution, int mouseX, int mouseY, FontRenderer fr, ItemStack toHover) { + List<String> list = toHover.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips); + for (int i = 0; i < list.size(); ++i) { + if (i == 0) { + list.set(i, toHover.getRarity().rarityColor + list.get(i)); + } else { + list.set(i, EnumChatFormatting.GRAY + list.get(i)); + } + } + FontRenderer font = toHover.getItem().getFontRenderer(toHover); + GlStateManager.popMatrix(); + GL11.glDisable(GL11.GL_SCISSOR_TEST); + FontRenderer theRenderer = (font == null ? fr : font); + GuiUtils.drawHoveringText(list, mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, theRenderer); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + GlStateManager.pushMatrix(); + } + + private void shouldCancelRendering(String uid, int mouseX, int mouseY) { + if (!((popupRect != null && (popupRect.contains(mouseX, mouseY) || shouldDraw)) || uid != null && uid.equals(lastuid))) { + cancelRender(); + } + + if (uid != null && !uid.equals(lastuid) && (popupRect == null || (!popupRect.contains(mouseX, mouseY) && !shouldDraw))) { + cancelRender(); + lastuid = uid; + } + } + + public void cancelRender() { + popupRect = null; + profileFuture = null; + lastuid = null; + gameProfileFuture = null; + skinFuture = null; + fakePlayer = null; + shouldDraw = false; + } + + @Override + public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { + ScaledResolution scaledResolution = new ScaledResolution(mc); + int width = scaledResolution.getScaledWidth(); + int height = scaledResolution.getScaledHeight(); + int mouseX = Mouse.getX() * width / mc.displayWidth; + int mouseY = height - Mouse.getY() * height / mc.displayHeight - 1; + + if (Mouse.getEventButton() != -1 && Mouse.isButtonDown(Mouse.getEventButton()) && shouldDraw) + shouldDraw = false; + if (popupRect == null || !popupRect.contains(mouseX, mouseY)) return; + + mouseInputEvent.setCanceled(true); + + int relX = mouseX - popupRect.x; + int relY = mouseY - popupRect.y; + + try { + PlayerSkyblockData playerData; + + if (profileFuture.isDone()) { + playerData = profileFuture.get().orElse(null); + } else { + return; + } + + if (playerData == null) { + return; + } + + if (Mouse.getEventButton() == -1 && !Mouse.isButtonDown(Mouse.getEventButton())) return; + + if (new Rectangle(2, 195, 86, 23).contains(relX, relY)) { + // invite + ChatProcessor.INSTANCE.addToChatQueue("/p invite " + ApiFetcher.fetchNicknameAsync(profileButtonWidget.getCurrentrySelectedProfile(playerData).getMemberUID()).get().orElse("-"), () -> { + }, true); + } else if (new Rectangle(2, 170, 86, 23).contains(relX, relY)) { + // kick + ChatProcessor.INSTANCE.addToChatQueue("/p kick " + ApiFetcher.fetchNicknameAsync(profileButtonWidget.getCurrentrySelectedProfile(playerData).getMemberUID()).get().orElse("-"), () -> { + }, true); + } else if (new Rectangle(80, 159, 10, 11).contains(relX, relY)) { + shouldDraw = true; + } + + + this.profileButtonWidget.handleClickProfileButton(playerData); + + + } catch (InterruptedException | ExecutionException e) { + } + + + } + + public IChatComponent getHoveredComponent(ScaledResolution scaledResolution) { + IChatComponent ichatcomponent = null; + if (Loader.isModLoaded("hychat")) { + try { + ChatManager chatManager = HyChat.getInstance().getChatManager(); + GuiChatBox guiChatBox = chatManager.getFocusedChat(); + + int x = guiChatBox.getX(scaledResolution); + int y = guiChatBox.getY(scaledResolution); + ichatcomponent = guiChatBox.chatArray.getHoveredComponent(guiChatBox.getSelectedTab().getChatLines(), Mouse.getX(), Mouse.getY(), x, y); + } catch (Throwable t) { + } + } + if (ichatcomponent == null) { + ichatcomponent = Minecraft.getMinecraft().ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY()); + } + return ichatcomponent; + } + + @Override + public String getEditRoute(RootConfigPanel rootConfigPanel) { + ConfigPanelCreator.map.put("base." + getKey(), () -> { + + MFeatureEdit featureEdit = new MFeatureEdit(FeatureViewPlayerStatsOnJoin.this, rootConfigPanel); + featureEdit.addParameterEdit("datarenderers", new DataRendererEditor(FeatureViewPlayerStatsOnJoin.this)); + for (FeatureParameter parameter : getParameters()) { + if (parameter.getKey().equals("datarenderers")) continue; + featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureViewPlayerStatsOnJoin.this, parameter, rootConfigPanel)); + } + return featureEdit; + }); + return "base." + getKey(); + } + + public static class HoverEventRenderPlayer extends HoverEvent { + @Getter + private final String uuid; + private IChatComponent cached; + + public HoverEventRenderPlayer(String uuid) { + super(Action.SHOW_TEXT, new ChatComponentText("")); + this.uuid = uuid; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + HoverEventRenderPlayer that = (HoverEventRenderPlayer) o; + return Objects.equals(uuid, that.uuid); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), uuid); + } + + @Override + public IChatComponent getValue() { + if (cached == null) { + cached = new ChatComponentText("") + .setChatStyle( + new ChatStyle() + .setChatHoverEvent( + new HoverEvent( + Action.SHOW_TEXT, + new ChatComponentText(uuid) + ) + ) + ); + return cached; + } + return cached; + } + } + + class ChangeProfileWidget { + FontRenderer fr; + @Getter + @Setter + int currentyselectedprofile = 0; + String buttonText = "Switch Profile"; + int stringWidth; + int textx; + int texty; + int blockWidth; + int blockHeight; + long clickDeBounce = 0; + + public ChangeProfileWidget() { + fr = Minecraft.getMinecraft().fontRendererObj; + stringWidth = fr.getStringWidth(buttonText); + textx = ((83 - stringWidth) / 2); + texty = (324 - fr.FONT_HEIGHT) / 2; + blockWidth = stringWidth + 3; + blockHeight = fr.FONT_HEIGHT + 2; + } + + void drawChangeProfileButton(float relX, float relY) { + + boolean contains = isWithinButtonRec(relX, relY); + + Gui.drawRect(textx - 5, texty - 1, textx + blockWidth, texty + blockHeight, contains ? 0xFFFFFFFF : 0xFF30afd3); + + fr.drawString(buttonText, textx, texty + 2, contains ? 0x30afd3 : 0xFFFFFF); + } + + Rectangle getButtonRec() { + return new Rectangle(textx - 5, texty - 1, blockWidth, blockHeight); + } + + boolean isWithinButtonRec(float relX, float relY) { + return getButtonRec().contains(relX, relY); + } + + void handleClickProfileButton(PlayerSkyblockData playerData) { + + if (System.currentTimeMillis() <= clickDeBounce) { + return; + } else { + clickDeBounce = System.currentTimeMillis() + 200; + } + + ScaledResolution scaledResolution = new ScaledResolution(mc); + int width = scaledResolution.getScaledWidth(); + int height = scaledResolution.getScaledHeight(); + int mouseX = Mouse.getX() * width / mc.displayWidth; + int mouseY = height - Mouse.getY() * height / mc.displayHeight - 1; + + int relX = mouseX - popupRect.x; + int relY = mouseY - popupRect.y; + + if (isWithinButtonRec(relX, relY)) { + if (profileButtonWidget.currentyselectedprofile + 1 >= playerData.getPlayerProfiles().length) { + profileButtonWidget.currentyselectedprofile = 0; + } else { + profileButtonWidget.currentyselectedprofile++; + } + } + } + + PlayerProfile getCurrentrySelectedProfile(PlayerSkyblockData data) { + if (data == null) return null; + if (data.getPlayerProfiles() == null) return null; + if (data.getPlayerProfiles().length == 0) return null; + if (data.getPlayerProfiles().length < currentyselectedprofile) return null; + return data.getPlayerProfiles()[currentyselectedprofile]; + } + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java new file mode 100644 index 00000000..32c38440 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java @@ -0,0 +1,387 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.mojang.authlib.GameProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfileParser; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; +import net.minecraft.client.Minecraft; +import org.apache.commons.io.IOUtils; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class ApiFetcher { + + private ApiFetcher(){} + + private static final Gson gson = new Gson(); + + private static final Map<String, CachedData<PlayerSkyblockData>> playerProfileCache = new ConcurrentHashMap<>(); + private static final Map<String, CachedData<String>> nicknameToUID = new ConcurrentHashMap<>(); + private static final Map<String, CachedData<String>> UIDtoNickname = new ConcurrentHashMap<>(); + private static final Map<String, CachedData<GameProfile>> UIDtoGameProfile = new ConcurrentHashMap<>(); + + private static final ExecutorService ex = Executors.newFixedThreadPool(4); + + private static final Set<String> invalidKeys = new HashSet<>(); + + public static void purgeCache() { + playerProfileCache.clear(); + nicknameToUID.clear(); + UIDtoNickname.clear(); + UIDtoGameProfile.clear(); + + completableFutureMap.clear(); + completableFutureMap2.clear(); + completableFutureMap3.clear(); + completableFutureMap4.clear(); + invalidKeys.clear(); + PlayerProfileParser.constants = null; + + ex.submit(PlayerProfileParser::getLilyWeightConstants); + } + + static { + ex.submit(PlayerProfileParser::getLilyWeightConstants); + } + + public static JsonObject getJson(String url) throws IOException { + URLConnection connection = new URL(url).openConnection(); + connection.setConnectTimeout(10000); + connection.setReadTimeout(10000); + InputStreamReader inputStreamReader = new InputStreamReader(connection.getInputStream()); + String serverres = IOUtils.toString(inputStreamReader); + return gson.fromJson(serverres, JsonObject.class); + } + + public static JsonArray getJsonArr(String url) throws IOException { + URLConnection connection = new URL(url).openConnection(); + connection.setConnectTimeout(10000); + connection.setReadTimeout(10000); + return gson.fromJson(new InputStreamReader(connection.getInputStream()), JsonArray.class); + } + + private static final Map<String, CompletableFuture<Optional<GameProfile>>> completableFutureMap4 = new ConcurrentHashMap<>(); + + public static CompletableFuture<Optional<GameProfile>> getSkinGameProfileByUUIDAsync(String uid) { + if (UIDtoGameProfile.containsKey(uid)) { + CachedData<GameProfile> cachedData = UIDtoGameProfile.get(uid); + if (cachedData.getExpire() > System.currentTimeMillis()) { + return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); + } + UIDtoGameProfile.remove(uid); + } + if (completableFutureMap4.containsKey(uid)) return completableFutureMap4.get(uid); + + CompletableFuture<Optional<GameProfile>> completableFuture = new CompletableFuture<>(); + fetchNicknameAsync(uid).thenAccept(nick -> { + if (!nick.isPresent()) { + completableFuture.complete(Optional.empty()); + return; + } + ex.submit(() -> { + try { + Optional<GameProfile> playerProfile = getSkinGameProfileByUUID(uid, nick.get()); + UIDtoGameProfile.put(uid, new CachedData<GameProfile>(System.currentTimeMillis() + 1000 * 60 * 30, playerProfile.orElse(null))); + completableFuture.complete(playerProfile); + completableFutureMap4.remove(uid); + return; + } catch (IOException e) { + e.printStackTrace(); + } + completableFuture.complete(Optional.empty()); + completableFutureMap4.remove(uid); + }); + }); + completableFutureMap4.put(uid, completableFuture); + return completableFuture; + } + + public static Optional<GameProfile> getSkinGameProfileByUUID(String uid, String nickname) throws IOException { + GameProfile gameProfile = new GameProfile(UUID.fromString(uid), nickname); + GameProfile newProf = Minecraft.getMinecraft().getSessionService().fillProfileProperties(gameProfile, true); + return newProf == gameProfile ? Optional.empty() : Optional.of(newProf); + } + + + private static final Map<String, CompletableFuture<Optional<PlayerSkyblockData>>> completableFutureMap = new ConcurrentHashMap<>(); + + public static CompletableFuture<Optional<PlayerSkyblockData>> fetchMostRecentProfileAsync(String uid, String apiKey) { + if (playerProfileCache.containsKey(uid)) { + CachedData<PlayerSkyblockData> cachedData = playerProfileCache.get(uid); + if (cachedData.getExpire() > System.currentTimeMillis()) { + return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); + } + playerProfileCache.remove(uid); + } + if (completableFutureMap.containsKey(uid)) { + return completableFutureMap.get(uid); + } + if (invalidKeys.contains(apiKey)) { + CompletableFuture cf = new CompletableFuture(); + cf.completeExceptionally(new IOException("403 for url")); + return cf; + } + CompletableFuture<Optional<PlayerSkyblockData>> completableFuture = new CompletableFuture<>(); + ex.submit(() -> { + try { + Optional<PlayerSkyblockData> playerProfile = fetchPlayerProfiles(uid, apiKey); + playerProfileCache.put(uid, new CachedData<>(System.currentTimeMillis() + 1000 * 60 * 30, playerProfile.orElse(null))); + completableFuture.complete(playerProfile); + completableFutureMap.remove(uid); + } catch (IOException e) { + if (e.getMessage().contains("403 for URL")) { + completableFuture.completeExceptionally(e); + completableFutureMap.remove(uid); + invalidKeys.add(apiKey); + } else { + completableFuture.completeExceptionally(e); + completableFutureMap.remove(uid); + } + e.printStackTrace(); + } + }); + completableFutureMap.put(uid, completableFuture); + return completableFuture; + } + + private static final Map<String, CompletableFuture<Optional<String>>> completableFutureMap3 = new ConcurrentHashMap<>(); + + public static CompletableFuture<Optional<String>> fetchNicknameAsync(String uid) { + if (UIDtoNickname.containsKey(uid)) { + CachedData<String> cachedData = UIDtoNickname.get(uid); + if (cachedData.getExpire() > System.currentTimeMillis()) { + return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); + } + UIDtoNickname.remove(uid); + } + if (completableFutureMap3.containsKey(uid)) return completableFutureMap3.get(uid); + + + CompletableFuture<Optional<String>> completableFuture = new CompletableFuture<>(); + + ex.submit(() -> { + try { + Optional<String> playerProfile = fetchNickname(uid); + UIDtoNickname.put(uid, new CachedData<String>(System.currentTimeMillis() + 1000 * 60 * 60 * 12, playerProfile.orElse(null))); + if (playerProfile.isPresent()) + nicknameToUID.put(playerProfile.orElse(null), new CachedData<>(System.currentTimeMillis() + 1000 * 60 * 60 * 12, uid)); + completableFuture.complete(playerProfile); + completableFutureMap3.remove(uid); + return; + } catch (IOException e) { + e.printStackTrace(); + } + completableFuture.complete(Optional.empty()); + completableFutureMap3.remove(uid); + }); + completableFutureMap3.put(uid, completableFuture); + + return completableFuture; + } + + private static final Map<String, CompletableFuture<Optional<String>>> completableFutureMap2 = new ConcurrentHashMap<>(); + + public static CompletableFuture<Optional<String>> fetchUUIDAsync(String nickname) { + if (nicknameToUID.containsKey(nickname)) { + CachedData<String> cachedData = nicknameToUID.get(nickname); + if (cachedData.getExpire() > System.currentTimeMillis()) { + return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); + } + nicknameToUID.remove(nickname); + } + if (completableFutureMap2.containsKey(nickname)) return completableFutureMap2.get(nickname); + + + CompletableFuture<Optional<String>> completableFuture = new CompletableFuture<>(); + + ex.submit(() -> { + try { + Optional<String> playerProfile = fetchUUID(nickname); + nicknameToUID.put(nickname, new CachedData<String>(System.currentTimeMillis() + 1000 * 60 * 60 * 12, playerProfile.orElse(null))); + if (playerProfile.isPresent()) + UIDtoNickname.put(playerProfile.orElse(null), new CachedData<>(System.currentTimeMillis() + 1000 * 60 * 60 * 12, nickname)); + + completableFuture.complete(playerProfile); + completableFutureMap2.remove(nickname); + return; + } catch (IOException e) { + e.printStackTrace(); + } + completableFuture.complete(Optional.empty()); + completableFutureMap2.remove(nickname); + }); + completableFutureMap2.put(nickname, completableFuture); + + return completableFuture; + } + + public static Optional<String> fetchUUID(String nickname) throws IOException { + JsonObject json = getJson("https://api.mojang.com/users/profiles/minecraft/" + nickname); + if (json.has("error")) return Optional.empty(); + return Optional.of(TextUtils.insertDashUUID(json.get("id").getAsString())); + } + + public static Optional<String> fetchNickname(String uuid) throws IOException { + try { + JsonArray json = getJsonArr("https://api.mojang.com/user/profiles/" + uuid.replace("-", "") + "/names"); + return Optional.of(json.get(json.size() - 1).getAsJsonObject().get("name").getAsString()); + } catch (Exception e) { + return Optional.empty(); + } + } + + + public static Optional<Integer> getNumberOfSecretsFromAchievement(String uid, String apiKey) throws IOException { + JsonObject responce = getJson("https://api.hypixel.net/player?uuid=" + uid + "&key=" + apiKey); + if (responce.has("player")) { + JsonObject treasures = responce.getAsJsonObject("player"); + if (treasures.has("achievements")) { + treasures = treasures.getAsJsonObject("achievements"); + if (treasures.has("skyblock_treasure_hunter")) { + return Optional.of(treasures.get("skyblock_treasure_hunter").getAsInt()); + } + } + } + return Optional.empty(); + } + + + public static int getArrayIndex(Object[] arr,Object value) { + int k=0; + for(int i=0;i<arr.length;i++){ + if(arr[i]==value){ + k=i; + break; + } + } + return k; + } + + public static Optional<PlayerSkyblockData> fetchPlayerProfiles(String uid, String apiKey) throws IOException { + System.out.println("Featching player profiles"); + JsonObject json = getJson("https://api.hypixel.net/skyblock/profiles?uuid=" + uid + "&key=" + apiKey); + if (!json.get("success").getAsBoolean()) return Optional.empty(); + System.out.println("Downloaded data from api"); + JsonArray profiles = json.getAsJsonArray("profiles"); + String dashTrimmed = uid.replace("-", ""); + + + PlayerSkyblockData pp = new PlayerSkyblockData(); + ArrayList<PlayerProfile> playerProfiles = new ArrayList<>(); + System.out.println("Saving and parsing data"); + float lastSave = Long.MIN_VALUE; + PlayerProfile lastest = null; + for (JsonElement jsonElement : profiles) { + JsonObject semiProfile = jsonElement.getAsJsonObject(); + if (!semiProfile.get("members").getAsJsonObject().has(dashTrimmed)) { + System.out.println("Profile does not appear to have the player???"); + continue; + } + + System.out.println("Parsing profile"); + PlayerProfile e = PlayerProfileParser.parseProfile(semiProfile, dashTrimmed); + + System.out.println("Finished Parsing Profile"); + + + System.out.println("Getting nm of secrets from achivment"); + getNumberOfSecretsFromAchievement(uid, apiKey).ifPresent(e::setTotalSecrets); + System.out.println("finished getting secrets from achivment"); + + + System.out.println("Gettign last save"); + JsonElement last_save = semiProfile.get("last_save"); + if(last_save != null){ + float lastSave2 = last_save.getAsLong(); + if (lastSave2 > lastSave) { + lastest = e; + lastSave = lastSave2; + } + } + System.out.println("Finished getting last save"); + + playerProfiles.add(e); + } + System.out.println("THE AMMOUT OF PLAYER PROFILES: " + playerProfiles.size()); + PlayerProfile[] p = new PlayerProfile[playerProfiles.size()]; + pp.setLastestprofileArrayIndex(getArrayIndex(p, lastest)); + pp.setPlayerProfiles(playerProfiles.toArray(p)); + return Optional.of(pp); + } + + public static Optional<PlayerProfile> fetchMostRecentProfile(String uid, String apiKey) throws IOException { + JsonObject json = getJson("https://api.hypixel.net/skyblock/profiles?uuid=" + uid + "&key=" + apiKey); + if (!json.get("success").getAsBoolean()) return Optional.empty(); + JsonArray profiles = json.getAsJsonArray("profiles"); + String dashTrimmed = uid.replace("-", ""); + + JsonObject profile = null; + float lastSave = Long.MIN_VALUE; + for (JsonElement jsonElement : profiles) { + JsonObject semiProfile = jsonElement.getAsJsonObject(); + if (!semiProfile.getAsJsonObject("members").has(dashTrimmed)) { + continue; + } + JsonElement last_save = semiProfile.get("last_save"); + + JsonElement cute_name = semiProfile.get("cute_name"); + if (cute_name != null) { + System.out.println(cute_name.getAsString()); + } else { + System.out.println("THIS SHOULD NOT HAPPEN"); + } + + if (last_save == null) { + return Optional.empty(); + } + float lastSave2 = last_save.getAsLong(); + if (lastSave2 > lastSave) { + + profile = semiProfile; + lastSave = lastSave2; + } + } + + + if (profile == null) { + return Optional.empty(); + } + + PlayerProfile pp = PlayerProfileParser.parseProfile(profile, dashTrimmed); + + getNumberOfSecretsFromAchievement(uid, apiKey).ifPresent(pp::setTotalSecrets); + + return Optional.of(pp); + } + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/CachedData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/CachedData.java new file mode 100644 index 00000000..fd70ec4d --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/CachedData.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class CachedData<T> { + private final long expire; + private final T data; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/PlayerSkyblockData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/PlayerSkyblockData.java new file mode 100644 index 00000000..2525183b --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/PlayerSkyblockData.java @@ -0,0 +1,10 @@ +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api; + +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import lombok.Data; + +@Data +public class PlayerSkyblockData { + PlayerProfile[] playerProfiles; + int lastestprofileArrayIndex; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/SkinFetchur.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/SkinFetcher.java index 29850132..5488f637 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/SkinFetchur.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/SkinFetcher.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.api; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; @@ -33,7 +33,9 @@ import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; -public class SkinFetchur { +public class SkinFetcher { + + private SkinFetcher(){} private static final Map<String, CachedData<SkinSet>> skinSetMap = new ConcurrentHashMap<>(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/PlayerProfile.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfile.java index 68de8b86..5ea0111d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/PlayerProfile.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfile.java @@ -16,8 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.api; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.*; import lombok.Data; import net.minecraft.item.ItemStack; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ApiFetchur.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java index 3e991c59..eddfdd95 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ApiFetchur.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/PlayerProfileParser.java @@ -1,28 +1,14 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import com.google.gson.*; -import com.mojang.authlib.GameProfile; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; -import net.minecraft.client.Minecraft; + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile; + + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonNull; +import com.google.gson.JsonObject; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.*; +import kr.syeyoung.dungeonsguide.mod.utils.XPUtils; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; @@ -31,301 +17,53 @@ import net.minecraft.nbt.NBTTagList; import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.*; -import java.util.concurrent.*; +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ExecutionException; import java.util.function.BiFunction; import java.util.stream.Collectors; -public class ApiFetchur { - private static final Gson gson = new Gson(); - - private static final Map<String, CachedData<PlayerProfile>> playerProfileCache = new ConcurrentHashMap<>(); - private static final Map<String, CachedData<String>> nicknameToUID = new ConcurrentHashMap<>(); - private static final Map<String, CachedData<String>> UIDtoNickname = new ConcurrentHashMap<>(); - private static final Map<String, CachedData<GameProfile>> UIDtoGameProfile = new ConcurrentHashMap<>(); - - private static final ExecutorService ex = Executors.newFixedThreadPool(4); +public class PlayerProfileParser { - private static final Set<String> invalidKeys = new HashSet<>(); - public static void purgeCache() { - playerProfileCache.clear(); - nicknameToUID.clear(); - UIDtoNickname.clear(); - UIDtoGameProfile.clear(); - - completableFutureMap.clear(); - completableFutureMap2.clear(); - completableFutureMap3.clear(); - completableFutureMap4.clear(); - invalidKeys.clear(); - constants = null; - - ex.submit(ApiFetchur::getLilyWeightConstants); - } - static { - ex.submit(ApiFetchur::getLilyWeightConstants); - } + public static volatile JsonObject constants; - public static JsonObject getJson(String url) throws IOException { - URLConnection connection = new URL(url).openConnection(); - connection.setConnectTimeout(10000); - connection.setReadTimeout(10000); - return gson.fromJson(new InputStreamReader(connection.getInputStream()), JsonObject.class); - } - public static JsonArray getJsonArr(String url) throws IOException { - URLConnection connection = new URL(url).openConnection(); - connection.setConnectTimeout(10000); - connection.setReadTimeout(10000); - return gson.fromJson(new InputStreamReader(connection.getInputStream()), JsonArray.class); - } - - private static volatile JsonObject constants; public static JsonObject getLilyWeightConstants() { if (constants != null) return constants; - try { - JsonObject jsonObject = getJson("https://raw.githubusercontent.com/Antonio32A/lilyweight/master/lib/constants.json"); - constants = jsonObject; - } catch (Exception e) { - throw new RuntimeException(e); - } - return constants; - } - - private static final Map<String, CompletableFuture<Optional<GameProfile>>> completableFutureMap4 = new ConcurrentHashMap<>(); - public static CompletableFuture<Optional<GameProfile>> getSkinGameProfileByUUIDAsync(String uid) { - if (UIDtoGameProfile.containsKey(uid)) { - CachedData<GameProfile> cachedData = UIDtoGameProfile.get(uid); - if (cachedData.getExpire() > System.currentTimeMillis()) { - return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); - } - UIDtoGameProfile.remove(uid); - } - if (completableFutureMap4.containsKey(uid)) return completableFutureMap4.get(uid); - - CompletableFuture<Optional<GameProfile>> completableFuture = new CompletableFuture<>(); - fetchNicknameAsync(uid).thenAccept(nick -> { - if (!nick.isPresent()) { - completableFuture.complete(Optional.empty()); - return; - } - ex.submit(() -> { - try { - Optional<GameProfile> playerProfile = getSkinGameProfileByUUID(uid,nick.get()); - UIDtoGameProfile.put(uid, new CachedData<GameProfile>(System.currentTimeMillis()+1000*60*30, playerProfile.orElse(null))); - completableFuture.complete(playerProfile); - completableFutureMap4.remove(uid); - return; - } catch (IOException e) { - e.printStackTrace(); - } - completableFuture.complete(Optional.empty()); - completableFutureMap4.remove(uid); - }); - }); - completableFutureMap4.put(uid, completableFuture); - return completableFuture; - } - - public static Optional<GameProfile> getSkinGameProfileByUUID(String uid, String nickname) throws IOException { - GameProfile gameProfile = new GameProfile(UUID.fromString(uid), nickname); - GameProfile newProf = Minecraft.getMinecraft().getSessionService().fillProfileProperties(gameProfile, true); - return newProf == gameProfile ? Optional.empty() : Optional.of(newProf); - } - - - private static final Map<String, CompletableFuture<Optional<PlayerProfile>>> completableFutureMap = new ConcurrentHashMap<>(); - public static CompletableFuture<Optional<PlayerProfile>> fetchMostRecentProfileAsync(String uid, String apiKey) { - if (playerProfileCache.containsKey(uid)) { - CachedData<PlayerProfile> cachedData = playerProfileCache.get(uid); - if (cachedData.getExpire() > System.currentTimeMillis()) { - return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); - } - playerProfileCache.remove(uid); - } - if (completableFutureMap.containsKey(uid)) return completableFutureMap.get(uid); - if (invalidKeys.contains(apiKey)) { - CompletableFuture cf = new CompletableFuture(); - cf.completeExceptionally(new IOException("403 for url")); - return cf; - } - - CompletableFuture<Optional<PlayerProfile>> completableFuture = new CompletableFuture<>(); - ex.submit(() -> { - try { - Optional<PlayerProfile> playerProfile = fetchMostRecentProfile(uid, apiKey); - playerProfileCache.put(uid, new CachedData<PlayerProfile>(System.currentTimeMillis()+1000*60*30, playerProfile.orElse(null))); - completableFuture.complete(playerProfile); - completableFutureMap.remove(uid); - return; - } catch (IOException e) { - if (e.getMessage().contains("403 for URL")) { - completableFuture.completeExceptionally(e); - completableFutureMap.remove(uid); - invalidKeys.add(apiKey); - } else { - completableFuture.completeExceptionally(e); - completableFutureMap.remove(uid); - } - e.printStackTrace(); - } - }); - completableFutureMap.put(uid, completableFuture); - return completableFuture; - } - - private static final Map<String, CompletableFuture<Optional<String>>> completableFutureMap3 = new ConcurrentHashMap<>(); - public static CompletableFuture<Optional<String>> fetchNicknameAsync(String uid) { - if (UIDtoNickname.containsKey(uid)) { - CachedData<String> cachedData = UIDtoNickname.get(uid); - if (cachedData.getExpire() > System.currentTimeMillis()) { - return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); - } - UIDtoNickname.remove(uid); - } - if (completableFutureMap3.containsKey(uid)) return completableFutureMap3.get(uid); - - - CompletableFuture<Optional<String>> completableFuture = new CompletableFuture<>(); - - ex.submit(() -> { - try { - Optional<String> playerProfile = fetchNickname(uid); - UIDtoNickname.put(uid, new CachedData<String>(System.currentTimeMillis()+1000*60*60*12,playerProfile.orElse(null))); - if (playerProfile.isPresent()) - nicknameToUID.put(playerProfile.orElse(null), new CachedData<>(System.currentTimeMillis()+1000*60*60*12, uid)); - completableFuture.complete(playerProfile); - completableFutureMap3.remove(uid); - return; - } catch (IOException e) { - e.printStackTrace(); - } - completableFuture.complete(Optional.empty()); - completableFutureMap3.remove(uid); - }); - completableFutureMap3.put(uid, completableFuture); - - return completableFuture; - } - - private static final Map<String, CompletableFuture<Optional<String>>> completableFutureMap2 = new ConcurrentHashMap<>(); - public static CompletableFuture<Optional<String>> fetchUUIDAsync(String nickname) { - if (nicknameToUID.containsKey(nickname)) { - CachedData<String> cachedData = nicknameToUID.get(nickname); - if (cachedData.getExpire() > System.currentTimeMillis()) { - return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); - } - nicknameToUID.remove(nickname); - } - if (completableFutureMap2.containsKey(nickname)) return completableFutureMap2.get(nickname); - - - CompletableFuture<Optional<String>> completableFuture = new CompletableFuture<>(); - - ex.submit(() -> { - try { - Optional<String> playerProfile = fetchUUID(nickname); - nicknameToUID.put(nickname, new CachedData<String>(System.currentTimeMillis()+1000*60*60*12,playerProfile.orElse(null))); - if (playerProfile.isPresent()) - UIDtoNickname.put(playerProfile.orElse(null), new CachedData<>(System.currentTimeMillis()+1000*60*60*12, nickname)); - - completableFuture.complete(playerProfile); - completableFutureMap2.remove(nickname); - return; - } catch (IOException e) { - e.printStackTrace(); - } - completableFuture.complete(Optional.empty()); - completableFutureMap2.remove(nickname); - }); - completableFutureMap2.put(nickname, completableFuture); - - return completableFuture; - } - - public static Optional<String> fetchUUID(String nickname) throws IOException { - JsonObject json = getJson("https://api.mojang.com/users/profiles/minecraft/"+nickname); - if (json.has("error")) return Optional.empty(); - return Optional.of(TextUtils.insertDashUUID(json.get("id").getAsString())); - } - public static Optional<String> fetchNickname(String uuid) throws IOException { try { - JsonArray json = getJsonArr("https://api.mojang.com/user/profiles/" + uuid.replace("-", "") + "/names"); - return Optional.of(json.get(json.size()-1).getAsJsonObject().get("name").getAsString()); - } catch (Exception e) {return Optional.empty();} - } - - public static List<PlayerProfile> fetchPlayerProfiles(String uid, String apiKey) throws IOException { - JsonObject json = getJson("https://api.hypixel.net/skyblock/profiles?uuid="+uid+"&key="+apiKey); - if (!json.get("success").getAsBoolean()) return new ArrayList<>(); - JsonArray profiles = json.getAsJsonArray("profiles"); - String dashTrimmed = uid.replace("-", ""); - - ArrayList<PlayerProfile> playerProfiles = new ArrayList<>(); - for (JsonElement jsonElement : profiles) { - JsonObject semiProfile = jsonElement.getAsJsonObject(); - if (!semiProfile.has(dashTrimmed)) continue; - playerProfiles.add(parseProfile(semiProfile, dashTrimmed)); - } - return playerProfiles; - } - - public static Optional<PlayerProfile> fetchMostRecentProfile(String uid, String apiKey) throws IOException { - JsonObject json = getJson("https://api.hypixel.net/skyblock/profiles?uuid="+uid+"&key="+apiKey); - if (!json.get("success").getAsBoolean()) return Optional.empty(); - JsonArray profiles = json.getAsJsonArray("profiles"); - String dashTrimmed = uid.replace("-", ""); - - JsonObject profile = null; - long lastSave = Long.MIN_VALUE; - for (JsonElement jsonElement : profiles) { - JsonObject semiProfile = jsonElement.getAsJsonObject(); - if (!semiProfile.getAsJsonObject("members").has(dashTrimmed)) continue; - long lastSave2 = semiProfile.getAsJsonObject("members").getAsJsonObject(dashTrimmed).get("last_save").getAsLong(); - if (lastSave2 > lastSave) { - profile = semiProfile; - lastSave = lastSave2; - } - } - - if (profile == null) return Optional.empty(); - PlayerProfile pp = parseProfile(profile, dashTrimmed); - json = getJson("https://api.hypixel.net/player?uuid="+uid+"&key="+apiKey); - if (json.has("player")) { - JsonObject treasures = json.getAsJsonObject("player"); - if (treasures.has("achievements")) { - treasures = treasures.getAsJsonObject("achievements"); - if (treasures.has("skyblock_treasure_hunter")) { - pp.setTotalSecrets(treasures.get("skyblock_treasure_hunter").getAsInt()); - } - } + JsonObject jsonObject = ApiFetcher.getJson("https://raw.githubusercontent.com/Antonio32A/lilyweight/master/lib/constants.json"); + constants = jsonObject; + } catch (Exception e) { + throw new RuntimeException(e); } - - return Optional.of(pp); + return constants; } public static int getOrDefault(JsonObject jsonObject, String key, int value) { if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value; return jsonObject.get(key).getAsInt(); } + public static long getOrDefault(JsonObject jsonObject, String key, long value) { if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value; return jsonObject.get(key).getAsLong(); } + public static double getOrDefault(JsonObject jsonObject, String key, double value) { if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value; return jsonObject.get(key).getAsDouble(); } + public static String getOrDefault(JsonObject jsonObject, String key, String value) { if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value; return jsonObject.get(key).getAsString(); } + public static Double getOrDefaultNullable(JsonObject jsonObject, String key, Double value) { if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value; return jsonObject.get(key).getAsDouble(); } + public static NBTTagCompound parseBase64NBT(String nbt) throws IOException { return CompressedStreamTools.readCompressed(new ByteArrayInputStream(Base64.getDecoder().decode(nbt))); } @@ -346,7 +84,7 @@ public class ApiFetchur { JsonObject playerData = profile.getAsJsonObject("members").getAsJsonObject(dashTrimmed); playerProfile.setLastSave(getOrDefault(playerData, "last_save", 0L)); playerProfile.setFairySouls(getOrDefault(playerData, "fairy_souls_collected", 0)); - playerProfile.setFairyExchanges(getOrDefault(playerData, "fairy_exchanges", 0)); + playerProfile.setFairyExchanges(getOrDefault(playerData, "fairy_exchanges", 0)); if (playerData.has("inv_armor")) { playerProfile.setCurrentArmor(new PlayerProfile.Armor()); @@ -366,7 +104,7 @@ public class ApiFetchur { for (int i = 0; i < array.tagCount(); i++) { if (i % 4 == 0) playerProfile.getWardrobe().add(new PlayerProfile.Armor()); NBTTagCompound item = array.getCompoundTagAt(i); - playerProfile.getWardrobe().get(i/4).getArmorSlots()[i%4] = deserializeNBT(item); + playerProfile.getWardrobe().get(i / 4).getArmorSlots()[i % 4] = deserializeNBT(item); } } @@ -402,7 +140,7 @@ public class ApiFetchur { playerProfile.setSkillXp(new HashMap<>()); for (Skill value : Skill.values()) { - playerProfile.getSkillXp().put(value, getOrDefaultNullable(playerData, "experience_skill_"+value.getJsonName(), null)); + playerProfile.getSkillXp().put(value, getOrDefaultNullable(playerData, "experience_skill_" + value.getJsonName(), null)); } if (playerData.has("pets")) { @@ -436,20 +174,20 @@ public class ApiFetchur { for (Integer validFloor : value.getValidFloors()) { DungeonStat.PlayedFloor playedFloor = new DungeonStat.PlayedFloor(); - playedFloor.setBestScore(getOrDefault(dungeonObj.getAsJsonObject("best_score"), ""+validFloor, 0)); - playedFloor.setCompletions(getOrDefault(dungeonObj.getAsJsonObject("tier_completions"), ""+validFloor, 0)); - playedFloor.setFastestTime(getOrDefault(dungeonObj.getAsJsonObject("fastest_time"), ""+validFloor, -1)); - playedFloor.setFastestTimeS(getOrDefault(dungeonObj.getAsJsonObject("fastest_time_s"), ""+validFloor, -1)); - playedFloor.setFastestTimeSPlus(getOrDefault(dungeonObj.getAsJsonObject("fastest_time_s_plus"), ""+validFloor, -1)); - playedFloor.setMobsKilled(getOrDefault(dungeonObj.getAsJsonObject("mobs_killed"), ""+validFloor, 0)); - playedFloor.setMostMobsKilled(getOrDefault(dungeonObj.getAsJsonObject("most_mobs_killed"), ""+validFloor, 0)); - playedFloor.setMostHealing(getOrDefault(dungeonObj.getAsJsonObject("most_healing"), ""+validFloor, 0)); - playedFloor.setTimes_played(getOrDefault(dungeonObj.getAsJsonObject("times_played"), ""+validFloor, 0)); - playedFloor.setWatcherKills(getOrDefault(dungeonObj.getAsJsonObject("watcher_kills"), ""+validFloor, 0)); + playedFloor.setBestScore(getOrDefault(dungeonObj.getAsJsonObject("best_score"), "" + validFloor, 0)); + playedFloor.setCompletions(getOrDefault(dungeonObj.getAsJsonObject("tier_completions"), "" + validFloor, 0)); + playedFloor.setFastestTime(getOrDefault(dungeonObj.getAsJsonObject("fastest_time"), "" + validFloor, -1)); + playedFloor.setFastestTimeS(getOrDefault(dungeonObj.getAsJsonObject("fastest_time_s"), "" + validFloor, -1)); + playedFloor.setFastestTimeSPlus(getOrDefault(dungeonObj.getAsJsonObject("fastest_time_s_plus"), "" + validFloor, -1)); + playedFloor.setMobsKilled(getOrDefault(dungeonObj.getAsJsonObject("mobs_killed"), "" + validFloor, 0)); + playedFloor.setMostMobsKilled(getOrDefault(dungeonObj.getAsJsonObject("most_mobs_killed"), "" + validFloor, 0)); + playedFloor.setMostHealing(getOrDefault(dungeonObj.getAsJsonObject("most_healing"), "" + validFloor, 0)); + playedFloor.setTimes_played(getOrDefault(dungeonObj.getAsJsonObject("times_played"), "" + validFloor, 0)); + playedFloor.setWatcherKills(getOrDefault(dungeonObj.getAsJsonObject("watcher_kills"), "" + validFloor, 0)); for (DungeonClass dungeonClass : DungeonClass.values()) { DungeonStat.PlayedFloor.ClassStatistics classStatistics = new DungeonStat.PlayedFloor.ClassStatistics(); - classStatistics.setMostDamage(getOrDefault(dungeonObj.getAsJsonObject("most_damage_"+dungeonClass.getJsonName()), ""+validFloor, 0)); + classStatistics.setMostDamage(getOrDefault(dungeonObj.getAsJsonObject("most_damage_" + dungeonClass.getJsonName()), "" + validFloor, 0)); ClassSpecificData<DungeonStat.PlayedFloor.ClassStatistics> classStatisticsClassSpecificData = new ClassSpecificData<>(dungeonClass, classStatistics); playedFloor.getClassStatistics().put(dungeonClass, classStatisticsClassSpecificData); @@ -508,9 +246,9 @@ public class ApiFetchur { double skillAvg = playerProfile.getSkillXp().entrySet().stream() .filter(a -> a.getValue() != null) .filter(a -> srw.has(a.getKey().getJsonName())) - .map(a -> XPUtils.getSkillXp(a.getKey(), a.getValue()).getLevel()).collect(Collectors.averagingInt(a -> a)); + .map(a -> XPUtils.getSkillXp(a.getKey(), a.getValue()).getLevel()).collect(Collectors.averagingInt(a -> a)); - double n = 12 * (skillAvg/60)*(skillAvg/60); + double n = 12 * (skillAvg / 60) * (skillAvg / 60); double r2 = Math.sqrt(2); for (Map.Entry<Skill, Double> skillDoubleEntry : playerProfile.getSkillXp().entrySet()) { @@ -519,8 +257,8 @@ public class ApiFetchur { if (temp_srw == null) continue; int lv = XPUtils.getSkillXp(skillDoubleEntry.getKey(), skillDoubleEntry.getValue()).getLevel(); skillWeight += n * temp_srw.get(lv).getAsDouble() - * temp_srw.get(temp_srw.size() - 1).getAsDouble(); - skillWeight += temp_srw.get(temp_srw.size() - 1).getAsDouble() * Math.pow(lv/60.0, r2); + * temp_srw.get(temp_srw.size() - 1).getAsDouble(); + skillWeight += temp_srw.get(temp_srw.size() - 1).getAsDouble() * Math.pow(lv / 60.0, r2); } int cnt = 0; @@ -529,13 +267,14 @@ public class ApiFetchur { double factor = skillFactor.get(cnt).getAsDouble(); double effectiveOver; Double xp = playerProfile.getSkillXp().get(s); - if (xp == null) continue; xp -= skillMaxXP; + if (xp == null) continue; + xp -= skillMaxXP; { if (xp < skillMaxXP) effectiveOver = xp; else { double remainingXP = xp; double z = 0; - for (int i = 0; i<= xp/skillMaxXP; i++) { + for (int i = 0; i <= xp / skillMaxXP; i++) { if (remainingXP >= skillMaxXP) { remainingXP -= skillMaxXP; z += Math.pow(factor, i); @@ -565,13 +304,16 @@ public class ApiFetchur { max1000 *= 1000; mMax1000 *= 1000; - double upperBound = 1500; double score = 0; + double upperBound = 1500; + double score = 0; DungeonStat dStat = playerProfile.getDungeonStats().get(DungeonType.CATACOMBS).getData(); for (FloorSpecificData<DungeonStat.PlayedFloor> value : dStat.getPlays().values()) { int runs = value.getData().getCompletions(); - int excess = 0; if (runs > 1000) { - excess = runs - 1000; runs = 1000; + int excess = 0; + if (runs > 1000) { + excess = runs - 1000; + runs = 1000; } double floorScore = runs * completionFactor.get(value.getFloor()).getAsDouble(); @@ -583,20 +325,24 @@ public class ApiFetchur { dStat = playerProfile.getDungeonStats().get(DungeonType.MASTER_CATACOMBS).getData(); for (FloorSpecificData<DungeonStat.PlayedFloor> value : dStat.getPlays().values()) { - if (dungeonCompletionBuffs.has(value.getFloor()+"")) { + if (dungeonCompletionBuffs.has(value.getFloor() + "")) { double threshold = 20; - if (value.getData().getCompletions() >= threshold) upperBound += dungeonCompletionBuffs.get(value.getFloor()+"").getAsDouble(); - else upperBound += dungeonCompletionBuffs.get(value.getFloor()+"").getAsDouble() * Math.pow(value.getData().getCompletions()/threshold, 1.840896416); + if (value.getData().getCompletions() >= threshold) + upperBound += dungeonCompletionBuffs.get(value.getFloor() + "").getAsDouble(); + else + upperBound += dungeonCompletionBuffs.get(value.getFloor() + "").getAsDouble() * Math.pow(value.getData().getCompletions() / threshold, 1.840896416); } } score = 0; for (FloorSpecificData<DungeonStat.PlayedFloor> value : dStat.getPlays().values()) { int runs = value.getData().getCompletions(); - int excess = 0; if (runs > 1000) { - excess = runs - 1000; runs = 1000; + int excess = 0; + if (runs > 1000) { + excess = runs - 1000; + runs = 1000; } - double floorScore = runs * completionFactor.get(value.getFloor()+7).getAsDouble(); + double floorScore = runs * completionFactor.get(value.getFloor() + 7).getAsDouble(); if (excess > 0) floorScore *= Math.log10(excess / 1000.0 + 1) / Math.log10(5) + 1; score += floorScore; @@ -617,7 +363,8 @@ public class ApiFetchur { level += progress; } - double n; double tempLevel = 0; + double n; + double tempLevel = 0; if (cataXP < dungeonMaxXP) n = 0.2 * Math.pow(level / 50.0, 2.967355422); else { @@ -626,8 +373,9 @@ public class ApiFetchur { n = 0.2 * Math.pow(1 + ((tempLevel - 50) / 50), 2.967355422); } if (level != 0) { - if (cataXP < 569809640) dungeonXPWeight = dungeonOverall * (Math.pow(1.18340401286164044, (level + 1)) - 1.05994990217254) * (1 + n); - else dungeonXPWeight =4000 * (n / 0.15465244570598540); + if (cataXP < 569809640) + dungeonXPWeight = dungeonOverall * (Math.pow(1.18340401286164044, (level + 1)) - 1.05994990217254) * (1 + n); + else dungeonXPWeight = 4000 * (n / 0.15465244570598540); } else dungeonXPWeight = 0; } double slayerWeight = 0; @@ -652,7 +400,7 @@ public class ApiFetchur { for (int i = 1; i <= score; i++) effectiveXP += (i * i + i) * Math.pow(scaling, i); effectiveXP = Math.round((1000000 * effectiveXP * (0.05 / scaling)) * 100) / 100.0; - double actualXP = ((score*score*score / 6) + (score*score / 2) + (score / 3)) * 100000; + double actualXP = ((score * score * score / 6) + (score * score / 2) + (score / 3)) * 100000; double distance = xp - actualXP; double effectiveDistance = distance * Math.pow(scaling, score); return effectiveXP + effectiveDistance; @@ -679,16 +427,25 @@ public class ApiFetchur { } private static Skill getSkillByLilyName(String lilyName) { - switch(lilyName) { - case "experience_skill_enchanting": return Skill.ENCHANTING; - case "experience_skill_taming": return Skill.TAMING; - case "experience_skill_alchemy": return Skill.ALCHEMY; - case "experience_skill_mining": return Skill.MINING; - case "experience_skill_farming": return Skill.FARMING; - case "experience_skill_foraging": return Skill.FORAGING; - case "experience_skill_combat": return Skill.COMBAT; - case "experience_skill_fishing": return Skill.FISHING; - default: return null; + switch (lilyName) { + case "experience_skill_enchanting": + return Skill.ENCHANTING; + case "experience_skill_taming": + return Skill.TAMING; + case "experience_skill_alchemy": + return Skill.ALCHEMY; + case "experience_skill_mining": + return Skill.MINING; + case "experience_skill_farming": + return Skill.FARMING; + case "experience_skill_foraging": + return Skill.FORAGING; + case "experience_skill_combat": + return Skill.COMBAT; + case "experience_skill_fishing": + return Skill.FISHING; + default: + return null; } } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/ClassSpecificData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/ClassSpecificData.java new file mode 100644 index 00000000..eff45140 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/ClassSpecificData.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public class ClassSpecificData<T> { + private final DungeonClass dungeonClass; + private final T data; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonClass.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonClass.java new file mode 100644 index 00000000..da32a49b --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonClass.java @@ -0,0 +1,46 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.HashMap; +import java.util.Map; + +@Getter +@AllArgsConstructor +public enum DungeonClass { + MAGE("mage", "Mage"), ARCHER("archer","Archer"), HEALER("healer", "Healer"), TANK("tank", "Tank"), BERSERK("berserk", "Berserk"); + + + private final String jsonName; + private final String familarName; + private static final Map<String, DungeonClass> jsonNameToClazz = new HashMap<>(); + static { + for (DungeonClass value : values()) { + jsonNameToClazz.put(value.getJsonName(), value); + } + } + + public static DungeonClass getClassByJsonName(String name) { + return jsonNameToClazz.get(name); + } + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonSpecificData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonSpecificData.java new file mode 100644 index 00000000..a7f95a9f --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonSpecificData.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class DungeonSpecificData<T> { + private final DungeonType type; + private final T data; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonStat.java index 7fbe02df..0b214115 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonStat.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonStat.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.api; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses; import lombok.Data; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonType.java new file mode 100644 index 00000000..0b8e8b37 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/DungeonType.java @@ -0,0 +1,39 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses; + +import com.google.common.collect.Sets; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Set; + +@Getter +@AllArgsConstructor +public enum DungeonType { + CATACOMBS("catacombs", "The Catacombs", + Sets.newHashSet(0,1,2,3,4,5,6,7)), + MASTER_CATACOMBS("master_catacombs", "MasterMode Catacombs", Sets.newHashSet( + 1,2,3,4,5,6 + )); + + private final String jsonName; + private final String familiarName; + private final Set<Integer> validFloors ; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/FloorSpecificData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/FloorSpecificData.java new file mode 100644 index 00000000..14ebbcf3 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/FloorSpecificData.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class FloorSpecificData<T> { + private final int floor; + private final T data; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/Pet.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/Pet.java new file mode 100644 index 00000000..e4a38fe6 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/Pet.java @@ -0,0 +1,31 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses; + +import lombok.Data; + +@Data +public class Pet { + private String uuid; + private String type; + private double exp; + private boolean active; + private String heldItem; + private String skin; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/Skill.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/Skill.java new file mode 100644 index 00000000..10f1b1f9 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/playerprofile/dataclasses/Skill.java @@ -0,0 +1,31 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum Skill { + RUNECRAFTING("runecrafting", "Runecrafting"), COMBAT("combat", "Combat"), MINING("mining", "Mining"), ALCHEMY("alchemy", "Alchemy"), FARMING("farming", "Farming"), TAMING("taming", "Taming"), ENCHANTING("enchanting", "Enchanting"), FISHING("fishing", "Fishing"), FORAGING("foraging", "Foraging"), CARPENTRY("carpentry", "Carpentry"); + + private final String jsonName; + private final String friendlyName; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/DataRendererEditor.java index fd3261c1..393136fa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/DataRendererEditor.java @@ -16,10 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.FeatureViewPlayerStatsOnJoin; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -34,10 +35,10 @@ import java.util.List; import java.util.Set; public class DataRendererEditor extends MPanel { - private final FeatureViewPlayerOnJoin feature; + private final FeatureViewPlayerStatsOnJoin feature; - public DataRendererEditor(FeatureViewPlayerOnJoin featureViewPlayerOnJoin) { - this.feature = featureViewPlayerOnJoin; + public DataRendererEditor(FeatureViewPlayerStatsOnJoin featureViewPlayerStatsOnJoin) { + this.feature = featureViewPlayerStatsOnJoin; } @Override @@ -84,7 +85,7 @@ public class DataRendererEditor extends MPanel { for (String datarenderers : feature.<List<String>>getParameter("datarenderers").getValue()) { if (0 <= selectedX && selectedX <= hamburgerWidth+11 && currentlySelected != null) { - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(currentlySelected); + IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(currentlySelected); Dimension dim; if (dataRenderer == null) dim = new Dimension(0,fr.FONT_HEIGHT*2); else dim = dataRenderer.getDimension(); @@ -115,7 +116,7 @@ public class DataRendererEditor extends MPanel { } } - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); + IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); clip(scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); Dimension dim; @@ -144,7 +145,7 @@ public class DataRendererEditor extends MPanel { } if (currentlySelected != null && new Rectangle(0,5+fr.FONT_HEIGHT + 3, hamburgerWidth+11, 232).contains(selectedX, selectedY) && !drewit) { - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(currentlySelected); + IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(currentlySelected); Dimension dim; clip(scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); GlStateManager.enableBlend(); @@ -178,7 +179,7 @@ public class DataRendererEditor extends MPanel { rest.removeAll( feature.<List<String>>getParameter("datarenderers").getValue()); rest.remove(currentlySelected); for (String datarenderers : rest) { - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); + IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); clip(scissor.x + 156 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); Dimension dim; GlStateManager.enableBlend(); @@ -208,7 +209,7 @@ public class DataRendererEditor extends MPanel { if (currentlySelected != null) { GlStateManager.pushMatrix(); GlStateManager.translate(selectedX+hamburgerWidth+1, selectedY, 0); - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(currentlySelected); + IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(currentlySelected); Dimension dim; GlStateManager.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -247,7 +248,7 @@ public class DataRendererEditor extends MPanel { rest.remove(currentlySelected); int culmutativeY = -scrollY; for (String datarenderers : rest) { - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); + IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); Dimension dim; if (dataRenderer == null) { dim = new Dimension(0, fr.FONT_HEIGHT * 2); @@ -270,7 +271,7 @@ public class DataRendererEditor extends MPanel { List<String> rest = feature.<List<String>>getParameter("datarenderers").getValue(); int culmutativeY = 0; for (String datarenderers : rest) { - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); + IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); Dimension dim; if (dataRenderer == null) { dim = new Dimension(0, fr.FONT_HEIGHT * 2); @@ -317,7 +318,7 @@ public class DataRendererEditor extends MPanel { int index = asdasdkasd.size(); for (int i = 0; i <asdasdkasd.size(); i++) { String datarenderers = asdasdkasd.get(i); - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); + IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); Dimension dim; if (dataRenderer == null) { dim = new Dimension(0, fr.FONT_HEIGHT * 2); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/DataRendererRegistry.java index bf1e68ac..cbb87bca 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/DataRendererRegistry.java @@ -16,20 +16,21 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonClass; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonType; -import kr.syeyoung.dungeonsguide.features.impl.party.api.Skill; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonClass; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonType; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.Skill; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl.*; import java.util.HashMap; import java.util.Map; import java.util.Set; public class DataRendererRegistry { - private static final Map<String, DataRenderer> dataRendererMap = new HashMap<>(); + private static final Map<String, IDataRenderer> dataRendererMap = new HashMap<>(); - public static DataRenderer getDataRenderer(String id) { + public static IDataRenderer getDataRenderer(String id) { return dataRendererMap.get(id); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/IDataRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/IDataRenderer.java new file mode 100644 index 00000000..577bdcb5 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/IDataRenderer.java @@ -0,0 +1,33 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders; + +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; + +import java.awt.*; + +public interface IDataRenderer { + Dimension renderData(PlayerProfile playerProfile); + void onHover(PlayerProfile playerProfile, int mouseX, int mouseY); + + + Dimension renderDummy(); + + Dimension getDimension(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonFloorStat.java index a1b1d36b..a5b1b432 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonFloorStat.java @@ -16,11 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; + + +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonSpecificData; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonStat; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonType; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.FloorSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; @@ -29,7 +34,7 @@ import net.minecraftforge.fml.client.config.GuiUtils; import java.awt.*; import java.util.Arrays; -public class DataRenderDungeonFloorStat implements DataRenderer { +public class DataRenderDungeonFloorStat implements IDataRenderer { private final DungeonType dungeonType; private final int floor; public DataRenderDungeonFloorStat(DungeonType dungeonType, int floor) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonHighestFloorStat.java index 7ab9a396..43973c4e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonHighestFloorStat.java @@ -16,11 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; + + +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonSpecificData; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonStat; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonType; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.FloorSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; @@ -29,7 +34,7 @@ import net.minecraftforge.fml.client.config.GuiUtils; import java.awt.*; import java.util.Arrays; -public class DataRenderDungeonHighestFloorStat implements DataRenderer { +public class DataRenderDungeonHighestFloorStat implements IDataRenderer { private final DungeonType dungeonType; public DataRenderDungeonHighestFloorStat(DungeonType dungeonType) { this.dungeonType = dungeonType; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererClassLv.java index a2a468d1..0c0333df 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererClassLv.java @@ -16,15 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; + + +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; -import kr.syeyoung.dungeonsguide.features.impl.party.api.ClassSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonClass; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; @@ -33,7 +30,7 @@ import net.minecraftforge.fml.client.config.GuiUtils; import java.awt.*; import java.util.Arrays; -public class DataRendererClassLv implements DataRenderer { +public class DataRendererClassLv implements IDataRenderer { private final DungeonClass dungeonClass; public DataRendererClassLv(DungeonClass dungeonClass) { this.dungeonClass = dungeonClass; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererDungeonLv.java index cabbdc02..58bb1b0d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererDungeonLv.java @@ -16,15 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonStat; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonType; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonSpecificData; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonStat; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.DungeonType; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.utils.XPUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; @@ -33,7 +34,7 @@ import net.minecraftforge.fml.client.config.GuiUtils; import java.awt.*; import java.util.Arrays; -public class DataRendererDungeonLv implements DataRenderer { +public class DataRendererDungeonLv implements IDataRenderer { private final DungeonType dungeonType; public DataRendererDungeonLv(DungeonType dungeonType) { this.dungeonType = dungeonType; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererFairySouls.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererFairySouls.java index d9fae9d6..afaef852 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererFairySouls.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererFairySouls.java @@ -16,15 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import java.awt.*; -public class DataRendererFairySouls implements DataRenderer { +public class DataRendererFairySouls implements IDataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererLilyWeight.java index bdbd782d..3c285528 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererLilyWeight.java @@ -16,9 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; + + +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; @@ -27,7 +30,7 @@ import net.minecraftforge.fml.client.config.GuiUtils; import java.awt.*; import java.util.Arrays; -public class DataRendererLilyWeight implements DataRenderer { +public class DataRendererLilyWeight implements IDataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSecrets.java index d06039cb..ed3da2ec 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSecrets.java @@ -16,15 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import java.awt.*; -public class DataRendererSecrets implements DataRenderer { +public class DataRendererSecrets implements IDataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSelectedClassLv.java index 013193e0..f2c84de0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSelectedClassLv.java @@ -16,13 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; -import kr.syeyoung.dungeonsguide.features.impl.party.api.ClassSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.ClassSpecificData; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.utils.XPUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; @@ -31,7 +32,7 @@ import net.minecraftforge.fml.client.config.GuiUtils; import java.awt.*; import java.util.Arrays; -public class DataRendererSelectedClassLv implements DataRenderer { +public class DataRendererSelectedClassLv implements IDataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSetUrOwn.java index aaccb3ae..919201a9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSetUrOwn.java @@ -16,15 +16,16 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import java.awt.*; -public class DataRendererSetUrOwn implements DataRenderer { +public class DataRendererSetUrOwn implements IDataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSkillLv.java index 9620b883..aede6295 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSkillLv.java @@ -16,13 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.features.impl.party.api.Skill; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.Skill; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; +import kr.syeyoung.dungeonsguide.mod.utils.XPUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; @@ -31,7 +32,7 @@ import net.minecraftforge.fml.client.config.GuiUtils; import java.awt.*; import java.util.Arrays; -public class DataRendererSkillLv implements DataRenderer { +public class DataRendererSkillLv implements IDataRenderer { private final Skill skill; public DataRendererSkillLv(Skill skill) { this.skill = skill; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererTalismans.java index 5bd423ca..4bd59644 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererTalismans.java @@ -16,9 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; +package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.impl; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer; import lombok.AllArgsConstructor; import lombok.Getter; import net.minecraft.client.Minecraft; @@ -33,7 +34,7 @@ import java.awt.*; import java.util.ArrayList; import java.util.List; -public class DataRendererTalismans implements DataRenderer { +public class DataRendererTalismans implements IDataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { boolean apiDisabled = playerProfile.getTalismans() == null || playerProfile.getInventory() == null; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureActions.java index ab9fdcd9..025be04d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureActions.java @@ -16,19 +16,19 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret; + + +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRoute; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.features.text.TextHUDFeature; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -39,7 +39,7 @@ import java.util.List; public class FeatureActions extends TextHUDFeature { public FeatureActions() { - super("Dungeon Secrets", "Action Viewer", "View List of actions that needs to be taken", "secret.actionview", false, 200, getFontRenderer().FONT_HEIGHT * 10); + super("Dungeon.Secrets", "Action Viewer", "View List of actions that needs to be taken", "secret.actionview", false, 200, getFontRenderer().FONT_HEIGHT * 10); getStyles().add(new TextStyle("pathfinding", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); getStyles().add(new TextStyle("mechanic", new AColor(0x55, 0xFF,0x55,255), new AColor(0, 0,0,0), false)); @@ -52,7 +52,6 @@ public class FeatureActions extends TextHUDFeature { getStyles().add(new TextStyle("afterline", new AColor(0xAA, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); } - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @Override public boolean doesScaleWithHeight() { @@ -61,9 +60,9 @@ public class FeatureActions extends TextHUDFeature { @Override public boolean isHUDViewable() { - if (!skyblockStatus.isOnDungeon()) return false; - if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return false; - DungeonContext context = skyblockStatus.getContext(); + if (!SkyblockStatus.isOnDungeon()) return false; + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() == null || !DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getMapProcessor().isInitialized()) return false; + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); @@ -109,7 +108,7 @@ public class FeatureActions extends TextHUDFeature { public List<StyledText> getText() { List<StyledText> actualBit = new ArrayList<StyledText>(); - DungeonContext context = skyblockStatus.getContext(); + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); @@ -125,7 +124,7 @@ public class FeatureActions extends TextHUDFeature { actualBit.add(new StyledText((i == path.getCurrent() ? ">" : " ") +" ","current")); actualBit.add(new StyledText(i+"","number")); actualBit.add(new StyledText(". ","dot")); - Action action = path.getActions().get(i); + AbstractAction action = path.getActions().get(i); String[] str = action.toString().split("\n"); actualBit.add(new StyledText(str[0] + " ","action")); actualBit.add(new StyledText("(","afterline")); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureBloodRush.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureBloodRush.java index 857dc9f0..280bf56d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureBloodRush.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureBloodRush.java @@ -16,21 +16,23 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret; + + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.KeybindPressedListener; -import kr.syeyoung.dungeonsguide.features.listener.KeybindPressedListener; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.client.Minecraft; import net.minecraft.util.ChatComponentText; import org.lwjgl.input.Keyboard; public class FeatureBloodRush extends SimpleFeature implements KeybindPressedListener { public FeatureBloodRush() { - super("Dungeon Secrets.Blood Rush", "Blood Rush Mode", "Auto pathfind to witherdoors. \nCan be toggled with key set in settings", "secret.bloodrush", false); - this.parameters.put("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle Blood Rush", Keyboard.KEY_NONE, "keybind")); + super("Dungeon.Secrets.Blood Rush", "Blood Rush Mode", "Auto pathfind to witherdoors. \nCan be toggled with key set in settings", "secret.bloodrush", false); + addParameter("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle Blood Rush", Keyboard.KEY_NONE, "keybind")); } @Override @@ -38,7 +40,7 @@ public class FeatureBloodRush extends SimpleFeature implements KeybindPressedLis if (keyBindPressedEvent.getKey() == this.<Integer>getParameter("key").getValue()) { setEnabled(!isEnabled()); try { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fToggled Blood Rush to §e"+(FeatureRegistry.SECRET_BLOOD_RUSH.isEnabled() ? "on":"off"))); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §fToggled Blood Rush to §e"+(FeatureRegistry.SECRET_BLOOD_RUSH.isEnabled() ? "on":"off"))); } catch (Exception ignored) {} } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureCreateRefreshLine.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureCreateRefreshLine.java index d8e3ac2f..cea7c956 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureCreateRefreshLine.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureCreateRefreshLine.java @@ -16,27 +16,29 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret; import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; + +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MFeatureEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; + import org.lwjgl.input.Keyboard; import java.util.LinkedHashMap; public class FeatureCreateRefreshLine extends SimpleFeature { public FeatureCreateRefreshLine() { - super("Dungeon Secrets.Keybinds", "Refresh pathfind line or Trigger pathfind", "A keybind for creating or refresh pathfind lines for pathfind contexts that doesn't have line, or contexts that has refresh rate set to -1.\nPress settings to edit the key", "secret.refreshPathfind", true); + super("Dungeon.Secrets.Keybinds", "Refresh pathfind line or Trigger pathfind", "A keybind for creating or refresh pathfind lines for pathfind contexts that doesn't have line, or contexts that has refresh rate set to -1.\nPress settings to edit the key", "secret.refreshPathfind", true); this.parameters = new LinkedHashMap<>(); - this.parameters.put("key", new FeatureParameter<Integer>("key", "Key","Press to refresh or create pathfind line", Keyboard.KEY_NONE, "keybind")); - this.parameters.put("pathfind", new FeatureParameter<Boolean>("pathfind", "Enable Pathfinding", "Force Enable pathfind for future actions when used", false, "boolean")); - this.parameters.put("refreshrate", new FeatureParameter<Integer>("refreshrate", "Line Refreshrate", "Ticks to wait per line refresh, to be overriden. If the line already has pathfind enabled, this value does nothing. Specify it to -1 to don't refresh line at all", 10, "integer")); + addParameter("key", new FeatureParameter<Integer>("key", "Key","Press to refresh or create pathfind line", Keyboard.KEY_NONE, "keybind")); + addParameter("pathfind", new FeatureParameter<Boolean>("pathfind", "Enable Pathfinding", "Force Enable pathfind for future actions when used", false, "boolean")); + addParameter("refreshrate", new FeatureParameter<Integer>("refreshrate", "Line Refreshrate", "Ticks to wait per line refresh, to be overriden. If the line already has pathfind enabled, this value does nothing. Specify it to -1 to don't refresh line at all", 10, "integer")); } public int getKeybind() {return this.<Integer>getParameter("key").getValue();} public boolean isPathfind() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureFreezePathfind.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureFreezePathfind.java new file mode 100644 index 00000000..16dc46d2 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureFreezePathfind.java @@ -0,0 +1,45 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.secret; + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.KeybindPressedListener; +import net.minecraft.util.ChatComponentText; +import org.lwjgl.input.Keyboard; + +public class FeatureFreezePathfind extends SimpleFeature implements KeybindPressedListener { + public FeatureFreezePathfind() { + super("Dungeon.Secrets.Keybinds", "Global Freeze Pathfind", "Freeze Pathfind, meaning the pathfind lines won't change when you move.\nPress settings to edit the key", "secret.freezepathfind", false); + addParameter("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle freeze pathfind", Keyboard.KEY_NONE, "keybind")); + } + + @Override + public void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent) { + if (keyBindPressedEvent.getKey() == this.<Integer>getParameter("key").getValue()) { + setEnabled(!isEnabled()); + try { + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §fToggled Pathfind Freeze to §e"+(FeatureRegistry.SECRET_FREEZE_LINES.isEnabled() ? "on":"off"))); + } catch (Exception ignored) {} + } + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeaturePathfindStrategy.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeaturePathfindStrategy.java index 6e1dccbc..6358cdb6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeaturePathfindStrategy.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeaturePathfindStrategy.java @@ -16,18 +16,20 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret; import com.google.common.base.Supplier; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; + +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MFeatureEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MStringSelectionButton; + import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -37,8 +39,8 @@ import java.util.stream.Collectors; public class FeaturePathfindStrategy extends SimpleFeature { public FeaturePathfindStrategy() { - super("Dungeon Secrets", "Pathfind Algorithm", "Select pathfind algorithm used by paths", "secret.secretpathfind.algorithm", true); - this.parameters.put("strategy", new FeatureParameter<String>("strategy", "Pathfind Strategy", "Pathfind Strategy", "THETA_STAR", "string")); + super("Dungeon.Secrets.Preferences", "Pathfind Algorithm", "Select pathfind algorithm used by paths", "secret.secretpathfind.algorithm", true); + addParameter("strategy", new FeatureParameter<String>("strategy", "Pathfind Strategy", "Pathfind Strategy", "THETA_STAR", "string")); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeaturePathfindToAll.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeaturePathfindToAll.java index 886eefef..9435968f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeaturePathfindToAll.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeaturePathfindToAll.java @@ -16,18 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; public class FeaturePathfindToAll extends SimpleFeature { public FeaturePathfindToAll(){ - super("Dungeon Secrets.Pathfind To All", "Start pathfind to all secrets upon entering a room", "Auto browse to all secrets in the room", "secret.secretpathfind.allbrowse", false); - this.parameters.put("bat", new FeatureParameter<Boolean>("bat", "Trigger pathfind to Bat", "This feature will trigger pathfind to all bats in this room when entering a room", true, "boolean")); - this.parameters.put("chest", new FeatureParameter<Boolean>("chest", "Trigger pathfind to Chest", "This feature will trigger pathfind to all chests in this room when entering a room", true, "boolean")); - this.parameters.put("essence", new FeatureParameter<Boolean>("essence", "Trigger pathfind to Essence", "This feature will trigger pathfind to all essences in this room when entering a room", true, "boolean")); - this.parameters.put("itemdrop", new FeatureParameter<Boolean>("itemdrop", "Trigger pathfind to Itemdrop", "This feature will trigger pathfind to all itemdrops in this room when entering a room", true, "boolean")); + super("Dungeon.Secrets.Pathfind To All", "Start pathfind to all secrets upon entering a room", "Auto browse to all secrets in the room", "secret.secretpathfind.allbrowse", false); + addParameter("bat", new FeatureParameter<Boolean>("bat", "Trigger pathfind to Bat", "This feature will trigger pathfind to all bats in this room when entering a room", true, "boolean")); + addParameter("chest", new FeatureParameter<Boolean>("chest", "Trigger pathfind to Chest", "This feature will trigger pathfind to all chests in this room when entering a room", true, "boolean")); + addParameter("essence", new FeatureParameter<Boolean>("essence", "Trigger pathfind to Essence", "This feature will trigger pathfind to all essences in this room when entering a room", true, "boolean")); + addParameter("itemdrop", new FeatureParameter<Boolean>("itemdrop", "Trigger pathfind to Itemdrop", "This feature will trigger pathfind to all itemdrops in this room when entering a room", true, "boolean")); } public boolean isBat() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureSoulRoomWarning.java index 983674fd..ab128628 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureSoulRoomWarning.java @@ -16,33 +16,29 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret; import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonFairySoul; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.features.text.*; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.text.*; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MFeatureEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.text.*; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MPassiveLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MStringSelectionButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MToggleButton; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -59,10 +55,10 @@ import java.util.function.Predicate; public class FeatureSoulRoomWarning extends TextHUDFeature implements TickListener { public FeatureSoulRoomWarning() { - super("Dungeon.Dungeon Information","Secret Soul Alert", "Alert if there is an fairy soul in the room", "secret.fairysoulwarn", true, getFontRenderer().getStringWidth("There is a fairy soul in this room!"), getFontRenderer().FONT_HEIGHT); + super("Dungeon.HUDs","Secret Soul Alert", "Alert if there is an fairy soul in the room", "secret.fairysoulwarn", true, getFontRenderer().getStringWidth("There is a fairy soul in this room!"), getFontRenderer().FONT_HEIGHT); getStyles().add(new TextStyle("warning", new AColor(0xFF, 0x69,0x17,255), new AColor(0, 0,0,0), false)); - this.parameters.put("roomuids", new FeatureParameter("roomuids", "Disabled room Names", "Disable for these rooms", new ArrayList<>(), "stringlist")); + addParameter("roomuids", new FeatureParameter("roomuids", "Disabled room Names", "Disable for these rooms", new ArrayList<>(), "stringlist")); } SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); @@ -93,8 +89,8 @@ public class FeatureSoulRoomWarning extends TextHUDFeature implements TickListen @Override public void onTick() { if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return; - DungeonContext context = skyblockStatus.getContext(); + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() == null || !DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getMapProcessor().isInitialized()) return; + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; if (thePlayer == null) return; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureTogglePathfind.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureTogglePathfind.java index b4d41096..3256d105 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureTogglePathfind.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/FeatureTogglePathfind.java @@ -16,20 +16,22 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret; + + +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.listener.KeybindPressedListener; -import kr.syeyoung.dungeonsguide.features.listener.KeybindPressedListener; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.client.Minecraft; import net.minecraft.util.ChatComponentText; import org.lwjgl.input.Keyboard; public class FeatureTogglePathfind extends SimpleFeature implements KeybindPressedListener { public FeatureTogglePathfind() { - super("Dungeon Secrets.Keybinds", "Toggle Pathfind Lines", "A key for toggling pathfound line visibility.\nPress settings to edit the key", "secret.togglePathfind"); - this.parameters.put("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle pathfind lines", Keyboard.KEY_NONE, "keybind")); + super("Dungeon.Secrets.Keybinds", "Toggle Pathfind Lines", "A key for toggling pathfound line visibility.\nPress settings to edit the key", "secret.togglePathfind"); + addParameter("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle pathfind lines", Keyboard.KEY_NONE, "keybind")); } public boolean togglePathfindStatus = false; @@ -38,7 +40,7 @@ public class FeatureTogglePathfind extends SimpleFeature implements KeybindPress if (keyBindPressedEvent.getKey() == this.<Integer>getParameter("key").getValue() && isEnabled()) { togglePathfindStatus = !togglePathfindStatus; try { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fToggled Pathfind Line visibility to §e"+(togglePathfindStatus ? "on":"off"))); + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §fToggled Pathfind Line visibility to §e"+(togglePathfindStatus ? "on":"off"))); } catch (Exception ignored) {} } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/PathfindLineProperties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/PathfindLineProperties.java index 9405814d..0de05068 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/PathfindLineProperties.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/PathfindLineProperties.java @@ -16,18 +16,20 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret; import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; + +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MFeatureEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRouteProperties; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; + import java.util.LinkedHashMap; @@ -38,14 +40,14 @@ public class PathfindLineProperties extends SimpleFeature { this.parent = parent; this.parameters = new LinkedHashMap<>(); if (parent != null) - this.parameters.put("useGlobal", new FeatureParameter<Boolean>("useGlobal", "Use Global Settings instead of this", "Completely ignore these settings, then use the parent one:: '"+parent.getName()+"'", useParent, "boolean")); - this.parameters.put("pathfind", new FeatureParameter<Boolean>("pathfind", "Enable Pathfinding", "Enable pathfind for secrets", useParent, "boolean")); - this.parameters.put("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the pathfind line", new AColor(0xFFFF0000, true), "acolor")); - this.parameters.put("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the pathfind line",1.0f, "float")); - this.parameters.put("linerefreshrate", new FeatureParameter<Integer>("linerefreshrate", "Line Refreshrate", "Ticks to wait per line refresh. Specify it to -1 to don't refresh line at all", 10, "integer")); - this.parameters.put("beacon", new FeatureParameter<Boolean>("beacon", "Enable Beacons", "Enable beacons for pathfind line targets", true, "boolean")); - this.parameters.put("beamColor", new FeatureParameter<AColor>("beamColor", "Beam Color", "Color of the beacon beam", new AColor(0x77FF0000, true), "acolor")); - this.parameters.put("beamTargetColor", new FeatureParameter<AColor>("beamTargetColor", "Target Color", "Color of the target", new AColor(0x33FF0000, true), "acolor")); + addParameter("useGlobal", new FeatureParameter<Boolean>("useGlobal", "Use Global Settings instead of this", "Completely ignore these settings, then use the parent one:: '"+parent.getName()+"'", useParent, "boolean")); + addParameter("pathfind", new FeatureParameter<Boolean>("pathfind", "Enable Pathfinding", "Enable pathfind for secrets", useParent, "boolean")); + addParameter("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the pathfind line", new AColor(0xFFFF0000, true), "acolor")); + addParameter("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the pathfind line",1.0f, "float")); + addParameter("linerefreshrate", new FeatureParameter<Integer>("linerefreshrate", "Line Refreshrate", "Ticks to wait per line refresh. Specify it to -1 to don't refresh line at all", 10, "integer")); + addParameter("beacon", new FeatureParameter<Boolean>("beacon", "Enable Beacons", "Enable beacons for pathfind line targets", true, "boolean")); + addParameter("beamColor", new FeatureParameter<AColor>("beamColor", "Beam Color", "Color of the beacon beam", new AColor(0x77FF0000, true), "acolor")); + addParameter("beamTargetColor", new FeatureParameter<AColor>("beamTargetColor", "Target Color", "Color of the target", new AColor(0x33FF0000, true), "acolor")); } @@ -101,8 +103,8 @@ public class PathfindLineProperties extends SimpleFeature { public AColor getTargetColor() { return isGlobal() ? parent.getTargetColor() : this.<AColor>getParameter("beamTargetColor").getValue(); } - public ActionRoute.ActionRouteProperties getRouteProperties() { - ActionRoute.ActionRouteProperties actionRouteProperties = new ActionRoute.ActionRouteProperties(); + public ActionRouteProperties getRouteProperties() { + ActionRouteProperties actionRouteProperties = new ActionRouteProperties(); actionRouteProperties.setPathfind(isPathfind()); actionRouteProperties.setLineColor(getLineColor()); actionRouteProperties.setLineWidth(getLineWidth()); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java index 1979d741..f2719ae4 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java @@ -16,23 +16,22 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.GUIRectangle; -import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiPreRenderListener; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement; -import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.mod.config.types.GUIRectangle; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MFloatSelectionButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MPassiveLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.*; @@ -50,8 +49,8 @@ import java.util.List; public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderListener, GuiClickListener, WorldRenderListener { public FeatureMechanicBrowse() { - super("Dungeon Secrets.Secret Browser","Secret Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); - parameters.put("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, "float")); + super("Dungeon.Secrets.Secret Browser","Secret Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); + addParameter("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, "float")); mGuiMechanicBrowser = new MGuiMechanicBrowser(this); mGuiMechanicBrowser.setWorldAndResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); lastWidth = Minecraft.getMinecraft().displayWidth; lastHeight = Minecraft.getMinecraft().displayHeight; @@ -129,8 +128,8 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis if (!isEnabled()) return; SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return; - DungeonContext context = skyblockStatus.getContext(); + if (DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext() == null || !DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getMapProcessor().isInitialized()) return; + DungeonContext context = DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext(); EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java index 27d5e583..d7d69e0a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser; -import kr.syeyoung.dungeonsguide.gui.MGui; +import kr.syeyoung.dungeonsguide.mod.gui.MGui; import lombok.Getter; public class MGuiMechanicBrowser extends MGui { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java index a177684a..e5a2282d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java @@ -16,10 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser; + + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; import lombok.AllArgsConstructor; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java index e2a0d028..87b100a5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser; -import kr.syeyoung.dungeonsguide.gui.elements.MList; -import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MList; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTooltip; import lombok.Getter; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java index 0457a2a8..9c93531a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java @@ -16,19 +16,21 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.*; -import kr.syeyoung.dungeonsguide.gui.elements.MList; -import kr.syeyoung.dungeonsguide.gui.elements.MPanelScaledGUI; -import kr.syeyoung.dungeonsguide.gui.elements.MScrollablePanel; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; +package kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser; + + +import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; +import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; +import kr.syeyoung.dungeonsguide.mod.dungeon.actions.tree.ActionRoute; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MList; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MPanelScaledGUI; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MScrollablePanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomprocessor.GeneralRoomProcessor; + import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -72,9 +74,16 @@ public class PanelMechanicBrowser extends MPanelScaledGUI { public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { toggleTooltip(openGUI()); - Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext()) + if(Minecraft.getMinecraft().thePlayer == null) return; + + + Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext()) .map(DungeonContext::getMapProcessor).map(a->a.worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition())) - .map(a -> DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getRoomMapper().get(a)); + .map(a -> { + + return DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getRoomMapper().get(a); + }); + DungeonRoom dungeonRoom = dungeonRoomOpt.orElse(null); renderTick(dungeonRoom); @@ -235,9 +244,13 @@ public class PanelMechanicBrowser extends MPanelScaledGUI { @Getter private String selectedID = null; public void onElementClick(String id, DungeonMechanic dungeonMechanic, Point pt, MechanicBrowserElement mechanicBrowserElement) { - Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext()) + + Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext()) .map(DungeonContext::getMapProcessor).map(a->a.worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition())) - .map(a -> DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getRoomMapper().get(a)); + .map(a -> { + + return DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getRoomMapper().get(a); + }); selectedID = id; DungeonRoom dungeonRoom = dungeonRoomOpt.orElse(null); @@ -270,9 +283,13 @@ public class PanelMechanicBrowser extends MPanelScaledGUI { } public void cancel(MechanicBrowserElement mechanicBrowserElement) { - Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext()) + + Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext()) .map(DungeonContext::getMapProcessor).map(a->a.worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition())) - .map(a -> DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getRoomMapper().get(a)); + .map(a -> { + + return DungeonsGuide.getDungeonsGuide().getDungeonFacade().getContext().getRoomMapper().get(a); + }); mechanicBrowserElement.setFocused(false); if (!dungeonRoomOpt.isPresent()) return; DungeonRoom dungeonRoom = dungeonRoomOpt.get(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBlaze.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBlaze.java new file mode 100644 index 00000000..b755b94b --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBlaze.java @@ -0,0 +1,51 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; + +public class FeatureSolverBlaze extends SimpleFeature { + public FeatureSolverBlaze() { + super("Dungeon.Solvers.Floor 2+", "Blaze", "Highlights the blaze that needs to be killed in an blaze room", "solver.blaze"); + addParameter("normBlazeColor", new FeatureParameter<AColor>("blazecolor", "Normal Blaze Color", "Normal Blaze Color", new AColor(255,255,255,255), "acolor", nval -> normBlazeColor = nval)); + addParameter("nextBlazeColor", new FeatureParameter<AColor>("blazecolor", "Next Blaze Color", "Next Blaze Color", new AColor(0,255,0,255), "acolor", nval -> nextBlazeColor = nval)); + addParameter("nextUpBlazeColor", new FeatureParameter<AColor>("blazecolor", "Next Up Blaze Color", "Color of blaze after next blaze", new AColor(255,255,0,255), "acolor", nval -> nextUpBlazeColor = nval)); + addParameter("blazeborder", new FeatureParameter<AColor>("blazeborder", "Blaze Border Color", "Blaze border color", new AColor(255,255,255,0), "acolor", nval -> blazeborder = nval)); + } + + AColor normBlazeColor; + AColor nextBlazeColor; + AColor nextUpBlazeColor; + AColor blazeborder; + + public AColor getBlazeColor() { + return normBlazeColor; + } + public AColor getNextBlazeColor() { + return nextBlazeColor; + } + public AColor getNextUpBlazeColor() { + return nextUpBlazeColor; + } + public AColor getBorder() { + return blazeborder; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBombdefuse.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBombdefuse.java index e9bf623b..1eb2c930 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBombdefuse.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBombdefuse.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.solvers; +package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; import org.lwjgl.input.Keyboard; public class FeatureSolverBombdefuse extends SimpleFeature { public FeatureSolverBombdefuse() { - super("Solver.Floor 7+", "Bomb Defuse", "Communicates with others dg using key 'F' for solutions and displays it", "solver.bombdefuse"); - parameters.put("key", new FeatureParameter<Integer>("key", "Key","Press to send solution in chat", Keyboard.KEY_NONE, "keybind")); + super("Dungeon.Solvers.Floor 7+", "Bomb Defuse", "Communicates with others dg using key 'F' for solutions and displays it", "solver.bombdefuse"); + addParameter("key", new FeatureParameter<Integer>("key", "Key","Press to send solution in chat", Keyboard.KEY_NONE, "keybind")); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBox.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBox.java index c4dcebf6..0c00add5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBox.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverBox.java @@ -16,25 +16,25 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.solvers; +package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; import java.util.LinkedHashMap; public class FeatureSolverBox extends SimpleFeature { public FeatureSolverBox() { - super("Solver.Floor 3+", "Box (Advanced)", "Calculates solution for box puzzle room, and displays it to user", "solver.box"); + super("Dungeon.Solvers.Floor 3+", "Box (Advanced)", "Calculates solution for box puzzle room, and displays it to user", "solver.box"); this.parameters = new LinkedHashMap<>(); - this.parameters.put("disableText", new FeatureParameter<Boolean>("disableText", "Box Puzzle Solver Disable text", "Disable 'Type recalc to recalculate solution' showing up on top left.\nYou can still type recalc to recalc solution after disabling this feature", false, "boolean")); - this.parameters.put("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), "acolor")); - this.parameters.put("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, "float")); + addParameter("disableText", new FeatureParameter<Boolean>("disableText", "Box Puzzle Solver Disable text", "Disable 'Type recalc to recalculate solution' showing up on top left.\nYou can still type recalc to recalc solution after disabling this feature", false, "boolean")); + addParameter("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), "acolor")); + addParameter("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, "float")); - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the target button", new AColor(0x5500FFFF, true), "acolor")); - this.parameters.put("textColor1", new FeatureParameter<AColor>("textColor1", "Text Color", "Color of the text (next step)", new AColor(0xFF00FF00, true), "acolor")); - this.parameters.put("textColor2", new FeatureParameter<AColor>("textColor2", "Text Color", "Color of the text (others)", new AColor(0xFF000000, true), "acolor")); + addParameter("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the target button", new AColor(0x5500FFFF, true), "acolor")); + addParameter("textColor1", new FeatureParameter<AColor>("textColor1", "Text Color", "Color of the text (next step)", new AColor(0xFF00FF00, true), "acolor")); + addParameter("textColor2", new FeatureParameter<AColor>("textColor2", "Text Color", "Color of the text (others)", new AColor(0xFF000000, true), "acolor")); } public AColor getLineColor() { return this.<AColor>getParameter("lineColor").getValue(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverIcefill.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverIcefill.java index 681e6b12..b21a9098 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverIcefill.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverIcefill.java @@ -16,20 +16,20 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.solvers; +package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; import java.util.LinkedHashMap; public class FeatureSolverIcefill extends SimpleFeature { public FeatureSolverIcefill() { - super("Solver.Floor 3+", "Icepath (Advanced)", "Calculates solution for icepath puzzle and displays it to user", "solver.icepath"); + super("Dungeon.Solvers.Floor 3+", "Icepath (Advanced)", "Calculates solution for icepath puzzle and displays it to user", "solver.icepath"); this.parameters = new LinkedHashMap<>(); - this.parameters.put("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), "acolor")); - this.parameters.put("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, "float")); + addParameter("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), "acolor")); + addParameter("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, "float")); } public AColor getLineColor() { return this.<AColor>getParameter("lineColor").getValue(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverKahoot.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverKahoot.java index 6055c12b..fdd1ed7c 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverKahoot.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverKahoot.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.solvers; +package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; public class FeatureSolverKahoot extends SimpleFeature { public FeatureSolverKahoot() { - super("Solver.Floor 4+", "Quiz", "Highlights the correct solution for trivia puzzle", "solver.trivia"); + super("Dungeon.Solvers.Floor 4+", "Quiz", "Highlights the correct solution for trivia puzzle", "solver.trivia"); - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box", new AColor(0,255,0,50), "acolor")); + addParameter("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box", new AColor(0,255,0,50), "acolor")); } public AColor getTargetColor() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverRiddle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverRiddle.java index 23bc5a0c..da84f379 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverRiddle.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverRiddle.java @@ -16,17 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.solvers; +package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; public class FeatureSolverRiddle extends SimpleFeature { public FeatureSolverRiddle() { - super("Solver.Any Floor", "Riddle", "Highlights the correct box after clicking on all 3 weirdos", "solver.riddle"); + super("Dungeon.Solvers.Any Floor", "Riddle", "Highlights the correct box after clicking on all 3 weirdos", "solver.riddle"); - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box", new AColor(0,255,0,50), "acolor")); + addParameter("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box", new AColor(0,255,0,50), "acolor")); } public AColor getTargetColor() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverSilverfish.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverSilverfish.java index 31a4d0e6..a014b09e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverSilverfish.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverSilverfish.java @@ -16,25 +16,29 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.solvers; +package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; import java.util.LinkedHashMap; public class FeatureSolverSilverfish extends SimpleFeature { public FeatureSolverSilverfish() { - super("Solver.Floor 3+", "Silverfish (Advanced)", "Actively calculates solution for silverfish puzzle and displays it to user", "solver.silverfish"); + super("Dungeon.Solvers.Floor 3+", "Silverfish (Advanced)", "Actively calculates solution for silverfish puzzle and displays it to user", "solver.silverfish"); this.parameters = new LinkedHashMap<>(); - this.parameters.put("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), "acolor")); - this.parameters.put("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, "float")); + addParameter("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), "acolor", nval -> lineColor = nval)); + addParameter("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, "float", nval -> lineWidth = nval)); } + + AColor lineColor; + Float lineWidth; + public AColor getLineColor() { - return this.<AColor>getParameter("lineColor").getValue(); + return lineColor; } public float getLineWidth() { - return this.<Float>getParameter("lineWidth").getValue(); + return lineWidth; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverTeleport.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverTeleport.java index c7e42516..f2a6adf2 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverTeleport.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverTeleport.java @@ -16,18 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.solvers; +package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; public class FeatureSolverTeleport extends SimpleFeature { public FeatureSolverTeleport() { - super("Solver.Any Floor", "Teleport", "Shows teleport pads you've visited in a teleport maze room", "solver.teleport"); + super("Dungeon.Solvers.Any Floor", "Teleport", "Shows teleport pads you've visited in a teleport maze room", "solver.teleport"); - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Solution Color", "Color of the solution teleport pad", new AColor(0,255,0,100), "acolor")); - this.parameters.put("targetColor2", new FeatureParameter<AColor>("targetColor2", "Not-Solution Color", "Color of the solution teleport pads you've been to", new AColor(255,0,0,100), "acolor")); + addParameter("targetColor", new FeatureParameter<AColor>("targetColor", "Solution Color", "Color of the solution teleport pad", new AColor(0,255,0,100), "acolor")); + addParameter("targetColor2", new FeatureParameter<AColor>("targetColor2", "Not-Solution Color", "Color of the solution teleport pads you've been to", new AColor(255,0,0,100), "acolor")); } public AColor getTargetColor() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverTictactoe.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverTictactoe.java index 68ca4cb5..cafe97b3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverTictactoe.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/solvers/FeatureSolverTictactoe.java @@ -16,18 +16,18 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.impl.solvers; +package kr.syeyoung.dungeonsguide.mod.features.impl.solvers; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature; public class FeatureSolverTictactoe extends SimpleFeature { public FeatureSolverTictactoe() { - super("Solver.Any Floor", "Tictactoe", "Shows the best move that could be taken by player in the tictactoe room", "solver.tictactoe"); + super("Dungeon.Solvers.Any Floor", "Tictactoe", "Shows the best move that could be taken by player in the tictactoe room", "solver.tictactoe"); - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box during your turn", new AColor(0,255,255,50), "acolor")); - this.parameters.put("targetColor2", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box during enemy turn", new AColor(255,201,0,50), "acolor")); + addParameter("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box during your turn", new AColor(0,255,255,50), "acolor")); + addParameter("targetColor2", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box during enemy turn", new AColor(255,201,0,50), "acolor")); } public AColor getTargetColor() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/BossroomEnterListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/BossroomEnterListener.java new file mode 100644 index 00000000..5de1e891 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/BossroomEnterListener.java @@ -0,0 +1,23 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +public interface BossroomEnterListener { + void onBossroomEnter(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListener.java new file mode 100644 index 00000000..fae18924 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.ClientChatReceivedEvent; + +public interface ChatListener { + void onChat(ClientChatReceivedEvent clientChatReceivedEvent); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListenerGlobal.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListenerGlobal.java new file mode 100644 index 00000000..60eed29b --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ChatListenerGlobal.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.ClientChatReceivedEvent; + +public interface ChatListenerGlobal { + void onChat(ClientChatReceivedEvent clientChatReceivedEvent); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DiscordUserJoinRequestListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DiscordUserJoinRequestListener.java index 99793f69..add9e9ab 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DiscordUserJoinRequestListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DiscordUserJoinRequestListener.java @@ -16,9 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.listener; +package kr.syeyoung.dungeonsguide.mod.features.listener; + + +import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserJoinRequestEvent; -import kr.syeyoung.dungeonsguide.events.DiscordUserJoinRequestEvent; public interface DiscordUserJoinRequestListener { void onDiscordUserJoinRequest(DiscordUserJoinRequestEvent event); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DiscordUserUpdateListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DiscordUserUpdateListener.java index d376a21d..2404d960 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DiscordUserUpdateListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DiscordUserUpdateListener.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.listener; +package kr.syeyoung.dungeonsguide.mod.features.listener; -import kr.syeyoung.dungeonsguide.events.DiscordUserUpdateEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.DiscordUserUpdateEvent; public interface DiscordUserUpdateListener { void onDiscordUserUpdate(DiscordUserUpdateEvent event); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonContextInitializationListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonContextInitializationListener.java new file mode 100644 index 00000000..a234fa61 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonContextInitializationListener.java @@ -0,0 +1,23 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +public interface DungeonContextInitializationListener { + void onDungeonInitialize(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonEndListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonEndListener.java new file mode 100644 index 00000000..c9ca0caa --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonEndListener.java @@ -0,0 +1,23 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +public interface DungeonEndListener { + void onDungeonEnd(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonQuitListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonQuitListener.java new file mode 100644 index 00000000..fc0e114f --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonQuitListener.java @@ -0,0 +1,23 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +public interface DungeonQuitListener { + void onDungeonQuit(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonStartListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonStartListener.java new file mode 100644 index 00000000..d0674daf --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/DungeonStartListener.java @@ -0,0 +1,23 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +public interface DungeonStartListener { + void onDungeonStart(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/EntityLivingRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/EntityLivingRenderListener.java new file mode 100644 index 00000000..f13c29f0 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/EntityLivingRenderListener.java @@ -0,0 +1,26 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.RenderLivingEvent; + +public interface EntityLivingRenderListener { + void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent); + void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiBackgroundRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiBackgroundRenderListener.java new file mode 100644 index 00000000..abaf900c --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiBackgroundRenderListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.GuiScreenEvent; + +public interface GuiBackgroundRenderListener { + void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiClickListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiClickListener.java new file mode 100644 index 00000000..d3816c3e --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiClickListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.GuiScreenEvent; + +public interface GuiClickListener { + void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiOpenListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiOpenListener.java new file mode 100644 index 00000000..bb8b8348 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiOpenListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.GuiOpenEvent; + +public interface GuiOpenListener { + void onGuiOpen(GuiOpenEvent event); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPostRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPostRenderListener.java new file mode 100644 index 00000000..2cd249f5 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPostRenderListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.GuiScreenEvent; + +public interface GuiPostRenderListener { + void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPreRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPreRenderListener.java new file mode 100644 index 00000000..848267c3 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiPreRenderListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.GuiScreenEvent; + +public interface GuiPreRenderListener { + void onGuiPreRender(GuiScreenEvent.DrawScreenEvent.Pre rendered); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiUpdateListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiUpdateListener.java new file mode 100644 index 00000000..633f1542 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/GuiUpdateListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import kr.syeyoung.dungeonsguide.mod.events.impl.WindowUpdateEvent; + +public interface GuiUpdateListener { + void onGuiUpdate(WindowUpdateEvent windowUpdateEvent); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/InteractListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/InteractListener.java new file mode 100644 index 00000000..0dcbc19d --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/InteractListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.event.entity.player.PlayerInteractEvent; + +public interface InteractListener { + void onInteract(PlayerInteractEvent event); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeyInputListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeyInputListener.java new file mode 100644 index 00000000..bba7862b --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeyInputListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.GuiScreenEvent; + +public interface KeyInputListener { + void onKeyInput(GuiScreenEvent.KeyboardInputEvent keyboardInputEvent); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeybindPressedListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeybindPressedListener.java index 3d67e326..d0966183 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeybindPressedListener.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/KeybindPressedListener.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.listener; +package kr.syeyoung.dungeonsguide.mod.features.listener; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.KeyBindPressedEvent; public interface KeybindPressedListener { void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/PlayerRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/PlayerRenderListener.java new file mode 100644 index 00000000..40961ced --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/PlayerRenderListener.java @@ -0,0 +1,26 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.RenderPlayerEvent; + +public interface PlayerRenderListener { + void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent ); + void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent ); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ScreenRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ScreenRenderListener.java new file mode 100644 index 00000000..4a69b8eb --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/ScreenRenderListener.java @@ -0,0 +1,23 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +public interface ScreenRenderListener { + void drawScreen(float partialTicks); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockJoinListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockJoinListener.java new file mode 100644 index 00000000..d2d996e9 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockJoinListener.java @@ -0,0 +1,23 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +public interface SkyblockJoinListener { + void onSkyblockJoin(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockLeaveListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockLeaveListener.java new file mode 100644 index 00000000..e1d95775 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SkyblockLeaveListener.java @@ -0,0 +1,23 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +public interface SkyblockLeaveListener { + void onSkyblockQuit(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SoundListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SoundListener.java new file mode 100644 index 00000000..9cd4b2fe --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/SoundListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.sound.PlaySoundEvent; + +public interface SoundListener { + void onSound(PlaySoundEvent playSoundEvent); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/StompConnectedListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/StompConnectedListener.java new file mode 100644 index 00000000..3772f780 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/StompConnectedListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import kr.syeyoung.dungeonsguide.mod.events.impl.StompConnectedEvent; + +public interface StompConnectedListener { + void onStompConnected(StompConnectedEvent event); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TextureStichListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TextureStichListener.java new file mode 100644 index 00000000..5c54eb9e --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TextureStichListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.client.event.TextureStitchEvent; + +public interface TextureStichListener { + void onTextureStitch(TextureStitchEvent event); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TickListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TickListener.java new file mode 100644 index 00000000..436ea23d --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TickListener.java @@ -0,0 +1,23 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +public interface TickListener { + void onTick(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TitleListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TitleListener.java new file mode 100644 index 00000000..ec402a96 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TitleListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraft.network.play.server.S45PacketTitle; + +public interface TitleListener { + void onTitle(S45PacketTitle renderPlayerEvent); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TooltipListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TooltipListener.java new file mode 100644 index 00000000..f2f73c62 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/TooltipListener.java @@ -0,0 +1,25 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + +public interface TooltipListener { + void onTooltip(ItemTooltipEvent event); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/WorldRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/WorldRenderListener.java new file mode 100644 index 00000000..40b8e338 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/listener/WorldRenderListener.java @@ -0,0 +1,23 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.listener; + +public interface WorldRenderListener { + void drawWorld(float partialTicks); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/PanelTextParameterConfig.java index 0ded16a8..78ebc9eb 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/PanelTextParameterConfig.java @@ -16,15 +16,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.text; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MEditableAColor; -import kr.syeyoung.dungeonsguide.gui.elements.MPanelScaledGUI; -import kr.syeyoung.dungeonsguide.gui.elements.MScrollablePanel; -import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +package kr.syeyoung.dungeonsguide.mod.features.text; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MEditableAColor; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MPanelScaledGUI; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MScrollablePanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MToggleButton; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledText.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledText.java new file mode 100644 index 00000000..d9f936fa --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledText.java @@ -0,0 +1,29 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.text; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class StyledText { + private String text; + private String group; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextProvider.java new file mode 100644 index 00000000..04a4cc81 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextProvider.java @@ -0,0 +1,30 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.text; + +import java.util.List; +import java.util.Map; + +public interface StyledTextProvider { + List<StyledText> getDummyText(); + List<StyledText> getText(); + + List<TextStyle> getStyles(); + Map<String, TextStyle> getStylesMap(); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextRenderer.java index ed6cb2da..bc309045 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextRenderer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/StyledTextRenderer.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.text; +package kr.syeyoung.dungeonsguide.mod.features.text; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java index 5b709904..a3ced073 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextHUDFeature.java @@ -16,22 +16,24 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.features.text; +package kr.syeyoung.dungeonsguide.mod.features.text; import com.google.common.base.Supplier; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement; + +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MFeatureEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel; +import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location.GuiGuiLocationConfig; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.mod.features.GuiFeature; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MFloatSelectionButton; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MPassiveLabelAndElement; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MStringSelectionButton; + import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; @@ -41,9 +43,9 @@ import java.util.List; public abstract class TextHUDFeature extends GuiFeature implements StyledTextProvider { protected TextHUDFeature(String category, String name, String description, String key, boolean keepRatio, int width, int height) { super(category, name, description, key, keepRatio, width, height); - this.parameters.put("textStylesNEW", new FeatureParameter<List<TextStyle>>("textStylesNEW", "", "", new ArrayList<TextStyle>(), "list_textStyle")); - this.parameters.put("alignment", new FeatureParameter<String>("alignment", "Alignment", "Alignment", "LEFT", "string")); - this.parameters.put("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, "float")); + addParameter("textStylesNEW", new FeatureParameter<List<TextStyle>>("textStylesNEW", "", "", new ArrayList<TextStyle>(), "list_textStyle")); + addParameter("alignment", new FeatureParameter<String>("alignment", "Alignment", "Alignment", "LEFT", "string")); + addParameter("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, "float")); } @Override diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextStyle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextStyle.java new file mode 100644 index 00000000..16cb4b66 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/text/TextStyle.java @@ -0,0 +1,34 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.features.text; + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class TextStyle { + private String groupName; + private AColor color; + private AColor background; + private boolean shadow = false; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MGui.java index 8d444d39..ea43a6c1 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/MGui.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MGui.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui; +package kr.syeyoung.dungeonsguide.mod.gui; -import kr.syeyoung.dungeonsguide.gui.elements.MRootPanel; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; -import kr.syeyoung.dungeonsguide.utils.cursor.GLCursors; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MRootPanel; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.GLCursors; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -40,7 +40,7 @@ public class MGui extends GuiScreen { private final MRootPanel mainPanel = new MRootPanel(); private boolean isOpen = false; - public MGui(){ + public MGui() { try { Mouse.setNativeCursor(GLCursors.getCursor(EnumCursor.DEFAULT)); } catch (Throwable e) { @@ -54,30 +54,25 @@ public class MGui extends GuiScreen { Keyboard.enableRepeatEvents(true); isOpen = true; ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - mainPanel.setBounds(new Rectangle(0,0,Minecraft.getMinecraft().displayWidth,Minecraft.getMinecraft().displayHeight)); + mainPanel.setBounds(new Rectangle(0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight)); } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { - try { - - int i = Mouse.getEventX(); - int j = this.mc.displayHeight - Mouse.getEventY(); - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GlStateManager.pushMatrix(); - GlStateManager.disableDepth(); - GlStateManager.enableBlend(); - GlStateManager.enableAlpha(); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - GlStateManager.color(1, 1, 1, 1); - GlStateManager.scale(1.0/scaledResolution.getScaleFactor(), 1.0/scaledResolution.getScaleFactor(), 1.0d); - mainPanel.render0(1, new Point(0,0), new Rectangle(0,0,Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight), i, j, i, j, partialTicks); - GlStateManager.popMatrix(); - GlStateManager.enableBlend(); - GlStateManager.enableDepth(); - } catch (Throwable e) { - e.printStackTrace(); - } + int i = Mouse.getEventX(); + int j = this.mc.displayHeight - Mouse.getEventY(); + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + GlStateManager.pushMatrix(); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GlStateManager.color(1, 1, 1, 1); + GlStateManager.scale(1.0 / scaledResolution.getScaleFactor(), 1.0 / scaledResolution.getScaleFactor(), 1.0d); + mainPanel.render0(1, new Point(0, 0), new Rectangle(0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight), i, j, i, j, partialTicks); + GlStateManager.popMatrix(); + GlStateManager.enableBlend(); + GlStateManager.enableDepth(); GL11.glDisable(GL11.GL_SCISSOR_TEST); } @@ -91,6 +86,7 @@ public class MGui extends GuiScreen { e.printStackTrace(); } } + public void keyHeld(int keyCode, char typedChar) throws IOException { try { mainPanel.keyHeld0(typedChar, keyCode); @@ -99,6 +95,7 @@ public class MGui extends GuiScreen { e.printStackTrace(); } } + public void keyReleased(int keyCode, char typedChar) throws IOException { try { mainPanel.keyReleased0(typedChar, keyCode); @@ -113,10 +110,10 @@ public class MGui extends GuiScreen { try { super.mouseClicked(mouseX, mouseY, mouseButton); mainPanel.mouseClicked0(mouseX, mouseY - ,mouseX, mouseY, mouseButton); + , mouseX, mouseY, mouseButton); } catch (Throwable e) { if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) - e.printStackTrace(); + e.printStackTrace(); } } @@ -138,10 +135,10 @@ public class MGui extends GuiScreen { public void mouseReleased(int mouseX, int mouseY, int state) { try { mainPanel.mouseReleased0(mouseX, mouseY - ,mouseX,mouseY , state); + , mouseX, mouseY, state); } catch (Throwable e) { if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) - e.printStackTrace(); + e.printStackTrace(); } } @@ -149,17 +146,17 @@ public class MGui extends GuiScreen { public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { try { mainPanel.mouseClickMove0(mouseX, mouseY - ,mouseX ,mouseY, clickedMouseButton, timeSinceLastClick); + , mouseX, mouseY, clickedMouseButton, timeSinceLastClick); } catch (Throwable e) { if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) - e.printStackTrace(); + e.printStackTrace(); } } public void mouseMove(int mouseX, int mouseY) { try { mainPanel.mouseMoved0(mouseX, mouseY - ,mouseX ,mouseY); + , mouseX, mouseY); } catch (Throwable e) { if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) e.printStackTrace(); @@ -183,29 +180,22 @@ public class MGui extends GuiScreen { int j = this.mc.displayHeight - Mouse.getEventY(); int k = Mouse.getEventButton(); - if (Mouse.getEventButtonState()) - { - if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0) - { + if (Mouse.getEventButtonState()) { + if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0) { return; } this.eventButton = k; this.lastMouseEvent = Minecraft.getSystemTime(); this.mouseClicked(i, j, this.eventButton); - } - else if (k != -1) - { - if (this.mc.gameSettings.touchscreen && --this.touchValue > 0) - { + } else if (k != -1) { + if (this.mc.gameSettings.touchscreen && --this.touchValue > 0) { return; } this.eventButton = -1; this.mouseReleased(i, j, k); - } - else if (this.eventButton != -1 && this.lastMouseEvent > 0L) - { + } else if (this.eventButton != -1 && this.lastMouseEvent > 0L) { long l = Minecraft.getSystemTime() - this.lastMouseEvent; this.mouseClickMove(i, j, this.eventButton, l); } @@ -225,20 +215,19 @@ public class MGui extends GuiScreen { int wheel = Mouse.getEventDWheel(); if (wheel != 0) { - mainPanel.mouseScrolled0(i, j,i,j, wheel); + mainPanel.mouseScrolled0(i, j, i, j, wheel); } lastX = i; lastY = j; } catch (Throwable e) { - e.printStackTrace(); + e.printStackTrace(); } } - public void handleKeyboardInput() throws IOException - { + + public void handleKeyboardInput() throws IOException { if (!isOpen) return; - if (Keyboard.getEventKeyState()) - { + if (Keyboard.getEventKeyState()) { if (Keyboard.isRepeatEvent()) this.keyHeld(Keyboard.getEventKey(), Keyboard.getEventCharacter()); else diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MPanel.java index c61235a3..3b36a509 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MPanel.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui; +package kr.syeyoung.dungeonsguide.mod.gui; -import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; +import kr.syeyoung.dungeonsguide.mod.gui.elements.MTooltip; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MButton.java index d95e4f33..1969b8b0 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MButton.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MCollapsable.java index 99d0405d..f665ee15 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MCollapsable.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MCollapsable.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MColor.java index 91369048..490ac7fd 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MColor.java @@ -16,9 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; + + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.MPanel; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MEditableAColor.java index 3dcfa6d4..0a521eb4 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MEditableAColor.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -44,7 +44,6 @@ public class MEditableAColor extends MPanel { private Dimension size = new Dimension(20,15); @Getter - @Setter private boolean enableEdit = false; @Getter diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MFloatSelectionButton.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MFloatSelectionButton.java index 081dc0e2..5489ef9b 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MFloatSelectionButton.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MFloatSelectionButton.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; import lombok.Setter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MIntegerSelectionButton.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MIntegerSelectionButton.java index 9e72d0a7..aec4535a 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MIntegerSelectionButton.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MIntegerSelectionButton.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; import lombok.Setter; import org.lwjgl.input.Keyboard; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MKeyEditButton.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MKeyEditButton.java index 20d5fb7f..703c99a3 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MKeyEditButton.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MKeyEditButton.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MLabel.java index 6b82b90b..2c634aeb 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabel.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MLabel.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MLabelAndElement.java index 19326543..85ac2db4 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MLabelAndElement.java @@ -16,9 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; + + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.MPanel; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MList.java index cb755963..bfdcae26 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MList.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MList.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModal.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MModal.java index be2c64d6..1a2abc6e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModal.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MModal.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalConfirmation.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MModalConfirmation.java index 92f3b258..746d1afa 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalConfirmation.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MModalConfirmation.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalMessage.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MModalMessage.java index 28d23d48..1973e239 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MModalMessage.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MModalMessage.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MNavigatingPane.java index 2f5f68de..aaef805c 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MNavigatingPane.java @@ -16,10 +16,12 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; import com.google.common.base.Function; -import kr.syeyoung.dungeonsguide.gui.MPanel; + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; + import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MPanelScaledGUI.java index 9d13e5d9..0941116a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPanelScaledGUI.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MPanelScaledGUI.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MParameter.java index cd9a89e1..855c216e 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MParameter.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonParameterEdit; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.Parameter; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit; -import kr.syeyoung.dungeonsguide.roomedit.panes.DynamicEditor; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPassiveLabelAndElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MPassiveLabelAndElement.java index a1d6334b..615e8149 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPassiveLabelAndElement.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MPassiveLabelAndElement.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPopupMenu.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MPopupMenu.java index 7b728958..bc2a656b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPopupMenu.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MPopupMenu.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MPortableColorEdit.java index 4e382d58..f322caa0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MPortableColorEdit.java @@ -16,10 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; + + +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MRootPanel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MRootPanel.java index ec8bcf70..5c4f7177 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MRootPanel.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MRootPanel.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; import lombok.Getter; import lombok.Setter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MScrollBar.java index 6cb3b16d..5d844cca 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MScrollBar.java @@ -16,11 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; + + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.Gui; @@ -30,7 +30,7 @@ import java.awt.*; public class MScrollBar extends MPanel { private final Axis axis; - @Setter + @Getter private int thumbSize, max, min; @Setter diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MScrollablePanel.java index 64898fd9..c791d7a2 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollablePanel.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MScrollablePanel.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; import lombok.Getter; import net.minecraft.client.gui.Gui; import net.minecraft.util.MathHelper; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MSpacer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MSpacer.java index 11336a7c..f891946e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MSpacer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MSpacer.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import java.awt.*; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MStringSelectionButton.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MStringSelectionButton.java index 407db0df..2bce7b4c 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MStringSelectionButton.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MStringSelectionButton.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; import lombok.Setter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MTabbedPane.java index 715b6720..d669d6b4 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MTabbedPane.java @@ -16,9 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; + + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.MPanel; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MTextField.java index 3238191f..763ad3e8 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MTextField.java @@ -16,10 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; + + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MToggleButton.java index efd473c1..706eca8e 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MToggleButton.java @@ -16,10 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; + + +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MTooltip.java index 8e1a9022..d365b8c7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltip.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MTooltip.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; -import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.GuiScreen; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltipText.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MTooltipText.java index 8280546a..cfc9ab8a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTooltipText.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MTooltipText.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MValue.java index 82e60109..7f9a4bdf 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MValue.java @@ -16,12 +16,14 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.gui.elements; +package kr.syeyoung.dungeonsguide.mod.gui.elements; + + +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.EditingContext; +import kr.syeyoung.dungeonsguide.mod.gui.MPanel; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.gui.GuiDungeonValueEdit; +import kr.syeyoung.dungeonsguide.mod.dungeon.roomedit.valueedit.ValueEditOffsetPointSet; -import kr.syeyoung.dungeonsguide.roomedit.EditingContext; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit; -import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditOffsetPointSet; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.Gui; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/chat/PartyContext.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/party/PartyContext.java index 87d1a264..6cab82b3 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/chat/PartyContext.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/party/PartyContext.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.chat; +package kr.syeyoung.dungeonsguide.mod.party; import lombok.Data; import net.minecraft.client.Minecraft; @@ -34,6 +34,8 @@ public class PartyContext { private Set<String> partyModerator; private boolean isModeratorComplete; private Set<String> partyMember; private boolean isMemberComplete; + private Set<String> dgUsers; + private Set<String> partyRawMembers = new HashSet<>(); private boolean isRawMemberComplete; private Boolean allInvite; @@ -62,9 +64,16 @@ public class PartyContext { this.partyMember.add(partyMember); addRawMember(partyMember); } - public void addRawMember(String partyMember){ + + public void addDgUser(String partyMember) { + if (this.dgUsers == null) this.dgUsers = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); + this.dgUsers.add(partyMember); + } + + public void addRawMember(String partyMember) { partyRawMembers.add(partyMember); } + public void removeFromParty(String username) { if (username.equalsIgnoreCase(partyOwner)) { partyOwner = null; @@ -73,7 +82,11 @@ public class PartyContext { if (partyMember != null) partyMember.remove(username); partyRawMembers.remove(username); } - + + + public boolean isDgUser(String username) { + return dgUsers != null && dgUsers.contains(username); + } public boolean hasModerator(String username) { return partyModerator != null && partyModerator.contains(username); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/chat/PartyManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/party/PartyManager.java index 3053c74c..6e5d9aa9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/chat/PartyManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/party/PartyManager.java @@ -16,13 +16,17 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.chat; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.events.HypixelJoinedEvent; -import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; -import kr.syeyoung.dungeonsguide.stomp.*; -import kr.syeyoung.dungeonsguide.utils.TextUtils; +package kr.syeyoung.dungeonsguide.mod.party; + +import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessResult; +import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor; +import kr.syeyoung.dungeonsguide.mod.chat.ChatSubscriber; +import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; +import kr.syeyoung.dungeonsguide.mod.events.impl.HypixelJoinedEvent; +import kr.syeyoung.dungeonsguide.mod.events.impl.StompConnectedEvent; +import kr.syeyoung.dungeonsguide.mod.features.impl.advanced.FeatureTestPepole; +import kr.syeyoung.dungeonsguide.mod.stomp.*; +import kr.syeyoung.dungeonsguide.mod.utils.TextUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -35,7 +39,7 @@ import java.security.SecureRandom; import java.util.*; import java.util.function.Consumer; -public class PartyManager implements StompMessageHandler { +public class PartyManager { public static final PartyManager INSTANCE = new PartyManager(); @Getter private PartyContext partyContext; @@ -62,42 +66,48 @@ public class PartyManager implements StompMessageHandler { public PartyManager() { ChatProcessor cp = ChatProcessor.INSTANCE; // Not in Party - cp.subscribe((str, a) -> { - if (str.equals("§cYou are not currently in a party.§r") - || str.equals("§eYou left the party.§r") - || str.equals("§cYou must be in a party to join the party channel!§r") - || str.equals("§cThe party was disbanded because all invites expired and the party was empty§r") - || str.equals("§cYou are not in a party and were moved to the ALL channel.§r") - || str.startsWith("§cThe party was disbanded") - || str.endsWith("§ehas disbanded the party!§r") - || str.startsWith("§cYou are not in a party") - || str.startsWith("§eYou have been kicked from the party by ")) { - leaveParty(); - - for (Consumer<PartyContext> partyContextConsumer : partyBuiltCallback) { - try { - partyContextConsumer.accept(null); - } catch (Exception e) { - e.printStackTrace(); + cp.subscribe(new ChatSubscriber() { + @Override + public ChatProcessResult process(String str, Map<String, Object> a) { + if (str.equals("§cYou are not currently in a party.§r") + || str.equals("§eYou left the party.§r") + || str.equals("§cYou must be in a party to join the party channel!§r") + || str.equals("§cThe party was disbanded because all invites expired and the party was empty§r") + || str.equals("§cYou are not in a party and were moved to the ALL channel.§r") + || str.startsWith("§cThe party was disbanded") + || str.endsWith("§ehas disbanded the party!§r") + || str.startsWith("§cYou are not in a party") + || str.startsWith("§eYou have been kicked from the party by ")) { + PartyManager.this.leaveParty(); + + for (Consumer<PartyContext> partyContextConsumer : partyBuiltCallback) { + try { + partyContextConsumer.accept(null); + } catch (Exception e) { + e.printStackTrace(); + } } + partyBuiltCallback.clear(); + a.put("type", "notinparty"); } - partyBuiltCallback.clear(); - a.put("type", "notinparty"); + return ChatProcessResult.NONE; } - return ChatProcessResult.NONE; }); // All invite - cp.subscribe((str, a) -> { - if (str.endsWith("§aenabled All Invite§r")) { - getPartyContext(true).setAllInvite(true); - a.put("type", "allinvite_on"); - } else if (str.endsWith("§cdisabled All Invite§r") - || str.equals("§cYou are not allowed to invite players.§r")) { - getPartyContext(true).setAllInvite(false); - a.put("type", "allinvite_off"); - potentialInvitenessChange(); + cp.subscribe(new ChatSubscriber() { + @Override + public ChatProcessResult process(String str, Map<String, Object> a) { + if (str.endsWith("§aenabled All Invite§r")) { + PartyManager.this.getPartyContext(true).setAllInvite(true); + a.put("type", "allinvite_on"); + } else if (str.endsWith("§cdisabled All Invite§r") + || str.equals("§cYou are not allowed to invite players.§r")) { + PartyManager.this.getPartyContext(true).setAllInvite(false); + a.put("type", "allinvite_off"); + PartyManager.this.potentialInvitenessChange(); + } + return ChatProcessResult.NONE; } - return ChatProcessResult.NONE; }); // Member building cp.subscribe(new ChatSubscriber() { @@ -170,153 +180,159 @@ public class PartyManager implements StompMessageHandler { } }); // Player party join / leave - cp.subscribe((str ,a) -> { - if (str.endsWith("§ejoined the party.§r")) { - String username = null; - for (String s : TextUtils.stripColor(str).split(" ")) { - if (s.startsWith("[")) continue; - username = s; - break; - } - if (username != null) { - getPartyContext(true).addPartyMember(username); - } - a.put("type", "party_join"); - } else if (str.endsWith("§ehas been removed from the party.§r") - || str.endsWith("§ehas left the party.§r")) { - String username = null; - for (String s : TextUtils.stripColor(str).split(" ")) { - if (s.startsWith("[")) continue; - username = s; - break; - } - if (username != null && partyContext != null) { - getPartyContext().removeFromParty(username); - } - a.put("type", "party_leave"); - } else if (str.endsWith(" They have §r§c60 §r§eseconds to accept.§r")) { - String[] messageSplit = TextUtils.stripColor(str).split(" "); - String inviter = null; - for (String s : messageSplit) { - if (s.startsWith("[")) continue; - inviter = s; - break; - } - if (inviter != null && partyContext != null) { - if (getPartyContext().hasMember(inviter)) { - getPartyContext().setAllInvite(true); + cp.subscribe(new ChatSubscriber() { + @Override + public ChatProcessResult process(String str, Map<String, Object> a) { + if (str.endsWith("§ejoined the party.§r")) { + String username = null; + for (String s : TextUtils.stripColor(str).split(" ")) { + if (s.startsWith("[")) continue; + username = s; + break; + } + if (username != null) { + PartyManager.this.getPartyContext(true).addPartyMember(username); + } + a.put("type", "party_join"); + } else if (str.endsWith("§ehas been removed from the party.§r") + || str.endsWith("§ehas left the party.§r")) { + String username = null; + for (String s : TextUtils.stripColor(str).split(" ")) { + if (s.startsWith("[")) continue; + username = s; + break; + } + if (username != null && partyContext != null) { + PartyManager.this.getPartyContext().removeFromParty(username); + } + a.put("type", "party_leave"); + } else if (str.endsWith(" They have §r§c60 §r§eseconds to accept.§r")) { + String[] messageSplit = TextUtils.stripColor(str).split(" "); + String inviter = null; + for (String s : messageSplit) { + if (s.startsWith("[")) continue; + inviter = s; + break; + } + if (inviter != null && partyContext != null) { + if (PartyManager.this.getPartyContext().hasMember(inviter)) { + PartyManager.this.getPartyContext().setAllInvite(true); + } + } + PartyManager.this.getPartyContext(true).setPartyExistHypixel(true); + a.put("type", "party_invite_exist"); + } else if (str.equals("§cCouldn't find a player with that name!§r") || str.equals("§cYou cannot invite that player since they're not online.")) { + a.put("type", "party_invite_noexist"); + String username = Minecraft.getMinecraft().getSession().getUsername(); + if (partyContext != null && PartyManager.this.getPartyContext().hasMember(username)) { + PartyManager.this.getPartyContext().setAllInvite(true); } } - getPartyContext(true).setPartyExistHypixel(true); - a.put("type", "party_invite_exist"); - } else if (str.equals("§cCouldn't find a player with that name!§r") || str.equals("§cYou cannot invite that player since they're not online.")) { - a.put("type", "party_invite_noexist"); - String username = Minecraft.getMinecraft().getSession().getUsername(); - if (partyContext != null && getPartyContext().hasMember(username)) { - getPartyContext().setAllInvite(true); - } + return ChatProcessResult.NONE; } - return ChatProcessResult.NONE; }); // Promotion - cp.subscribe((str, a) -> { - if (str.startsWith("§eThe party was transferred to ")) { - // §eThe party was transferred to §r§b[MVP§r§f+§r§b] apotato321 §r§eby §r§a[VIP§r§6+§r§a] syeyoung§r - String[] messageSplit = TextUtils.stripColor(str.substring(31)).split(" "); - String newLeader = null; - for (String s : messageSplit) { - if (s.startsWith("[")) continue; - newLeader = s; - break; - } - String oldLeader; - boolean left= false; - if (str.endsWith("§r§eleft§r")) { - oldLeader = messageSplit[messageSplit.length-2]; - left = true; - } else { - oldLeader = messageSplit[messageSplit.length-1]; - } + cp.subscribe(new ChatSubscriber() { + @Override + public ChatProcessResult process(String str, Map<String, Object> a) { + if (str.startsWith("§eThe party was transferred to ")) { + // §eThe party was transferred to §r§b[MVP§r§f+§r§b] apotato321 §r§eby §r§a[VIP§r§6+§r§a] syeyoung§r + String[] messageSplit = TextUtils.stripColor(str.substring(31)).split(" "); + String newLeader = null; + for (String s : messageSplit) { + if (s.startsWith("[")) continue; + newLeader = s; + break; + } + String oldLeader; + boolean left = false; + if (str.endsWith("§r§eleft§r")) { + oldLeader = messageSplit[messageSplit.length - 2]; + left = true; + } else { + oldLeader = messageSplit[messageSplit.length - 1]; + } - if (oldLeader != null && newLeader != null ) { - getPartyContext(true).setPartyOwner(newLeader); - if (left) - getPartyContext(true).removeFromParty(oldLeader); - else - getPartyContext(true).addPartyModerator(oldLeader); - } - a.put("type", "party_transfer"); - potentialInvitenessChange(); - } else if (str.endsWith("§eto Party Leader§r")) { - // §a[VIP§r§6+§r§a] syeyoung§r§e has promoted §r§b[MVP§r§f+§r§b] apotato321 §r§eto Party Leader§r - String[] messageSplit = TextUtils.stripColor(str).split(" "); - String oldLeader = null; - for (String s : messageSplit) { - if (s.startsWith("[")) continue; - oldLeader = s; - break; - } - messageSplit = TextUtils.stripColor(str.substring(str.indexOf("has promoted") + 13)).split(" "); - String newLeader = null; - for (String s : messageSplit) { - if (s.startsWith("[")) continue; - newLeader = s; - break; - } + if (oldLeader != null && newLeader != null) { + PartyManager.this.getPartyContext(true).setPartyOwner(newLeader); + if (left) + PartyManager.this.getPartyContext(true).removeFromParty(oldLeader); + else + PartyManager.this.getPartyContext(true).addPartyModerator(oldLeader); + } + a.put("type", "party_transfer"); + PartyManager.this.potentialInvitenessChange(); + } else if (str.endsWith("§eto Party Leader§r")) { + // §a[VIP§r§6+§r§a] syeyoung§r§e has promoted §r§b[MVP§r§f+§r§b] apotato321 §r§eto Party Leader§r + String[] messageSplit = TextUtils.stripColor(str).split(" "); + String oldLeader = null; + for (String s : messageSplit) { + if (s.startsWith("[")) continue; + oldLeader = s; + break; + } + messageSplit = TextUtils.stripColor(str.substring(str.indexOf("has promoted") + 13)).split(" "); + String newLeader = null; + for (String s : messageSplit) { + if (s.startsWith("[")) continue; + newLeader = s; + break; + } - if (oldLeader != null && newLeader != null) { - getPartyContext(true).setPartyOwner(newLeader); - getPartyContext(true).addPartyModerator(oldLeader); - } - a.put("type", "party_transfer"); - potentialInvitenessChange(); - } else if (str.endsWith("§r§eto Party Moderator§r")) { - // §b[MVP§r§f+§r§b] apotato321§r§e has promoted §r§a[VIP§r§6+§r§a] syeyoung §r§eto Party Moderator§r - String[] messageSplit = TextUtils.stripColor(str).split(" "); - String oldLeader = null; - for (String s : messageSplit) { - if (s.startsWith("[")) continue; - oldLeader = s; - break; - } - messageSplit = TextUtils.stripColor(str.substring(str.indexOf("has promoted") + 13)).split(" "); - String newModerator = null; - for (String s : messageSplit) { - if (s.startsWith("[")) continue; - newModerator = s; - break; - } + if (oldLeader != null && newLeader != null) { + PartyManager.this.getPartyContext(true).setPartyOwner(newLeader); + PartyManager.this.getPartyContext(true).addPartyModerator(oldLeader); + } + a.put("type", "party_transfer"); + PartyManager.this.potentialInvitenessChange(); + } else if (str.endsWith("§r§eto Party Moderator§r")) { + // §b[MVP§r§f+§r§b] apotato321§r§e has promoted §r§a[VIP§r§6+§r§a] syeyoung §r§eto Party Moderator§r + String[] messageSplit = TextUtils.stripColor(str).split(" "); + String oldLeader = null; + for (String s : messageSplit) { + if (s.startsWith("[")) continue; + oldLeader = s; + break; + } + messageSplit = TextUtils.stripColor(str.substring(str.indexOf("has promoted") + 13)).split(" "); + String newModerator = null; + for (String s : messageSplit) { + if (s.startsWith("[")) continue; + newModerator = s; + break; + } - if (oldLeader != null && newModerator != null) { - getPartyContext(true).setPartyOwner(oldLeader); - getPartyContext(true).addPartyModerator(newModerator); - } - a.put("type", "party_promotion"); - potentialInvitenessChange(); - } else if (str.endsWith("§r§eto Party Member§r")) { - String[] messageSplit = TextUtils.stripColor(str).split(" "); - String oldLeader = null; - for (String s : messageSplit) { - if (s.startsWith("[")) continue; - oldLeader = s; - break; - } - messageSplit = TextUtils.stripColor(str.substring(str.indexOf("has demoted") + 12)).split(" "); - String newMember = null; - for (String s : messageSplit) { - if (s.startsWith("[")) continue; - newMember = s; - break; - } + if (oldLeader != null && newModerator != null) { + PartyManager.this.getPartyContext(true).setPartyOwner(oldLeader); + PartyManager.this.getPartyContext(true).addPartyModerator(newModerator); + } + a.put("type", "party_promotion"); + PartyManager.this.potentialInvitenessChange(); + } else if (str.endsWith("§r§eto Party Member§r")) { + String[] messageSplit = TextUtils.stripColor(str).split(" "); + String oldLeader = null; + for (String s : messageSplit) { + if (s.startsWith("[")) continue; + oldLeader = s; + break; + } + messageSplit = TextUtils.stripColor(str.substring(str.indexOf("has demoted") + 12)).split(" "); + String newMember = null; + for (String s : messageSplit) { + if (s.startsWith("[")) continue; + newMember = s; + break; + } - if (oldLeader != null && newMember != null) { - getPartyContext(true).setPartyOwner(oldLeader); - getPartyContext(true).addPartyMember(newMember); + if (oldLeader != null && newMember != null) { + PartyManager.this.getPartyContext(true).setPartyOwner(oldLeader); + PartyManager.this.getPartyContext(true).addPartyMember(newMember); + } + a.put("type", "party_demotion"); + PartyManager.this.potentialInvitenessChange(); } - a.put("type", "party_demotion"); - potentialInvitenessChange(); + return ChatProcessResult.NONE; } - return ChatProcessResult.NONE; }); // Player Join cp.subscribe(new ChatSubscriber() { @@ -353,20 +369,24 @@ public class PartyManager implements StompMessageHandler { return ChatProcessResult.NONE; }}); // Player Join Dungon - cp.subscribe((str, a)-> { - if (str.contains("§r§ejoined the dungeon group! (§r§b")) { - String username = TextUtils.stripColor(str).split(" ")[3]; - if (username.equalsIgnoreCase(Minecraft.getMinecraft().getSession().getUsername())) { - partyContext = new PartyContext(); - requestPartyList((str2) -> { - potentialInvitenessChange(); - }); - } else { - getPartyContext(true).setMemberComplete(false); - requestPartyList((str2) -> {}); + cp.subscribe(new ChatSubscriber() { + @Override + public ChatProcessResult process(String str, Map<String, Object> a) { + if (str.contains("§r§ejoined the dungeon group! (§r§b")) { + String username = TextUtils.stripColor(str).split(" ")[3]; + if (username.equalsIgnoreCase(Minecraft.getMinecraft().getSession().getUsername())) { + partyContext = new PartyContext(); + PartyManager.this.requestPartyList((str2) -> { + PartyManager.this.potentialInvitenessChange(); + }); + } else { + PartyManager.this.getPartyContext(true).setMemberComplete(false); + PartyManager.this.requestPartyList((str2) -> { + }); + } } + return ChatProcessResult.NONE; } - return ChatProcessResult.NONE; }); } @@ -386,8 +406,7 @@ public class PartyManager implements StompMessageHandler { } askToJoinSecret = secretBuilder.toString(); - StompInterface stompInterface = DungeonsGuide.getDungeonsGuide().getStompConnection(); - stompInterface.send(new StompPayload().payload(new JSONObject().put("secret", askToJoinSecret).toString()).header("destination", "/app/party.setjoinsecret")); + StompManager.getInstance().send(new StompPayload().payload(new JSONObject().put("secret", askToJoinSecret).toString()).destination("/app/party.setjoinsecret")); } public static ChatSubscriber dashShredder() { @@ -429,8 +448,7 @@ public class PartyManager implements StompMessageHandler { if (getPartyContext().getPartyID() != null) { JSONObject object = new JSONObject(); object.put("partyid", getPartyContext().getPartyID()); - StompInterface stompInterface = DungeonsGuide.getDungeonsGuide().getStompConnection(); - stompInterface.send(new StompPayload().payload(object.toString()).header("destination", "/app/party.leave")); + StompManager.getInstance().send(new StompPayload().payload(object.toString()).destination( "/app/party.leave")); } } @@ -451,8 +469,7 @@ public class PartyManager implements StompMessageHandler { } JSONObject object = new JSONObject(); object.put("members", jsonArray); - StompInterface stompInterface = DungeonsGuide.getDungeonsGuide().getStompConnection(); - stompInterface.send(new StompPayload().payload(object.toString()).header("destination", "/app/party.join")); + StompManager.getInstance().send(new StompPayload().payload(object.toString()).destination("/app/party.join")); getPartyContext().setPartyID("!@#!@#!@#..........FETCHING..........$!@$!@$!@$"+UUID.randomUUID().toString()); } @@ -496,51 +513,77 @@ public class PartyManager implements StompMessageHandler { private Map<String, Long> playerInvAntiSpam = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - @Override - public void handle(StompInterface stompInterface, StompPayload stompPayload) { - JSONObject object = new JSONObject(stompPayload.payload()); - if ("/user/queue/party.check".equals(stompPayload.headers().get("destination"))) { + @SubscribeEvent + public void stompConnect(StompConnectedEvent event) { + + event.getStompInterface().subscribe("/user/queue/party.resp", (stompClient ,payload) -> { + JSONObject object = new JSONObject(payload); + + String str = object.getString("status"); + if ("success".equals(str) && partyContext != null) { + getPartyContext().setPartyID(object.getString("partyId")); + if (askToJoinSecret != null) { + updateAskToJoin(); + } + } else if (partyContext != null){ + getPartyContext().setPartyID(null); + } + }); + + event.getStompInterface().subscribe("/user/queue/party.check", (stompClient ,payload) -> { + JSONObject object = new JSONObject(payload); String playerName = object.getString("player"); String token = object.getString("token"); if (partyContext == null) { requestPartyList((pc) -> { boolean contains = pc.getPartyRawMembers().contains(playerName); if (!contains) { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "failure").put("token", token).toString()).header("destination", "/app/party.check.resp")); + StompManager.getInstance().send(new StompPayload().payload(new JSONObject().put("status", "failure").put("token", token).toString()).destination("/app/party.check.resp")); } else { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "success").put("token", token).toString()).header("destination", "/app/party.check.resp")); + StompManager.getInstance().send(new StompPayload().payload(new JSONObject().put("status", "success").put("token", token).toString()).destination("/app/party.check.resp")); } }); } else { if (getPartyContext().getPartyRawMembers().contains(playerName)) { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "success").put("token", token).toString()).header("destination", "/app/party.check.resp")); + StompManager.getInstance().send(new StompPayload().payload(new JSONObject().put("status", "success").put("token", token).toString()).destination("/app/party.check.resp")); } else if (getPartyContext().isMemberComplete() && getPartyContext().isModeratorComplete() && getPartyContext().getPartyOwner() != null) { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "failure").put("token", token).toString()).header("destination", "/app/party.check.resp")); + StompManager.getInstance().send(new StompPayload().payload(new JSONObject().put("status", "failure").put("token", token).toString()).destination("/app/party.check.resp")); } else { requestPartyList((pc) -> { boolean contains = pc.getPartyRawMembers().contains(playerName); if (!contains) { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "failure").put("token", token).toString()).header("destination", "/app/party.check.resp")); + StompManager.getInstance().send(new StompPayload().payload(new JSONObject().put("status", "failure").put("token", token).toString()).destination("/app/party.check.resp")); } else { - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "success").put("token", token).toString()).header("destination", "/app/party.check.resp")); + StompManager.getInstance().send(new StompPayload().payload(new JSONObject().put("status", "success").put("token", token).toString()).destination("/app/party.check.resp")); } }); } } - } else if ("/user/queue/party.broadcast".equals(stompPayload.headers().get("destination"))) { - try { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: Message Broadcasted from player:: \n" + new JSONObject(stompPayload.payload()).getString("payload"))); - } catch (Exception e) { - e.printStackTrace(); + }); + event.getStompInterface().subscribe("/user/queue/party.broadcast", (stompClient ,payload) -> { + String broadCastPlayload = new JSONObject(payload).getString("payload"); + System.out.println("Received broadcast"); + if(broadCastPlayload.startsWith("C:")) { + FeatureTestPepole.handlePartyBroadCast(broadCastPlayload); + }else { + try { + ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: Message Broadcasted from player:: \n" + new JSONObject(payload).getString("payload"))); + } catch (Exception e) { + e.printStackTrace(); + } } - } else if ("/user/queue/party.join".equals(stompPayload.headers().get("destination"))) { + }); + event.getStompInterface().subscribe("/user/queue/party.join", (stompClient ,payload) -> { + JSONObject object = new JSONObject(payload); String playerName = object.getString("player"); String secret = object.getString("secret"); if (secret.equals(askToJoinSecret) && partyContext != null && getPartyContext().getPartyRawMembers().size() < maxParty && playerInvAntiSpam.getOrDefault(playerName, 0L) < System.currentTimeMillis() - 5000) { playerInvAntiSpam.put(playerName, System.currentTimeMillis()); ChatProcessor.INSTANCE.addToChatQueue("/p invite "+playerName,() -> {}, true); } - } else if ("/user/queue/party.askedtojoin.resp".equals(stompPayload.headers().get("destination"))) { + }); + event.getStompInterface().subscribe("/user/queue/party.askedtojoin.resp", (stompClient ,payload) -> { + JSONObject object = new JSONObject(payload); String invFrom = object.getString("username"); String token2 = object.getString("token"); if (!token2.equals(lastToken)) return; @@ -562,31 +605,9 @@ public class PartyManager implements StompMessageHandler { } return ChatProcessResult.NONE; }); - } else { - String str = object.getString("status"); - if ("success".equals(str) && partyContext != null) { - getPartyContext().setPartyID(object.getString("partyId")); - if (askToJoinSecret != null) { - updateAskToJoin(); - } - } else if (partyContext != null){ - getPartyContext().setPartyID(null); - } - } - } + }); + - @SubscribeEvent - public void stompConnect(StompConnectedEvent stompConnectedEvent) { - stompConnectedEvent.getStompInterface().subscribe(StompSubscription.builder() - .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/user/queue/party.resp").build()); - stompConnectedEvent.getStompInterface().subscribe(StompSubscription.builder() - .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/user/queue/party.check").build()); - stompConnectedEvent.getStompInterface().subscribe(StompSubscription.builder() - .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/user/queue/party.broadcast").build()); - stompConnectedEvent.getStompInterface().subscribe(StompSubscription.builder() - .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/user/queue/party.join").build()); - stompConnectedEvent.getStompInterface().subscribe(StompSubscription.builder() - .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/user/queue/party.askedtojoin.resp").build()); } private String lastToken; @@ -594,8 +615,8 @@ public class PartyManager implements StompMessageHandler { lastToken = secret; if (partyContext != null && getPartyContext().isPartyExistHypixel()) ChatProcessor.INSTANCE.addToChatQueue("/p leave", () -> {}, true); - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().method(StompHeader.SEND) - .header("destination", "/app/party.askedtojoin") + StompManager.getInstance().send(new StompPayload().method(StompHeader.SEND) + .destination("/app/party.askedtojoin") .payload(new JSONObject().put("token", secret).toString())); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java new file mode 100644 index 00000000..7b8c12d2 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java @@ -0,0 +1,71 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.resources; + +import kr.syeyoung.dungeonsguide.launcher.auth.ResourceManager; +import lombok.AllArgsConstructor; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.resources.data.IMetadataSection; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.util.ResourceLocation; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collections; +import java.util.Set; + +@AllArgsConstructor +public class DGTexturePack implements IResourcePack { + + + @Override + public InputStream getInputStream(ResourceLocation location) throws IOException { + InputStream inputStream = this.getClass().getResourceAsStream("/assets/dg/"+location.getResourcePath()); + if (inputStream != null) return inputStream; + return new ByteArrayInputStream(ResourceManager.getInstance().getResources().get("assets/dg/"+location.getResourcePath())); + } + + @Override + public boolean resourceExists(ResourceLocation location) { + return ResourceManager.getInstance().getResources().containsKey("assets/dg/"+location.getResourcePath()) + || this.getClass().getResourceAsStream("/assets/dg/"+location.getResourcePath()) != null; + } + + @Override + public Set<String> getResourceDomains() { + return Collections.singleton("dungeonsguide"); + } + + @Override + public <T extends IMetadataSection> T getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException { + return null; + } + + @Override + public BufferedImage getPackImage() throws IOException { + return new BufferedImage(512,512, BufferedImage.TYPE_INT_RGB); + } + + @Override + public String getPackName() { + return "Dungeons Guide Default Pack"; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/FailedWebSocketConnection.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/FailedWebSocketConnection.java new file mode 100644 index 00000000..15f79dde --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/FailedWebSocketConnection.java @@ -0,0 +1,7 @@ +package kr.syeyoung.dungeonsguide.mod.stomp; + +public class FailedWebSocketConnection extends RuntimeException{ + public FailedWebSocketConnection(String message) { + super(message); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompClient.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompClient.java new file mode 100644 index 00000000..84705a1d --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompClient.java @@ -0,0 +1,192 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.stomp; + +import lombok.Getter; +import net.minecraftforge.common.MinecraftForge; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.java_websocket.client.WebSocketClient; +import org.java_websocket.handshake.ServerHandshake; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +public class StompClient extends WebSocketClient { + + Logger logger = LogManager.getLogger("StompClient"); + public StompClient(URI serverUri, final String token) throws InterruptedException { + super(serverUri); + + + addHeader("Authorization", token); + + logger.info("connecting websocket"); + if (!connectBlocking()) { + throw new FailedWebSocketConnection("Cant connect to ws"); + } + + logger.info("connected, stomp handshake"); + while(this.stompClientStatus == StompClientStatus.CONNECTING); + logger.info("fully connected"); + } + + + @Getter + private volatile StompClientStatus stompClientStatus = StompClientStatus.CONNECTING; + + @Getter + private StompPayload errorPayload; + + private ScheduledFuture heartbeat = null; + + private static final ScheduledExecutorService ex = Executors.newScheduledThreadPool(1); + @Override + public void onOpen(ServerHandshake handshakedata) { + send(new StompPayload().method(StompHeader.CONNECT) + .header("accept-version","1.2") + .header("heart-beat", "30000,30000") + .header("host",uri.getHost()).getBuilt() + ); + } + + @Override + public void onMessage(String message) { + try { + StompPayload payload = StompPayload.parse(message); + + switch (payload.method()){ + case SEND: + case SUBSCRIBE: + case UNSUBSCRIBE: + case BEGIN: + case COMMIT: + case ABORT: + case ACK: + case NACK: + case DISCONNECT: + case STOMP: + break; + case CONNECTED: + stompClientStatus = StompClientStatus.CONNECTED; + + String serverHeartbeat = payload.headers().get("heart-beat"); + if (serverHeartbeat != null) { + int heartbeatMS = 30; + this.heartbeat = ex.scheduleAtFixedRate(() -> send("\n"), heartbeatMS-1, heartbeatMS-1, TimeUnit.SECONDS); + } + + break; + case MESSAGE: + String subscriptionName = payload.headers().get("subscription"); + int subscriptionId = Integer.parseInt(subscriptionName); + StompSubscription listener = stompSubscriptionMap.get(subscriptionId); + + listener.process(this, payload.payload()); + + break; + case RECEIPT: + String receiptId = payload.headers().get("receipt-id"); + StompPayload payload1 = receiptMap.remove(Integer.parseInt(receiptId)); + if (payload1.method() == StompHeader.DISCONNECT) { + stompClientStatus = StompClientStatus.DISCONNECTED; + close(); + } + break; + case ERROR: + errorPayload = payload; + stompClientStatus = StompClientStatus.ERROR; + this.close(); + break; + + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onClose(int code, String reason, boolean remote) { + if (heartbeat != null) heartbeat.cancel(true); + + MinecraftForge.EVENT_BUS.post(new StompDiedEvent(code, reason, remote)); + + } + + @Override + public void onError(Exception ex) { + if(ex != null){ + ex.printStackTrace(); + } + } + + + private final Map<Integer, StompSubscription> stompSubscriptionMap = new HashMap<>(); + private final Map<Integer, StompPayload> receiptMap = new HashMap<>(); + + private int idIncrement = 0; + + private void makeSureStompIsConnected() { + if (stompClientStatus != StompClientStatus.CONNECTED) throw new IllegalStateException("not connected"); + } + + public void sendfake(StompPayload payload) { + makeSureStompIsConnected(); + payload.method(StompHeader.SEND); + if (payload.headers().get("receipt") != null) + receiptMap.put(Integer.parseInt(payload.headers().get("receipt")), payload); + send(payload.getBuilt()); + } + + public void subscribe(String destination, StompSubscription listener) { + makeSureStompIsConnected(); + int id = ++idIncrement; + + send(new StompPayload() + .method(StompHeader.SUBSCRIBE) + .header("id", String.valueOf(id)) + .destination(destination) + .header("ack", "auto") + .getBuilt() + ); + + stompSubscriptionMap.put(id, listener); + } + + + public void disconnect() { + makeSureStompIsConnected(); + stompClientStatus =StompClientStatus.DISCONNECTING; + + StompPayload stompPayload = new StompPayload().method(StompHeader.DISCONNECT).header("receipt", String.valueOf(++idIncrement)); + + send(stompPayload.getBuilt()); + receiptMap.put(idIncrement, stompPayload); + } + + + public enum StompClientStatus { + CONNECTING, CONNECTED, ERROR, DISCONNECTING, DISCONNECTED + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompDiedEvent.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompDiedEvent.java new file mode 100644 index 00000000..33913424 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompDiedEvent.java @@ -0,0 +1,15 @@ +package kr.syeyoung.dungeonsguide.mod.stomp; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Data +@EqualsAndHashCode(callSuper=false) +@AllArgsConstructor +public class StompDiedEvent extends Event { + int code; + String reason; + boolean remote; +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompHeader.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompHeader.java new file mode 100644 index 00000000..7755d8a6 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompHeader.java @@ -0,0 +1,24 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.stomp; + + +public enum StompHeader { + SEND, SUBSCRIBE, UNSUBSCRIBE, BEGIN, COMMIT, ABORT, ACK, NACK, DISCONNECT, CONNECT, STOMP, CONNECTED, MESSAGE, RECEIPT, ERROR +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompInterface.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompInterface.java index a7410218..14b6d0d7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompInterface.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompInterface.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.stomp; +package kr.syeyoung.dungeonsguide.mod.stomp; public interface StompInterface { void send(StompPayload payload); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompManager.java new file mode 100644 index 00000000..37e2792e --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompManager.java @@ -0,0 +1,73 @@ +package kr.syeyoung.dungeonsguide.mod.stomp; + +import com.google.common.base.Throwables; +import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager; +import kr.syeyoung.dungeonsguide.mod.events.impl.StompConnectedEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.net.URI; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +public class StompManager { + Logger logger = LogManager.getLogger("StompManager"); + public static final String STOMP_URL = "wss://dungeons.guide/ws"; + // private String stompURL = "ws://localhost/ws"; + static StompManager instance; + + public static StompManager getInstance() { + if (instance == null) { + instance = new StompManager(); + MinecraftForge.EVENT_BUS.register(instance); + } + return instance; + } + + public void init() { + connectStomp(); + } + + private StompClient stompConnection; + + + public boolean isStompConnected(){ + if(stompConnection != null && stompConnection.getStompClientStatus() == StompClient.StompClientStatus.CONNECTED) return true; + return false; + } + + public void send(StompPayload payload){ + if(stompConnection != null){ + stompConnection.sendfake(payload); + } else { + logger.error("OOPS STOMP CONNECTION IS NULL AND SOMEONE TRIED TO SEND SOMETHING THIS SHOULD NOT HAPPEN"); + } + } + + ScheduledExecutorService ex = Executors.newSingleThreadScheduledExecutor(); + + @SubscribeEvent + public void onStompDied(StompDiedEvent event) { + logger.info("Stomp Connection closed, trying to reconnect - {} - {}", event.reason, event.code); + connectStomp(); + } + + public void connectStomp() { + ex.schedule(() -> { + if (AuthManager.getInstance().getToken() == null) return; + try { + if (stompConnection != null) { + stompConnection.disconnect(); + } + stompConnection = new StompClient(new URI(StompManager.STOMP_URL), AuthManager.getInstance().getToken()); + MinecraftForge.EVENT_BUS.post(new StompConnectedEvent(stompConnection)); + } catch (Exception e) { + logger.error("Failed to connect to Stomp with message: {}", String.valueOf(Throwables.getRootCause(e))); + } + + }, 5L, TimeUnit.SECONDS); + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompPayload.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompPayload.java index 72eac419..0e88fffb 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompPayload.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompPayload.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.stomp; +package kr.syeyoung.dungeonsguide.mod.stomp; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; import lombok.Data; import lombok.experimental.Accessors; @@ -28,7 +28,7 @@ import java.util.*; @Accessors(chain = true, fluent = true) public class StompPayload { private StompHeader method; - private Map<String, String> headers = new HashMap<String, String>(); + private Map<String, String> headers = new HashMap<>(); private String payload; public StompPayload header(String key, String value) { @@ -36,6 +36,17 @@ public class StompPayload { return this; } + + public StompPayload destination(String value){ + headers.put("destination", value); + return this; + } + + public StompPayload id(String value){ + headers.put("id", value); + return this; + } + public String getBuilt() { StringBuilder sb = new StringBuilder(); sb.append(method.name()); @@ -52,7 +63,7 @@ public class StompPayload { if (payload != null) sb.append(payload); sb.append((char) 0); - if (FeatureRegistry.DEBUG.isEnabled()) System.out.println("Sending.. "+sb.toString()); + if (FeatureRegistry.DEBUG.isEnabled()) System.out.println("Sending.. "+ sb); return sb.toString(); } @@ -62,7 +73,7 @@ public class StompPayload { Scanner scanner = new Scanner(payload); StompPayload stompPayload = new StompPayload(); stompPayload.method = StompHeader.valueOf(scanner.nextLine()); - String line = ""; + String line; while (!(line = scanner.nextLine()).isEmpty()) { int index = line.indexOf(":"); if (index == -1) throw new IllegalArgumentException("No : found in headers section"); @@ -75,7 +86,7 @@ public class StompPayload { stompPayload.headers.put(name, value); } - List<String> lines = new ArrayList<String>(); + List<String> lines = new ArrayList<>(); while (scanner.hasNextLine() && !(line = scanner.nextLine()).equals("\0")) { lines.add(line); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompSubscription.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompSubscription.java new file mode 100644 index 00000000..965eaae9 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompSubscription.java @@ -0,0 +1,6 @@ +package kr.syeyoung.dungeonsguide.mod.stomp; + +@FunctionalInterface +public interface StompSubscription { + void process(StompClient stompInterface, String stompPayload); +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/AhUtils.java index 792f5ebc..8f3d8714 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/AhUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/AhUtils.java @@ -16,37 +16,48 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; - -import java.security.*; -import java.security.cert.CertificateException; -import java.util.HashMap; -import java.util.Map; +package kr.syeyoung.dungeonsguide.mod.utils; +import com.google.common.base.Throwables; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.DungeonsGuide; +import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager; +import kr.syeyoung.dungeonsguide.launcher.auth.AuthUtil; +import kr.syeyoung.dungeonsguide.mod.events.impl.AuthChangedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; -import java.util.Timer; -import java.util.TimerTask; +import java.security.*; +import java.security.cert.CertificateException; +import java.util.*; public class AhUtils { public static volatile Map<String, AuctionData> auctions = new HashMap<String, AuctionData>(); + static Logger logger = LogManager.getLogger("AhUtils"); + public static Timer timer = new Timer(); public static int totalAuctions = 0; + @SubscribeEvent + public void onAuthChanged(AuthChangedEvent event) { + if(AuthManager.getInstance().isPlebUser()){ + registerTimer(); + } + } + public static void registerTimer() { timer.schedule(new TimerTask() { public void run() { try { AhUtils.loadAuctions(); } catch (CertificateException | NoSuchAlgorithmException | InvalidKeyException | InvalidAlgorithmParameterException | NoSuchPaddingException | BadPaddingException | KeyStoreException | IllegalBlockSizeException | KeyManagementException e) { - e.printStackTrace(); + logger.error("Error loading auctions {}", String.valueOf(Throwables.getRootCause(e))); } } }, 0L, 1800000L); @@ -56,15 +67,17 @@ public class AhUtils { try { Map<String, AuctionData> semi_auctions = new HashMap<String, AuctionData>(); -// JsonElement object = DungeonsGuide.getDungeonsGuide().getAuthenticator().getJsonSecured("https://dungeons.guide/resource/keys"); -// for (JsonElement element : object.getAsJsonArray()) { -// JsonObject object1 = element.getAsJsonObject(); -// AuctionData auctionData = new AuctionData(object1.get("id").getAsString()); -// auctionData.lowestBin = object1.get("lowestBin").getAsInt(); -// auctionData.sellPrice = object1.get("sellPrice").getAsInt(); -// auctionData.buyPrice = object1.get("buyPrice").getAsInt(); -// semi_auctions.put(auctionData.id, auctionData); -// } + + JsonElement object = AuthUtil.getJsonSecured("https://dungeons.guide/resource/keys"); + for (JsonElement element : object.getAsJsonArray()) { + JsonObject object1 = element.getAsJsonObject(); + AuctionData auctionData = new AuctionData(object1.get("id").getAsString()); + auctionData.lowestBin = object1.get("lowestBin").getAsInt(); + auctionData.sellPrice = object1.get("sellPrice").getAsInt(); + auctionData.buyPrice = object1.get("buyPrice").getAsInt(); + semi_auctions.put(auctionData.id, auctionData); + } + auctions = semi_auctions; } catch (Throwable e) { e.printStackTrace(); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/ArrayUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/ArrayUtils.java new file mode 100755 index 00000000..be5b1088 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/ArrayUtils.java @@ -0,0 +1,40 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.mod.utils; + +public class ArrayUtils { + public static int[][] rotateCounterClockwise(int[][] arr) { + int[][] res = new int[arr[0].length][arr.length]; + for(int y=0; y<arr.length; y++) { + for (int x = 0; x< arr[0].length; x++) { + res[res.length - x - 1][y] = arr[y][x]; + } + } + return res; + } + public static int[][] rotateClockwise(int[][] arr) { + int[][] res = new int[arr[0].length][arr.length]; + for(int y=0; y<arr.length; y++) { + for (int x = 0; x< arr[0].length; x++) { + res[x][res[0].length - y - 1] = arr[y][x]; + } + } + return res; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/BlockCache.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/BlockCache.java new file mode 100644 index 00000000..b8313778 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/BlockCache.java @@ -0,0 +1,50 @@ +package kr.syeyoung.dungeonsguide.mod.utils; + +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.util.BlockPos; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.jetbrains.annotations.NotNull; + +import java.util.concurrent.TimeUnit; + +public class BlockCache { + public BlockCache() { + MinecraftForge.EVENT_BUS.register(this); + } + + @SuppressWarnings("UnstableApiUsage") + private final LoadingCache<BlockPos, IBlockState> cache = CacheBuilder.newBuilder() + .maximumSize(10000) + .expireAfterWrite(3, TimeUnit.SECONDS) + .build( + new CacheLoader<BlockPos, IBlockState>() { + public IBlockState load(@NotNull BlockPos pos) { + return Minecraft.getMinecraft().theWorld.getBlockState(pos); + } + }); + + + @SuppressWarnings("UnstableApiUsage") + public IBlockState getBlockState(@NotNull BlockPos pos){ + if(FeatureRegistry.DEBUG_BLOCK_CACHING.isEnabled()){ + return cache.getUnchecked(pos); + } else { + return Minecraft.getMinecraft().theWorld.getBlockState(pos); + } + } + + + @SubscribeEvent @SuppressWarnings("UnstableApiUsage") + public void onWorldLoad(WorldEvent.Load e){ + cache.invalidateAll(); + } + + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/GlStateUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/GlStateUtils.java index 3ee44888..4fee85d0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/GlStateUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/GlStateUtils.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; +package kr.syeyoung.dungeonsguide.mod.utils; import net.minecraft.client.renderer.GlStateManager; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/MapUtils.java index 3336a6b1..31385178 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/MapUtils.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; +package kr.syeyoung.dungeonsguide.mod.utils; import lombok.Getter; import net.minecraft.block.material.MapColor; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/RenderUtils.java index fef599dc..cd700c51 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/RenderUtils.java @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; +package kr.syeyoung.dungeonsguide.mod.utils; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; +import kr.syeyoung.dungeonsguide.mod.config.types.AColor; +import kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonDoor; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/ScoreBoardUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/ScoreBoardUtils.java new file mode 100644 index 00000000..b14041e8 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/ScoreBoardUtils.java @@ -0,0 +1,58 @@ +package kr.syeyoung.dungeonsguide.mod.utils; + +import net.minecraft.client.Minecraft; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; + +import java.util.function.Consumer; + +public class ScoreBoardUtils { + + public static void forEachLine(Consumer<String> lineConsumer){ + Scoreboard scoreboard = Minecraft.getMinecraft().thePlayer.getWorldScoreboard(); + ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); + for (Score sc : scoreboard.getSortedScores(objective)) { + ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); + String line = ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()).trim(); + String stripped = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(line)); +// if (line.contains("[") && line.endsWith("❤")) { +// String name = stripped.split(" ")[stripped.split(" ").length - 2]; +// int health = Integer.parseInt(stripped.split(" ")[stripped.split(" ").length - 1]); +// if (health < lowestHealth) { +// lowestHealth = health; +// lowestHealthName = name; +// } +// } + + lineConsumer.accept(line); + + } + } + + public static void forEachLineClean(Consumer<String> lineConsumer){ + Scoreboard scoreboard = Minecraft.getMinecraft().thePlayer.getWorldScoreboard(); + ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); + for (Score sc : scoreboard.getSortedScores(objective)) { + ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); + String line = ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()).trim(); + String stripped = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(line)); +// if (line.contains("[") && line.endsWith("❤")) { +// String name = stripped.split(" ")[stripped.split(" ").length - 2]; +// int health = Integer.parseInt(stripped.split(" ")[stripped.split(" ").length - 1]); +// if (health < lowestHealth) { +// lowestHealth = health; +// lowestHealthName = name; +// } +// } + + lineConsumer.accept(stripped); + + } + } + + + + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/ShortUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/ShortUtils.java index 134f4089..9924c7cb 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/ShortUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/ShortUtils.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; +package kr.syeyoung.dungeonsguide.mod.utils; public class ShortUtils { public static short rotateCounterClockwise(short integer) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/SkyblockUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/SkyblockUtils.java index 6a349f6e..ef6050e3 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/SkyblockUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/SkyblockUtils.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; +package kr.syeyoung.dungeonsguide.mod.utils; import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TabListUtil.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TabListUtil.java new file mode 100644 index 00000000..91ccb4fd --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TabListUtil.java @@ -0,0 +1,75 @@ +package kr.syeyoung.dungeonsguide.mod.utils; + +import kr.syeyoung.dungeonsguide.mod.features.impl.dungeon.FeatureDungeonMap; +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.scoreboard.ScorePlayerTeam; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class TabListUtil { + final static Pattern tabListRegex = Pattern.compile("\\*[a-zA-Z0-9_]{2,16}\\*", Pattern.MULTILINE); + + public static List<String> getPlayersInDungeon(){ + List<String> players = new ArrayList<>(); + List<NetworkPlayerInfo> list = FeatureDungeonMap.sorter.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); + + if(list.size() >= 20){ + for (int i = 1; i < 20; i++) { + + String na = getPlayerNameWithChecks(list.get(i)); + + if(na != null){ + players.add(na); + } + } + } + + return players; + } + + /** + * We make sure that the player is alive and regex their name out + * @param networkPlayerInfo the network player info of player + * @return the username of player + */ + @Nullable + public static String getPlayerNameWithChecks(NetworkPlayerInfo networkPlayerInfo) { + String name; + if (networkPlayerInfo.getDisplayName() != null) { + name = networkPlayerInfo.getDisplayName().getFormattedText(); + } else { + name = ScorePlayerTeam.formatPlayerName( + networkPlayerInfo.getPlayerTeam(), + networkPlayerInfo.getGameProfile().getName() + ); + } + + if (name.trim().equals("§r") || name.startsWith("§r ")) return null; + + name = TextUtils.stripColor(name); + + if(name.contains("(DEAD)")) { + return null; + } + + return getString(name, tabListRegex); + } + + @Nullable + public static String getString(String name, Pattern tabListRegex) { + name = name.replace(" ", "*"); + + Matcher matcher = tabListRegex.matcher(name); + if (!matcher.find()) return null; + + name = matcher.group(0); + name = name.substring(0, name.length() - 1); + name = name.substring(1); + return name; + } +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/TextUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TextUtils.java index 846a8052..b2b16725 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/TextUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TextUtils.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; +package kr.syeyoung.dungeonsguide.mod.utils; import java.util.List; import java.util.Map; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/TimeScoreUtil.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TimeScoreUtil.java index d874de00..1d231060 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/TimeScoreUtil.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TimeScoreUtil.java @@ -16,9 +16,11 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; +package kr.syeyoung.dungeonsguide.mod.utils; + + +import kr.syeyoung.dungeonsguide.Main; -import kr.syeyoung.dungeonsguide.launcher.Main; import org.apache.commons.io.IOUtils; import java.io.IOException; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TitleRender.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TitleRender.java new file mode 100644 index 00000000..dfc0b0a1 --- /dev/null +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TitleRender.java @@ -0,0 +1,139 @@ +package kr.syeyoung.dungeonsguide.mod.utils; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.MathHelper; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.NotNull; + +/** + * STOLEN FROM VANILLA 1.8.9, DONT @ ME + * CREDS TO MOJANG AND THE CREW + */ +public class TitleRender { + + Logger logger = LogManager.getLogger("TitleRender"); + + private static TitleRender instance; + public static TitleRender getInstance() { + return instance == null ? instance = new TitleRender() : instance; + } + + private TitleRender() { + MinecraftForge.EVENT_BUS.register(this); + } + + protected static int titlesTimer; + /** + * The current title displayed + */ + protected static String displayedTitle = ""; + /** + * The current sub-title displayed + */ + protected static String displayedSubTitle = ""; + /** + * The time that the title take to fade in + */ + protected static int titleFadeIn; + /** + * The time that the title is display + */ + protected static int titleDisplayTime; + + /** + * The time that the title take to fade out + */ + protected static int titleFadeOut; + Minecraft mc = Minecraft.getMinecraft(); + + FontRenderer fontRenderer = mc.fontRendererObj; + + + @SubscribeEvent + public void onClinetTick(TickEvent.ClientTickEvent e){ + if(e.phase == TickEvent.Phase.START){ + tick(); + } + } + + @SubscribeEvent + public void onGameOverLay(RenderGameOverlayEvent.Post e){ + if (!(e.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || e.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) return; + GlStateManager.enableBlend(); + draw(e.partialTicks); + } + + + void tick(){ + if (titlesTimer > 0) { + --titlesTimer; + if (titlesTimer <= 0) { + displayedTitle = ""; + displayedSubTitle = ""; + } + } + } + + + public static void clearTitle(){ + displayedTitle = ""; + displayedSubTitle = ""; + titlesTimer = 0; + } + + + public static void displayTitle(@NotNull String title, String subTitle, int timeFadeIn, int displayTime, int timeFadeOut) { + displayedTitle = title; + displayedSubTitle = subTitle; + titleFadeIn = timeFadeIn; + titleDisplayTime = displayTime; + titleFadeOut = timeFadeOut; + titlesTimer = titleFadeIn + titleDisplayTime + titleFadeOut; + } + + void draw(float partialTicks){ + float g; + int l; + ScaledResolution scaledResolution = new ScaledResolution(mc); + int i = scaledResolution.getScaledWidth(); + int j = scaledResolution.getScaledHeight(); + if (titlesTimer > 0) { + g = titlesTimer - partialTicks; + l = 255; + if (titlesTimer > titleFadeOut + titleDisplayTime) { + float h = (float)(titleFadeIn + titleDisplayTime + titleFadeOut) - g; + l = (int)(h * 255.0f / (float)titleFadeIn); + } + if (titlesTimer <= titleFadeOut) { + float h = g; + l = (int)(h * 255.0f / (float)titleFadeOut); + } + if ((l = MathHelper.clamp_int(l, 0, 255)) > 8) { + GlStateManager.pushMatrix(); + GlStateManager.translate(i / 2, j / 2, 0.0f); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); + GlStateManager.scale(6.0f, 6.0f, 6.0f); + int m = l << 24 & 0xFF000000; + fontRenderer.drawString(displayedTitle, -fontRenderer.getStringWidth(displayedTitle) / 2, -10.0f, 0xFFFFFF | m, true); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(2.0f, 2.0f, 2.0f); + fontRenderer.drawString(displayedSubTitle, -fontRenderer.getStringWidth(displayedSubTitle) / 2, 5.0f, 0xFFFFFF | m, true); + GlStateManager.popMatrix(); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + } + } + +} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/VectorUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/VectorUtils.java index 6f667f03..d3aa4c26 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/VectorUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/VectorUtils.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; +package kr.syeyoung.dungeonsguide.mod.utils; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/XPUtils.java index 8e5bb3ad..df04bb2b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/XPUtils.java @@ -16,9 +16,9 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils; +package kr.syeyoung.dungeonsguide.mod.utils; -import kr.syeyoung.dungeonsguide.features.impl.party.api.Skill; +import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.dataclasses.Skill; import lombok.Data; import java.util.Map; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/CursorReader.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/CursorReader.java index eec09a6a..48dcc357 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/CursorReader.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/CursorReader.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils.cursor; +package kr.syeyoung.dungeonsguide.mod.utils.cursor; import com.google.common.io.LittleEndianDataInputStream; import com.twelvemonkeys.imageio.plugins.bmp.CURImageReader; @@ -25,13 +25,14 @@ import lombok.Data; import javax.imageio.ImageIO; import javax.imageio.stream.ImageInputStream; import java.awt.image.BufferedImage; -import java.io.*; +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.List; public class CursorReader { public static List<CursorData> readFromInputStream(InputStream inputStream) throws IOException { - System.out.println(inputStream); LittleEndianDataInputStream dataInputStream = new LittleEndianDataInputStream(new BufferedInputStream(inputStream)); dataInputStream.mark(Integer.MAX_VALUE); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/EnumCursor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/EnumCursor.java index 20cccef7..e7762ba5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/EnumCursor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/EnumCursor.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils.cursor; +package kr.syeyoung.dungeonsguide.mod.utils.cursor; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/Foundation.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/Foundation.java index 9eab9b84..7474c85a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/Foundation.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/Foundation.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils.cursor; +package kr.syeyoung.dungeonsguide.mod.utils.cursor; import com.sun.jna.Library; import com.sun.jna.Native; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/GLCursors.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/GLCursors.java index 9cffc8b4..5dc872e7 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/GLCursors.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/GLCursors.java @@ -16,13 +16,13 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils.cursor; +package kr.syeyoung.dungeonsguide.mod.utils.cursor; + + +import com.google.common.base.Throwables; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; -import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; @@ -44,7 +44,14 @@ import java.util.Map; import java.util.stream.Collectors; +@SuppressWarnings("unsafe") public class GLCursors { + + static Logger logger = LogManager.getLogger("DG-GlCursors"); + + @SuppressWarnings("unsafe") + static boolean verbose = false; + private static Unsafe unsafe; private static Class cursorElement; private static Constructor constructor; @@ -89,7 +96,7 @@ public class GLCursors { break; } } catch (Throwable e) { - System.out.println("Error occured while loading cursor: "+value); + if(verbose) logger.error("Error occured while loading cursor: {}", value); e.printStackTrace(); } try { @@ -107,11 +114,13 @@ public class GLCursors { CursorReader.CursorData cursorData = cursorDataList2.size() == 0 ? cursorDataList.get(0) : cursorDataList2.get(0); - System.out.println(cursorData); + if(verbose) logger.info(cursorData); bufferedImage = cursorData.getBufferedImage(); hotspotX = cursorData.getXHotSpot(); hotspotY = cursorData.getYHotSpot(); - } catch (Throwable t) {t.printStackTrace();} + } catch (Throwable t) { + if(verbose) logger.error("loading currsor failed with message, {}", String.valueOf(Throwables.getRootCause(t))); + } int width = bufferedImage == null ? 16 : bufferedImage.getWidth(); @@ -135,7 +144,7 @@ public class GLCursors { c = new Cursor(effWidth, effHeight, hotspotX, height - hotspotY - 1,1,intBuffer, null); } } catch (Throwable e) { - System.out.println("Error occured while loading cursor from resource: "+value); + if(verbose) logger.error("Error occured while loading cursor from resource: "+value); e.printStackTrace(); } if (c != null) { @@ -145,14 +154,14 @@ public class GLCursors { for (Field declaredField : cursor.getClass().getDeclaredFields()) { declaredField.setAccessible(true); Object obj = declaredField.get(cursor); - System.out.println(declaredField.getName()+": "+obj+" - "+(obj instanceof ByteBuffer)); + if(verbose) logger.info(declaredField.getName()+": "+obj+" - "+(obj instanceof ByteBuffer)); if (obj instanceof ByteBuffer) { ByteBuffer b = (ByteBuffer) declaredField.get(cursor); StringBuilder sb = new StringBuilder("Contents: "); for (int i = 0; i < b.limit(); i++) { sb.append(Integer.toHexString(b.get(i) & 0xFF)).append(" "); } - System.out.println(sb.toString()); + if(verbose) logger.info(sb.toString()); } } } catch (IllegalAccessException e) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/User32.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/User32.java index 0577ebab..dfbbc03d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/User32.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/User32.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils.cursor; +package kr.syeyoung.dungeonsguide.mod.utils.cursor; import com.sun.jna.Library; import com.sun.jna.Native; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/X11.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/X11.java index caf8ae10..dc5a8894 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/utils/cursor/X11.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/cursor/X11.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.utils.cursor; +package kr.syeyoung.dungeonsguide.mod.utils.cursor; import com.sun.jna.Library; import com.sun.jna.Native; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/wsresource/StaticResource.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/wsresource/StaticResource.java index 814fb8c8..f682513f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/wsresource/StaticResource.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/wsresource/StaticResource.java @@ -16,7 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.wsresource; +package kr.syeyoung.dungeonsguide.mod.wsresource; import lombok.Data; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/wsresource/StaticResourceCache.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/wsresource/StaticResourceCache.java index db781844..cd213115 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/wsresource/StaticResourceCache.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/wsresource/StaticResourceCache.java @@ -16,14 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package kr.syeyoung.dungeonsguide.wsresource; +package kr.syeyoung.dungeonsguide.mod.wsresource; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; -import kr.syeyoung.dungeonsguide.stomp.StompInterface; -import kr.syeyoung.dungeonsguide.stomp.StompMessageHandler; -import kr.syeyoung.dungeonsguide.stomp.StompPayload; -import kr.syeyoung.dungeonsguide.stomp.StompSubscription; +import kr.syeyoung.dungeonsguide.mod.events.impl.StompConnectedEvent; +import kr.syeyoung.dungeonsguide.mod.stomp.*; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.json.JSONObject; @@ -32,7 +28,7 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.CompletableFuture; -public class StaticResourceCache implements StompMessageHandler { +public class StaticResourceCache { public static final StaticResourceCache INSTANCE = new StaticResourceCache(); private Map<UUID, StaticResource> staticResourceMap = new HashMap<>(); @@ -48,29 +44,27 @@ public class StaticResourceCache implements StompMessageHandler { if (staticResourceMap.containsKey(resourceID)) return CompletableFuture.completedFuture(staticResourceMap.get(resourceID)); if (staticResourceRequest.containsKey(resourceID)) return staticResourceRequest.get(resourceID); - DungeonsGuide.getDungeonsGuide().getStompConnection().send(new StompPayload().header("destination", "/app/staticresource.get").payload(resourceID.toString())); + StompManager.getInstance().send(new StompPayload().destination("/app/staticresource.get").payload(resourceID.toString())); CompletableFuture<StaticResource> comp = new CompletableFuture<>(); staticResourceRequest.put(resourceID, comp); return comp; } - @Override - public void handle(StompInterface stompInterface, StompPayload stompPayload) { - JSONObject object = new JSONObject(stompPayload.payload()); - StaticResource staticResource = new StaticResource(); - staticResource.setResourceID(UUID.fromString(object.getString("resourceID"))); - staticResource.setExists(object.getBoolean("exists")); - staticResource.setValue((!object.has("value") || object.isNull("value")) ? null : object.getString("value")); + @SubscribeEvent + public void stompConnect(StompConnectedEvent event) { - staticResourceMap.put(staticResource.getResourceID(), staticResource); - CompletableFuture<StaticResource> completed = staticResourceRequest.remove(staticResource.getResourceID()); - if (completed != null) completed.complete(staticResource); - } + event.getStompInterface().subscribe("/user/queue/staticresource.get", (stompClient ,payload) -> { + JSONObject object = new JSONObject(payload); + StaticResource staticResource = new StaticResource(); + staticResource.setResourceID(UUID.fromString(object.getString("resourceID"))); + staticResource.setExists(object.getBoolean("exists")); + staticResource.setValue((!object.has("value") || object.isNull("value")) ? null : object.getString("value")); + + staticResourceMap.put(staticResource.getResourceID(), staticResource); + CompletableFuture<StaticResource> completed = staticResourceRequest.remove(staticResource.getResourceID()); + if (completed != null) completed.complete(staticResource); + }); - @SubscribeEvent - public void stompConnect(StompConnectedEvent stompConnectedEvent) { - stompConnectedEvent.getStompInterface().subscribe(StompSubscription.builder() - .stompMessageHandler(this).ackMode(StompSubscription.AckMode.AUTO).destination("/user/queue/staticresource.get").build()); getResource(BONUS_SCORE); getResource(TRIVIA_ANSWERS); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java deleted file mode 100755 index 5ca4ce69..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/Parameter.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomedit; - -import lombok.Data; - -@Data -public class Parameter { - private String name; - private Object previousData; - private Object newData; - - public Parameter(String name, Object previousData, Object newData) { - this.name = name; this.previousData = previousData; this.newData = newData; - } - - private Runnable onSetNewData; - - public void setNewData(Object newData) { - this.newData = newData; - if (onSetNewData != null) onSetNewData.run(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/DynamicEditor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/DynamicEditor.java deleted file mode 100755 index 8d3ba5e9..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/DynamicEditor.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomedit.panes; - -import kr.syeyoung.dungeonsguide.gui.elements.MParameter; - -import java.util.List; - -public interface DynamicEditor { - void delete(MParameter parameter); - - List<String> allowedClass(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEdit.java deleted file mode 100755 index 980ae947..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEdit.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.roomedit.Parameter; - -public interface ValueEdit<T extends Object> { - void setParameter(Parameter parameter); - - void renderWorld(float partialTicks); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditCreator.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditCreator.java deleted file mode 100755 index 41579f0c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditCreator.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.roomedit.Parameter; - -public interface ValueEditCreator<T extends ValueEdit> { - T createValueEdit(Parameter parameter); - - Object createDefaultValue(Parameter parameter); - - Object cloneObj(Object object); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java deleted file mode 100755 index 475a942a..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditNull.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomedit.valueedit; - -import kr.syeyoung.dungeonsguide.roomedit.Parameter; - -public class ValueEditNull implements ValueEditCreator { - @Override - public ValueEdit createValueEdit(Parameter parameter) { - return null; - } - - @Override - public Cloneable createDefaultValue(Parameter parameter) { - return null; - } - - @Override - public Object cloneObj(Object object) { - return null; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorGenerator.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorGenerator.java deleted file mode 100755 index 16fc5f23..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorGenerator.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomprocessor; - -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; - -public interface RoomProcessorGenerator<T extends RoomProcessor> { - T createNew(DungeonRoom dungeonRoom); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/BombDefuseChamberGenerator.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/BombDefuseChamberGenerator.java deleted file mode 100644 index 21cebf0c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/BombDefuseChamberGenerator.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers; - -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; - -public interface BombDefuseChamberGenerator { - boolean match(BDChamber left, BDChamber right); - - String getName(); - - ChamberProcessor createLeft(BDChamber left, RoomProcessorBombDefuseSolver solver); - ChamberProcessor createRight(BDChamber right, RoomProcessorBombDefuseSolver solver); -}
\ No newline at end of file diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/ChamberProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/ChamberProcessor.java deleted file mode 100644 index 95c33a8d..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/ChamberProcessor.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers; - -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor; -import net.minecraft.nbt.NBTTagCompound; - -public interface ChamberProcessor extends RoomProcessor { - void onDataRecieve(NBTTagCompound compound); - String getName(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/DummyDefuseChamberProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/DummyDefuseChamberProcessor.java deleted file mode 100644 index 1736f094..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bombdefuse/chambers/DummyDefuseChamberProcessor.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.chambers; - -import kr.syeyoung.dungeonsguide.roomprocessor.bombdefuse.RoomProcessorBombDefuseSolver; - -public class DummyDefuseChamberProcessor extends GeneralDefuseChamberProcessor { - public DummyDefuseChamberProcessor(RoomProcessorBombDefuseSolver solver, BDChamber chamber) { - super(solver, chamber); - } - - @Override - public String getName() { - return "dummy"; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessor.java deleted file mode 100644 index 657ab0d0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessor.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; - -import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor; - -import java.util.List; - -public interface BossfightProcessor extends RoomProcessor { - List<String> getPhases(); - String getCurrentPhase(); - List<String> getNextPhases(); - - List<HealthData> getHealths(); - - String getBossName(); -}
\ No newline at end of file diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/HealthData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/HealthData.java deleted file mode 100644 index 268a4d28..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/HealthData.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class HealthData { - private String name; - private int health; - private int maxHealth; - private boolean attackable; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/LeverState.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/LeverState.java deleted file mode 100755 index a2acd9c4..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/LeverState.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class LeverState { - private String blockId; - private boolean requiredState; - - public LeverState invert() { - return new LeverState(blockId, !requiredState); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/WaterNode.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/WaterNode.java deleted file mode 100755 index 78f3f1ca..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/waterpuzzle/WaterNode.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle; - -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -public interface WaterNode { - boolean canWaterGoThrough(); - - // condition for water go - LeverState getCondition(); - - boolean isWaterFilled(World w); - - BlockPos getBlockPos(); - - int getX(); - int getY(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/CloseListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/CloseListener.java deleted file mode 100644 index ba156b3b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/CloseListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.stomp; - -public interface CloseListener { - void onClose(int code, String reason, boolean remote); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClient.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClient.java deleted file mode 100644 index c52a2dd0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClient.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.stomp; - -import lombok.Getter; -import org.java_websocket.client.WebSocketClient; -import org.java_websocket.handshake.ServerHandshake; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - -public class StompClient extends WebSocketClient implements StompInterface { - public StompClient(URI serverUri, final String token, CloseListener closeListener) throws Exception { - super(serverUri); - this.closeListener = closeListener; - addHeader("Authorization", token); - - System.out.println("connecting websocket"); - if (!connectBlocking()) { - throw new RuntimeException("Can't connect to ws"); - } - System.out.println("connected, stomp handshake"); - while(this.stompClientStatus == StompClientStatus.CONNECTING); - System.out.println("fully connected"); - } - private final CloseListener closeListener; - - @Getter - private volatile StompClientStatus stompClientStatus = StompClientStatus.CONNECTING; - - @Getter - private StompPayload errorPayload; - - private ScheduledFuture heartbeat = null; - - private static final ScheduledExecutorService ex = Executors.newScheduledThreadPool(1); - - @Override - public void onOpen(ServerHandshake handshakedata) { - send(new StompPayload().method(StompHeader.CONNECT) - .header("accept-version","1.2") - .header("heart-beat", "30000,30000") - .header("host",uri.getHost()).getBuilt() - ); - } - - @Override - public void onMessage(String message) { - try { - StompPayload payload = StompPayload.parse(message); - if (payload.method() == StompHeader.CONNECTED) { - stompClientStatus = StompClientStatus.CONNECTED; - - String heartbeat = payload.headers().get("heart-beat"); - if (heartbeat != null) { -// int sx = Integer.parseInt(heartbeat.split(",")[0]); -// int sy = Integer.parseInt(heartbeat.split(",")[1]); -// -// if (sy == 0) return; - int heartbeatMS = 30000; - this.heartbeat = ex.scheduleAtFixedRate(() -> { - send("\n"); - }, heartbeatMS-1000, heartbeatMS-1000, TimeUnit.MILLISECONDS); - } - - } else if (payload.method() == StompHeader.ERROR) { - errorPayload = payload; - stompClientStatus = StompClientStatus.ERROR; - this.close(); - } else if (payload.method() == StompHeader.MESSAGE) { - // mesage - StompSubscription stompSubscription = stompSubscriptionMap.get(Integer.parseInt(payload.headers().get("subscription"))); - try { - stompSubscription.getStompMessageHandler().handle(this, payload); - if (stompSubscription.getAckMode() != StompSubscription.AckMode.AUTO) { - send(new StompPayload().method(StompHeader.ACK) - .header("id",payload.headers().get("ack")).getBuilt() - ); - } - } catch (Exception e) { - e.printStackTrace(); - if (stompSubscription.getAckMode() != StompSubscription.AckMode.AUTO) { - send(new StompPayload().method(StompHeader.NACK) - .header("id",payload.headers().get("ack")).getBuilt() - ); - } - } - } else if (payload.method() == StompHeader.RECEIPT) { - String receipt_id = payload.headers().get("receipt-id"); - StompPayload payload1 = receiptMap.remove(Integer.parseInt(receipt_id)); - if (payload1.method() == StompHeader.DISCONNECT) { - stompClientStatus = StompClientStatus.DISCONNECTED; - close(); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void onClose(int code, String reason, boolean remote) { - if (heartbeat != null) heartbeat.cancel(true); - closeListener.onClose(code, reason, remote); - } - - @Override - public void onError(Exception ex) { - ex.printStackTrace(); - } - - private final Map<Integer, StompSubscription> stompSubscriptionMap = new HashMap<Integer, StompSubscription>(); - private final Map<Integer, StompPayload> receiptMap = new HashMap<Integer, StompPayload>(); - - private int idIncrement = 0; - - @Override - public void send(StompPayload payload) { - if (stompClientStatus != StompClientStatus.CONNECTED) throw new IllegalStateException("not connected"); - payload.method(StompHeader.SEND); - if (payload.headers().get("receipt") != null) - receiptMap.put(Integer.parseInt(payload.headers().get("receipt")), payload); - send(payload.getBuilt()); - } - - @Override - public void subscribe(StompSubscription stompSubscription) { - if (stompClientStatus != StompClientStatus.CONNECTED) throw new IllegalStateException("not connected"); - stompSubscription.setId(++idIncrement); - - send(new StompPayload().method(StompHeader.SUBSCRIBE) - .header("id",String.valueOf(stompSubscription.getId())) - .header("destination", stompSubscription.getDestination()) - .header("ack", stompSubscription.getAckMode().getValue()).getBuilt() - ); - - stompSubscriptionMap.put(stompSubscription.getId(), stompSubscription); - } - - @Override - public void unsubscribe(StompSubscription stompSubscription) { - if (stompClientStatus != StompClientStatus.CONNECTED) throw new IllegalStateException("not connected"); - send(new StompPayload().method(StompHeader.UNSUBSCRIBE) - .header("id",String.valueOf(stompSubscription.getId())).getBuilt() - ); - stompSubscriptionMap.remove(stompSubscription.getId()); - } - - @Override - public void disconnect() { - if (stompClientStatus != StompClientStatus.CONNECTED) throw new IllegalStateException("not connected"); - StompPayload stompPayload; - stompClientStatus =StompClientStatus.DISCONNECTING; - send((stompPayload = new StompPayload().method(StompHeader.DISCONNECT) - .header("receipt", String.valueOf(++idIncrement))) - .getBuilt() - ); - receiptMap.put(idIncrement, stompPayload); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClientStatus.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClientStatus.java deleted file mode 100644 index 9839c61b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompClientStatus.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.stomp; - -public enum StompClientStatus { - CONNECTING, CONNECTED, ERROR, DISCONNECTING, DISCONNECTED -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompHeader.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompHeader.java deleted file mode 100644 index 4f00e499..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompHeader.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.stomp; - -public enum StompHeader { - SEND, SUBSCRIBE, UNSUBSCRIBE, BEGIN, COMMIT, ABORT, ACK, NACK, DISCONNECT, CONNECT, STOMP, CONNECTED, MESSAGE, RECEIPT, ERROR -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompMessageHandler.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompMessageHandler.java deleted file mode 100644 index 4610c686..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompMessageHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.stomp; - -public interface StompMessageHandler { - void handle(StompInterface stompInterface, StompPayload stompPayload); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompSubscription.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompSubscription.java deleted file mode 100644 index b6ce928e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/stomp/StompSubscription.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.stomp; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.Getter; - -@Data -@Builder -public class StompSubscription { - private int id; - private String destination; - private StompMessageHandler stompMessageHandler; - private AckMode ackMode; - - @AllArgsConstructor - public enum AckMode { - AUTO("auto"), CLIENT("client"), CLIENT_INDIVIDUAL("client-individual"); - - @Getter - private final String value; - } -} diff --git a/mod/src/main/resources/assets/dg/sounds.json b/mod/src/main/resources/assets/dg/sounds.json new file mode 100644 index 00000000..5c28a55b --- /dev/null +++ b/mod/src/main/resources/assets/dg/sounds.json @@ -0,0 +1,10 @@ +{ + "readysetgo": { + "category" : "player", + "sounds": [{ + "name": "skyblock_dungeons_guide:readysetgo", + "stream": true + } + ] + } +} diff --git a/mod/src/main/resources/assets/dg/sounds/readysetgo.ogg b/mod/src/main/resources/assets/dg/sounds/readysetgo.ogg Binary files differnew file mode 100644 index 00000000..12470b8e --- /dev/null +++ b/mod/src/main/resources/assets/dg/sounds/readysetgo.ogg diff --git a/mod/src/main/resources/assets/dg/textures/dglogox128.png b/mod/src/main/resources/assets/dg/textures/dglogox128.png Binary files differnew file mode 100644 index 00000000..3558d9da --- /dev/null +++ b/mod/src/main/resources/assets/dg/textures/dglogox128.png diff --git a/mod/src/main/resources/assets/dg/textures/dglogox32.png b/mod/src/main/resources/assets/dg/textures/dglogox32.png Binary files differnew file mode 100644 index 00000000..62962d7e --- /dev/null +++ b/mod/src/main/resources/assets/dg/textures/dglogox32.png |