Skip to content

Commit 3397ad2

Browse files
committed
Major refactor of the ILoot + new gradle
1 parent f215061 commit 3397ad2

Some content is hidden

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

50 files changed

+777
-246
lines changed

.gitattributes

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# These are explicitly windows files and should use crlf
5+
*.bat text eol=crlf
6+
gradlew text eol=lf
7+
* text=auto
8+

.gitignore

+141-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,143 @@
1+
# User specifics
2+
Main.java
3+
Test.java
4+
5+
# Created by https://www.toptal.com/developers/gitignore/api/intellij+all,java,gradle
6+
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,java,gradle
7+
8+
### Intellij+all ###
9+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
10+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
11+
12+
# User-specific stuff
13+
.idea/**/workspace.xml
14+
.idea/**/tasks.xml
15+
.idea/**/usage.statistics.xml
16+
.idea/**/dictionaries
17+
.idea/**/shelf
18+
19+
# Generated files
20+
.idea/**/contentModel.xml
21+
22+
# Sensitive or high-churn files
23+
.idea/**/dataSources/
24+
.idea/**/dataSources.ids
25+
.idea/**/dataSources.local.xml
26+
.idea/**/sqlDataSources.xml
27+
.idea/**/dynamic.xml
28+
.idea/**/uiDesigner.xml
29+
.idea/**/dbnavigator.xml
30+
31+
# Gradle
32+
.idea/**/gradle.xml
33+
.idea/**/libraries
34+
35+
# Gradle and Maven with auto-import
36+
# When using Gradle or Maven with auto-import, you should exclude module files,
37+
# since they will be recreated, and may cause churn. Uncomment if using
38+
# auto-import.
39+
# .idea/artifacts
40+
# .idea/compiler.xml
41+
# .idea/jarRepositories.xml
42+
# .idea/modules.xml
43+
# .idea/*.iml
44+
# .idea/modules
45+
# *.iml
46+
# *.ipr
47+
48+
# CMake
49+
cmake-build-*/
50+
51+
# Mongo Explorer plugin
52+
.idea/**/mongoSettings.xml
53+
54+
# File-based project format
55+
*.iws
56+
57+
# IntelliJ
58+
out/
59+
60+
# mpeltonen/sbt-idea plugin
61+
.idea_modules/
62+
63+
# JIRA plugin
64+
atlassian-ide-plugin.xml
65+
66+
# Cursive Clojure plugin
67+
.idea/replstate.xml
68+
69+
# Crashlytics plugin (for Android Studio and IntelliJ)
70+
com_crashlytics_export_strings.xml
71+
crashlytics.properties
72+
crashlytics-build.properties
73+
fabric.properties
74+
75+
# Editor-based Rest Client
76+
.idea/httpRequests
77+
78+
# Android studio 3.1+ serialized cache file
79+
.idea/caches/build_file_checksums.ser
80+
81+
### Intellij+all Patch ###
82+
# Ignores the whole .idea folder and all .iml files
83+
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
84+
85+
.idea/
86+
87+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
88+
89+
*.iml
90+
modules.xml
91+
.idea/misc.xml
92+
*.ipr
93+
94+
# Sonarlint plugin
95+
.idea/sonarlint
96+
97+
### Java ###
98+
# Compiled class file
99+
*.class
100+
101+
# Log file
102+
*.log
103+
104+
# BlueJ files
105+
*.ctxt
106+
107+
# Mobile Tools for Java (J2ME)
108+
.mtj.tmp/
109+
110+
# Package Files #
111+
*.jar
112+
*.war
113+
*.nar
114+
*.ear
115+
*.zip
116+
*.tar.gz
117+
*.rar
118+
119+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
120+
hs_err_pid*
121+
122+
### Gradle ###
1123
.gradle
2-
.idea
3124
build/
4-
Main.java
125+
126+
# Ignore Gradle GUI config
127+
gradle-app.setting
128+
129+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
130+
!gradle-wrapper.jar
131+
132+
# Cache of project
133+
.gradletasknamecache
134+
135+
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
136+
# gradle/wrapper/gradle-wrapper.properties
137+
138+
### Gradle Patch ###
139+
**/build/
140+
141+
# End of https://www.toptal.com/developers/gitignore/api/intellij+all,java,gradle
142+
# Ignore Gradle build output directory
143+
build

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
The MIT License (MIT)
33

4-
Copyright (c) 2020 KaptainWutax
4+
Copyright (c) 2020 KaptainWutax, Neil
55

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

README.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
StructureUtils
1+
# Feature Utils
2+
3+
A library to provide Structure, Feature placement as well as their generation and respective loot.
4+
5+
A few utilities are also present such as slime chunk, spawnpoint...
6+
7+
Look in the test folder for how to use
8+
9+
## Legal mentions
10+
Licensed under MIT
11+
12+
Maintained by Neil and KaptainWutax.
13+
14+
NOT OFFICIAL MINECRAFT PRODUCT. NOT APPROVED BY OR ASSOCIATED WITH MOJANG.

build.gradle

+92-10
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,46 @@
11
plugins {
2-
id 'java'
2+
id 'java-library'
3+
id 'maven-publish'
4+
id "idea"
5+
id "jacoco"
6+
id 'org.jetbrains.kotlin.jvm' version '1.5.0-RC'
37
}
48

5-
defaultTasks 'clean', 'test'
9+
group = 'com.seedfinding'
10+
archivesBaseName = project.name
11+
12+
defaultTasks 'clean', 'test', 'install'
613

714
java {
815
sourceCompatibility = JavaVersion.VERSION_1_8
916
targetCompatibility = JavaVersion.VERSION_1_8
17+
withJavadocJar()
18+
withSourcesJar()
1019
}
1120

1221
repositories {
1322
mavenCentral()
14-
maven {url "https://jitpack.io"}
23+
maven { url "https://jitpack.io" }
1524
}
1625

1726
dependencies {
1827
implementation('com.github.KaptainWutax:MathUtils:5531c4a87b0f1bb85d1dab2bdd18ce375400626a') { transitive = false }
1928
implementation('com.github.KaptainWutax:SeedUtils:b6a383113ce5d8d09a59e91b28ff064fb97c0709') { transitive = false }
20-
implementation('com.github.KaptainWutax:MCUtils:424f9dd6ed25672c314ab8fd2101f9634f0e2707') { transitive = false }
21-
implementation('com.github.KaptainWutax:NoiseUtils:a3954932b15a889aa51c82176942d62f291c3b12') { transitive = false }
29+
implementation('com.github.KaptainWutax:MCUtils:11e3c70867968877233630797741f6cd47777e41') { transitive = false }
30+
implementation('com.github.KaptainWutax:NoiseUtils:288e1b60e0f427bead80f001d19565ad1adcbd73') { transitive = false }
2231

23-
implementation('com.github.KaptainWutax:BiomeUtils:43cbdbe4319790ecdfde89cc24077e8b3faf215c') {transitive = false}
24-
implementation('com.github.KaptainWutax:TerrainUtils:21b6d72b7798403abf620f736d0f1972daf822ed') {transitive = false}
32+
implementation('com.github.KaptainWutax:BiomeUtils:8588e0eb9f433162fe8744147f56bbbf424f25de') { transitive = false }
33+
implementation('com.github.KaptainWutax:TerrainUtils:322c2405600be7e87ded65f7bc6f2c4f042a5472') { transitive = false }
2534

2635
testImplementation('com.github.KaptainWutax:ChunkRandomReversal:6b76fb5cf2cd438de56e6a46cea2a83985831834') {transitive = false}
27-
testImplementation('org.junit.jupiter:junit-jupiter-api:5.7.1')
28-
testImplementation('org.junit.jupiter:junit-jupiter-params:5.7.1')
36+
37+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
38+
39+
testImplementation("org.junit.jupiter:junit-jupiter-api:${jupiterVersion}")
40+
testImplementation("org.junit.jupiter:junit-jupiter-params:${jupiterVersion}")
2941
testImplementation('org.junit-pioneer:junit-pioneer:1.3.8')
3042

31-
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.7.1')
43+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${jupiterVersion}")
3244
testRuntimeOnly('org.junit.platform:junit-platform-console:1.7.1')
3345
}
3446

@@ -40,6 +52,19 @@ compileTestJava {
4052
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
4153
}
4254

55+
56+
compileKotlin {
57+
kotlinOptions {
58+
jvmTarget = "1.8"
59+
}
60+
}
61+
compileTestKotlin {
62+
kotlinOptions {
63+
jvmTarget = "1.8"
64+
}
65+
}
66+
67+
4368
test {
4469
useJUnitPlatform {
4570
includeEngines("junit-jupiter")
@@ -53,4 +78,61 @@ test {
5378
showCauses true
5479
showStackTraces true
5580
}
81+
finalizedBy(jacocoTestReport)
82+
}
83+
84+
85+
publishing {
86+
publications {
87+
mavenJava(MavenPublication) {
88+
artifactId = "$project.name"
89+
from components.java
90+
versionMapping {
91+
usage('java-api') {
92+
fromResolutionOf('runtimeClasspath')
93+
}
94+
usage('java-runtime') {
95+
fromResolutionResult()
96+
}
97+
}
98+
pom {
99+
name = "$project.name"
100+
description = 'An efficient library to simulate Minecraft Terrain Generation for all dimension'
101+
url = 'http://www.kaptainwutax.seedfinding.com'
102+
licenses {
103+
license {
104+
name = 'MIT License'
105+
url = 'https://opensource.org/licenses/MIT'
106+
}
107+
}
108+
developers {
109+
developer {
110+
id = 'hube12'
111+
name = 'Neil'
112+
}
113+
developer {
114+
id = 'Kap'
115+
name = 'KaptainWutax'
116+
}
117+
}
118+
scm {
119+
connection = 'scm:git:https://github.com/kaptainwutax/TerrainUtils.git'
120+
url = 'https://github.com/kaptainwutax/TerrainUtils.git'
121+
}
122+
}
123+
}
124+
}
125+
repositories {
126+
maven {
127+
def releasesRepoUrl = "https://jitpack.io/com/github/kaptainwutax/terrainutils/latest"
128+
def snapshotsRepoUrl = "https://jitpack.io/com/github/kaptainwutax/terrainutils/snapshots"
129+
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
130+
}
131+
}
132+
}
133+
134+
javadoc {
135+
if (JavaVersion.current().isJava9Compatible()) {
136+
options.addBooleanOption('html5', true)
137+
}
56138
}

gradle.properties

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Done to increase the memory available to gradle.
2+
org.gradle.jvmargs=-Xmx4G
3+
4+
version=1.0.0
5+
6+
jupiterVersion=5.7.1

src/main/java/kaptainwutax/featureutils/Feature.java

+27-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import kaptainwutax.mcutils.rand.ChunkRand;
55
import kaptainwutax.mcutils.state.Dimension;
66
import kaptainwutax.mcutils.version.MCVersion;
7-
import kaptainwutax.terrainutils.ChunkGenerator;
8-
9-
public abstract class Feature<C extends Feature.Config, D extends Feature.Data<?>> {
7+
import kaptainwutax.terrainutils.TerrainGenerator;
108

9+
public abstract class Feature<C extends Feature.Config, D extends Feature.Data<?>> implements GenerationContext {
10+
private Context context = null;
1111
private final C config;
1212
private final MCVersion version;
1313

@@ -26,17 +26,37 @@ public MCVersion getVersion() {
2626

2727
public abstract String getName();
2828

29-
public static String name(){
29+
public static String name() {
3030
return "unknown";
3131
}
3232

3333
public abstract boolean canStart(D data, long structureSeed, ChunkRand rand);
3434

3535
public abstract boolean canSpawn(D data, BiomeSource source);
3636

37-
public abstract boolean canGenerate(D data, ChunkGenerator generator);
37+
public abstract boolean canGenerate(D data, TerrainGenerator generator);
38+
39+
public boolean isValidDimension(Dimension dimension) {
40+
return this.getValidDimension() == dimension;
41+
}
42+
43+
public abstract Dimension getValidDimension();
44+
45+
@Override
46+
public Context getContext(long worldSeed) {
47+
if (this.getContext() == null) {
48+
this.setContext(GenerationContext.super.getContext(worldSeed));
49+
}
50+
return this.getContext();
51+
}
3852

39-
public abstract boolean isValidDimension(Dimension dimension);
53+
public void setContext(Context context) {
54+
this.context = context;
55+
}
56+
57+
public Context getContext() {
58+
return context;
59+
}
4060

4161
public static class Config {
4262

@@ -64,7 +84,7 @@ public boolean testBiome(BiomeSource source) {
6484
}
6585

6686
@SuppressWarnings("unchecked")
67-
public boolean testGenerate(ChunkGenerator generator) {
87+
public boolean testGenerate(TerrainGenerator generator) {
6888
return this.feature.canGenerate(this, generator);
6989
}
7090
}

0 commit comments

Comments
 (0)