diff options
author | Julian Braun <julianbraun6@gmail.com> | 2021-04-06 00:23:56 +0200 |
---|---|---|
committer | Julian Braun <julianbraun6@gmail.com> | 2021-04-06 00:23:56 +0200 |
commit | ac921e7f125b6d8f252a78c7aa666e0df74d5b1e (patch) | |
tree | fdc00310ae78dbab20fc0cd4ffc3f58742c947d4 /src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon | |
parent | dd58bd4a7705da2c97e2bbd6a5979225e5f8245d (diff) | |
download | Skyblocker-ac921e7f125b6d8f252a78c7aa666e0df74d5b1e.tar.gz Skyblocker-ac921e7f125b6d8f252a78c7aa666e0df74d5b1e.tar.bz2 Skyblocker-ac921e7f125b6d8f252a78c7aa666e0df74d5b1e.zip |
add trivia and blaze dungeon quest
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon')
4 files changed, 209 insertions, 0 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DemoBlockEntity.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DemoBlockEntity.java new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DemoBlockEntity.java diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DungeonBlaze.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DungeonBlaze.java new file mode 100644 index 00000000..4d77f734 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DungeonBlaze.java @@ -0,0 +1,125 @@ +package me.xmrvizzy.skyblocker.skyblock.dungeon; + +import java.util.List; + +import com.mojang.blaze3d.systems.RenderCall; + +import org.lwjgl.opengl.GL11; + +import me.xmrvizzy.skyblocker.utils.RenderUtils; +import me.xmrvizzy.skyblocker.utils.RenderUtilsLiving; +import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; +import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry; +import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents.AfterEntities; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents.BeforeEntities; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents.DebugRender; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents.Start; +import net.fabricmc.fabric.api.renderer.v1.RendererAccess; +import net.fabricmc.fabric.impl.client.indigo.renderer.render.BlockRenderContext; +import net.fabricmc.fabric.impl.client.rendering.WorldRenderContextImpl; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.hud.InGameHud; +import net.minecraft.client.render.BufferBuilder; +import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.Tessellator; +import net.minecraft.client.render.VertexFormats; +import net.minecraft.client.render.WorldRenderer; +import net.minecraft.client.render.block.BlockModelRenderer; +import net.minecraft.client.render.block.BlockRenderManager; +import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; +import net.minecraft.client.render.block.entity.BlockEntityRenderer; +import net.minecraft.client.render.debug.DebugRenderer; +import net.minecraft.client.render.debug.DebugRenderer.Renderer; +import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.util.math.Vector3f; +import net.minecraft.entity.Entity; +import net.minecraft.entity.mob.BlazeEntity; +import net.minecraft.text.LiteralText; +import net.minecraft.util.Formatting; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.Vec3d; + +public class DungeonBlaze { + static Entity highestBlaze = null; + static Entity lowestBlaze = null; + static boolean renderHooked = false; + private static long lastCalculationTime = 0; + private static boolean lastCalculationExists = false; + private static int lastCalculationMinX = 0; + private static int lastCalculationMinY = 0; + private static int lastCalculationWidth = 0; + private static int lastCalculationHeight = 0; + + public static void DungeonBlaze() { + MinecraftClient client = MinecraftClient.getInstance(); + if(!renderHooked){ + + WorldRenderEvents.END.register(DungeonBlaze::blazeRenderer); + MinecraftClient.getInstance().player.sendMessage(new LiteralText("--- BlazeSolver ---"), false); + MinecraftClient.getInstance().player.sendMessage(new LiteralText("Blaze Low: ").append(new LiteralText("Red").formatted(Formatting.RED)), false); + MinecraftClient.getInstance().player.sendMessage(new LiteralText("Blaze High: ").append(new LiteralText("Green").formatted(Formatting.GREEN)), false); + renderHooked = true; + } + Iterable<Entity> entities = client.world.getEntities(); + int highestHealth = 0; + int lowestHealth = 99999999; + + for (Entity entity : entities) { + //System.out.println(entity.getName().getString()); + if (entity.getName().getString().contains("Blaze") && entity.getName().getString().contains("/")) { + + String blazeName = entity.getName().getString(); + try { + + int health = Integer.parseInt(blazeName.substring(blazeName.indexOf("/") + 1, blazeName.length() - 1)); + + if (health > highestHealth) { + highestHealth = health; + + highestBlaze = entity; + + } + if (health < lowestHealth) { + lowestHealth = health; + lowestBlaze = entity; + } + } catch (NumberFormatException ex) { + ex.printStackTrace(); + } + } + } + } + public static void blazeRenderer(WorldRenderContext wrc) { + try { + TextRenderer tr = MinecraftClient.getInstance().textRenderer; + DebugRenderer wc = MinecraftClient.getInstance().debugRenderer; + + if(highestBlaze != null){ + /* Outline */ + Box blaze = highestBlaze.getBoundingBox().expand(1); + RenderUtils.drawOutlineBox(blaze, 0.0F, 1.0F, 0.0F, 1f); + } + if(lowestBlaze != null){ + + /* Outline */ + Box blaze = lowestBlaze.getBoundingBox().expand(1); + RenderUtils.drawOutlineBox(blaze, 1.0F, 0.0F, 0.0F, 1f); + } + }catch(Exception e) { + System.out.println("BlazeRenderer: " + e.getStackTrace()); + } + + } + + + + +}
\ No newline at end of file diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DungeonPuzzles.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DungeonPuzzles.java index 3fae82cd..ff03f385 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DungeonPuzzles.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DungeonPuzzles.java @@ -1,7 +1,13 @@ package me.xmrvizzy.skyblocker.skyblock.dungeon; +import java.util.HashMap; +import java.util.Map; + +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + import net.minecraft.client.MinecraftClient; import net.minecraft.entity.decoration.ArmorStandEntity; +import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -31,4 +37,82 @@ public class DungeonPuzzles { } } } + public static String[] triviaAnswers = null; + public static void trivia(String message, CallbackInfo ci){ + MinecraftClient client = MinecraftClient.getInstance(); + + + if (client.player == null && client.world == null) return; + if (message.contains("What SkyBlock year is it?")) { + double currentTime = System.currentTimeMillis() /1000L; + + double diff = Math.floor(currentTime - 1560276000); + + int year = (int) (diff / 446400 + 1); + triviaAnswers = new String[]{"Year " + year}; + }else{ + Map<String, String[]> solutions = new HashMap<>(); + solutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); + solutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); + solutions.put("What is the status of Scarf?", new String[]{"Apprentice Necromancer"}); + solutions.put("What is the status of The Professor?", new String[]{"Professor"}); + solutions.put("What is the status of Thorn?", new String[]{"Shaman Necromancer"}); + solutions.put("What is the status of Livid?", new String[]{"Master Necromancer"}); + solutions.put("What is the status of Sadan?", new String[]{"Necromancer Lord"}); + solutions.put("What is the status of Maxor?", new String[]{"Young Wither"}); + solutions.put("What is the status of Goldor?", new String[]{"Wither Soldier"}); + solutions.put("What is the status of Storm?", new String[]{"Elementalist"}); + solutions.put("What is the status of Necron?", new String[]{"Wither Lord"}); + solutions.put("How many total Fairy Souls are there?", new String[]{"220 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"17 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in The Barn?", new String[]{"7 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in Mushroom Desert?", new String[]{"8 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in Blazing Fortress?", new String[]{"19 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in The Park?", new String[]{"11 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in Jerry's Workshop?", new String[]{"5 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in Hub?", new String[]{"79 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in The Hub?", new String[]{"79 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in Deep Caverns?", new String[]{"21 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in Gold Mine?", new String[]{"12 Fairy Souls"}); + solutions.put("How many Fairy Souls are there in Dungeon Hub?", new String[]{"7 Fairy Souls"}); + solutions.put("Which brother is on the Spider's Den?", new String[]{"Rick"}); + solutions.put("What is the name of Rick's brother?", new String[]{"Pat"}); + solutions.put("What is the name of the Painter in the Hub?", new String[]{"Marco"}); + solutions.put("What is the name of the person that upgrades pets?", new String[]{"Kat"}); + solutions.put("What is the name of the lady of the Nether?", new String[]{"Elle"}); + solutions.put("Which villager in the Village gives you a Rogue Sword?", new String[]{"Jamie"}); + solutions.put("How many unique minions are there?", new String[]{"53 Minions"}); + solutions.put("Which of these enemies does not spawn in the Spider's Den?", new String[]{"Zombie Spider", "Cave Spider", "Wither Skeleton", + "Dashing Spooder", "Broodfather", "Night Spider"}); + solutions.put("Which of these monsters only spawns at night?", new String[]{"Zombie Villager", "Ghast"}); + solutions.put("Which of these is not a dragon in The End?", new String[]{"Zoomer Dragon", "Weak Dragon", "Stonk Dragon", "Holy Dragon", "Boomer Dragon", + "Booger Dragon", "Older Dragon", "Elder Dragon", "Stable Dragon", "Professor Dragon"}); + + for (String question : solutions.keySet()) { + if (message.contains(question)) { + triviaAnswers = solutions.get(question); + break; + } + } + } + + if (triviaAnswers != null && (message.contains("ⓐ") || message.contains("ⓑ") || message.contains("ⓒ"))) { + boolean isSolution = false; + for (String solution : triviaAnswers) { + if (message.contains(solution)) { + //client.player.sendMessage(new LiteralText(solution), false); + isSolution = true; + break; + } + } + if (!isSolution) { + char letter = message.charAt(5); + String option = message.substring(6); + ci.cancel(); + client.player.sendMessage(new LiteralText(" " + Formatting.GOLD + letter + Formatting.RED + option), false); + return; + } + } + } }
\ No newline at end of file diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/HitResult.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/HitResult.java new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/HitResult.java |