Skip to content

Commit 016ffbd

Browse files
committed
try to add stonecutter
1 parent 1180666 commit 016ffbd

31 files changed

+555
-689
lines changed

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
<div align="center">
22

33
# MineMark
4+
45
Java Markdown Rendering library
56
</div>
67

78
## Usage
8-
MineMark is build in a modular system, `minemark-core` is the hearth of everything, it is responsible for parsing
9+
10+
MineMark is build in a modular system, `minemark-core` is the hearth of everything, it is responsible for parsing
911
the markdown and generating a layout for it. Then you need a rendering implementation to actually render the markdown.
10-
Currently, there is a Minecraft and Elementa rendering implementation available, but it is relatively easy to create your own if you wish!
12+
Currently, there is a Minecraft and Elementa rendering implementation available, but it is relatively easy to create
13+
your own if you wish!
14+
15+
Adding MineMark as a dependency (latest MineMark
16+
version: ![](https://img.shields.io/badge/dynamic/xml?label=%20&query=/metadata/versioning/versions/version[not(contains(text(),%27%2B%27))][last()]
17+
&url=https://maven.dediamondpro.dev/releases/dev/dediamondpro/minemark-core/maven-metadata.xml)):
1118

12-
Adding MineMark as a dependency (latest MineMark version: ![](https://img.shields.io/badge/dynamic/xml?label=%20&query=/metadata/versioning/versions/version[not(contains(text(),%27%2B%27))][last()]&url=https://maven.dediamondpro.dev/releases/dev/dediamondpro/minemark-core/maven-metadata.xml)):
1319
```kt
1420
repositories {
1521
maven("https://maven.dediamondpro.dev/releases")
@@ -27,23 +33,28 @@ dependencies {
2733
implementation("dev.dediamondpro:minemark-elementa:{version}")
2834
}
2935
```
36+
3037
It is recommended to **shade and relocate MineMark** if you are using it in a Minecraft mod since no guarantees will be
3138
provided regarding backwards compatibility.
3239

3340
## Minecraft rendering implementation
3441

3542
To use the Minecraft rendering implementation you first have to create a markdown drawable like this
43+
3644
```java
3745
MineMarkDrawable markdown = new MineMarkDrawable("This *is* **where** you input your markdown!");
3846
```
47+
3948
Then to render it call the draw method.
49+
4050
```java
4151
markdown.draw(x, y, width, mouseX, mouseY, drawContext);
4252
```
4353

4454
## Elementa rendering implementation
4555

4656
You can create an MineMark elementa component like this, it will act like any other elementa component.
57+
4758
```kt
4859
MineMarkComponent("This *is* **where** you input your markdown!").constrain {
4960
x = 0.pixels()
@@ -54,14 +65,17 @@ MineMarkComponent("This *is* **where** you input your markdown!").constrain {
5465

5566
## Creating your own rendering implementation
5667

57-
To create your own rendering implementation, you first have to implement the rendering of the elements you want to
58-
support. You can choose what elements you implement, the only requirement is that **you have to provide a text element**.
68+
To create your own rendering implementation, you first have to implement the rendering of the elements you want to
69+
support. You can choose what elements you implement, the only requirement is that **you have to provide a text element
70+
**.
5971
To implement an element, you have to extend its abstract form, for an example for each element I would recommend you
6072
look at the elementa implementation as a reference. An element takes 2 type variables, the first one (`S`) is the style,
61-
so you have to create a class that implements the `Style` interface. The second (`R`) can be any class, it is given to your
73+
so you have to create a class that implements the `Style` interface. The second (`R`) can be any class, it is given to
74+
your
6275
elements at render time. If you do not wish to use this you can just set it to be an `Object`.
6376

6477
Once you implemented the elements you want, you have to register them in a core. You can do this as follows:
78+
6579
```java
6680
MineMarkCore<MyStyle, MyRenderObject> core = MineMarkCore.<MyStyle, MyRenderObject>builder()
6781
// Set the text element to your text element
@@ -74,4 +88,5 @@ MineMarkCore<MyStyle, MyRenderObject> core = MineMarkCore.<MyStyle, MyRenderObje
7488
```
7589

7690
Then you have to call `core.parse(myStyle, markdown)` to parse the markdown, this will return a `MineMarkElement`.
77-
This element has a `draw`, `beforeDraw` and `onMouseClick` method that should be called by your rendering implementation.
91+
This element has a `draw`, `beforeDraw` and `onMouseClick` method that should be called by your rendering
92+
implementation.

build.gradle.kts

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import kotlin.system.exitProcess
2+
13
/*
24
* This file is part of MineMark
35
* Copyright (C) 2024 DeDiamondPro
@@ -23,75 +25,73 @@ plugins {
2325
group = "dev.dediamondpro"
2426
version = "1.2.3"
2527

26-
repositories {
27-
mavenCentral()
28-
}
29-
3028
dependencies {
3129
implementation(libs.commonmark)
3230
implementation(libs.tagsoup)
3331
compileOnly(libs.jetbrains.annotations)
3432
}
3533

36-
tasks {
37-
build {
38-
dependsOn(gradle.includedBuild("minecraft").task(":buildAll"))
39-
}
40-
clean {
41-
dependsOn(gradle.includedBuild("minecraft").task(":cleanAll"))
42-
}
43-
publish {
44-
dependsOn(gradle.includedBuild("minecraft").task(":publishAll"))
45-
}
46-
publishToMavenLocal {
47-
dependsOn(gradle.includedBuild("minecraft").task(":publishToMavenLocalAll"))
48-
}
34+
java {
35+
sourceCompatibility = JavaVersion.VERSION_1_8
36+
targetCompatibility = JavaVersion.VERSION_1_8
4937
}
5038

51-
allprojects {
52-
apply(plugin = "java-library")
53-
apply(plugin = "maven-publish")
54-
55-
java {
56-
sourceCompatibility = JavaVersion.VERSION_1_8
57-
targetCompatibility = JavaVersion.VERSION_1_8
58-
withSourcesJar()
59-
withJavadocJar()
60-
}
61-
62-
publishing {
63-
publications {
64-
var name = project.name.lowercase()
65-
name = if (name != "minemark") "minemark-$name" else "minemark-core"
66-
register<MavenPublication>(name) {
67-
groupId = "dev.dediamondpro"
68-
artifactId = name
39+
//tasks {
40+
// register("chiseledBuild") {
41+
// project.subprojects.forEach { subProject ->
42+
// if (!subProject.name.contains("minecraft")) {
43+
// dependsOn(subProject.tasks.named("build"))
44+
// }
45+
// }
46+
// }
47+
//}
6948

70-
from(components["java"])
71-
}
72-
}
73-
repositories {
74-
maven {
75-
name = "diamond"
49+
//allprojects {
50+
// apply(plugin = "java-library")
51+
// apply(plugin = "maven-publish")
52+
//
53+
// java {
54+
// withSourcesJar()
55+
// withJavadocJar()
56+
// }
57+
//
58+
// repositories {
59+
// mavenCentral()
60+
// }
61+
//
62+
// publishing {
63+
// publications {
64+
// var name = project.name.lowercase()
65+
// name = if (name != "minemark") "minemark-$name" else "minemark-core"
66+
// register<MavenPublication>(name) {
67+
// groupId = "dev.dediamondpro"
68+
// artifactId = name
69+
//
70+
// from(components["java"])
71+
// }
72+
// }
73+
// repositories {
74+
// maven {
75+
// name = "diamond"
76+
//
77+
// url = uri("https://maven.dediamondpro.dev/releases")
78+
//
79+
// credentials {
80+
// username = System.getenv("MAVEN_DIAMOND_USER")
81+
// password = System.getenv("MAVEN_DIAMOND_PASSWORD")
82+
// }
83+
//
84+
// version = rootProject.version
85+
// }
86+
// }
87+
// }
88+
//}
7689

77-
url = uri("https://maven.dediamondpro.dev/releases")
78-
79-
credentials {
80-
username = System.getenv("MAVEN_DIAMOND_USER")
81-
password = System.getenv("MAVEN_DIAMOND_PASSWORD")
82-
}
83-
84-
version = rootProject.version
85-
}
86-
}
87-
}
88-
}
89-
90-
subprojects {
91-
dependencies {
92-
api(project.rootProject)
93-
}
94-
}
90+
//subprojects {
91+
// dependencies {
92+
// implementation(project.rootProject)
93+
// }
94+
//}
9595

9696
tasks.test {
9797
useJUnitPlatform()

buildSrc/build.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* This file is part of Resourcify
3+
* Copyright (C) 2025 DeDiamondPro
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License Version 3 as published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
* Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
plugins {
19+
`kotlin-dsl`
20+
}
21+
22+
repositories {
23+
mavenCentral()
24+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* This file is part of MineMark
3+
* Copyright (C) 2025 DeDiamondPro
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License Version 3 as published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
* Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
package dev.dediamondpro.buildsource;
19+
20+
public enum Loader {
21+
FABRIC,
22+
FORGE,
23+
NEOFORGE;
24+
25+
boolean isForgeLike() {
26+
return this == FORGE || this == NEOFORGE;
27+
}
28+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* This file is part of MineMark
3+
* Copyright (C) 2025 DeDiamondPro
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License Version 3 as published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
* Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
package dev.dediamondpro.buildsource;
19+
20+
import org.gradle.api.Project;
21+
22+
import javax.management.openmbean.SimpleType;
23+
24+
public class Platform {
25+
private final int major;
26+
private final int minor;
27+
private final int patch;
28+
private final Loader loader;
29+
private final int version;
30+
31+
public Platform(int major, int minor, int patch, Loader loader) {
32+
this.major = major;
33+
this.minor = minor;
34+
this.patch = patch;
35+
this.loader = loader;
36+
this.version = major * 10_000 + minor * 100 + patch;
37+
}
38+
39+
public int getMajor() {
40+
return major;
41+
}
42+
43+
public int getMinor() {
44+
return minor;
45+
}
46+
47+
public int getPatch() {
48+
return patch;
49+
}
50+
51+
public int getVersion() {
52+
return version;
53+
}
54+
55+
public String getVersionString() {
56+
return major + "." + minor + "." + patch;
57+
}
58+
59+
public Loader getLoader() {
60+
return loader;
61+
}
62+
63+
public String getLoaderString() {
64+
return loader.toString().toLowerCase();
65+
}
66+
67+
public boolean isFabric() {
68+
return loader == Loader.FABRIC;
69+
}
70+
71+
public boolean isForge() {
72+
return loader == Loader.FORGE;
73+
}
74+
75+
public boolean isNeoForge() {
76+
return loader == Loader.NEOFORGE;
77+
}
78+
79+
public boolean isForgeLike() {
80+
return loader.isForgeLike();
81+
}
82+
83+
public String getName() {
84+
return getVersionString() + "-" + loader.toString().toLowerCase();
85+
}
86+
87+
public static Platform fromProject(Project project) {
88+
String[] nameSplit = project.getName().split("-");
89+
String[] versionSplit = nameSplit[0].split("\\.");
90+
int major = Integer.parseInt(versionSplit[0]);
91+
int minor = Integer.parseInt(versionSplit[1]);
92+
int patch = Integer.parseInt(versionSplit[2]);
93+
Loader loader = Loader.valueOf(nameSplit[1].toUpperCase());
94+
return new Platform(major, minor, patch, loader);
95+
}
96+
}

0 commit comments

Comments
 (0)