Compare commits

...

2 Commits

20 changed files with 316 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)

View File

@ -37,6 +37,8 @@ object PhyItems {
val SCREWDRIVER = ScrewdriverItem() val SCREWDRIVER = ScrewdriverItem()
val CONSOLE = ConsoleItem() val CONSOLE = ConsoleItem()
val TWISTED_PAIR = Item(Item.Settings()) val TWISTED_PAIR = Item(Item.Settings())
val SCREEN = Item(Item.Settings())
val SERIAL_CABLE = Item(Item.Settings())
fun init() { fun init() {
register(InterfaceBlock.ID, INTERFACE) register(InterfaceBlock.ID, INTERFACE)
@ -52,6 +54,8 @@ object PhyItems {
register(ScrewdriverItem.ID, SCREWDRIVER) register(ScrewdriverItem.ID, SCREWDRIVER)
register(ConsoleItem.ID, CONSOLE) register(ConsoleItem.ID, CONSOLE)
register(Identifier(PhysicalConnectivity.MODID, "twisted_pair"), TWISTED_PAIR) register(Identifier(PhysicalConnectivity.MODID, "twisted_pair"), TWISTED_PAIR)
register(Identifier(PhysicalConnectivity.MODID, "screen"), SCREEN)
register(Identifier(PhysicalConnectivity.MODID, "serial_cable"), SERIAL_CABLE)
} }
private fun register(id: Identifier, item: Item) { private fun register(id: Identifier, item: Item) {

View File

@ -12,6 +12,8 @@
"item.phycon.screwdriver": "Screwdriver", "item.phycon.screwdriver": "Screwdriver",
"item.phycon.console": "Console", "item.phycon.console": "Console",
"item.phycon.twisted_pair": "Twisted Pair", "item.phycon.twisted_pair": "Twisted Pair",
"item.phycon.screen": "Screen",
"item.phycon.serial_cable": "Serial Cable",
"gui.phycon.terminal_buffer": "Buffer", "gui.phycon.terminal_buffer": "Buffer",
"gui.phycon.console.details": "Device Details", "gui.phycon.console.details": "Device Details",

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "phycon:item/screen"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "phycon:item/serial_cable"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"phycon:console"
]
},
"criteria": {
"has_serial_cable": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "phycon:serial_cable"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "phycon:console"
}
}
},
"requirements": [
[
"has_serial_cable",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"phycon:screen"
]
},
"criteria": {
"has_glowstone": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:glowstone_dust"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "phycon:screen"
}
}
},
"requirements": [
[
"has_glowstone",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"phycon:serial_cable"
]
},
"criteria": {
"has_redstone_and_gold": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:redstone"
},
{
"tag": "c:gold_ingots"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "phycon:serial_cable"
}
}
},
"requirements": [
[
"has_redstone_and_gold",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" I ",
"ISI",
" C "
],
"key": {
"I": {"tag": "c:iron_ingots"},
"S": {"item": "phycon:screen"},
"C": {"item": "phycon:serial_cable"}
},
"result": {
"item": "phycon:console"
}
}

View File

@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GGG",
"ggg",
"RRR"
],
"key": {
"G": {"item": "minecraft:glass_pane"},
"g": {"item": "minecraft:glowstone_dust"},
"R": {"item": "minecraft:redstone"}
},
"result": {
"item": "phycon:screen"
}
}

View File

@ -0,0 +1,16 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" C ",
"CRC",
"GC "
],
"key": {
"C": {"item": "minecraft:blue_carpet"},
"R": {"item": "minecraft:redstone"},
"G": {"tag": "c:gold_ingots"}
},
"result": {
"item": "phycon:serial_cable"
}
}