Skip to content

Commit

Permalink
More bug fixes, ready for 1.5.1 patch release.
Browse files Browse the repository at this point in the history
  • Loading branch information
biscuut committed Jun 25, 2020
1 parent b1966a8 commit e366146
Show file tree
Hide file tree
Showing 19 changed files with 74 additions and 66 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2G
# SkyblockAddons Properties
modId = skyblockaddons
modName = SkyblockAddons
version = 1.5.0
version = 1.5.1
acceptedMinecraftVersions = [1.8.9]
minecraftVersion = 1.8.9
forgeVersion = 11.15.1.2318-1.8.9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public KeyBinding getFreezeBackpackKey() {
static {
//noinspection ConstantConditions
if (VERSION.contains("@")) { // Debug environment...
VERSION = "1.5.0";
VERSION = "1.5.1";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ModelEndermanHook {

public static void setEndermanColor() {
SkyblockAddons main = SkyblockAddons.getInstance();
if (main.getUtils().isOnSkyblock() && main.getUtils().getLocation() == Location.THE_END && main.getConfigValues().isEnabled(Feature.CHANGE_ZEALOT_COLOR)) {
if (main.getUtils().isOnSkyblock() && main.getUtils().getLocation() == Location.DRAGONS_NEST && main.getConfigValues().isEnabled(Feature.CHANGE_ZEALOT_COLOR)) {
Color color = main.getConfigValues().getColor(Feature.CHANGE_ZEALOT_COLOR);
GlStateManager.color((float)color.getRed()/255, (float)color.getGreen()/255, (float)color.getBlue()/255);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import codes.biscuit.skyblockaddons.core.Location;
import codes.biscuit.skyblockaddons.core.Message;
import codes.biscuit.skyblockaddons.utils.*;
import codes.biscuit.skyblockaddons.utils.item.ItemUtils;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
Expand Down Expand Up @@ -193,9 +194,14 @@ public static void onWindowClick(int slotNum, int mouseButtonClicked, int mode,
if (main.getConfigValues().isEnabled(Feature.LOCK_SLOTS)
&& main.getConfigValues().getLockedSlots().contains(slotNum)
&& (slotNum >= 9 || player.openContainer instanceof ContainerPlayer && slotNum >= 5)) {
if (mouseButtonClicked == 1 && mode == 0 && slotIn != null && slotIn.getHasStack() &&
slotIn.getStack().getItem() == Items.skull && BackpackManager.isBackpack(slotIn.getStack())) {
return;
if (mouseButtonClicked == 1 && mode == 0 && slotIn != null && slotIn.getHasStack() && slotIn.getStack().getItem() == Items.skull) {

String itemID = ItemUtils.getSkyBlockItemID(slotIn.getStack());
if (itemID == null) itemID = "";

if (BackpackManager.isBackpack(slotIn.getStack()) || itemID.contains("SACK")) {
return;
}
}

main.getUtils().playLoudSound("note.bass", 0.5);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/codes/biscuit/skyblockaddons/core/Feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ public enum Feature {
TEXT_STYLE(-1, Message.SETTING_TEXT_STYLE, false),
CHROMA_SPEED(-1, Message.SETTING_CHROMA_SPEED, false),
CHROMA_MODE(-1, Message.SETTING_CHROMA_MODE, false),
CHROMA_FADE_WIDTH(-1, Message.SETTING_CHROMA_FADE_WIDTH, false);
CHROMA_FADE_WIDTH(-1, Message.SETTING_CHROMA_FADE_WIDTH, false),
TURN_ALL_FEATURES_CHROMA(-1, Message.SETTING_TURN_ALL_FEATURES_CHROMA, false);

/**
* These are "features" that are not actually features, but just hold the place of a setting. If you are adding any new settings and create
Expand All @@ -168,7 +169,7 @@ public enum Feature {
/**
* These are features that are displayed separate, on the general tab.
*/
@Getter private static final Set<Feature> generalTabFeatures = new LinkedHashSet<>(Arrays.asList(TEXT_STYLE, WARNING_TIME, CHROMA_SPEED, CHROMA_MODE, CHROMA_FADE_WIDTH));
@Getter private static final Set<Feature> generalTabFeatures = new LinkedHashSet<>(Arrays.asList(TEXT_STYLE, WARNING_TIME, CHROMA_SPEED, CHROMA_MODE, CHROMA_FADE_WIDTH, TURN_ALL_FEATURES_CHROMA));

private int id;
private Message message;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/codes/biscuit/skyblockaddons/core/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public enum Message {
SETTING_DISABLE_ENDERMAN_TELEPORTATION_EFFECT(MessageObject.SETTING, "disableEndermanTeleportation"),
SETTING_CHANGE_ZEALOT_COLOR(MessageObject.SETTING, "changeZealotColor"),
SETTING_HIDE_SVEN_PUP_NAMETAGS(MessageObject.SETTING, "hideSvenPupNametags"),
SETTING_TURN_ALL_FEATURES_CHROMA(MessageObject.SETTING, "turnAllFeaturesChroma"),

BACKPACK_STYLE_REGULAR(MessageObject.BACKPACK_STYLE, "regular"),
BACKPACK_STYLE_COMPACT(MessageObject.BACKPACK_STYLE, "compact"),
Expand Down Expand Up @@ -184,7 +185,8 @@ public enum Message {
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"),

@Deprecated ANCHOR_POINT_TOP_LEFT(MessageObject.ANCHOR_POINT, "topLeft"),
@Deprecated ANCHOR_POINT_TOP_RIGHT(MessageObject.ANCHOR_POINT, "topRight"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void initGui() {

for (Feature feature : features) {
if (skip == 0) {
if (feature == Feature.TEXT_STYLE || feature == Feature.WARNING_TIME || feature == Feature.CHROMA_MODE) {
if (feature == Feature.TEXT_STYLE || feature == Feature.WARNING_TIME || feature == Feature.CHROMA_MODE || feature == Feature.TURN_ALL_FEATURES_CHROMA) {
addButton(feature, EnumUtils.ButtonType.SOLID);
} else if (feature == Feature.CHROMA_SPEED || feature == Feature.CHROMA_FADE_WIDTH) {
addButton(feature, EnumUtils.ButtonType.CHROMA_SLIDER);
Expand Down Expand Up @@ -253,6 +253,27 @@ protected void actionPerformed(GuiButton abstractButton) {
cancelClose = true;
Minecraft.getMinecraft().displayGuiScreen(new SkyblockAddonsGui(main, page, tab));
cancelClose = false;
} else if (feature == Feature.TURN_ALL_FEATURES_CHROMA) {
boolean enable = false;

for (Feature loopFeature : Feature.values()) {
if (loopFeature.getGuiFeatureData() != null && loopFeature.getGuiFeatureData().getDefaultColor() != null) {
if (!main.getConfigValues().getChromaFeatures().contains(loopFeature)) {
enable = true;
break;
}
}
}

for (Feature loopFeature : Feature.values()) {
if (loopFeature.getGuiFeatureData() != null && loopFeature.getGuiFeatureData().getDefaultColor() != null) {
if (enable) {
main.getConfigValues().getChromaFeatures().add(loopFeature);
} else {
main.getConfigValues().getChromaFeatures().remove(loopFeature);
}
}
}
}
} else if (abstractButton instanceof ButtonModify) {
if (feature == Feature.ADD) {
Expand Down Expand Up @@ -400,7 +421,7 @@ private void addButton(Feature feature, EnumUtils.ButtonType buttonType) {
} else if (buttonType == EnumUtils.ButtonType.SOLID) {
buttonList.add(new ButtonNormal(x, y, text, main, feature));

if (feature == Feature.TEXT_STYLE || feature == Feature.CHROMA_MODE) {
if (feature == Feature.TEXT_STYLE || feature == Feature.CHROMA_MODE || feature == Feature.TURN_ALL_FEATURES_CHROMA) {
buttonList.add(new ButtonSolid(x+10, y + boxHeight - 23, 120, 15, "", main, feature));
} else if (feature == Feature.WARNING_TIME) {
int solidButtonX = x+(boxWidth/2)-17;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import codes.biscuit.skyblockaddons.SkyblockAddons;
import codes.biscuit.skyblockaddons.core.Feature;
import codes.biscuit.skyblockaddons.core.Message;
import codes.biscuit.skyblockaddons.utils.nifty.reflection.MinecraftReflection;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.SoundHandler;
Expand Down Expand Up @@ -38,6 +39,17 @@ public void drawButton(Minecraft mc, int mouseX, int mouseY) {
displayString = main.getConfigValues().getChromaMode().getMessage();
} else if (feature == Feature.WARNING_TIME) {
displayString = main.getConfigValues().getWarningSeconds()+"s";
} else if (feature == Feature.TURN_ALL_FEATURES_CHROMA) {
boolean enable = false;
for (Feature loopFeature : Feature.values()) {
if (loopFeature.getGuiFeatureData() != null && loopFeature.getGuiFeatureData().getDefaultColor() != null) {
if (!main.getConfigValues().getChromaFeatures().contains(loopFeature)) {
enable = true;
break;
}
}
}
displayString = (enable ? Message.MESSAGE_ENABLE_ALL : Message.MESSAGE_DISABLE_ALL).getMessage();
}
int alpha;
float alphaMultiplier = 1F;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void drawButton(Minecraft mc, int mouseX, int mouseY, boolean actuallyDra
}

mc.getTextureManager().bindTexture(island.getResourceLocation());
SkyblockAddons.getInstance().getUtils().drawModalRectWithCustomSizedTexture(x, y, 0, 0, w, h, w, h, true);
SkyblockAddons.getInstance().getUtils().drawModalRectWithCustomSizedTexture(x, y, 0, 0, w, h, w, h);

for (IslandMarkerButton marker : markerButtons) {
marker.drawButton(x, y, expansion, hovered, unlocked, this.markers.get(marker.getMarker()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private void renderWarnings(ScaledResolution scaledResolution) {

float scale = 4; // Scale is normally 4, but if its larger than the screen, scale it down...
if (stringWidth*scale > (scaledWidth*0.9F)) {
scale = scaledWidth/(float)stringWidth;
scale = (scaledWidth*0.9F)/(float)stringWidth;
}

GlStateManager.pushMatrix();
Expand Down Expand Up @@ -259,7 +259,7 @@ private void renderWarnings(ScaledResolution scaledResolution) {

float scale = 2; // Scale is normally 2, but if its larger than the screen, scale it down...
if (stringWidth*scale > (scaledWidth*0.9F)) {
scale = scaledWidth/(float)stringWidth;
scale = (scaledWidth*0.9F)/(float)stringWidth;
}

GlStateManager.pushMatrix();
Expand Down Expand Up @@ -1280,7 +1280,7 @@ private void drawCompactPowerOrbStatus(Minecraft mc, float scale, ButtonLocation
main.getUtils().enableStandardGLOptions();

mc.getTextureManager().bindTexture(powerOrb.getResourceLocation());
main.getUtils().drawModalRectWithCustomSizedTexture(x, y, 0, 0, iconSize, iconSize, iconSize, iconSize, false);
main.getUtils().drawModalRectWithCustomSizedTexture(x, y, 0, 0, iconSize, iconSize, iconSize, iconSize);

main.getUtils().drawTextWithStyle(secondsString, x + spacing + iconSize, y + (iconSize / 2F) - (8 / 2F), ChatFormatting.WHITE.getColor(255).getRGB());

Expand Down Expand Up @@ -1341,7 +1341,7 @@ private void drawDetailedPowerOrbStatus(Minecraft mc, float scale, ButtonLocatio
main.getUtils().enableStandardGLOptions();

mc.getTextureManager().bindTexture(powerOrb.getResourceLocation());
main.getUtils().drawModalRectWithCustomSizedTexture(x, y, 0, 0, iconSize, iconSize, iconSize, iconSize, false);
main.getUtils().drawModalRectWithCustomSizedTexture(x, y, 0, 0, iconSize, iconSize, iconSize, iconSize);

String secondsString = String.format("§e%ss", seconds);
main.getUtils().drawTextWithStyle(secondsString, Math.round(x + (iconSize / 2F) - (MinecraftReflection.FontRenderer.getStringWidth(secondsString) / 2F)), y + iconSize, ChatFormatting.WHITE.getColor(255).getRGB());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public enum EnchantedItemBlacklist {
ENCHANTED_SNOW("ENCHANTED_SNOW_BLOCK", false, Feature.AVOID_PLACING_ENCHANTED_ITEMS, true),
ENCHANTED_STRING("ENCHANTED_STRING", false, Feature.AVOID_PLACING_ENCHANTED_ITEMS, true),
ENCHANTED_WOOL("ENCHANTED_WOOL", true, Feature.AVOID_PLACING_ENCHANTED_ITEMS, true),
WEIRD_TUBA("WEIRD_TUBA", false, Feature.AVOID_PLACING_ENCHANTED_ITEMS, true),
EMBER_ROD("EMBER_ROD", true, Feature.DISABLE_EMBER_ROD, false);

private String itemId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public int getSlotDifference(Container container) {
*/
public void checkIfWearingSlayerArmor(EntityPlayerSP p) {
if (main.getConfigValues().isEnabled(Feature.SLAYER_INDICATOR)) {
for (int i = 3; i > -1; i--) {
for (int i = 3; i >= 0; i--) {
ItemStack item = p.inventory.armorInventory[i];
String itemID = item != null ? ItemUtils.getSkyBlockItemID(item) : null;

Expand Down
56 changes: 9 additions & 47 deletions src/main/java/codes/biscuit/skyblockaddons/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public void checkGameLocationDate() {
}

private static final Pattern SLAYER_SCOREBOARD_PATTERN = Pattern.compile("(?<progress>[0-9.k]*)/(?<total>[0-9.k]*) (?:Kills|Combat XP)$");
private float lastSlayerCompletion;
private boolean triggeredSlayerWarning = false;

private void parseSlayerProgress(String line) {
if (!main.getConfigValues().isEnabled(Feature.BOSS_APPROACH_ALERT)) return;
Expand All @@ -376,58 +376,20 @@ private void parseSlayerProgress(String line) {

float completion = progress/total;

// They progressed farther on the same quest, let's not show the same warning.
if (completion > lastSlayerCompletion) {
return;
}
lastSlayerCompletion = completion;

if (completion > 0.85) {
main.getUtils().playLoudSound("random.orb", 0.5);
main.getRenderListener().setTitleFeature(Feature.BOSS_APPROACH_ALERT);
main.getScheduler().schedule(Scheduler.CommandType.RESET_TITLE_FEATURE, main.getConfigValues().getWarningSeconds());
if (!triggeredSlayerWarning) {
triggeredSlayerWarning = true;
main.getUtils().playLoudSound("random.orb", 0.5);
main.getRenderListener().setTitleFeature(Feature.BOSS_APPROACH_ALERT);
main.getScheduler().schedule(Scheduler.CommandType.RESET_TITLE_FEATURE, main.getConfigValues().getWarningSeconds());
}
} else {
triggeredSlayerWarning = false; // Reset warning flag when completion is below 85%, meaning they started a new quest.
}
}
}

private void onCoinsChange(double coinsChange) {
if (true) return;

// main.getPlayerListener().getExplosiveBowExplosions().keySet().removeIf((explosionTime) -> System.currentTimeMillis() - explosionTime > 1500);
// Map.Entry<Long, Vec3> latestExplosion = main.getPlayerListener().getExplosiveBowExplosions().lastEntry();
// if (latestExplosion == null) return;
//
// Vec3 explosionLocation = latestExplosion.getValue();
// int lastExplosion = (int) (System.currentTimeMillis() - latestExplosion.getKey());
// System.out.println("Detected coins change of "+coinsChange+". Last explosion was "+lastExplosion+"ms ago...");
//
// int possibleZealotsKilled = (int)(coinsChange/42); // 42.5 coins per zealot kill...S
//
// System.out.println("This means "+possibleZealotsKilled+" may have been killed...");
//
// main.getPlayerListener().getRecentlyKilledZealots().keySet().removeIf((zealotSpawnTime) -> System.currentTimeMillis() - zealotSpawnTime > lastExplosion+200);
//
// int originalPossibleZealotsKilled = possibleZealotsKilled;
//
// Iterator<Map.Entry<Long, Vec3>> recentZealotsIterator = main.getPlayerListener().getRecentlyKilledZealots().entries().iterator();
// while (possibleZealotsKilled > 0) {
// if (recentZealotsIterator.hasNext()) {
// Map.Entry<Long, Vec3> recentZealotEntry = recentZealotsIterator.next();
// Vec3 deathLocation = recentZealotEntry.getValue();
//
// if (explosionLocation.distanceTo(deathLocation) < 4.6) {
// possibleZealotsKilled--;
// recentZealotsIterator.remove();
//
// main.getPersistentValues().addKill();
// EndstoneProtectorManager.onKill();
// }
// } else {
// break; // No more possible zealots...
// }
// }
//
// System.out.println((originalPossibleZealotsKilled-possibleZealotsKilled)+" zealots were actually killed...");
}

public int getDefaultColor(float alphaFloat) {
Expand Down
Binary file modified src/main/resources/assets/skyblockaddons/icons/enderman.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/assets/skyblockaddons/icons/magmaboss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/assets/skyblockaddons/icons/summoningeye.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/resources/assets/skyblockaddons/icons/zealotspereye.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions src/main/resources/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@
"zealotCounterExplosiveBow": "Zealot Counter Explosive Bow Support",
"disableEndermanTeleportation": "Disable Enderman Teleportation",
"changeZealotColor": "Change Zealot Color",
"hideSvenPupNametags": "Hide Sven Pup Nametags"
"hideSvenPupNametags": "Hide Sven Pup Nametags",
"turnAllFeaturesChroma": "Turn All Features Chroma"
},
"messages": {
"dropConfirmation": "Drop this item again to confirm!",
Expand Down Expand Up @@ -188,7 +189,9 @@
"fallbackStatus": "This status will appear when your automatic status has nothing to show",
"legendarySeaCreatureWarning": "Legendary Catch!",
"cancelledPark": "A feature has stopped you from breaking this block here.",
"bossApproaching": "You are close to spawning a boss!"
"bossApproaching": "You are close to spawning a boss!",
"enableAll": "Enable All",
"disableAll": "Disable All"
},
"discordStatus": {
"titleNone": "None",
Expand Down

0 comments on commit e366146

Please sign in to comment.