Skip to content

Commit

Permalink
update to gtceu 2.7.4
Browse files Browse the repository at this point in the history
fix some laboratory issues
  • Loading branch information
serenibyss committed Nov 20, 2023
1 parent 42fbe11 commit becebea
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 63 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1690966774
//version: 1699743071
/*
* DO NOT CHANGE THIS FILE!
* Also, you may replace this file at any time if there is an update available.
Expand All @@ -24,9 +24,9 @@ plugins {
id 'eclipse'
id 'maven-publish'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.23'
id 'net.darkhax.curseforgegradle' version '1.0.14' apply false
id 'com.modrinth.minotaur' version '2.8.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24'
id 'net.darkhax.curseforgegradle' version '1.1.16' apply false
id 'com.modrinth.minotaur' version '2.8.4' apply false
id 'com.diffplug.spotless' version '6.13.0' apply false
id 'com.palantir.git-version' version '3.0.0' apply false
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
Expand Down Expand Up @@ -456,7 +456,7 @@ configurations {
}
}

String mixinProviderSpec = 'zone.rong:mixinbooter:8.3'
String mixinProviderSpec = 'zone.rong:mixinbooter:8.9'
dependencies {
if (usesMixins.toBoolean()) {
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
Expand Down
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
dependencies {
// Hard Dependencies
implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4641113") // GTCEu 2.7.1
implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4799055") // GTCEu 2.7.4
implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848") // CCL 3.2.3.358

// Soft Dependencies
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ modGroup = serendustry

# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion = 0.0.2
modVersion = 0.0.3

# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
includeMCVersionJar = true
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/serendustry/SerendustryEventHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import gregtech.api.unification.ore.OrePrefix.*
import gregtech.api.unification.stack.UnificationEntry
import gregtech.loaders.recipe.CraftingComponent
import gregtech.loaders.recipe.CraftingComponent.*
import net.minecraft.nbt.NBTTagCompound
import net.minecraft.util.math.BlockPos
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
Expand Down Expand Up @@ -86,7 +87,7 @@ class SerendustryEventHandler {
// TODO

// Spring
appendToComponent(GTValues.UEV, SPRING, spring, Pikyonium, Lafium, Signalium, Bedrockium, Quantium);
appendToComponent(GTValues.UEV, SPRING, spring, Pikyonium, Lafium, Signalium, Bedrockium, Quantium)
}

private fun appendToComponent(component: Component, prefix: OrePrefix, vararg materials: Material) =
Expand Down
15 changes: 0 additions & 15 deletions src/main/kotlin/serendustry/SerendustryUtil.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package serendustry.item.material

import codechicken.lib.vec.uv.UV
import gregtech.api.GTValues.*
import gregtech.api.unification.material.Material
import gregtech.api.unification.material.Materials.*
Expand Down
60 changes: 25 additions & 35 deletions src/main/kotlin/serendustry/machine/LaboratoryProperty.kt
Original file line number Diff line number Diff line change
@@ -1,64 +1,58 @@
package serendustry.machine

import com.google.common.collect.HashBasedTable
import com.google.common.collect.ImmutableTable
import com.google.common.collect.Table
import gregtech.api.GTValues
import gregtech.api.metatileentity.MetaTileEntity
import gregtech.api.metatileentity.TieredMetaTileEntity
import gregtech.api.metatileentity.multiblock.MultiblockControllerBase
import gregtech.api.recipes.RecipeMap
import gregtech.api.recipes.recipeproperties.RecipeProperty
import gregtech.client.renderer.handler.TerminalARRenderer
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.Gui
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.renderer.RenderHelper
import net.minecraft.client.resources.I18n
import net.minecraft.client.util.ITooltipFlag
import net.minecraft.item.ItemStack
import net.minecraft.util.ResourceLocation
import net.minecraftforge.fml.client.config.GuiUtils
import net.minecraftforge.fml.relauncher.Side
import net.minecraftforge.fml.relauncher.SideOnly
import serendustry.getMachineStack
import org.jetbrains.annotations.NotNull
import serendustry.machine.LaboratoryProperty.LaboratoryEntry
import java.util.*
import java.util.stream.Collectors
import javax.annotation.Nonnull


class LaboratoryProperty private constructor(): RecipeProperty<LaboratoryEntry>(KEY, LaboratoryEntry::class.java) {
companion object {

const val KEY = "laboratory_internal"

private val ALLOWED_MACHINES = HashSet<ResourceLocation>()

private var instance: LaboratoryProperty? = null
val instance: LaboratoryProperty by lazy { LaboratoryProperty() }

fun getInstance() = instance ?: LaboratoryProperty().also { instance = it }
fun isMachineAllowed(@NotNull machine: MetaTileEntity) =
if (machine is MultiblockControllerBase) false else machine is TieredMetaTileEntity && machine.getRecipeMap() != null

// todo remove
fun registerLaboratoryMachine(vararg machines: MetaTileEntity) =
ALLOWED_MACHINES.addAll(Arrays.stream(machines).filter(Objects::nonNull).map { mte -> mte.metaTileEntityId }
.collect(Collectors.toList()))
private val mapTierToMachineStack: Table<RecipeMap<*>, Int, ItemStack> = HashBasedTable.create()

fun isMachineAllowed(@Nonnull machine: MetaTileEntity) =
if (machine is MultiblockControllerBase) false else machine is TieredMetaTileEntity && machine.getRecipeMap() != null
fun getMachineStack(map: RecipeMap<*>, tier: Int?, count: Int?): ItemStack? {
if (tier !in 0..GTValues.MAX) return ItemStack.EMPTY
val stack = mapTierToMachineStack.get(map, tier)?.copy() ?: return ItemStack.EMPTY
return stack.also { it.count = count ?: 1 }
}
}


@SideOnly(Side.CLIENT)
override fun drawInfo(minecraft: Minecraft, x: Int, y: Int, color: Int, value: Any, mouseX: Int, mouseY: Int) {
val entry = castValue(value)
if (entry.getMachineTable().size() != 0) {
minecraft.fontRenderer.drawString(
I18n.format("serendustry.machine.industrial_laboratory.jei_header"),
TerminalARRenderer.x,
TerminalARRenderer.y,
x,
y,
color
)
TerminalARRenderer.y += 10
var xOffset = TerminalARRenderer.x
val y = y + 10
var xOffset = x
for (cell in entry.getMachineTable().cellSet()) {
val map = cell.rowKey ?: continue
val tier = cell.columnKey
Expand All @@ -74,25 +68,25 @@ class LaboratoryProperty private constructor(): RecipeProperty<LaboratoryEntry>(
RenderHelper.enableGUIStandardItemLighting()
GlStateManager.pushMatrix()
val itemRender = minecraft.renderItem
itemRender.renderItemAndEffectIntoGUI(renderStack, xOffset, TerminalARRenderer.y)
itemRender.renderItemAndEffectIntoGUI(renderStack, xOffset, y)
itemRender.renderItemOverlayIntoGUI(
minecraft.fontRenderer,
renderStack,
xOffset,
TerminalARRenderer.y,
y,
null
)
GlStateManager.enableAlpha()
GlStateManager.popMatrix()
RenderHelper.disableStandardItemLighting()
if (mouseX >= TerminalARRenderer.x + xOffset && mouseY >= TerminalARRenderer.y && TerminalARRenderer.x + 16 > mouseX && TerminalARRenderer.y + 16 > mouseY) {
if (mouseX >= x + xOffset && mouseY >= y && x + 16 > mouseX && y + 16 > mouseY) {
GlStateManager.disableDepth()
GlStateManager.colorMask(true, true, true, false)
Gui.drawRect(
TerminalARRenderer.x + xOffset,
TerminalARRenderer.y,
TerminalARRenderer.x + xOffset + 16,
TerminalARRenderer.y + 16,
x + xOffset,
y,
x + xOffset + 16,
y + 16,
-2130706433
)
GlStateManager.color(1f, 1f, 1f, 1f)
Expand Down Expand Up @@ -123,13 +117,9 @@ class LaboratoryProperty private constructor(): RecipeProperty<LaboratoryEntry>(
@SideOnly(Side.CLIENT)
override fun drawInfo(p0: Minecraft?, p1: Int, p2: Int, p3: Int, p4: Any?) {}

class LaboratoryEntry(tableBuilder: ImmutableTable.Builder<RecipeMap<*>, Int, Int>) {
data class LaboratoryEntry(private val tableBuilder: ImmutableTable.Builder<RecipeMap<*>, Int, Int>) {

private var machines: Table<RecipeMap<*>, Int, Int>

init {
machines = tableBuilder.build()
}
private var machines: Table<RecipeMap<*>, Int, Int> = tableBuilder.build()

fun getMachineTable() = machines
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class LaboratoryRecipeBuilder : RecipeBuilder<LaboratoryRecipeBuilder> {
override fun applyProperty(key: String, value: Any?): Boolean {
if (key == LaboratoryProperty.KEY) {
if (value is LaboratoryEntry) {
return applyProperty(LaboratoryProperty.getInstance(), value)
return applyProperty(LaboratoryProperty.instance, value)
}
if (value is String) { // from GrS or CT
val stringPair = value.split(",")
Expand Down Expand Up @@ -52,7 +52,7 @@ class LaboratoryRecipeBuilder : RecipeBuilder<LaboratoryRecipeBuilder> {
}

override fun buildAndRegister() {
super.applyProperty(LaboratoryProperty.getInstance(), LaboratoryEntry(internalBuilder))
super.applyProperty(LaboratoryProperty.instance, LaboratoryEntry(internalBuilder))
super.buildAndRegister()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class MetaTileEntityIndustrialLaboratory(id: ResourceLocation): RecipeMapMultibl

override fun checkRecipe(recipe: Recipe): Boolean {
if (!super.checkRecipe(recipe)) return false
val entry = recipe.getProperty(LaboratoryProperty.getInstance(), null) ?: return true
val entry = recipe.getProperty(LaboratoryProperty.instance, null) ?: return true
return getMetaTileEntity().laboratoryResources.matchesEntry(entry)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/serendustry/recipe/WasteFluidRecipes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal fun wasteFluidRecipes() {
.input(WASTE_FLUID_EXTRACTOR_FILLED)
.output(WASTE_FLUID_EXTRACTOR)
.fluidOutputs(AnimalWaste.getFluid(1000))
.duration(400).EUt(30).buildAndRegister();
.duration(400).EUt(30).buildAndRegister()

//ASSEMBLY_LINE_RECIPES.recipeBuilder()
// .input(MetaItems.BATTERY_ULV_TANTALUM).input(OrePrefix.pipeNonupleFluid, Materials.Lead).inputs(MetaBlocks.WARNING_SIGN.getItemVariant(BlockWarningSign.SignType.SMALL_YELLOW_STRIPES)).input(MetaItems.BATTERY_ULV_TANTALUM)
Expand Down

0 comments on commit becebea

Please sign in to comment.