diff --git a/buildSrc/src/main/java/cm/tasks/CreateBuildInfo.java b/buildSrc/src/main/java/cm/tasks/CreateBuildInfo.java index 7b0cb2f7..41b5644c 100644 --- a/buildSrc/src/main/java/cm/tasks/CreateBuildInfo.java +++ b/buildSrc/src/main/java/cm/tasks/CreateBuildInfo.java @@ -22,6 +22,9 @@ import org.gradle.api.tasks.OutputDirectory; import org.gradle.api.tasks.TaskAction; +/** + * Creates the build info. + */ public abstract class CreateBuildInfo extends DefaultTask { @Inject public CreateBuildInfo() { diff --git a/buildSrc/src/main/java/cm/tasks/CreateRegions.java b/buildSrc/src/main/java/cm/tasks/CreateRegions.java index e4eee7ac..429b1ccd 100644 --- a/buildSrc/src/main/java/cm/tasks/CreateRegions.java +++ b/buildSrc/src/main/java/cm/tasks/CreateRegions.java @@ -24,6 +24,9 @@ import org.gradle.api.tasks.OutputDirectory; import org.gradle.api.tasks.TaskAction; +/** + * Creates the regions. + */ public abstract class CreateRegions extends DefaultTask { @Inject diff --git a/buildSrc/src/main/java/cm/tasks/ModifyJarName.java b/buildSrc/src/main/java/cm/tasks/ModifyJarName.java index 4f99f503..c0f80e33 100644 --- a/buildSrc/src/main/java/cm/tasks/ModifyJarName.java +++ b/buildSrc/src/main/java/cm/tasks/ModifyJarName.java @@ -6,6 +6,9 @@ import org.gradle.api.Project; import org.gradle.jvm.tasks.Jar; +/** + * Modifies the jar name to include the branch. + */ public class ModifyJarName implements Plugin { @Override public void apply(Project target) { diff --git a/src/datagen/java/codes/cookies/mod/datagen/CookiesLanguageProvider.java b/src/datagen/java/codes/cookies/mod/datagen/CookiesLanguageProvider.java index a58c9cff..4b8726fb 100644 --- a/src/datagen/java/codes/cookies/mod/datagen/CookiesLanguageProvider.java +++ b/src/datagen/java/codes/cookies/mod/datagen/CookiesLanguageProvider.java @@ -6,6 +6,9 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider; import net.minecraft.registry.RegistryWrapper; +/** + * Language provider to generate language files. + */ public abstract class CookiesLanguageProvider extends FabricLanguageProvider implements TranslationKeys { protected CookiesLanguageProvider(FabricDataOutput dataOutput, CompletableFuture registryLookup) { super(dataOutput, registryLookup); @@ -21,6 +24,9 @@ protected abstract void generateLocals( RegistryWrapper.WrapperLookup registryLookup, CookiesTranslationBuilder translationBuilder); + /** + * Expanded translation builder to allow for easy config value addition. + */ public interface CookiesTranslationBuilder extends FabricLanguageProvider.TranslationBuilder { default void addConfig(String key, String name, String tooltip) { diff --git a/src/datagen/java/codes/cookies/mod/datagen/CookiesModDataGen.java b/src/datagen/java/codes/cookies/mod/datagen/CookiesModDataGen.java index fa367cde..8e0acecc 100644 --- a/src/datagen/java/codes/cookies/mod/datagen/CookiesModDataGen.java +++ b/src/datagen/java/codes/cookies/mod/datagen/CookiesModDataGen.java @@ -4,6 +4,9 @@ import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; +/** + * Datagen entrypoint for the mod. + */ public class CookiesModDataGen implements DataGeneratorEntrypoint { @Override public void onInitializeDataGenerator(FabricDataGenerator generator) { diff --git a/src/datagen/java/codes/cookies/mod/datagen/lang/EnglishLanguageProvider.java b/src/datagen/java/codes/cookies/mod/datagen/lang/EnglishLanguageProvider.java index 4485fbc7..8625acb1 100644 --- a/src/datagen/java/codes/cookies/mod/datagen/lang/EnglishLanguageProvider.java +++ b/src/datagen/java/codes/cookies/mod/datagen/lang/EnglishLanguageProvider.java @@ -8,6 +8,9 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +/** + * Language provider for english. + */ public class EnglishLanguageProvider extends CookiesLanguageProvider { public EnglishLanguageProvider( FabricDataOutput fabricDataOutput, CompletableFuture registryLookupFuture) { diff --git a/src/main/java/codes/cookies/mod/CookiesMod.java b/src/main/java/codes/cookies/mod/CookiesMod.java index 07e262c7..35541d89 100644 --- a/src/main/java/codes/cookies/mod/CookiesMod.java +++ b/src/main/java/codes/cookies/mod/CookiesMod.java @@ -93,6 +93,9 @@ private void registerKeyBindings() { }); } + /** + * Opens the hud edit screen. + */ public static void openHudScreen() { openScreen(new HudEditScreen()); } diff --git a/src/main/java/codes/cookies/mod/api/ApiManager.java b/src/main/java/codes/cookies/mod/api/ApiManager.java index 47a2765c..901a3acf 100644 --- a/src/main/java/codes/cookies/mod/api/ApiManager.java +++ b/src/main/java/codes/cookies/mod/api/ApiManager.java @@ -48,6 +48,9 @@ @Slf4j public class ApiManager { + /** + * User agent to use for the mod. + */ public static String USER_AGENT; static CloseableHttpClient CLIENT; private static boolean isAuthenticated; diff --git a/src/main/java/codes/cookies/mod/config/categories/mining/ShaftConfig.java b/src/main/java/codes/cookies/mod/config/categories/mining/ShaftConfig.java index 24350ba5..ccb40b06 100644 --- a/src/main/java/codes/cookies/mod/config/categories/mining/ShaftConfig.java +++ b/src/main/java/codes/cookies/mod/config/categories/mining/ShaftConfig.java @@ -8,6 +8,9 @@ import java.awt.*; +/** + * Config for the mine shaft corpse highlight. + */ public class ShaftConfig extends Foldable { public BooleanOption enable = new BooleanOption(TranslationKeys.CONFIG_MINING_SHAFT_ENABLE, true); diff --git a/src/main/java/codes/cookies/mod/config/categories/mining/powder/PauseTime.java b/src/main/java/codes/cookies/mod/config/categories/mining/powder/PauseTime.java index 5c21e01a..427ab659 100644 --- a/src/main/java/codes/cookies/mod/config/categories/mining/powder/PauseTime.java +++ b/src/main/java/codes/cookies/mod/config/categories/mining/powder/PauseTime.java @@ -1,5 +1,8 @@ package codes.cookies.mod.config.categories.mining.powder; +/** + * Time to wait till the powder tracker pauses. + */ public enum PauseTime { TEN_SEC(10), THIRTY_SEC(30), ONE_MIN(60), TWO_MIN(120), FIVE_MIN(300), TEN_MIN(600); diff --git a/src/main/java/codes/cookies/mod/config/categories/mining/powder/PowderTrackerHudFoldable.java b/src/main/java/codes/cookies/mod/config/categories/mining/powder/PowderTrackerHudFoldable.java index 964657d7..801278ba 100644 --- a/src/main/java/codes/cookies/mod/config/categories/mining/powder/PowderTrackerHudFoldable.java +++ b/src/main/java/codes/cookies/mod/config/categories/mining/powder/PowderTrackerHudFoldable.java @@ -7,6 +7,9 @@ import codes.cookies.mod.config.system.options.EnumCycleOption; import codes.cookies.mod.features.mining.PowderHud; +/** + * Config for the powder hud element. + */ public class PowderTrackerHudFoldable extends Foldable { public static PowderTrackerHudFoldable getConfig() { diff --git a/src/main/java/codes/cookies/mod/config/categories/mining/powder/ShaftTrackingType.java b/src/main/java/codes/cookies/mod/config/categories/mining/powder/ShaftTrackingType.java index 3aa892ac..2ba11a97 100644 --- a/src/main/java/codes/cookies/mod/config/categories/mining/powder/ShaftTrackingType.java +++ b/src/main/java/codes/cookies/mod/config/categories/mining/powder/ShaftTrackingType.java @@ -1,5 +1,8 @@ package codes.cookies.mod.config.categories.mining.powder; +/** + * The way the powder hud tracks mineshafts in. + */ public enum ShaftTrackingType { ENTER, FIND diff --git a/src/main/java/codes/cookies/mod/config/categories/mining/powder/TimeoutTime.java b/src/main/java/codes/cookies/mod/config/categories/mining/powder/TimeoutTime.java index 9125a17e..71076a2e 100644 --- a/src/main/java/codes/cookies/mod/config/categories/mining/powder/TimeoutTime.java +++ b/src/main/java/codes/cookies/mod/config/categories/mining/powder/TimeoutTime.java @@ -1,5 +1,8 @@ package codes.cookies.mod.config.categories.mining.powder; +/** + * Time to wait after last powder gain till removal and reset of the powder tracker. + */ public enum TimeoutTime { ONE_MIN(1), TWO_MINE(2), FIVE_MIN(5), TEN_MIN(10), TWENTY_MIN(20); diff --git a/src/main/java/codes/cookies/mod/config/data/CodecData.java b/src/main/java/codes/cookies/mod/config/data/CodecData.java index e744b4d5..59604f53 100644 --- a/src/main/java/codes/cookies/mod/config/data/CodecData.java +++ b/src/main/java/codes/cookies/mod/config/data/CodecData.java @@ -4,6 +4,10 @@ import com.mojang.serialization.Codec; import org.slf4j.Logger; +/** + * Misc data that has a codec representation. + * @param + */ public class CodecData implements CodecJsonSerializable { public CodecData(T defaultValue, Codec codec) { this.value = defaultValue; diff --git a/src/main/java/codes/cookies/mod/config/data/HudData.java b/src/main/java/codes/cookies/mod/config/data/HudData.java index 4ca2a3ce..8d39673c 100644 --- a/src/main/java/codes/cookies/mod/config/data/HudData.java +++ b/src/main/java/codes/cookies/mod/config/data/HudData.java @@ -10,6 +10,9 @@ import net.minecraft.util.Identifier; +/** + * Parent element that contains all hud data. + */ public class HudData implements CodecJsonSerializable> { private static final Codec> CODEC = Codec.unboundedMap(Identifier.CODEC, HudPosition.CODEC); diff --git a/src/main/java/codes/cookies/mod/config/data/SqueakyMousematOption.java b/src/main/java/codes/cookies/mod/config/data/SqueakyMousematOption.java index ed366162..d1b51285 100644 --- a/src/main/java/codes/cookies/mod/config/data/SqueakyMousematOption.java +++ b/src/main/java/codes/cookies/mod/config/data/SqueakyMousematOption.java @@ -10,6 +10,11 @@ import net.minecraft.util.Uuids; +/** + * Data that is stored in the config for the squeaky mousemat overlay. + * @param useProfileData A list of uuids where the profile data is used. + * @param data The squeaky mousemat data. + */ public record SqueakyMousematOption(List useProfileData, SqueakyMousematData data) { public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( diff --git a/src/main/java/codes/cookies/mod/config/system/HudSetting.java b/src/main/java/codes/cookies/mod/config/system/HudSetting.java index 52c99d3e..2b625dfb 100644 --- a/src/main/java/codes/cookies/mod/config/system/HudSetting.java +++ b/src/main/java/codes/cookies/mod/config/system/HudSetting.java @@ -8,6 +8,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Used to attach an option to a hud element. + */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) @Repeatable(HudSetting.HudSettings.class) diff --git a/src/main/java/codes/cookies/mod/config/system/parsed/ConfigReader.java b/src/main/java/codes/cookies/mod/config/system/parsed/ConfigReader.java index 9a0fbe27..1b8a0bfd 100644 --- a/src/main/java/codes/cookies/mod/config/system/parsed/ConfigReader.java +++ b/src/main/java/codes/cookies/mod/config/system/parsed/ConfigReader.java @@ -140,12 +140,18 @@ public > ProcessedOption processOption(Option> void addHudSetting(Class value, ProcessedOption processedOption) { final List> orDefault = hudSettings.getOrDefault(value, new ArrayList<>()); hudSettings.putIfAbsent(value, orDefault); orDefault.add(processedOption.getOption()); } + /** + * Gets all hud settings attached to the element. + */ public List> getHudSettings(HudElement hudElement) { return hudSettings.getOrDefault(hudElement.getClass(), Collections.emptyList()); } diff --git a/src/main/java/codes/cookies/mod/data/Migration.java b/src/main/java/codes/cookies/mod/data/Migration.java index f587bf52..c2b32089 100644 --- a/src/main/java/codes/cookies/mod/data/Migration.java +++ b/src/main/java/codes/cookies/mod/data/Migration.java @@ -36,7 +36,7 @@ public interface Migration { Type getType(); /** - * Whether this migration may fail without causing a data reset. + * @return Whether this migration may fail without causing a data reset. */ default boolean mayFail() { return false; diff --git a/src/main/java/codes/cookies/mod/data/farming/squeakymousemat/SqueakyMousematData.java b/src/main/java/codes/cookies/mod/data/farming/squeakymousemat/SqueakyMousematData.java index 41e75225..3da9c5eb 100644 --- a/src/main/java/codes/cookies/mod/data/farming/squeakymousemat/SqueakyMousematData.java +++ b/src/main/java/codes/cookies/mod/data/farming/squeakymousemat/SqueakyMousematData.java @@ -3,6 +3,9 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +/** + * Data for the squeaky mousemat overlay. + */ public record SqueakyMousematData(SqueakyMousematEntry wheat, SqueakyMousematEntry carrot, SqueakyMousematEntry potato, SqueakyMousematEntry netherWart, SqueakyMousematEntry pumpkin, SqueakyMousematEntry melon, SqueakyMousematEntry cocoaBeans, diff --git a/src/main/java/codes/cookies/mod/data/farming/squeakymousemat/SqueakyMousematEntry.java b/src/main/java/codes/cookies/mod/data/farming/squeakymousemat/SqueakyMousematEntry.java index bd40df57..42aa84a5 100644 --- a/src/main/java/codes/cookies/mod/data/farming/squeakymousemat/SqueakyMousematEntry.java +++ b/src/main/java/codes/cookies/mod/data/farming/squeakymousemat/SqueakyMousematEntry.java @@ -8,6 +8,9 @@ import lombok.Setter; import lombok.ToString; +/** + * Entry for the squeaky mousemat overlay. + */ @AllArgsConstructor @Getter @Setter diff --git a/src/main/java/codes/cookies/mod/data/mining/PowderData.java b/src/main/java/codes/cookies/mod/data/mining/PowderData.java index 4d5a625c..21dc348c 100644 --- a/src/main/java/codes/cookies/mod/data/mining/PowderData.java +++ b/src/main/java/codes/cookies/mod/data/mining/PowderData.java @@ -8,6 +8,9 @@ import com.mojang.serialization.Codec; import org.slf4j.Logger; +/** + * The data that is saved about the players powder. + */ public class PowderData implements CodecJsonSerializable> { public static final Codec> CODEC = Codec.unboundedMap(PowderType.CODEC, Codec.INT); diff --git a/src/main/java/codes/cookies/mod/data/profile/items/ItemCompound.java b/src/main/java/codes/cookies/mod/data/profile/items/ItemCompound.java index 80dff59c..207d30e3 100644 --- a/src/main/java/codes/cookies/mod/data/profile/items/ItemCompound.java +++ b/src/main/java/codes/cookies/mod/data/profile/items/ItemCompound.java @@ -37,6 +37,10 @@ public ItemCompound(int amount, ItemStack itemStack, Set> items) { this.handleAny(items.iterator().next()); } + /** + * Adds an item of unknown type. + * @param item The item to handle. + */ public void handleAny(Item item) { if (this.type == CompoundType.MULTIPLE) { return; @@ -98,6 +102,10 @@ private void handleStorage(Item item) { this.data = Unit.INSTANCE; } + /** + * Adds an item to the compound. + * @param item The item to add. + */ public void add(Item item) { if (item.source() == ItemSources.CRAFTABLE) { return; @@ -123,6 +131,10 @@ public Set> items() { return this.items; } + /** + * Get all items used by craft helper or in total if craft helper is irrelevant. + * @return The items. + */ public Set> getUsedItems() { if (this.type == CompoundType.CRAFTABLE && this.data instanceof CraftableItemSource.Data craftData) { return craftData.amounts() @@ -167,6 +179,9 @@ public String toString() { this.items + ']'; } + /** + * The type of the compound. + */ public enum CompoundType { CHEST_POS, CHEST, @@ -214,6 +229,4 @@ public static CompoundType of(ItemSources source, Object data) { }; } } - - } diff --git a/src/main/java/codes/cookies/mod/data/profile/items/ItemSource.java b/src/main/java/codes/cookies/mod/data/profile/items/ItemSource.java index b5e705de..4277d17e 100644 --- a/src/main/java/codes/cookies/mod/data/profile/items/ItemSource.java +++ b/src/main/java/codes/cookies/mod/data/profile/items/ItemSource.java @@ -20,5 +20,9 @@ public interface ItemSource { */ ItemSources getType(); + /** + * Removes the item from the item source. + * @param item The item to remove. + */ void remove(Item item); } diff --git a/src/main/java/codes/cookies/mod/data/profile/items/sources/ForgeItemSource.java b/src/main/java/codes/cookies/mod/data/profile/items/sources/ForgeItemSource.java index 2ec1150a..bdcb92f1 100644 --- a/src/main/java/codes/cookies/mod/data/profile/items/sources/ForgeItemSource.java +++ b/src/main/java/codes/cookies/mod/data/profile/items/sources/ForgeItemSource.java @@ -69,7 +69,7 @@ public void remove(Item item) { ProfileStorage.getCurrentProfile() .map(ProfileData::getForgeTracker) - .map(FunctionUtils.function(ForgeTracker::remove)) + .map(FunctionUtils.function(ForgeTracker::removeItem)) .orElseGet(FunctionUtils::noOp) .accept(data.slot()); } diff --git a/src/main/java/codes/cookies/mod/data/profile/migrations/ProfileDataMigration_0002.java b/src/main/java/codes/cookies/mod/data/profile/migrations/ProfileDataMigration_0002.java index 654eb557..b6de524e 100644 --- a/src/main/java/codes/cookies/mod/data/profile/migrations/ProfileDataMigration_0002.java +++ b/src/main/java/codes/cookies/mod/data/profile/migrations/ProfileDataMigration_0002.java @@ -5,6 +5,9 @@ import com.google.gson.JsonObject; import codes.cookies.mod.data.Migration; +/** + * Moves the current craft helper item to the new version. + */ public class ProfileDataMigration_0002 implements Migration { @Override public int getNumber() { diff --git a/src/main/java/codes/cookies/mod/data/profile/profile/IslandChestStorage.java b/src/main/java/codes/cookies/mod/data/profile/profile/IslandChestStorage.java index 707f148f..1989c5c4 100644 --- a/src/main/java/codes/cookies/mod/data/profile/profile/IslandChestStorage.java +++ b/src/main/java/codes/cookies/mod/data/profile/profile/IslandChestStorage.java @@ -5,10 +5,10 @@ import java.util.List; import java.util.Optional; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; import codes.cookies.mod.events.ChestSaveEvent; import codes.cookies.mod.utils.json.CodecJsonSerializable; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import lombok.Getter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,24 +27,34 @@ public class IslandChestStorage implements CodecJsonSerializable items = new ArrayList<>(); + /** + * Saves a stack for the chest in the provided slot. + */ public void save(BlockPos blockPos, BlockPos secondChest, ItemStack stack, int slot) { Optional.ofNullable(ChestItem.create(blockPos, secondChest, stack, slot)) .ifPresent(items::add); } + /** + * @return All items that are present within the block. + */ private List getItems(BlockPos pos) { return this.items.stream().filter(chestItem -> pos.equals(chestItem.blockPos)) .toList(); } - public void removeBlockSlot(BlockPos blockPos, int slot) { - this.items.removeIf(item -> blockPos.equals(item.blockPos) && item.slot == slot); - } - + /** + * @param chestItem The item to remove. + */ public void remove(ChestItem chestItem) { this.items.remove(chestItem); } + /** + * Removes all items related to the chest position. + * + * @param blockPos The position to remove. + */ public void removeBlock(BlockPos blockPos) { if (blockPos == null) { return; @@ -88,6 +98,9 @@ public Logger getLogger() { return LOGGER; } + /** + * Sends a chest save event for the provided blocks + */ public void sendEvent(BlockPos blockPos, BlockPos second) { if (blockPos != null && second != null) { final ArrayList bothItems = new ArrayList<>(); @@ -97,7 +110,7 @@ public void sendEvent(BlockPos blockPos, BlockPos second) { return; } if (blockPos != null) { - ChestSaveEvent.EVENT.invoker().onSave(blockPos, second,this.getItems(blockPos)); + ChestSaveEvent.EVENT.invoker().onSave(blockPos, second, this.getItems(blockPos)); } } diff --git a/src/main/java/codes/cookies/mod/data/profile/sub/AccessoryItemData.java b/src/main/java/codes/cookies/mod/data/profile/sub/AccessoryItemData.java index 3665e9a6..5dca0a59 100644 --- a/src/main/java/codes/cookies/mod/data/profile/sub/AccessoryItemData.java +++ b/src/main/java/codes/cookies/mod/data/profile/sub/AccessoryItemData.java @@ -41,18 +41,34 @@ public Logger getLogger() { return LOGGER; } + /** + * Clears all data that is saved on the provided page. + * @param page The page number to clear. + */ public void clearPage(int page) { this.items.removeIf(item -> item.page == page); } + /** + * Save an item with the provided data. + * @param itemStack The item to save. + * @param slot The slot the item is in. + * @param page The page the item is on. + */ public void save(ItemStack itemStack, int slot, int page) { this.items.add(AccessoryData.create(itemStack, slot, page)); } + /** + * Removes the item on the provided page in the provided slot. + */ public void remove(int page, int slot) { this.items.removeIf(items -> items.page == page && items.slot == slot); } + /** + * Data for the accessory bag. + */ public record AccessoryData(ItemStack itemStack, int slot, int page) { public static AccessoryData create(ItemStack itemStack, int slot, int page) { itemStack.remove(DataComponentTypes.JUKEBOX_PLAYABLE); diff --git a/src/main/java/codes/cookies/mod/data/profile/sub/CraftHelperData.java b/src/main/java/codes/cookies/mod/data/profile/sub/CraftHelperData.java index bce4152a..f7052786 100644 --- a/src/main/java/codes/cookies/mod/data/profile/sub/CraftHelperData.java +++ b/src/main/java/codes/cookies/mod/data/profile/sub/CraftHelperData.java @@ -10,6 +10,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Profile data for the craft helper to serialize the current item and settings. + */ public class CraftHelperData implements CodecJsonSerializable { public CraftHelperData() { diff --git a/src/main/java/codes/cookies/mod/data/profile/sub/EquipmentData.java b/src/main/java/codes/cookies/mod/data/profile/sub/EquipmentData.java index 0ebdfa1d..9e1a3aac 100644 --- a/src/main/java/codes/cookies/mod/data/profile/sub/EquipmentData.java +++ b/src/main/java/codes/cookies/mod/data/profile/sub/EquipmentData.java @@ -12,6 +12,9 @@ import java.util.ArrayList; import java.util.List; +/** + * Equipment data that is saved to the profile. + */ public class EquipmentData implements CodecJsonSerializable> { private final Logger LOGGER = LoggerFactory.getLogger(EquipmentData.class); diff --git a/src/main/java/codes/cookies/mod/data/profile/sub/ForgeTracker.java b/src/main/java/codes/cookies/mod/data/profile/sub/ForgeTracker.java index ff12ffb7..4c58005b 100644 --- a/src/main/java/codes/cookies/mod/data/profile/sub/ForgeTracker.java +++ b/src/main/java/codes/cookies/mod/data/profile/sub/ForgeTracker.java @@ -22,11 +22,20 @@ public class ForgeTracker implements CodecJsonSerializable data = new ArrayList<>(); + /** + * Saves an item for the provided forge slot. + * @param item The item to save. + * @param slot The slot that was used. + * @param timeStartedSeconds The start time in seconds. + */ public void saveItem(RepositoryItem item, int slot, long timeStartedSeconds) { this.removeItem(slot); this.data.add(new Data(item, timeStartedSeconds + 1, slot)); } + /** + * Removes the item that is saved in the slot. + */ public void removeItem(int slot) { this.data.removeIf(data -> data.slot == slot); } @@ -51,10 +60,6 @@ public Logger getLogger() { return LOGGER; } - public void remove(int slot) { - this.data.removeIf(data -> data.slot == slot); - } - public record Data(RepositoryItem repositoryItem, long startedSeconds, int slot) { public static Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( RepositoryItem.ID_CODEC.optionalFieldOf("item") diff --git a/src/main/java/codes/cookies/mod/data/profile/sub/HotmData.java b/src/main/java/codes/cookies/mod/data/profile/sub/HotmData.java index acfac0dc..7d467f07 100644 --- a/src/main/java/codes/cookies/mod/data/profile/sub/HotmData.java +++ b/src/main/java/codes/cookies/mod/data/profile/sub/HotmData.java @@ -15,8 +15,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Data saved for the heart of the mountain. + */ public class HotmData implements CodecJsonSerializable> { - private static final Logger LOGGER = LoggerFactory.getLogger(ForgeTracker.class); + private static final Logger LOGGER = LoggerFactory.getLogger(HotmData.class); private final CopyOnWriteArrayList list = new CopyOnWriteArrayList<>(); @@ -70,7 +73,9 @@ public record Entry(String id, int level, boolean enabled) { public static Codec> LIST_CODEC = CODEC.listOf(); } - + /** + * Gets the current quick forge multiplier. + */ public double getQuickForgeMultiplier() { final IntBooleanPair quickForge = this.getStatus("quick_forge"); if (quickForge == null || !quickForge.secondBoolean()) { diff --git a/src/main/java/codes/cookies/mod/data/profile/sub/PlotData.java b/src/main/java/codes/cookies/mod/data/profile/sub/PlotData.java index dbc7ede8..7fb342f9 100644 --- a/src/main/java/codes/cookies/mod/data/profile/sub/PlotData.java +++ b/src/main/java/codes/cookies/mod/data/profile/sub/PlotData.java @@ -8,6 +8,9 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +/** + * Saved data about plot spray time. + */ public class PlotData implements CodecJsonSerializable> { Logger LOGGER = LoggerFactory.getLogger(PlotData.class); static Codec> CODEC = Codec.unboundedMap(Codec.STRING, Codec.LONG); diff --git a/src/main/java/codes/cookies/mod/data/profile/sub/ProfileStats.java b/src/main/java/codes/cookies/mod/data/profile/sub/ProfileStats.java index e2961ca5..e26f0074 100644 --- a/src/main/java/codes/cookies/mod/data/profile/sub/ProfileStats.java +++ b/src/main/java/codes/cookies/mod/data/profile/sub/ProfileStats.java @@ -11,6 +11,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Stats that are saved about the players profile. + */ public class ProfileStats implements CodecJsonSerializable> { private static final String LOG_KEY = "profile-stats"; private static final Logger LOGGER = LoggerFactory.getLogger(ProfileStats.class); diff --git a/src/main/java/codes/cookies/mod/data/profile/sub/SackTracker.java b/src/main/java/codes/cookies/mod/data/profile/sub/SackTracker.java index 1ecd98ee..d7e3b9ff 100644 --- a/src/main/java/codes/cookies/mod/data/profile/sub/SackTracker.java +++ b/src/main/java/codes/cookies/mod/data/profile/sub/SackTracker.java @@ -65,6 +65,9 @@ public void modify(RepositoryItem item, int value) { items.compute(item, (key, oldValue) -> Math.max(oldValue == null ? value : oldValue + value, 0)); } + /** + * Clears all sack data. + */ public void clear() { this.items.clear(); } diff --git a/src/main/java/codes/cookies/mod/events/ChestSaveEvent.java b/src/main/java/codes/cookies/mod/events/ChestSaveEvent.java index 59dd4818..fc431229 100644 --- a/src/main/java/codes/cookies/mod/events/ChestSaveEvent.java +++ b/src/main/java/codes/cookies/mod/events/ChestSaveEvent.java @@ -9,6 +9,9 @@ import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.EventFactory; +/** + * Event to listen on chest updates on the private island. + */ public interface ChestSaveEvent { Event EVENT = EventFactory.createArrayBacked( diff --git a/src/main/java/codes/cookies/mod/events/mining/MineshaftEvents.java b/src/main/java/codes/cookies/mod/events/mining/MineshaftEvents.java index 51ea1915..e32a506e 100644 --- a/src/main/java/codes/cookies/mod/events/mining/MineshaftEvents.java +++ b/src/main/java/codes/cookies/mod/events/mining/MineshaftEvents.java @@ -8,6 +8,9 @@ import java.util.function.Consumer; +/** + * Events related to mineshafts. + */ public interface MineshaftEvents { Event> JOIN_SHAFT = CookiesEventUtils.consumer(); diff --git a/src/main/java/codes/cookies/mod/events/mining/PowderUpdateEvent.java b/src/main/java/codes/cookies/mod/events/mining/PowderUpdateEvent.java index 75d9aea0..22f47503 100644 --- a/src/main/java/codes/cookies/mod/events/mining/PowderUpdateEvent.java +++ b/src/main/java/codes/cookies/mod/events/mining/PowderUpdateEvent.java @@ -5,6 +5,9 @@ import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.EventFactory; +/** + * Event to inform about powder changes, negative delta can be ignored most of the time. + */ public interface PowderUpdateEvent { Event EVENT = EventFactory.createArrayBacked( diff --git a/src/main/java/codes/cookies/mod/events/mixins/InventoryContentUpdateMixin.java b/src/main/java/codes/cookies/mod/events/mixins/InventoryContentUpdateMixin.java index cfbde4a2..cdb1ff08 100644 --- a/src/main/java/codes/cookies/mod/events/mixins/InventoryContentUpdateMixin.java +++ b/src/main/java/codes/cookies/mod/events/mixins/InventoryContentUpdateMixin.java @@ -21,6 +21,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +/** + * Used to invoke inventory content events. + */ @Mixin(ScreenHandler.class) public abstract class InventoryContentUpdateMixin implements ScreenHandlerUpdateEventAccessor { diff --git a/src/main/java/codes/cookies/mod/features/dungeons/DungeonFeatures.java b/src/main/java/codes/cookies/mod/features/dungeons/DungeonFeatures.java index 3fd867fe..3c391e91 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/DungeonFeatures.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/DungeonFeatures.java @@ -191,6 +191,10 @@ public Optional getCurrentInstance() { return Optional.ofNullable(this.currentInstance); } + /** + * Sends a debug message if debug is enabled, else just ignore it. + * @param message The message to send. + */ public static void sendDebugMessage(String message) { if (!DevUtils.isEnabled(SEND_DEBUG_MESSAGES)) { return; diff --git a/src/main/java/codes/cookies/mod/features/dungeons/DungeonPlayer.java b/src/main/java/codes/cookies/mod/features/dungeons/DungeonPlayer.java index 098744cd..3ebfd831 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/DungeonPlayer.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/DungeonPlayer.java @@ -114,6 +114,11 @@ public Result getItem() { return getItem(true); } + /** + * Gets the item representation of the player. + * @param useSkullsIfPossible Whether to use a skull if possible. + * @return The item. + */ public Result getItem(boolean useSkullsIfPossible) { if (player != null && useSkullsIfPossible) { if (isSelf()) { diff --git a/src/main/java/codes/cookies/mod/features/dungeons/map/DungeonMapHud.java b/src/main/java/codes/cookies/mod/features/dungeons/map/DungeonMapHud.java index a21bb122..87c6ec22 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/map/DungeonMapHud.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/map/DungeonMapHud.java @@ -20,6 +20,9 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; +/** + * Hud element for the dungeon map. + */ public class DungeonMapHud extends HudElement { @Getter private static final DungeonMapHud instance = new DungeonMapHud(); diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/CreeperBeamPuzzleSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/CreeperBeamPuzzleSolver.java index d93b18ca..d6cfdf75 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/CreeperBeamPuzzleSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/CreeperBeamPuzzleSolver.java @@ -21,6 +21,9 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +/** + * Solver for the creeper beam puzzle. + */ public class CreeperBeamPuzzleSolver extends PuzzleSolver { private static final Block[] BLOCKS = {Blocks.PRISMARINE, Blocks.SEA_LANTERN}; private static final int[] COLORS = {Constants.SUCCESS_COLOR, 0xFFBED2FE, 0xFFFDFD96, 0xFF6EB5FF}; diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/HigherLowerPuzzleSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/HigherLowerPuzzleSolver.java index 9a91fa93..ea9bb617 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/HigherLowerPuzzleSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/HigherLowerPuzzleSolver.java @@ -30,6 +30,9 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; +/** + * Solver for the higher lower puzzle. + */ public class HigherLowerPuzzleSolver extends PuzzleSolver { private static final Pattern PATTERN = Pattern.compile("\\[Lv15] Blaze [\\d,]+/([\\d,]+)❤"); private Direction direction = null; diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/QuizPuzzleSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/QuizPuzzleSolver.java index b9bd23a4..c5773a48 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/QuizPuzzleSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/QuizPuzzleSolver.java @@ -24,6 +24,9 @@ import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; +/** + * Solver for the quiz puzzle. + */ public class QuizPuzzleSolver extends PuzzleSolver { boolean hasStarted; diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/ThreeWeirdosPuzzleSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/ThreeWeirdosPuzzleSolver.java index 6655ef1f..c1f15d09 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/ThreeWeirdosPuzzleSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/ThreeWeirdosPuzzleSolver.java @@ -21,6 +21,9 @@ import net.minecraft.text.Text; import net.minecraft.util.math.BlockPos; +/** + * Solver for the three weirdos puzzle. + */ public class ThreeWeirdosPuzzleSolver extends PuzzleSolver { private static final Pattern PATTERN = Pattern.compile("\\[NPC] (\\w+): (.+)"); private static final List CORRECT_MESSAGES = Arrays.asList("The reward is not in my chest!", diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/WaterBoardPuzzleSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/WaterBoardPuzzleSolver.java index 02273044..03885dff 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/WaterBoardPuzzleSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/puzzle/WaterBoardPuzzleSolver.java @@ -48,6 +48,9 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; +/** + * Solver for the water board puzzle. + */ public class WaterBoardPuzzleSolver extends PuzzleSolver { private static final Block[] ALLOWED_BLOCKS = new Block[]{Blocks.GOLD_BLOCK, Blocks.TERRACOTTA, @@ -450,6 +453,7 @@ public void increment(DungeonInstance dungeonInstance) { this.instances.put(dungeonInstance, this.get(dungeonInstance).map(i -> i + 1).orElse(1)); } + public Optional getLeverPosition(BlockPos chestPosition, Direction puzzleDirection) { if (chestPosition == null || puzzleDirection == null) { return Optional.empty(); diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/ChangeAllToSameColorTerminalSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/ChangeAllToSameColorTerminalSolver.java index cf2bf227..7b4612c1 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/ChangeAllToSameColorTerminalSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/ChangeAllToSameColorTerminalSolver.java @@ -17,6 +17,9 @@ import org.apache.commons.lang3.ArrayUtils; +/** + * Solver for the change all to same color terminal in floor seven. + */ public class ChangeAllToSameColorTerminalSolver extends TerminalSolver { private static final Item[] ITEMS = {Items.ORANGE_STAINED_GLASS_PANE, Items.YELLOW_STAINED_GLASS_PANE, diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/ClickInOrderTerminalSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/ClickInOrderTerminalSolver.java index 43f44155..bf084be0 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/ClickInOrderTerminalSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/ClickInOrderTerminalSolver.java @@ -13,6 +13,9 @@ import net.minecraft.util.Unit; import net.minecraft.util.math.MathHelper; +/** + * Solver for the click in order terminal in floor seven. + */ public class ClickInOrderTerminalSolver extends TerminalSolver { private final ItemStack todo = this.doneItem.copy().withItem(Items.RED_STAINED_GLASS_PANE); private final ItemStack thirdItem = this.doneItem.copy().withItem(Items.ORANGE_STAINED_GLASS_PANE); diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/CorrectAllThePanesTerminalSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/CorrectAllThePanesTerminalSolver.java index efd35a54..c6d1a541 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/CorrectAllThePanesTerminalSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/CorrectAllThePanesTerminalSolver.java @@ -11,6 +11,9 @@ import net.minecraft.item.Items; import net.minecraft.util.Unit; +/** + * Solver for the correct all panes terminal in floor seven. + */ public class CorrectAllThePanesTerminalSolver extends TerminalSolver { public CorrectAllThePanesTerminalSolver() { diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/SelectAllColorsTerminalSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/SelectAllColorsTerminalSolver.java index 81caf390..79cb2a89 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/SelectAllColorsTerminalSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/SelectAllColorsTerminalSolver.java @@ -14,6 +14,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Unit; +/** + * Solver for the select all colors terminal. + */ public class SelectAllColorsTerminalSolver extends TerminalSolver { public SelectAllColorsTerminalSolver() { diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/StartsWithTerminalSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/StartsWithTerminalSolver.java index e222e489..047a6c21 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/StartsWithTerminalSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/StartsWithTerminalSolver.java @@ -19,6 +19,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Unit; +/** + * Solver for the starts with terminal solver for floor seven + */ public class StartsWithTerminalSolver extends TerminalSolver { String lastOpened; diff --git a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/TerminalSolver.java b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/TerminalSolver.java index 31f016bd..1d52b8f4 100644 --- a/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/TerminalSolver.java +++ b/src/main/java/codes/cookies/mod/features/dungeons/solver/terminals/TerminalSolver.java @@ -25,6 +25,9 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; +/** + * Generic terminal solver. + */ public abstract class TerminalSolver { public static Identifier DEBUG = DevUtils.createIdentifier("terminals/disable_click_all_check"); protected boolean localToggle = true; diff --git a/src/main/java/codes/cookies/mod/features/farming/PlotSprayTracker.java b/src/main/java/codes/cookies/mod/features/farming/PlotSprayTracker.java index 05b7e922..3127b5c9 100644 --- a/src/main/java/codes/cookies/mod/features/farming/PlotSprayTracker.java +++ b/src/main/java/codes/cookies/mod/features/farming/PlotSprayTracker.java @@ -18,6 +18,9 @@ import net.fabricmc.fabric.api.event.player.UseItemCallback; +/** + * Tracks the time plots got sprayed at. + */ public class PlotSprayTracker { private static final String DEBUG = "SprayTracker"; private static int lastPlotId; diff --git a/src/main/java/codes/cookies/mod/features/farming/garden/PestTimerHud.java b/src/main/java/codes/cookies/mod/features/farming/garden/PestTimerHud.java index 4f491117..36aaeb37 100644 --- a/src/main/java/codes/cookies/mod/features/farming/garden/PestTimerHud.java +++ b/src/main/java/codes/cookies/mod/features/farming/garden/PestTimerHud.java @@ -13,6 +13,9 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; +/** + * Hud for the {@link PestTimer} + */ public class PestTimerHud extends TextHudElement { private final Text defaultText = Text.literal("Pests in ").formatted(Formatting.DARK_GREEN); private final Text canSpawnText = Text.literal("Pests can spawn!").formatted(Formatting.DARK_GREEN); diff --git a/src/main/java/codes/cookies/mod/features/mining/PowderHud.java b/src/main/java/codes/cookies/mod/features/mining/PowderHud.java index 392c1da4..e5428f4c 100644 --- a/src/main/java/codes/cookies/mod/features/mining/PowderHud.java +++ b/src/main/java/codes/cookies/mod/features/mining/PowderHud.java @@ -20,6 +20,9 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; +/** + * Hud implementation of the powder tracker. + */ public class PowderHud extends MultiLineTextHudElement { InterpolatedInteger powderAmount = new LinearInterpolatedInteger(1000, 0); diff --git a/src/main/java/codes/cookies/mod/features/mining/PowderTracker.java b/src/main/java/codes/cookies/mod/features/mining/PowderTracker.java index c2cc8a76..e0d090d6 100644 --- a/src/main/java/codes/cookies/mod/features/mining/PowderTracker.java +++ b/src/main/java/codes/cookies/mod/features/mining/PowderTracker.java @@ -13,6 +13,9 @@ import net.minecraft.text.Text; +/** + * Manager to handle powder updates and keep track. + */ @Slf4j public class PowderTracker { diff --git a/src/main/java/codes/cookies/mod/features/mining/PuzzlerSolver.java b/src/main/java/codes/cookies/mod/features/mining/PuzzlerSolver.java index 52299f65..c3141423 100644 --- a/src/main/java/codes/cookies/mod/features/mining/PuzzlerSolver.java +++ b/src/main/java/codes/cookies/mod/features/mining/PuzzlerSolver.java @@ -21,6 +21,9 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +/** + * Solver for the puzzler in the dwarven mines. + */ public class PuzzlerSolver { private static final Identifier DEBUG = DevUtils.createIdentifier("puzzler_debug"); private static final BlockPos location = new BlockPos(181, 195, 135); diff --git a/src/main/java/codes/cookies/mod/features/mining/hollows/MinesOfDivanHelper.java b/src/main/java/codes/cookies/mod/features/mining/hollows/MinesOfDivanHelper.java index 046da3bc..560dea78 100644 --- a/src/main/java/codes/cookies/mod/features/mining/hollows/MinesOfDivanHelper.java +++ b/src/main/java/codes/cookies/mod/features/mining/hollows/MinesOfDivanHelper.java @@ -37,6 +37,9 @@ import net.fabricmc.fabric.api.event.player.UseBlockCallback; import net.fabricmc.fabric.api.event.player.UseEntityCallback; +/** + * Helper for the mines of divan loot chests. + */ public class MinesOfDivanHelper { static Identifier DEBUG = DevUtils.createIdentifier("ch/mod_debug"); diff --git a/src/main/java/codes/cookies/mod/features/mining/shafts/CorpseHighlight.java b/src/main/java/codes/cookies/mod/features/mining/shafts/CorpseHighlight.java index b4312f3b..471909c1 100644 --- a/src/main/java/codes/cookies/mod/features/mining/shafts/CorpseHighlight.java +++ b/src/main/java/codes/cookies/mod/features/mining/shafts/CorpseHighlight.java @@ -16,6 +16,9 @@ import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +/** + * Renderable to highlight a corpse in the glacite mineshafts. + */ public record CorpseHighlight(BlockPos blockPos, BeaconBeam beam, Box box, int color) implements Renderable { public CorpseHighlight(BlockPos blockPos, int color) { diff --git a/src/main/java/codes/cookies/mod/features/mining/shafts/CorpseWaypoints.java b/src/main/java/codes/cookies/mod/features/mining/shafts/CorpseWaypoints.java index f267d194..43e8a05a 100644 --- a/src/main/java/codes/cookies/mod/features/mining/shafts/CorpseWaypoints.java +++ b/src/main/java/codes/cookies/mod/features/mining/shafts/CorpseWaypoints.java @@ -22,6 +22,9 @@ import net.fabricmc.fabric.api.event.player.UseEntityCallback; +/** + * Adds waypoints in the glacite mineshafts for possible corpse locations. + */ public class CorpseWaypoints { private static final Map renderables = new HashMap<>(); diff --git a/src/main/java/codes/cookies/mod/features/mining/shafts/ShaftFeatures.java b/src/main/java/codes/cookies/mod/features/mining/shafts/ShaftFeatures.java index 73c36371..ff1bc2ab 100644 --- a/src/main/java/codes/cookies/mod/features/mining/shafts/ShaftFeatures.java +++ b/src/main/java/codes/cookies/mod/features/mining/shafts/ShaftFeatures.java @@ -10,6 +10,9 @@ import java.util.Optional; +/** + * Keeps track of current mineshaft states. + */ public class ShaftFeatures { private static boolean isInShaft = false; private static ShaftCorpseLocations.ShaftLocations locations; diff --git a/src/main/java/codes/cookies/mod/features/misc/items/AccessoryTracker.java b/src/main/java/codes/cookies/mod/features/misc/items/AccessoryTracker.java index 3d48f16c..41968e85 100644 --- a/src/main/java/codes/cookies/mod/features/misc/items/AccessoryTracker.java +++ b/src/main/java/codes/cookies/mod/features/misc/items/AccessoryTracker.java @@ -24,6 +24,9 @@ public class AccessoryTracker { private static String name; + /** + * Registers the accessory bag tracker. + */ public static void register() { InventoryEvents.beforeInit("cookies-regex:Accessory Bag .*", Predicates.alwaysTrue(), AccessoryTracker::open); } diff --git a/src/main/java/codes/cookies/mod/features/misc/items/ChestTracker.java b/src/main/java/codes/cookies/mod/features/misc/items/ChestTracker.java index 479ef921..e9e84751 100644 --- a/src/main/java/codes/cookies/mod/features/misc/items/ChestTracker.java +++ b/src/main/java/codes/cookies/mod/features/misc/items/ChestTracker.java @@ -80,7 +80,7 @@ private ActionResult blockClicked( this.first = blockHitResult.getBlockPos(); final ChestType chestType = blockState.get(Properties.CHEST_TYPE); - final DoubleBlockProperties.Type doubleBlockType = getDoubleBlockType(blockState); + final DoubleBlockProperties.Type doubleBlockType = this.getDoubleBlockType(blockState); if (chestType != ChestType.SINGLE) { BlockPos diff = switch (blockState.get(Properties.HORIZONTAL_FACING)) { case EAST -> new BlockPos(0, 0, 1); @@ -105,7 +105,7 @@ private ActionResult blockClicked( return ActionResult.PASS; } - public static DoubleBlockProperties.Type getDoubleBlockType(BlockState state) { + private DoubleBlockProperties.Type getDoubleBlockType(BlockState state) { ChestType chestType = state.get(Properties.CHEST_TYPE); if (chestType == ChestType.SINGLE) { return DoubleBlockProperties.Type.SINGLE; @@ -202,21 +202,21 @@ private void saveItem(IslandChestStorage islandStorage, Slot slot, @NotNull Bloc islandStorage.save(blockPos, this.getOtherPos(slot.id), slot.getStack(), this.getSlotForChest(slot.id)); } - public int getSlotForChest(int slot) { + private int getSlotForChest(int slot) { if (slot >= SLOTS_IN_ONE_CHEST) { return slot - SLOTS_IN_ONE_CHEST; } return slot; } - public BlockPos getBlockPos(int slot) { + private BlockPos getBlockPos(int slot) { if (slot >= SLOTS_IN_ONE_CHEST) { return this.second; } return this.first; } - public BlockPos getOtherPos(int slot) { + private BlockPos getOtherPos(int slot) { if (slot >= SLOTS_IN_ONE_CHEST) { return this.first; } diff --git a/src/main/java/codes/cookies/mod/features/misc/timer/FearTimer.java b/src/main/java/codes/cookies/mod/features/misc/timer/FearTimer.java index d9c64aee..1a76ae06 100644 --- a/src/main/java/codes/cookies/mod/features/misc/timer/FearTimer.java +++ b/src/main/java/codes/cookies/mod/features/misc/timer/FearTimer.java @@ -8,6 +8,9 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; +/** + * Timer for the primal fear cooldown. + */ public class FearTimer extends Timer { private static final SbEntityToast.ImageData DATA = new SbEntityToast.ImageData( 12, diff --git a/src/main/java/codes/cookies/mod/features/misc/timer/NotificationManager.java b/src/main/java/codes/cookies/mod/features/misc/timer/NotificationManager.java index 04d21503..b591fd97 100644 --- a/src/main/java/codes/cookies/mod/features/misc/timer/NotificationManager.java +++ b/src/main/java/codes/cookies/mod/features/misc/timer/NotificationManager.java @@ -17,6 +17,9 @@ import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; +/** + * Manager for all notifications/times in the mod. + */ public class NotificationManager { private static final Identifier DEBUG = DevUtils.createIdentifier("timer/enable_debug"); static List timers = new ArrayList<>(); diff --git a/src/main/java/codes/cookies/mod/features/misc/timer/PestTimer.java b/src/main/java/codes/cookies/mod/features/misc/timer/PestTimer.java index 78fbd359..72bc250f 100644 --- a/src/main/java/codes/cookies/mod/features/misc/timer/PestTimer.java +++ b/src/main/java/codes/cookies/mod/features/misc/timer/PestTimer.java @@ -25,6 +25,9 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; +/** + * Timer to keep track of pest spawning cooldowns. + */ @Getter public class PestTimer extends Timer { public static final SbEntityToast.ImageData DATA = new SbEntityToast.ImageData( diff --git a/src/main/java/codes/cookies/mod/features/misc/timer/SbEntityToast.java b/src/main/java/codes/cookies/mod/features/misc/timer/SbEntityToast.java index 3c0e5e1d..f1565831 100644 --- a/src/main/java/codes/cookies/mod/features/misc/timer/SbEntityToast.java +++ b/src/main/java/codes/cookies/mod/features/misc/timer/SbEntityToast.java @@ -10,6 +10,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Identifier; +/** + * Toast that renders an image and a text. + */ public class SbEntityToast implements Toast { private static final Identifier TEXTURE = Identifier.ofVanilla("toast/advancement"); private final ImageData data; diff --git a/src/main/java/codes/cookies/mod/features/misc/timer/Timer.java b/src/main/java/codes/cookies/mod/features/misc/timer/Timer.java index 8f9c7688..40f480d6 100644 --- a/src/main/java/codes/cookies/mod/features/misc/timer/Timer.java +++ b/src/main/java/codes/cookies/mod/features/misc/timer/Timer.java @@ -13,6 +13,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Identifier; +/** + * A generic timer that can notify the user. + */ public abstract class Timer { private final MiscConfig.NotificationFoldable.TimerConfig timerFoldable; private final Identifier debug; diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/AnvilHelper.java b/src/main/java/codes/cookies/mod/features/misc/utils/AnvilHelper.java index 6a938f37..1c5fed1e 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/AnvilHelper.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/AnvilHelper.java @@ -22,7 +22,9 @@ */ public class AnvilHelper { - @SuppressWarnings("MissingJavadocs") + /** + * Initializes the anvil helper. + */ public AnvilHelper() { ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> { if (screen instanceof GenericContainerScreen genericContainerScreen) { diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/StatsTracker.java b/src/main/java/codes/cookies/mod/features/misc/utils/StatsTracker.java index 94aa7b58..e7470823 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/StatsTracker.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/StatsTracker.java @@ -23,6 +23,9 @@ import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents; +/** + * Tracks the players stats and saves them. + */ public interface StatsTracker { static void init() { ScreenEvents.AFTER_INIT.register(StatsTracker::afterInitScreen); diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperContext.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperContext.java index c5080c56..aaf995c4 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperContext.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperContext.java @@ -9,6 +9,16 @@ import codes.cookies.mod.repository.recipes.calculations.RecipeCalculationResult; import codes.cookies.mod.repository.recipes.calculations.RecipeResult; +/** + * Context for craft helper component formatting and evaluation. + * @param components A list of components. + * @param prefix The current prefix. + * @param itemTracker The item tracker state. + * @param result The result the component is for. + * @param evaluationContext The evaluation context. + * @param path The current path. + * @param toolTipContext The tooltip context to use. + */ public record CraftHelperContext(List components, String prefix, ItemTracker itemTracker, @@ -33,6 +43,9 @@ public CraftHelperContext( new ToolTipContext(result.getRepositoryItemNotNull(), prefix)); } + /** + * Creates a new craft helper context for the result and the provided item sources. + */ public static CraftHelperContext create(RecipeCalculationResult result, ItemSources... values) { final Stack objects = new Stack<>(); objects.push(0); @@ -44,6 +57,9 @@ public static CraftHelperContext create(RecipeCalculationResult result, ItemSour new EvaluationContext(null, result, objects), "root"); } + /** + * Creates or returns the tooltip context. + */ public ToolTipContext toContext() { if (!toolTipContext.hasBeenInitialized) { toolTipContext.amount = amount() - getAmountThroughParents(); @@ -56,10 +72,16 @@ public ToolTipContext toContext() { return toolTipContext; } + /** + * @return The max amount. + */ public int getMax() { return result.getAmount(); } + /** + * @return The amount that is present through parent elements. + */ public int getAmountThroughParents() { if (evaluationContext.parent() == null) { return 0; @@ -69,6 +91,9 @@ public int getAmountThroughParents() { return Math.min(amount, result.getAmount()); } + /** + * @return The amount that is present. + */ public int amount() { int amount = 0; @@ -81,14 +106,26 @@ public int amount() { return Math.min(amount, getMax()); } + /** + * Pushes the amount onto the count stack. + */ public void pushAmount() { this.evaluationContext.stack().push(toolTipContext.getAmount() + toolTipContext.getAmountThroughParents()); // right } + /** + * Pops the amount from the count stack. + */ public void popAmount() { this.evaluationContext.stack().pop(); } + /** + * Push the context one layer to the next recipe. + * @param recipeResult The next recipe result. + * @param isLast Whether it is the last element in the list. + * @return The new context. + */ public CraftHelperContext push(RecipeResult recipeResult, boolean isLast) { String newPrefix; if (prefix.isEmpty()) { diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperFormatter.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperFormatter.java index a1d6036e..6a398f1f 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperFormatter.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperFormatter.java @@ -10,6 +10,9 @@ import codes.cookies.mod.repository.recipes.calculations.RecipeCalculationResult; import codes.cookies.mod.repository.recipes.calculations.RecipeResult; +/** + * Formatter for the craft helper. + */ public class CraftHelperFormatter { public CraftHelperInstance instance; @@ -18,6 +21,12 @@ public CraftHelperFormatter(CraftHelperInstance instance) { this.instance = instance; } + /** + * Formats the recipe calculation result in a list of craft helper elements. + * @param result The recipe result. + * @param instance The instance this belongs to. + * @return The formatted list. + */ public List format(RecipeCalculationResult result, CraftHelperInstance instance) { final CraftHelperContext craftHelperContext = CraftHelperContext.create( result, diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperInstance.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperInstance.java index 361cdac6..4d5a02cb 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperInstance.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperInstance.java @@ -33,6 +33,9 @@ import net.minecraft.util.Pair; import net.minecraft.util.dynamic.Codecs; +/** + * Instance of the craft helper. + */ @Getter @Setter public class CraftHelperInstance { @@ -65,6 +68,9 @@ public CraftHelperInstance(RepositoryItem repositoryItem, int amount, List getVisibleComponentList() { this.maxScroll = (int) Math.max(componentList.stream() .filter(Predicate.not(CraftHelperComponent::isHidden)) @@ -121,6 +130,9 @@ public List getVisibleComponentList() { return list; } + /** + * Renders the instance. + */ public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, float tickDelta) { if (!hasCalculated) { return; @@ -179,6 +191,9 @@ private void renderOverlay(CraftHelperComponentPart part, int textX, int x, int } } + /** + * @return The text under the mouse cursor. + */ public Optional> getTextUnder( double mouseX, double rawMouseY, @@ -237,6 +252,9 @@ public boolean onMouseClicked(double mouseX, double mouseY, int button) { return false; } + /** + * Gets the clicked component part and the x location where it was clicked. + */ private Optional> clicked( double mouseX, double mouseY, diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperLocation.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperLocation.java index 716f560a..1bfbfdd6 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperLocation.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperLocation.java @@ -1,5 +1,8 @@ package codes.cookies.mod.features.misc.utils.crafthelper; +/** + * The location the craft helper is placed at. + */ public enum CraftHelperLocation { LEFT, LEFT_INVENTORY, RIGHT_INVENTORY, RIGHT diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperManager.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperManager.java index d0b5ee86..a7cf2d14 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperManager.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperManager.java @@ -23,6 +23,9 @@ import net.fabricmc.fabric.api.client.screen.v1.ScreenKeyboardEvents; import net.fabricmc.fabric.api.client.screen.v1.ScreenMouseEvents; +/** + * Manager for all craft helper instances. + */ public class CraftHelperManager { @Setter @@ -57,6 +60,9 @@ public static void init() { }); } + /** + * Pushes a new craft helper instance. + */ public static void pushNewCraftHelperItem(RepositoryItem repositoryItem, int amount) { active = new CraftHelperInstance(repositoryItem, amount, new ArrayList<>()); active.recalculate(); diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperPlacement.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperPlacement.java index 4d24b46c..89ccab31 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperPlacement.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperPlacement.java @@ -13,6 +13,9 @@ import net.minecraft.item.Items; import net.minecraft.text.Text; +/** + * Placement screen for the craft helper. + */ public class CraftHelperPlacement extends ClientSideInventory { private static final int UNSELECTED_COLOR = Constants.SUCCESS_COLOR; diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperTooltipPositioner.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperTooltipPositioner.java index dfa7a448..3ecde537 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperTooltipPositioner.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/CraftHelperTooltipPositioner.java @@ -6,6 +6,9 @@ import org.joml.Vector2i; import org.joml.Vector2ic; +/** + * Tooltip positioner for craft helper instances. + */ public class CraftHelperTooltipPositioner implements TooltipPositioner { public static CraftHelperTooltipPositioner INSTANCE = new CraftHelperTooltipPositioner(); diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/EvaluationContext.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/EvaluationContext.java index 5a329663..4353abad 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/EvaluationContext.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/EvaluationContext.java @@ -4,6 +4,12 @@ import java.util.Stack; +/** + * Evaluation context for the craft helper. + * @param parent The parent instance. + * @param recipeResult The recipe result. + * @param stack The item amount stack. + */ public record EvaluationContext(EvaluationContext parent, RecipeResult recipeResult, Stack stack) { public EvaluationContext push(RecipeResult recipeResult) { return new EvaluationContext(this, recipeResult, stack); diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/ItemTracker.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/ItemTracker.java index 8d57ded7..374517d3 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/ItemTracker.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/ItemTracker.java @@ -20,6 +20,9 @@ import net.minecraft.util.Pair; +/** + * Tracks availability of repository items across a crafting tree. + */ public class ItemTracker { private final Map trackedItems = new HashMap<>(); @@ -39,6 +42,11 @@ public ItemTracker(ItemTracker itemTracker) { trackedItem.copy())); } + /** + * Gets the amount of items available for the item. + * @param repositoryItem The item. + * @return The amount available. + */ public int getAmount(RepositoryItem repositoryItem) { if (trackedItems.containsKey(repositoryItem)) { return trackedItems.get(repositoryItem).amount; @@ -46,6 +54,12 @@ public int getAmount(RepositoryItem repositoryItem) { return 0; } + /** + * Takes the amount of the item if possible. + * @param repositoryItem The item. + * @param amount The amount to take. + * @return The amount that was available. + */ public int take(RepositoryItem repositoryItem, int amount) { if (trackedItems.containsKey(repositoryItem)) { return trackedItems.get(repositoryItem).take(amount); @@ -53,14 +67,26 @@ public int take(RepositoryItem repositoryItem, int amount) { return 0; } + /** + * Creates a copy of the item tracker. + * @return The copy. + */ public ItemTracker copy() { return new ItemTracker(this); } + /** + * Gets the tracked item representation of the repository item. + * @param repositoryItem The item. + * @return The tracked item. + */ public TrackedItem get(RepositoryItem repositoryItem) { return trackedItems.getOrDefault(repositoryItem, TrackedItem.EMPTY); } + /** + * Used to store availability and other stats about an item. + */ public static class TrackedItem { public static TrackedItem EMPTY = new TrackedItem(RepositoryItem.EMPTY); @@ -77,7 +103,6 @@ public TrackedItem(@NotNull RepositoryItem repositoryItem) { this.repositoryItem = repositoryItem; } - public TrackedItem(@NotNull RepositoryItem repositoryItem, List> items) { this.repositoryItem = repositoryItem; for (Item item : items) { @@ -100,6 +125,11 @@ public TrackedItem(TrackedItem trackedItem) { this.sourceAmounts.putAll(trackedItem.sourceAmounts); } + /** + * Tries to take the provided amount. + * @param max The amount to take. + * @return The amount that was available. + */ public int take(int max) { int remaining = amount - consumed; if (remaining > max) { diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/ToolTipContext.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/ToolTipContext.java index 83661beb..4f17b505 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/ToolTipContext.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/ToolTipContext.java @@ -8,6 +8,9 @@ import java.util.ArrayList; import java.util.List; +/** + * Craft helper tooltip context to cache data. + */ @RequiredArgsConstructor @Getter public class ToolTipContext { diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperComponent.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperComponent.java index ae54c8fc..1b893f40 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperComponent.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperComponent.java @@ -10,6 +10,9 @@ import net.minecraft.client.gui.tooltip.TooltipComponent; import net.minecraft.util.Identifier; +/** + * Standard component used in the craft helper. + */ @Setter public abstract class CraftHelperComponent implements TooltipComponent { protected static final Identifier DEBUG = DevUtils.createIdentifier("craft_helper/debug_messages"); @@ -18,20 +21,34 @@ public abstract class CraftHelperComponent implements TooltipComponent { @Getter boolean collapsed = false; - + /** + * @return The parent of the component. + */ public Optional getParent() { return Optional.ofNullable(parent); } + /** + * @return Whether the component is hidden or collapsed. + */ public boolean isHiddenOrCollapsed() { return isHidden() || isCollapsed(); } + /** + * @return Whether the component is hidden. + */ public boolean isHidden() { return getParent().map(CraftHelperComponent::isHiddenOrCollapsed).orElse(false); } + /** + * Initializes the component. + */ public void init() {} + /** + * @return The parts used by the component. + */ public abstract List getTextParts(); } diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperComponentPart.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperComponentPart.java index 80715c57..28d9d51d 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperComponentPart.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperComponentPart.java @@ -1,5 +1,8 @@ package codes.cookies.mod.features.misc.utils.crafthelper.tooltips; +/** + * A generic part that is used in a craft helper component. + */ public interface CraftHelperComponentPart { int x(); diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperText.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperText.java index 5ac796dd..495232f7 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperText.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/CraftHelperText.java @@ -7,6 +7,9 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.text.Text; +/** + * Text that is used in a craft helper component. + */ @Setter public final class CraftHelperText implements CraftHelperComponentPart { private final Text text; diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/DebugComponent.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/DebugComponent.java index d691abc3..71cff2e6 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/DebugComponent.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/DebugComponent.java @@ -7,6 +7,9 @@ import java.util.List; +/** + * Debug craft helper component. + */ public class DebugComponent extends CraftHelperComponent { private final CraftHelperText debug; diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/HeadingPart.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/HeadingPart.java index f07e0f44..03f38d06 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/HeadingPart.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/HeadingPart.java @@ -26,6 +26,9 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; +/** + * Heading element of the craft helper. + */ public final class HeadingPart extends CraftHelperComponent { private static final Identifier SLOT = Identifier.of("cookies-mod", "textures/gui/slot.png"); diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/NormalComponent.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/NormalComponent.java index 347778f7..c8c2d57d 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/NormalComponent.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/NormalComponent.java @@ -37,6 +37,9 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Pair; +/** + * A "normal" craft helper component, used for all except the debug and header components. + */ public class NormalComponent extends CraftHelperComponent { private final ToolTipContext toolTipContext; diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/SpacerComponent.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/SpacerComponent.java index b9105f87..f339ef6a 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/SpacerComponent.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/SpacerComponent.java @@ -3,6 +3,11 @@ import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.tooltip.TooltipComponent; +/** + * A spacer tooltip component. + * @param height The height. + * @param width The width. + */ public record SpacerComponent(int height, int width) implements TooltipComponent { @Override public int getHeight(TextRenderer textRenderer) { diff --git a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/TooltipFieldPart.java b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/TooltipFieldPart.java index 37013336..253d6b21 100644 --- a/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/TooltipFieldPart.java +++ b/src/main/java/codes/cookies/mod/features/misc/utils/crafthelper/tooltips/TooltipFieldPart.java @@ -9,6 +9,9 @@ import java.util.List; import java.util.Objects; +/** + * Represents a field in the craft helper component. + */ @Setter public final class TooltipFieldPart implements CraftHelperComponentPart { private int x; diff --git a/src/main/java/codes/cookies/mod/features/search/MuseumHelper.java b/src/main/java/codes/cookies/mod/features/search/MuseumHelper.java index 4158a07a..b8cf7011 100644 --- a/src/main/java/codes/cookies/mod/features/search/MuseumHelper.java +++ b/src/main/java/codes/cookies/mod/features/search/MuseumHelper.java @@ -48,6 +48,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Formatting; +/** + * Helper for the museum, shows what items are present on the profile. + */ public class MuseumHelper { Map>> items; diff --git a/src/main/java/codes/cookies/mod/mixins/render/HideLightningBoltMixin.java b/src/main/java/codes/cookies/mod/mixins/render/HideLightningBoltMixin.java index 6a6aa43e..72a3ead2 100644 --- a/src/main/java/codes/cookies/mod/mixins/render/HideLightningBoltMixin.java +++ b/src/main/java/codes/cookies/mod/mixins/render/HideLightningBoltMixin.java @@ -9,6 +9,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +/** + * Stops lightning bolts from being rendered. + */ @Mixin(LightningEntityRenderer.class) public class HideLightningBoltMixin { diff --git a/src/main/java/codes/cookies/mod/render/Renderable.java b/src/main/java/codes/cookies/mod/render/Renderable.java index 1a3c4f24..d5cbb1e7 100644 --- a/src/main/java/codes/cookies/mod/render/Renderable.java +++ b/src/main/java/codes/cookies/mod/render/Renderable.java @@ -42,5 +42,8 @@ default boolean shouldRemove() { return false; } + /** + * Called when registering the renderable with the world renderer. + */ default void load() {} } diff --git a/src/main/java/codes/cookies/mod/render/hud/HudEditScreen.java b/src/main/java/codes/cookies/mod/render/hud/HudEditScreen.java index 1b90f015..b62a52c6 100644 --- a/src/main/java/codes/cookies/mod/render/hud/HudEditScreen.java +++ b/src/main/java/codes/cookies/mod/render/hud/HudEditScreen.java @@ -26,6 +26,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Formatting; +/** + * Implementation of the hud edit screen. + */ public class HudEditScreen extends Screen { private HudElement currentlyHovered; private Action action = Action.NONE; @@ -306,13 +309,13 @@ public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmou return super.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); } - public Optional getElementUnder(int x, int y) { + private Optional getElementUnder(int x, int y) { return getVisibleElements().stream() .filter(hudElement -> expandBox(hudElement.getScaledBoundingBox(), 0).isPointInsideBox(x, y)) .findFirst(); } - public BoundingBox expandBox(BoundingBox box, float amount) { + private BoundingBox expandBox(BoundingBox box, float amount) { return box.expand(amount); } diff --git a/src/main/java/codes/cookies/mod/render/hud/HudManager.java b/src/main/java/codes/cookies/mod/render/hud/HudManager.java index 829aed4b..29cee119 100644 --- a/src/main/java/codes/cookies/mod/render/hud/HudManager.java +++ b/src/main/java/codes/cookies/mod/render/hud/HudManager.java @@ -18,6 +18,9 @@ import net.minecraft.util.Identifier; +/** + * Manager for the hud, handles registration, rendering and persisting. + */ public class HudManager { static final List elements = new ArrayList<>(); diff --git a/src/main/java/codes/cookies/mod/render/hud/elements/HudElement.java b/src/main/java/codes/cookies/mod/render/hud/elements/HudElement.java index e2355bc3..4fd83bb5 100644 --- a/src/main/java/codes/cookies/mod/render/hud/elements/HudElement.java +++ b/src/main/java/codes/cookies/mod/render/hud/elements/HudElement.java @@ -21,6 +21,9 @@ import java.util.List; +/** + * A generic hud element. + */ @Getter public abstract class HudElement { @@ -33,10 +36,19 @@ public HudElement(Identifier identifier) { this.identifier = identifier; } + /** + * Renders the hud element. + */ public abstract void render(DrawContext drawContext, TextRenderer textRenderer, float ticks); + /** + * @return Whether the element should be rendered. + */ public abstract boolean shouldRender(); + /** + * Renders the element with all checks. + */ public final void renderChecks(DrawContext drawContext, TextRenderer textRenderer, float partialTicks) { if (!shouldRender()) { return; @@ -44,12 +56,25 @@ public final void renderChecks(DrawContext drawContext, TextRenderer textRendere render(drawContext, textRenderer, partialTicks); } + /** + * @return The width of the element. + */ public abstract int getWidth(); + /** + * @return The height of the element. + */ public abstract int getHeight(); + /** + * @return The name of the element. + */ public abstract Text getName(); + /** + * Adds all settings that are used by the element. + * @param builder The settings builder. + */ @MustBeInvokedByOverriders public void buildSettings(HudElementSettingBuilder builder) { builder.prependSetting(new EnumCycleSetting<>( diff --git a/src/main/java/codes/cookies/mod/render/hud/elements/MultiLineTextHudElement.java b/src/main/java/codes/cookies/mod/render/hud/elements/MultiLineTextHudElement.java index 6874ba0d..8d560cbf 100644 --- a/src/main/java/codes/cookies/mod/render/hud/elements/MultiLineTextHudElement.java +++ b/src/main/java/codes/cookies/mod/render/hud/elements/MultiLineTextHudElement.java @@ -7,6 +7,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Identifier; +/** + * A generic multiline text hud. + */ public abstract class MultiLineTextHudElement extends HudElement { protected int lastWidth; public MultiLineTextHudElement(Identifier identifier) { diff --git a/src/main/java/codes/cookies/mod/render/hud/elements/TextHudElement.java b/src/main/java/codes/cookies/mod/render/hud/elements/TextHudElement.java index 61a9a3ea..4cc01eca 100644 --- a/src/main/java/codes/cookies/mod/render/hud/elements/TextHudElement.java +++ b/src/main/java/codes/cookies/mod/render/hud/elements/TextHudElement.java @@ -8,6 +8,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Identifier; +/** + * Single line text hud element. + */ public abstract class TextHudElement extends HudElement { public TextHudElement(Identifier identifier) { diff --git a/src/main/java/codes/cookies/mod/render/hud/internal/Action.java b/src/main/java/codes/cookies/mod/render/hud/internal/Action.java index 3c272376..75b9ae09 100644 --- a/src/main/java/codes/cookies/mod/render/hud/internal/Action.java +++ b/src/main/java/codes/cookies/mod/render/hud/internal/Action.java @@ -1,5 +1,8 @@ package codes.cookies.mod.render.hud.internal; +/** + * Different actions that can be done in the hud edit screen. + */ public enum Action { MOVE, EDIT, NONE diff --git a/src/main/java/codes/cookies/mod/render/hud/internal/Alignment.java b/src/main/java/codes/cookies/mod/render/hud/internal/Alignment.java index 9619aeac..7da1fae9 100644 --- a/src/main/java/codes/cookies/mod/render/hud/internal/Alignment.java +++ b/src/main/java/codes/cookies/mod/render/hud/internal/Alignment.java @@ -4,11 +4,17 @@ import net.minecraft.util.StringIdentifiable; +/** + * Where the alignment point of the hud element is. + */ public enum Alignment implements StringIdentifiable { LEFT, MIDDLE, RIGHT; public static Codec CODEC = StringIdentifiable.createBasicCodec(Alignment::values); + /** + * Calculates the x position of the hud element, based on the alignment. + */ public int getX(int x, int width) { return switch (this) { case LEFT -> x; diff --git a/src/main/java/codes/cookies/mod/render/hud/internal/BoundingBox.java b/src/main/java/codes/cookies/mod/render/hud/internal/BoundingBox.java index 1115fee5..9723f220 100644 --- a/src/main/java/codes/cookies/mod/render/hud/internal/BoundingBox.java +++ b/src/main/java/codes/cookies/mod/render/hud/internal/BoundingBox.java @@ -4,6 +4,9 @@ import net.minecraft.client.gui.DrawContext; +/** + * A bounding box for the hud system, only really used as utility class. + */ public record BoundingBox(float x, float y, float width, float height) { public BoundingBox scale(float scaleFactor) { diff --git a/src/main/java/codes/cookies/mod/render/hud/internal/HudEditAction.java b/src/main/java/codes/cookies/mod/render/hud/internal/HudEditAction.java index ea9ae161..4ccc5374 100644 --- a/src/main/java/codes/cookies/mod/render/hud/internal/HudEditAction.java +++ b/src/main/java/codes/cookies/mod/render/hud/internal/HudEditAction.java @@ -3,6 +3,9 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; +/** + * Current hud edit action, it's more like current visibility state. + */ @Getter @RequiredArgsConstructor public enum HudEditAction { diff --git a/src/main/java/codes/cookies/mod/render/hud/internal/HudPosition.java b/src/main/java/codes/cookies/mod/render/hud/internal/HudPosition.java index cf81e572..534e8bb7 100644 --- a/src/main/java/codes/cookies/mod/render/hud/internal/HudPosition.java +++ b/src/main/java/codes/cookies/mod/render/hud/internal/HudPosition.java @@ -7,6 +7,9 @@ import net.minecraft.client.MinecraftClient; +/** + * Element position in the hud. + */ public class HudPosition { public static Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( Codec.FLOAT.fieldOf("x").forGetter(HudPosition::getRelativeX), diff --git a/src/main/java/codes/cookies/mod/render/hud/settings/BooleanSetting.java b/src/main/java/codes/cookies/mod/render/hud/settings/BooleanSetting.java index e11cb1dd..7c103535 100644 --- a/src/main/java/codes/cookies/mod/render/hud/settings/BooleanSetting.java +++ b/src/main/java/codes/cookies/mod/render/hud/settings/BooleanSetting.java @@ -16,6 +16,9 @@ import net.minecraft.sound.SoundEvents; import net.minecraft.text.Text; +/** + * A boolean setting for a hud element. + */ public class BooleanSetting extends HudElementSetting { private static final ItemStack ACTIVATED = new ItemStack(Items.GREEN_WOOL); private static final ItemStack DEACTIVATED = new ItemStack(Items.RED_WOOL); diff --git a/src/main/java/codes/cookies/mod/render/hud/settings/ColorSetting.java b/src/main/java/codes/cookies/mod/render/hud/settings/ColorSetting.java index d5108901..6d1dcd5a 100644 --- a/src/main/java/codes/cookies/mod/render/hud/settings/ColorSetting.java +++ b/src/main/java/codes/cookies/mod/render/hud/settings/ColorSetting.java @@ -14,6 +14,9 @@ import net.minecraft.client.gui.tooltip.HoveredTooltipPositioner; import net.minecraft.text.Text; +/** + * Hud setting for color. + */ public class ColorSetting extends HudElementSetting { final ColorInputWidget inputWidget; diff --git a/src/main/java/codes/cookies/mod/render/hud/settings/EnumCycleSetting.java b/src/main/java/codes/cookies/mod/render/hud/settings/EnumCycleSetting.java index e0591bde..4b38afcc 100644 --- a/src/main/java/codes/cookies/mod/render/hud/settings/EnumCycleSetting.java +++ b/src/main/java/codes/cookies/mod/render/hud/settings/EnumCycleSetting.java @@ -16,6 +16,10 @@ import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; +/** + * Hud setting for enum cycles. + * @param The enum type. + */ public class EnumCycleSetting> extends HudElementSetting { private final Text name; diff --git a/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSetting.java b/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSetting.java index 2b8ef539..14602f45 100644 --- a/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSetting.java +++ b/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSetting.java @@ -10,6 +10,9 @@ import net.minecraft.client.gui.Element; import net.minecraft.client.gui.Selectable; +/** + * Generic setting for a hud element. + */ public abstract class HudElementSetting implements Drawable, Selectable, Element { private final HudElementSettingType type; diff --git a/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSettingBuilder.java b/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSettingBuilder.java index f9c256a1..f1fbc2f5 100644 --- a/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSettingBuilder.java +++ b/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSettingBuilder.java @@ -12,29 +12,43 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Builder for the hud element settings. + */ public class HudElementSettingBuilder { private static final Logger log = LoggerFactory.getLogger(HudElementSettingBuilder.class); private final List settings = new ArrayList<>(); + /** + * Adds a setting to the list. + * @param setting The setting to add. + */ public void addSetting(HudElementSetting setting) { settings.add(setting); } + /** + * Prepend setting to the list. + * @param setting The setting to prepend. + */ public void prependSetting(HudElementSetting setting) { settings.addFirst(setting); } - public void addAfter(HudElementSetting toAdd, HudElementSetting after) { - settings.add(settings.indexOf(after) + 1, toAdd); - } - + /** + * Builds the settings list. + */ public List build() { return settings.stream() .sorted(Comparator.comparing(HudElementSetting::getSettingType, HudElementSettingType::compareTo)) .toList(); } + /** + * Creates a setting based on the provided option if applicable. + * @param option The option to use. + */ public void addOption(Option option) { switch (option) { case BooleanOption booleanOption -> addSetting(new BooleanSetting(booleanOption)); diff --git a/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSettingType.java b/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSettingType.java index c86d9993..09b2d12e 100644 --- a/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSettingType.java +++ b/src/main/java/codes/cookies/mod/render/hud/settings/HudElementSettingType.java @@ -1,5 +1,8 @@ package codes.cookies.mod.render.hud.settings; +/** + * The different types of settings a hud element can have. + */ public enum HudElementSettingType { METADATA, POSITION, CUSTOM diff --git a/src/main/java/codes/cookies/mod/render/hud/settings/LiteralSetting.java b/src/main/java/codes/cookies/mod/render/hud/settings/LiteralSetting.java index 49bb8c03..0b85674d 100644 --- a/src/main/java/codes/cookies/mod/render/hud/settings/LiteralSetting.java +++ b/src/main/java/codes/cookies/mod/render/hud/settings/LiteralSetting.java @@ -5,6 +5,9 @@ import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; import net.minecraft.text.Text; +/** + * Literal text as hud element setting. + */ public class LiteralSetting extends HudElementSetting { private final Text literal; diff --git a/src/main/java/codes/cookies/mod/render/hud/settings/ValueSetting.java b/src/main/java/codes/cookies/mod/render/hud/settings/ValueSetting.java index de75e403..3a769260 100644 --- a/src/main/java/codes/cookies/mod/render/hud/settings/ValueSetting.java +++ b/src/main/java/codes/cookies/mod/render/hud/settings/ValueSetting.java @@ -5,6 +5,9 @@ import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; import net.minecraft.text.Text; +/** + * A "value" setting for a hud element, used to display location and scale. + */ public class ValueSetting extends HudElementSetting { private final Text literal; diff --git a/src/main/java/codes/cookies/mod/render/mixins/DrawContextMixin.java b/src/main/java/codes/cookies/mod/render/mixins/DrawContextMixin.java index ef13be6a..32cc8a83 100644 --- a/src/main/java/codes/cookies/mod/render/mixins/DrawContextMixin.java +++ b/src/main/java/codes/cookies/mod/render/mixins/DrawContextMixin.java @@ -16,6 +16,9 @@ import java.util.function.Consumer; +/** + * Some utility for the draw context. + */ @Mixin(DrawContext.class) public abstract class DrawContextMixin implements DrawContextInjections { @Shadow diff --git a/src/main/java/codes/cookies/mod/render/types/CallbackRemovable.java b/src/main/java/codes/cookies/mod/render/types/CallbackRemovable.java index c092b86a..2f456eb7 100644 --- a/src/main/java/codes/cookies/mod/render/types/CallbackRemovable.java +++ b/src/main/java/codes/cookies/mod/render/types/CallbackRemovable.java @@ -9,6 +9,9 @@ import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +/** + * Renderable that can be removed with either an atomic boolean or a completable future. + */ public record CallbackRemovable(Renderable renderable, AtomicBoolean reference) implements Renderable { public CallbackRemovable(Renderable renderable, CompletableFuture completableFuture) { diff --git a/src/main/java/codes/cookies/mod/render/widgets/ColorInputWidget.java b/src/main/java/codes/cookies/mod/render/widgets/ColorInputWidget.java index 0fed890c..ed5d9b4e 100644 --- a/src/main/java/codes/cookies/mod/render/widgets/ColorInputWidget.java +++ b/src/main/java/codes/cookies/mod/render/widgets/ColorInputWidget.java @@ -15,6 +15,9 @@ import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.text.Text; +/** + * Widget to allow for easy color input. + */ public class ColorInputWidget extends TextFieldWidget { private final boolean canHaveAlpha = false; private Color color; diff --git a/src/main/java/codes/cookies/mod/repository/RepositoryItemMuseumData.java b/src/main/java/codes/cookies/mod/repository/RepositoryItemMuseumData.java index e7f9fff9..ef759c57 100644 --- a/src/main/java/codes/cookies/mod/repository/RepositoryItemMuseumData.java +++ b/src/main/java/codes/cookies/mod/repository/RepositoryItemMuseumData.java @@ -10,6 +10,9 @@ import lombok.Getter; import org.jetbrains.annotations.NotNull; +/** + * Museum data instance that is stored in the repository. + */ public class RepositoryItemMuseumData { private List armorItems; diff --git a/src/main/java/codes/cookies/mod/repository/constants/MuseumData.java b/src/main/java/codes/cookies/mod/repository/constants/MuseumData.java index 0c4066c5..ba70376b 100644 --- a/src/main/java/codes/cookies/mod/repository/constants/MuseumData.java +++ b/src/main/java/codes/cookies/mod/repository/constants/MuseumData.java @@ -22,6 +22,15 @@ import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.Nullable; +/** + * Repository data for the museum. + * @param weapons All weapons that can be put in the museum. + * @param armor All armor items that can be put in the museum. + * @param rarity All items that fall under the rarity category. + * @param special All items that fall under the special category. + * @param museumItems All museum items. + * @param exceptions All naming exceptions. + */ @Slf4j public record MuseumData( List weapons, List armor, List rarity, List special, diff --git a/src/main/java/codes/cookies/mod/repository/constants/RepositoryConstantsHelper.java b/src/main/java/codes/cookies/mod/repository/constants/RepositoryConstantsHelper.java index 582e3562..13148560 100644 --- a/src/main/java/codes/cookies/mod/repository/constants/RepositoryConstantsHelper.java +++ b/src/main/java/codes/cookies/mod/repository/constants/RepositoryConstantsHelper.java @@ -11,6 +11,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * helper for save loading of repository data. + */ public interface RepositoryConstantsHelper { Logger LOGGER = LoggerFactory.getLogger("repository/constants"); diff --git a/src/main/java/codes/cookies/mod/repository/constants/dungeons/DungeonConstants.java b/src/main/java/codes/cookies/mod/repository/constants/dungeons/DungeonConstants.java index cb94d9ea..50177c1f 100644 --- a/src/main/java/codes/cookies/mod/repository/constants/dungeons/DungeonConstants.java +++ b/src/main/java/codes/cookies/mod/repository/constants/dungeons/DungeonConstants.java @@ -14,6 +14,9 @@ import codes.cookies.mod.features.dungeons.solver.puzzle.WaterBoardPuzzleSolver; import codes.cookies.mod.repository.constants.RepositoryConstantsHelper; +/** + * Constants used in dungeon features. + */ public class DungeonConstants { public static List waterEntries; diff --git a/src/main/java/codes/cookies/mod/repository/constants/dungeons/WaterEntry.java b/src/main/java/codes/cookies/mod/repository/constants/dungeons/WaterEntry.java index ece44595..ef60de58 100644 --- a/src/main/java/codes/cookies/mod/repository/constants/dungeons/WaterEntry.java +++ b/src/main/java/codes/cookies/mod/repository/constants/dungeons/WaterEntry.java @@ -14,6 +14,12 @@ import codes.cookies.mod.features.dungeons.solver.puzzle.WaterBoardPuzzleSolver; import org.jetbrains.annotations.Nullable; +/** + * Entry in the water board solver list. + * @param variant The variant of the room. + * @param closed The closed doors. + * @param times The times to flick levers at. + */ public record WaterEntry( WaterBoardPuzzleSolver.Variant variant, String closed, Map> times diff --git a/src/main/java/codes/cookies/mod/repository/constants/mining/ShaftCorpseLocations.java b/src/main/java/codes/cookies/mod/repository/constants/mining/ShaftCorpseLocations.java index 638d261a..10a4336f 100644 --- a/src/main/java/codes/cookies/mod/repository/constants/mining/ShaftCorpseLocations.java +++ b/src/main/java/codes/cookies/mod/repository/constants/mining/ShaftCorpseLocations.java @@ -13,6 +13,10 @@ import net.minecraft.util.math.BlockPos; + +/** + * Repository data of all shaft corpse locations. + */ @Slf4j public class ShaftCorpseLocations { diff --git a/src/main/java/codes/cookies/mod/screen/search/InspectItemScreen.java b/src/main/java/codes/cookies/mod/screen/search/InspectItemScreen.java index f1f1be7d..f675c771 100644 --- a/src/main/java/codes/cookies/mod/screen/search/InspectItemScreen.java +++ b/src/main/java/codes/cookies/mod/screen/search/InspectItemScreen.java @@ -30,6 +30,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Formatting; +/** + * Shows all present sources for a provided item compound. + */ public class InspectItemScreen extends ClientSideInventory { private static final Position LEFT_ARROW = new Position(5, 0); diff --git a/src/main/java/codes/cookies/mod/screen/search/ItemSearchScreen.java b/src/main/java/codes/cookies/mod/screen/search/ItemSearchScreen.java index 30b84a95..c6bd1e4d 100644 --- a/src/main/java/codes/cookies/mod/screen/search/ItemSearchScreen.java +++ b/src/main/java/codes/cookies/mod/screen/search/ItemSearchScreen.java @@ -410,6 +410,9 @@ public boolean charTyped(char chr, int modifiers) { return super.charTyped(chr, modifiers); } + /** + * Updates the item search screen. + */ public void updateInventory() { this.buildItemIndex(); this.updateSearch(lastSearch); diff --git a/src/main/java/codes/cookies/mod/services/item/ItemHighlightService.java b/src/main/java/codes/cookies/mod/services/item/ItemHighlightService.java index 735d1d5b..029d82a5 100644 --- a/src/main/java/codes/cookies/mod/services/item/ItemHighlightService.java +++ b/src/main/java/codes/cookies/mod/services/item/ItemHighlightService.java @@ -29,6 +29,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; +/** + * Service to handle highlighting. + */ public class ItemHighlightService { @Nullable diff --git a/src/main/java/codes/cookies/mod/services/item/ItemSearchService.java b/src/main/java/codes/cookies/mod/services/item/ItemSearchService.java index f537cede..e3c684e6 100644 --- a/src/main/java/codes/cookies/mod/services/item/ItemSearchService.java +++ b/src/main/java/codes/cookies/mod/services/item/ItemSearchService.java @@ -17,9 +17,15 @@ import net.minecraft.text.Text; +/** + * Service to handle various item search things. + */ public class ItemSearchService { - + /** + * Opens the recipe of a craftable item. + * @param data + */ public static void handleCraftable(CraftableItemSource.Data data) { if (data.hasAllIngredients()) { sendCommand("viewrecipe " + data.output().getId()); diff --git a/src/main/java/codes/cookies/mod/services/item/ItemServices.java b/src/main/java/codes/cookies/mod/services/item/ItemServices.java index 718a4204..bc54e736 100644 --- a/src/main/java/codes/cookies/mod/services/item/ItemServices.java +++ b/src/main/java/codes/cookies/mod/services/item/ItemServices.java @@ -34,6 +34,9 @@ import net.minecraft.util.Formatting; import net.minecraft.util.math.BlockPos; +/** + * Service for item related methods, + */ public class ItemServices { /** * Whether the two items are the same. @@ -251,6 +254,11 @@ public static int getColor(RepositoryItem repositoryItem) { return 0xFF << 24 | color & 0xFFFFFF; } + /** + * Extracts the chest positions for the item compound. + * @param itemCompound The compound. + * @return The chest positions that are present in the compound. + */ public static Set extractChestPositions(ItemCompound itemCompound) { Set positions = new HashSet<>(); for (Item item : itemCompound.items()) { @@ -266,6 +274,11 @@ public static Set extractChestPositions(ItemCompound itemCompound) { return positions; } + /** + * Gets the repository item of the item stack. + * @param itemStack The stack. + * @return The repository item associated with the stack. + */ public static Optional getRepositoryItem(@NotNull ItemStack itemStack) { return Optional.ofNullable(itemStack.get(CookiesDataComponentTypes.REPOSITORY_ITEM)); } diff --git a/src/main/java/codes/cookies/mod/services/item/search/ExactItemMatch.java b/src/main/java/codes/cookies/mod/services/item/search/ExactItemMatch.java index c5b0e09f..d414e6d8 100644 --- a/src/main/java/codes/cookies/mod/services/item/search/ExactItemMatch.java +++ b/src/main/java/codes/cookies/mod/services/item/search/ExactItemMatch.java @@ -17,6 +17,10 @@ import java.util.Optional; import java.util.UUID; +/** + * Matches an item as good as possible. + * @param itemStack The item to match. + */ public record ExactItemMatch(ItemStack itemStack) implements ItemSearchFilter { @Override public int getColor() { diff --git a/src/main/java/codes/cookies/mod/services/item/search/IsSameMatch.java b/src/main/java/codes/cookies/mod/services/item/search/IsSameMatch.java index 155e742c..7e21ba10 100644 --- a/src/main/java/codes/cookies/mod/services/item/search/IsSameMatch.java +++ b/src/main/java/codes/cookies/mod/services/item/search/IsSameMatch.java @@ -9,6 +9,10 @@ import net.minecraft.item.ItemStack; +/** + * Tries to match two items. + * @param itemStack The item to match. + */ public record IsSameMatch(@NotNull ItemStack itemStack) implements ItemSearchFilter { @Override @@ -23,7 +27,7 @@ public IsSameResult doesMatch(ItemStack stack) { return getResult(stack).map(IsSameResult::wrapBoolean).orElse(IsSameResult.NO); } - Optional getResult(ItemStack stack) { + private Optional getResult(ItemStack stack) { return Optional.ofNullable(stack).map(check -> ItemServices.isSame(check, itemStack)); } } diff --git a/src/main/java/codes/cookies/mod/services/item/search/ItemSearchFilter.java b/src/main/java/codes/cookies/mod/services/item/search/ItemSearchFilter.java index 5cf5cd54..0ad0d214 100644 --- a/src/main/java/codes/cookies/mod/services/item/search/ItemSearchFilter.java +++ b/src/main/java/codes/cookies/mod/services/item/search/ItemSearchFilter.java @@ -4,9 +4,21 @@ import net.minecraft.item.ItemStack; +/** + * Filter that can be used by item search. + */ public interface ItemSearchFilter { + /** + * The color to use for highlighting. + */ int getColor(); + + /** + * Checks if the item matches the filter. + * @param stack The stack to match. + * @return Whether the stack does match the filter, and how exact the match is. + */ IsSameResult doesMatch(ItemStack stack); } diff --git a/src/main/java/codes/cookies/mod/services/item/search/SearchQueryMatcher.java b/src/main/java/codes/cookies/mod/services/item/search/SearchQueryMatcher.java index b92348cc..431b6f61 100644 --- a/src/main/java/codes/cookies/mod/services/item/search/SearchQueryMatcher.java +++ b/src/main/java/codes/cookies/mod/services/item/search/SearchQueryMatcher.java @@ -29,6 +29,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.text.Text; +/** + * Item search filter for string queries. + */ @RequiredArgsConstructor public class SearchQueryMatcher implements ItemSearchFilter { diff --git a/src/main/java/codes/cookies/mod/services/powder/PowderEntry.java b/src/main/java/codes/cookies/mod/services/powder/PowderEntry.java index f961c18a..cdc2d9b5 100644 --- a/src/main/java/codes/cookies/mod/services/powder/PowderEntry.java +++ b/src/main/java/codes/cookies/mod/services/powder/PowderEntry.java @@ -3,6 +3,9 @@ import codes.cookies.mod.config.categories.mining.powder.PowderTrackerHudFoldable; import codes.cookies.mod.utils.cookies.PauseableTime; +/** + * Entry of the powder tracker. + */ public final class PowderEntry { private long powderGained; private PauseableTime pauseableTime; diff --git a/src/main/java/codes/cookies/mod/services/powder/PowderService.java b/src/main/java/codes/cookies/mod/services/powder/PowderService.java index 3822ea6f..a7e5af01 100644 --- a/src/main/java/codes/cookies/mod/services/powder/PowderService.java +++ b/src/main/java/codes/cookies/mod/services/powder/PowderService.java @@ -17,6 +17,9 @@ import net.minecraft.text.Text; import net.minecraft.util.Pair; +/** + * Service to keep track of powder. + */ public class PowderService { private static final Map> powderTimeouts = new HashMap<>(); diff --git a/src/main/java/codes/cookies/mod/translations/TranslationKeys.java b/src/main/java/codes/cookies/mod/translations/TranslationKeys.java index b346420d..e302120d 100644 --- a/src/main/java/codes/cookies/mod/translations/TranslationKeys.java +++ b/src/main/java/codes/cookies/mod/translations/TranslationKeys.java @@ -2,6 +2,9 @@ import org.jetbrains.annotations.NotNull; +/** + * A list of all translation keys used in the mod. + */ public interface TranslationKeys { String MOD = "cookies"; diff --git a/src/main/java/codes/cookies/mod/utils/ColorUtils.java b/src/main/java/codes/cookies/mod/utils/ColorUtils.java index 56abc0ab..15b1cc69 100644 --- a/src/main/java/codes/cookies/mod/utils/ColorUtils.java +++ b/src/main/java/codes/cookies/mod/utils/ColorUtils.java @@ -104,6 +104,10 @@ public static MutableText literalWithGradient(@NotNull String text, int startCol return gradient; } + /** + * + * Returns a text with a gradient that is going through all the provided colors. + */ public static MutableText literalWithGradient(String prefix, int... values) { int amountPerValue = (int) Math.ceil(prefix.length() / ((float)values.length)); diff --git a/src/main/java/codes/cookies/mod/utils/Either.java b/src/main/java/codes/cookies/mod/utils/Either.java index ae3fac0b..3178c752 100644 --- a/src/main/java/codes/cookies/mod/utils/Either.java +++ b/src/main/java/codes/cookies/mod/utils/Either.java @@ -2,21 +2,61 @@ import java.util.Optional; +/** + * Utility to represent a return value that can be either on or another thing. + * @param First type. + * @param Second type. + */ public interface Either { + /** + * @return Whether it's the left element. + */ boolean isLeft(); + + /** + * @return Whether it's the right element. + */ boolean isRight(); + + /** + * @return The left element. + */ Optional getLeft(); + + /** + * @return The right element. + */ Optional getRight(); + /** + * Creates an instance with the left element being present. + * @param a The value. + * @return The instance. + * @param The left type. + * @param The right type. + */ static Either left(A a) { return new Left<>(a); } + /** + * Creates an instance with the right element being present. + * @param b The value. + * @return The instance. + * @param The left type. + * @param The right type. + */ static Either right(B b) { return new Right<>(b); } + /** + * Implementation for the right side. + * @param b The value. + * @param The left type. + * @param The right type. + */ record Right(B b) implements Either { @Override @@ -40,6 +80,12 @@ public Optional getRight() { } } + /** + * Implementation for the left side. + * @param a The value. + * @param The left type. + * @param The right type. + */ record Left(A a) implements Either { @Override public boolean isLeft() { diff --git a/src/main/java/codes/cookies/mod/utils/RenderUtils.java b/src/main/java/codes/cookies/mod/utils/RenderUtils.java index de5d0b0e..224537e2 100644 --- a/src/main/java/codes/cookies/mod/utils/RenderUtils.java +++ b/src/main/java/codes/cookies/mod/utils/RenderUtils.java @@ -41,6 +41,15 @@ static void renderBox( drawContext.fill(x + 1, y + 1, x + width - 1, y + height - 1, 0xFF8B8B8B); } + /** + * Draws a minecraft like background texture. + * @param drawContext The context to use. + * @param x The x location. + * @param y The y location. + * @param width The width of the box. + * @param height The height of the box. + * @param color The color to use for the box. + */ static void renderBackgroundBox(final DrawContext drawContext, int x, int y, int width, int height, int color) { drawContext.drawTexture(RenderLayer::getGuiTextured, BACKGROUND_TEXTURE, x, y, 0, 0, 4, 4, 4, 4, 12, 12, color); drawContext.drawTexture(RenderLayer::getGuiTextured, BACKGROUND_TEXTURE, x + 4, y, 4, 0, width - 8, 4, 4, 4, 12, 12, color); @@ -222,20 +231,40 @@ static void renderTextInWorld( matrixStack.pop(); } - + /** + * Draws the slot background if highlighted. + * @param context The context. + * @param slotX The x coordinate of the slot. + * @param slotY The y coordinate of the slot. + */ static void drawSlotHighlightBack(DrawContext context, int slotX, int slotY) { context.drawGuiTexture(RenderLayer::getGuiTextured, HandledScreen.SLOT_HIGHLIGHT_BACK_TEXTURE, slotX - 4, slotY - 4, 24, 24); } + /** + * Draws the slot foreground if highlighted. + * @param context The context. + * @param slotX The x coordinate of the slot. + * @param slotY The y coordinate of the slot. + */ static void drawSlotHighlightFront(DrawContext context, int slotX, int slotY) { context.drawGuiTexture(RenderLayer::getGuiTexturedOverlay, HandledScreen.SLOT_HIGHLIGHT_FRONT_TEXTURE, slotX - 4, slotY - 4, 24, 24); } + /** + * Gets the interpolated position of the entity. + * @param entity The entity. + * @param tickDelta The delta. + * @return The interpolated position. + */ static Vec3d getInterpolated(Entity entity, double tickDelta) { return new Vec3d(MathHelper.lerp(tickDelta, entity.lastRenderX, entity.getX()), MathHelper.lerp(tickDelta, entity.lastRenderY, entity.getY()), MathHelper.lerp(tickDelta, entity.lastRenderZ, entity.getZ())); } + /** + * Seals the render utils. + */ final class Sealed implements RenderUtils {} } diff --git a/src/main/java/codes/cookies/mod/utils/Result.java b/src/main/java/codes/cookies/mod/utils/Result.java index b4a00eb8..3095c33e 100644 --- a/src/main/java/codes/cookies/mod/utils/Result.java +++ b/src/main/java/codes/cookies/mod/utils/Result.java @@ -6,9 +6,13 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +/** + * A result that can either be completed successfully or fail. + * @param The successful type. + * @param The error type. + */ public interface Result { - static Result success(@NotNull T value) { return new Success<>(value); } diff --git a/src/main/java/codes/cookies/mod/utils/accessors/ClickEventAccessor.java b/src/main/java/codes/cookies/mod/utils/accessors/ClickEventAccessor.java index e34a5982..58c2d71d 100644 --- a/src/main/java/codes/cookies/mod/utils/accessors/ClickEventAccessor.java +++ b/src/main/java/codes/cookies/mod/utils/accessors/ClickEventAccessor.java @@ -4,6 +4,9 @@ import java.util.Optional; +/** + * Allows to put runnables onto click events. + */ public interface ClickEventAccessor { static ClickEventAccessor get(ClickEvent clickEvent) { diff --git a/src/main/java/codes/cookies/mod/utils/accessors/GlowingEntityAccessor.java b/src/main/java/codes/cookies/mod/utils/accessors/GlowingEntityAccessor.java index 3d4d368c..5ba0a5dd 100644 --- a/src/main/java/codes/cookies/mod/utils/accessors/GlowingEntityAccessor.java +++ b/src/main/java/codes/cookies/mod/utils/accessors/GlowingEntityAccessor.java @@ -2,6 +2,9 @@ import net.minecraft.entity.Entity; +/** + * Allows for custom glowing colors and custom glow. + */ public interface GlowingEntityAccessor { static GlowingEntityAccessor toAccessor(Entity entity) { diff --git a/src/main/java/codes/cookies/mod/utils/accessors/HoverEventAccessor.java b/src/main/java/codes/cookies/mod/utils/accessors/HoverEventAccessor.java index 2fc0a635..948a107e 100644 --- a/src/main/java/codes/cookies/mod/utils/accessors/HoverEventAccessor.java +++ b/src/main/java/codes/cookies/mod/utils/accessors/HoverEventAccessor.java @@ -6,6 +6,9 @@ import net.minecraft.text.HoverEvent; import net.minecraft.text.Text; +/** + * Allows for custom text lists as hover event. + */ public interface HoverEventAccessor { static HoverEventAccessor get(HoverEvent clickEvent) { diff --git a/src/main/java/codes/cookies/mod/utils/accessors/PlayerEntityRenderStateAccessor.java b/src/main/java/codes/cookies/mod/utils/accessors/PlayerEntityRenderStateAccessor.java index 6f97f8fb..12aefd53 100644 --- a/src/main/java/codes/cookies/mod/utils/accessors/PlayerEntityRenderStateAccessor.java +++ b/src/main/java/codes/cookies/mod/utils/accessors/PlayerEntityRenderStateAccessor.java @@ -2,6 +2,9 @@ import net.minecraft.client.render.entity.state.PlayerEntityRenderState; +/** + * Allows to access the custom data for the player render state + */ public interface PlayerEntityRenderStateAccessor { static PlayerEntityRenderStateAccessor get(PlayerEntityRenderState state) { diff --git a/src/main/java/codes/cookies/mod/utils/accessors/TextRenderUtils.java b/src/main/java/codes/cookies/mod/utils/accessors/TextRenderUtils.java index 7ff48c3c..f6409dd9 100644 --- a/src/main/java/codes/cookies/mod/utils/accessors/TextRenderUtils.java +++ b/src/main/java/codes/cookies/mod/utils/accessors/TextRenderUtils.java @@ -7,14 +7,23 @@ public class TextRenderUtils { private static boolean shadowsDisabled = false; + /** + * Disables all shadows for text. + */ public static void disableShadows() { shadowsDisabled = true; } + /** + * Uses the default show behaviour. + */ public static void enableShadows() { shadowsDisabled = false; } + /** + * @return Whether shadows are disabled. + */ public static boolean hasShadowsDisabled() { return shadowsDisabled; } diff --git a/src/main/java/codes/cookies/mod/utils/compatibility/CompatibilityService.java b/src/main/java/codes/cookies/mod/utils/compatibility/CompatibilityService.java index bd2d1519..1d3731b7 100644 --- a/src/main/java/codes/cookies/mod/utils/compatibility/CompatibilityService.java +++ b/src/main/java/codes/cookies/mod/utils/compatibility/CompatibilityService.java @@ -13,6 +13,9 @@ import net.fabricmc.loader.api.FabricLoader; +/** + * Service to allow for workarounds and compatibility with certain mods. + */ @Slf4j public class CompatibilityService { diff --git a/src/main/java/codes/cookies/mod/utils/compatibility/legendarytooltips/LegendaryTooltips.java b/src/main/java/codes/cookies/mod/utils/compatibility/legendarytooltips/LegendaryTooltips.java index 66bdf471..fae425e8 100644 --- a/src/main/java/codes/cookies/mod/utils/compatibility/legendarytooltips/LegendaryTooltips.java +++ b/src/main/java/codes/cookies/mod/utils/compatibility/legendarytooltips/LegendaryTooltips.java @@ -7,6 +7,9 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; +/** + * Compatibility interface for legendary tooltips. + */ @Requires("legendarytooltips") public interface LegendaryTooltips { diff --git a/src/main/java/codes/cookies/mod/utils/compatibility/legendarytooltips/LegendaryTooltipsImpl.java b/src/main/java/codes/cookies/mod/utils/compatibility/legendarytooltips/LegendaryTooltipsImpl.java index 01273cf9..50cd68c1 100644 --- a/src/main/java/codes/cookies/mod/utils/compatibility/legendarytooltips/LegendaryTooltipsImpl.java +++ b/src/main/java/codes/cookies/mod/utils/compatibility/legendarytooltips/LegendaryTooltipsImpl.java @@ -13,6 +13,9 @@ import net.minecraft.screen.slot.Slot; import net.minecraft.text.Text; +/** + * Implementation of the compatibility methods for legendary tooltips. + */ public class LegendaryTooltipsImpl implements LegendaryTooltips { Slot focused = null; diff --git a/src/main/java/codes/cookies/mod/utils/compatibility/system/CompatabilityMethod.java b/src/main/java/codes/cookies/mod/utils/compatibility/system/CompatabilityMethod.java index b393548e..e4736abb 100644 --- a/src/main/java/codes/cookies/mod/utils/compatibility/system/CompatabilityMethod.java +++ b/src/main/java/codes/cookies/mod/utils/compatibility/system/CompatabilityMethod.java @@ -5,6 +5,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Used to mark a method as compatibility method which causes it to not be called in the proxy instance. + */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface CompatabilityMethod {} diff --git a/src/main/java/codes/cookies/mod/utils/compatibility/system/Requires.java b/src/main/java/codes/cookies/mod/utils/compatibility/system/Requires.java index b2cb1786..699e5c03 100644 --- a/src/main/java/codes/cookies/mod/utils/compatibility/system/Requires.java +++ b/src/main/java/codes/cookies/mod/utils/compatibility/system/Requires.java @@ -5,10 +5,16 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * Used to annotate that the compatibility instance should be loaded if the condition is met. + */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface Requires { + /** + * @return The mod id that has to be present for the instance to be loaded. + */ String value(); } diff --git a/src/main/java/codes/cookies/mod/utils/cookies/Constants.java b/src/main/java/codes/cookies/mod/utils/cookies/Constants.java index 2f3bbf1d..3be11ecc 100644 --- a/src/main/java/codes/cookies/mod/utils/cookies/Constants.java +++ b/src/main/java/codes/cookies/mod/utils/cookies/Constants.java @@ -8,6 +8,9 @@ public interface Constants { * The prefix that is appended before mod messages. */ String PREFIX = "Cookies Mod ⋙ "; + /** + * Secondary prefix, will mostly be used during april fools. + */ String SECONDARY_PREFIX = "【Cookies Mod】"; /** * The main color that is used. @@ -66,6 +69,9 @@ interface Emojis { * Emoji to indicate a repetition. */ String REPEAT_ARROW = "\uD83D\uDD01"; + /** + * Emoji to indicate a move action. + */ String MOVE = "✥"; } diff --git a/src/main/java/codes/cookies/mod/utils/cookies/CookiesUtils.java b/src/main/java/codes/cookies/mod/utils/cookies/CookiesUtils.java index 8038ce0c..f4175ea1 100644 --- a/src/main/java/codes/cookies/mod/utils/cookies/CookiesUtils.java +++ b/src/main/java/codes/cookies/mod/utils/cookies/CookiesUtils.java @@ -191,10 +191,20 @@ public static boolean match(String string, String search) { }; } + /** + * Maps from 3d space to the 2d xz space. + * @param vec3d The initial vector. + * @return The vectors (x, z) components. + */ public static Vector2i mapToXZ(Vec3d vec3d) { return new Vector2i((int) vec3d.x, (int) vec3d.z); } + /** + * Strips the color from the input. + * @param input The input. + * @return The input without color codes, or null if the input is null. + */ public static String stripColor(String input) { if (input == null) { return null; @@ -203,10 +213,15 @@ public static String stripColor(String input) { return input.replaceAll("§[0-9a-fklmnor]", ""); } - public static String formattedMs(long time) { + /** + * Formats time in days, hours, minutes, seconds and milliseconds. + * @param timerInMilliseconds The time to format. + * @return The formatted time. + */ + public static String formattedMs(long timerInMilliseconds) { StringBuilder stringBuilder = new StringBuilder(); - long milliSeconds = time % 1000; - long secondsRemaining = time / 1000; + long milliSeconds = timerInMilliseconds % 1000; + long secondsRemaining = timerInMilliseconds / 1000; long seconds = secondsRemaining % 60; long minutesRemaining = secondsRemaining / 60; long minutes = minutesRemaining % 60; @@ -233,6 +248,9 @@ public static String formattedMs(long time) { return stringBuilder.toString().trim(); } + /** + * Sends a command as the player. + */ public static void sendCommand(String command) { Optional.ofNullable(MinecraftClient.getInstance().player) .ifPresent(player -> player.networkHandler.sendCommand(command)); diff --git a/src/main/java/codes/cookies/mod/utils/cookies/PauseableTime.java b/src/main/java/codes/cookies/mod/utils/cookies/PauseableTime.java index 60c30649..134d6b5f 100644 --- a/src/main/java/codes/cookies/mod/utils/cookies/PauseableTime.java +++ b/src/main/java/codes/cookies/mod/utils/cookies/PauseableTime.java @@ -1,5 +1,8 @@ package codes.cookies.mod.utils.cookies; +/** + * Represents a timer that can be paused. + */ public class PauseableTime { private final long startedAt; private long pausedAt; @@ -13,6 +16,9 @@ public PauseableTime(boolean start) { } } + /** + * Unpauses the time if paused, else do nothing. + */ public void unpause() { if (this.pausedAt == -1) { return; @@ -21,6 +27,9 @@ public void unpause() { this.pausedAt = -1; } + /** + * Pauses the timer, if it isn't already paused. + */ public void pause() { if (this.isPaused()) { return; @@ -28,6 +37,9 @@ public void pause() { this.pausedAt = System.currentTimeMillis(); } + /** + * @return The time the timer was active for in total. + */ public long getTimePassed() { if (this.pausedAt == -1) { return System.currentTimeMillis() - (this.startedAt + this.pausedFor); @@ -35,6 +47,9 @@ public long getTimePassed() { return this.pausedAt - (this.startedAt + this.pausedFor); } + /** + * @return Whether the timer currently is paused. + */ public boolean isPaused() { return this.pausedAt != -1; } diff --git a/src/main/java/codes/cookies/mod/utils/dev/DevInventoryUtils.java b/src/main/java/codes/cookies/mod/utils/dev/DevInventoryUtils.java index 8079b48d..3939fc0a 100644 --- a/src/main/java/codes/cookies/mod/utils/dev/DevInventoryUtils.java +++ b/src/main/java/codes/cookies/mod/utils/dev/DevInventoryUtils.java @@ -99,6 +99,7 @@ protected void init() { * @param handledScreen The inventory to save. * @param The type of the inventory. * @return The path it was saved to. + * @throws IOException May be caused by saving. */ public static Path saveInventory(HandledScreen handledScreen) throws IOException { if (!Files.exists(saved)) { diff --git a/src/main/java/codes/cookies/mod/utils/dev/DevUtils.java b/src/main/java/codes/cookies/mod/utils/dev/DevUtils.java index 8c2cbb52..ba3e957c 100644 --- a/src/main/java/codes/cookies/mod/utils/dev/DevUtils.java +++ b/src/main/java/codes/cookies/mod/utils/dev/DevUtils.java @@ -55,6 +55,12 @@ public static boolean isEnabled(final Identifier identifier) { return enabledTools.contains(identifier); } + /** + * Whether a dev tool is disabled. + * + * @param identifier The tool to check. + * @return Whether it is disabled. + */ public static boolean isDisabled(final Identifier identifier) { return !isEnabled(identifier); } diff --git a/src/main/java/codes/cookies/mod/utils/injections/DrawContextInjections.java b/src/main/java/codes/cookies/mod/utils/injections/DrawContextInjections.java index 982c9acb..4dd3e561 100644 --- a/src/main/java/codes/cookies/mod/utils/injections/DrawContextInjections.java +++ b/src/main/java/codes/cookies/mod/utils/injections/DrawContextInjections.java @@ -5,12 +5,27 @@ import java.util.function.Consumer; +/** + * Custom methods for the draw context, mainly just for convenience. + */ public interface DrawContextInjections { + /** + * Pushes and pops the matrix just before and right after consumer execution. + * @param consumer The consumer to execute. + */ default void cm$withMatrix(Consumer consumer) { // implemented in mixin } + /** + * Renders a centered text at the provided location. + * @param text The text to render. + * @param centerX The center position of the text. + * @param y The y position. + * @param color The color to render the text in. + * @param shadow Whether the text has a shadow or not. + */ default void cm$drawCenteredText(Text text, int centerX, int y, int color, boolean shadow) { // implemented in mixin } diff --git a/src/main/java/codes/cookies/mod/utils/items/AbsoluteTooltipPositioner.java b/src/main/java/codes/cookies/mod/utils/items/AbsoluteTooltipPositioner.java index f6040f22..60d3c56b 100644 --- a/src/main/java/codes/cookies/mod/utils/items/AbsoluteTooltipPositioner.java +++ b/src/main/java/codes/cookies/mod/utils/items/AbsoluteTooltipPositioner.java @@ -8,6 +8,9 @@ * TooltipPositioner without any restrictions on width and height. */ public class AbsoluteTooltipPositioner implements TooltipPositioner { + /** + * Static instance of the tooltip positioner. + */ public static final AbsoluteTooltipPositioner INSTANCE = new AbsoluteTooltipPositioner(); @Override public Vector2ic getPosition(int screenWidth, int screenHeight, int x, int y, int width, int height) { diff --git a/src/main/java/codes/cookies/mod/utils/items/PetInfo.java b/src/main/java/codes/cookies/mod/utils/items/PetInfo.java index e7178cb5..73787522 100644 --- a/src/main/java/codes/cookies/mod/utils/items/PetInfo.java +++ b/src/main/java/codes/cookies/mod/utils/items/PetInfo.java @@ -7,6 +7,17 @@ import com.google.gson.JsonParser; import lombok.Builder; +/** + * Info about a pet. + * @param type The type of the pet. + * @param active Whether it is active. + * @param exp The exp on the pet. + * @param tier The tier of the pet. + * @param hideInfo Whether the pet is hidden. + * @param candyUsed How many candies have been used on the pet. + * @param hideRightClick Whether right click should be hidden. + * @param noMove Whether the pet is marked as no move. + */ @Builder public record PetInfo(String type, boolean active, double exp, RepositoryItem.Tier tier, boolean hideInfo, int candyUsed, boolean hideRightClick, boolean noMove) { diff --git a/src/main/java/codes/cookies/mod/utils/items/ScrollableTooltipHandler.java b/src/main/java/codes/cookies/mod/utils/items/ScrollableTooltipHandler.java index 0e1a80b4..f443282b 100644 --- a/src/main/java/codes/cookies/mod/utils/items/ScrollableTooltipHandler.java +++ b/src/main/java/codes/cookies/mod/utils/items/ScrollableTooltipHandler.java @@ -9,6 +9,9 @@ import net.minecraft.component.ComponentType; import net.minecraft.item.ItemStack; +/** + * Handles the tooltip displacement. + */ public interface ScrollableTooltipHandler { static void scroll(ItemStack stack, double horizontalAmount, double verticalAmount) { diff --git a/src/main/java/codes/cookies/mod/utils/maths/MathUtils.java b/src/main/java/codes/cookies/mod/utils/maths/MathUtils.java index 39ed38e0..ca90f484 100644 --- a/src/main/java/codes/cookies/mod/utils/maths/MathUtils.java +++ b/src/main/java/codes/cookies/mod/utils/maths/MathUtils.java @@ -48,6 +48,13 @@ public static int clamp(int value, int min, int max) { return Math.max(min, Math.min(max, value)); } + /** + * Calculates the distance between a point and a line. + * @param point The point. + * @param from The starting position of the line. + * @param to The end position of the line. + * @return The closest distance. + */ public static double distance(Vec3d point, Vec3d from, Vec3d to) { return Intersectiond.distancePointLine(point.x, point.y, point.z, from.x, from.y, from.z, to.x, to.y, to.z); } diff --git a/src/main/java/codes/cookies/mod/utils/maths/SigmoidInterpolatedInteger.java b/src/main/java/codes/cookies/mod/utils/maths/SigmoidInterpolatedInteger.java index f5f7a881..bccbab3a 100644 --- a/src/main/java/codes/cookies/mod/utils/maths/SigmoidInterpolatedInteger.java +++ b/src/main/java/codes/cookies/mod/utils/maths/SigmoidInterpolatedInteger.java @@ -1,5 +1,8 @@ package codes.cookies.mod.utils.maths; +/** + * Interpolated integer that follows a sigmoid function. + */ public final class SigmoidInterpolatedInteger extends InterpolatedInteger { /** diff --git a/src/main/java/codes/cookies/mod/utils/minecraft/TextBuilder.java b/src/main/java/codes/cookies/mod/utils/minecraft/TextBuilder.java index 7739cc14..c5921958 100644 --- a/src/main/java/codes/cookies/mod/utils/minecraft/TextBuilder.java +++ b/src/main/java/codes/cookies/mod/utils/minecraft/TextBuilder.java @@ -13,20 +13,36 @@ import net.minecraft.text.Text; import net.minecraft.util.Formatting; +/** + * Builder for (custom) text. + */ public class TextBuilder { private final MutableText text; private Style style; + /** + * Creates a new builder based on the string. + * @param text The string. + */ public TextBuilder(String text) { this(Text.literal(text)); } + /** + * Creates a new builder base on the text. + * @param text The text. + */ public TextBuilder(Text text) { this.text = text.copy(); this.style = text.getStyle(); } + /** + * Sets the runnable as click event for the text. + * @param runnable The runnable to use. + * @return The builder. + */ public TextBuilder setRunnable(Runnable runnable) { final ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, ":C"); ClickEventAccessor.setRunnable(clickEvent, runnable); @@ -34,16 +50,31 @@ public TextBuilder setRunnable(Runnable runnable) { return this; } + /** + * Appends text to the builder. + * @param text The text to append. + * @return The builder. + */ public TextBuilder append(Text text) { this.text.append(text); return this; } + /** + * Appends a string to the builder. + * @param text The string to append. + * @return The builder. + */ public TextBuilder append(String text) { this.text.append(text); return this; } + /** + * Sets a list of text as hover event. + * @param event The list. + * @return The builder. + */ public TextBuilder onHover(List event) { final HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal(":c")); HoverEventAccessor.setText(hoverEvent, event); @@ -51,16 +82,30 @@ public TextBuilder onHover(List event) { return this; } + /** + * Adds a text hover event to the builder. + * @param event The text. + * @return The builder. + */ public TextBuilder onHover(Text event) { this.style = this.style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, event)); return this; } + /** + * Formats the builder with the formatting. + * @param formatting The formatting to use. + * @return The builder. + */ public TextBuilder formatted(Formatting... formatting) { this.style = this.style.withFormatting(formatting); return this; } + /** + * Builds the builder to a mutable text. + * @return The text. + */ public MutableText build() { this.text.setStyle(this.style); return text; diff --git a/src/main/java/codes/cookies/mod/utils/mixins/DrawContextMixin.java b/src/main/java/codes/cookies/mod/utils/mixins/DrawContextMixin.java index 004c2a30..cf175cb5 100644 --- a/src/main/java/codes/cookies/mod/utils/mixins/DrawContextMixin.java +++ b/src/main/java/codes/cookies/mod/utils/mixins/DrawContextMixin.java @@ -11,6 +11,9 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; +/** + * Extends the draw context with some custom functionality. + */ @Mixin(DrawContext.class) public class DrawContextMixin { diff --git a/src/main/java/codes/cookies/mod/utils/mixins/EntityMixin.java b/src/main/java/codes/cookies/mod/utils/mixins/EntityMixin.java index cf1986e9..c5043b77 100644 --- a/src/main/java/codes/cookies/mod/utils/mixins/EntityMixin.java +++ b/src/main/java/codes/cookies/mod/utils/mixins/EntityMixin.java @@ -10,6 +10,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +/** + * Implements custom glowing. + */ @Mixin(Entity.class) public class EntityMixin implements GlowingEntityAccessor { diff --git a/src/main/java/codes/cookies/mod/utils/mixins/HoverEventMixin.java b/src/main/java/codes/cookies/mod/utils/mixins/HoverEventMixin.java index 32a16a45..9ed59bab 100644 --- a/src/main/java/codes/cookies/mod/utils/mixins/HoverEventMixin.java +++ b/src/main/java/codes/cookies/mod/utils/mixins/HoverEventMixin.java @@ -11,6 +11,9 @@ import java.util.List; +/** + * Implements the custom hover event list. + */ @Mixin(HoverEvent.class) public class HoverEventMixin implements HoverEventAccessor { diff --git a/src/main/java/codes/cookies/mod/utils/mixins/ItemPacketCodecMixin.java b/src/main/java/codes/cookies/mod/utils/mixins/ItemPacketCodecMixin.java index 4d34888d..037e4ce7 100644 --- a/src/main/java/codes/cookies/mod/utils/mixins/ItemPacketCodecMixin.java +++ b/src/main/java/codes/cookies/mod/utils/mixins/ItemPacketCodecMixin.java @@ -7,6 +7,9 @@ import net.minecraft.item.ItemStack; +/** + * Prevents replacement items to slip through to hypixel. + */ @Mixin(targets = "net.minecraft.item.ItemStack$1") public class ItemPacketCodecMixin { diff --git a/src/main/java/codes/cookies/mod/utils/mixins/PingMeasurerMixin.java b/src/main/java/codes/cookies/mod/utils/mixins/PingMeasurerMixin.java index ef99b390..204b9244 100644 --- a/src/main/java/codes/cookies/mod/utils/mixins/PingMeasurerMixin.java +++ b/src/main/java/codes/cookies/mod/utils/mixins/PingMeasurerMixin.java @@ -9,6 +9,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +/** + * Saves the last received ping. + */ @Mixin(PingMeasurer.class) public class PingMeasurerMixin { diff --git a/src/main/java/codes/cookies/mod/utils/mixins/PlayerEntityRenderMixin.java b/src/main/java/codes/cookies/mod/utils/mixins/PlayerEntityRenderMixin.java index 1c71c256..5097c4ce 100644 --- a/src/main/java/codes/cookies/mod/utils/mixins/PlayerEntityRenderMixin.java +++ b/src/main/java/codes/cookies/mod/utils/mixins/PlayerEntityRenderMixin.java @@ -14,6 +14,9 @@ import net.minecraft.client.render.entity.PlayerEntityRenderer; import net.minecraft.client.render.entity.state.PlayerEntityRenderState; +/** + * Adds a self reference to the player entity render state. + */ @Mixin(PlayerEntityRenderer.class) public class PlayerEntityRenderMixin { diff --git a/src/main/java/codes/cookies/mod/utils/mixins/PlayerEntityRenderStateMixin.java b/src/main/java/codes/cookies/mod/utils/mixins/PlayerEntityRenderStateMixin.java index a3b359c3..55643c33 100644 --- a/src/main/java/codes/cookies/mod/utils/mixins/PlayerEntityRenderStateMixin.java +++ b/src/main/java/codes/cookies/mod/utils/mixins/PlayerEntityRenderStateMixin.java @@ -7,6 +7,9 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; +/** + * Implements the custom data for the player entity render state. + */ @Mixin(PlayerEntityRenderState.class) public class PlayerEntityRenderStateMixin implements PlayerEntityRenderStateAccessor { diff --git a/src/main/java/codes/cookies/mod/utils/skyblock/MayorUtils.java b/src/main/java/codes/cookies/mod/utils/skyblock/MayorUtils.java index c44bfd73..4245994a 100644 --- a/src/main/java/codes/cookies/mod/utils/skyblock/MayorUtils.java +++ b/src/main/java/codes/cookies/mod/utils/skyblock/MayorUtils.java @@ -19,6 +19,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * Utils to get current mayor data. + */ public class MayorUtils { private static final Set activePerks = new HashSet<>(); static Logger LOGGER = LoggerFactory.getLogger(MayorUtils.class); @@ -39,6 +42,9 @@ public static void load() { CookiesMod.getExecutorService().schedule(MayorUtils::update, delay, TimeUnit.SECONDS); } + /** + * Updates the cached data. + */ private static void update() { activePerks.clear(); mayor = null; @@ -71,6 +77,9 @@ private static void update() { } } + /** + * Builds the perk list. + */ private static void buildPerks() { for (Perk perk : mayor.perks) { addPerk(perk.name); @@ -78,29 +87,75 @@ private static void buildPerks() { addPerk(mayor.minister.name); } + /** + * Adds a perk to the active list. + * @param name The perk to add. + */ private static void addPerk(String name) { activePerks.add(name.replaceAll(" ", "_").replaceAll("[^\\w_]", "")); } + /** + * Checks if a mayor perk (id) is active. + * @param perkId The perk to check. + * @return Whether the perk is active. + */ public static boolean isPerkActive(String perkId) { return activePerks.contains(perkId); } + /** + * Model that represents the api response. + * @param success Whether the request had success. + * @param lastUpdated Last time the data was updates. + * @param mayor The current mayor. + * @param current The current election. + */ public record Response(boolean success, long lastUpdated, Mayor mayor, Current current) { } + /** + * Mayor model that is returned by the api. + * @param key The mayor id. + * @param name The name of the mayor. + * @param perks The active perks. + * @param minister The minister of the last election. + */ public record Mayor(String key, String name, Perk[] perks, Minister minister) { } + /** + * Current election model that is returned by the api. + * @param year The year the election is for. + * @param candidates The candidates present in the election. + */ public record Current(int year, Candidate[] candidates) { } + /** + * Minister model that is returned by the api. + * @param key The id of the minister. + * @param name The name of the minister. + * @param perk Their minister perk. + */ public record Minister(String key, String name, Perk perk) { } + /** + * Candidate model that is returned by the api. + * @param key The id of the candidate. + * @param name The name of the candidate. + * @param perks Their perks. + */ public record Candidate(String key, String name, Perk[] perks) { } + /** + * Perk model that is returned by the api. + * @param name The name of the perk. + * @param description The description of the perk. + * @param minister Whether it would be the minister perk. + */ public record Perk(String name, String description, boolean minister) { } } diff --git a/src/main/java/codes/cookies/mod/utils/skyblock/SkyblockDateTime.java b/src/main/java/codes/cookies/mod/utils/skyblock/SkyblockDateTime.java index 95ceae2f..42729f96 100644 --- a/src/main/java/codes/cookies/mod/utils/skyblock/SkyblockDateTime.java +++ b/src/main/java/codes/cookies/mod/utils/skyblock/SkyblockDateTime.java @@ -5,25 +5,36 @@ import java.time.Duration; import java.time.Instant; +/** + * Utility class to work with skyblock time. + */ @Getter public class SkyblockDateTime { + /** + * Creates the skyblock time of a real world instant. + * @param instant The instant. + */ public SkyblockDateTime(Instant instant) { this.instant = instant; this.skyblockInstant = this.instant.minus(Duration.ofSeconds(SKYBLOCK_EPOCH.getEpochSecond())); } + /** + * Creates the skyblock time based on a skyblock instant. + * @param instant The skyblock isntant. + * @return The skyblock time. + */ public static SkyblockDateTime ofSkyblockInstant(Instant instant) { return new SkyblockDateTime(instant.plus(Duration.ofSeconds(SKYBLOCK_EPOCH.getEpochSecond()))); } + /** + * @return The current skyblock time. + */ public static SkyblockDateTime now() { return new SkyblockDateTime(Instant.now()); } - public static SkyblockDateTime ofEpochSecond(long second) { - return new SkyblockDateTime(Instant.ofEpochSecond(second)); - } - private final static Instant SKYBLOCK_EPOCH = Instant.ofEpochMilli(1_560_275_700_000L); private final Instant instant; @@ -152,6 +163,11 @@ private SkyblockDateTime with(int minute, int hour, int day, int month, int year return SkyblockDateTime.ofSkyblockInstant(Instant.ofEpochMilli((long) ((minute * 0.83 + hour * SB_HOUR + day * SB_DAY + month * SB_MONTH + year * SB_YEAR) * 1000))); } + /** + * Checks whether a provided even is currently active. + * @param events The event to check. + * @return Whether it is active. + */ public boolean isActive(SkyblockEvents events) { return switch (events) { case FARMING_CONTEST -> (getElapsedSkyblockDays() % 3) == 1; @@ -173,6 +189,11 @@ public boolean isActive(SkyblockEvents events) { }; } + /** + * Gets the next skyblock time the provided event starts at. + * @param skyblockEvents The event. + * @return The time it happens at. + */ public SkyblockDateTime getNext(SkyblockEvents skyblockEvents) { return switch (skyblockEvents) { case FARMING_CONTEST -> this.with( @@ -262,6 +283,9 @@ public SkyblockDateTime getNext(SkyblockEvents skyblockEvents) { }; } + /** + * A list of all (supported) skyblock events. + */ public enum SkyblockEvents { FARMING_CONTEST, TRAVELING_ZOO, @@ -275,6 +299,6 @@ public enum SkyblockEvents { WINTER_ISLAND, DARK_AUCTION, NEW_YEAR, - STAR_CULT; + STAR_CULT } } diff --git a/src/main/java/codes/cookies/mod/utils/skyblock/components/PressableField.java b/src/main/java/codes/cookies/mod/utils/skyblock/components/PressableField.java index c512c42b..c08b07e1 100644 --- a/src/main/java/codes/cookies/mod/utils/skyblock/components/PressableField.java +++ b/src/main/java/codes/cookies/mod/utils/skyblock/components/PressableField.java @@ -8,6 +8,9 @@ import net.minecraft.client.gui.widget.PressableWidget; import net.minecraft.text.Text; +/** + * A pressable field widget. + */ @Setter @Getter public class PressableField extends PressableWidget { diff --git a/src/main/java/codes/cookies/mod/utils/skyblock/inventories/ClientSideInventory.java b/src/main/java/codes/cookies/mod/utils/skyblock/inventories/ClientSideInventory.java index 0a40d1be..174bb508 100644 --- a/src/main/java/codes/cookies/mod/utils/skyblock/inventories/ClientSideInventory.java +++ b/src/main/java/codes/cookies/mod/utils/skyblock/inventories/ClientSideInventory.java @@ -73,6 +73,9 @@ public ClientSideInventory(Text title, int rows) { this.inventoryContents = new InventoryContents(this.rows, this); } + /** + * Initializes pagination with the provided values. + */ public void initPagination(List items, Position from, Position to, List first) { this.pagination = new Pagination(items, from, to, first); } @@ -258,6 +261,9 @@ private void executeClick(Slot slot, int button) { } } + /** + * Sets the slot to the provided item. + */ public void setSlot(int row, int column, ItemStack itemStack) { this.slots[row * 9 + column].itemStack = Objects.requireNonNullElse(itemStack, ItemStack.EMPTY); }