Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean-up code for some removed features #579

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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!");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,6 @@ public class MinecraftHook {

@Getter private static long lastLockedSlotItemChange = -1;

private static final Set<Location> 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<Location> 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<Block> 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<Block> 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<String> 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<Location> PARK_LOCATIONS = EnumSet.of(Location.BIRCH_PARK, Location.SPRUCE_WOODS, Location.SAVANNA_WOODLAND, Location.DARK_THICKET, Location.JUNGLE_ISLAND);

private static final Set<Block> 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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Integer> 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.
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -37,9 +36,6 @@ public static class PersistentValues {
private DragonTrackerData dragonTracker = new DragonTrackerData();
private Map<String, CompressedStorage> storageCache = new HashMap<>();

private boolean blockCraftingIncompletePatterns = true;
private CraftingPattern selectedCraftingPattern = CraftingPattern.FREE;

private int oresMined = 0;
private int seaCreaturesKilled = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -227,8 +222,7 @@ public enum Feature {
*/
private static final Set<Feature> 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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package codes.biscuit.skyblockaddons.core;

import codes.biscuit.skyblockaddons.features.craftingpatterns.CraftingPattern;
import lombok.Getter;

import java.util.regex.Pattern;
Expand All @@ -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 \\((?<type>[a-zA-Z]+)\\)"),
CHRONOMATRON("Chronomatron", "Chronomatron \\((?<type>[a-zA-Z]+)\\)"),
Expand Down
Loading