Skip to content

Commit e870a9e

Browse files
committed
Merge branch 'master' into dev/1.21.11
2 parents 349ce66 + c6eb2f4 commit e870a9e

49 files changed

Lines changed: 990 additions & 166 deletions

File tree

Some content is hidden

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

Jenkinsfile

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
pipeline {
2+
agent any
3+
4+
tools {
5+
jdk "Temurin Java 21"
6+
}
7+
8+
triggers {
9+
githubPush()
10+
}
11+
12+
environment {
13+
DISCORD_WEBHOOK_URL = credentials('polydev-discord-webhook-url')
14+
}
15+
16+
stages {
17+
stage('Checkout') {
18+
steps {
19+
scmSkip(deleteBuild: true)
20+
}
21+
}
22+
23+
stage('Setup Gradle') {
24+
steps {
25+
sh 'chmod +x gradlew'
26+
}
27+
}
28+
29+
stage('Build') {
30+
steps {
31+
withGradle {
32+
sh './gradlew build --rerun-tasks -x check'
33+
sh './gradlew javadoc'
34+
}
35+
}
36+
37+
post {
38+
success {
39+
archiveArtifacts artifacts: 'platforms/fabric/build/libs/Terra-fabric*.jar,platforms/bukkit/build/libs/Terra-bukkit*-shaded.jar,platforms/allay/build/libs/Terra-allay*.jar,platforms/minestom/build/libs/Terra-minestom*.jar', fingerprint: true, onlyIfSuccessful: true
40+
41+
javadoc javadocDir: 'common/api/build/docs/javadoc', keepAll: true
42+
}
43+
}
44+
}
45+
46+
stage('Tests') {
47+
steps {
48+
withGradle {
49+
sh './gradlew test --rerun-tasks'
50+
}
51+
}
52+
}
53+
54+
// stage('Deploy to snapshots repositories') {
55+
// when {
56+
// allOf {
57+
// not { buildingTag() }
58+
// not { expression { env.TAG_NAME != null && env.TAG_NAME.matches('v\\d+\\.\\d+\\.\\d+') } }
59+
// }
60+
// }
61+
//
62+
// steps {
63+
// withCredentials([
64+
// string(credentialsId: 'maven-signing-key', variable: 'ORG_GRADLE_PROJECT_signingKey'),
65+
// string(credentialsId: 'maven-signing-key-password', variable: 'ORG_GRADLE_PROJECT_signingPassword'),
66+
// usernamePassword(
67+
// credentialsId: 'solo-studios-maven',
68+
// passwordVariable: 'ORG_GRADLE_PROJECT_SoloStudiosSnapshotsPassword',
69+
// usernameVariable: 'ORG_GRADLE_PROJECT_SoloStudiosSnapshotsUsername'
70+
// )
71+
// ]) {
72+
// withGradle {
73+
// sh './gradlew publishAllPublicationsToSoloStudiosSnapshotsRepository'
74+
// }
75+
// }
76+
// }
77+
// }
78+
79+
stage('Deploy to releases repositories') {
80+
// when {
81+
// allOf {
82+
// buildingTag()
83+
// expression { env.TAG_NAME != null && env.TAG_NAME.matches('v\\d+\\.\\d+\\.\\d+') }
84+
// }
85+
// }
86+
87+
steps {
88+
withCredentials([
89+
string(credentialsId: 'maven-signing-key', variable: 'ORG_GRADLE_PROJECT_signingKey'),
90+
string(credentialsId: 'maven-signing-key-password', variable: 'ORG_GRADLE_PROJECT_signingPassword'),
91+
usernamePassword(
92+
credentialsId: 'solo-studios-maven',
93+
passwordVariable: 'ORG_GRADLE_PROJECT_SoloStudiosReleasesPassword',
94+
usernameVariable: 'ORG_GRADLE_PROJECT_SoloStudiosReleasesUsername'
95+
),
96+
// TODO: does not yet exist (uncomment once added)
97+
// usernamePassword(
98+
// credentialsId: 'sonatype-maven-credentials',
99+
// passwordVariable: 'ORG_GRADLE_PROJECT_SonatypePassword',
100+
// usernameVariable: 'ORG_GRADLE_PROJECT_SonatypeUsername'
101+
// ),
102+
// usernamePassword(
103+
// credentialsId: 'codemc-maven-credentials',
104+
// passwordVariable: 'ORG_GRADLE_PROJECT_CodeMCPassword',
105+
// usernameVariable: 'ORG_GRADLE_PROJECT_CodeMCUsername'
106+
// )
107+
]) {
108+
withGradle {
109+
sh './gradlew publish'
110+
//sh './gradlew publishAllPublicationsToSoloStudiosReleasesRepository'
111+
// sh './gradlew publishAllPublicationsToSonatypeRepository'
112+
// sh './gradlew publishAllPublicationsToCodeMCRepository'
113+
}
114+
}
115+
}
116+
}
117+
}
118+
119+
post {
120+
always {
121+
discoverReferenceBuild()
122+
123+
// junit testResults: '**/build/test-results/*/TEST-*.xml'
124+
125+
recordIssues(
126+
aggregatingResults: true,
127+
enabledForFailure: true,
128+
minimumSeverity: 'ERROR',
129+
sourceCodeEncoding: 'UTF-8',
130+
checksAnnotationScope: 'ALL',
131+
sourceCodeRetention: 'LAST_BUILD',
132+
tools: [java(), javaDoc()]
133+
)
134+
135+
discordSend(
136+
title: env.JOB_NAME + ' ' + env.BUILD_DISPLAY_NAME,
137+
showChangeset: true,
138+
enableArtifactsList: true,
139+
link: env.BUILD_URL,
140+
result: currentBuild.currentResult,
141+
customAvatarUrl: 'https://github.com/PolyhedralDev.png',
142+
customUsername: 'Solo Studios Jenkins',
143+
webhookURL: env.DISCORD_WEBHOOK_URL,
144+
)
145+
146+
cleanWs()
147+
}
148+
}
149+
}

buildSrc/src/main/kotlin/CompilationConfig.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import org.gradle.kotlin.dsl.getByName
1313
import org.gradle.kotlin.dsl.register
1414
import org.gradle.kotlin.dsl.withType
1515
import org.gradle.language.jvm.tasks.ProcessResources
16+
import org.gradle.plugins.ide.idea.model.IdeaModel
1617

1718
fun Project.configureCompilation() {
1819
apply(plugin = "maven-publish")
@@ -21,6 +22,13 @@ fun Project.configureCompilation() {
2122
apply(plugin = "idea")
2223
apply<TectonicDocPlugin>()
2324

25+
configure<IdeaModel> {
26+
module {
27+
isDownloadJavadoc = true
28+
isDownloadSources = true
29+
}
30+
}
31+
2432
configure<JavaPluginExtension> {
2533
sourceCompatibility = JavaVersion.VERSION_21
2634
targetCompatibility = JavaVersion.VERSION_21

buildSrc/src/main/kotlin/PublishingConfig.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ fun Project.configurePublishing() {
1616
}
1717

1818
repositories {
19-
val mavenUrl = "https://repo.codemc.io/repository/maven-releases/"
19+
val mavenUrl = "https://maven.solo-studios.ca/releases/"
2020
//val mavenSnapshotUrl = "https://repo.codemc.io/repository/maven-snapshots/"
2121

2222
maven(mavenUrl) {
23-
val mavenUsername: String? by project
24-
val mavenPassword: String? by project
25-
if (mavenUsername != null && mavenPassword != null) {
23+
val SoloStudiosReleasesUsername: String? by project
24+
val SoloStudiosReleasesPassword: String? by project
25+
26+
if (SoloStudiosReleasesUsername != null && SoloStudiosReleasesPassword != null) {
2627
credentials {
27-
username = mavenUsername
28-
password = mavenPassword
28+
username = SoloStudiosReleasesUsername
29+
password = SoloStudiosReleasesPassword
2930
}
3031
}
3132
}

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object Versions {
1010
const val tectonic = "4.3.1"
1111
const val paralithic = "2.0.1"
1212
const val strata = "1.3.2"
13-
const val seismic = "2.3.0"
13+
const val seismic = "2.5.7"
1414

1515
const val cloud = "2.0.0"
1616

common/addons/biome-provider-extrusion/src/main/java/com/dfsek/terra/addons/biome/extrusion/BaseBiomeColumn.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ public int getZ() {
4646

4747
@Override
4848
public Biome get(int y) {
49-
return biomeProvider.extrude(base, x, y, z, seed);
49+
return biomeProvider.pipeline.extrude(base, x, y, z, seed);
5050
}
5151
}

common/addons/biome-provider-extrusion/src/main/java/com/dfsek/terra/addons/biome/extrusion/BiomeExtrusionProvider.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,33 @@
66
import java.util.stream.Collectors;
77

88
import com.dfsek.terra.addons.biome.extrusion.api.Extrusion;
9+
import com.dfsek.terra.addons.biome.extrusion.utils.ExtrusionPipeline;
10+
import com.dfsek.terra.addons.biome.extrusion.utils.ExtrusionPipelineFactory;
911
import com.dfsek.terra.api.util.Column;
1012
import com.dfsek.terra.api.world.biome.Biome;
1113
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
1214

1315

1416
public class BiomeExtrusionProvider implements BiomeProvider {
17+
public final ExtrusionPipeline pipeline;
1518
private final BiomeProvider delegate;
1619
private final Set<Biome> biomes;
17-
private final Extrusion[] extrusions;
1820
private final int resolution;
1921

2022
public BiomeExtrusionProvider(BiomeProvider delegate, List<Extrusion> extrusions, int resolution) {
2123
this.delegate = delegate;
2224
this.biomes = delegate.stream().collect(Collectors.toSet());
2325
extrusions.forEach(e -> biomes.addAll(e.getBiomes()));
24-
this.extrusions = extrusions.toArray(new Extrusion[0]);
26+
27+
this.pipeline = ExtrusionPipelineFactory.create(extrusions);
28+
2529
this.resolution = resolution;
2630
}
2731

2832
@Override
2933
public Biome getBiome(int x, int y, int z, long seed) {
3034
Biome delegated = delegate.getBiome(x, y, z, seed);
31-
32-
return extrude(delegated, x, y, z, seed);
33-
}
34-
35-
public Biome extrude(Biome original, int x, int y, int z, long seed) {
36-
for(int i = 0; i < extrusions.length; i++) {
37-
original = extrusions[i].extrude(original, x, y, z, seed);
38-
}
39-
return original;
35+
return pipeline.extrude(delegated, x, y, z, seed);
4036
}
4137

4238
@Override
@@ -64,4 +60,4 @@ public int resolution() {
6460
public BiomeProvider getDelegate() {
6561
return delegate;
6662
}
67-
}
63+
}

common/addons/biome-provider-extrusion/src/main/java/com/dfsek/terra/addons/biome/extrusion/extrusions/ReplaceExtrusion.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.dfsek.terra.addons.biome.extrusion.api.ReplaceableBiome;
1111
import com.dfsek.terra.addons.biome.query.api.BiomeQueries;
1212
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
13+
import com.dfsek.terra.api.util.collection.TriStateIntCache;
1314
import com.dfsek.terra.api.util.range.Range;
1415
import com.dfsek.terra.api.world.biome.Biome;
1516

@@ -19,25 +20,41 @@
1920
*/
2021
public class ReplaceExtrusion implements Extrusion {
2122
private final Sampler sampler;
22-
2323
private final Range range;
24-
2524
private final ProbabilityCollection<ReplaceableBiome> biomes;
26-
2725
private final Predicate<Biome> hasTag;
26+
private final TriStateIntCache cache;
2827

2928
public ReplaceExtrusion(Sampler sampler, Range range, ProbabilityCollection<ReplaceableBiome> biomes, String tag) {
3029
this.sampler = sampler;
3130
this.range = range;
3231
this.biomes = biomes;
3332
this.hasTag = BiomeQueries.has(tag);
33+
this.cache = new TriStateIntCache(Biome.INT_ID_COUNTER.get());
3434
}
3535

3636
@Override
3737
public Biome extrude(Biome original, int x, int y, int z, long seed) {
38-
if(hasTag.test(original)) {
39-
return range.ifInRange(y, () -> biomes.get(sampler, x, y, z, seed).get(original), original);
38+
int id = original.getIntID();
39+
40+
long state = cache.get(id);
41+
boolean passes;
42+
43+
if(state == TriStateIntCache.STATE_UNSET) {
44+
// Only run the test if unset in cache
45+
passes = hasTag.test(original);
46+
cache.set(id, passes);
47+
} else {
48+
// Read the primitive long directly
49+
passes = (state == TriStateIntCache.STATE_TRUE);
50+
}
51+
52+
if(passes) {
53+
if(range.isInRange(y)) {
54+
return biomes.get(sampler, x, y, z, seed).get(original);
55+
}
4056
}
57+
4158
return original;
4259
}
4360

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.dfsek.terra.addons.biome.extrusion.utils;
2+
3+
import com.dfsek.terra.api.world.biome.Biome;
4+
5+
6+
public interface ExtrusionPipeline {
7+
Biome extrude(Biome original, int x, int y, int z, long seed);
8+
}

0 commit comments

Comments
 (0)