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

Commit

Permalink
Update to v1.3.1 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory authored Dec 23, 2023
2 parents e202030 + 4e8f3fd commit f1005db
Show file tree
Hide file tree
Showing 59 changed files with 2,596 additions and 99 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ Featuring things from Projectile Trails, Particle Rings, Custom Structures, Pets

## 📓 Changelog

🪩 v1.3.1 - December 22, 2023
- Add 1.20.3+ Support & Cosmetics
- Fix Additional 1.20.2 Bugs
- Octagon Particle Shape
- More Gadgets & Particle Shape Options
- Improve Riptide-related Cosmetic Accuracy
- Other Optimizations

🕺 v1.3.0 - November 17, 2023 | "Astounding Animations"
- PlaceholderAPI & Other Dependency Updates
- Additional 1.20.2/Paper-related Fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static void emote(@NotNull StarPlayer sp, @NotNull Emote emote) {
stand.setChestplate(dyedArmor(Material.LEATHER_CHESTPLATE, color));
stand.setLeggings(dyedArmor(Material.LEATHER_LEGGINGS, color));
stand.setBoots(dyedArmor(Material.LEATHER_BOOTS, color));
stand.setItemInHand(p.getInventory().getItemInMainHand());

StarAnimator animator = new StarAnimator(emote, stand, p.getUniqueId());
animator.play(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ public final class BaseShape implements ParticleShape {
polygon(l, o, 5, 1.5, m);
});

// Octagons

public static final BaseShape OCTAGON = new BaseShape("octagon", (l, o, m) -> polygon(l, o, 8, 2, m));

public static final BaseShape DETAILED_OCTAGON = new BaseShape("detailed_octagon", (l, o, m) -> {
polygon(l, o, 8, 2, m);
polygon(l, o, 8, 1.75, m);
polygon(l, o, 8, 1.5, m);
});

// Combinations

public static final BaseShape SQUARE_RING = new BaseShape("square_ring", (l, o, m) -> {
Expand All @@ -90,18 +100,22 @@ public final class BaseShape implements ParticleShape {
// Spawn Utilities

public static void spawn(Location l, Object o) {
spawn(l, o, 0);
}

public static void spawn(Location l, Object o, double speed) {
if (o instanceof Material) {
Material m = (Material) o;
Object input = m.isBlock() ? m : new ItemStack(m);

if (input instanceof ItemStack) {
ItemStack item = (ItemStack) input;
l.getWorld().spawnParticle(Particle.ITEM_CRACK, l, 1, 0, 0, 0, 0, item);
l.getWorld().spawnParticle(Particle.ITEM_CRACK, l, 1, 0, 0, 0, speed, item);
} else
dw.blockDataParticle(Particle.BLOCK_CRACK, l, 1, m);
dw.blockDataParticle(Particle.BLOCK_CRACK, l, 1, m, speed);
} else if (o instanceof Particle) {
Particle p = (Particle) o;
l.getWorld().spawnParticle(p, l, 1, 0, 0, 0, 0);
l.getWorld().spawnParticle(p, l, 1, 0, 0, 0, speed);
}
}

Expand Down Expand Up @@ -140,20 +154,27 @@ public static void polygon(Location l, Object o, int points, double radius, int
}
}

public static void line(Location l, Object o, int length) {
line(l, o, length, 0);
}

public static void line(Location l, Object o, int length, long stepDelay) {
line(l, o, length, stepDelay, 0);
}

public static void line(Location l, Object o, int length, long stepDelay, double speed) {
Vector dir = l.getDirection();
double width = 0.1;

int count = 0;
for (double i = 0; i < length * (1 / width); i += width) {
for (double i = 0; i < length; i += width) {
final double fi = i;

BukkitRunnable r = new BukkitRunnable() {
@Override
public void run() {
dir.multiply(fi);
dir.multiply(1 + fi);
l.add(dir);
spawn(l, o);
spawn(l, o, speed);
l.subtract(dir);
dir.normalize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public void run() {
return;
}

dw.blockDataParticle(Particle.BLOCK_CRACK, p.getLocation(), 2, m);
dw.blockDataParticle(Particle.BLOCK_CRACK, p.getLocation(), 2, m, 0);
}
}.runTaskTimer(StarConfig.getPlugin(), 2, 1);
break;
Expand All @@ -265,7 +265,7 @@ public void run() {
return;
}

dw.blockDataParticle(Particle.BLOCK_DUST, p.getLocation(), 2, m);
dw.blockDataParticle(Particle.BLOCK_DUST, p.getLocation(), 2, m, 0);
}
}.runTaskTimer(StarConfig.getPlugin(), 2, 1);
break;
Expand Down Expand Up @@ -373,12 +373,12 @@ public void run() {
}
case "crack": {
Material m = matchMaterial(input);
dw.blockDataParticle(Particle.BLOCK_CRACK, loc, 2, m);
dw.blockDataParticle(Particle.BLOCK_CRACK, loc, 2, m, 0);
break;
}
case "dust": {
Material m = matchMaterial(input);
dw.blockDataParticle(Particle.BLOCK_DUST, loc, 2, m);
dw.blockDataParticle(Particle.BLOCK_DUST, loc, 2, m, 0);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ else if (line.startsWith("frame")) {
currentFrame.frameID = frameID;
}
else if (line.contains("Armorstand_Position")) {
// Blender uses Z as up and Y as forward
currentFrame.x = Float.parseFloat(split[1]);
currentFrame.y = Float.parseFloat(split[2]);
currentFrame.z = Float.parseFloat(split[3]);
currentFrame.y = Float.parseFloat(split[3]);
currentFrame.z = -Float.parseFloat(split[2]);
currentFrame.r = Float.parseFloat(split[4]);
}
else if (line.contains("Armorstand_Middle")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,25 @@ public enum StarMaterial {
PLAYER_HEAD(3, "skull_item"),

OAK_LOG("log"),

ACACIA_LOG("log_2"),

JUNGLE_LOG(3, "log"),

END_STONE("ender_stone"),

COMMAND_BLOCK("command"),

CHAIN_COMMAND_BLOCK("command_chain"),

REPEATING_COMMAND_BLOCK("command_repeating"),

GRASS_BLOCK("grass"),

CRAFTING_TABLE("workbench"),

BLACK_STAINED_GLASS_PANE(15, "stained_glass_pane"),

RED_STAINED_GLASS_PANE(14, "stained_glass_pane"),

LIME_STAINED_GLASS_PANE(5, "stained_glass_pane"),

LIME_WOOL(5, "wool"),

RED_WOOL(14, "wool"),

WHITE_WOOL(0, "wool"),

LIGHT_BLUE_WOOL(3, "wool"),
Expand Down Expand Up @@ -93,18 +85,13 @@ public enum StarMaterial {

LIGHT_BLUE_TERRACOTTA(3, "stained_clay"),

PORKCHOP("pork"),

RED_SAND(1, "sand"),

NETHER_QUARTZ_ORE("quartz_ore"),

OAK_LEAVES("leaves"),

OAK_BUTTON("wooden_button"),

OAK_FENCE("fence"),

OAK_FENCE_GATE("fence_gate"),

SPAWNER("mob_spawner"),
Expand Down Expand Up @@ -134,6 +121,12 @@ public enum StarMaterial {
RED_BANNER(14, "banner"),
BLACK_BANNER(15, "banner"),

CHICKEN("raw_chicken"),
BEEF("raw_beef"),
PORKCHOP("pork"),

NETHER_WART("nether_warts"),

;

@VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public enum StarSound {
ITEM_BOOK_PAGE_TURN,
BLOCK_SLIME_PLACE("block_slime_block_place"),
ITEM_TRIDENT_RIPTIDE_1,

ENTITY_ENDER_DRAGON_GROWL("ENTITY_ENDERDRAGON_GROWL"),
;

@VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
package me.gamercoder215.starcosmetics.util;

import me.gamercoder215.starcosmetics.api.StarConfig;
import org.bukkit.entity.Explosive;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.Metadatable;

import java.util.Arrays;

public final class StarUtil {

public static <T extends Metadatable> T cosmetic(T m) {
m.setMetadata("cosmetic", new FixedMetadataValue(StarConfig.getPlugin(), true));

if (m instanceof Explosive) {
Explosive e = (Explosive) m;
e.setIsIncendiary(false);
e.setYield(0);
}

return m;
}

public static int levenshteinDistance(String s1, String s2) {
if (s1 == null || s2 == null) return -1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package me.gamercoder215.starcosmetics.wrapper;

import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.Material;
import org.bukkit.Particle;

// Wrapper Used for Legacy-Specific Actions (e.g. BlockData vs MaterialData)
public interface DataWrapper {

void blockDataParticle(Particle p, Location loc, int count, Material m);
void blockDataParticle(Particle p, Location loc, int count, Material m, double speed);

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

public final class TestDataWrapper implements DataWrapper {
@Override
public void blockDataParticle(Particle p, Location loc, int count, Material m) {}
public void blockDataParticle(Particle p, Location loc, int count, Material m, double speed) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static boolean isOutdatedSubversion() {
default void registerEvents() {}

static String getServerVersion() {
if (Bukkit.getServer() == null) return "1_20_R2"; // Using Test Server
if (Bukkit.getServer() == null) return "1_20_R3"; // Using Test Server
return Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3].substring(1);
}

Expand Down
Loading

0 comments on commit f1005db

Please sign in to comment.