diff --git a/abstraction/src/main/java/me/gamercoder215/starcosmetics/util/selection/HatSelection.java b/abstraction/src/main/java/me/gamercoder215/starcosmetics/util/selection/HatSelection.java index ecb604a8..1540f3fb 100644 --- a/abstraction/src/main/java/me/gamercoder215/starcosmetics/util/selection/HatSelection.java +++ b/abstraction/src/main/java/me/gamercoder215/starcosmetics/util/selection/HatSelection.java @@ -15,11 +15,6 @@ import org.bukkit.inventory.meta.SkullMeta; import org.jetbrains.annotations.NotNull; -import java.util.Arrays; -import java.util.Collection; -import java.util.Objects; -import java.util.stream.Collectors; - import static me.gamercoder215.starcosmetics.util.inventory.StarInventoryUtil.itemBuilder; import static me.gamercoder215.starcosmetics.wrapper.Wrapper.get; import static me.gamercoder215.starcosmetics.wrapper.Wrapper.getWithArgs; @@ -51,30 +46,6 @@ public HatSelection(String name, AnimatedHatData data, CompletionCriteria criter this.name = name; } - public static AnimatedHatData of(long interval, Iterable frames) { - AnimatedHatData.Builder builder = AnimatedHatData.builder(); - for (ItemStack item : frames) - builder.addFrame(interval, item); - - return builder.build(); - } - - public static AnimatedHatData of(long interval, ItemStack... frames) { - return of(interval, Arrays.asList(frames)); - } - - public static AnimatedHatData of(long interval, Collection frames) { - return of(interval, frames.stream() - .filter(Objects::nonNull) - .map(ItemStack::new) - .collect(Collectors.toList()) - ); - } - - public static AnimatedHatData of(long interval, Material... frames) { - return of(interval, Arrays.asList(frames)); - } - @Override public @NotNull String getKey() { return name; diff --git a/api/src/main/java/me/gamercoder215/starcosmetics/api/cosmetics/hat/AnimatedHatData.java b/api/src/main/java/me/gamercoder215/starcosmetics/api/cosmetics/hat/AnimatedHatData.java index 20c736f8..21cf61d7 100644 --- a/api/src/main/java/me/gamercoder215/starcosmetics/api/cosmetics/hat/AnimatedHatData.java +++ b/api/src/main/java/me/gamercoder215/starcosmetics/api/cosmetics/hat/AnimatedHatData.java @@ -3,6 +3,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import me.gamercoder215.starcosmetics.api.StarConfig; +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; @@ -11,6 +12,7 @@ import java.util.*; import java.util.function.Function; +import java.util.stream.Collectors; import java.util.stream.Stream; /** @@ -29,6 +31,30 @@ private AnimatedHatData(List> frames) { this.started = false; } + public static AnimatedHatData of(long interval, Iterable frames) { + Builder builder = builder(); + for (ItemStack item : frames) + builder.addFrame(interval, item); + + return builder.build(); + } + + public static AnimatedHatData of(long interval, ItemStack... frames) { + return of(interval, Arrays.asList(frames)); + } + + public static AnimatedHatData of(long interval, Collection frames) { + return of(interval, frames.stream() + .filter(Objects::nonNull) + .map(ItemStack::new) + .collect(Collectors.toList()) + ); + } + + public static AnimatedHatData of(long interval, Material... frames) { + return of(interval, Arrays.asList(frames)); + } + /** * Fetches whether this Animated Hat has been started. * @return true if started, false otherwise diff --git a/nms/1_12_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_12.java b/nms/1_12_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_12.java index 9d26dad8..3f02690f 100644 --- a/nms/1_12_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_12.java +++ b/nms/1_12_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_12.java @@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap; import me.gamercoder215.starcosmetics.api.Rarity; import me.gamercoder215.starcosmetics.api.cosmetics.*; +import me.gamercoder215.starcosmetics.api.cosmetics.hat.AnimatedHatData; import me.gamercoder215.starcosmetics.util.StarAdvancement; import me.gamercoder215.starcosmetics.util.StarMaterial; import me.gamercoder215.starcosmetics.util.selection.CosmeticSelection; @@ -58,7 +59,7 @@ final class CosmeticSelections1_12 implements CosmeticSelections { // Animated Hats private static final List> ANIMATED_HATS = ImmutableList.>builder() - .add(new HatSelection("glazed_terracotta", HatSelection.of(20, + .add(new HatSelection("glazed_terracotta", AnimatedHatData.of(20, Material.RED_GLAZED_TERRACOTTA, Material.ORANGE_GLAZED_TERRACOTTA, Material.YELLOW_GLAZED_TERRACOTTA, Material.GREEN_GLAZED_TERRACOTTA, Material.CYAN_GLAZED_TERRACOTTA, Material.BLUE_GLAZED_TERRACOTTA, Material.MAGENTA_GLAZED_TERRACOTTA, Material.PURPLE_GLAZED_TERRACOTTA, Material.PINK_GLAZED_TERRACOTTA diff --git a/nms/1_13_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_13.java b/nms/1_13_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_13.java index 2d802c07..fc051574 100644 --- a/nms/1_13_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_13.java +++ b/nms/1_13_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_13.java @@ -6,15 +6,12 @@ import me.gamercoder215.starcosmetics.api.cosmetics.BaseGadget; import me.gamercoder215.starcosmetics.api.cosmetics.BaseShape; import me.gamercoder215.starcosmetics.api.cosmetics.Cosmetic; +import me.gamercoder215.starcosmetics.api.cosmetics.hat.AnimatedHatData; import me.gamercoder215.starcosmetics.api.cosmetics.pet.PetInfo; import me.gamercoder215.starcosmetics.api.cosmetics.pet.PetType; import me.gamercoder215.starcosmetics.util.StarMaterial; import me.gamercoder215.starcosmetics.util.StarSound; -import me.gamercoder215.starcosmetics.util.selection.CosmeticSelection; -import me.gamercoder215.starcosmetics.util.selection.GadgetSelection; -import me.gamercoder215.starcosmetics.util.selection.HatSelection; -import me.gamercoder215.starcosmetics.util.selection.ParticleSelection; -import me.gamercoder215.starcosmetics.util.selection.TrailSelection; +import me.gamercoder215.starcosmetics.util.selection.*; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.Statistic; @@ -193,6 +190,19 @@ final class CosmeticSelections1_13 implements CosmeticSelections { .add(new HatSelection("granite", Material.GRANITE, fromMined(45, Material.GRANITE), COMMON)) + .add(new HatSelection("oak_leaves", Material.OAK_LEAVES, + fromMined(65, Material.OAK_LEAVES), OCCASIONAL)) + .add(new HatSelection("birch_leaves", Material.BIRCH_LEAVES, + fromMined(65, Material.BIRCH_LEAVES), OCCASIONAL)) + .add(new HatSelection("spruce_leaves", Material.SPRUCE_LEAVES, + fromMined(65, Material.SPRUCE_LEAVES), OCCASIONAL)) + .add(new HatSelection("jungle_leaves", Material.JUNGLE_LEAVES, + fromMined(65, Material.JUNGLE_LEAVES), OCCASIONAL)) + .add(new HatSelection("acacia_leaves", Material.ACACIA_LEAVES, + fromMined(65, Material.ACACIA_LEAVES), OCCASIONAL)) + .add(new HatSelection("dark_oak_leaves", Material.DARK_OAK_LEAVES, + fromMined(65, Material.DARK_OAK_LEAVES), OCCASIONAL)) + .add(new HatSelection("dried_kelp_block", Material.DRIED_KELP_BLOCK, fromMined(250, Material.DRIED_KELP_BLOCK), UNCOMMON)) .add(new HatSelection("polished_andesite", Material.POLISHED_ANDESITE, @@ -206,14 +216,14 @@ final class CosmeticSelections1_13 implements CosmeticSelections { // Animated Hats private static final List> ANIMATED_HATS = ImmutableList.>builder() - .add(new HatSelection("minerals", HatSelection.of(10, + .add(new HatSelection("minerals", AnimatedHatData.of(10, Material.STONE, Material.ANDESITE, Material.GRANITE, Material.DIORITE), fromMined(1000, Material.STONE), UNCOMMON)) - .add(new HatSelection("wood_stairs", HatSelection.of(20, + .add(new HatSelection("wood_stairs", AnimatedHatData.of(20, Tag.WOODEN_STAIRS.getValues()), fromCrafted(10000, Material.OAK_PLANKS), EPIC)) - .add(new HatSelection("colored_glass", HatSelection.of(20, + .add(new HatSelection("colored_glass", AnimatedHatData.of(20, Material.GRAY_STAINED_GLASS, Material.WHITE_STAINED_GLASS, Material.RED_STAINED_GLASS, diff --git a/nms/1_17_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_17.java b/nms/1_17_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_17.java index 1fde9275..1660f9ba 100644 --- a/nms/1_17_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_17.java +++ b/nms/1_17_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_17.java @@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap; import me.gamercoder215.starcosmetics.api.Rarity; import me.gamercoder215.starcosmetics.api.cosmetics.*; +import me.gamercoder215.starcosmetics.api.cosmetics.hat.AnimatedHatData; import me.gamercoder215.starcosmetics.api.cosmetics.pet.PetInfo; import me.gamercoder215.starcosmetics.api.cosmetics.pet.PetType; import me.gamercoder215.starcosmetics.api.player.PlayerCompletion; @@ -161,12 +162,12 @@ final class CosmeticSelections1_17 implements CosmeticSelections { // Animated Hats private static final List> ANIMATED_HATS = ImmutableList.>builder() - .add(new HatSelection("deepslate_ores", HatSelection.of(20, + .add(new HatSelection("deepslate_ores", AnimatedHatData.of(20, Material.DEEPSLATE_COAL_ORE, Material.DEEPSLATE_COPPER_ORE, Material.DEEPSLATE_IRON_ORE, Material.DEEPSLATE_LAPIS_ORE, Material.DEEPSLATE_REDSTONE_ORE, Material.DEEPSLATE_GOLD_ORE, Material.DEEPSLATE_DIAMOND_ORE, Material.DEEPSLATE_EMERALD_ORE ), fromMined(400, Material.DEEPSLATE_COAL_ORE), Rarity.EPIC)) - .add(new HatSelection("animated_azalea", HatSelection.of(60, + .add(new HatSelection("animated_azalea", AnimatedHatData.of(60, Material.AZALEA, Material.FLOWERING_AZALEA ), fromMined(500, Material.AZALEA_LEAVES), Rarity.LEGENDARY)) .build(); diff --git a/nms/1_19_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_19.java b/nms/1_19_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_19.java index 26cf3d29..8d0413d7 100644 --- a/nms/1_19_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_19.java +++ b/nms/1_19_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_19.java @@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableMap; import me.gamercoder215.starcosmetics.api.Rarity; import me.gamercoder215.starcosmetics.api.cosmetics.*; +import me.gamercoder215.starcosmetics.api.cosmetics.hat.AnimatedHatData; import me.gamercoder215.starcosmetics.api.player.PlayerCompletion; import me.gamercoder215.starcosmetics.util.selection.CosmeticSelection; import me.gamercoder215.starcosmetics.util.selection.HatSelection; @@ -116,9 +117,13 @@ final class CosmeticSelections1_19 implements CosmeticSelections { .add(new HatSelection("packed_mud", Material.PACKED_MUD, fromMined(145, Material.MUD), Rarity.OCCASIONAL)) + .add(new HatSelection("mangrove_leaves", Material.MANGROVE_LEAVES, + fromMined(75, Material.MANGROVE_LEAVES), Rarity.OCCASIONAL)) .add(new HatSelection("sculk", Material.SCULK, fromMined(300, Material.SCULK), Rarity.UNCOMMON)) + .add(new HatSelection("mangrove_roots", Material.MANGROVE_ROOTS, + fromMined(110, Material.MANGROVE_ROOTS), Rarity.UNCOMMON)) .add(new HatSelection("mangrove_fence", Material.MANGROVE_FENCE, fromCrafted(250, Material.MANGROVE_FENCE), Rarity.RARE)) @@ -128,6 +133,16 @@ final class CosmeticSelections1_19 implements CosmeticSelections { .build(); + // Animated Hats + + private static final List> ANIMATED_HATS = ImmutableList.>builder() + .add(new HatSelection("froglight", AnimatedHatData.of(10, + Material.OCHRE_FROGLIGHT, + Material.VERDANT_FROGLIGHT, + Material.PEARLESCENT_FROGLIGHT + ), fromKilled(825, EntityType.MAGMA_CUBE), Rarity.EPIC)) + .build(); + // Selections private static final Map>> SELECTIONS = ImmutableMap.>>builder() diff --git a/nms/1_20_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_20.java b/nms/1_20_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_20.java index ad718147..c7b22db1 100644 --- a/nms/1_20_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_20.java +++ b/nms/1_20_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_20.java @@ -3,6 +3,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import me.gamercoder215.starcosmetics.api.cosmetics.*; +import me.gamercoder215.starcosmetics.api.cosmetics.hat.AnimatedHatData; import me.gamercoder215.starcosmetics.util.selection.CosmeticSelection; import me.gamercoder215.starcosmetics.util.selection.HatSelection; import me.gamercoder215.starcosmetics.util.selection.TrailSelection; @@ -11,6 +12,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -31,6 +33,10 @@ final class CosmeticSelections1_20 implements CosmeticSelections { .add(new TrailSelection("relic", BaseTrail.PROJECTILE_TRAIL, Material.MUSIC_DISC_RELIC, fromStatistic(Statistic.ANIMALS_BRED, 5500), EPIC)) + + .add(new TrailSelection("armor_trims", BaseTrail.PROJECTILE_TRAIL, + Arrays.stream(Material.values()).filter(m -> m.name().endsWith("_TRIM_SMITHING_TEMPLATE")).toList(), + fromCrafted(4780, Material.IRON_CHESTPLATE), LEGENDARY)) .build(); // Ground Trails @@ -64,6 +70,9 @@ private static ItemStack decoratedPot(Material... materials) { .add(new HatSelection("empty_pot", decoratedPot(Material.BRICK), fromStatistic(Statistic.TRADED_WITH_VILLAGER, 25), COMMON)) + .add(new HatSelection("cherry_leaves", Material.CHERRY_LEAVES, + fromMined(65, Material.CHERRY_LEAVES), OCCASIONAL)) + .add(new HatSelection("angler_pot", decoratedPot(Material.ANGLER_POTTERY_SHERD), fromCrafted(50, Material.DECORATED_POT), UNCOMMON)) .add(new HatSelection("heart_pot", decoratedPot(Material.HEART_POTTERY_SHERD), @@ -90,7 +99,7 @@ private static ItemStack decoratedPot(Material... materials) { // Animated Hats private static final List> ANIMATED_HATS = ImmutableList.>builder() - .add(new HatSelection("miner_pot_animated", HatSelection.of(20, + .add(new HatSelection("miner_pot_animated", AnimatedHatData.of(20, decoratedPot(Material.MINER_POTTERY_SHERD), decoratedPot(Material.PRIZE_POTTERY_SHERD) ), fromMined(15, Material.EMERALD_ORE), LEGENDARY)) .build(); diff --git a/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_9.java b/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_9.java index c126d176..64002a1c 100644 --- a/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_9.java +++ b/nms/1_9_R1/src/main/java/me/gamercoder215/starcosmetics/wrapper/cosmetics/CosmeticSelections1_9.java @@ -9,7 +9,10 @@ import me.gamercoder215.starcosmetics.util.StarSound; import me.gamercoder215.starcosmetics.util.selection.*; import org.bukkit.*; -import org.bukkit.entity.*; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Firework; +import org.bukkit.entity.LargeFireball; +import org.bukkit.entity.Snowball; import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.metadata.FixedMetadataValue; @@ -19,7 +22,7 @@ import static me.gamercoder215.starcosmetics.api.CompletionCriteria.*; import static me.gamercoder215.starcosmetics.api.Rarity.*; -import static me.gamercoder215.starcosmetics.util.selection.HatSelection.of; +import static me.gamercoder215.starcosmetics.api.cosmetics.hat.AnimatedHatData.of; final class CosmeticSelections1_9 implements CosmeticSelections {