Skip to content

Commit

Permalink
Merge branch 'SkyblockerMod:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamKracker authored Dec 26, 2024
2 parents d2d7ac3 + 7ce731f commit ed9d6a1
Show file tree
Hide file tree
Showing 67 changed files with 2,278 additions and 930 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package de.hysky.skyblocker.compatibility.emi;

import de.hysky.skyblocker.SkyblockerMod;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.mixins.accessors.HandledScreenAccessor;
import de.hysky.skyblocker.skyblock.itemlist.ItemRepository;
import de.hysky.skyblocker.utils.ItemUtils;
import de.hysky.skyblocker.utils.Location;
import de.hysky.skyblocker.utils.Utils;
import dev.emi.emi.api.EmiPlugin;
import dev.emi.emi.api.EmiRegistry;
import dev.emi.emi.api.recipe.EmiRecipeCategory;
import dev.emi.emi.api.render.EmiTexture;
import dev.emi.emi.api.stack.Comparison;
import dev.emi.emi.api.stack.EmiStack;
import dev.emi.emi.api.widget.Bounds;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;

Expand All @@ -29,5 +35,10 @@ public void register(EmiRegistry registry) {
registry.addCategory(SKYBLOCK);
registry.addWorkstation(SKYBLOCK, EmiStack.of(Items.CRAFTING_TABLE));
ItemRepository.getRecipesStream().map(SkyblockEmiRecipe::new).forEach(registry::addRecipe);
registry.addExclusionArea(InventoryScreen.class, (screen, consumer) -> {
if (!SkyblockerConfigManager.get().farming.garden.gardenPlotsWidget || !Utils.getLocation().equals(Location.GARDEN)) return;
HandledScreenAccessor accessor = (HandledScreenAccessor) screen;
consumer.accept(new Bounds(accessor.getX() + accessor.getBackgroundWidth() + 4, accessor.getY(), 104, 127));
});
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
package de.hysky.skyblocker.compatibility.jei;

import de.hysky.skyblocker.SkyblockerMod;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.mixins.accessors.HandledScreenAccessor;
import de.hysky.skyblocker.skyblock.itemlist.ItemRepository;
import de.hysky.skyblocker.utils.Location;
import de.hysky.skyblocker.utils.Utils;
import de.hysky.skyblocker.utils.datafixer.ItemStackComponentizationFixer;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.handlers.IGuiContainerHandler;
import mezz.jei.api.registration.IGuiHandlerRegistration;
import mezz.jei.api.registration.IRecipeCategoryRegistration;
import mezz.jei.api.registration.IRecipeRegistration;
import mezz.jei.api.registration.ISubtypeRegistration;
import mezz.jei.library.ingredients.subtypes.SubtypeInterpreters;
import mezz.jei.library.load.registration.SubtypeRegistration;
import mezz.jei.library.plugins.vanilla.crafting.CraftingCategoryExtension;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.client.util.math.Rect2i;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.*;
import net.minecraft.recipe.book.CraftingRecipeCategory;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
import java.util.List;
import java.util.Map;

@JeiPlugin
Expand Down Expand Up @@ -45,6 +55,11 @@ public void registerCategories(@NotNull IRecipeCategoryRegistration registration
registration.addRecipeCategories(skyblockCraftingRecipeCategory);
}

@Override
public void registerGuiHandlers(@NotNull IGuiHandlerRegistration registration) {
registration.addGuiContainerHandler(InventoryScreen.class, new InventoryContainerHandler());
}

@Override
public void registerRecipes(@NotNull IRecipeRegistration registration) {
//FIXME no clue what to replace any of this with, we can't use items as that does not work
Expand All @@ -63,4 +78,13 @@ public void registerRecipes(@NotNull IRecipeRegistration registration) {
), "abc", "def", "ghi"), recipe.getResult()))
).toList());*/
}

private static class InventoryContainerHandler implements IGuiContainerHandler<InventoryScreen> {
@Override
public @NotNull List<Rect2i> getGuiExtraAreas(@NotNull InventoryScreen containerScreen) {
if (!SkyblockerConfigManager.get().farming.garden.gardenPlotsWidget || !Utils.getLocation().equals(Location.GARDEN)) return List.of();
HandledScreenAccessor accessor = (HandledScreenAccessor) containerScreen;
return Collections.singletonList(new Rect2i(accessor.getX() + accessor.getBackgroundWidth() + 4, accessor.getY(), 104, 127));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
package de.hysky.skyblocker.compatibility.rei;

import de.hysky.skyblocker.SkyblockerMod;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.mixins.accessors.HandledScreenAccessor;
import de.hysky.skyblocker.skyblock.itemlist.ItemRepository;
import de.hysky.skyblocker.utils.Location;
import de.hysky.skyblocker.utils.Utils;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
import me.shedaniel.rei.api.client.registry.entry.EntryRegistry;
import me.shedaniel.rei.api.client.registry.screen.ExclusionZones;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.item.Items;

import java.util.List;

/**
* REI integration
*/
Expand All @@ -31,4 +40,13 @@ public void registerDisplays(DisplayRegistry displayRegistry) {
public void registerEntries(EntryRegistry entryRegistry) {
entryRegistry.addEntries(ItemRepository.getItemsStream().map(EntryStacks::of).toList());
}

@Override
public void registerExclusionZones(ExclusionZones zones) {
zones.register(InventoryScreen.class, screen -> {
if (!SkyblockerConfigManager.get().farming.garden.gardenPlotsWidget || !Utils.getLocation().equals(Location.GARDEN)) return List.of();
HandledScreenAccessor accessor = (HandledScreenAccessor) screen;
return List.of(new Rectangle(accessor.getX() + accessor.getBackgroundWidth() + 4, accessor.getY(), 104, 127));
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import de.hysky.skyblocker.skyblock.garden.FarmingHudWidget;
import de.hysky.skyblocker.skyblock.tabhud.config.WidgetsConfigurationScreen;
import de.hysky.skyblocker.utils.Location;
import dev.isxander.yacl3.api.ButtonOption;
import dev.isxander.yacl3.api.ConfigCategory;
import dev.isxander.yacl3.api.Option;
import dev.isxander.yacl3.api.OptionGroup;
import dev.isxander.yacl3.api.*;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;

Expand Down Expand Up @@ -62,6 +59,22 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.farming.garden.lockMouseGroundOnly = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.farming.garden.gardenPlotsWidget"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.farming.garden.gardenPlotsWidget.@Tooltip")))
.binding(defaults.farming.garden.gardenPlotsWidget,
() -> config.farming.garden.gardenPlotsWidget,
newValue -> config.farming.garden.gardenPlotsWidget = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.farming.garden.closeScreenOnPlotClick"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.farming.garden.closeScreenOnPlotClick.@Tooltip")))
.binding(defaults.farming.garden.closeScreenOnPlotClick,
() -> config.farming.garden.closeScreenOnPlotClick,
newValue -> config.farming.garden.closeScreenOnPlotClick = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.build())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import de.hysky.skyblocker.config.SkyblockerConfig;
import de.hysky.skyblocker.config.configs.MiningConfig;
import de.hysky.skyblocker.skyblock.dwarven.CrystalsHudWidget;
import de.hysky.skyblocker.skyblock.dwarven.CarpetHighlighter;
import dev.isxander.yacl3.api.*;
import dev.isxander.yacl3.api.controller.ColorControllerBuilder;
import de.hysky.skyblocker.skyblock.tabhud.config.WidgetsConfigurationScreen;
Expand Down Expand Up @@ -55,6 +56,25 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.mining.dwarvenMines.solvePuzzler = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.mining.dwarvenMines.enableCarpetHighlight"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.mining.dwarvenMines.enableCarpetHighlight.@Tooltip")))
.binding(defaults.mining.dwarvenMines.enableCarpetHighlighter,
() -> config.mining.dwarvenMines.enableCarpetHighlighter,
newValue -> config.mining.dwarvenMines.enableCarpetHighlighter = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Color>createBuilder()
.name(Text.translatable("skyblocker.config.mining.dwarvenMines.carpetHighlightColor"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.mining.dwarvenMines.carpetHighlightColor.@Tooltip")))
.binding(defaults.mining.dwarvenMines.carpetHighlightColor,
() -> config.mining.dwarvenMines.carpetHighlightColor,
newValue -> {
config.mining.dwarvenMines.carpetHighlightColor = newValue;
CarpetHighlighter.INSTANCE.configCallback(newValue);
})
.controller(opt -> ColorControllerBuilder.create(opt).allowAlpha(true))
.build())
.build())

//Crystal Hollows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
TheEnd.eyes = 0;
})
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.otherLocations.end.muteEndermanSounds"))
.binding(defaults.otherLocations.end.muteEndermanSounds,
() -> config.otherLocations.end.muteEndermanSounds,
newValue -> config.otherLocations.end.muteEndermanSounds = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.build())

//Spider's Den
Expand Down
Loading

0 comments on commit ed9d6a1

Please sign in to comment.