Skip to content

Commit

Permalink
Modernize setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdAurora committed Jul 22, 2024
1 parent ce88580 commit 9812fd0
Show file tree
Hide file tree
Showing 14 changed files with 200 additions and 175 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/gradlebuild.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
name: Gradle Build
name: "Gradle Build"

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
on: [push, pull_request]

jobs:
build:
strategy:
matrix:
java: [ 17, 19 ]
java: [21]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
- name: "Set up Java"
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'gradle'
- name: "Set up Gradle"
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/1.') && !startsWith(github.ref, 'refs/heads/dev/') && !startsWith(github.ref, 'refs/tags/v') }}

- name: Build with Gradle
- name: "Gradle Build"
run: ./gradlew build --parallel --stacktrace

- uses: actions/upload-artifact@v2
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: Artifacts
name: Artifacts_j${{ matrix.java }}
path: ./build/libs/
26 changes: 16 additions & 10 deletions .github/workflows/gradlepublish.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
name: Gradle Package
name: "Release"

on:
push:
tags:
- 'v*'
- "v*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: "Checkout"
uses: actions/checkout@v4
with:
java-version: 17
distribution: 'temurin'
fetch-depth: 0
- name: "Set up Java"
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 21
- name: "Set up Gradle"
uses: gradle/actions/setup-gradle@v3

- name: Build with Gradle
- name: "Gradle Build"
run: ./gradlew build --parallel --stacktrace

- uses: actions/upload-artifact@v2
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: ./build/libs/

# The USERNAME and PASSWORD need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages and other Mavens
- name: "Publish to GitHub Packages and other Mavens"
run: ./gradlew publish
env:
BRANCH_NAME: ${{ github.ref }}
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# LambdAurora's ignore file
#
# v0.21
# v0.23

# JetBrains
.idea/
Expand Down Expand Up @@ -59,7 +59,7 @@ venv/
# OS
## Windows
desktop.ini
# MacOS
## MacOS
.DS_Store

# File types
Expand All @@ -83,8 +83,10 @@ bin/
build/
dist/
lib/
!/lib/
!src/lib/
!src/**/lib/
obj/
run/
target/
/local.properties
49 changes: 30 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PrideLib

![Java 17](https://img.shields.io/badge/language-Java%2017-9B599A.svg?style=flat-square)
![Java 21](https://img.shields.io/badge/language-Java%2021-9B599A.svg?style=flat-square)
[![GitHub license](https://img.shields.io/github/license/Queerbric/pridelib?style=flat-square)](https://raw.githubusercontent.com/Queerbric/pridelib/1.19/LICENSE)
![Environment: Client](https://img.shields.io/badge/environment-client-1976d2?style=flat-square)
[![Mod loader: Fabric]][fabric]
Expand All @@ -9,19 +9,21 @@
PrideLib is a small JIJ dependency for modders who want to use a centralized data-driven and configurable source of pride flags in their mods. PrideLib can then be used to draw randomized graphical elements, or generate other colored visuals. PrideLib lets flags be added through resource packs, optionally part of a mod. Flags used by PrideLib can be configured either with resource packs, or a config file.

## Including PrideLib in a Mod

```gradle
repositories {
maven {
name 'Gegy Maven'
url 'https://maven.gegy.dev'
name = "Gegy Maven"
url = uri("https://maven.gegy.dev")
}
}
dependencies {
modImplementation include("io.github.queerbric:pridelib:${pridelib_version}")
modImplementation(include("io.github.queerbric:pridelib:${pridelib_version}"))
}
```

## Adding Flags

Flags are json files located at `assets/[namespace]/flags/[name].json`. The namespace is unimportant, the name of the file is its ID, and only one of each ID will be loaded. Flags have a shape (which if omitted will default to `pride:horizontal_stripes`) and a set of colors. The following example is the trans flag.
```json
{
Expand All @@ -37,6 +39,7 @@ Flags are json files located at `assets/[namespace]/flags/[name].json`. The name
```

## Configuring Flags

Sometimes you don't actually want all of the available flags to be used in game. In this scenario, you'd use a flag configuration file. These are located in 2 different places, either `assets/pride/flags.json` for resource packs, or `config/pride.json` for a config file. Config files have a higher priority than resource pack ones. They use the same format, but the scenario where you might use one over the other may vary. Here is an example limiting available flags to only the trans flag, even if other flags are registered.
```json
{
Expand All @@ -47,52 +50,60 @@ Sometimes you don't actually want all of the available flags to be used in game.
```

## Default Flags

In order to provide a small amount of structure, PrideLib comes bundled with a small handful of common flags.

| ID | Description |
| --- | --- |
| `asexual` | Asexual pride |
| `bisexual` | Bisexual pride |
| `intersex` | Intersex pride |
| `lesbian` | Lesbian pride |
| `nonbinary` | Non-binary pride |
| `pansexual` | Pansexual pride |
| `rainbow` | Rainbow/queer/gay/umbrella pride |
| `transgender` | Transgender pride |
| ID | Description |
|---------------|----------------------------------|
| `asexual` | Asexual pride |
| `bisexual` | Bisexual pride |
| `intersex` | Intersex pride |
| `lesbian` | Lesbian pride |
| `nonbinary` | Non-binary pride |
| `pansexual` | Pansexual pride |
| `rainbow` | Rainbow/queer/gay/umbrella pride |
| `transgender` | Transgender pride |

## Using in Code

Flags can be obtained from the class `PrideFlags`, it also provides helper methods for selecting a random flag. The returned `PrideFlag` type also offers a `render` method for quick 2D rendering in a GUI or similar. For more complex usage, you can retrieve the raw data. **Note that if no flags are available for whatever reason, getRandomFlag will return `null`**.

Since you may particularly want to make use of this library during Pride Month (i.e. June), there is also a utility method offered in `PrideFlags`: `isPrideMonth`. This also checks for a system property, `everyMonthIsPrideMonth`, which if it is set to `true` the method will always return `true`. You can do this by adding this to your JVM arguments: `-DeveryMonthIsPrideMonth=true`

## Built-in Flag Shapes

The following flag shapes are built-in to PrideLib. Any mod can contribute additional shapes by registering them with `PrideFlagShapes`.

## horizontal_stripes
### `horizontal_stripes`

A basic flag consisting of an arbitrary number of equally-sized colored stripes. Each color is a stripe. The first color is the top stripe, the last is the bottom stripe.

You can accomplish non-equally-sized stripes by repeating the same color multiple times.

Examples: rainbow flag, trans flag, pan flag, nonbinary flag, many more

## vertical_stripes
### `vertical_stripes`

A basic flag consisting of an arbitrary number of equally-sized colored stripes. Each color is a stripe. The first color is the left stripe, the last is the right stripe.

You can accomplish non-equally-sized stripes by repeating the same color multiple times.

Examples: androgynous flag (not built-in)

## circle
### `circle`

A flag with a solid background and a hollow circle in the foreground. The first color is the background, the second color is the color of the circle. Additional colors are ignored.

Examples: intersex flag

## arrow
### `arrow`

A flag with a triangle pointing to the right on the left side of the flag. The first color is the color of the triangle, the rest are treated as in horizontal_stripes and make up the background.

Examples: demisexual flag (not built-in)

## progress
### `progress`

Something very close to the "Progress" pride flag design. Hardcoded due to its unique shape; ignores all colors.

Not provided by any built-in flags; you can add this JSON file to provide it:
Expand Down
88 changes: 0 additions & 88 deletions build.gradle

This file was deleted.

Loading

0 comments on commit 9812fd0

Please sign in to comment.