diff --git a/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/GuiChestHook.java b/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/GuiChestHook.java index cb12c11153..04a35fe15e 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/GuiChestHook.java +++ b/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/GuiChestHook.java @@ -10,7 +10,6 @@ import codes.biscuit.skyblockaddons.features.backpacks.BackpackInventoryManager; import codes.biscuit.skyblockaddons.features.backpacks.ContainerPreviewManager; import codes.biscuit.skyblockaddons.gui.IslandWarpGui; -import codes.biscuit.skyblockaddons.gui.elements.CraftingPatternSelection; import codes.biscuit.skyblockaddons.utils.ColorCode; import codes.biscuit.skyblockaddons.utils.DrawUtils; import codes.biscuit.skyblockaddons.utils.ItemUtils; @@ -45,7 +44,6 @@ public class GuiChestHook { @Setter @Getter private static String lastAccessoryBagReforge = null; - private static CraftingPatternSelection craftingPatternSelection = null; private static final Pattern warpPattern = Pattern.compile("(?:§5§o)?§8/warp ([a-z_]*)"); private static final Pattern unlockedPattern = Pattern.compile("(?:§5§o)?§eClick to warp!"); @@ -221,13 +219,6 @@ public static void initGui(IInventory lowerChestInventory, int guiLeft, int guiT InventoryType inventoryType = SkyblockAddons.getInstance().getInventoryUtils().updateInventoryType(); if (inventoryType != null) { - if (inventoryType == InventoryType.CRAFTING_TABLE) { - if (false /*SkyblockAddons.getInstance().getConfigValues().isEnabled(Feature.CRAFTING_PATTERNS)*/) { - craftingPatternSelection = new CraftingPatternSelection(Minecraft.getMinecraft(), Math.max(guiLeft - CraftingPatternSelection.ICON_SIZE - 2, 10), guiTop + 1); - } - return; - } - if (SkyblockAddons.getInstance().getConfigValues().isEnabled(Feature.REFORGE_FILTER) && inventoryType == InventoryType.BASIC_REFORGING || inventoryType == InventoryType.BASIC_ACCESSORY_BAG_REFORGING) { int xPos = guiLeft - 160; @@ -363,11 +354,6 @@ public static void mouseClicked(int mouseX, int mouseY, int mouseButton, ReturnV textFieldMatch.mouseClicked(mouseX, mouseY, mouseButton); textFieldExclusions.mouseClicked(mouseX, mouseY, mouseButton); } - - if (craftingPatternSelection != null && SkyblockAddons.getInstance().getInventoryUtils().getInventoryType() == - InventoryType.CRAFTING_TABLE) { - craftingPatternSelection.mouseClicked(mouseX, mouseY, mouseButton); - } } public static void color(float colorRed, float colorGreen, float colorBlue, float colorAlpha, IInventory lowerChestInventory) { //Item item, ItemStack stack @@ -377,13 +363,6 @@ public static void color(float colorRed, float colorGreen, float colorBlue, floa return; } - // Draw here to make sure it's in the background of the GUI and items overlay it. - if (false && /*main.getConfigValues().isEnabled(Feature.CRAFTING_PATTERNS) && */ - main.getInventoryUtils().getInventoryType() == InventoryType.CRAFTING_TABLE && - craftingPatternSelection != null) { - craftingPatternSelection.draw(); - } - Minecraft mc = Minecraft.getMinecraft(); if (main.getConfigValues().isEnabled(Feature.SHOW_BACKPACK_PREVIEW) && diff --git a/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/GuiContainerHook.java b/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/GuiContainerHook.java index ff92ae1792..ea849566d1 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/GuiContainerHook.java +++ b/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/GuiContainerHook.java @@ -5,7 +5,6 @@ import codes.biscuit.skyblockaddons.core.Feature; import codes.biscuit.skyblockaddons.core.InventoryType; import codes.biscuit.skyblockaddons.features.backpacks.ContainerPreviewManager; -import codes.biscuit.skyblockaddons.features.craftingpatterns.CraftingPattern; import codes.biscuit.skyblockaddons.utils.ColorCode; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -64,29 +63,6 @@ public static void drawSlot(GuiContainer guiContainer, Slot slot) { Container container = mc.thePlayer.openContainer; if (slot != null) { - // Draw crafting pattern overlays inside the crafting grid. - if (false /*main.getConfigValues().isEnabled(Feature.CRAFTING_PATTERNS)*/ && main.getUtils().isOnSkyblock() - && slot.inventory.getDisplayName().getUnformattedText().equals(CraftingPattern.CRAFTING_TABLE_DISPLAYNAME) - && main.getPersistentValuesManager().getPersistentValues().getSelectedCraftingPattern() != CraftingPattern.FREE) { - - int craftingGridIndex = CraftingPattern.slotToCraftingGridIndex(slot.getSlotIndex()); - if (craftingGridIndex >= 0) { - int slotLeft = slot.xDisplayPosition; - int slotTop = slot.yDisplayPosition; - int slotRight = slotLeft + 16; - int slotBottom = slotTop + 16; - if (main.getPersistentValuesManager().getPersistentValues().getSelectedCraftingPattern().isSlotInPattern(craftingGridIndex)) { - if (!slot.getHasStack()) { - guiContainer.drawGradientRect(slotLeft, slotTop, slotRight, slotBottom, OVERLAY_GREEN, OVERLAY_GREEN); - } - } else { - if (slot.getHasStack()) { - guiContainer.drawGradientRect(slotLeft, slotTop, slotRight, slotBottom, OVERLAY_RED, OVERLAY_RED); - } - } - } - } - if (main.getConfigValues().isEnabled(Feature.LOCK_SLOTS) && main.getUtils().isOnSkyblock()) { int slotNum = slot.slotNumber + main.getInventoryUtils().getSlotDifference(container); diff --git a/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/MinecraftHook.java b/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/MinecraftHook.java index cd3db47f98..d15a58735b 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/MinecraftHook.java +++ b/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/MinecraftHook.java @@ -24,36 +24,6 @@ public class MinecraftHook { @Getter private static long lastLockedSlotItemChange = -1; - private static final Set DEEP_CAVERNS_LOCATIONS = EnumSet.of(Location.DEEP_CAVERNS, Location.GUNPOWDER_MINES, - Location.LAPIS_QUARRY, Location.PIGMAN_DEN, Location.SLIMEHILL, Location.DIAMOND_RESERVE, Location.OBSIDIAN_SANCTUARY); - - private static final Set DWARVEN_MINES_LOCATIONS = EnumSet.of(Location.DWARVEN_MINES, Location.THE_LIFT, Location.DWARVEN_VILLAGE, - Location.GATES_TO_THE_MINES, Location.THE_FORGE, Location.FORGE_BASIN, Location.LAVA_SPRINGS, Location.PALACE_BRIDGE, - Location.ROYAL_PALACE, Location.ARISTOCRAT_PASSAGE, Location.HANGING_TERRACE, Location.CLIFFSIDE_VEINS, - Location.RAMPARTS_QUARRY, Location.DIVANS_GATEWAY, Location.FAR_RESERVE, Location.GOBLIN_BURROWS, Location.UPPER_MINES, - Location.MINERS_GUILD, Location.GREAT_ICE_WALL, Location.THE_MIST, Location.CC_MINECARTS_CO, Location.GRAND_LIBRARY, - Location.HANGING_COURT, Location.ROYAL_MINES); - - // The room with the puzzle is made of wood that you have to mine - private static final AxisAlignedBB DWARVEN_PUZZLE_ROOM = new AxisAlignedBB(171, 195, 125, 192, 196, 146); - - private static final Set DEEP_CAVERNS_MINEABLE_BLOCKS = new HashSet<>(Arrays.asList(Blocks.coal_ore, Blocks.iron_ore, Blocks.gold_ore, Blocks.redstone_ore, Blocks.emerald_ore, - Blocks.diamond_ore, Blocks.diamond_block, Blocks.obsidian, Blocks.lapis_ore, Blocks.lit_redstone_ore)); - - private static final Set NETHER_MINEABLE_BLOCKS = new HashSet<>(Arrays.asList(Blocks.glowstone, Blocks.quartz_ore, Blocks.nether_wart)); - - // TODO: Make this less computationally expensive - // More specifically, should be cyan hardened clay, grey/light blue wool, dark prismarine, prismarine brick, prismarine, polished diorite - private static final Set DWARVEN_MINEABLE_BLOCKS = new HashSet<>(Arrays.asList("minecraft:prismarine0", - "minecraft:prismarine1", "minecraft:prismarine2", "minecraft:stone4", "minecraft:wool3", "minecraft:wool7", - "minecraft:stained_hardened_clay9")); - - private static final Set PARK_LOCATIONS = EnumSet.of(Location.BIRCH_PARK, Location.SPRUCE_WOODS, Location.SAVANNA_WOODLAND, Location.DARK_THICKET, Location.JUNGLE_ISLAND); - - private static final Set LOGS = new HashSet<>(Arrays.asList(Blocks.log, Blocks.log2)); - - private static final long lastStemMessage = -1; - private static final long lastUnmineableMessage = -1; public static BlockPos prevClickBlock = new BlockPos(-1, -1, -1); public static long startMineTime = Long.MAX_VALUE; diff --git a/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/PlayerControllerMPHook.java b/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/PlayerControllerMPHook.java index 0351719250..fa0f3fecc1 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/PlayerControllerMPHook.java +++ b/src/main/java/codes/biscuit/skyblockaddons/asm/hooks/PlayerControllerMPHook.java @@ -3,12 +3,9 @@ import codes.biscuit.skyblockaddons.SkyblockAddons; import codes.biscuit.skyblockaddons.asm.utils.ReturnValue; import codes.biscuit.skyblockaddons.core.Feature; -import codes.biscuit.skyblockaddons.core.InventoryType; import codes.biscuit.skyblockaddons.events.SkyblockBlockBreakEvent; import codes.biscuit.skyblockaddons.features.backpacks.BackpackColor; import codes.biscuit.skyblockaddons.features.backpacks.BackpackInventoryManager; -import codes.biscuit.skyblockaddons.features.craftingpatterns.CraftingPattern; -import codes.biscuit.skyblockaddons.features.craftingpatterns.CraftingPatternResult; import codes.biscuit.skyblockaddons.utils.ItemUtils; import codes.biscuit.skyblockaddons.utils.Utils; import com.google.common.collect.Sets; @@ -32,29 +29,6 @@ public class PlayerControllerMPHook { - /** - * clickModifier value in {@link #onWindowClick(int, int, int, EntityPlayer, ReturnValue)} for shift-clicks - */ - private static final int SHIFTCLICK_CLICK_TYPE = 1; - - /** - * Cooldown between playing error sounds to avoid stacking up - */ - private static final int CRAFTING_PATTERN_SOUND_COOLDOWN = 400; - - private static long lastCraftingSoundPlayed = 0; - - private static final Set ORES = Sets.newHashSet(Block.getIdFromBlock(Blocks.coal_ore), Block.getIdFromBlock(Blocks.iron_ore), - Block.getIdFromBlock(Blocks.gold_ore), Block.getIdFromBlock(Blocks.redstone_ore), Block.getIdFromBlock(Blocks.emerald_ore), - Block.getIdFromBlock(Blocks.lapis_ore), Block.getIdFromBlock(Blocks.diamond_ore), Block.getIdFromBlock(Blocks.lit_redstone_ore), - Utils.getBlockMetaId(Blocks.stone, BlockStone.EnumType.DIORITE_SMOOTH.getMetadata()), - Utils.getBlockMetaId(Blocks.stained_hardened_clay, EnumDyeColor.CYAN.getMetadata()), - Utils.getBlockMetaId(Blocks.prismarine, BlockPrismarine.EnumType.ROUGH.getMetadata()), - Utils.getBlockMetaId(Blocks.prismarine, BlockPrismarine.EnumType.DARK.getMetadata()), - Utils.getBlockMetaId(Blocks.prismarine, BlockPrismarine.EnumType.BRICKS.getMetadata()), - Utils.getBlockMetaId(Blocks.wool, EnumDyeColor.LIGHT_BLUE.getMetadata()), - Utils.getBlockMetaId(Blocks.wool, EnumDyeColor.GRAY.getMetadata())); - /** * Checks if an item is being dropped and if an item is being dropped, whether it is allowed to be dropped. * This check works only for mouse clicks, not presses of the "Drop Item" key. @@ -161,45 +135,6 @@ public static void onWindowClick(int slotNum, int mouseButtonClicked, int mode, main.getUtils().playLoudSound("note.bass", 0.5); returnValue.cancel(); } - - // Crafting patterns - if (false && slotIn != null && main.getInventoryUtils().getInventoryType() == InventoryType.CRAFTING_TABLE - /*&& main.getConfigValues().isEnabled(Feature.CRAFTING_PATTERNS)*/) { - - final CraftingPattern selectedPattern = main.getPersistentValuesManager().getPersistentValues().getSelectedCraftingPattern(); - final ItemStack clickedItem = slotIn.getStack(); - if (selectedPattern != CraftingPattern.FREE && clickedItem != null) { - final ItemStack[] craftingGrid = new ItemStack[9]; - for (int i = 0; i < CraftingPattern.CRAFTING_GRID_SLOTS.size(); i++) { - int slotIndex = CraftingPattern.CRAFTING_GRID_SLOTS.get(i); - craftingGrid[i] = slots.getSlot(slotIndex).getStack(); - } - - final CraftingPatternResult result = selectedPattern.checkAgainstGrid(craftingGrid); - - if (slotIn.inventory.equals(Minecraft.getMinecraft().thePlayer.inventory)) { - if (result.isFilled() && !result.fitsItem(clickedItem) && mode == SHIFTCLICK_CLICK_TYPE) { - // cancel shift-clicking items from the inventory if the pattern is already filled - if (System.currentTimeMillis() > lastCraftingSoundPlayed + CRAFTING_PATTERN_SOUND_COOLDOWN) { - main.getUtils().playSound("note.bass", 0.5); - lastCraftingSoundPlayed = System.currentTimeMillis(); - } - returnValue.cancel(); - } - } else { - if (slotIn.getSlotIndex() == CraftingPattern.CRAFTING_RESULT_INDEX - && !result.isSatisfied() - && main.getPersistentValuesManager().getPersistentValues().isBlockCraftingIncompletePatterns()) { - // cancel clicking the result if the pattern isn't satisfied - if (System.currentTimeMillis() > lastCraftingSoundPlayed + CRAFTING_PATTERN_SOUND_COOLDOWN) { - main.getUtils().playSound("note.bass", 0.5); - lastCraftingSoundPlayed = System.currentTimeMillis(); - } - returnValue.cancel(); - } - } - } - } } } else { diff --git a/src/main/java/codes/biscuit/skyblockaddons/config/PersistentValuesManager.java b/src/main/java/codes/biscuit/skyblockaddons/config/PersistentValuesManager.java index 174da682d2..6d2626dfdd 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/config/PersistentValuesManager.java +++ b/src/main/java/codes/biscuit/skyblockaddons/config/PersistentValuesManager.java @@ -4,7 +4,6 @@ import codes.biscuit.skyblockaddons.SkyblockAddons; import codes.biscuit.skyblockaddons.features.FetchurManager; import codes.biscuit.skyblockaddons.features.backpacks.CompressedStorage; -import codes.biscuit.skyblockaddons.features.craftingpatterns.CraftingPattern; import codes.biscuit.skyblockaddons.features.dragontracker.DragonTrackerData; import codes.biscuit.skyblockaddons.features.slayertracker.SlayerTrackerData; import lombok.Getter; @@ -37,9 +36,6 @@ public static class PersistentValues { private DragonTrackerData dragonTracker = new DragonTrackerData(); private Map storageCache = new HashMap<>(); - private boolean blockCraftingIncompletePatterns = true; - private CraftingPattern selectedCraftingPattern = CraftingPattern.FREE; - private int oresMined = 0; private int seaCreaturesKilled = 0; diff --git a/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java b/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java index e8e2af173b..14867ccd78 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java +++ b/src/main/java/codes/biscuit/skyblockaddons/core/Feature.java @@ -52,7 +52,6 @@ public enum Feature { MAKE_BACKPACK_INVENTORIES_COLORED(43, Message.SETTING_MAKE_BACKPACK_INVENTORIES_COLORED, false), REPLACE_ROMAN_NUMERALS_WITH_NUMBERS(45, Message.SETTING_REPLACE_ROMAN_NUMERALS_WITH_NUMBERS, true), CHANGE_BAR_COLOR_FOR_POTIONS(46, Message.SETTING_CHANGE_BAR_COLOR_WITH_POTIONS, false), - //CRAFTING_PATTERNS(47, Message.SETTING_CRAFTING_PATTERNS, false), FISHING_SOUND_INDICATOR(48, Message.SETTING_FISHING_SOUND_INDICATOR, false), AVOID_BLINKING_NIGHT_VISION(49, Message.SETTING_AVOID_BLINKING_NIGHT_VISION, false), MINION_DISABLE_LOCATION_WARNING(50, Message.SETTING_DISABLE_MINION_LOCATION_WARNING, false), @@ -62,9 +61,6 @@ public enum Feature { SPEED_PERCENTAGE(55, Message.SETTING_SPEED_PERCENTAGE, new GuiFeatureData(EnumUtils.DrawType.TEXT, ColorCode.WHITE), false), SLAYER_INDICATOR(57, Message.SETTING_SLAYER_INDICATOR, new GuiFeatureData(EnumUtils.DrawType.REVENANT_PROGRESS, ColorCode.AQUA), true), SPECIAL_ZEALOT_ALERT(58, Message.SETTING_SPECIAL_ZEALOT_ALERT, new GuiFeatureData(ColorCode.RED), false), - ENABLE_MESSAGE_WHEN_MINING_DEEP_CAVERNS(60, null, false), - ENABLE_MESSAGE_WHEN_BREAKING_STEMS(61, null, false), - ENABLE_MESSAGE_WHEN_MINING_NETHER(62, null, false), HIDE_PET_HEALTH_BAR(63, Message.SETTING_HIDE_PET_HEALTH_BAR, false), // Release v1.4 DISABLE_MAGICAL_SOUP_MESSAGES(64, Message.SETTING_DISABLE_MAGICAL_SOUP_MESSAGE, true), @@ -90,7 +86,6 @@ public enum Feature { FANCY_WARP_MENU(85, Message.SETTING_FANCY_WARP_MENU, false), HIDE_GREY_ENCHANTS(87, Message.SETTING_HIDE_GREY_ENCHANTS, false), LEGENDARY_SEA_CREATURE_WARNING(88, Message.SETTING_LEGENDARY_SEA_CREATURE_WARNING, new GuiFeatureData(ColorCode.RED), false), - ENABLE_MESSAGE_WHEN_BREAKING_PARK(90, null, false), BOSS_APPROACH_ALERT(91, Message.SETTING_BOSS_APPROACH_ALERT, false, EnumUtils.FeatureSetting.REPEATING), DISABLE_TELEPORT_PAD_MESSAGES(92, Message.SETTING_DISABLE_TELEPORT_PAD_MESSAGES, false), BAIT_LIST(93, Message.SETTING_BAIT_LIST, new GuiFeatureData(EnumUtils.DrawType.BAIT_LIST_DISPLAY, ColorCode.AQUA), true), @@ -227,8 +222,7 @@ public enum Feature { */ private static final Set SETTINGS = Sets.newHashSet(DOUBLE_DROP_IN_OTHER_GAMES, USE_VANILLA_TEXTURE_DEFENCE, SHOW_BACKPACK_HOLDING_SHIFT, SHOW_MAGMA_TIMER_IN_OTHER_GAMES, - MAKE_BACKPACK_INVENTORIES_COLORED, CHANGE_BAR_COLOR_FOR_POTIONS, ENABLE_MESSAGE_WHEN_BREAKING_STEMS, - ENABLE_MESSAGE_WHEN_MINING_DEEP_CAVERNS, ENABLE_MESSAGE_WHEN_MINING_NETHER, HIDE_NIGHT_VISION_EFFECT_TIMER, + MAKE_BACKPACK_INVENTORIES_COLORED, CHANGE_BAR_COLOR_FOR_POTIONS, HIDE_NIGHT_VISION_EFFECT_TIMER, CAKE_BAG_PREVIEW, REPEAT_FULL_INVENTORY_WARNING, SORT_TAB_EFFECT_TIMERS, DOUBLE_WARP, REPEAT_SLAYER_BOSS_WARNING, ROTATE_MAP, CENTER_ROTATION_ON_PLAYER, MAP_ZOOM, BASE_STAT_BOOST_COLOR_BY_RARITY, SHOW_PLAYER_HEADS_ON_MAP, SHOW_GLOWING_ITEMS_ON_ISLAND, SKILL_ACTIONS_LEFT_UNTIL_NEXT_LEVEL, REVENANT_COLOR_BY_RARITY, diff --git a/src/main/java/codes/biscuit/skyblockaddons/core/InventoryType.java b/src/main/java/codes/biscuit/skyblockaddons/core/InventoryType.java index 19b16fdfdc..d6d0dad204 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/core/InventoryType.java +++ b/src/main/java/codes/biscuit/skyblockaddons/core/InventoryType.java @@ -1,6 +1,5 @@ package codes.biscuit.skyblockaddons.core; -import codes.biscuit.skyblockaddons.features.craftingpatterns.CraftingPattern; import lombok.Getter; import java.util.regex.Pattern; @@ -17,7 +16,7 @@ public enum InventoryType { BASIC_ACCESSORY_BAG_REFORGING("Reforge Accessory Bag", "Reforge Accessory Bag"), ADVANCED_ACCESSORY_BAG_REFORGING("Reforge Accessory Bag", "Reforge Accessory Bag"), BAKER("Baker", "Baker"), - CRAFTING_TABLE(CraftingPattern.CRAFTING_TABLE_DISPLAYNAME, CraftingPattern.CRAFTING_TABLE_DISPLAYNAME), + CRAFTING_TABLE("Craft Item", "Craft Item"), SALVAGING("Salvage Dungeon Item", "Salvage Dungeon Item"), ULTRASEQUENCER("Ultrasequencer", "Ultrasequencer \\((?[a-zA-Z]+)\\)"), CHRONOMATRON("Chronomatron", "Chronomatron \\((?[a-zA-Z]+)\\)"), diff --git a/src/main/java/codes/biscuit/skyblockaddons/core/Message.java b/src/main/java/codes/biscuit/skyblockaddons/core/Message.java index bda2df9865..0470aa05de 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/core/Message.java +++ b/src/main/java/codes/biscuit/skyblockaddons/core/Message.java @@ -27,7 +27,6 @@ public enum Message { SETTING_FULL_INVENTORY_WARNING(MessageObject.SETTING, "fullInventoryWarning"), SETTING_REPEATING(MessageObject.SETTING, "repeating"), SETTING_MAGMA_BOSS_TIMER(MessageObject.SETTING, "magmaBossTimer"), - SETTING_DISABLE_EMBER_ROD_ABILITY(MessageObject.SETTING, "disableEmberRodAbility"), SETTING_EDIT_LOCATIONS(MessageObject.SETTING, "editLocations"), SETTING_GUI_SCALE(MessageObject.SETTING, "guiScale"), SETTING_RESET_LOCATIONS(MessageObject.SETTING, "resetLocations"), @@ -54,9 +53,6 @@ public enum Message { SETTING_TEXT_STYLE(MessageObject.SETTING, "textStyle"), SETTING_DARK_AUCTION_TIMER(MessageObject.SETTING, "darkAuctionTimer"), SETTING_ITEM_PICKUP_LOG(MessageObject.SETTING, "itemPickupLog"), - SETTING_AVOID_PLACING_ENCHANTED_ITEMS(MessageObject.SETTING, "avoidPlacingEnchantedItems"), - SETTING_AVOID_BREAKING_STEMS(MessageObject.SETTING, "avoidBreakingStems"), - SETTING_STOP_BOW_CHARGE_FROM_RESETTING(MessageObject.SETTING, "stopBowChargeFromResetting"), SETTING_SHOW_ITEM_ANVIL_USES(MessageObject.SETTING, "showItemAnvilUses"), SETTING_PREVENT_MOVEMENT_ON_DEATH(MessageObject.SETTING, "preventMovementOnDeath"), SETTING_LOCK_SLOTS(MessageObject.SETTING, "lockSlots"), @@ -72,7 +68,6 @@ public enum Message { @Deprecated SETTING_AVOID_BREAKING_BOTTOM_SUGAR_CANE(MessageObject.SETTING, "avoidBreakingBottomSugarCane"), // disallowed SETTING_REPLACE_ROMAN_NUMERALS_WITH_NUMBERS(MessageObject.SETTING, "replaceRomanNumeralsWithNumbers"), SETTING_CHANGE_BAR_COLOR_WITH_POTIONS(MessageObject.SETTING, "changeBarColorForPotions"), - SETTING_CRAFTING_PATTERNS(MessageObject.SETTING, "craftingPatterns"), SETTING_FISHING_SOUND_INDICATOR(MessageObject.SETTING, "soundIndicatorForFishing"), SETTING_AVOID_BLINKING_NIGHT_VISION(MessageObject.SETTING, "avoidBlinkingNightVision"), SETTING_DISABLE_MINION_LOCATION_WARNING(MessageObject.SETTING, "disableMinionLocationWarning"), @@ -81,11 +76,9 @@ public enum Message { SETTING_SHOW_ITEM_COOLDOWNS(MessageObject.SETTING, "showItemCooldowns"), SETTING_COLLECTION_DISPLAY(MessageObject.SETTING, "collectionDisplay"), SETTING_SPEED_PERCENTAGE(MessageObject.SETTING, "speedPercentage"), - SETTING_ONLY_MINE_ORES_DEEP_CAVERNS(MessageObject.SETTING, "onlyMineOresDeepCaverns"), SETTING_ENABLE_MESSAGE_WHEN_ACTION_PREVENTED(MessageObject.SETTING, "enableMessageWhenActionPrevented"), SETTING_SLAYER_INDICATOR(MessageObject.SETTING, "revenantIndicator"), SETTING_SPECIAL_ZEALOT_ALERT(MessageObject.SETTING, "specialZealotAlert"), - SETTING_ONLY_MINE_VALUABLES_NETHER(MessageObject.SETTING, "onlyMineValuablesNether"), SETTING_DISABLE_MAGICAL_SOUP_MESSAGE(MessageObject.SETTING, "disableMagicalSoupMessage"), SETTING_HIDE_PET_HEALTH_BAR(MessageObject.SETTING, "hidePetHealthBar"), SETTING_POWER_ORB_DISPLAY(MessageObject.SETTING, "powerOrbDisplay"), @@ -118,7 +111,6 @@ public enum Message { SETTING_FREEZE_BACKPACK_PREVIEW(MessageObject.SETTING, "freezeBackpackPreview"), SETTING_HIDE_GREY_ENCHANTS(MessageObject.SETTING, "hideGreyEnchants"), SETTING_LEGENDARY_SEA_CREATURE_WARNING(MessageObject.SETTING, "legendarySeaCreatureWarning"), - SETTING_ONLY_BREAK_LOGS_PARK(MessageObject.SETTING, "onlyBreakLogsPark"), SETTING_BOSS_APPROACH_ALERT(MessageObject.SETTING, "bossApproachAlert"), SETTING_DISABLE_TELEPORT_PAD_MESSAGES(MessageObject.SETTING, "disableTeleportPadMessages"), SETTING_BAIT_LIST(MessageObject.SETTING, "baitListDisplay"), @@ -183,7 +175,6 @@ public enum Message { MESSAGE_SEPARATE_ENCHANTMENTS(MessageObject.MESSAGES, "separateMultiple"), MESSAGE_ENCHANTS_TO_MATCH(MessageObject.MESSAGES, "enchantsToMatch"), MESSAGE_ENCHANTS_TO_EXCLUDE(MessageObject.MESSAGES, "enchantsToExclude"), - MESSAGE_CANCELLED_STEM_BREAK(MessageObject.MESSAGES, "cancelledStemBreak"), MESSAGE_SLOT_LOCKED(MessageObject.MESSAGES, "slotLocked"), MESSAGE_SUMMONING_EYE_FOUND(MessageObject.MESSAGES, "summoningEyeFound"), MESSAGE_CANCELLED_DROPPING(MessageObject.MESSAGES, "cancelledDropping"), @@ -194,7 +185,6 @@ public enum Message { MESSAGE_ANVIL_USES(MessageObject.MESSAGES, "anvilUses"), MESSAGE_CANCELLED_NON_ORES_BREAK(MessageObject.MESSAGES, "cancelledDeepCaverns"), MESSAGE_SPECIAL_ZEALOT_FOUND(MessageObject.MESSAGES, "specialZealotFound"), - MESSAGE_BLOCK_INCOMPLETE_PATTERNS(MessageObject.MESSAGES, "blockIncompletePatterns"), MESSAGE_SEARCH_FEATURES(MessageObject.MESSAGES, "searchFeatures"), MESSAGE_DOWNLOADING_UPDATE(MessageObject.MESSAGES, "downloadingUpdateFile"), MESSAGE_ONLY_FEW_ARROWS_LEFT(MessageObject.MESSAGES, "onlyFewArrowsLeft"), @@ -214,7 +204,6 @@ public enum Message { MESSAGE_SECOND_STATUS(MessageObject.MESSAGES, "secondStatus"), MESSAGE_FALLBACK_STATUS(MessageObject.MESSAGES, "fallbackStatus"), MESSAGE_LEGENDARY_SEA_CREATURE_WARNING(MessageObject.MESSAGES, "legendarySeaCreatureWarning"), - MESSAGE_CANCELLED_NON_LOGS_BREAK(MessageObject.MESSAGES, "cancelledPark"), MESSAGE_BOSS_APPROACH_ALERT(MessageObject.MESSAGES, "bossApproaching"), MESSAGE_ENABLE_ALL(MessageObject.MESSAGES, "enableAll"), MESSAGE_DISABLE_ALL(MessageObject.MESSAGES, "disableAll"), diff --git a/src/main/java/codes/biscuit/skyblockaddons/features/craftingpatterns/CraftingPattern.java b/src/main/java/codes/biscuit/skyblockaddons/features/craftingpatterns/CraftingPattern.java deleted file mode 100644 index 29ce5a8b6f..0000000000 --- a/src/main/java/codes/biscuit/skyblockaddons/features/craftingpatterns/CraftingPattern.java +++ /dev/null @@ -1,146 +0,0 @@ -package codes.biscuit.skyblockaddons.features.craftingpatterns; - -import codes.biscuit.skyblockaddons.core.Feature; -import codes.biscuit.skyblockaddons.features.ItemDiff; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * {@link Feature#CRAFTING_PATTERNS Crafting patterns} enum, constants and utility methods - * - * @author DidiSkywalker - */ -public enum CraftingPattern { - - FREE(0, null), - THREE(1, new int[]{ - 1, 1, 1, - 0, 0, 0, - 0, 0, 0 - }), - FIVE(2, new int[]{ - 1, 1, 1, - 1, 1, 0, - 0, 0, 0 - }), - SIX(3, new int[]{ - 1, 1, 1, - 1, 1, 1, - 0, 0, 0 - }); - - public static final ResourceLocation ICONS = new ResourceLocation("skyblockaddons", "craftingpatterns.png"); - - /** - * Displayname of the SkyBlock crafting table - */ - public static final String CRAFTING_TABLE_DISPLAYNAME = "Craft Item"; - - /** - * Slot index of the crafting result - */ - public static final int CRAFTING_RESULT_INDEX = 23; - - public static final List CRAFTING_GRID_SLOTS = Arrays.asList( - 10, 11, 12, - 19, 20, 21, - 28, 29, 30 - ); - - public final int index; - public final int[] pattern; - - CraftingPattern(final int index, final int[] pattern) { - this.index = index; - this.pattern = pattern; - } - - /** - * Check if a translated slot is within the pattern - * - * @param slot Slot index translated with {@link #slotToCraftingGridIndex(int)} - * @return Whether that slot is within the pattern - */ - public boolean isSlotInPattern(int slot) { - return slot >= 0 && slot <= 8 && pattern[slot] == 1; - } - - /** - * Checks the items of a crafting grid against the pattern for these characteristics: - * - filled: Every expected slot is filled, but other slots may be filled too - * - satisfied: Only expected slots are filled - * - free space: Amount of items that still fit into the stacks inside the patterns - * - * @param grid ItemStack array of length 9 containing the items of the crafting grid - * @return {@link CraftingPatternResult} containing all above mentioned characteristics - */ - public CraftingPatternResult checkAgainstGrid(ItemStack[] grid) { - if(grid == null || grid.length < 9) { - throw new IllegalArgumentException("grid cannot be null or smaller than 9."); - } - - boolean filled = true; - boolean satisfied = true; - int emptySpace = 0; - Map freeSpaceMap = new HashMap<>(); - - for(int i = 0; i < pattern.length; i++) { - ItemStack itemStack = grid[i]; - boolean hasStack = itemStack != null; - - if(isSlotInPattern(i) && !hasStack) { - filled = false; - satisfied = false; - } else if(!isSlotInPattern(i) && hasStack) { - satisfied = false; - } - - if(isSlotInPattern(i)) { - if(hasStack) { - if(!freeSpaceMap.containsKey(itemStack.getDisplayName())) { - freeSpaceMap.put(itemStack.getDisplayName(), new ItemDiff(itemStack.getDisplayName(), 0)); - } - - ItemDiff diff = freeSpaceMap.get(itemStack.getDisplayName()); - diff.add(itemStack.getMaxStackSize() - itemStack.stackSize); - } else { - // empty slot inside the pattern: add 64 free space - emptySpace += 64; - } - } - } - - return new CraftingPatternResult(filled, satisfied, emptySpace, freeSpaceMap); - } - - /** - * Translates a slot index to the corresponding index in the crafting grid between 0 and 8 or - * return -1 if the slot is not within the crafting grid. - * - * @param slotIndex Slot index to translate - * @return index 0-8 or -1 if not in the crafting grid - */ - public static int slotToCraftingGridIndex(int slotIndex) { - return CRAFTING_GRID_SLOTS.indexOf(slotIndex); - } - - /** - * Translate a crafting grid index to the corresponding slot index in the full inventory - * - * @param index Crafting grid index 0-8 - * @return Slot index - */ - public static int craftingGridIndexToSlot(int index) { - if(index < 0 || index > 8) { - throw new IndexOutOfBoundsException("Crafting Grid index must be between 0 and 8"); - } - - return CRAFTING_GRID_SLOTS.get(index); - } - -} diff --git a/src/main/java/codes/biscuit/skyblockaddons/features/craftingpatterns/CraftingPatternResult.java b/src/main/java/codes/biscuit/skyblockaddons/features/craftingpatterns/CraftingPatternResult.java deleted file mode 100644 index 64ebd651fa..0000000000 --- a/src/main/java/codes/biscuit/skyblockaddons/features/craftingpatterns/CraftingPatternResult.java +++ /dev/null @@ -1,57 +0,0 @@ -package codes.biscuit.skyblockaddons.features.craftingpatterns; - -import codes.biscuit.skyblockaddons.features.ItemDiff; -import net.minecraft.item.ItemStack; - -import java.util.Map; - -/** - * Class containing results of pattern checks through {@link CraftingPattern#checkAgainstGrid(ItemStack[])} - */ -public class CraftingPatternResult { - - private final boolean filled; - private final boolean satisfied; - private final int emptySpace; - private final Map freeSpaceMap; - - CraftingPatternResult(boolean filled, boolean satisfied, int emptySpace, Map freeSpaceMap) { - this.filled = filled; - this.satisfied = satisfied; - this.emptySpace = emptySpace; - this.freeSpaceMap = freeSpaceMap; - } - - /** - * A pattern is considered filled if at least every expected slot is filled. Other slots may be filled too. - * - * @return Whether the checked grid filled the pattern - */ - public boolean isFilled() { - return filled; - } - - /** - * A pattern is considered satisfied if every expected slot and no other slots are filled. - * - * @return Whether the checked grid filled the pattern - */ - public boolean isSatisfied() { - return satisfied; - } - - /** - * Checks whether a given ItemStack can still fit inside without violating the pattern. - * - * @param itemStack ItemStack to check - * @return Whether that ItemStack can safely fit the pattern - */ - public boolean fitsItem(ItemStack itemStack) { - ItemDiff itemDiff = freeSpaceMap.getOrDefault(itemStack.getDisplayName(), null); - if(itemDiff != null) { - return itemStack.stackSize <= itemDiff.getAmount(); - } else { - return itemStack.stackSize <= emptySpace; - } - } -} diff --git a/src/main/java/codes/biscuit/skyblockaddons/gui/elements/CheckBox.java b/src/main/java/codes/biscuit/skyblockaddons/gui/elements/CheckBox.java index cb00c62a97..36b262f055 100644 --- a/src/main/java/codes/biscuit/skyblockaddons/gui/elements/CheckBox.java +++ b/src/main/java/codes/biscuit/skyblockaddons/gui/elements/CheckBox.java @@ -1,12 +1,12 @@ package codes.biscuit.skyblockaddons.gui.elements; import codes.biscuit.skyblockaddons.SkyblockAddons; -import codes.biscuit.skyblockaddons.features.craftingpatterns.CraftingPattern; import codes.biscuit.skyblockaddons.utils.DrawUtils; import codes.biscuit.skyblockaddons.utils.Utils; import codes.biscuit.skyblockaddons.utils.ColorCode; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; /** * CheckBox GUI element to use in other GUI elements. @@ -20,6 +20,8 @@ public interface OnToggleListener { void onToggle(boolean value); } + private static final ResourceLocation ICON = new ResourceLocation("skyblockaddons", "craftingpatterns.png"); + /** * Size of the CheckBox icon */ @@ -75,11 +77,11 @@ public void draw() { GlStateManager.scale(scale, scale, 1); int color = value ? ColorCode.WHITE.getColor() : ColorCode.GRAY.getColor(); - DrawUtils.drawText(text, scaledX + Math.round(size * 1.5f / scale), scaledY + (size / 2), color); + DrawUtils.drawText(text, scaledX + Math.round(size * 1.5F / scale), scaledY + (size / 2F), color); GlStateManager.disableDepth(); GlStateManager.enableBlend(); - Minecraft.getMinecraft().getTextureManager().bindTexture(CraftingPattern.ICONS); + Minecraft.getMinecraft().getTextureManager().bindTexture(ICON); GlStateManager.color(1, 1, 1, 1F); if (value) { diff --git a/src/main/java/codes/biscuit/skyblockaddons/gui/elements/CraftingPatternSelection.java b/src/main/java/codes/biscuit/skyblockaddons/gui/elements/CraftingPatternSelection.java deleted file mode 100644 index b959f50825..0000000000 --- a/src/main/java/codes/biscuit/skyblockaddons/gui/elements/CraftingPatternSelection.java +++ /dev/null @@ -1,95 +0,0 @@ -package codes.biscuit.skyblockaddons.gui.elements; - -import codes.biscuit.skyblockaddons.SkyblockAddons; -import codes.biscuit.skyblockaddons.features.craftingpatterns.CraftingPattern; -import codes.biscuit.skyblockaddons.core.Message; -import codes.biscuit.skyblockaddons.config.PersistentValuesManager; -import codes.biscuit.skyblockaddons.utils.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; - -/** - * GUI Element that lets the user select a {@link CraftingPattern} - * - * @author DidiSkywalker - */ -public class CraftingPatternSelection { - - /** - * Icon size in pixel - */ - public static final int ICON_SIZE = 32; - - /** - * Margin value to use between the icons - */ - private static final int MARGIN = 2; - - private final Minecraft mc; - private final int x; - private final int y; - private final CheckBox blockIncompleteCheckBox; - - public CraftingPatternSelection(Minecraft mc, int x, int y) { - this.mc = mc; - this.x = x; - this.y = y; - int checkBoxY = (y - MARGIN - 8); - String checkBoxText = Message.MESSAGE_BLOCK_INCOMPLETE_PATTERNS.getMessage(); - - PersistentValuesManager persistentValuesManager = SkyblockAddons.getInstance().getPersistentValuesManager(); - blockIncompleteCheckBox = new CheckBox(mc, x, checkBoxY, 8, checkBoxText, persistentValuesManager.getPersistentValues().isBlockCraftingIncompletePatterns()); - blockIncompleteCheckBox.setOnToggleListener(value -> { - persistentValuesManager.getPersistentValues().setBlockCraftingIncompletePatterns(value); - persistentValuesManager.saveValues(); - }); - } - - public void draw() { - GlStateManager.disableDepth(); - GlStateManager.enableBlend(); - Minecraft.getMinecraft().getTextureManager().bindTexture(CraftingPattern.ICONS); - GlStateManager.color(1,1,1, 1F); - for(CraftingPattern craftingPattern : CraftingPattern.values()) { - int offset = getYOffsetByIndex(craftingPattern.index); - GlStateManager.color(1,1,1, 1F); - mc.ingameGUI.drawTexturedModalRect(x, y+ offset, 0, offset, ICON_SIZE, ICON_SIZE); - if(craftingPattern != SkyblockAddons.getInstance().getPersistentValuesManager().getPersistentValues().getSelectedCraftingPattern()) { - GlStateManager.color(1,1,1, .5F); - mc.ingameGUI.drawTexturedModalRect(x, y+ offset, 33, 0, ICON_SIZE, ICON_SIZE); - } - } - GlStateManager.disableBlend(); - GlStateManager.enableDepth(); - - blockIncompleteCheckBox.draw(); - } - - public void mouseClicked(int mouseX, int mouseY, int mouseButton) { - blockIncompleteCheckBox.onMouseClick(mouseX, mouseY, mouseButton); - if(mouseButton != 0 - || mouseX < this.x || mouseX > this.x + ICON_SIZE - || mouseY < this.y || mouseY > this.y + CraftingPattern.values().length * (ICON_SIZE + MARGIN)) { - return; // cannot hit - } - - PersistentValuesManager persistentValuesManager = SkyblockAddons.getInstance().getPersistentValuesManager(); - - for (CraftingPattern craftingPattern : CraftingPattern.values()) { - int offset = getYOffsetByIndex(craftingPattern.index); - if(mouseY > this.y + offset && mouseY < this.y + offset + ICON_SIZE) { - if(persistentValuesManager.getPersistentValues().getSelectedCraftingPattern() != craftingPattern) { - SkyblockAddons.getInstance().getUtils().playLoudSound("gui.button.press", 1F); - persistentValuesManager.getPersistentValues().setSelectedCraftingPattern(craftingPattern); - persistentValuesManager.saveValues(); - } - } - } - - Utils.blockNextClick = true; - } - - private int getYOffsetByIndex(int index) { - return index * (ICON_SIZE + MARGIN); - } -}