Skip to content

Commit e5cc8ef

Browse files
committed
Merge remote-tracking branch 'origin/1.19.4' into 1.20
2 parents a7e5147 + af63a6c commit e5cc8ef

File tree

7 files changed

+113
-73
lines changed

7 files changed

+113
-73
lines changed

build.gradle

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
id "maven-publish"
55
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
66
id 'com.palantir.git-version' version '1.0.0'
7+
id 'org.ajoberstar.grgit' version '5.2.0'
78
id 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' version '1.79.0'
89
id "com.modrinth.minotaur" version "2.+" apply false
910
id("com.diffplug.spotless") version "6.18.0" apply false
@@ -35,7 +36,7 @@ allprojects {
3536
plusIndex = details.lastTag.length()
3637
}
3738
def baseVersion = details.lastTag.substring(0, plusIndex)
38-
def dirtyMarker = details.isCleanTag ? "" : ".dirty"
39+
def dirtyMarker = grgit.status().clean ? "" : ".dirty"
3940
def commitHashMarker = details.commitDistance > 0 ? ("." + details.gitHash) : ""
4041
def preMarker = (details.commitDistance > 0 || !details.isCleanTag) ? ("-beta." + details.commitDistance) : ""
4142
def versionString = "${baseVersion}${preMarker}+mc${minecraft_version}${commitHashMarker}${dirtyMarker}"
@@ -184,3 +185,43 @@ tasks.register('checkCleanTag') {
184185
}
185186
}
186187
}
188+
189+
configure(subprojects.findAll {it.name == "forge" || it.name == "fabric"}) {
190+
apply plugin: 'com.matthewprenger.cursegradle'
191+
apply plugin: 'com.modrinth.minotaur'
192+
193+
def isBeta = project.version.toString().contains("beta")
194+
195+
curseforge {
196+
if (System.getenv("CURSEFORGE_TOKEN") != null) {
197+
apiKey = System.getenv("CURSEFORGE_TOKEN")
198+
project {
199+
id = "790626"
200+
changelog = file('../CHANGELOG.md')
201+
changelogType = "markdown"
202+
releaseType = isBeta ? "beta" : "release"
203+
addGameVersion project.name.capitalize()
204+
gameVersionStrings.addAll(supported_minecraft_versions.tokenize(","))
205+
mainArtifact remapJar
206+
}
207+
}
208+
}
209+
210+
modrinth {
211+
token = System.getenv("MODRINTH_TOKEN")
212+
projectId = "modernfix" // This can be the project ID or the slug. Either will work!
213+
versionType = isBeta ? "beta" : "release" // This is the default -- can also be `beta` or `alpha`
214+
uploadFile = remapJar
215+
gameVersions = supported_minecraft_versions.tokenize(",")
216+
loaders = [project.name]
217+
changelog.set(provider { file("CHANGELOG.md").getText('UTF-8') })
218+
}
219+
220+
tasks.curseforge.dependsOn(rootProject.generateChangelog)
221+
tasks.modrinth.dependsOn(rootProject.generateChangelog)
222+
223+
tasks.register('publishToModSites') {
224+
publishToModSites.dependsOn(tasks.modrinth)
225+
publishToModSites.dependsOn(tasks.curseforge)
226+
}
227+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package org.embeddedt.modernfix.tickables;
2+
3+
import org.jetbrains.annotations.Nullable;
4+
5+
import java.util.function.Consumer;
6+
import java.util.function.Supplier;
7+
8+
public class LoadableTickableObject<T> implements TickableObject {
9+
private volatile int ticksInactive = 0;
10+
private final int timeout;
11+
private final Supplier<T> loader;
12+
private final Consumer<T> finalizer;
13+
private volatile T theObject = null;
14+
15+
public LoadableTickableObject(int timeout, Supplier<T> loader, Consumer<T> finalizer) {
16+
this(timeout, loader, finalizer, null);
17+
}
18+
19+
public LoadableTickableObject(int timeout, Supplier<T> loader, Consumer<T> finalizer, @Nullable T initialValue) {
20+
this.timeout = timeout;
21+
this.loader = loader;
22+
this.finalizer = finalizer;
23+
this.theObject = initialValue;
24+
}
25+
26+
public T get() {
27+
synchronized (this) {
28+
ticksInactive++;
29+
T obj = theObject;
30+
if(obj == null) {
31+
obj = loader.get();
32+
theObject = obj;
33+
}
34+
return obj;
35+
}
36+
}
37+
38+
public final void tick() {
39+
synchronized (this) {
40+
ticksInactive++;
41+
if(ticksInactive >= this.timeout) {
42+
finalizer.accept(theObject);
43+
theObject = null;
44+
}
45+
}
46+
}
47+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.embeddedt.modernfix.tickables;
2+
3+
public interface TickableObject {
4+
void tick();
5+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.embeddedt.modernfix.tickables;
2+
3+
import java.util.List;
4+
import java.util.concurrent.CopyOnWriteArrayList;
5+
6+
public class TickableObjectManager {
7+
private static final List<TickableObject> TICKABLE_OBJECT_LIST = new CopyOnWriteArrayList<>();
8+
9+
public static void register(TickableObject object) {
10+
TICKABLE_OBJECT_LIST.add(object);
11+
}
12+
13+
public static void runTick() {
14+
for(TickableObject o : TICKABLE_OBJECT_LIST) {
15+
o.tick();
16+
}
17+
}
18+
}

fabric/build.gradle

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ plugins {
22
id "com.github.johnrengelman.shadow" version "7.1.2"
33
}
44

5-
apply plugin: 'com.matthewprenger.cursegradle'
6-
apply plugin: 'com.modrinth.minotaur'
7-
85
architectury {
96
platformSetupLoomIde()
107
fabric()
@@ -96,37 +93,4 @@ publishing {
9693
repositories {
9794
// Add repositories to publish to here.
9895
}
99-
}
100-
101-
curseforge {
102-
if (System.getenv("CURSEFORGE_TOKEN") != null) {
103-
apiKey = System.getenv("CURSEFORGE_TOKEN")
104-
project {
105-
id = "790626"
106-
changelog = file('../CHANGELOG.md')
107-
changelogType = "markdown"
108-
releaseType = "beta"
109-
addGameVersion "Fabric"
110-
addGameVersion minecraft_version
111-
mainArtifact remapJar
112-
}
113-
}
114-
}
115-
116-
modrinth {
117-
token = System.getenv("MODRINTH_TOKEN")
118-
projectId = "modernfix" // This can be the project ID or the slug. Either will work!
119-
versionType = "beta" // This is the default -- can also be `beta` or `alpha`
120-
uploadFile = remapJar
121-
gameVersions = [minecraft_version]
122-
loaders = ["fabric"]
123-
changelog.set(provider { file("../CHANGELOG.md").getText('UTF-8') })
124-
}
125-
126-
tasks.curseforge.dependsOn(rootProject.generateChangelog)
127-
tasks.modrinth.dependsOn(rootProject.generateChangelog)
128-
129-
tasks.register('publishToModSites') {
130-
publishToModSites.dependsOn(tasks.modrinth)
131-
publishToModSites.dependsOn(tasks.curseforge)
13296
}

forge/build.gradle

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ plugins {
22
id "com.github.johnrengelman.shadow" version "7.1.2"
33
}
44

5-
apply plugin: 'com.matthewprenger.cursegradle'
6-
apply plugin: 'com.modrinth.minotaur'
7-
85
architectury {
96
platformSetupLoomIde()
107
forge()
@@ -114,37 +111,4 @@ publishing {
114111
repositories {
115112
// Add repositories to publish to here.
116113
}
117-
}
118-
119-
curseforge {
120-
if (System.getenv("CURSEFORGE_TOKEN") != null) {
121-
apiKey = System.getenv("CURSEFORGE_TOKEN")
122-
project {
123-
id = "790626"
124-
changelog = file('../CHANGELOG.md')
125-
changelogType = "markdown"
126-
releaseType = "release"
127-
addGameVersion "Forge"
128-
addGameVersion minecraft_version
129-
mainArtifact remapJar
130-
}
131-
}
132-
}
133-
134-
modrinth {
135-
token = System.getenv("MODRINTH_TOKEN")
136-
projectId = "modernfix" // This can be the project ID or the slug. Either will work!
137-
versionType = "release" // This is the default -- can also be `beta` or `alpha`
138-
uploadFile = remapJar
139-
gameVersions = [minecraft_version]
140-
loaders = ["forge"]
141-
changelog.set(provider { file("../CHANGELOG.md").getText('UTF-8') })
142-
}
143-
144-
tasks.curseforge.dependsOn(rootProject.generateChangelog)
145-
tasks.modrinth.dependsOn(rootProject.generateChangelog)
146-
147-
tasks.register('publishToModSites') {
148-
publishToModSites.dependsOn(tasks.modrinth)
149-
publishToModSites.dependsOn(tasks.curseforge)
150114
}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ rei_version=11.0.597
1212
ctm_version=1.19.2-1.1.7+11
1313
kubejs_version=1902.6.0-build.142
1414
rhino_version=1902.2.2-build.268
15+
supported_minecraft_versions=1.19.4
1516

1617
fabric_loader_version=0.14.21
1718
fabric_api_version=0.83.0+1.20

0 commit comments

Comments
 (0)