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

Commit

Permalink
Idofront & Geary bump, GearyItems Recipe prevention (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 authored Aug 25, 2023
1 parent e3a9fdd commit 78d7004
Show file tree
Hide file tree
Showing 51 changed files with 686 additions and 1,059 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/gradle-ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: Java CI with Gradle

on:
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:

concurrency:
cancel-in-progress: true
group: ci-${{ github.ref }}

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -21,14 +20,5 @@ jobs:
java-version: 17
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build
run: gradle build

- name: Upload build
uses: actions/upload-artifact@v1
with:
name: build
path: build/libs
62 changes: 24 additions & 38 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- develop
paths-ignore:
- '**.md'

Expand All @@ -14,42 +15,27 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
- uses: MineInAbyss/publish-action@master
with:
distribution: temurin
java-version: 17
cache: gradle

- name: Set env variable from latest maven version
run: >
echo "RELEASE_VERSION=$( \
curl https://repo.mineinabyss.com/releases/com/mineinabyss/looty/maven-metadata.xml | \
grep -oP '(?!<latest>)[\d\.]*(?=</latest>)' \
)" >> $GITHUB_ENV
- name: Run gradle build and publish
run: gradle build publish dokkaHtml -PmineinabyssMavenUsername=${{ secrets.MAVEN_PUBLISH_USERNAME }} -PmineinabyssMavenPassword=${{ secrets.MAVEN_PUBLISH_PASSWORD }}

- name: Publish documentation to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/dokka/htmlMultiModule
force_orphan: true

- name: Get version from gradle
shell: bash
id: extract_version
run: |
version=`gradle properties --console=plain -q | grep "^version:" | awk '{printf $2}'`
echo "::set-output name=version::$version"
- name: Create GitHub Release for shaded idofront platfrom
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
automatic_release_tag: v${{ steps.extract_version.outputs.version }}
files: |
build/libs/*[0-9].jar
maven-metadata-url: https://repo.mineinabyss.com/releases/com/mineinabyss/looty/maven-metadata.xml
pages-path: build/dokka/htmlMultiModule/
dokka: dokkaHtmlMultiModule
maven-username: ${{ secrets.MAVEN_PUBLISH_USERNAME }}
maven-password: ${{ secrets.MAVEN_PUBLISH_PASSWORD }}
release-files: |
${{ github.workspace }}/publish/*.jar
deploy:
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ out
eclipse
*.ipr
*.iws

logs
109 changes: 66 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,72 @@
[![Contribute](https://shields.io/badge/Contribute-e57be5?logo=github%20sponsors&style=flat&logoColor=white)](https://wiki.mineinabyss.com/contribute)
</div>

## Overview

Looty is a PaperMC plugin that acts as a link between ItemStacks and ECS entities from our Entity Component System (
ECS) [Geary](https://github.com/MineInAbyss/Geary). It lets you easily persist components on ItemStacks and have systems
iterate over them.

Looty also provides the same powerful configuration system as Geary, which lets you quickly create fancy custom items
for Minecraft servers. It even updates item data like models or lore update automatically.
Looty is a [Paper](https://papermc.io/) plugin for creating custom items with config files. We use [Geary](https://github.com/MineInAbyss/geary-papermc) to break down items into small components. We provide many components to modify vanilla behaviour, for new game features check out [Geary-addons](https://github.com/MineInAbyss/Geary-addons).

## Features

### Modular behaviours

ECS allows us to deconstruct complex item behaviours into individual components or actions. It makes code easier to
maintain and behaviours more reusable!

### Easy serialization

Thanks to kotlinx.serialization all our components are automatically serializable without reflection! Looty will
automatically save persisting components to the item itself.

### Prefabs and config files

Looty uses the same prefab system as Geary. It also adds item-related events so you can configure Geary actions to fire
on left click, or when an item is equipped.

Coders can focus on coding interesting components and systems while designers can tweak numbers and combine things
together without messing with your precious code!

### Item tracking

Looty will automatically keep track of item entities for you. You can go between the two using: `gearyOrNull(itemStack)`
and `gearyEntity.get<ItemStack>()`. Looty essentially ensures the ItemStack component on this entity always references
the true ItemStack (i.e. modifying it modifies the item in inventory.)

Currently, we plan on keeping track of items in player inventories and when thrown on the ground. We may also allow
specifically marked mobs to keep track of custom items in their inventory (doing this for all mobs would likely be
unnecessarily slow).

## Biggest issues

- Some more caching and optimizations should be done for the item tracking system. We haven't tested it large-scale yet.
- There are many design questions regarding how the config system should work and how to handle some complex behaviours.
Things may change.
- There is no data migration for items, though using prefabs, most item components can be static and not serialized to
the item itself. This means once the prefab config is updated, the item itself works again.
- Automatically updates item name, lore, and custom models when the config changes
- Support for custom recipes
- Write configs in yaml, json, and more.

## Usage
Coming soon

## Examples

### Custom item from our server

`star-compass.yml`
```yaml
# Make items in the same inventory share one entity
- !<looty:player_instanced_item>

# Specify item name, model, and lore,
# if this ever changes, Looty will update existing items
- !<looty:type>
item:
type: PAPER
customModelData: 125
displayName: <dark_aqua>Star Compass
lore:
- <aqua>Points towards the center of the <green>Abyss

# Add a recipe using other custom items
- !<looty:recipes>
discoverRecipes: true
recipes:
- !<shapeless>
items:
- prefab: mineinabyss:star_compass_needle
- prefab: mineinabyss:titanjaw_pearl


# A component provided another plugin
- !<mineinabyss:starcompass>

```
### Custom recipe for a vanilla item
`lead.yml`
```yaml
- !<looty:recipes>
discoverRecipes: true
result:
type: LEAD
amount: 2
removeRecipes:
- minecraft:lead
group: "looty:lead"
recipes:
- !<shaped>
items:
S:
prefab: mineinabyss:silkfang_silk
Z:
prefab: mineinabyss:abyssal_snail_gunk
configuration: |-
|ZZ |
|ZS |
| Z|
```
9 changes: 5 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val idofrontVersion: String by project
val gearyVersion: String by project

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("com.mineinabyss.conventions.kotlin")
alias(libs.plugins.kotlinx.serialization)
id("com.mineinabyss.conventions.kotlin.jvm")
id("com.mineinabyss.conventions.papermc")
id("com.mineinabyss.conventions.nms")
id("com.mineinabyss.conventions.copyjar")
Expand All @@ -15,12 +15,13 @@ plugins {
}

repositories {
maven("https://repo.mineinabyss.com/snapshots")
maven("https://jitpack.io")
}

dependencies {
// Other plugins
compileOnly(lootyLibs.geary.papermc.core)
compileOnly(myLibs.geary.papermc)

// From Geary

Expand Down
6 changes: 2 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
group=com.mineinabyss
version=0.9
kotlinVersion=1.7.20
idofrontVersion=0.15.3
serverVersion=1.19.2-R0.1-SNAPSHOT
version=0.10
idofrontVersion=0.18.14
5 changes: 0 additions & 5 deletions gradle/lootyLibs.versions.toml

This file was deleted.

5 changes: 5 additions & 0 deletions gradle/myLibs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[versions]
gearyPaper = "0.24-SNAPSHOT"

[libraries]
geary-papermc = { module = "com.mineinabyss:geary-papermc", version.ref = "gearyPaper" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
13 changes: 3 additions & 10 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
rootProject.name = "looty"

pluginManagement {
repositories {
gradlePluginPortal()
maven("https://repo.mineinabyss.com/releases")
maven("https://repo.papermc.io/repository/maven-public/")
}

plugins {
val kotlinVersion: String by settings
kotlin("jvm") version kotlinVersion
kotlin("plugin.serialization") version kotlinVersion
kotlin("kapt") version kotlinVersion
}

val idofrontVersion: String by settings
resolutionStrategy {
eachPlugin {
Expand All @@ -30,9 +25,7 @@ dependencyResolutionManagement {

versionCatalogs {
create("libs").from("com.mineinabyss:catalog:$idofrontVersion")
create("lootyLibs").from(files("gradle/lootyLibs.versions.toml"))
create("myLibs").from(files("gradle/myLibs.versions.toml"))
}
}


rootProject.name = "looty"
18 changes: 0 additions & 18 deletions src/main/kotlin/com/mineinabyss/looty/Helpers.kt

This file was deleted.

Loading

0 comments on commit 78d7004

Please sign in to comment.