aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features
diff options
context:
space:
mode:
authorRabbitType99 <luis.be@gmx.de>2021-03-10 20:14:26 +0100
committerRabbitType99 <luis.be@gmx.de>2021-03-10 20:14:26 +0100
commit2c3838f8144959e3db3f60de8ce3c8d7ce799b9a (patch)
treed3e0e17e63900c45a76a194ed6bd8a6df3664f2e /src/main/java/me/Danker/features
parentb9fb3b6a33d1fac17859e1821a0de1b7d41191b5 (diff)
parentdbad2bfbec9a2b1c8ac72ff0516a1a3d543339d6 (diff)
downloadSkyblockMod-2c3838f8144959e3db3f60de8ce3c8d7ce799b9a.tar.gz
SkyblockMod-2c3838f8144959e3db3f60de8ce3c8d7ce799b9a.tar.bz2
SkyblockMod-2c3838f8144959e3db3f60de8ce3c8d7ce799b9a.zip
Merge branch 'development' into InstallerFrame
Diffstat (limited to 'src/main/java/me/Danker/features')
-rw-r--r--src/main/java/me/Danker/features/Skill50Display.java2
-rw-r--r--src/main/java/me/Danker/features/SkillTracker.java2
-rw-r--r--src/main/java/me/Danker/features/SpamHider.java7
-rw-r--r--src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java183
-rw-r--r--src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java4
5 files changed, 194 insertions, 4 deletions
diff --git a/src/main/java/me/Danker/features/Skill50Display.java b/src/main/java/me/Danker/features/Skill50Display.java
index 511bb16..3b73cf9 100644
--- a/src/main/java/me/Danker/features/Skill50Display.java
+++ b/src/main/java/me/Danker/features/Skill50Display.java
@@ -36,7 +36,7 @@ public class Skill50Display {
double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", ""));
int limit;
int totalXp;
- if (section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining")) {
+ if (section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining") || section.contains("Combat")) {
limit = 60;
totalXp = 111672425;
} else {
diff --git a/src/main/java/me/Danker/features/SkillTracker.java b/src/main/java/me/Danker/features/SkillTracker.java
index 15e9fdd..60eb632 100644
--- a/src/main/java/me/Danker/features/SkillTracker.java
+++ b/src/main/java/me/Danker/features/SkillTracker.java
@@ -63,7 +63,7 @@ public class SkillTracker {
}
timeSinceGained = System.currentTimeMillis() / 1000;
- int limit = section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining") ? 60 : 50;
+ int limit = section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining") || section.contains("Combat") ? 60 : 50;
double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", ""));
int xpToLevelUp = Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", ""));
xpLeft = xpToLevelUp - currentXP;
diff --git a/src/main/java/me/Danker/features/SpamHider.java b/src/main/java/me/Danker/features/SpamHider.java
index 4b22f61..a88d9e5 100644
--- a/src/main/java/me/Danker/features/SpamHider.java
+++ b/src/main/java/me/Danker/features/SpamHider.java
@@ -44,6 +44,13 @@ public class SpamHider {
if (!ToggleCommand.implosionMessages) {
if (message.contains("Your Implosion hit ") || message.contains("There are blocks in the way")) {
event.setCanceled(true);
+ return;
+ }
+ }
+ // Kill Combo
+ if (!ToggleCommand.killComboMessages) {
+ if ((message.contains("+") && message.contains(" Kill Combo ")) || message.contains("Your Kill Combo has expired!")) {
+ event.setCanceled(true);
}
}
}
diff --git a/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java
new file mode 100644
index 0000000..c07524d
--- /dev/null
+++ b/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java
@@ -0,0 +1,183 @@
+package me.Danker.features.puzzlesolvers;
+
+import me.Danker.DankersSkyblockMod;
+import me.Danker.commands.ToggleCommand;
+import me.Danker.utils.SilverfishUtils;
+import me.Danker.utils.Utils;
+import net.minecraft.block.BlockHopper;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.monster.EntitySilverfish;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+import net.minecraftforge.client.event.RenderWorldLastEvent;
+import net.minecraftforge.event.world.WorldEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class SilverfishSolver {
+
+ static boolean prevInSilverfishRoom = false;
+ static boolean inSilverfishRoom = false;
+ static BlockPos chest = null;
+ static EnumFacing silverfishRoomDirection = null;
+ static List<SilverfishUtils.Point> route = new ArrayList<>();
+ public static int SILVERFISH_LINE_COLOUR;
+
+ @SubscribeEvent
+ public void onWorldChange(WorldEvent.Load event) {
+ reset();
+ }
+
+ @SubscribeEvent
+ public void onTick(TickEvent.ClientTickEvent event) {
+ if (event.phase != TickEvent.Phase.START) return;
+
+ Minecraft mc = Minecraft.getMinecraft();
+ World world = mc.theWorld;
+ EntityPlayerSP player = mc.thePlayer;
+ if (DankersSkyblockMod.tickAmount % 20 == 0) {
+ if (ToggleCommand.silverfishToggled && Utils.inDungeons && world != null && player != null) {
+ new Thread(() -> {
+ boolean foundRoom = false;
+ prevInSilverfishRoom = inSilverfishRoom;
+ double x = player.posX;
+ double z = player.posZ;
+ // Find creepers nearby
+ AxisAlignedBB entityScan = new AxisAlignedBB(x - 25, 67, z - 25, x + 25, 68, z + 25); // 50x1x50
+ List<EntitySilverfish> silverfishes = world.getEntitiesWithinAABB(EntitySilverfish.class, entityScan);
+ List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, entityScan);
+ if (silverfishes.size() > 0 && items.size() > 0) {
+ double silverfishX = silverfishes.get(0).posX;
+ double silverfishZ = silverfishes.get(0).posZ;
+ for (EntityItem item : items) {
+ if (Item.getIdFromItem(item.getEntityItem().getItem()) == 46 && Math.abs(item.posX - silverfishX) < 1 && Math.abs(item.posZ - silverfishZ) < 1) {
+ Iterable<BlockPos> blocks = BlockPos.getAllInBox(new BlockPos(player.posX - 27, 67, player.posZ - 27), new BlockPos(player.posX + 27, 67, player.posZ + 27));
+ for (BlockPos blockPos : blocks) {
+ if (world.getBlockState(blockPos).getBlock() == Blocks.chest && world.getBlockState(blockPos.add(0, 2, 0)).getBlock() == Blocks.hopper) {
+ foundRoom = true;
+ inSilverfishRoom = true;
+ if (!prevInSilverfishRoom) {
+ chest = blockPos;
+ BlockPos silverfishBlock = new BlockPos(silverfishX, 67, silverfishZ);
+ TileEntity hopper = world.getTileEntity(blockPos.add(0, 2, 0));
+ silverfishRoomDirection = BlockHopper.getFacing(hopper.getBlockMetadata());
+ char[][] board = new char[19][19];
+ SilverfishUtils.Point silverfishPoint = null;
+
+ switch (silverfishRoomDirection) {
+ case NORTH:
+ for (int row = chest.getZ() + 3, xIteration = 0; xIteration < 19; row++, xIteration++) {
+ for (int column = chest.getX() - 9, yIteration = 0; yIteration < 19; column++, yIteration++) {
+ if (world.getBlockState(new BlockPos(column, 67, row)).getBlock() != Blocks.air) {
+ board[xIteration][yIteration] = 'X';
+ } else if (silverfishBlock.equals(new BlockPos(column, 67, row))) {
+ silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration);
+ }
+ }
+ }
+ break;
+ case EAST:
+ for (int row = chest.getX() - 3, xIteration = 0; xIteration < 19; row--, xIteration++) {
+ for (int column = chest.getZ() - 9, yIteration = 0; yIteration < 19; column++, yIteration++) {
+ if (world.getBlockState(new BlockPos(row, 67, column)).getBlock() != Blocks.air) {
+ board[xIteration][yIteration] = 'X';
+ } else if (silverfishBlock.equals(new BlockPos(row, 67, column))) {
+ silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration);
+ }
+ }
+ }
+ break;
+ case SOUTH:
+ for (int row = chest.getZ() - 3, xIteration = 0; xIteration < 19; row--, xIteration++) {
+ for (int column = chest.getX() + 9, yIteration = 0; yIteration < 19; column--, yIteration++) {
+ if (world.getBlockState(new BlockPos(column, 67, row)).getBlock() != Blocks.air) {
+ board[xIteration][yIteration] = 'X';
+ } else if (silverfishBlock.equals(new BlockPos(column, 67, row))) {
+ silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration);
+ }
+ }
+ }
+ break;
+ case WEST:
+ for (int row = chest.getX() + 3, xIteration = 0; xIteration < 19; row++, xIteration++) {
+ for (int column = chest.getZ() + 9, yIteration = 0; yIteration < 19; column--, yIteration++) {
+ if (world.getBlockState(new BlockPos(row, 67, column)).getBlock() != Blocks.air) {
+ board[xIteration][yIteration] = 'X';
+ } else if (silverfishBlock.equals(new BlockPos(row, 67, column))) {
+ board[xIteration][yIteration] = 'S';
+ silverfishPoint = new SilverfishUtils.Point(xIteration, yIteration);
+ }
+ }
+ }
+ break;
+ default:
+ return;
+ }
+ System.out.println(Arrays.deepToString(board));
+
+ List<SilverfishUtils.Point> endPoints = new ArrayList<>();
+ for (int column = 0; column < 19; column++) {
+ if (board[0][column] != 'X') endPoints.add(new SilverfishUtils.Point(0, column));
+ }
+
+ route = SilverfishUtils.solve(board, silverfishPoint, endPoints);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (!foundRoom) reset();
+ }).start();
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onWorldRender(RenderWorldLastEvent event) {
+ if (ToggleCommand.silverfishToggled && Utils.inDungeons && route != null && route.size() > 0 && chest != null) {
+ for (int i = 0; i < route.size() - 1; i++) {
+ Vec3 pos1 = null;
+ Vec3 pos2 = null;
+ switch (silverfishRoomDirection) {
+ case NORTH:
+ pos1 = new Vec3(chest.getX() - 8.5 + route.get(i).column, 67.5, chest.getZ() + 3.5 + route.get(i).row);
+ pos2 = new Vec3(chest.getX() - 8.5 + route.get(i + 1).column, 67.5, chest.getZ() + 3.5 + route.get(i + 1).row);
+ break;
+ case EAST:
+ pos1 = new Vec3(chest.getX() - 2.5 - route.get(i).row, 67.5, chest.getZ() - 8.5 + route.get(i).column);
+ pos2 = new Vec3(chest.getX() - 2.5 - route.get(i + 1).row, 67.5, chest.getZ() - 8.5 + route.get(i + 1).column);
+ break;
+ case SOUTH:
+ pos1 = new Vec3(chest.getX() + 9.5 - route.get(i).column, 67.5, chest.getZ() - 2.5 - route.get(i).row);
+ pos2 = new Vec3(chest.getX() + 9.5 - route.get(i + 1).column, 67.5, chest.getZ() - 2.5 - route.get(i + 1).row);
+ break;
+ case WEST:
+ pos1 = new Vec3(chest.getX() + 3.5 + route.get(i).row, 67.5, chest.getZ() + 9.5 - route.get(i).column);
+ pos2 = new Vec3(chest.getX() + 3.5 + route.get(i + 1).row, 67.5, chest.getZ() + 9.5 - route.get(i + 1).column);
+ break;
+ default:
+ return;
+ }
+ Utils.draw3DLine(pos1, pos2, SILVERFISH_LINE_COLOUR, 5, true, event.partialTicks);
+ }
+ }
+ }
+
+ static void reset() {
+ inSilverfishRoom = false;
+ chest = null;
+ silverfishRoomDirection = null;
+ route.clear();
+ }
+
+}
diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java
index b769634..9adc555 100644
--- a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java
+++ b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java
@@ -30,8 +30,8 @@ public class TriviaSolver {
triviaSolutions.put("What is the status of Goldor?", new String[]{"Wither Soldier"});
triviaSolutions.put("What is the status of Storm?", new String[]{"Elementalist"});
triviaSolutions.put("What is the status of Necron?", new String[]{"Wither Lord"});
- triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"220 Fairy Souls"});
- triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"17 Fairy Souls"});
+ triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"222 Fairy Souls"});
+ triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"19 Fairy Souls"});
triviaSolutions.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"});
triviaSolutions.put("How many Fairy Souls are there in The Barn?", new String[]{"7 Fairy Souls"});
triviaSolutions.put("How many Fairy Souls are there in Mushroom Desert?", new String[]{"8 Fairy Souls"});