aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Braun <julianbraun6@gmail.com>2021-04-06 00:23:56 +0200
committerJulian Braun <julianbraun6@gmail.com>2021-04-06 00:23:56 +0200
commitac921e7f125b6d8f252a78c7aa666e0df74d5b1e (patch)
treefdc00310ae78dbab20fc0cd4ffc3f58742c947d4
parentdd58bd4a7705da2c97e2bbd6a5979225e5f8245d (diff)
downloadSkyblocker-ac921e7f125b6d8f252a78c7aa666e0df74d5b1e.tar.gz
Skyblocker-ac921e7f125b6d8f252a78c7aa666e0df74d5b1e.tar.bz2
Skyblocker-ac921e7f125b6d8f252a78c7aa666e0df74d5b1e.zip
add trivia and blaze dungeon quest
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java12
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/mixin/ChatHudListenerMixin.java2
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DemoBlockEntity.java0
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DungeonBlaze.java125
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/DungeonPuzzles.java84
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/HitResult.java0
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java11
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java199
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java138
9 files changed, 567 insertions, 4 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java
index 0d77486d..f81135de 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java
@@ -4,8 +4,11 @@ import java.util.Map;
import com.google.gson.JsonObject;
+import org.apache.commons.lang3.ObjectUtils.Null;
+
import me.xmrvizzy.skyblocker.config.SkyblockerConfig;
import me.xmrvizzy.skyblocker.skyblock.HotbarSlotLock;
+import me.xmrvizzy.skyblocker.skyblock.dungeon.DungeonBlaze;
import me.xmrvizzy.skyblocker.utils.Utils;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
@@ -29,9 +32,18 @@ public class SkyblockerMod implements ClientModInitializer {
if (client == null) return;
TICKS++;
+ if (TICKS % 4 == 0)
+ try {
+ if(Utils.isDungeons){
+ DungeonBlaze.DungeonBlaze();
+ }
+ }catch(Exception e) {
+ // do nothing :))
+ }
if (TICKS % 20 == 0) {
if (client.world != null && !client.isInSingleplayer())
Utils.sbChecker();
+
TICKS = 0;
}
}
diff --git a/src/main/java/me/xmrvizzy/skyblocker/mixin/ChatHudListenerMixin.java b/src/main/java/me/xmrvizzy/skyblocker/mixin/ChatHudListenerMixin.java
index 0e8e807f..99a4f929 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/mixin/ChatHudListenerMixin.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/mixin/ChatHudListenerMixin.java
@@ -31,6 +31,8 @@ public class ChatHudListenerMixin {
if (Utils.isDungeons) {
if (SkyblockerConfig.get().locations.dungeons.solveThreeWeirdos && msg.contains("[NPC]"))
DungeonPuzzles.threeWeirdos(msg);
+
+ DungeonPuzzles.trivia(msg, ci);
}
if (Utils.isSkyblock) {
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
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java
index c34e4136..c4c3fb9c 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/PriceInfoTooltip.java
@@ -11,6 +11,7 @@ import java.math.RoundingMode;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;
import java.util.zip.GZIPInputStream;
@@ -34,6 +35,7 @@ import me.xmrvizzy.skyblocker.SkyblockerMod;
public class PriceInfoTooltip {
private JsonObject auctionPricesJson = null;
+ private JsonObject bazaarPricesJson = null;
public static JsonObject prices = PriceInfoTooltip.downloadPrices();
public static void onInjectTooltip(ItemStack stack, TooltipContext context, List<Text> list) {
String name = getInternalNameForItem(stack);
@@ -43,9 +45,9 @@ public class PriceInfoTooltip {
if(prices != null){
JsonElement getPrice = prices.get(name);
- Double price = round(getPrice.getAsDouble(), 2);
+ String price = round(getPrice.getAsDouble(), 2);
- list.add(new LiteralText("Avg. BIN Price: ").formatted(Formatting.GOLD).append(new LiteralText(price.toString() + " Coins").formatted(Formatting.DARK_AQUA)));
+ list.add(new LiteralText("Avg. BIN Price: ").formatted(Formatting.GOLD).append(new LiteralText(price + " Coins").formatted(Formatting.DARK_AQUA)));
}
}
}catch(Exception e) {
@@ -53,12 +55,13 @@ public class PriceInfoTooltip {
}
}
- public static double round(double value, int places) {
+ public static String round(double value, int places) {
+ DecimalFormat df = new DecimalFormat("#,##0.00");
if (places < 0) throw new IllegalArgumentException();
BigDecimal bd = new BigDecimal(value);
bd = bd.setScale(places, RoundingMode.HALF_UP);
- return bd.doubleValue();
+ return df.format(bd);
}
public static String getInternalNameForItem(ItemStack stack) {
if(stack == null) return null;
diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java
new file mode 100644
index 00000000..f88accab
--- /dev/null
+++ b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtils.java
@@ -0,0 +1,199 @@
+package me.xmrvizzy.skyblocker.utils;
+
+import com.mojang.blaze3d.platform.GlStateManager;
+
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.render.*;
+import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
+import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.entity.Entity;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.Box;
+import net.minecraft.util.math.MathHelper;
+import net.minecraft.util.math.Vec3d;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
+
+public class RenderUtils {
+
+ public static void drawFilledBox(BlockPos blockPos, float r, float g, float b, float a) {
+ drawFilledBox(new Box(blockPos), r, g, b, a);
+ }
+
+ public static void drawFilledBox(Box box, float r, float g, float b, float a) {
+ gl11Setup();
+
+ // Fill
+ Tessellator tessellator = Tessellator.getInstance();
+ BufferBuilder buffer = tessellator.getBuffer();
+ buffer.begin(5, VertexFormats.POSITION_COLOR);
+ WorldRenderer.drawBox(buffer,
+ box.minX, box.minY, box.minZ,
+ box.maxX, box.maxY, box.maxZ, r, g, b, a / 2f);
+ tessellator.draw();
+
+ // Outline
+ buffer.begin(3, VertexFormats.POSITION_COLOR);
+ buffer.vertex(box.minX, box.minY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.minY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.minY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.minY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.maxY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.maxY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.minY, box.maxZ).color(r, g, b, 0f).next();
+ buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, g, b, 0f).next();
+ buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.minY, box.minZ).color(r, g, b, 0f).next();
+ buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, g, b, a).next();
+ tessellator.draw();
+
+ gl11Cleanup();
+ }
+
+ public static void drawOutlineBox(BlockPos blockPos, float r, float g, float b, float a) {
+ drawOutlineBox(new Box(blockPos), r, g, b, a);
+ }
+
+ public static void fillGradient(MatrixStack matrix, int x1, int y1, int x2, int y2, int color1, int color2) {
+ float float_1 = (color1 >> 24 & 255) / 255.0F;
+ float float_2 = (color1 >> 16 & 255) / 255.0F;
+ float float_3 = (color1 >> 8 & 255) / 255.0F;
+ float float_4 = (color1 & 255) / 255.0F;
+ float float_5 = (color2 >> 24 & 255) / 255.0F;
+ float float_6 = (color2 >> 16 & 255) / 255.0F;
+ float float_7 = (color2 >> 8 & 255) / 255.0F;
+ float float_8 = (color2 & 255) / 255.0F;
+ Tessellator tessellator_1 = Tessellator.getInstance();
+ BufferBuilder bufferBuilder_1 = tessellator_1.getBuffer();
+ bufferBuilder_1.begin(7, VertexFormats.POSITION_COLOR);
+ bufferBuilder_1.vertex(x1, y1, 0).color(float_2, float_3, float_4, float_1).next();
+ bufferBuilder_1.vertex(x1, y2, 0).color(float_2, float_3, float_4, float_1).next();
+ bufferBuilder_1.vertex(x2, y2, 0).color(float_6, float_7, float_8, float_5).next();
+ bufferBuilder_1.vertex(x2, y1, 0).color(float_6, float_7, float_8, float_5).next();
+ tessellator_1.draw();
+ }
+
+
+ public static void drawOutlineBox(Box box, float r, float g, float b, float a) {
+ gl11Setup();
+
+ Tessellator tessellator = Tessellator.getInstance();
+ BufferBuilder buffer = tessellator.getBuffer();
+
+ // Outline
+ buffer.begin(3, VertexFormats.POSITION_COLOR);
+ buffer.vertex(box.minX, box.minY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.minY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.minY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.minY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.maxY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.maxY, box.minZ).color(r, g, b, a).next();
+ buffer.vertex(box.minX, box.minY, box.maxZ).color(r, g, b, 0f).next();
+ buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, g, b, 0f).next();
+ buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, g, b, a).next();
+ buffer.vertex(box.maxX, box.minY, box.minZ).color(r, g, b, 0f).next();
+ buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, g, b, a).next();
+ tessellator.draw();
+
+ gl11Cleanup();
+ }
+
+ public static void drawLine(double x1, double y1, double z1, double x2, double y2, double z2, float r, float g, float b, float t) {
+ gl11Setup();
+ GL11.glLineWidth(t);
+
+ Tessellator tessellator = Tessellator.getInstance();
+ BufferBuilder buffer = tessellator.getBuffer();
+ buffer.begin(3, VertexFormats.POSITION_COLOR);
+ buffer.vertex(x1, y1, z1).color(r, g, b, 0.0F).next();
+ buffer.vertex(x1, y1, z1).color(r, g, b, 1.0F).next();
+ buffer.vertex(x2, y2, z2).color(r, g, b, 1.0F).next();
+ tessellator.draw();
+
+ gl11Cleanup();
+
+ }
+
+ public static void drawRect(float x, float y, float w, float h, int color, float alpha) {
+ float red = (float) (color >> 16 & 255) / 255.0F;
+ float green = (float) (color >> 8 & 255) / 255.0F;
+ float blue = (float) (color & 255) / 255.0F;
+ final Tessellator tessellator = Tessellator.getInstance();
+ final BufferBuilder bufferbuilder = tessellator.getBuffer();
+ GlStateManager.enableBlend();
+ GlStateManager.disableTexture();
+ GlStateManager.blendFuncSeparate(770, 771, 1, 0);
+ bufferbuilder.begin(7, VertexFormats.POSITION_COLOR);
+ bufferbuilder.vertex(x, h, 0.0D).color(red, green, blue, alpha).next();
+ bufferbuilder.vertex(w, h, 0.0D).color(red, green, blue, alpha).next();
+ bufferbuilder.vertex(w, y, 0.0D).color(red, green, blue, alpha).next();
+ bufferbuilder.vertex(x, y, 0.0D).color(red, green, blue, alpha).next();
+ tessellator.draw();
+ GlStateManager.enableTexture();
+ GlStateManager.disableBlend();
+ }
+
+ public static void offsetRender() {
+ Camera camera = BlockEntityRenderDispatcher.INSTANCE.camera;
+ Vec3d camPos = camera.getPos();
+ GL11.glRotated(MathHelper.wrapDegrees(camera.getPitch()), 1, 0, 0);
+ GL11.glRotated(MathHelper.wrapDegrees(camera.getYaw() + 180.0), 0, 1, 0);
+ GL11.glTranslated(-camPos.x, -camPos.y, -camPos.z);
+ }
+
+ public static void gl11Setup() {
+ GL11.glPushMatrix();
+ GL11.glEnable(GL11.GL_BLEND);
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
+ GL11.glLineWidth(2.5F);
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ GL11.glEnable(GL11.GL_LINE_SMOOTH);
+ offsetRender();
+ }
+
+ public static void gl11Cleanup() {
+ GL11.glDisable(GL11.GL_LINE_SMOOTH);
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+ }
+
+
+ public static void DrawPolygon(double x, double y, int radius, int sides, int color) {
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+
+ final Tessellator tessellator = Tessellator.getInstance();
+ final BufferBuilder bufferbuilder = tessellator.getBuffer();
+
+ bufferbuilder.begin(GL11.GL_TRIANGLE_FAN, VertexFormats.POSITION);
+
+ float alpha = (float) (color >> 24 & 255) / 255.0F;
+ float red = (float) (color >> 16 & 255) / 255.0F;
+ float green = (float) (color >> 8 & 255) / 255.0F;
+ float blue = (float) (color & 255) / 255.0F;
+
+ bufferbuilder.vertex(x, y, 0).next();
+ final double TWICE_PI = Math.PI * 2;
+
+ for (int i = 0; i <= sides; i++) {
+ double angle = (TWICE_PI * i / sides) + Math.toRadians(180);
+ bufferbuilder.vertex(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0).next();
+ }
+ tessellator.draw();
+
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java
new file mode 100644
index 00000000..a4c00499
--- /dev/null
+++ b/src/main/java/me/xmrvizzy/skyblocker/utils/RenderUtilsLiving.java
@@ -0,0 +1,138 @@
+package me.xmrvizzy.skyblocker.utils;
+
+/*
+ * This file is part of the MacHack distribution (https://github.com/BleachDrinker420/bleachhack-1.14/).
+ * Copyright (c) 2019 Bleach.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.render.BufferBuilder;
+import net.minecraft.client.render.Tessellator;
+import net.minecraft.client.render.VertexFormats;
+import net.minecraft.client.render.model.json.ModelTransformation.Mode;
+import net.minecraft.client.resource.language.I18n;
+import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.enchantment.Enchantments;
+import net.minecraft.item.BlockItem;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.math.MathHelper;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
+
+import java.awt.*;
+import java.util.Map.Entry;
+
+public class RenderUtilsLiving {
+
+ private static MinecraftClient mc = MinecraftClient.getInstance();
+ public static void drawText(String str, double x, double y, double z, double scale)
+ {
+ drawText(str, x, y, z, scale, 0.0F, 0.0F, 0.0F);
+ }
+ public static void drawText(String str, double x, double y, double z, double scale, float red, float green, float blue) {
+ glSetup(x, y, z);
+
+ GL11.glScaled(-0.025 * scale, -0.025 * scale, 0.025 * scale);
+
+ int i = mc.textRenderer.getWidth(str) / 2;
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ Tessellator tessellator = Tessellator.getInstance();
+ BufferBuilder bufferbuilder = tessellator.getBuffer();
+ bufferbuilder.begin(7, VertexFormats.POSITION_COLOR);
+ float f = mc.options.getTextBackgroundOpacity(0.25F);
+ bufferbuilder.vertex(-i - 1, -1, 0.0D).color(red, green, blue, f).next();
+ bufferbuilder.vertex(-i - 1, 8, 0.0D).color(red, green, blue, f).next();
+ bufferbuilder.vertex(i + 1, 8, 0.0D).color(red, green, blue, f).next();
+ bufferbuilder.vertex(i + 1, -1, 0.0D).color(red, green, blue, f).next();
+ tessellator.draw();
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+
+ mc.textRenderer.draw(new MatrixStack(), str, -i, 0, 553648127);
+ mc.textRenderer.draw(new MatrixStack(), str, -i, 0, -1);
+
+ glCleanup();
+ }
+
+ public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) {
+ glSetup(x, y, z);
+
+ GL11.glScaled(0.4 * scale, 0.4 * scale, 0);
+
+ GL11.glTranslated(offX, offY, 0);
+ if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F);
+ mc.getItemRenderer().renderItem(new ItemStack(
+ item.getItem()), Mode.GUI, 0, 0, new MatrixStack(), mc.getBufferBuilders().getEntityVertexConsumers());
+ if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F);
+ GL11.glDisable(GL11.GL_LIGHTING);
+
+ GL11.glScalef(-0.05F, -0.05F, 0);
+
+ if (item.getCount() > 0) {
+ int w = mc.textRenderer.getWidth("x" + item.getCount()) / 2;
+ mc.textRenderer.drawWithShadow(new MatrixStack(), "x" + item.getCount(), 7 - w, 5, 0xffffff);
+ }
+
+ GL11.glScalef(0.85F, 0.85F, 0.85F);
+
+ int c = 0;
+ for (Entry<Enchantment, Integer> m : EnchantmentHelper.get(item).entrySet()) {
+ int w1 = mc.textRenderer.getWidth(I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue()) / 2;
+ mc.textRenderer.drawWithShadow(new MatrixStack(),
+ I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue(), -4 - w1, c * 10 - 1,
+ m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE
+ ? 0xff5050 : 0xffb0e0);
+ c--;
+ }
+
+ GL11.glScalef(0.6F, 0.6F, 0.6F);
+ String dur = item.getMaxDamage() - item.getDamage() + "";
+ int color = 0x000000;
+ try {
+ color = MathHelper.hsvToRgb(((float) (item.getMaxDamage() - item.getDamage()) / item.getMaxDamage()) / 3.0F, 1.0F, 1.0F);
+ } catch (Exception e) {
+ }
+ if (item.isDamageable()) mc.textRenderer.drawWithShadow(new MatrixStack(), dur, -8 - dur.length() * 3, 15,
+ new Color(color >> 16 & 255, color >> 8 & 255, color & 255).getRGB());
+
+ glCleanup();
+ }
+
+ public static void glSetup(double x, double y, double z) {
+ GL11.glPushMatrix();
+ RenderUtils.offsetRender();
+ GL11.glTranslated(x, y, z);
+ GL11.glNormal3f(0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(-mc.player.yaw, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(mc.player.pitch, 1.0F, 0.0F, 0.0F);
+ //GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_DEPTH_TEST);
+
+ GL11.glEnable(GL11.GL_BLEND);
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
+
+ }
+
+ public static void glCleanup() {
+ //GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glEnable(GL11.GL_DEPTH_TEST);
+ GL11.glPopMatrix();
+ }
+} \ No newline at end of file