Skip to content

Commit 0cf7986

Browse files
committed
shota is cute!!!
Update README.md Update README.md file only file only fixs fix add debug options fix compiler factory and advanced url handler to uri string upload icon rewrite preprocessor fixs index fix fix ignore nulls fix fix fix cache gradle reroot reference Use https://github.com/CleanroomMC/CleanroomModTemplate update crl fg use downdate use fg 6.10.34 Update build.gradle Fork the gradle add extra classpaths fix null scripts update mod, impl event and provide classpath deimport init implements the api packages DynamicPackageInitializer update javashota and fix compiler fix compiler fix fix fix update icon fix fix fix fix fix fix fix registry fix build impl mods Initial commit
0 parents  commit 0cf7986

40 files changed

+1814
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/workflows/gradle.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7+
8+
name: Build mod jar
9+
10+
on:
11+
[workflow_dispatch, push]
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
build:
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v4.2.2
23+
- name: Set up JDK 21
24+
uses: actions/setup-java@v4.7.0
25+
with:
26+
java-version: '21'
27+
distribution: 'temurin'
28+
cache: 'gradle'
29+
- uses: gradle/actions/setup-gradle@v4.3.1
30+
with:
31+
gradle-version: 8.13
32+
name: Set up Gradle
33+
- name: Add permission
34+
run: chmod +x ./gradlew
35+
- name: Execute Gradle build
36+
run: ./gradlew build
37+
38+
- name: Upload a Build Artifact
39+
uses: actions/upload-artifact@v4.6.2
40+
with:
41+
path: build/libs

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Releases
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v4.2.2
15+
- name: Set up JDK 21
16+
uses: actions/setup-java@v4.7.0
17+
with:
18+
java-version: '21'
19+
distribution: 'temurin'
20+
cache: 'gradle'
21+
- uses: gradle/actions/setup-gradle@v4.3.1
22+
with:
23+
gradle-version: 8.13
24+
name: Set up Gradle
25+
- name: Add permission
26+
run: chmod +x ./gradlew
27+
- name: Execute Gradle build
28+
run: ./gradlew build
29+
30+
- uses: ncipollo/release-action@v1.16.0
31+
with:
32+
artifacts: "build/libs/*"
33+
generateReleaseNotes: true

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# eclipse
2+
bin
3+
*.launch
4+
.settings
5+
.metadata
6+
.classpath
7+
.project
8+
9+
# idea
10+
out
11+
*.ipr
12+
*.iws
13+
*.iml
14+
.idea
15+
16+
# gradle
17+
build
18+
.gradle
19+
20+
# other
21+
eclipse
22+
run/*
23+
!run/SinglePlayer.txt
24+
runServer/*
25+
!runServer/eula.txt
26+
!runServer/server.properties
27+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Hileb
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
### ShotaASM
2+
<img src="https://github.com/Ecdcaeb/ShotaASM/blob/main/icon.png" alt="image" width="100" height="auto">
3+
a script mod enables you write asm codes in scripts
4+
5+
#### example :
6+
```java
7+
#compiler javaShota
8+
#import org.apache.logging.log4j.LogManager
9+
#import org.apache.logging.log4j.Logger
10+
11+
System.out.print("Shota Strat his own tests!!! ^o^");
12+
final Logger LOGGER = LogManager.getLogger("Cute shota");
13+
LOGGER.info("Now, i have my own logger!!");
14+
15+
// Change the title
16+
TransformerRegistry.registerASMExplicitTransformer(-99 ,
17+
(cn) -> {
18+
for (var mn :cn.methods) {
19+
var itr = mn.instructions.iterator();
20+
while (itr.hasNext()) {
21+
if (itr.next() instanceof LdcInsnNode ldc && ldc.cst instanceof String str && str.startsWith("Cleanroom Loader")) {
22+
ldc.cst = str + " & Cute Shota";
23+
LOGGER.info("change the title to {}", ldc.cst);
24+
}
25+
}
26+
}
27+
}, "net.minecraft.client.Minecraft");
28+
```
29+
![image](https://github.com/user-attachments/assets/e89ec1cc-7cea-483d-a204-3c6d545466e1)
30+
31+

build.gradle

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
import org.jetbrains.changelog.Changelog
2+
3+
plugins {
4+
id 'java'
5+
id 'java-library'
6+
id 'maven-publish'
7+
id 'com.gradleup.shadow' version '9.0.0-beta12' // Remove this line and shadowJar task if you don't need shadow
8+
id 'org.jetbrains.changelog' version '2.2.1'
9+
id 'xyz.wagyourtail.unimined' version '1.3.14'
10+
}
11+
12+
apply from: 'gradle/scripts/helpers.gradle'
13+
14+
// Early Assertions
15+
assertProperty 'mod_version'
16+
assertProperty 'root_package'
17+
assertProperty 'mod_id'
18+
assertProperty 'mod_name'
19+
20+
injectTags()
21+
22+
assertSubProperties 'use_access_transformer', 'access_transformer_locations'
23+
assertSubProperties 'is_coremod', 'coremod_includes_mod', 'coremod_plugin_class_name'
24+
assertSubProperties 'use_asset_mover', 'asset_mover_version'
25+
26+
setDefaultProperty 'generate_sources_jar', true, false
27+
setDefaultProperty 'generate_javadocs_jar', true, false
28+
setDefaultProperty 'minecraft_username', true, 'Developer'
29+
setDefaultProperty 'extra_jvm_args', false, ''
30+
31+
version = propertyString('mod_version')
32+
group = propertyString('root_package')
33+
34+
base {
35+
archivesName.set(propertyString('mod_id'))
36+
}
37+
38+
39+
java {
40+
toolchain {
41+
languageVersion.set(JavaLanguageVersion.of(21))
42+
}
43+
if (propertyBool('generate_sources_jar')) {
44+
withSourcesJar()
45+
}
46+
if (propertyBool('generate_javadocs_jar')) {
47+
withJavadocJar()
48+
}
49+
}
50+
51+
configurations {
52+
embed
53+
contain
54+
implementation.extendsFrom(embed)
55+
}
56+
57+
unimined.minecraft {
58+
version "1.12.2"
59+
60+
mappings {
61+
mcp("stable", "39-1.12")
62+
}
63+
64+
cleanroom {
65+
if (propertyBool('use_access_transformer')) {
66+
accessTransformer 'src/main/resources/' + propertyString('access_transformer_locations')
67+
}
68+
loader "0.3.0-alpha"
69+
runs.auth.username = minecraft_username
70+
runs.all {
71+
if (hasProperty("extra_jvm_args")) {
72+
jvmArgs(propertyString('extra_jvm_args'))
73+
}
74+
if (propertyBool('enable_foundation_debug')) {
75+
systemProperty("foundation.dump", "true")
76+
systemProperty("foundation.verbose", "true")
77+
}
78+
return
79+
}
80+
}
81+
82+
83+
}
84+
85+
repositories {
86+
maven {
87+
name 'CleanroomMC Maven'
88+
url 'https://maven.cleanroommc.com'
89+
}
90+
}
91+
92+
dependencies {
93+
if (propertyBool('use_asset_mover')) {
94+
implementation "com.cleanroommc:assetmover:${propertyString('asset_mover_version')}"
95+
}
96+
if (propertyBool('enable_junit_testing')) {
97+
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
98+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
99+
}
100+
}
101+
102+
apply from: 'gradle/scripts/dependencies.gradle'
103+
104+
processResources {
105+
106+
inputs.property 'mod_id', propertyString('mod_id')
107+
inputs.property 'mod_name', propertyString('mod_name')
108+
inputs.property 'mod_version', propertyString('mod_version')
109+
inputs.property 'mod_description', propertyString('mod_description')
110+
inputs.property 'mod_authors', "${propertyStringList('mod_authors', ',').join(', ')}"
111+
inputs.property 'mod_credits', propertyString('mod_credits')
112+
inputs.property 'mod_url', propertyString('mod_url')
113+
inputs.property 'mod_update_json', propertyString('mod_update_json')
114+
inputs.property 'mod_logo_path', propertyString('mod_logo_path')
115+
116+
def filterList = ['mcmod.info', 'pack.mcmeta']
117+
118+
filesMatching(filterList) { fcd ->
119+
fcd.expand(
120+
'mod_id': propertyString('mod_id'),
121+
'mod_name': propertyString('mod_name'),
122+
'mod_version': propertyString('mod_version'),
123+
'mod_description': propertyString('mod_description'),
124+
'mod_authors': "${propertyStringList('mod_authors', ',').join(', ')}",
125+
'mod_credits': propertyString('mod_credits'),
126+
'mod_url': propertyString('mod_url'),
127+
'mod_update_json': propertyString('mod_update_json'),
128+
'mod_logo_path': propertyString('mod_logo_path'),
129+
)
130+
}
131+
132+
rename '(.+_at.cfg)', 'META-INF/$1'
133+
}
134+
135+
jar {
136+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
137+
if (configurations.contain.size() > 0) {
138+
into('/') {
139+
from configurations.contain
140+
}
141+
}
142+
doFirst{
143+
manifest {
144+
def attribute_map = [:]
145+
attribute_map['ModType'] = "CRL"
146+
if (configurations.contain.size() > 0) {
147+
attribute_map['ContainedDeps'] = configurations.contain.collect { it.name }.join(' ')
148+
attribute_map['NonModDeps'] = true
149+
}
150+
if (propertyBool('is_coremod')) {
151+
attribute_map['FMLCorePlugin'] = propertyString('coremod_plugin_class_name')
152+
if (propertyBool('coremod_includes_mod')) {
153+
attribute_map['FMLCorePluginContainsFMLMod'] = true
154+
}
155+
}
156+
if (propertyBool('use_access_transformer')) {
157+
attribute_map['FMLAT'] = propertyString('access_transformer_locations')
158+
}
159+
attributes(attribute_map)
160+
}
161+
}
162+
if (propertyBool('enable_shadow')) {
163+
finalizedBy(shadowJar)
164+
}
165+
}
166+
167+
tasks.remapJar {
168+
doFirst {
169+
logging.captureStandardOutput LogLevel.INFO
170+
}
171+
doLast {
172+
logging.captureStandardOutput LogLevel.QUIET
173+
}
174+
}
175+
176+
shadowJar {
177+
configurations = [project.configurations.shadow]
178+
archiveClassifier = "shadow"
179+
}
180+
181+
compileTestJava {
182+
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
183+
}
184+
185+
test {
186+
useJUnitPlatform()
187+
javaLauncher.set(javaToolchains.launcherFor {
188+
languageVersion = JavaLanguageVersion.of(21)
189+
})
190+
if (propertyBool('show_testing_output')) {
191+
testLogging {
192+
showStandardStreams = true
193+
}
194+
}
195+
}
196+
197+
String parserChangelog() {
198+
if (!file('CHANGELOG.md').exists()) {
199+
throw new GradleException('publish_with_changelog is true, but CHANGELOG.md does not exist in the workspace!')
200+
}
201+
String parsedChangelog = changelog.renderItem(
202+
changelog.get(propertyString('mod_version')).withHeader(false).withEmptySections(false),
203+
Changelog.OutputType.MARKDOWN)
204+
if (parsedChangelog.isEmpty()) {
205+
throw new GradleException('publish_with_changelog is true, but the changelog for the latest version is empty!')
206+
}
207+
return parsedChangelog
208+
}
209+
210+
def injectTags() {
211+
var target = new File("${rootProject.projectDir}/src/main/java/${root_package.replace('.', '/')}/${mod_id}/Reference.java")
212+
var template = new File("${rootProject.projectDir}/template/Reference.java")
213+
var replaceMap = [$mod_id : mod_id, $mod_name : mod_name, $mod_version : mod_version]
214+
target.withWriter { var writer ->
215+
template.eachLine { var line ->
216+
replaceMap.each {if (line.contains(it.key)) line = line.replace(it.key, it.value)}
217+
writer.write(line + "\n");
218+
}
219+
}
220+
}
221+
222+
tasks.withType(JavaCompile).configureEach {
223+
options.encoding = 'UTF-8'
224+
}
225+
226+
apply from: 'gradle/scripts/publishing.gradle'
227+
apply from: 'gradle/scripts/extra.gradle'

0 commit comments

Comments
 (0)