Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/museum' into museum
Browse files Browse the repository at this point in the history
7azeemm committed Jan 10, 2025
2 parents 539e0dd + b3ee0f4 commit 7835a4b
Showing 51 changed files with 594 additions and 199 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ yacl_version=3.6.2+1.21.4
## HM API (https://github.com/AzureAaron/hm-api)
hm_api_version=1.0.1+1.21.2
## Mod Menu (https://modrinth.com/mod/modmenu/versions)
mod_menu_version = 12.0.0-beta.1
mod_menu_version = 13.0.0
## REI (https://modrinth.com/mod/rei/versions?l=fabric)
rei_version = 17.0.789
## EMI (https://modrinth.com/mod/emi/versions)
4 changes: 2 additions & 2 deletions src/main/java/de/hysky/skyblocker/SkyblockerMod.java
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
import de.hysky.skyblocker.config.datafixer.ConfigDataFixer;
import de.hysky.skyblocker.skyblock.StatusBarTracker;
import de.hysky.skyblocker.skyblock.item.tooltip.BackpackPreview;
import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr;
import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListManager;
import de.hysky.skyblocker.utils.Utils;
import de.hysky.skyblocker.utils.discord.DiscordRPCManager;
import de.hysky.skyblocker.utils.scheduler.MessageScheduler;
@@ -66,7 +66,7 @@ public void onInitializeClient() {
Scheduler.INSTANCE.scheduleCyclic(Utils::update, 20);
Scheduler.INSTANCE.scheduleCyclic(DiscordRPCManager::updateDataAndPresence, 200);
Scheduler.INSTANCE.scheduleCyclic(BackpackPreview::tick, 50);
Scheduler.INSTANCE.scheduleCyclic(PlayerListMgr::updateList, 20);
Scheduler.INSTANCE.scheduleCyclic(PlayerListManager::updateList, 20);
}

/**
Original file line number Diff line number Diff line change
@@ -227,6 +227,27 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.build())
.build())

.group(OptionGroup.createBuilder()
.name(Text.translatable("skyblocker.config.helpers.carnival"))
.collapsed(true)
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.helpers.carnival.catchAFishHelper"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.helpers.carnival.catchAFishHelper.@Tooltip")))
.binding(defaults.helpers.carnival.catchAFishHelper,
() -> config.helpers.carnival.catchAFishHelper,
newValue -> config.helpers.carnival.catchAFishHelper = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.helpers.carnival.zombieShootoutHelper"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.helpers.carnival.zombieShootoutHelper.@Tooltip")))
.binding(defaults.helpers.carnival.zombieShootoutHelper,
() -> config.helpers.carnival.zombieShootoutHelper,
newValue -> config.helpers.carnival.zombieShootoutHelper = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.build())

//Bazaar
.group(OptionGroup.createBuilder()
.name(Text.translatable("skyblocker.config.helpers.bazaar"))
Original file line number Diff line number Diff line change
@@ -42,6 +42,12 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.controller(ConfigUtils::createBooleanController)
.build())

.option(ButtonOption.createBuilder()
.name(Text.translatable("skyblocker.config.mining.dwarvenHud.screen"))
.text(Text.translatable("text.skyblocker.open"))
.action((screen, opt) -> MinecraftClient.getInstance().setScreen(new WidgetsConfigurationScreen(Location.DWARVEN_MINES, CommsWidget.ID, screen)))
.build())

//Dwarven Mines
.group(OptionGroup.createBuilder()
.name(Text.translatable("skyblocker.config.mining.dwarvenMines"))
Original file line number Diff line number Diff line change
@@ -248,6 +248,25 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.uiAndVisuals.tabHud.tabHudScale = newValue)
.controller(opt -> IntegerSliderControllerBuilder.create(opt).range(10, 200).step(1))
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.tabHud.showVanillaTabByDefault"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.tabHud.showVanillaTabByDefault.@Tooltip")))
.binding(defaults.uiAndVisuals.tabHud.showVanillaTabByDefault,
() -> config.uiAndVisuals.tabHud.showVanillaTabByDefault,
newValue -> config.uiAndVisuals.tabHud.showVanillaTabByDefault = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<UIAndVisualsConfig.TabHudStyle>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.tabHud.style"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.tabHud.style.@Tooltip[0]"),
Text.translatable("skyblocker.config.uiAndVisuals.tabHud.style.@Tooltip[1]"),
Text.translatable("skyblocker.config.uiAndVisuals.tabHud.style.@Tooltip[2]"),
Text.translatable("skyblocker.config.uiAndVisuals.tabHud.style.@Tooltip[3]")))
.binding(defaults.uiAndVisuals.tabHud.style,
() -> config.uiAndVisuals.tabHud.style,
newValue -> config.uiAndVisuals.tabHud.style = newValue)
.controller(ConfigUtils::createEnumCyclingListController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.tabHud.enableHudBackground"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.tabHud.enableHudBackground.@Tooltip")))
11 changes: 11 additions & 0 deletions src/main/java/de/hysky/skyblocker/config/configs/HelperConfig.java
Original file line number Diff line number Diff line change
@@ -32,6 +32,9 @@ public class HelperConfig {
@SerialEntry
public ChocolateFactory chocolateFactory = new ChocolateFactory();

@SerialEntry
public Carnival carnival = new Carnival();

@SerialEntry
public Bazaar bazaar = new Bazaar();

@@ -107,6 +110,14 @@ public static class ChocolateFactory {
public boolean straySound = true;
}

public static class Carnival {
@SerialEntry
public boolean catchAFishHelper = true;

@SerialEntry
public boolean zombieShootoutHelper = true;
}

public static class Bazaar {
@SerialEntry
public boolean enableBazaarHelper = true;
Original file line number Diff line number Diff line change
@@ -175,6 +175,10 @@ public static class Glacite {
public boolean autoShareCorpses = false;
}

/**
* @deprecated See {@link UIAndVisualsConfig.TabHudStyle}.
*/
@Deprecated
public enum DwarvenHudStyle {
SIMPLE, FANCY, CLASSIC;

Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
import de.hysky.skyblocker.skyblock.tabhud.screenbuilder.ScreenBuilder;
import de.hysky.skyblocker.utils.waypoint.Waypoint;
import dev.isxander.yacl3.config.v2.api.SerialEntry;
import it.unimi.dsi.fastutil.objects.Object2BooleanMap;
import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.util.Formatting;
@@ -108,7 +107,7 @@ public static class SlotText {
public SlotTextMode slotTextMode = SlotTextMode.ENABLED;

@SerialEntry
public Object2BooleanMap<String> textEnabled = new Object2BooleanOpenHashMap<>();
public Object2BooleanOpenHashMap<String> textEnabled = new Object2BooleanOpenHashMap<>();

@SerialEntry
public boolean slotTextToggled = true;
@@ -191,6 +190,12 @@ public static class TabHudConf {
@SerialEntry
public int tabHudScale = 100;

@SerialEntry
public boolean showVanillaTabByDefault = false;

@SerialEntry
public TabHudStyle style = TabHudStyle.FANCY;

@SerialEntry
public boolean enableHudBackground = true;

@@ -207,6 +212,36 @@ public static class TabHudConf {
public NameSorting nameSorting = NameSorting.DEFAULT;
}

public enum TabHudStyle {
/**
* The minimal style, with no decorations, icons, or custom components,
* rendered in a minimal rectangle background,
* or no background at all if {@link TabHudConf#enableHudBackground} is false.
*/
MINIMAL,
/**
* The simple style, with no decorations, icons, or custom components.
*/
SIMPLE,
/**
* The classic style, with decorations such as icons but no custom components.
*/
CLASSIC,
/**
* The default style, with all custom components and decorations in use.
*/
FANCY;

public boolean isMinimal() {
return this == MINIMAL;
}

@Override
public String toString() {
return I18n.translate("skyblocker.config.uiAndVisuals.tabHud.style." + name());
}
}

@Deprecated
public enum NameSorting {
DEFAULT, ALPHABETICAL;
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
import de.hysky.skyblocker.skyblock.end.TheEnd;
import de.hysky.skyblocker.skyblock.slayers.SlayerManager;
import de.hysky.skyblocker.skyblock.slayers.boss.demonlord.FirePillarAnnouncer;
import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr;
import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListManager;
import de.hysky.skyblocker.skyblock.waypoint.MythologicalRitual;
import de.hysky.skyblocker.utils.Utils;
import net.minecraft.client.network.ClientPlayNetworkHandler;
@@ -101,7 +101,7 @@ public abstract class ClientPlayNetworkHandlerMixin {

@Inject(method = "onPlayerListHeader", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;setFooter(Lnet/minecraft/text/Text;)V"))
private void skyblocker$updatePlayerListFooter(PlayerListHeaderS2CPacket packet, CallbackInfo ci) {
PlayerListMgr.updateFooter(packet.footer());
PlayerListManager.updateFooter(packet.footer());
}

@WrapWithCondition(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
Original file line number Diff line number Diff line change
@@ -201,6 +201,6 @@ public abstract class InGameHudMixin {

@WrapWithCondition(method = "renderPlayerList", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;render(Lnet/minecraft/client/gui/DrawContext;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreboardObjective;)V"))
private boolean skyblocker$shouldRenderHud(PlayerListHud playerListHud, DrawContext context, int scaledWindowWidth, Scoreboard scoreboard, ScoreboardObjective objective) {
return !Utils.isOnSkyblock() || !SkyblockerConfigManager.get().uiAndVisuals.tabHud.tabHudEnabled || TabHud.defaultTgl.isPressed() || MinecraftClient.getInstance().currentScreen instanceof WidgetsConfigurationScreen;
return !Utils.isOnSkyblock() || !SkyblockerConfigManager.get().uiAndVisuals.tabHud.tabHudEnabled || TabHud.shouldRenderVanilla() || MinecraftClient.getInstance().currentScreen instanceof WidgetsConfigurationScreen;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package de.hysky.skyblocker.skyblock.carnival;

import java.awt.Color;

import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.entity.MobGlow;
import de.hysky.skyblocker.utils.ItemUtils;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;

public class CatchAFish {
private static final MinecraftClient CLIENT = MinecraftClient.getInstance();
private static final Box AREA = Box.enclosing(new BlockPos(-69, 65, -5), new BlockPos(-87, 84, 22));
private static final String YELLOW_FISH_TEXTURE = "ewogICJ0aW1lc3RhbXAiIDogMTcyMDA1MjU4MjAwMSwKICAicHJvZmlsZUlkIiA6ICIzM2Y4ZGExMTU1MzQ0YWQ5OWQ0Y2Q2ZjNhYjFjMjNhYSIsCiAgInByb2ZpbGVOYW1lIiA6ICJCXzFfUl9CIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzM2MGY0Zjk5Yzc4YWRkZGVhYjI3NmViZGY2YWI5YTBmY2ZmYWJkNDlmMGI1NDNlMTk4MWFjN2JkM2Q1NWIxOGEiLAogICAgICAibWV0YWRhdGEiIDogewogICAgICAgICJtb2RlbCIgOiAic2xpbSIKICAgICAgfQogICAgfQogIH0KfQ==";
private static final int YELLOW = Color.YELLOW.getRGB();

public static int getFishGlowColor(ArmorStandEntity armorStand) {
ItemStack stack = armorStand.getEquippedStack(EquipmentSlot.HEAD);

if (!stack.isEmpty() && stack.isOf(Items.PLAYER_HEAD) && ItemUtils.getHeadTexture(stack).equals(YELLOW_FISH_TEXTURE)) {
return YELLOW;
}

return MobGlow.NO_GLOW;
}

public static boolean isInCatchAFish() {
if (ChivalrousCarnival.isInCarnival() && SkyblockerConfigManager.get().helpers.carnival.catchAFishHelper && CLIENT.player != null) {
BlockPos pos = CLIENT.player.getBlockPos();

return AREA.contains(pos.getX(), pos.getY(), pos.getZ());
}

return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package de.hysky.skyblocker.skyblock.carnival;

import de.hysky.skyblocker.utils.Area;
import de.hysky.skyblocker.utils.Location;
import de.hysky.skyblocker.utils.Utils;

public class ChivalrousCarnival {

protected static boolean isInCarnival() {
return Utils.isOnSkyblock() && Utils.getLocation() == Location.HUB && Utils.getArea() == Area.CARNIVAL;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package de.hysky.skyblocker.skyblock.carnival;

import de.hysky.skyblocker.annotations.Init;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.entity.MobGlow;
import de.hysky.skyblocker.utils.render.RenderHelper;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.mob.ZombieEntity;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;

public class ZombieShootout {
private static final MinecraftClient CLIENT = MinecraftClient.getInstance();
private static final float[] RED = { 1, 0, 0 };
private static final Box SHOOTING_BOX = Box.enclosing(new BlockPos(-100, 70, 15), new BlockPos(-102, 75, 13));
private static final BlockPos[] LAMPS = {
new BlockPos(-96, 76, 31),
new BlockPos(-99, 77, 32),
new BlockPos(-102, 75, 32),
new BlockPos(-106, 77, 31),
new BlockPos(-109, 75, 30),
new BlockPos(-112, 76, 28),
new BlockPos(-115, 77, 25),
new BlockPos(-117, 76, 22),
new BlockPos(-118, 76, 19),
new BlockPos(-119, 75, 15),
new BlockPos(-119, 77, 12),
new BlockPos(-118, 76, 9)
};

@Init
public static void init() {
WorldRenderEvents.AFTER_TRANSLUCENT.register(ZombieShootout::render);
}

private static void render(WorldRenderContext context) {
if (isInZombieShootout() && CLIENT.world != null) {
for (BlockPos pos : LAMPS) {
BlockState state = CLIENT.world.getBlockState(pos);
Block block = state.getBlock();

if (block.equals(Blocks.REDSTONE_LAMP) && state.contains(Properties.LIT) && state.get(Properties.LIT)) {
RenderHelper.renderOutline(context, pos, RED, 5f, false);
}
}
}
}

public static int getZombieGlowColor(ZombieEntity zombie) {
if (!zombie.getEquippedStack(EquipmentSlot.CHEST).isEmpty()) {
Item item = zombie.getEquippedStack(EquipmentSlot.CHEST).getItem();

//Uses the same colors as the dojo stuff
return switch (item) {
case Item i when i == Items.DIAMOND_CHESTPLATE -> 0x00ffff;
case Item i when i == Items.GOLDEN_CHESTPLATE -> 0xffd700;
case Item i when i == Items.IRON_CHESTPLATE -> 0xc0c0c0;
case Item i when i == Items.LEATHER_CHESTPLATE -> 0xa52a2a;

default -> MobGlow.NO_GLOW;
};
}

return MobGlow.NO_GLOW;
}

public static boolean isInZombieShootout() {
if (ChivalrousCarnival.isInCarnival() && SkyblockerConfigManager.get().helpers.carnival.zombieShootoutHelper && CLIENT.player != null) {
BlockPos pos = CLIENT.player.getBlockPos();

return SHOOTING_BOX.contains(pos.getX(), pos.getY(), pos.getZ());
}

return false;
}
}
Loading

0 comments on commit 7835a4b

Please sign in to comment.