Setup Gradle multi-project and add REI plugin

This commit is contained in:
Shadowfacts 2021-03-08 20:53:25 -05:00
parent 6f55282537
commit 815a9ab8af
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
8 changed files with 151 additions and 9 deletions

View File

@ -17,12 +17,9 @@ minecraft {
} }
repositories { repositories {
maven { maven { url "https://mod-buildcraft.com/maven" }
url = "https://mod-buildcraft.com/maven" maven { url "http://server.bbkr.space:8081/artifactory/libs-release/" }
} maven { url "https://maven.terraformersmc.com/releases" }
maven {
url = "http://server.bbkr.space:8081/artifactory/libs-release/"
}
jcenter() jcenter()
} }
@ -42,10 +39,15 @@ dependencies {
include "alexiil.mc.lib:libblockattributes-core:${project.libblockattributes_version}" include "alexiil.mc.lib:libblockattributes-core:${project.libblockattributes_version}"
include "alexiil.mc.lib:libblockattributes-items:${project.libblockattributes_version}" include "alexiil.mc.lib:libblockattributes-items:${project.libblockattributes_version}"
modImplementation "io.github.cottonmc:cotton-resources:${project.cotton_resources_version}" compile project(":kiwi-java")
shadow project(":kiwi-java") shadow project(":kiwi-java")
runtimeOnly project(":plugin:rei")
include project(":plugin:rei")
modRuntime "io.github.cottonmc:cotton-resources:${project.cotton_resources_version}"
modRuntime "com.terraformersmc:modmenu:${project.modmenu_version}"
testImplementation "org.junit.jupiter:junit-jupiter:${project.junit_version}" testImplementation "org.junit.jupiter:junit-jupiter:${project.junit_version}"
} }
@ -64,6 +66,10 @@ tasks.withType(JavaCompile) {
options.encoding = "UTF-8" options.encoding = "UTF-8"
} }
compileKotlin {
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8
}
java { java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present. // if it is present.

View File

@ -14,5 +14,6 @@ fabric_kotlin_version=1.4.30+build.2
libblockattributes_version=0.8.5 libblockattributes_version=0.8.5
cotton_resources_version=1.7.4 cotton_resources_version=1.7.4
modmenu_version=1.16.8
junit_version = 5.4.0 junit_version = 5.4.0

66
plugin/rei/build.gradle Normal file
View File

@ -0,0 +1,66 @@
plugins {
id "fabric-loom"
id "org.jetbrains.kotlin.jvm"
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
minecraft {
log4jConfigs.from "PhyConDebugLogging.xml"
}
repositories {
maven {
url = "https://maven.shedaniel.me/"
}
jcenter()
}
dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}"
implementation project(":")
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api:${project.rei_version}"
modRuntime "me.shedaniel:RoughlyEnoughItems:${project.rei_version}"
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}

View File

@ -0,0 +1,3 @@
archives_base_name=PhyCon-Plugin-REI
rei_version=5.10.184

View File

@ -0,0 +1,27 @@
package net.shadowfacts.phycon.plugin.rei
import me.shedaniel.math.Rectangle
import me.shedaniel.rei.api.BaseBoundsHandler
import me.shedaniel.rei.api.DisplayHelper
import me.shedaniel.rei.api.plugins.REIPluginV0
import net.minecraft.client.MinecraftClient
import net.minecraft.util.Identifier
import net.shadowfacts.phycon.block.terminal.TerminalScreen
/**
* @author shadowfacts
*/
object PhyConPlugin: REIPluginV0 {
const val MODID = "phycon_rei"
override fun getPluginIdentifier() = Identifier(MODID, "rei_plugin")
override fun registerBounds(helper: DisplayHelper) {
BaseBoundsHandler.getInstance().registerExclusionZones(TerminalScreen::class.java) {
val screen = MinecraftClient.getInstance().currentScreen as TerminalScreen
listOf(
Rectangle(screen.sortButtonX, screen.sortButtonY, 20, 20)
)
}
}
}

View File

@ -0,0 +1,32 @@
{
"schemaVersion": 1,
"id": "phycon_rei",
"version": "${version}",
"name": "PhyCon REI Integration",
"description": "",
"authors": [
"Shadowfacts"
],
"contact": {
"homepage": "https://git.shadowfacts.net/minecraft/PhysicalConnectivity"
},
"license": "LGPL-3.0",
"environment": "client",
"entrypoints": {
"rei_plugins": [
{
"adapter": "kotlin",
"value": "net.shadowfacts.phycon.plugin.rei.PhyConPlugin"
}
]
},
"mixins": [
],
"depends": {
"fabricloader": ">=0.4.0",
"fabric": "*",
"fabric-language-kotlin": ">=1.3.50",
"phycon": "*"
}
}

View File

@ -10,3 +10,4 @@ pluginManagement {
} }
include("kiwi-java") include("kiwi-java")
include("plugin:rei")

View File

@ -43,6 +43,10 @@ class TerminalScreen(handler: TerminalScreenHandler, playerInv: PlayerInventory,
private lateinit var searchBox: TextFieldWidget private lateinit var searchBox: TextFieldWidget
private lateinit var sortButton: SortButton private lateinit var sortButton: SortButton
var sortButtonX: Int = 0
private set
var sortButtonY = 0
private set
private lateinit var amountBox: TextFieldWidget private lateinit var amountBox: TextFieldWidget
private var dialogStack = ItemStack.EMPTY private var dialogStack = ItemStack.EMPTY
private var showingAmountDialog = false private var showingAmountDialog = false
@ -95,7 +99,9 @@ class TerminalScreen(handler: TerminalScreenHandler, playerInv: PlayerInventory,
searchBox.setEditableColor(0xffffff) searchBox.setEditableColor(0xffffff)
addChild(searchBox) addChild(searchBox)
sortButton = SortButton(x + 256, y + 0, handler.sortMode, { sortButtonX = x + 256
sortButtonY = y
sortButton = SortButton(sortButtonX, sortButtonY, handler.sortMode, {
requestUpdatedItems() requestUpdatedItems()
}, ::renderTooltip) }, ::renderTooltip)
addButton(sortButton) addButton(sortButton)