mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-14 03:36:03 +00:00
Update libs and use libs.versions.toml for dep management
This commit is contained in:
@@ -3,32 +3,20 @@ plugins {
|
||||
kotlin("jvm") version embeddedKotlinVersion
|
||||
}
|
||||
|
||||
buildscript {
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force("org.ow2.asm:asm:9.3") // TODO: remove when ShadowJar updates ASM version
|
||||
force("org.ow2.asm:asm-commons:9.3")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://repo.codemc.org/repository/maven-public") {
|
||||
name = "CodeMC"
|
||||
}
|
||||
maven("https://papermc.io/repo/repository/maven-public/") {
|
||||
name = "PaperMC"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:+")
|
||||
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.3.5")
|
||||
implementation(libs.libraries.internal.shadow)
|
||||
|
||||
|
||||
implementation("org.ow2.asm:asm:9.3")
|
||||
implementation("org.ow2.asm:asm-tree:9.3")
|
||||
implementation("com.dfsek.tectonic:common:4.2.0")
|
||||
implementation("org.yaml:snakeyaml:1.27")
|
||||
implementation(libs.libraries.internal.asm)
|
||||
implementation(libs.libraries.internal.asm.tree)
|
||||
implementation(libs.libraries.tectonic)
|
||||
implementation(libs.libraries.snakeyaml)
|
||||
}
|
||||
7
buildSrc/settings.gradle.kts
Normal file
7
buildSrc/settings.gradle.kts
Normal file
@@ -0,0 +1,7 @@
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import org.gradle.kotlin.dsl.getValue
|
||||
import org.gradle.kotlin.dsl.getting
|
||||
import org.gradle.kotlin.dsl.maven
|
||||
import org.gradle.kotlin.dsl.repositories
|
||||
import org.gradle.api.artifacts.VersionCatalog
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
|
||||
fun Project.configureDependencies() {
|
||||
val testImplementation by configurations.getting
|
||||
@@ -15,6 +17,8 @@ fun Project.configureDependencies() {
|
||||
|
||||
val shaded by configurations.creating
|
||||
|
||||
val libs = rootProject.project.versionCatalogs.libs
|
||||
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val shadedApi by configurations.creating {
|
||||
shaded.extendsFrom(this)
|
||||
@@ -48,14 +52,17 @@ fun Project.configureDependencies() {
|
||||
maven("https://jitpack.io") {
|
||||
name = "JitPack"
|
||||
}
|
||||
maven("Modrinth") {
|
||||
url = uri("https://api.modrinth.com/maven")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.7.0")
|
||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||
|
||||
compileOnly("com.google.guava:guava:30.0-jre")
|
||||
testImplementation("com.google.guava:guava:30.0-jre")
|
||||
testImplementation(libs.findLibrary("libraries.internal.junit.jupiter.api").get())
|
||||
testImplementation(libs.findLibrary("libraries.internal.junit.jupiter.engine").get())
|
||||
compileOnly(libs.findLibrary("libraries.internal.jetbrains.annotations").get())
|
||||
|
||||
compileOnly(libs.findLibrary("libraries.guava").get())
|
||||
testImplementation(libs.findLibrary("libraries.guava").get())
|
||||
}
|
||||
}
|
||||
12
buildSrc/src/main/kotlin/Helper.kt
Normal file
12
buildSrc/src/main/kotlin/Helper.kt
Normal file
@@ -0,0 +1,12 @@
|
||||
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||
import org.gradle.api.artifacts.VersionCatalog
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.*
|
||||
|
||||
internal
|
||||
val Project.versionCatalogs: VersionCatalogsExtension
|
||||
get() = the<VersionCatalogsExtension>()
|
||||
|
||||
internal
|
||||
val VersionCatalogsExtension.libs: VersionCatalog
|
||||
get() = named("libs")
|
||||
@@ -1,72 +0,0 @@
|
||||
object Versions {
|
||||
object Libraries {
|
||||
const val tectonic = "4.2.0"
|
||||
const val paralithic = "0.7.0"
|
||||
const val strata = "1.1.1"
|
||||
|
||||
const val cloud = "1.7.0"
|
||||
|
||||
const val slf4j = "1.7.36"
|
||||
const val log4j_slf4j_impl = "2.14.1"
|
||||
|
||||
const val caffeine = "3.1.0"
|
||||
const val vavr = "0.10.4"
|
||||
|
||||
object Internal {
|
||||
const val apacheText = "1.9"
|
||||
const val jafama = "2.3.2"
|
||||
const val apacheIO = "2.6"
|
||||
const val fastutil = "8.5.6"
|
||||
}
|
||||
}
|
||||
|
||||
object Fabric {
|
||||
const val fabricLoader = "0.14.8"
|
||||
const val fabricAPI = "0.57.0+1.19"
|
||||
}
|
||||
|
||||
object Quilt {
|
||||
const val quiltLoader = "0.17.0"
|
||||
const val fabricApi = "2.0.0-beta.4+0.57.0-1.19"
|
||||
}
|
||||
|
||||
object Mod {
|
||||
const val mixin = "0.11.2+mixin.0.8.5"
|
||||
|
||||
const val minecraft = "1.19"
|
||||
const val yarn = "$minecraft+build.1"
|
||||
const val fabricLoader = "0.14.2"
|
||||
|
||||
const val architecuryLoom = "0.12.0.290"
|
||||
const val architecturyPlugin = "3.4-SNAPSHOT"
|
||||
|
||||
const val loomQuiltflower = "1.7.1"
|
||||
|
||||
const val lazyDfu = "0.1.2"
|
||||
}
|
||||
|
||||
object Forge {
|
||||
const val forge = "${Mod.minecraft}-41.0.63"
|
||||
const val burningwave = "12.53.0"
|
||||
}
|
||||
|
||||
object Bukkit {
|
||||
const val paper = "1.18.2-R0.1-SNAPSHOT"
|
||||
const val paperLib = "1.0.5"
|
||||
const val minecraft = "1.19"
|
||||
const val reflectionRemapper = "0.1.0-SNAPSHOT"
|
||||
}
|
||||
|
||||
object Sponge {
|
||||
const val sponge = "9.0.0-SNAPSHOT"
|
||||
const val mixin = "0.8.2"
|
||||
const val minecraft = "1.17.1"
|
||||
}
|
||||
|
||||
object CLI {
|
||||
const val nbt = "6.1"
|
||||
const val logback = "1.2.9"
|
||||
const val commonsIO = "2.7"
|
||||
const val guava = "31.0.1-jre"
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,4 @@ version = version("1.0.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
}
|
||||
|
||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
||||
relocate("net.jafama", "com.dfsek.terra.addons.biome.image.lib.jafama")
|
||||
}
|
||||
@@ -2,11 +2,4 @@ version = version("1.0.1")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
}
|
||||
|
||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
||||
relocate("net.jafama", "com.dfsek.terra.addons.biome.pipeline.lib.jafama")
|
||||
}
|
||||
@@ -2,11 +2,4 @@ version = version("1.1.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
}
|
||||
|
||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
||||
relocate("net.jafama", "com.dfsek.terra.addons.chunkgenerator.lib.jafama")
|
||||
}
|
||||
|
||||
@@ -2,11 +2,4 @@ version = version("1.0.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
}
|
||||
|
||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
||||
relocate("net.jafama", "com.dfsek.terra.addons.feature.distributor.lib.jafama")
|
||||
}
|
||||
@@ -2,10 +2,4 @@ version = version("1.0.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
}
|
||||
|
||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
||||
relocate("net.jafama", "com.dfsek.terra.addons.flora.lib.jafama")
|
||||
}
|
||||
|
||||
@@ -2,11 +2,4 @@ version = version("1.1.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
}
|
||||
|
||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
||||
relocate("net.jafama", "com.dfsek.terra.addons.feature.locator.lib.jafama")
|
||||
}
|
||||
|
||||
@@ -4,13 +4,4 @@ version = version("1.0.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
api("com.dfsek", "paralithic", Versions.Libraries.paralithic)
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
}
|
||||
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
relocate("com.dfsek.paralithic", "com.dfsek.terra.addons.noise.lib.paralithic")
|
||||
relocate("net.jafama", "com.dfsek.terra.addons.noise.lib.jafama")
|
||||
}
|
||||
@@ -2,11 +2,5 @@ version = version("1.0.0")
|
||||
|
||||
dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
compileOnlyApi(project(":common:addons:config-noise-function"))
|
||||
}
|
||||
|
||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
||||
relocate("net.jafama", "com.dfsek.terra.addons.ore.lib.jafama")
|
||||
}
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
version = version("1.0.0")
|
||||
|
||||
dependencies {
|
||||
api("com.googlecode.json-simple:json-simple:1.1.1")
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
}
|
||||
|
||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
||||
relocate("net.jafama", "com.dfsek.terra.addons.structure.lib.jafama")
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Polyhedral Development
|
||||
*
|
||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in this module's root directory.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.addons.structure.structures.loot;
|
||||
|
||||
import net.jafama.FastMath;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.random.RandomGenerator;
|
||||
|
||||
import com.dfsek.terra.addons.structure.structures.loot.functions.AmountFunction;
|
||||
import com.dfsek.terra.addons.structure.structures.loot.functions.DamageFunction;
|
||||
import com.dfsek.terra.addons.structure.structures.loot.functions.EnchantFunction;
|
||||
import com.dfsek.terra.addons.structure.structures.loot.functions.LootFunction;
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.inventory.Item;
|
||||
import com.dfsek.terra.api.inventory.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a single item entry within a Loot Table pool.
|
||||
*/
|
||||
public class Entry {
|
||||
private final Item item;
|
||||
private final long weight;
|
||||
private final List<LootFunction> functions = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Instantiates an Entry from a JSON representation.
|
||||
*
|
||||
* @param entry The JSON Object to instantiate from.
|
||||
*/
|
||||
public Entry(JSONObject entry, Platform platform) {
|
||||
String id = entry.get("name").toString();
|
||||
this.item = platform.getItemHandle().createItem(id);
|
||||
|
||||
long weight1;
|
||||
try {
|
||||
weight1 = (long) entry.get("weight");
|
||||
} catch(NullPointerException e) {
|
||||
weight1 = 1;
|
||||
}
|
||||
|
||||
this.weight = weight1;
|
||||
if(entry.containsKey("functions")) {
|
||||
for(Object function : (JSONArray) entry.get("functions")) {
|
||||
switch(((String) ((JSONObject) function).get("function"))) {
|
||||
case "minecraft:set_count", "set_count" -> {
|
||||
Object loot = ((JSONObject) function).get("count");
|
||||
long max, min;
|
||||
if(loot instanceof Long) {
|
||||
max = (Long) loot;
|
||||
min = (Long) loot;
|
||||
} else {
|
||||
max = (long) ((JSONObject) loot).get("max");
|
||||
min = (long) ((JSONObject) loot).get("min");
|
||||
}
|
||||
functions.add(new AmountFunction(FastMath.toIntExact(min), FastMath.toIntExact(max)));
|
||||
}
|
||||
case "minecraft:set_damage", "set_damage" -> {
|
||||
long maxDamage = (long) ((JSONObject) ((JSONObject) function).get("damage")).get("max");
|
||||
long minDamage = (long) ((JSONObject) ((JSONObject) function).get("damage")).get("min");
|
||||
functions.add(new DamageFunction(FastMath.toIntExact(minDamage), FastMath.toIntExact(maxDamage)));
|
||||
}
|
||||
case "minecraft:enchant_with_levels", "enchant_with_levels" -> {
|
||||
long maxEnchant = (long) ((JSONObject) ((JSONObject) function).get("levels")).get("max");
|
||||
long minEnchant = (long) ((JSONObject) ((JSONObject) function).get("levels")).get("min");
|
||||
JSONArray disabled = null;
|
||||
if(((JSONObject) function).containsKey("disabled_enchants"))
|
||||
disabled = (JSONArray) ((JSONObject) function).get("disabled_enchants");
|
||||
functions.add(
|
||||
new EnchantFunction(FastMath.toIntExact(minEnchant), FastMath.toIntExact(maxEnchant), disabled, platform));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a single ItemStack from the Entry, applying all functions to it.
|
||||
*
|
||||
* @param r The RandomGenerator instance to apply functions with
|
||||
*
|
||||
* @return ItemStack - The ItemStack with all functions applied.
|
||||
*/
|
||||
public ItemStack getItem(RandomGenerator r) {
|
||||
ItemStack item = this.item.newItemStack(1);
|
||||
for(LootFunction f : functions) {
|
||||
item = f.apply(item, r);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the weight attribute of the Entry.
|
||||
*
|
||||
* @return long - The weight of the Entry.
|
||||
*/
|
||||
public long getWeight() {
|
||||
return this.weight;
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Polyhedral Development
|
||||
*
|
||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in this module's root directory.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.addons.structure.structures.loot;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.random.RandomGenerator;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.inventory.Inventory;
|
||||
import com.dfsek.terra.api.inventory.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* Class representation of a Loot Table to populate chest loot.
|
||||
*/
|
||||
public class LootTableImpl implements com.dfsek.terra.api.structure.LootTable {
|
||||
private final List<Pool> pools = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Instantiates a LootTable from a JSON String.
|
||||
*
|
||||
* @param json The JSON String representing the loot table.
|
||||
*
|
||||
* @throws ParseException if malformed JSON is passed.
|
||||
*/
|
||||
public LootTableImpl(String json, Platform platform) throws ParseException {
|
||||
JSONParser jsonParser = new JSONParser();
|
||||
Object tableJSON = jsonParser.parse(json);
|
||||
JSONArray poolArray = (JSONArray) ((JSONObject) tableJSON).get("pools");
|
||||
for(Object pool : poolArray) {
|
||||
pools.add(new Pool((JSONObject) pool, platform));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillInventory(Inventory i, RandomGenerator r) {
|
||||
List<ItemStack> loot = getLoot(r);
|
||||
for(ItemStack stack : loot) {
|
||||
int attempts = 0;
|
||||
while(stack.getAmount() != 0 && attempts < 10) {
|
||||
ItemStack newStack = stack.getType().newItemStack(stack.getAmount());
|
||||
newStack.setItemMeta(stack.getItemMeta());
|
||||
newStack.setAmount(1);
|
||||
int slot = r.nextInt(i.getSize());
|
||||
ItemStack slotItem = i.getItem(slot);
|
||||
if(slotItem == null) {
|
||||
i.setItem(slot, newStack);
|
||||
stack.setAmount(stack.getAmount() - 1);
|
||||
} else if(slotItem.getType().equals(newStack.getType())) {
|
||||
ItemStack dep = newStack.getType().newItemStack(newStack.getAmount());
|
||||
dep.setItemMeta(newStack.getItemMeta());
|
||||
dep.setAmount(newStack.getAmount() + slotItem.getAmount());
|
||||
i.setItem(slot, dep);
|
||||
stack.setAmount(stack.getAmount() - 1);
|
||||
}
|
||||
attempts++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getLoot(RandomGenerator r) {
|
||||
List<ItemStack> itemList = new ArrayList<>();
|
||||
for(Pool pool : pools) {
|
||||
itemList.addAll(pool.getItems(r));
|
||||
}
|
||||
return itemList;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Polyhedral Development
|
||||
*
|
||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in this module's root directory.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.addons.structure.structures.loot;
|
||||
|
||||
import net.jafama.FastMath;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.random.RandomGenerator;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.inventory.ItemStack;
|
||||
import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||
|
||||
|
||||
/**
|
||||
* Representation of a Loot Table pool, or a set of items to be fetched independently.
|
||||
*/
|
||||
public class Pool {
|
||||
private final int max;
|
||||
private final int min;
|
||||
private final ProbabilityCollection<Entry> entries;
|
||||
|
||||
/**
|
||||
* Instantiates a Pool from a JSON representation.
|
||||
*
|
||||
* @param pool The JSON Object to instantiate from.
|
||||
*/
|
||||
public Pool(JSONObject pool, Platform platform) {
|
||||
entries = new ProbabilityCollection<>();
|
||||
Object amount = pool.get("rolls");
|
||||
if(amount instanceof Long) {
|
||||
max = FastMath.toIntExact((Long) amount);
|
||||
min = FastMath.toIntExact((Long) amount);
|
||||
} else {
|
||||
max = FastMath.toIntExact((Long) ((JSONObject) amount).get("max"));
|
||||
min = FastMath.toIntExact((Long) ((JSONObject) amount).get("min"));
|
||||
}
|
||||
|
||||
for(Object entryJSON : (JSONArray) pool.get("entries")) {
|
||||
Entry entry = new Entry((JSONObject) entryJSON, platform);
|
||||
entries.add(entry, FastMath.toIntExact(entry.getWeight()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a list of items from the pool using the provided RandomGenerator instance.
|
||||
*
|
||||
* @param r The RandomGenerator instance to use.
|
||||
*
|
||||
* @return List<ItemStack> - The list of items fetched.
|
||||
*/
|
||||
public List<ItemStack> getItems(RandomGenerator r) {
|
||||
|
||||
int rolls = r.nextInt(max - min + 1) + min;
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
for(int i = 0; i < rolls; i++) {
|
||||
items.add(entries.get(r).getItem(r));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Polyhedral Development
|
||||
*
|
||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in this module's root directory.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.addons.structure.structures.loot.functions;
|
||||
|
||||
|
||||
import java.util.random.RandomGenerator;
|
||||
|
||||
import com.dfsek.terra.api.inventory.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* Loot LootFunction fot setting the amount of an item.
|
||||
*/
|
||||
public class AmountFunction implements LootFunction {
|
||||
private final int max;
|
||||
private final int min;
|
||||
|
||||
/**
|
||||
* Instantiates an AmountFunction.
|
||||
*
|
||||
* @param min Minimum amount.
|
||||
* @param max Maximum amount.
|
||||
*/
|
||||
public AmountFunction(int min, int max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the function to an ItemStack.
|
||||
*
|
||||
* @param original The ItemStack on which to apply the function.
|
||||
* @param r The RandomGenerator instance to use.
|
||||
*
|
||||
* @return - ItemStack - The mutated ItemStack.
|
||||
*/
|
||||
@Override
|
||||
public ItemStack apply(ItemStack original, RandomGenerator r) {
|
||||
original.setAmount(r.nextInt(max - min + 1) + min);
|
||||
return original;
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Polyhedral Development
|
||||
*
|
||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in this module's root directory.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.addons.structure.structures.loot.functions;
|
||||
|
||||
import java.util.random.RandomGenerator;
|
||||
|
||||
import com.dfsek.terra.api.inventory.ItemStack;
|
||||
import com.dfsek.terra.api.inventory.item.Damageable;
|
||||
import com.dfsek.terra.api.inventory.item.ItemMeta;
|
||||
|
||||
|
||||
/**
|
||||
* Loot LootFunction for setting the damage on items in Loot Tables
|
||||
*/
|
||||
public class DamageFunction implements LootFunction {
|
||||
private final int max;
|
||||
private final int min;
|
||||
|
||||
/**
|
||||
* Instantiates a DamageFunction.
|
||||
*
|
||||
* @param min Minimum amount of damage (percentage, out of 100)
|
||||
* @param max Maximum amount of damage (percentage, out of 100)
|
||||
*/
|
||||
public DamageFunction(int min, int max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the function to an ItemStack.
|
||||
*
|
||||
* @param original The ItemStack on which to apply the function.
|
||||
* @param r The RandomGenerator instance to use.
|
||||
*
|
||||
* @return - ItemStack - The mutated ItemStack.
|
||||
*/
|
||||
@Override
|
||||
public ItemStack apply(ItemStack original, RandomGenerator r) {
|
||||
if(original == null) return null;
|
||||
if(!original.isDamageable()) return original;
|
||||
ItemMeta meta = original.getItemMeta();
|
||||
double itemDurability = (r.nextDouble() * (max - min)) + min;
|
||||
Damageable damage = (Damageable) meta;
|
||||
damage.setDamage((int) (original.getType().getMaxDurability() - (itemDurability / 100) * original.getType().getMaxDurability()));
|
||||
original.setItemMeta((ItemMeta) damage);
|
||||
return original;
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Polyhedral Development
|
||||
*
|
||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in this module's root directory.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.addons.structure.structures.loot.functions;
|
||||
|
||||
import net.jafama.FastMath;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.random.RandomGenerator;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.inventory.ItemStack;
|
||||
import com.dfsek.terra.api.inventory.item.Enchantment;
|
||||
import com.dfsek.terra.api.inventory.item.ItemMeta;
|
||||
|
||||
|
||||
public class EnchantFunction implements LootFunction {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EnchantFunction.class);
|
||||
private final int min;
|
||||
private final int max;
|
||||
private final JSONArray disabled;
|
||||
private final Platform platform;
|
||||
|
||||
|
||||
public EnchantFunction(int min, int max, JSONArray disabled, Platform platform) {
|
||||
this.max = max;
|
||||
this.min = min;
|
||||
this.disabled = disabled;
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the function to an ItemStack.
|
||||
*
|
||||
* @param original The ItemStack on which to apply the function.
|
||||
* @param r The RandomGenerator instance to use.
|
||||
*
|
||||
* @return - ItemStack - The mutated ItemStack.
|
||||
*/
|
||||
@Override
|
||||
public ItemStack apply(ItemStack original, RandomGenerator r) {
|
||||
if(original.getItemMeta() == null) return original;
|
||||
|
||||
double enchant = (r.nextDouble() * (max - min)) + min;
|
||||
List<Enchantment> possible = new ArrayList<>();
|
||||
for(Enchantment ench : platform.getItemHandle().getEnchantments()) {
|
||||
if(ench.canEnchantItem(original) && (disabled == null || !this.disabled.contains(ench.getID()))) {
|
||||
possible.add(ench);
|
||||
}
|
||||
}
|
||||
int numEnchant = (r.nextInt((int) FastMath.abs(enchant)) / 10 + 1);
|
||||
Collections.shuffle(possible);
|
||||
ItemMeta meta = original.getItemMeta();
|
||||
iter:
|
||||
for(int i = 0; i < numEnchant && i < possible.size(); i++) {
|
||||
Enchantment chosen = possible.get(i);
|
||||
for(Enchantment ench : meta.getEnchantments().keySet()) {
|
||||
if(chosen.conflictsWith(ench)) continue iter;
|
||||
}
|
||||
int lvl = r.nextInt(1 + (int) (((enchant / 40 > 1) ? 1 : enchant / 40) * (chosen.getMaxLevel())));
|
||||
try {
|
||||
meta.addEnchantment(chosen, FastMath.max(lvl, 1));
|
||||
} catch(IllegalArgumentException e) {
|
||||
LOGGER.warn(
|
||||
"Attempted to enchant {} with {} at level {}, but an unexpected exception occurred! Usually this is caused by a " +
|
||||
"misbehaving enchantment plugin.",
|
||||
original.getType(), chosen, FastMath.max(lvl, 1));
|
||||
}
|
||||
}
|
||||
original.setItemMeta(meta);
|
||||
return original;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Polyhedral Development
|
||||
*
|
||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in this module's root directory.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.addons.structure.structures.loot.functions;
|
||||
|
||||
|
||||
import java.util.random.RandomGenerator;
|
||||
|
||||
import com.dfsek.terra.api.inventory.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* Interface for mutating items in Loot Tables.
|
||||
*/
|
||||
public interface LootFunction {
|
||||
/**
|
||||
* Applies the function to an ItemStack.
|
||||
*
|
||||
* @param original The ItemStack on which to apply the function.
|
||||
* @param r The RandomGenerator instance to use.
|
||||
*
|
||||
* @return - ItemStack - The mutated ItemStack.
|
||||
*/
|
||||
ItemStack apply(ItemStack original, RandomGenerator r);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
version = version("1.0.0")
|
||||
|
||||
dependencies {
|
||||
implementation("com.dfsek.tectonic:yaml:${Versions.Libraries.tectonic}")
|
||||
implementation(libs.libraries.tectonic.yaml)
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
version = version("1.0.0")
|
||||
|
||||
dependencies {
|
||||
api("commons-io:commons-io:2.7")
|
||||
implementation("com.dfsek.tectonic:yaml:${Versions.Libraries.tectonic}")
|
||||
api(libs.libraries.internal.apache.io)
|
||||
implementation(libs.libraries.tectonic.yaml)
|
||||
}
|
||||
|
||||
tasks.withType<Jar> {
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
version = version("1.1.0")
|
||||
|
||||
dependencies {
|
||||
api("commons-io:commons-io:2.7")
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
}
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
relocate("org.apache.commons", "com.dfsek.terra.addons.terrascript.lib.commons")
|
||||
relocate("net.jafama", "com.dfsek.terra.addons.terrascript.lib.jafama")
|
||||
api(libs.libraries.internal.apache.io)
|
||||
}
|
||||
@@ -4,11 +4,4 @@ dependencies {
|
||||
compileOnlyApi(project(":common:addons:manifest-addon-loader"))
|
||||
compileOnlyApi(project(":common:addons:chunk-generator-noise-3d"))
|
||||
compileOnlyApi(project(":common:addons:structure-terrascript-loader"))
|
||||
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
}
|
||||
|
||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
||||
relocate("net.jafama", "com.dfsek.terra.addon.terrascript.check.lib.jafama")
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
dependencies {
|
||||
api("ca.solo-studios", "strata", Versions.Libraries.strata)
|
||||
compileOnlyApi("org.slf4j", "slf4j-api", Versions.Libraries.slf4j)
|
||||
testImplementation("org.slf4j", "slf4j-api", Versions.Libraries.slf4j)
|
||||
api("cloud.commandframework", "cloud-core", Versions.Libraries.cloud)
|
||||
api(libs.libraries.strata)
|
||||
compileOnlyApi(libs.libraries.slf4j.api)
|
||||
testImplementation(libs.libraries.slf4j.api)
|
||||
api(libs.libraries.cloud.core)
|
||||
|
||||
api("com.dfsek.tectonic", "common", Versions.Libraries.tectonic)
|
||||
api(libs.libraries.tectonic)
|
||||
|
||||
api("com.github.ben-manes.caffeine", "caffeine", Versions.Libraries.caffeine)
|
||||
api(libs.libraries.caffeine)
|
||||
|
||||
api("io.vavr", "vavr", Versions.Libraries.vavr)
|
||||
api(libs.libraries.vavr)
|
||||
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
api(libs.libraries.jafama)
|
||||
|
||||
api(libs.libraries.paralithic)
|
||||
}
|
||||
@@ -2,14 +2,14 @@ dependencies {
|
||||
api(project(":common:api"))
|
||||
api(project(":common:implementation:bootstrap-addon-loader"))
|
||||
|
||||
testImplementation("org.slf4j", "slf4j-api", Versions.Libraries.slf4j)
|
||||
testImplementation(libs.libraries.slf4j.api)
|
||||
|
||||
implementation("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO)
|
||||
implementation(libs.libraries.internal.apache.io)
|
||||
|
||||
implementation("org.apache.commons", "commons-text", Versions.Libraries.Internal.apacheText)
|
||||
implementation("com.dfsek.tectonic", "yaml", Versions.Libraries.tectonic)
|
||||
implementation(libs.libraries.internal.apache.text)
|
||||
implementation(libs.libraries.tectonic.yaml)
|
||||
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
implementation(libs.libraries.jafama)
|
||||
|
||||
implementation("com.dfsek", "paralithic", Versions.Libraries.paralithic)
|
||||
implementation(libs.libraries.paralithic)
|
||||
}
|
||||
|
||||
98
gradle/libs.versions.toml
Normal file
98
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,98 @@
|
||||
[versions]
|
||||
libraries_tectonic = "4.2.0"
|
||||
libraries_paralithic = "0.7.0"
|
||||
libraries_strata = "1.3.1"
|
||||
libraries_snakeyaml = "1.30"
|
||||
libraries_cloud = "1.7.0"
|
||||
libraries_slf4j = "1.7.36"
|
||||
libraries_caffeine = "3.1.1"
|
||||
libraries_vavr = "0.10.4"
|
||||
libraries_jafama = "2.3.2"
|
||||
libraries_guava = "31.1-jre"
|
||||
|
||||
libraries_internal_apache-text = "1.9"
|
||||
libraries_internal_apache-io = "2.11.0"
|
||||
libraries_internal_fastutil = "8.5.8"
|
||||
libraries_internal_shadow = "7.1.2"
|
||||
libraries_internal_junit-jupiter = "5.9.0"
|
||||
libraries_internal_jetbrains-annotations = "23.0.0"
|
||||
libraries_internal_asm = "9.3"
|
||||
|
||||
mod_mixin = "0.11.4+mixin.0.8.5"
|
||||
mod_minecraft = "1.19.2"
|
||||
mod_yarn = "1.19.2+build.4"
|
||||
mod_architecury-loom = "0.12.0.299"
|
||||
mod_architectury-plugin = "3.4.138"
|
||||
mod_loom-quiltflower = "1.7.3"
|
||||
mod_lazy-dfu = "0.1.3"
|
||||
|
||||
mod_fabric_fabric-loader = "0.14.9"
|
||||
mod_fabric_fabric-api = "0.60.0+1.19.2"
|
||||
|
||||
mod_quilt_quilt-loader = "0.17.3"
|
||||
mod_quilt_fabric-api = "4.0.0-beta.9+0.60.0-1.19.2"
|
||||
|
||||
mod_forge_forge = "1.19.2-43.1.1"
|
||||
mod_forge_burningwave = "12.59.0"
|
||||
|
||||
bukkit_run-paper = "1.0.6"
|
||||
bukkit_paperweight = "1.3.8"
|
||||
bukkit_paper = "1.19-R0.1-20220725.172700-79"
|
||||
bukkit_paper-lib = "1.0.7"
|
||||
bukkit_minecraft = "1.19.2"
|
||||
bukkit_reflection-remapper = "0.1.0-20220312.202611-7"
|
||||
|
||||
cli_nbt = "6.1"
|
||||
cli_logback = "1.2.11"
|
||||
|
||||
[libraries]
|
||||
libraries_tectonic = { module = "com.dfsek.tectonic:common", version.ref = "libraries_tectonic" }
|
||||
libraries_tectonic_yaml = { module = "com.dfsek.tectonic:yaml", version.ref = "libraries_tectonic" }
|
||||
libraries_paralithic = { module = "com.dfsek:paralithic", version.ref = "libraries_paralithic" }
|
||||
libraries_strata = { module = "ca.solo-studios:strata", version.ref = "libraries_strata" }
|
||||
libraries_snakeyaml = { module = "org.yaml:snakeyaml", version.ref = "libraries_snakeyaml" }
|
||||
libraries_cloud-core = { module = "cloud.commandframework:cloud-core", version.ref = "libraries_cloud" }
|
||||
libraries_slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "libraries_slf4j" }
|
||||
libraries_caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "libraries_caffeine" }
|
||||
libraries_vavr = { module = "io.vavr:vavr", version.ref = "libraries_vavr" }
|
||||
libraries_guava = { module = "com.google.guava:guava", version.ref = "libraries_guava" }
|
||||
libraries_jafama = { module = "net.jafama:jafama", version.ref = "libraries_jafama" }
|
||||
|
||||
libraries_internal_apache-text = { module = "org.apache.commons:commons-text", version.ref = "libraries_internal_apache-text" }
|
||||
libraries_internal_apache-io = { module = "commons-io:commons-io", version.ref = "libraries_internal_apache-io" }
|
||||
libraries_internal_fastutil = { module = "it.unimi.dsi:fastutil ", version.ref = "libraries_internal_fastutil" }
|
||||
libraries_internal_shadow = { module = "gradle.plugin.com.github.johnrengelman:shadow", version.ref = "libraries_internal_shadow" }
|
||||
libraries_internal_junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "libraries_internal_junit_jupiter" }
|
||||
libraries_internal_junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "libraries_internal_junit_jupiter" }
|
||||
libraries_internal_jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "libraries_internal_jetbrains_annotations" }
|
||||
libraries_internal_asm = { module = "org.ow2.asm:asm", version.ref = "libraries_internal_asm" }
|
||||
libraries_internal_asm-tree = { module = "org.ow2.asm:asm-tree", version.ref = "libraries_internal_asm" }
|
||||
|
||||
mod_mixin = { module = "net.fabricmc:sponge-mixin", version.ref = "mod_mixin" }
|
||||
mod_minecraft = { module = "com.mojang:minecraft", version.ref = "mod_minecraft" }
|
||||
mod_lazy-dfu = { module = "maven.modrinth:lazydfu", version.ref = "mod_lazy-dfu" }
|
||||
mod_cloud-fabric = { module = "cloud.commandframework:cloud-fabric", version.ref = "libraries_cloud" }
|
||||
|
||||
mod_fabric_fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "mod_fabric_fabric-loader" }
|
||||
|
||||
mod_quilt_quilt-loader = { module = "org.quiltmc:quilt-loader", version.ref = "mod_quilt_quilt-loader" }
|
||||
mod_quilt_fabric-api = { module = "org.quiltmc.quilted-fabric-api:quilted-fabric-api", version.ref = "mod_quilt_fabric-api" }
|
||||
|
||||
mod_forge_forge = { module = "net.minecraftforge:forge", version.ref = "mod_forge_forge" }
|
||||
mod_forge_burningwave = { module = "org.burningwave:core", version.ref = "mod_forge_burningwave" }
|
||||
|
||||
bukkit_paper-api = { module = "io.papermc.paper:paper-api", version.ref = "bukkit_paper" }
|
||||
bukkit_paper-lib = { module = "io.papermc:paperlib", version.ref = "bukkit_paper-lib" }
|
||||
bukkit_reflection-remapper = { module = "xyz.jpenilla:reflection-remapper", version.ref = "bukkit_reflection-remapper" }
|
||||
bukkit_cloud-paper = { module = "cloud.commandframework:cloud-paper", version.ref = "libraries_cloud" }
|
||||
|
||||
cli_nbt = { module = "com.github.Querz:NBT", version.ref = "cli_nbt" }
|
||||
cli_logback = { module = "ch.qos.logback:logback-classic", version.ref = "cli_logback" }
|
||||
|
||||
[plugins]
|
||||
mod_architectury-loom = { id = "dev.architectury.loom", version.ref = "mod_architecury-loom" }
|
||||
mod_architectury-plugin = { id = "architectury-plugin", version.ref = "mod_architectury-plugin" }
|
||||
mod_loom-quiltflower = { id = "io.github.juuxel.loom-quiltflower", version.ref = "mod_loom-quiltflower" }
|
||||
|
||||
bukkit_run-paper = { id = "xyz.jpenilla.run-paper", version.ref = "bukkit_run-paper" }
|
||||
bukkit_paperweight = { id = "io.papermc.paperweight.userdev", version.ref = "bukkit_paperweight" }
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
org.gradle.jvmargs=-Xmx4096m
|
||||
269
gradlew
vendored
269
gradlew
vendored
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,67 +17,101 @@
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
@@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
@@ -106,80 +140,95 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id("xyz.jpenilla.run-paper") version "1.0.6"
|
||||
alias(libs.plugins.bukkit.run.paper)
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -9,15 +9,12 @@ repositories {
|
||||
dependencies {
|
||||
shaded(project(":platforms:bukkit:common"))
|
||||
shaded(project(":platforms:bukkit:nms:v1_19_R1", configuration = "reobf"))
|
||||
shaded("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
|
||||
shaded(libs.bukkit.reflection.remapper)
|
||||
}
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
relocate("org.bstats.bukkit", "com.dfsek.terra.lib.bstats")
|
||||
relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib")
|
||||
relocate("com.google.common", "com.dfsek.terra.lib.google.common")
|
||||
relocate("org.apache.logging.slf4j", "com.dfsek.terra.lib.slf4j-over-log4j")
|
||||
exclude("org/slf4j/**")
|
||||
exclude("org/checkerframework/**")
|
||||
exclude("org/jetbrains/annotations/**")
|
||||
@@ -28,7 +25,7 @@ tasks {
|
||||
}
|
||||
|
||||
runServer {
|
||||
minecraftVersion("1.19")
|
||||
minecraftVersion(libs.versions.bukkit.minecraft.get())
|
||||
dependsOn(shadowJar)
|
||||
pluginJars(shadowJar.get().archiveFile)
|
||||
}
|
||||
|
||||
@@ -5,14 +5,9 @@ repositories {
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
api("org.slf4j:slf4j-api:1.8.0-beta4") {
|
||||
because("Minecraft 1.17+ includes slf4j 1.8.0-beta4, so we need to shade it for other versions.")
|
||||
}
|
||||
compileOnly(libs.bukkit.paper.api)
|
||||
|
||||
compileOnly("io.papermc.paper:paper-api:${Versions.Bukkit.paper}")
|
||||
shadedApi(libs.bukkit.paper.lib)
|
||||
|
||||
shadedApi("io.papermc", "paperlib", Versions.Bukkit.paperLib)
|
||||
shadedApi("com.google.guava:guava:30.0-jre")
|
||||
|
||||
shadedApi("cloud.commandframework", "cloud-paper", Versions.Libraries.cloud)
|
||||
shadedApi(libs.bukkit.cloud.paper)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
apply(plugin = "io.papermc.paperweight.userdev")
|
||||
plugins {
|
||||
alias(libs.plugins.bukkit.paperweight)
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
|
||||
|
||||
@@ -7,14 +7,10 @@ val javaMainClass = "com.dfsek.terra.cli.TerraCLI"
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
shadedApi("commons-io:commons-io:${Versions.CLI.commonsIO}")
|
||||
shadedApi("com.github.Querz:NBT:${Versions.CLI.nbt}")
|
||||
shadedApi(libs.libraries.internal.apache.io)
|
||||
shadedApi(libs.cli.nbt)
|
||||
|
||||
shadedImplementation("com.google.guava:guava:${Versions.CLI.guava}")
|
||||
|
||||
shadedImplementation("ch.qos.logback:logback-classic:${Versions.CLI.logback}")
|
||||
|
||||
implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama)
|
||||
shadedImplementation(libs.cli.logback)
|
||||
}
|
||||
|
||||
tasks.withType<Jar> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower
|
||||
alias(libs.plugins.mod.architectury.loom)
|
||||
alias(libs.plugins.mod.architectury.plugin)
|
||||
alias(libs.plugins.mod.loom.quiltflower)
|
||||
}
|
||||
|
||||
architectury {
|
||||
@@ -12,9 +12,6 @@ architectury {
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
|
||||
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
"developmentFabric"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionFabric")) { isTransitive = false }
|
||||
@@ -22,28 +19,15 @@ dependencies {
|
||||
"developmentFabric"(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-lifecycle", configuration = "transformProductionFabric")) { isTransitive = false }
|
||||
|
||||
minecraft(libs.mod.minecraft)
|
||||
mappings("net.fabricmc", "yarn", libs.versions.mod.yarn.get(), classifier = "v2")
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
modImplementation(libs.mod.fabric.fabric.loader)
|
||||
|
||||
modImplementation("net.fabricmc:fabric-loader:${Versions.Fabric.fabricLoader}")
|
||||
modImplementation(libs.mod.cloud.fabric)
|
||||
include(libs.mod.cloud.fabric)
|
||||
|
||||
setOf(
|
||||
"fabric-lifecycle-events-v1",
|
||||
"fabric-resource-loader-v0",
|
||||
"fabric-api-base",
|
||||
"fabric-command-api-v2",
|
||||
"fabric-networking-api-v1"
|
||||
).forEach { apiModule ->
|
||||
val module = fabricApi.module(apiModule, Versions.Fabric.fabricAPI)
|
||||
modImplementation(module)
|
||||
include(module)
|
||||
}
|
||||
|
||||
modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud)
|
||||
include("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud)
|
||||
|
||||
modLocalRuntime("com.github.astei:lazydfu:${Versions.Mod.lazyDfu}")
|
||||
modLocalRuntime(libs.mod.lazy.dfu)
|
||||
}
|
||||
|
||||
loom {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower
|
||||
alias(libs.plugins.mod.architectury.loom)
|
||||
alias(libs.plugins.mod.architectury.plugin)
|
||||
alias(libs.plugins.mod.loom.quiltflower)
|
||||
}
|
||||
|
||||
architectury {
|
||||
@@ -10,9 +10,6 @@ architectury {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
"forgeRuntimeLibrary"(project(":common:implementation:base"))
|
||||
|
||||
@@ -20,14 +17,14 @@ dependencies {
|
||||
"developmentForge"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionForge")) { isTransitive = false }
|
||||
|
||||
forge(group = "net.minecraftforge", name = "forge", version = Versions.Forge.forge)
|
||||
forge(libs.mod.forge.forge)
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
minecraft(libs.mod.minecraft)
|
||||
mappings("net.fabricmc", "yarn", libs.versions.mod.yarn.get(), classifier = "v2")
|
||||
|
||||
//forge is not ok.
|
||||
compileOnly("org.burningwave:core:${Versions.Forge.burningwave}")
|
||||
"forgeRuntimeLibrary"("org.burningwave:core:${Versions.Forge.burningwave}")
|
||||
compileOnly(libs.mod.forge.burningwave)
|
||||
"forgeRuntimeLibrary"(libs.mod.forge.burningwave)
|
||||
}
|
||||
|
||||
loom {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower
|
||||
alias(libs.plugins.mod.architectury.loom)
|
||||
alias(libs.plugins.mod.architectury.plugin)
|
||||
alias(libs.plugins.mod.loom.quiltflower)
|
||||
}
|
||||
|
||||
loom {
|
||||
@@ -15,16 +15,14 @@ loom {
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
modImplementation(libs.mod.fabric.fabric.loader)
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
minecraft(libs.mod.minecraft)
|
||||
mappings("net.fabricmc", "yarn", libs.versions.mod.yarn.get(), classifier = "v2")
|
||||
}
|
||||
|
||||
architectury {
|
||||
common("fabric", "forge", "quilt")
|
||||
minecraft = Versions.Mod.minecraft
|
||||
minecraft = libs.versions.mod.minecraft.get()
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
||||
|
||||
private void beard(StructureAccessor structureAccessor, Chunk chunk, WorldProperties world, BiomeProvider biomeProvider,
|
||||
PreLoadCompatibilityOptions compatibilityOptions) {
|
||||
StructureWeightSampler structureWeightSampler = StructureWeightSampler.method_42695(structureAccessor, chunk.getPos());
|
||||
StructureWeightSampler structureWeightSampler = StructureWeightSampler.createStructureWeightSampler(structureAccessor, chunk.getPos());
|
||||
double threshold = compatibilityOptions.getBeardThreshold();
|
||||
double airThreshold = compatibilityOptions.getAirThreshold();
|
||||
int xi = chunk.getPos().x << 4;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.dfsek.terra.mod.mixin.access;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
|
||||
@Mixin(Biome.class)
|
||||
public interface BiomeAccessor {
|
||||
@Accessor("weather")
|
||||
Biome.Weather getWeather();
|
||||
}
|
||||
@@ -1,2 +1 @@
|
||||
accessWidener v1 named
|
||||
accessible class net/minecraft/world/biome/Biome$Weather
|
||||
accessWidener v1 named
|
||||
@@ -1,22 +1,22 @@
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower
|
||||
alias(libs.plugins.mod.architectury.loom)
|
||||
alias(libs.plugins.mod.architectury.plugin)
|
||||
alias(libs.plugins.mod.loom.quiltflower)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
|
||||
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) {
|
||||
modImplementation(libs.mod.fabric.fabric.loader)
|
||||
|
||||
minecraft(libs.mod.minecraft)
|
||||
mappings("net.fabricmc", "yarn", libs.versions.mod.yarn.get(), classifier = "v2")
|
||||
|
||||
modImplementation(libs.mod.cloud.fabric) {
|
||||
exclude("net.fabricmc")
|
||||
exclude("net.fabricmc.fabric-api")
|
||||
}
|
||||
@@ -42,5 +42,5 @@ tasks {
|
||||
|
||||
architectury {
|
||||
common("fabric", "quilt")
|
||||
minecraft = Versions.Mod.minecraft
|
||||
minecraft = libs.versions.mod.minecraft.get()
|
||||
}
|
||||
@@ -16,15 +16,19 @@ public class LifecycleEntryPoint {
|
||||
protected static void initialize(String modName, LifecyclePlatform platform) {
|
||||
logger.info("Initializing Terra {} mod...", modName);
|
||||
|
||||
FabricServerCommandManager<CommandSender> manager = new FabricServerCommandManager<>(
|
||||
CommandExecutionCoordinator.simpleCoordinator(),
|
||||
serverCommandSource -> (CommandSender) serverCommandSource,
|
||||
commandSender -> (ServerCommandSource) commandSender
|
||||
);
|
||||
|
||||
|
||||
manager.brigadierManager().setNativeNumberSuggestions(false);
|
||||
|
||||
platform.getEventManager().callEvent(new CommandRegistrationEvent(manager));
|
||||
try {
|
||||
FabricServerCommandManager<CommandSender> manager = new FabricServerCommandManager<>(
|
||||
CommandExecutionCoordinator.simpleCoordinator(),
|
||||
serverCommandSource -> (CommandSender) serverCommandSource,
|
||||
commandSender -> (ServerCommandSource) commandSender
|
||||
);
|
||||
|
||||
|
||||
manager.brigadierManager().setNativeNumberSuggestions(false);
|
||||
|
||||
platform.getEventManager().callEvent(new CommandRegistrationEvent(manager));
|
||||
} catch (Exception e) {
|
||||
logger.warn("Fabric API not found, Terra commands will not work.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower
|
||||
alias(libs.plugins.mod.architectury.loom)
|
||||
alias(libs.plugins.mod.architectury.plugin)
|
||||
alias(libs.plugins.mod.loom.quiltflower)
|
||||
}
|
||||
|
||||
architectury {
|
||||
@@ -12,9 +12,6 @@ architectury {
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
|
||||
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
"developmentQuilt"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionQuilt")) { isTransitive = false }
|
||||
@@ -23,23 +20,22 @@ dependencies {
|
||||
"developmentQuilt"(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-lifecycle", configuration = "transformProductionQuilt")) { isTransitive = false }
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
minecraft(libs.mod.minecraft)
|
||||
mappings("net.fabricmc", "yarn", libs.versions.mod.yarn.get(), classifier = "v2")
|
||||
|
||||
modImplementation("org.quiltmc:quilt-loader:${Versions.Quilt.quiltLoader}")
|
||||
modImplementation(libs.mod.quilt.quilt.loader)
|
||||
modImplementation(libs.mod.quilt.fabric.api)
|
||||
|
||||
modImplementation("org.quiltmc.quilted-fabric-api:quilted-fabric-api:${Versions.Quilt.fabricApi}")
|
||||
|
||||
modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) {
|
||||
modImplementation(libs.mod.cloud.fabric) {
|
||||
exclude("net.fabricmc")
|
||||
exclude("net.fabricmc.fabric-api")
|
||||
}
|
||||
include("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) {
|
||||
include(libs.mod.cloud.fabric) {
|
||||
exclude("net.fabricmc")
|
||||
exclude("net.fabricmc.fabric-api")
|
||||
}
|
||||
|
||||
modLocalRuntime("com.github.astei:lazydfu:${Versions.Mod.lazyDfu}") {
|
||||
modLocalRuntime(libs.mod.lazy.dfu) {
|
||||
exclude("net.fabricmc")
|
||||
exclude("net.fabricmc.fabric-api")
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ include(":platforms:bukkit:common")
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.fabricmc.net") {
|
||||
name = "Fabric Maven"
|
||||
@@ -37,5 +38,8 @@ pluginManagement {
|
||||
maven("https://maven.quiltmc.org/repository/release/") {
|
||||
name = "Quilt"
|
||||
}
|
||||
maven("https://papermc.io/repo/repository/maven-public/") {
|
||||
name = "PaperMC"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user