mirror of
https://github.com/naalit/slotlink.git
synced 2025-12-31 04:13:02 +00:00
1.18
This commit is contained in:
parent
ed6011920f
commit
6c2a64e551
16 changed files with 49 additions and 53 deletions
2
.github/workflows/build_head.yml
vendored
2
.github/workflows/build_head.yml
vendored
|
|
@ -20,7 +20,7 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 16
|
java-version: 17
|
||||||
- run: chmod +x gradlew
|
- run: chmod +x gradlew
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
2
.github/workflows/build_release.yml
vendored
2
.github/workflows/build_release.yml
vendored
|
|
@ -12,7 +12,7 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 16
|
java-version: 17
|
||||||
- run: chmod +x gradlew
|
- run: chmod +x gradlew
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ import net.fabricmc.loom.task.RunGameTask
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm").version("1.5.20")
|
kotlin("jvm").version("1.6.0")
|
||||||
kotlin("plugin.serialization").version("1.5.20")
|
kotlin("plugin.serialization").version("1.6.0")
|
||||||
|
|
||||||
id("fabric-loom").version("0.8-SNAPSHOT")
|
id("fabric-loom").version("0.10.+")
|
||||||
id("com.matthewprenger.cursegradle").version("1.4.0")
|
id("com.matthewprenger.cursegradle").version("1.4.0")
|
||||||
id("com.modrinth.minotaur").version("1.1.0")
|
id("com.modrinth.minotaur").version("1.1.0")
|
||||||
id("maven-publish")
|
id("maven-publish")
|
||||||
|
|
@ -37,7 +37,7 @@ dependencies {
|
||||||
|
|
||||||
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:${prop["rei"]}")
|
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:${prop["rei"]}")
|
||||||
modCompileOnly("me.shedaniel:RoughlyEnoughItems-default-plugin-fabric:${prop["rei"]}")
|
modCompileOnly("me.shedaniel:RoughlyEnoughItems-default-plugin-fabric:${prop["rei"]}")
|
||||||
modRuntime("me.shedaniel:RoughlyEnoughItems-fabric:${prop["rei"]}")
|
modRuntimeOnly("me.shedaniel:RoughlyEnoughItems-fabric:${prop["rei"]}")
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|
@ -49,8 +49,8 @@ sourceSets {
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_16
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
targetCompatibility = JavaVersion.VERSION_16
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
tasks.withType<JavaCompile> {
|
||||||
|
|
@ -59,7 +59,7 @@ tasks.withType<JavaCompile> {
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
tasks.withType<KotlinCompile> {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "16"
|
jvmTarget = "17"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,27 +4,27 @@ org.gradle.jvmargs = -Xmx1G
|
||||||
run_args = -Dmixin.debug.export=true
|
run_args = -Dmixin.debug.export=true
|
||||||
|
|
||||||
# Fabric properties
|
# Fabric properties
|
||||||
minecraft = 1.17.1
|
minecraft = 1.18
|
||||||
yarn = 1.17.1+build.14
|
yarn = 1.18+build.1
|
||||||
fabricLoader = 0.11.6
|
fabricLoader = 0.12.8
|
||||||
|
|
||||||
# Mod properties
|
# Mod properties
|
||||||
maven_group = com.github.badasintended
|
maven_group = com.github.badasintended
|
||||||
archives_base_name = slotlink
|
archives_base_name = slotlink
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabricApi = 0.40.1+1.17
|
fabricApi = 0.43.0+1.18
|
||||||
fabricKotlin = 1.6.2+kotlin.1.5.20
|
fabricKotlin = 1.7.0+kotlin.1.6.0
|
||||||
rei = 6.0.264-alpha
|
rei = 7.0.341
|
||||||
|
|
||||||
# CurseForge
|
# CurseForge
|
||||||
cf.projectId = 391014
|
cf.projectId = 391014
|
||||||
cf.releaseType = release
|
cf.releaseType = release
|
||||||
cf.gameVersion = 1.17.1
|
cf.gameVersion = 1.18
|
||||||
cf.require = fabric-api, fabric-language-kotlin
|
cf.require = fabric-api, fabric-language-kotlin
|
||||||
cf.optional = roughly-enough-items
|
cf.optional = roughly-enough-items
|
||||||
|
|
||||||
# Modrinth
|
# Modrinth
|
||||||
mr.projectId = FTMcNdhv
|
mr.projectId = FTMcNdhv
|
||||||
mr.releaseType = release
|
mr.releaseType = release
|
||||||
mr.gameVersion = 1.17.1
|
mr.gameVersion = 1.18
|
||||||
|
|
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
distributionUrl = https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
distributionUrl = https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||||
distributionBase = GRADLE_USER_HOME
|
distributionBase = GRADLE_USER_HOME
|
||||||
distributionPath = wrapper/dists
|
distributionPath = wrapper/dists
|
||||||
zipStorePath = wrapper/dists
|
zipStorePath = wrapper/dists
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
package badasintended.slotlink.dev
|
package badasintended.slotlink.dev
|
||||||
|
|
||||||
import badasintended.slotlink.item.ModItem
|
import badasintended.slotlink.item.ModItem
|
||||||
import kotlin.random.Random
|
|
||||||
import kotlin.random.asJavaRandom
|
|
||||||
import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage
|
import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage
|
||||||
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant
|
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant
|
||||||
import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction
|
import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction
|
||||||
|
|
@ -16,13 +14,11 @@ import net.minecraft.util.registry.Registry
|
||||||
|
|
||||||
object StorageFillerItem : Item(ModItem.SETTINGS) {
|
object StorageFillerItem : Item(ModItem.SETTINGS) {
|
||||||
|
|
||||||
private val random = Random.asJavaRandom()
|
|
||||||
|
|
||||||
override fun hasGlint(stack: ItemStack?): Boolean {
|
override fun hasGlint(stack: ItemStack?): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION", "UnstableApiUsage")
|
@Suppress("UnstableApiUsage")
|
||||||
override fun useOnBlock(context: ItemUsageContext): ActionResult {
|
override fun useOnBlock(context: ItemUsageContext): ActionResult {
|
||||||
val world = context.world
|
val world = context.world
|
||||||
val player = context.player ?: return ActionResult.FAIL
|
val player = context.player ?: return ActionResult.FAIL
|
||||||
|
|
@ -34,7 +30,7 @@ object StorageFillerItem : Item(ModItem.SETTINGS) {
|
||||||
|
|
||||||
if (storage != null) Transaction.openOuter().use { transaction ->
|
if (storage != null) Transaction.openOuter().use { transaction ->
|
||||||
while (true) {
|
while (true) {
|
||||||
val item = Registry.ITEM.getRandom(random)
|
val item = Registry.ITEM.getRandom(world.random)
|
||||||
if (storage.insert(ItemVariant.of(item), item.maxCount.toLong(), transaction) == 0L) break
|
if (storage.insert(ItemVariant.of(item), item.maxCount.toLong(), transaction) == 0L) break
|
||||||
}
|
}
|
||||||
transaction.commit()
|
transaction.commit()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import badasintended.slotlink.util.BlockEntityBuilder
|
||||||
import badasintended.slotlink.util.bbCuboid
|
import badasintended.slotlink.util.bbCuboid
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
|
||||||
import net.fabricmc.fabric.api.`object`.builder.v1.block.FabricBlockSettings
|
import net.fabricmc.fabric.api.`object`.builder.v1.block.FabricBlockSettings
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags
|
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.Material
|
import net.minecraft.block.Material
|
||||||
|
|
@ -33,7 +32,6 @@ open class CableBlock(id: String = "cable", be: BlockEntityBuilder = ::CableBloc
|
||||||
val SETTINGS: Settings = FabricBlockSettings
|
val SETTINGS: Settings = FabricBlockSettings
|
||||||
.of(Material.GLASS)
|
.of(Material.GLASS)
|
||||||
.breakByHand(true)
|
.breakByHand(true)
|
||||||
.breakByTool(FabricToolTags.PICKAXES)
|
|
||||||
.hardness(3f)
|
.hardness(3f)
|
||||||
|
|
||||||
val PROPERTIES = mapOf(
|
val PROPERTIES = mapOf(
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import net.minecraft.block.entity.BlockEntityTicker
|
||||||
import net.minecraft.block.entity.BlockEntityType
|
import net.minecraft.block.entity.BlockEntityType
|
||||||
import net.minecraft.entity.LivingEntity
|
import net.minecraft.entity.LivingEntity
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.nbt.NbtCompound
|
|
||||||
import net.minecraft.nbt.NbtList
|
import net.minecraft.nbt.NbtList
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
|
@ -33,7 +32,7 @@ class MasterBlock : ModBlock("master") {
|
||||||
super.onPlaced(world, pos, state, placer, itemStack)
|
super.onPlaced(world, pos, state, placer, itemStack)
|
||||||
|
|
||||||
val blockEntity = world.getBlockEntity(pos)!!
|
val blockEntity = world.getBlockEntity(pos)!!
|
||||||
val nbt = blockEntity.writeNbt(NbtCompound())
|
val nbt = blockEntity.createNbt()
|
||||||
|
|
||||||
nbt.put("storagePos", NbtList())
|
nbt.put("storagePos", NbtList())
|
||||||
blockEntity.readNbt(nbt)
|
blockEntity.readNbt(nbt)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package badasintended.slotlink.block
|
||||||
|
|
||||||
import badasintended.slotlink.util.modId
|
import badasintended.slotlink.util.modId
|
||||||
import net.fabricmc.fabric.api.`object`.builder.v1.block.FabricBlockSettings
|
import net.fabricmc.fabric.api.`object`.builder.v1.block.FabricBlockSettings
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags
|
|
||||||
import net.minecraft.block.BlockRenderType
|
import net.minecraft.block.BlockRenderType
|
||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.BlockWithEntity
|
import net.minecraft.block.BlockWithEntity
|
||||||
|
|
@ -15,7 +14,6 @@ abstract class ModBlock(id: String, settings: Settings = SETTINGS) : BlockWithEn
|
||||||
val SETTINGS: Settings = FabricBlockSettings
|
val SETTINGS: Settings = FabricBlockSettings
|
||||||
.of(Material.STONE)
|
.of(Material.STONE)
|
||||||
.breakByHand(true)
|
.breakByHand(true)
|
||||||
.breakByTool(FabricToolTags.PICKAXES)
|
|
||||||
.hardness(5f)
|
.hardness(5f)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,15 +32,13 @@ abstract class ChildBlockEntity(
|
||||||
_network = value
|
_network = value
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun writeNbt(nbt: NbtCompound): NbtCompound {
|
override fun writeNbt(nbt: NbtCompound) {
|
||||||
super.writeNbt(nbt)
|
super.writeNbt(nbt)
|
||||||
|
|
||||||
network?.also {
|
network?.also {
|
||||||
if (!it.deleted) nbt.putIntArray("network", it.masterPos.toArray())
|
if (!it.deleted) nbt.putIntArray("network", it.masterPos.toArray())
|
||||||
}
|
}
|
||||||
nbt.putInt("sides", connectionData.sideBits)
|
nbt.putInt("sides", connectionData.sideBits)
|
||||||
|
|
||||||
return nbt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun readNbt(nbt: NbtCompound) {
|
override fun readNbt(nbt: NbtCompound) {
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ abstract class ConnectorCableBlockEntity(
|
||||||
|
|
||||||
protected abstract fun Block.isIgnored(): Boolean
|
protected abstract fun Block.isIgnored(): Boolean
|
||||||
|
|
||||||
override fun writeNbt(nbt: NbtCompound): NbtCompound {
|
override fun writeNbt(nbt: NbtCompound) {
|
||||||
super.writeNbt(nbt)
|
super.writeNbt(nbt)
|
||||||
|
|
||||||
nbt.putInt("priority", priority)
|
nbt.putInt("priority", priority)
|
||||||
|
|
@ -131,8 +131,6 @@ abstract class ConnectorCableBlockEntity(
|
||||||
}
|
}
|
||||||
filterTag.put("Items", list)
|
filterTag.put("Items", list)
|
||||||
nbt.put("filter", filterTag)
|
nbt.put("filter", filterTag)
|
||||||
|
|
||||||
return nbt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun readNbt(nbt: NbtCompound) {
|
override fun readNbt(nbt: NbtCompound) {
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,9 @@ class MasterBlockEntity(pos: BlockPos, state: BlockState) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun writeNbt(nbt: NbtCompound): NbtCompound {
|
override fun writeNbt(nbt: NbtCompound) {
|
||||||
super.writeNbt(nbt)
|
super.writeNbt(nbt)
|
||||||
nbt.putInt("sides", connectionData.sideBits)
|
nbt.putInt("sides", connectionData.sideBits)
|
||||||
return nbt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun readNbt(nbt: NbtCompound) {
|
override fun readNbt(nbt: NbtCompound) {
|
||||||
|
|
|
||||||
|
|
@ -53,13 +53,11 @@ abstract class TransferCableBlockEntity(
|
||||||
mode = Mode.of(nbt.getInt("mode"))
|
mode = Mode.of(nbt.getInt("mode"))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun writeNbt(nbt: NbtCompound): NbtCompound {
|
override fun writeNbt(nbt: NbtCompound) {
|
||||||
super.writeNbt(nbt)
|
super.writeNbt(nbt)
|
||||||
|
|
||||||
nbt.putInt("side", side.id)
|
nbt.putInt("side", side.id)
|
||||||
nbt.putInt("mode", mode.ordinal)
|
nbt.putInt("mode", mode.ordinal)
|
||||||
|
|
||||||
return nbt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createMenu(syncId: Int, inv: PlayerInventory, player: PlayerEntity): ScreenHandler? {
|
override fun createMenu(syncId: Int, inv: PlayerInventory, player: PlayerEntity): ScreenHandler? {
|
||||||
|
|
|
||||||
|
|
@ -26,25 +26,26 @@ import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry
|
||||||
import me.shedaniel.rei.api.client.registry.transfer.TransferHandler.Result.createNotApplicable
|
import me.shedaniel.rei.api.client.registry.transfer.TransferHandler.Result.createNotApplicable
|
||||||
import me.shedaniel.rei.api.client.registry.transfer.TransferHandler.Result.createSuccessful
|
import me.shedaniel.rei.api.client.registry.transfer.TransferHandler.Result.createSuccessful
|
||||||
import me.shedaniel.rei.api.client.registry.transfer.TransferHandlerRegistry
|
import me.shedaniel.rei.api.client.registry.transfer.TransferHandlerRegistry
|
||||||
|
import me.shedaniel.rei.api.common.entry.EntryIngredient
|
||||||
|
import me.shedaniel.rei.api.common.plugins.PluginManager
|
||||||
|
import me.shedaniel.rei.api.common.registry.ReloadStage
|
||||||
import me.shedaniel.rei.api.common.util.EntryStacks
|
import me.shedaniel.rei.api.common.util.EntryStacks
|
||||||
import me.shedaniel.rei.plugin.common.BuiltinPlugin
|
import me.shedaniel.rei.plugin.common.BuiltinPlugin
|
||||||
import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCraftingDisplay
|
import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCraftingDisplay
|
||||||
import net.fabricmc.api.EnvType
|
|
||||||
import net.fabricmc.api.Environment
|
|
||||||
import net.minecraft.client.gui.screen.Screen
|
import net.minecraft.client.gui.screen.Screen
|
||||||
import net.minecraft.recipe.RecipeType
|
import net.minecraft.recipe.RecipeType
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
class ReiPlugin : REIClientPlugin {
|
class ReiPlugin : REIClientPlugin {
|
||||||
|
|
||||||
override fun registerCategories(registry: CategoryRegistry) {
|
override fun registerCategories(registry: CategoryRegistry) {
|
||||||
registry.addWorkstations(BuiltinPlugin.CRAFTING, EntryStacks.of(Blocks.REQUEST))
|
registry.addWorkstations(BuiltinPlugin.CRAFTING, EntryStacks.of(Blocks.REQUEST))
|
||||||
registry.addWorkstations(
|
registry.addWorkstations(
|
||||||
BuiltinPlugin.CRAFTING,
|
BuiltinPlugin.CRAFTING, EntryIngredient.of(
|
||||||
EntryStacks.of(Items.LIMITED_REMOTE),
|
EntryStacks.of(Items.LIMITED_REMOTE),
|
||||||
EntryStacks.of(Items.UNLIMITED_REMOTE),
|
EntryStacks.of(Items.UNLIMITED_REMOTE),
|
||||||
EntryStacks.of(Items.MULTI_DIM_REMOTE)
|
EntryStacks.of(Items.MULTI_DIM_REMOTE)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,7 +109,7 @@ class ReiPlugin : REIClientPlugin {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun postRegister() {
|
override fun postStage(manager: PluginManager<REIClientPlugin>?, stage: ReloadStage?) {
|
||||||
reiSearchHandler = { REIRuntime.getInstance().searchTextField?.text = it }
|
reiSearchHandler = { REIRuntime.getInstance().searchTextField?.text = it }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values" : [
|
||||||
|
"slotlink:master",
|
||||||
|
"slotlink:request",
|
||||||
|
"slotlink:cable",
|
||||||
|
"slotlink:link_cable",
|
||||||
|
"slotlink:import_cable",
|
||||||
|
"slotlink:export_cable"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -20,9 +20,9 @@
|
||||||
},
|
},
|
||||||
"mixins" : ["slotlink.mixins.json"],
|
"mixins" : ["slotlink.mixins.json"],
|
||||||
"depends" : {
|
"depends" : {
|
||||||
"fabricloader" : ">=0.8",
|
"fabricloader" : ">=0.12",
|
||||||
"minecraft" : "1.17.x",
|
"minecraft" : "1.18.x",
|
||||||
"fabric" : ">=0.40.1",
|
"fabric" : ">=0.43",
|
||||||
"fabric-language-kotlin": ">=1.6"
|
"fabric-language-kotlin": ">=1.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue