Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
pullRequests: true
issues: true
issuesWoLabels: true
excludeLabels: 1.12.2,1.16.5,forge,1.18.2
excludeLabels: 1.12.2,1.16.5,forge
prWoLabels: true
- name: Build with Gradle
run: ./gradlew build publishCurseForge
Expand Down
23 changes: 7 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import net.darkhax.curseforgegradle.Constants as CFG_Constants

plugins {
id("fabric-loom")
val kotlinVersion: String = "1.7.20"
val kotlinVersion: String = "1.6.21"
kotlin("jvm").version(kotlinVersion)
id("net.darkhax.curseforgegradle") version "1.0.10"
}
Expand Down Expand Up @@ -59,20 +59,11 @@ dependencies {
modImplementation("net.fabricmc.fabric-api", "fabric-api", fabricVersion)
val fabricKotlinVersion: String by project
modImplementation("net.fabricmc", "fabric-language-kotlin", fabricKotlinVersion)
// modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:$reiVersion")
// modRuntimeOnly("me.shedaniel:RoughlyEnoughItems-fabric:$reiVersion")

modImplementation("teamreborn", "energy", "2.2.0") {
exclude(group = "net.fabricmc.fabric-api")
}

// include modApi('teamreborn:energy:<latest_version>') {
// exclude(group: "net.fabricmc.fabric-api")
// }
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:$reiVersion")
modRuntimeOnly("me.shedaniel:RoughlyEnoughItems-fabric:$reiVersion")

// modImplementation("appeng:appliedenergistics2-fabric:$aeVersion")
// modImplementation("curse.maven:ae2-things-563800:3796436")
modImplementation("curse.maven:ae2-223794:4030069")
modImplementation("appeng:appliedenergistics2-fabric:$aeVersion")
modImplementation("curse.maven:ae2things-563800:4024417")

annotationProcessor("org.spongepowered:mixin:0.8.5:processor")
modCompileOnly("org.spongepowered:mixin:0.8.5") { isTransitive = false }
Expand All @@ -92,8 +83,8 @@ tasks {
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions { jvmTarget = javaVersion.toString() }
// sourceCompatibility = javaVersion.toString()
// targetCompatibility = javaVersion.toString()
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
}
jar { from("LICENSE") { rename { "${it}_${base.archivesName}" } } }
processResources {
Expand Down
20 changes: 10 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@
#fabricKotlinVersion = 1.7.4+kotlin.1.6.21
#

modBaseName=AEAdditions-1.19.2
aeVersion=12.8.3-beta
modBaseName=AEAdditions-1.18.2
aeVersion=11.7.2
modCurseId=493962
reiVersion=9.1.550
reiVersion=8.3.594
kotlin.code.style = official
org.gradle.jvmargs = -Xmx1G
org.gradle.warning.mode = all
# Check these on https://fabricmc.net/develop/
minecraftVersion = 1.19.2
yarnMappings = 1.19.2+build.24
loaderVersion = 0.14.9
minecraftVersion=1.18.2
yarnMappings=1.18.2+build.4
loaderVersion=0.14.21
# Fabric API
fabricVersion = 0.63.0+1.19.2
loomVersion = 1.0-SNAPSHOT
fabricVersion=0.76.0+1.18.2
loomVersion = 0.11-SNAPSHOT
# Mod Properties
modVersion = 3.0.3
mavenGroup = com.the9grounds
archivesBaseName = AEAdditions-1.19.2
archivesBaseName = AEAdditions-1.18.2
# Kotlin
systemProp.kotlinVersion = 1.6.21
fabricKotlinVersion = 1.8.5+kotlin.1.7.20
fabricKotlinVersion = 1.7.4+kotlin.1.6.21
12 changes: 8 additions & 4 deletions src/main/kotlin/com/the9grounds/aeadditions/AEAdditions.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package com.the9grounds.aeadditions

import appeng.api.IAEAddonEntrypoint
import appeng.api.stacks.AEKeyType
import appeng.items.storage.BasicStorageCell
import com.the9grounds.aeadditions.integration.Integration
import com.the9grounds.aeadditions.integration.Mods
import com.the9grounds.aeadditions.integration.appeng.AppEng
import com.the9grounds.aeadditions.integration.appeng.InitUpgrades
import com.the9grounds.aeadditions.item.storage.DiskCell
import com.the9grounds.aeadditions.item.storage.StorageCell
import com.the9grounds.aeadditions.registries.Blocks
import com.the9grounds.aeadditions.registries.Cells
import com.the9grounds.aeadditions.registries.Items
import com.the9grounds.aeadditions.registries.client.Models
import io.github.projectet.ae2things.item.DISKDrive
import net.fabricmc.api.EnvType
import net.fabricmc.api.Environment
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap
Expand All @@ -36,10 +40,10 @@ object AEAdditions : IAEAddonEntrypoint {

itemColorsRegister(BasicStorageCell::getColor, storageCells)

// if (Mods.AE2THINGS.isEnabled) {
// val diskCells = Items.ITEMS.filter { it is DiskCell && it.keyType == AEKeyType.fluids() }.toTypedArray()
// itemColorsRegister(DISKDrive::getColor, diskCells)
// }
if (Mods.AE2THINGS.isEnabled) {
val diskCells = Items.ITEMS.filter { it is DiskCell && it.keyType == AEKeyType.fluids() }.toTypedArray()
itemColorsRegister(DISKDrive::getColor, diskCells)
}
}

@Environment(EnvType.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import appeng.api.stacks.AEKey
import appeng.api.stacks.AEKeyType
import appeng.api.storage.cells.ICellWorkbenchItem
import net.minecraft.world.item.ItemStack
import javax.annotation.Nonnull

interface IAEAdditionsStorageCell : ICellWorkbenchItem {

Expand All @@ -19,7 +20,7 @@ interface IAEAdditionsStorageCell : ICellWorkbenchItem {
*
* @return number of bytes
*/
fun getBytes(cellItem: ItemStack): Int
fun getBytes(@Nonnull cellItem: ItemStack): Int

/**
* Determines the number of bytes used for any type included on the cell.
Expand All @@ -28,7 +29,7 @@ interface IAEAdditionsStorageCell : ICellWorkbenchItem {
*
* @return number of bytes
*/
fun getBytesPerType(cellItem: ItemStack): Int
fun getBytesPerType(@Nonnull cellItem: ItemStack): Int

/**
* Allows you to fine tune which items are allowed on a given cell, if you don't care, just return false; As the
Expand Down Expand Up @@ -70,7 +71,7 @@ interface IAEAdditionsStorageCell : ICellWorkbenchItem {
*
* @return number of types
*/
fun getTotalTypes(cellItem: ItemStack): Int
fun getTotalTypes(@Nonnull cellItem: ItemStack): Int

/**
* @return drain in ae/t this storage cell will use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum class ExtendedCraftingUnitType(val kiloBytes: Int) : ICraftingUnitType {
STORAGE_16384(16384),
STORAGE_65536(65536);

override fun getStorageBytes(): Long = 1024L * kiloBytes
override fun getStorageBytes(): Int = 1024 * kiloBytes

override fun getAcceleratorThreads(): Int = 0

Expand Down
187 changes: 187 additions & 0 deletions src/main/kotlin/com/the9grounds/aeadditions/client/helpers/Blit.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
package com.the9grounds.aeadditions.client.helpers

import com.mojang.blaze3d.systems.RenderSystem
import com.mojang.blaze3d.vertex.*
import com.the9grounds.aeadditions.AEAdditions
import com.the9grounds.aeadditions.util.Colors
import net.minecraft.client.renderer.GameRenderer
import net.minecraft.client.renderer.Rect2i
import net.minecraft.client.renderer.texture.TextureAtlasSprite
import net.minecraft.resources.ResourceLocation
import org.lwjgl.opengl.GL11

class Blit(val texture: ResourceLocation, val referenceWidth: Int, val referenceHeight: Int) {

companion object {
const val DEFAULT_WIDTH = 256
const val DEFAULT_HEIGHT = 256
}

var r = 255
var g = 255
var b = 255
var a = 255

/**
* The section of the texture we are drawing from
*/
var srcRect: Rect2i? = null

/**
* The destination on the screen that we are drawing to
*/
var destRect = Rect2i(0, 0, 0, 0)

/**
* Apply blending function?
*/
var blending = true

constructor(texture: ResourceLocation) : this(texture, DEFAULT_WIDTH, DEFAULT_HEIGHT)

constructor(sprite: TextureAtlasSprite) : this(sprite.atlas().location(), DEFAULT_WIDTH, DEFAULT_HEIGHT) {
src(
(sprite.u0 * DEFAULT_WIDTH).toInt(),
(sprite.v0 * DEFAULT_HEIGHT).toInt(),
((sprite.u1 - sprite.u0) * DEFAULT_WIDTH).toInt(),
((sprite.v1 - sprite.v0) * DEFAULT_HEIGHT).toInt()
)
}

constructor(resource: String): this(ResourceLocation(AEAdditions.MOD_ID, "textures/${resource}"), DEFAULT_WIDTH, DEFAULT_HEIGHT)
constructor(resource: String, width: Int, height: Int): this(ResourceLocation(AEAdditions.MOD_ID, "textures/${resource}"), width, height)

fun src(x: Int, y: Int, width: Int, height: Int): Blit {
srcRect = Rect2i(x, y, width, height)

return this
}

fun dest(x: Int, y: Int, width: Int, height: Int): Blit {
destRect = Rect2i(x, y, width, height)

return this
}

fun dest(x: Int, y: Int): Blit {
return dest(x, y, 0, 0)
}

fun color(r: Float, g: Float, b: Float): Blit {
return this.apply {
this.r = (r.coerceIn(0f, 1f) * 255).toInt()
this.g = (g.coerceIn(0f, 1f) * 255).toInt()
this.b = (b.coerceIn(0f, 1f) * 255).toInt()
}
}

fun opacity(a: Float): Blit {
return this.apply {
this.a = (a.coerceIn(0f, 1f) * 255).toInt()
}
}

fun color(r: Float, g: Float, b: Float, a: Float): Blit {
return this.color(r, g, b).opacity(a)
}

fun colorRgb(color: Int, withAlpha: Boolean = false): Blit {
val r = Colors.getRed(color)
val g = Colors.getGreen(color)
val b = Colors.getBlue(color)

color(r, g, b)

if (withAlpha) {
val a = Colors.getAlpha(color)

opacity(a)
}

return this
}

fun copy(): Blit {
val copy = Blit(texture, referenceWidth, referenceHeight)

val self = this

return copy.apply {
srcRect = self.srcRect
destRect = self.destRect
blending = self.blending
r = self.r
g = self.g
b = self.b
a = self.a
}
}

fun draw(poseStack: PoseStack, zIndex: Float) {
RenderSystem.setShader { GameRenderer.getPositionTexColorShader() }
RenderSystem.setShaderTexture(0, texture)

val minU: Float
val minV: Float
val maxU: Float
val maxV: Float

if (srcRect == null) {
minU = 0f
minV = 0f
maxU = 1f
maxV = 1f
} else {
minU = srcRect!!.x / referenceWidth.toFloat()
minV = srcRect!!.y / referenceHeight.toFloat()
maxU = (srcRect!!.x + srcRect!!.width) / referenceWidth.toFloat()
maxV = (srcRect!!.y + srcRect!!.height) / referenceHeight.toFloat()
}

val x1: Float = destRect.x.toFloat()
val y1: Float = destRect.y.toFloat()

var x2 = x1
var y2 = y1

if (destRect.width != 0 && destRect.height != 0) {
x2 += destRect.width.toFloat()
y2 += destRect.height.toFloat()
} else if (srcRect != null) {
x2 += srcRect!!.width.toFloat()
y2 += srcRect!!.height.toFloat()
}

val matrix = poseStack.last().pose()

val bufferBuilder = Tesselator.getInstance().builder
bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX)
bufferBuilder.vertex(matrix, x1, y2, zIndex)
.color(r, g, b, a)
.uv(minU, maxV)
.endVertex()
bufferBuilder.vertex(matrix, x2, y2, zIndex)
.color(r, g, b, a)
.uv(maxU, maxV)
.endVertex()
bufferBuilder.vertex(matrix, x2, y1, zIndex)
.color(r, g, b, a)
.uv(maxU, minV)
.endVertex()
bufferBuilder.vertex(matrix, x1, y1, zIndex)
.color(r, g, b, a)
.uv(minU, minV)
.endVertex()
bufferBuilder.end()

if (blending) {
RenderSystem.enableBlend()
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA)
} else {
RenderSystem.disableBlend()
}

RenderSystem.enableTexture()
BufferUploader.end(bufferBuilder)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.the9grounds.aeadditions.integration.appeng

import appeng.api.storage.StorageCells
import com.the9grounds.aeadditions.integration.Mods
import com.the9grounds.aeadditions.me.storage.AEAdditionsCellHandler
import com.the9grounds.aeadditions.me.storage.ExtendedDiskCellHandler
import com.the9grounds.aeadditions.me.storage.SuperCellHandler

class AppEng {
Expand All @@ -11,9 +13,9 @@ class AppEng {
fun initCellHandler() {
StorageCells.addCellHandler(AEAdditionsCellHandler)
StorageCells.addCellHandler(SuperCellHandler)
// if (Mods.AE2THINGS.isEnabled) {
// StorageCells.addCellHandler(ExtendedDiskCellHandler())
// }
if (Mods.AE2THINGS.isEnabled) {
StorageCells.addCellHandler(ExtendedDiskCellHandler())
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DiskCell(properties: Item.Properties, private val _keyType: AEKeyType, val
}

override fun getBytes(cellItem: ItemStack?): Int {
return kilobytes * 1024
return kilobytes * 1000
}

override fun getIdleDrain(): Double {
Expand Down
Loading