Compare commits
No commits in common. "df6fe0f0846d5639259075348ec5cccf29f77a65" and "8ac2119c679d63a88b2fd935af389013b3b0a1b6" have entirely different histories.
df6fe0f084
...
8ac2119c67
9 changed files with 43 additions and 157 deletions
3
.github/workflows/dev-build-release.yml
vendored
3
.github/workflows/dev-build-release.yml
vendored
|
|
@ -32,9 +32,6 @@ jobs:
|
|||
|
||||
- name: Run build & publish with Gradle Wrapper
|
||||
if: github.ref == 'refs/heads/master'
|
||||
env:
|
||||
OSSRH_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
|
||||
OSSRH_PASSWORD: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
|
||||
run: chmod +x ./gradlew && ./gradlew publishAllPublicationsToMavenRepository
|
||||
|
||||
- name: Run build with Gradle Wrapper
|
||||
|
|
|
|||
37
.github/workflows/publish-to-maven-central.yml
vendored
37
.github/workflows/publish-to-maven-central.yml
vendored
|
|
@ -1,37 +0,0 @@
|
|||
name: Publish to Maven Central
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone project
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install JDK 8
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'temurin'
|
||||
check-latest: true
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Import GPG key
|
||||
run: |
|
||||
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --import --batch --yes
|
||||
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --import
|
||||
|
||||
- name: Publish to Maven Central
|
||||
env:
|
||||
OSSRH_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
|
||||
OSSRH_PASSWORD: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
|
||||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||
run: ./gradlew publishAllPublicationsToMavenRepository --no-daemon
|
||||
38
README.md
38
README.md
|
|
@ -8,36 +8,37 @@ You can easily use EntityLib platformless by using the `api` or `common` module
|
|||
|
||||
If you like EntityLib and or want to sponsor me, visit my [ko-fi page](https://ko-fi.com/tofaa) :D
|
||||
|
||||
EntityLib is published to [Maven Central](https://central.sonatype.com/artifact/io.github.tofaa2). Snapshots are available on pushes to the main branch, and stable releases are published on GitHub releases.
|
||||
EntityLib builds are available on [Jitpack](https://jitpack.io/#Tofaa2/EntityLib) and my own [Maven Repository](https://maven.evokegames.gg/#/snapshots/me/tofaa/entitylib)
|
||||
The examples below use my repository, open the jitpack link for its group information.
|
||||
|
||||
Gradle (Groovy DSL):
|
||||
```groovy
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.evokegames.gg/snapshots' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'io.github.tofaa2:<platform>:<version>'
|
||||
implementation 'me.tofaa.entitylib:<platform>:<latest-release-version'
|
||||
}
|
||||
```
|
||||
|
||||
Gradle (Kotlin DSL):
|
||||
```kotlin
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven(url = "https://maven.evokegames.gg/snapshots")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("io.github.tofaa2:<platform>:<version>")
|
||||
implementation("me.tofaa.entitylib:<platform>:<latest-release-version>")
|
||||
}
|
||||
```
|
||||
|
||||
Maven:
|
||||
```xml
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>io.github.tofaa2</groupId>
|
||||
<artifactId><platform></artifactId>
|
||||
<version><version></version>
|
||||
<groupId>me.tofaa.entitylib</groupId>
|
||||
<artifactId>(platform)</artifactId>
|
||||
<version>(latest-release-version)</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
|
@ -49,6 +50,8 @@ EntityLib does not provide packet-events as a dependency, you must have it in yo
|
|||
- Creation of WrapperEntities
|
||||
- Keeping track of entities.
|
||||
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
For more realistic examples, please take a look at the `test-plugin` module. It has an example `Bukkit` plugin that uses EntityLib.
|
||||
|
|
@ -128,23 +131,6 @@ class Example {
|
|||
|
||||
```
|
||||
|
||||
## Publishing to Maven Central
|
||||
|
||||
EntityLib uses the new Maven Central publishing system via the Central Portal (replacing the deprecated OSSRH). To publish, set up the following GitHub secrets:
|
||||
|
||||
- `OSSRH_USERNAME`: Your Central Portal username (usually your email).
|
||||
- `OSSRH_PASSWORD`: Your publishing token from the Central Portal.
|
||||
- `GPG_PRIVATE_KEY`: Your GPG private key (for signing artifacts).
|
||||
- `GPG_PASSPHRASE`: The passphrase for your GPG key.
|
||||
|
||||
### Setting Up Central Portal Credentials
|
||||
1. Go to [Central Portal](https://central.sonatype.com/) and log in with your GitHub account.
|
||||
2. **Create a namespace**: In the "Namespaces" section, create a new namespace for your group ID (`io.github.tofaa2`). This is crucial for publishing to work.
|
||||
3. Generate a publishing token from the "Account Settings" > "Publishing Tokens".
|
||||
4. Use your email as the username and the token as the password.
|
||||
|
||||
Snapshots are automatically published on pushes to the `master` branch. Stable releases are published when a GitHub release is created.
|
||||
|
||||
### TODO:
|
||||
Once this list is complete, i will release a stable version of the library.
|
||||
- [ ] Implement checks for each EntityMeta to make sure the version specific data is correct.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package me.tofaa.entitylib.meta.mobs.tameable;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.cat.CatVariant;
|
||||
import com.github.retrooper.packetevents.protocol.entity.cat.CatVariants;
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import me.tofaa.entitylib.extras.DyeColor;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
|
|
@ -22,12 +20,11 @@ public class CatMeta extends TameableMeta {
|
|||
|
||||
@NotNull
|
||||
public CatMeta.Variant getVariant() {
|
||||
final CatVariant catVariant = super.metadata.getIndex(OFFSET, CatVariants.BLACK);
|
||||
return Variant.fromCatVariant(catVariant);
|
||||
return super.metadata.getIndex(OFFSET, Variant.BLACK);
|
||||
}
|
||||
|
||||
public void setVariant(@NotNull CatMeta.Variant value) {
|
||||
super.metadata.setIndex(OFFSET, EntityDataTypes.TYPED_CAT_VARIANT, value.getCatVariant());
|
||||
super.metadata.setIndex(OFFSET, EntityDataTypes.CAT_VARIANT, value.ordinal());
|
||||
}
|
||||
|
||||
public boolean isLying() {
|
||||
|
|
@ -54,40 +51,21 @@ public class CatMeta extends TameableMeta {
|
|||
super.metadata.setIndex(offset(OFFSET, 3), EntityDataTypes.INT, value.ordinal());
|
||||
}
|
||||
|
||||
|
||||
public enum Variant {
|
||||
ALL_BLACK(CatVariants.ALL_BLACK),
|
||||
BLACK(CatVariants.BLACK),
|
||||
BRITISH_SHORTHAIR(CatVariants.BRITISH_SHORTHAIR),
|
||||
CALICO(CatVariants.CALICO),
|
||||
JELLIE(CatVariants.JELLIE),
|
||||
PERSIAN(CatVariants.PERSIAN),
|
||||
RAGDOLL(CatVariants.RAGDOLL),
|
||||
RED(CatVariants.RED),
|
||||
SIAMESE(CatVariants.SIAMESE),
|
||||
TABBY(CatVariants.TABBY),
|
||||
WHITE(CatVariants.WHITE);
|
||||
|
||||
private final CatVariant catVariant;
|
||||
|
||||
Variant(final CatVariant catVariant) {
|
||||
this.catVariant = catVariant;
|
||||
}
|
||||
TABBY,
|
||||
BLACK,
|
||||
RED,
|
||||
SIAMESE,
|
||||
BRITISH_SHORTHAIR,
|
||||
CALICO,
|
||||
PERSIAN,
|
||||
RAGDOLL,
|
||||
WHITE,
|
||||
JELLIE,
|
||||
ALL_BLACK;
|
||||
|
||||
private static final Variant[] VALUES = values();
|
||||
|
||||
public CatVariant getCatVariant() {
|
||||
return catVariant;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Variant fromCatVariant(@NotNull final CatVariant catVariant) {
|
||||
for (final Variant variant : VALUES) {
|
||||
if (variant.getCatVariant().equals(catVariant)) {
|
||||
return variant;
|
||||
}
|
||||
}
|
||||
return BLACK;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,19 @@
|
|||
package me.tofaa.entitylib.meta.mobs.tameable;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.protocol.entity.wolfvariant.WolfVariant;
|
||||
import com.github.retrooper.packetevents.protocol.entity.wolfvariant.WolfVariants;
|
||||
import me.tofaa.entitylib.extras.DyeColor;
|
||||
import me.tofaa.entitylib.meta.Metadata;
|
||||
import me.tofaa.entitylib.meta.types.TameableMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class WolfMeta extends TameableMeta {
|
||||
|
||||
public static final byte OFFSET = TameableMeta.MAX_OFFSET;
|
||||
public static final byte MAX_OFFSET = OFFSET + 5;
|
||||
public static final byte MAX_OFFSET = OFFSET + 3;
|
||||
|
||||
public WolfMeta(int entityId, Metadata metadata) {
|
||||
super(entityId, metadata);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public WolfVariant getVariant() {
|
||||
return super.metadata.getIndex(offset(OFFSET, 3), WolfVariants.PALE);
|
||||
}
|
||||
|
||||
public void setVariant(@NotNull WolfVariant value) {
|
||||
super.metadata.setIndex(offset(OFFSET, 3), EntityDataTypes.TYPED_WOLF_VARIANT, value);
|
||||
}
|
||||
|
||||
public boolean isBegging() {
|
||||
return super.metadata.getIndex(OFFSET, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ public class ItemFrameMeta extends EntityMeta implements ObjectData {
|
|||
|
||||
@NotNull
|
||||
public ItemStack getItem() {
|
||||
return super.metadata.getIndex((byte)9, ItemStack.EMPTY);
|
||||
return super.metadata.getIndex(9, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
public void setItem(@NotNull ItemStack value) {
|
||||
super.metadata.setIndex((byte)9, EntityDataTypes.ITEMSTACK, value);
|
||||
super.metadata.setIndex(9, EntityDataTypes.ITEMSTACK, value);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
|||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;
|
||||
import me.tofaa.entitylib.EntityLib;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
|
@ -16,11 +15,6 @@ public class PacketUtil {
|
|||
}
|
||||
|
||||
public static void renderPacket(UUID user, WrapperPlayServerEntityMetadata metadata) {
|
||||
final ArrayList<EntityData<?>> copiedEntityData = new ArrayList<>();
|
||||
metadata.getEntityMetadata().forEach(entityData ->
|
||||
copiedEntityData.add(new EntityData(entityData.getIndex(), entityData.getType(), entityData.getValue()))
|
||||
);
|
||||
metadata.setEntityMetadata(copiedEntityData);
|
||||
Locale locale = EntityLib.getApi().getUserLocaleProvider().locale(user);
|
||||
for (final EntityData<?> entityData : metadata.getEntityMetadata()) {
|
||||
if (entityData.getType() == EntityDataTypes.ADV_COMPONENT) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import java.io.ByteArrayOutputStream
|
|||
val fullVersion = "3.0.3"
|
||||
val snapshot = true
|
||||
|
||||
group = "io.github.tofaa2"
|
||||
group = "me.tofaa.entitylib"
|
||||
description = rootProject.name
|
||||
|
||||
fun getVersionMeta(includeHash: Boolean): String {
|
||||
|
|
@ -21,8 +21,8 @@ fun getVersionMeta(includeHash: Boolean): String {
|
|||
}
|
||||
return "$commitHash-SNAPSHOT"
|
||||
}
|
||||
version = "$fullVersion${getVersionMeta(false)}"
|
||||
ext["versionBeta"] = getVersionMeta(false)
|
||||
version = "$fullVersion${getVersionMeta(true)}"
|
||||
ext["versionBeta"] = getVersionMeta(true)
|
||||
ext["versionNoHash"] = "$fullVersion${getVersionMeta(false)}"
|
||||
|
||||
tasks {
|
||||
|
|
@ -62,12 +62,6 @@ tasks {
|
|||
}
|
||||
}
|
||||
|
||||
register("publishAllPublicationsToMavenRepository") {
|
||||
val publishTasks = subModuleTasks("publishAllPublicationsToMavenRepository")
|
||||
dependsOn(publishTasks)
|
||||
group = "publishing"
|
||||
}
|
||||
|
||||
register<Delete>("clean") {
|
||||
val cleanTasks = subModuleTasks("clean")
|
||||
dependsOn(cleanTasks)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
signing
|
||||
}
|
||||
|
||||
group = rootProject.group
|
||||
|
|
@ -46,6 +45,17 @@ tasks {
|
|||
}
|
||||
|
||||
publishing {
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://maven.evokegames.gg/snapshots")
|
||||
credentials {
|
||||
username = System.getenv("TYCOONS_REPO_USER")
|
||||
password = System.getenv("TYCOONS_REPO_PASS")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publications {
|
||||
create<MavenPublication>("EntityLib") {
|
||||
groupId = project.group as String
|
||||
|
|
@ -65,14 +75,6 @@ publishing {
|
|||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id = "Tofaa2"
|
||||
name = "Tofaa"
|
||||
email = "tofaadev@gmail.com"
|
||||
}
|
||||
}
|
||||
|
||||
scm {
|
||||
connection = "scm:git:https://github.com/Tofaa2/EntityLib.git"
|
||||
developerConnection = "scm:git:https://github.com/Tofaa2/EntityLib.git"
|
||||
|
|
@ -81,22 +83,6 @@ publishing {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://central.sonatype.com/api/v1/publisher/upload")
|
||||
credentials {
|
||||
username = System.getenv("OSSRH_USERNAME")
|
||||
password = System.getenv("OSSRH_PASSWORD")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
if (!version.toString().endsWith("-SNAPSHOT")) {
|
||||
sign(publishing.publications["EntityLib"])
|
||||
}
|
||||
}
|
||||
|
||||
// So that SNAPSHOT is always the latest SNAPSHOT
|
||||
|
|
|
|||
Loading…
Reference in a new issue