-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/refactor/submodules' into dev/1.20.1
- Loading branch information
Showing
59 changed files
with
427 additions
and
950 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package net.smyler.terramap; | ||
|
||
import com.google.gson.Gson; | ||
import net.smyler.terramap.http.HttpClient; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
public interface Terramap { | ||
|
||
static Terramap instance() { | ||
return InstanceHolder.instance; | ||
} | ||
|
||
String MOD_ID = "terramap"; | ||
|
||
Logger logger(); | ||
|
||
HttpClient http(); | ||
|
||
Gson gson(); | ||
|
||
Gson gsonPretty(); | ||
|
||
class InstanceHolder { | ||
private static Terramap instance; | ||
public static void setInstance(Terramap instance) { | ||
instance.logger().info("Setting Terramap instance of class {}", instance.getClass().getName()); | ||
InstanceHolder.instance = instance; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...myler/terramap/files/kml/KmlDocument.java → ...myler/terramap/files/kml/KmlDocument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...yler/terramap/files/kml/KmlPlacemark.java → ...yler/terramap/files/kml/KmlPlacemark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...hesmyler/terramap/files/kml/KmlPoint.java → ...t/smyler/terramap/files/kml/KmlPoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
core/src/main/java/net/smyler/terramap/http/HttpClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package net.smyler.terramap.http; | ||
|
||
import net.smyler.terramap.Terramap; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
/** | ||
* Asynchronous HTTP client abstraction. | ||
* The implementation should focus on implementing | ||
* efficient GET requests with compliant caching. | ||
* Implementations should support cancellation of the CompletableFuture. | ||
* <br> | ||
* Access the singleton from {@link Terramap#http()} | ||
* | ||
* @author Smyler | ||
*/ | ||
public interface HttpClient { | ||
|
||
CompletableFuture<byte[]> get(String url); | ||
|
||
void setMaxConcurrentRequests(String host, int maxConcurrentRequests); | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...smyler/terramap/util/CopyrightHolder.java → ...smyler/terramap/util/CopyrightHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package fr.thesmyler.terramap.util; | ||
package net.smyler.terramap.util; | ||
|
||
import net.smyler.smylib.text.Text; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 37 additions & 4 deletions
41
fabric/src/main/java/net/smyler/terramap/TerramapFabricMod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,53 @@ | ||
package net.smyler.terramap; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.GsonBuilder; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.minecraft.client.Minecraft; | ||
import net.smyler.smylib.SmyLib; | ||
import net.smyler.smylib.game.WrappedMinecraft; | ||
import net.smyler.smylib.json.TextJsonAdapter; | ||
import net.smyler.smylib.text.Text; | ||
import net.smyler.terramap.http.HttpClient; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import static org.apache.logging.log4j.LogManager.getLogger; | ||
|
||
public class TerramapFabricMod implements ModInitializer { | ||
public class TerramapFabricMod implements ModInitializer, Terramap { | ||
|
||
private final Logger logger = getLogger("terramap"); | ||
private final Gson gson = new GsonBuilder() | ||
.registerTypeAdapter(Text.class, new TextJsonAdapter()) | ||
.create(); | ||
private final Gson gsonPretty = new GsonBuilder() | ||
.registerTypeAdapter(Text.class, new TextJsonAdapter()) | ||
.setPrettyPrinting() | ||
.create(); | ||
|
||
public static final Logger LOGGER = getLogger("terramap"); | ||
@Override | ||
public void onInitialize() { | ||
LOGGER.info("Initializing Terramap"); | ||
SmyLib.initializeGameClient(new WrappedMinecraft(Minecraft.getInstance()), LOGGER); | ||
this.logger.info("Initializing Terramap"); | ||
SmyLib.initializeGameClient(new WrappedMinecraft(Minecraft.getInstance()), this.logger); | ||
} | ||
|
||
@Override | ||
public Logger logger() { | ||
return this.logger; | ||
} | ||
|
||
@Override | ||
public HttpClient http() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Gson gson() { | ||
return this.gson; | ||
} | ||
|
||
@Override | ||
public Gson gsonPretty() { | ||
return this.gsonPretty; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.