Skip to content

Commit ddf7cbc

Browse files
Java compiler for GeyserOptionalPack (#65)
* inital commit * i think pr is ready now * wait now its ready * Update copyright year * add license to each file * Update pack version * copy license / mojang disclaimer to pack * Update mojang.md * test actions * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update .gitignore * clean up some code * change "extracting" to copying * Update build.yml * Add new compilation instructions * update developer documentation for new compiler * make some code more readable * some more code cleanup * Code cleanup and tweaks * Move to gradle action for running * Cleanup run folder * Update build action to use run folder * Lets not bother with the run folder * Download the specified version from mojang * Remove old run folder --------- Co-authored-by: rtm516 <[email protected]>
1 parent 1f9be92 commit ddf7cbc

File tree

95 files changed

+2432
-1033
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2432
-1033
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,27 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- name: Checkout repository
17-
# See https://github.com/actions/checkout/commits
18-
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
19-
20-
- name: Install ImageMagick
21-
run: sudo apt install -y imagemagick
22-
23-
- name: Prepare pack
24-
run: bash prepare_pack.sh
25-
26-
- name: Zip pack
27-
run: zip GeyserOptionalPack.mcpack -r . -x ".*" required_files.txt prepare_pack.sh
16+
- name: Setup Gradle
17+
uses: GeyserMC/actions/setup-gradle-composite@master
18+
with:
19+
setup-java_java-version: 21
2820

29-
- name: Archive artifacts
21+
- name: Build and run with Gradle
22+
run: ./gradlew run
23+
24+
- name: Archive resource pack artifact
3025
# See https://github.com/actions/upload-artifact/commits
3126
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
3227
if: success()
3328
with:
3429
name: GeyserOptionalPack
3530
path: GeyserOptionalPack.mcpack
36-
31+
3732
- name: Get Version
3833
if: ${{ success() && github.repository == 'GeyserMC/GeyserOptionalPack' && github.ref_name == 'master' }}
3934
id: get-version
4035
run: |
41-
version=$(cat manifest.json | jq -r '.header.version | join(".")')
36+
version=$(cat src/main/resources/optionalpack/manifest.json | jq -r '.header.version | join(".")')
4237
echo "VERSION=${version}" >> $GITHUB_OUTPUT
4338
4439
- name: Get Release Metadata

.gitignore

Lines changed: 260 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,262 @@
1-
.idea/
1+
# Created by https://www.toptal.com/developers/gitignore/api/git,java,gradle,eclipse,netbeans,jetbrains+all,visualstudiocode
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=git,java,gradle,eclipse,netbeans,jetbrains+all,visualstudiocode
3+
4+
### Eclipse ###
5+
.metadata
6+
bin/
7+
tmp/
8+
*.tmp
9+
*.bak
10+
*.swp
11+
*~.nib
12+
local.properties
13+
.settings/
14+
.loadpath
15+
.recommenders
16+
17+
# External tool builders
18+
.externalToolBuilders/
19+
20+
# Locally stored "Eclipse launch configurations"
21+
*.launch
22+
23+
# PyDev specific (Python IDE for Eclipse)
24+
*.pydevproject
25+
26+
# CDT-specific (C/C++ Development Tooling)
27+
.cproject
28+
29+
# CDT- autotools
30+
.autotools
31+
32+
# Java annotation processor (APT)
33+
.factorypath
34+
35+
# PDT-specific (PHP Development Tools)
36+
.buildpath
37+
38+
# sbteclipse plugin
39+
.target
40+
41+
# Tern plugin
42+
.tern-project
43+
44+
# TeXlipse plugin
45+
.texlipse
46+
47+
# STS (Spring Tool Suite)
48+
.springBeans
49+
50+
# Code Recommenders
51+
.recommenders/
52+
53+
# Annotation Processing
54+
.apt_generated/
55+
.apt_generated_test/
56+
57+
# Scala IDE specific (Scala & Java development for Eclipse)
58+
.cache-main
59+
.scala_dependencies
60+
.worksheet
61+
62+
# Uncomment this line if you wish to ignore the project description file.
63+
# Typically, this file would be tracked if it contains build/dependency configurations:
64+
#.project
65+
66+
### Eclipse Patch ###
67+
# Spring Boot Tooling
68+
.sts4-cache/
69+
70+
### Git ###
71+
# Created by git for backups. To disable backups in Git:
72+
# $ git config --global mergetool.keepBackup false
73+
*.orig
74+
75+
# Created by git when using merge tools for conflicts
76+
*.BACKUP.*
77+
*.BASE.*
78+
*.LOCAL.*
79+
*.REMOTE.*
80+
*_BACKUP_*.txt
81+
*_BASE_*.txt
82+
*_LOCAL_*.txt
83+
*_REMOTE_*.txt
84+
85+
### Java ###
86+
# Compiled class file
87+
*.class
88+
89+
# Log file
90+
*.log
91+
92+
# BlueJ files
93+
*.ctxt
94+
95+
# Mobile Tools for Java (J2ME)
96+
.mtj.tmp/
97+
98+
# Package Files #
99+
*.jar
100+
*.war
101+
*.nar
102+
*.ear
103+
*.zip
104+
*.tar.gz
105+
*.rar
106+
107+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
108+
hs_err_pid*
109+
replay_pid*
110+
111+
### JetBrains+all ###
112+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
113+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
114+
115+
# User-specific stuff
116+
.idea/**/workspace.xml
117+
.idea/**/tasks.xml
118+
.idea/**/usage.statistics.xml
119+
.idea/**/dictionaries
120+
.idea/**/shelf
121+
122+
# AWS User-specific
123+
.idea/**/aws.xml
124+
125+
# Generated files
126+
.idea/**/contentModel.xml
127+
128+
# Sensitive or high-churn files
129+
.idea/**/dataSources/
130+
.idea/**/dataSources.ids
131+
.idea/**/dataSources.local.xml
132+
.idea/**/sqlDataSources.xml
133+
.idea/**/dynamic.xml
134+
.idea/**/uiDesigner.xml
135+
.idea/**/dbnavigator.xml
136+
137+
# Gradle
138+
.idea/**/gradle.xml
139+
.idea/**/libraries
140+
141+
# Gradle and Maven with auto-import
142+
# When using Gradle or Maven with auto-import, you should exclude module files,
143+
# since they will be recreated, and may cause churn. Uncomment if using
144+
# auto-import.
145+
# .idea/artifacts
146+
# .idea/compiler.xml
147+
# .idea/jarRepositories.xml
148+
# .idea/modules.xml
149+
# .idea/*.iml
150+
# .idea/modules
151+
# *.iml
152+
# *.ipr
153+
154+
# CMake
155+
cmake-build-*/
156+
157+
# Mongo Explorer plugin
158+
.idea/**/mongoSettings.xml
159+
160+
# File-based project format
161+
*.iws
162+
163+
# IntelliJ
164+
out/
165+
166+
# mpeltonen/sbt-idea plugin
167+
.idea_modules/
168+
169+
# JIRA plugin
170+
atlassian-ide-plugin.xml
171+
172+
# Cursive Clojure plugin
173+
.idea/replstate.xml
174+
175+
# SonarLint plugin
176+
.idea/sonarlint/
177+
178+
# Crashlytics plugin (for Android Studio and IntelliJ)
179+
com_crashlytics_export_strings.xml
180+
crashlytics.properties
181+
crashlytics-build.properties
182+
fabric.properties
183+
184+
# Editor-based Rest Client
185+
.idea/httpRequests
186+
187+
# Android studio 3.1+ serialized cache file
188+
.idea/caches/build_file_checksums.ser
189+
190+
### JetBrains+all Patch ###
191+
# Ignore everything but code style settings and run configurations
192+
# that are supposed to be shared within teams.
193+
194+
.idea/*
195+
196+
!.idea/codeStyles
197+
!.idea/runConfigurations
198+
199+
### NetBeans ###
200+
**/nbproject/private/
201+
**/nbproject/Makefile-*.mk
202+
**/nbproject/Package-*.bash
203+
build/
204+
nbbuild/
205+
dist/
206+
nbdist/
207+
.nb-gradle/
208+
209+
### VisualStudioCode ###
210+
.vscode/*
211+
!.vscode/settings.json
212+
!.vscode/tasks.json
213+
!.vscode/launch.json
214+
!.vscode/extensions.json
215+
!.vscode/*.code-snippets
216+
217+
# Local History for Visual Studio Code
218+
.history/
219+
220+
# Built Visual Studio Code Extensions
221+
*.vsix
222+
223+
### VisualStudioCode Patch ###
224+
# Ignore all local history of files
225+
.history
226+
.ionide
227+
228+
### Gradle ###
229+
.gradle
230+
**/build/
231+
!src/**/build/
232+
233+
# Ignore Gradle GUI config
234+
gradle-app.setting
235+
236+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
237+
!gradle-wrapper.jar
238+
239+
# Avoid ignore Gradle wrappper properties
240+
!gradle-wrapper.properties
241+
242+
# Cache of project
243+
.gradletasknamecache
244+
245+
# Eclipse Gradle plugin generated files
246+
# Eclipse Core
247+
.project
248+
# JDT-specific (Eclipse Java Development Tools)
249+
.classpath
250+
251+
### Gradle Patch ###
252+
# Java heap dump
253+
*.hprof
254+
255+
# End of https://www.toptal.com/developers/gitignore/api/git,java,gradle,eclipse,netbeans,jetbrains+all,visualstudiocode
256+
257+
# Output pack files
2258
GeyserOptionalPack.mcpack
3259
GeyserOptionalPack.zip
4-
# Java Edition textures that should not be submitted to Git
5-
textures/geyser/entity/iron_golem/iron_golem_crackiness_high.png
6-
textures/geyser/entity/iron_golem/iron_golem_crackiness_low.png
7-
textures/geyser/entity/iron_golem/iron_golem_crackiness_medium.png
8-
textures/geyser/entity/arrow/spectral_arrow.png
9-
textures/geyser/entity/rabbit/caerbannog.png
10-
textures/geyser/particle/damage.png
11-
textures/geyser/particle/flash.png
12-
textures/geyser/particle/nautilus.png
13-
textures/geyser/particle/sweep_attack.png
14-
textures/geyser/entity/illager/illusioner.png
15-
# Blockception's Minecraft Bedrock Development VS Code Extension settings
16-
.mcattributes
260+
261+
# Development folders
262+
temp/

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 GeyserMC
3+
Copyright (c) 2025 GeyserMC
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ Download: [GeyserOptionalPack.mcpack](https://download.geysermc.org/v2/projects/
1919
- 2x2 crafting grid while in creative mode
2020
- Tick-delay and rename fields in the command block menu
2121
- Structure block options that do not exist on Java
22-
- Removes the (sub)title background for attack cooldowns
2322

24-
### Manually building
23+
### Manually compiling the pack
2524

26-
Run `./prepare_pack.sh` in this directory and the necessary files from the vanilla jar will be copied to the required directories. Zip up and you're set. Optionally, you may compress the output JSON files by running `./prepare_pack.sh -jc`. This should not be done when planning to contribute. You may then package with `zip GeyserOptionalPack.mcpack -r . -x ".*" Jenkinsfile required_files.txt prepare_pack.sh`.
25+
1. Clone the repo to your computer
26+
2. Run `gradlew build`.
27+
3. Run the pack compiler using `java -jar build/libs/GeyserOptionalPackCompiler.jar`
28+
4. When it finishes compiling, it will output the `GeyserOptionalPack.mcpack`.
2729

2830
### Legal
2931

build.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
plugins {
2+
id 'java'
3+
id 'application'
4+
}
5+
6+
group = 'org.geysermc.optionalpack'
7+
version = '1.0-SNAPSHOT'
8+
9+
repositories {
10+
mavenCentral()
11+
}
12+
13+
dependencies {
14+
implementation 'com.google.code.gson:gson:2.13.1'
15+
}
16+
17+
jar {
18+
archiveFileName = 'GeyserOptionalPackCompiler.jar'
19+
manifest {
20+
attributes 'Main-Class': application.mainClass
21+
}
22+
}
23+
24+
application {
25+
mainClass = 'org.geysermc.optionalpack.OptionalPack'
26+
}

0 commit comments

Comments
 (0)