Skip to content

Commit

Permalink
Fix jolly pink rocks (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron committed Sep 17, 2023
1 parent 8c88eb7 commit 01ad5f7
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import me.xmrvizzy.skyblocker.utils.NEURepo;
import net.minecraft.item.FireworkRocketItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -89,6 +90,16 @@ public static ItemStack parseJsonObj(JsonObject obj) {
enchantments.add(new NbtCompound());
tag.put("Enchantments", enchantments);
}

// Add firework star color
Matcher explosionColorMatcher = Pattern.compile("\\{Explosion:\\{(?:Type:[0-9a-z]+,)?Colors:\\[(?<color>[0-9]+)\\]\\}").matcher(nbttag);
if (explosionColorMatcher.find()) {
NbtCompound explosion = new NbtCompound();

explosion.putInt("Type", FireworkRocketItem.Type.SMALL_BALL.getId()); //Forget about the actual ball type because it probably doesn't matter
explosion.putIntArray("Colors", new int[] { Integer.parseInt(explosionColorMatcher.group("color")) });
tag.put("Explosion", explosion);
}

return ItemStack.fromNbt(root);
}
Expand Down

0 comments on commit 01ad5f7

Please sign in to comment.