Skip to content

Commit

Permalink
Added UniHatch and Certificated Electrician
Browse files Browse the repository at this point in the history
  • Loading branch information
Taskeren committed Aug 21, 2024
1 parent 783783a commit f7d86d8
Show file tree
Hide file tree
Showing 13 changed files with 603 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ addon.local.gradle.kts
addon.late.local.gradle
addon.late.local.gradle.kts
layout.json
.kotlin/
1 change: 0 additions & 1 deletion src/main/kotlin/cn/taskeren/op/OP.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ object OP : OP_Logger {
val propertyDumpStackTraceOnMachineExplode get() = System.getProperty("op.dumpStackTraceOnMachineExplode") == "true"

val gtMachineBlock get() = GregTech_API.sBlockMachines

val livingBioChip get() = ItemList.Circuit_Parts_Chip_Bioware.get(1)

fun isMachineBlock(block: Block) = block == gtMachineBlock
Expand Down
12 changes: 11 additions & 1 deletion src/main/kotlin/cn/taskeren/op/gt/IdItemContainer.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package cn.taskeren.op.gt

import cn.taskeren.op.mc.OP_CreativeTab
import gregtech.api.enums.GT_Values
import gregtech.api.interfaces.IItemContainer
import gregtech.api.interfaces.IRecipeMap
import gregtech.api.interfaces.metatileentity.IMetaTileEntity
import gregtech.api.util.GT_RecipeBuilder
import net.minecraft.item.ItemStack

interface IdItemContainer : IItemContainer {
Expand All @@ -22,7 +26,13 @@ fun IdItemContainer.registerMachine(block: (id: Int) -> IMetaTileEntity) = regis
/**
* Create an instance of the item with given id. It will do the rest things for you.
*/
fun IdItemContainer.registerItem(block: (id: Int) -> ItemStack) {
fun IdItemContainer.registerItem(block: (id: Int) -> ItemStack) = apply {
val constructed = block(id.toInt())
set(constructed)
// add to the creative tab
OP_CreativeTab.itemList += constructed
}

fun IdItemContainer.addRecipe(recipeMap: IRecipeMap, block: GT_RecipeBuilder.(defaultItem: ItemStack) -> Unit) = apply {
GT_Values.RA.stdBuilder().apply { block(get(1)) }.addTo(recipeMap)
}
109 changes: 109 additions & 0 deletions src/main/kotlin/cn/taskeren/op/gt/init/OP_GTRegistrar.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
package cn.taskeren.op.gt.init

import cn.taskeren.op.gt.addRecipe
import cn.taskeren.op.gt.registerMachine
import cn.taskeren.op.gt.single.OP_ActiveTransformerRack
import cn.taskeren.op.gt.single.OP_DebugEnergyHatch
import cn.taskeren.op.gt.single.OP_OverpowerMachine
import cn.taskeren.op.gt.single.OP_UniHatch
import gregtech.api.enums.GT_Values
import gregtech.api.enums.ItemList
import gregtech.api.enums.Materials
import gregtech.api.enums.TierEU
import gregtech.api.recipe.RecipeMaps
import gregtech.api.util.GT_RecipeBuilder

object OP_GTRegistrar {

Expand All @@ -18,13 +26,110 @@ object OP_GTRegistrar {
OP_MachineItemList.OverpowerMachine.registerMachine {
OP_OverpowerMachine(it, "OP_NameOverpowerMachine", "Incredible Malicious Machine Overpowering System", 9)
}

// #tr OP_NameActiveTransformerRack
// #en Active Transformer Rack
// #zh 有源变压器机械架
// #tw 有源變壓器機械架
OP_MachineItemList.ActiveTransformerRack.registerMachine {
OP_ActiveTransformerRack(it, "OP_NameActiveTransformerRack", "Active Transformer Rack", 9)
}

// region UniHatch

// #tr OP_NameUniHatch_ULV
// #en UniHatch ULV
// #zh 组合式输入仓 ULV
OP_MachineItemList.UniHatch_ULV.registerMachine {
OP_UniHatch(it, "OP_NameUniHatch_ULV", "UniHatch ULV", 0)
}.addRecipe(RecipeMaps.assemblerRecipes) {
itemInputs(ItemList.Hull_ULV.get(1), ItemList.Hatch_Input_Bus_ULV.get(1), ItemList.Hatch_Input_ULV.get(1))
fluidInputs(Materials.Glue.getFluid(2L * GT_RecipeBuilder.INGOTS))
itemOutputs(it)
duration(16 * GT_RecipeBuilder.SECONDS)
eut(TierEU.RECIPE_ULV)
}.addRecipe(RecipeMaps.assemblerRecipes) {
itemInputs(ItemList.Hull_ULV.get(1), ItemList.Hatch_Input_Bus_ULV.get(1), ItemList.Hatch_Input_ULV.get(1))
fluidInputs(Materials.AdvancedGlue.getFluid(1L * GT_RecipeBuilder.INGOTS))
itemOutputs(it)
duration(8 * GT_RecipeBuilder.SECONDS)
eut(TierEU.RECIPE_ULV)
}
// #tr OP_NameUniHatch_LV
// #en UniHatch LV
// #zh 组合式输入仓 LV
OP_MachineItemList.UniHatch_LV.registerMachine {
OP_UniHatch(it, "OP_NameUniHatch_LV", "UniHatch LV", 1)
}.addRecipe(RecipeMaps.assemblerRecipes) {
itemInputs(ItemList.Hull_LV.get(1), ItemList.Hatch_Input_Bus_LV.get(1), ItemList.Hatch_Input_LV.get(1))
fluidInputs(Materials.AdvancedGlue.getFluid(4L * GT_RecipeBuilder.INGOTS))
itemOutputs(it)
duration(16 * GT_RecipeBuilder.SECONDS)
eut(TierEU.RECIPE_LV)
}.addRecipe(RecipeMaps.assemblerRecipes) {
itemInputs(ItemList.Hull_LV.get(1), ItemList.Hatch_Input_Bus_LV.get(1), ItemList.Hatch_Input_LV.get(1))
fluidInputs(Materials.Plastic.getMolten(2L * GT_RecipeBuilder.INGOTS))
itemOutputs(it)
duration(8 * GT_RecipeBuilder.SECONDS)
eut(TierEU.RECIPE_LV)
}
// #tr OP_NameUniHatch_MV
// #en UniHatch MV
// #zh 组合式输入仓 MV
OP_MachineItemList.UniHatch_MV.registerMachine {
OP_UniHatch(it, "OP_NameUniHatch_MV", "UniHatch MV", 2)
}.addRecipe(RecipeMaps.assemblerRecipes) {
itemInputs(ItemList.Hull_MV.get(1), ItemList.Hatch_Input_Bus_MV.get(1), ItemList.Hatch_Input_MV.get(1))
fluidInputs(Materials.Plastic.getMolten(16L * GT_RecipeBuilder.INGOTS))
itemOutputs(it)
duration(16 * GT_RecipeBuilder.SECONDS)
eut(TierEU.RECIPE_MV)
}.addRecipe(RecipeMaps.assemblerRecipes) {
itemInputs(ItemList.Hull_MV.get(1), ItemList.Hatch_Input_Bus_MV.get(1), ItemList.Hatch_Input_MV.get(1))
fluidInputs(Materials.PolyvinylChloride.getMolten(4L * GT_RecipeBuilder.INGOTS))
itemOutputs(it)
duration(8 * GT_RecipeBuilder.SECONDS)
eut(TierEU.RECIPE_MV)
}
// #tr OP_NameUniHatch_HV
// #en UniHatch HV
// #zh 组合式输入仓 HV
OP_MachineItemList.UniHatch_HV.registerMachine {
OP_UniHatch(it, "OP_NameUniHatch_HV", "UniHatch HV", 3)
}.addRecipe(RecipeMaps.assemblerRecipes) {
itemInputs(ItemList.Hull_HV.get(1), ItemList.Hatch_Input_Bus_HV.get(1), ItemList.Hatch_Input_HV.get(1))
fluidInputs(Materials.PolyvinylChloride.getMolten(24L * GT_RecipeBuilder.INGOTS))
itemOutputs(it)
duration(16 * GT_RecipeBuilder.SECONDS)
eut(TierEU.RECIPE_HV)
}.addRecipe(RecipeMaps.assemblerRecipes) {
itemInputs(ItemList.Hull_HV.get(1), ItemList.Hatch_Input_Bus_HV.get(1), ItemList.Hatch_Input_HV.get(1))
fluidInputs(Materials.Polytetrafluoroethylene.getMolten(4L * GT_RecipeBuilder.INGOTS))
itemOutputs(it)
duration(8 * GT_RecipeBuilder.SECONDS)
eut(TierEU.RECIPE_HV)
}
// #tr OP_NameUniHatch_EV
// #en UniHatch EV
// #zh 组合式输入仓 EV
OP_MachineItemList.UniHatch_EV.registerMachine {
OP_UniHatch(it, "OP_NameUniHatch_EV", "UniHatch EV", 4)
}.addRecipe(RecipeMaps.assemblerRecipes) {
itemInputs(ItemList.Hull_EV.get(1), ItemList.Hatch_Input_Bus_EV.get(1), ItemList.Hatch_Input_EV.get(1))
fluidInputs(Materials.Polytetrafluoroethylene.getMolten(32L * GT_RecipeBuilder.INGOTS))
itemOutputs(it)
duration(16 * GT_RecipeBuilder.SECONDS)
eut(TierEU.RECIPE_EV)
}.addRecipe(RecipeMaps.assemblerRecipes) {
itemInputs(ItemList.Hull_EV.get(1), ItemList.Hatch_Input_Bus_EV.get(1), ItemList.Hatch_Input_EV.get(1))
fluidInputs(Materials.Polybenzimidazole.getMolten(16L * GT_RecipeBuilder.INGOTS))
itemOutputs(it)
duration(8 * GT_RecipeBuilder.SECONDS)
eut(TierEU.RECIPE_EV)
}

// endregion

// #tr OP_NameDebugEnergyHatch
// #en Ascendant Realm Paracausal Manipulating Unit
// #zh 上维领域超因果单元
Expand All @@ -35,3 +140,7 @@ object OP_GTRegistrar {
}

}

internal fun addRecipe(block: GT_RecipeBuilder.() -> Unit) {
GT_Values.RA.stdBuilder().apply(block)
}
3 changes: 2 additions & 1 deletion src/main/kotlin/cn/taskeren/op/gt/init/OP_ItemList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack
enum class OP_ItemList(override val id: Short) : IdItemContainer, OP_Logger {

DyingBioChip(1),
CertifiedElectrician(2),

;

Expand Down Expand Up @@ -83,7 +84,7 @@ enum class OP_ItemList(override val id: Short) : IdItemContainer, OP_Logger {

override fun get(aAmount: Long, vararg aReplacements: Any?): ItemStack? {
sanityCheck()
if(GT_Utility.isStackValid(theItem)) {
if(GT_Utility.isStackInvalid(theItem)) {
logger.warn("Object in the OP_ItemList is null", NullPointerException())
return GT_Utility.copyAmount(aAmount.toInt(), aReplacements.filterIsInstance<ItemStack>().firstOrNull())
}
Expand Down
10 changes: 9 additions & 1 deletion src/main/kotlin/cn/taskeren/op/gt/init/OP_MachineItemList.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("EnumEntryName")

package cn.taskeren.op.gt.init

import cn.taskeren.op.OP_Logger
Expand All @@ -20,6 +22,12 @@ enum class OP_MachineItemList(override val id: Short) : IdItemContainer, OP_Logg
OverpowerMachine(14301),
ActiveTransformerRack(14302),

UniHatch_ULV(17500),
UniHatch_LV(17501),
UniHatch_MV(17502),
UniHatch_HV(17503),
UniHatch_EV(17504),

DebugEnergyHatch(17508),

;
Expand Down Expand Up @@ -89,7 +97,7 @@ enum class OP_MachineItemList(override val id: Short) : IdItemContainer, OP_Logg

override fun get(aAmount: Long, vararg aReplacements: Any?): ItemStack? {
sanityCheck()
if(GT_Utility.isStackValid(theItem)) {
if(GT_Utility.isStackInvalid(theItem)) {
logger.warn("Object in the OP_ItemList is null", NullPointerException())
return GT_Utility.copyAmount(aAmount.toInt(), aReplacements.filterIsInstance<ItemStack>().firstOrNull())
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/cn/taskeren/op/gt/item/OP_GeneratedItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ object OP_GeneratedItem : GT_MetaGenerated_Item_X32("metaitem.op") {
OP_ItemList.DyingBioChip.registerItem {
addItem(it, "Dying Bio Chip", "Squeezed Living Bio Chip")
}
OP_ItemList.CertifiedElectrician.registerItem {
addItem(it, "Certified Electrician", "Proof of your qualifications on Electrical Engineering")
}
}

}
Loading

0 comments on commit f7d86d8

Please sign in to comment.