Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
Add More Cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
gmitch215 committed Nov 6, 2023
1 parent 20bb9b0 commit 1b459cf
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -51,30 +46,6 @@ public HatSelection(String name, AnimatedHatData data, CompletionCriteria criter
this.name = name;
}

public static AnimatedHatData of(long interval, Iterable<ItemStack> 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<Material> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -11,6 +12,7 @@

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
Expand All @@ -29,6 +31,30 @@ private AnimatedHatData(List<Map.Entry<Long, ItemStack>> frames) {
this.started = false;
}

public static AnimatedHatData of(long interval, Iterable<ItemStack> 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<Material> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -58,7 +59,7 @@ final class CosmeticSelections1_12 implements CosmeticSelections {
// Animated Hats

private static final List<CosmeticSelection<?>> ANIMATED_HATS = ImmutableList.<CosmeticSelection<?>>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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -206,14 +216,14 @@ final class CosmeticSelections1_13 implements CosmeticSelections {
// Animated Hats

private static final List<CosmeticSelection<?>> ANIMATED_HATS = ImmutableList.<CosmeticSelection<?>>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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -161,12 +162,12 @@ final class CosmeticSelections1_17 implements CosmeticSelections {
// Animated Hats

private static final List<CosmeticSelection<?>> ANIMATED_HATS = ImmutableList.<CosmeticSelection<?>>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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
Expand All @@ -128,6 +133,16 @@ final class CosmeticSelections1_19 implements CosmeticSelections {

.build();

// Animated Hats

private static final List<CosmeticSelection<?>> ANIMATED_HATS = ImmutableList.<CosmeticSelection<?>>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<Cosmetic, List<CosmeticSelection<?>>> SELECTIONS = ImmutableMap.<Cosmetic, List<CosmeticSelection<?>>>builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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
Expand Down Expand Up @@ -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),
Expand All @@ -90,7 +99,7 @@ private static ItemStack decoratedPot(Material... materials) {
// Animated Hats

private static final List<CosmeticSelection<?>> ANIMATED_HATS = ImmutableList.<CosmeticSelection<?>>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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 {

Expand Down

0 comments on commit 1b459cf

Please sign in to comment.