Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
Added Multi Smelter TT Replacement
Browse files Browse the repository at this point in the history
Updated Coil Logic
  • Loading branch information
bartimaeusnek committed Dec 29, 2020
1 parent 02d7c22 commit 205579b
Show file tree
Hide file tree
Showing 10 changed files with 464 additions and 155 deletions.
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ val majorUpdate: String by project
val minorUpdate: String by project
val buildNumber: String by project

minecraft.version = "1.7.10-10.13.4.1614-1.7.10"
version = "$majorUpdate.$minorUpdate.$buildNumber"
group = "com.github.bartimaeusnek.bartworks"

//minecraft block
configure<UserExtension> {
this.version = "1.7.10-10.13.4.1614-1.7.10"
this.includes.addAll(
arrayOf(
"MainMod.java",
Expand Down Expand Up @@ -121,9 +121,9 @@ dependencies {
compileOnly("com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf")
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
compileOnly("mods.railcraft:Railcraft_1.7.10:9.12.3.0:dev")
compileOnly("micdoodle8.mods:MicdoodleCore:$galacticraftVersion:Dev")
compileOnly("micdoodle8.mods:GalacticraftCore:$galacticraftVersion:Dev")
compileOnly("micdoodle8.mods:Galacticraft-Planets:$galacticraftVersion:Dev")
compile("micdoodle8.mods:MicdoodleCore:$galacticraftVersion:Dev")
compile("micdoodle8.mods:GalacticraftCore:$galacticraftVersion:Dev")
compile("micdoodle8.mods:Galacticraft-Planets:$galacticraftVersion:Dev")
compileOnly("li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api")
compileOnly("net.sengir.forestry:forestry_1.7.10:4.2.16.64:dev")
//jitpack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public boolean checkRecipe(ItemStack itemStack) {
int processed = 0;

while (this.getStoredInputs().size() > 0 && processed < ConfigHandler.megaMachinesMax) {
if (tRecipe != null && (tRecipe.mEUt * (processed + 1)) < nominalV && tRecipe.isRecipeInputEqual(true, null, tInputs)) {
if (tRecipe != null && ((long) tRecipe.mEUt * (processed + 1)) < nominalV && tRecipe.isRecipeInputEqual(true, null, tInputs)) {
found_Recipe = true;
for (int i = 0; i < tRecipe.mOutputs.length; i++) {
outputItems.add(tRecipe.getOutput(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
import com.github.bartimaeusnek.crossmod.GTpp.loader.RadioHatchCompat;
import com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy;
import com.github.bartimaeusnek.crossmod.tectech.TecTechResearchLoader;
import com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement.TT_ElectronicBlastFurnace;
import com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement.TT_ImplosionCompressor;
import com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement.TT_OilCrackingUnit;
import com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement.TT_VaccuumFreezer;
import com.github.bartimaeusnek.crossmod.tectech.tileentites.multi.GT_Replacement.*;
import com.github.bartimaeusnek.crossmod.thaumcraft.CustomAspects;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
Expand Down Expand Up @@ -80,12 +77,13 @@ public void init(FMLInitializationEvent init) {
if (LoaderReference.GalacticraftCore)
GalacticraftProxy.init(init);
//Base GT -> TT Replacement
//if (LoaderReference.tectech) {
// new TT_VaccuumFreezer(null);
// new TT_OilCrackingUnit(null);
// new TT_ImplosionCompressor(null);
// new TT_ElectronicBlastFurnace(null);
//}
if (LoaderReference.tectech) {
new TT_VaccuumFreezer(null,null);
new TT_OilCrackingUnit(null,null);
new TT_ImplosionCompressor(null,null);
new TT_ElectronicBlastFurnace(null,null);
new TT_MultiSmelter(null,null);
}
}

@Mod.EventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
import com.github.technus.tectech.mechanics.structure.IStructureElement;
import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM;
import gregtech.api.GregTech_API;
import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.interfaces.IHeatingCoil;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

Expand All @@ -43,10 +46,14 @@ public static <MultiBlock extends GT_MetaTileEntity_MultiblockBase_EM & IHasCoil

@Override
public boolean check(MultiBlock multiBlock, World world, int x, int y, int z) {
if (multiBlock.getCoilMeta() == -1)
multiBlock.setCoilMeta((short) world.getBlockMetadata(x, y, z));
return multiBlock.getCoilMeta() == (short) world.getBlockMetadata(x, y, z)
&& GregTech_API.sBlockCasings5 == world.getBlock(x, y, z);
Block coil = world.getBlock(x, y, z);
if (!(coil instanceof IHeatingCoil))
return false;
int meta = world.getBlockMetadata(x, y, z);
HeatingCoilLevel heat = ((IHeatingCoil) coil).getCoilHeat(meta);
if (multiBlock.getCoilHeat() == HeatingCoilLevel.None)
multiBlock.setCoilHeat(heat);
return multiBlock.getCoilHeat() == heat;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

package com.github.bartimaeusnek.crossmod.tectech.helper;

import gregtech.api.enums.HeatingCoilLevel;

public interface IHasCoils {
void setCoilMeta(short coilMeta);
short getCoilMeta();
void setCoilHeat(HeatingCoilLevel coilMeta);
HeatingCoilLevel getCoilHeat();
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture;
import com.google.common.collect.ImmutableSet;
import gregtech.api.GregTech_API;
import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_Container_MultiMachine;
Expand All @@ -44,11 +45,13 @@
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.*;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.input.Keyboard;

import java.util.ArrayList;
import java.util.Set;
Expand All @@ -59,7 +62,7 @@

public class TT_ElectronicBlastFurnace extends GT_MetaTileEntity_MultiblockBase_EM implements IHasCoils, IConstructable {

public TT_ElectronicBlastFurnace(Object unused) {
public TT_ElectronicBlastFurnace(Object unused, Object unused2) {
super(32765, "multimachine.blastfurnace", "Electric Blast Furnace");
GregTech_API.METATILEENTITIES[32765] = null;
GregTech_API.METATILEENTITIES[1000] = this;
Expand All @@ -69,7 +72,7 @@ private TT_ElectronicBlastFurnace(String aName) {
super(aName);
}

private short coilMeta = -1;
private HeatingCoilLevel coilMeta = HeatingCoilLevel.None;
private static final byte TEXTURE_INDEX = 11;
private static final IStructureDefinition<TT_ElectronicBlastFurnace> STRUCTURE_DEFINITION = StructureDefinition
.<TT_ElectronicBlastFurnace>builder()
Expand Down Expand Up @@ -113,8 +116,8 @@ public IStructureDefinition<TT_ElectronicBlastFurnace> getStructure_EM() {

@Override
protected boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
this.setCoilMeta((short) -1);
boolean ret = this.structureCheck_EM("main", 1, 3, 0) && this.getHeatingCapacity() > -1;
this.setCoilHeat(HeatingCoilLevel.None);
boolean ret = this.structureCheck_EM("main", 1, 3, 0) && this.getCoilHeat() != HeatingCoilLevel.None;
if (this.mMufflerHatches.stream()
.map(MetaTileEntity::getBaseMetaTileEntity)
.mapToInt(ITurnable::getFrontFacing)
Expand Down Expand Up @@ -210,24 +213,36 @@ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DynamoMulti)
}

public String[] getDescription() {
return new String[]{
"Controller Block for the Blast Furnace",
"Size(WxHxD): 3x4x3 (Hollow), Controller (Front middle bottom)",
"16x Heating Coils (Two middle Layers, hollow)",
"1x Input Hatch/Bus (Any bottom layer casing)",
"1x Output Hatch/Bus (Any bottom layer casing)",
"1x Energy Hatch (Any bottom layer casing)",
"1x Maintenance Hatch (Any bottom layer casing)",
"1x Muffler Hatch (Top middle)",
"1x Output Hatch to recover CO2/CO/SO2 (optional, any top layer casing),",
" Recovery scales with Muffler Hatch tier",
"Heat Proof Machine Casings for the rest",
"Each 900K over the min. Heat Capacity multiplies eu/t by 0.95",
"Each 1800K over the min. Heat Capacity allows for one upgraded overclock",
"Upgraded overclocks reduce recipe time to 25% and increase EU/t to 400%",
"Causes " + 20 * getPollutionPerTick(null) + " Pollution per second",
ADV_STR_CHECK
};
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Blast Furnace")
.addInfo("Controller block for the Electric Blast Furnace")
.addInfo("You can use some fluids to reduce recipe time. Place the circuit in the Input Bus")
.addInfo("Each 900K over the min. Heat required multiplies EU/t by 0.95")
.addInfo("Each 1800K over the min. Heat required allows for one upgraded overclock instead of normal")
.addInfo("Upgraded overclocks reduce recipe time to 25% (instead of 50%) and increase EU/t to 400%")
.addInfo("Additionally gives +100K for every tier past MV")
.addPollutionAmount(20 * getPollutionPerTick(null))
.addInfo(ADV_STR_CHECK)
.addSeparator()
.beginStructureBlock(3, 4, 3, true)
.addController("Front bottom")
.addCasingInfo("Heat Proof Machine Casing", 0)
.addOtherStructurePart("Heating Coils", "Two middle Layers")
.addEnergyHatch("Any bottom layer casing")
.addMaintenanceHatch("Any bottom layer casing")
.addMufflerHatch("Top middle")
.addInputBus("Any bottom layer casing")
.addInputHatch("Any bottom layer casing")
.addOutputBus("Any bottom layer casing")
.addOutputHatch("CO/CO2/SO2, Any top layer casing")
.addStructureInfo("Recovery amount scales with Muffler Hatch tier")
.addOutputHatch("Fluids, Any bottom layer casing")
.toolTipFinisher("Gregtech");
if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
return tt.getInformation();
} else {
return tt.getStructureInformation();
}
}

public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
Expand All @@ -247,40 +262,15 @@ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechT
}

@Override
public void setCoilMeta(short coilMeta) {
public void setCoilHeat(HeatingCoilLevel coilMeta) {
this.coilMeta = coilMeta;
}

@Override
public short getCoilMeta() {
public HeatingCoilLevel getCoilHeat() {
return coilMeta;
}

private int getHeatingCapacity() {
switch (coilMeta) {
case 0:
return 1801;
case 1:
return 2701;
case 2:
return 3601;
case 3:
return 4501;
case 4:
return 5401;
case 5:
return 7201;
case 6:
return 9001;
case 7:
return 9901;
case 8:
return 10801;
default:
return -1;
}
}

@Override
public String[] getStructureDescription(ItemStack itemStack) {
return new String[0];
Expand All @@ -292,53 +282,21 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
}

public boolean checkRecipe_EM(ItemStack aStack) {
ArrayList<ItemStack> tInputList = getStoredInputs();
int tInputList_sS = tInputList.size();
for (int i = 0; i < tInputList_sS - 1; i++) {
for (int j = i + 1; j < tInputList_sS; j++) {
if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) {
if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
tInputList.remove(j--);
tInputList_sS = tInputList.size();
} else {
tInputList.remove(i--);
tInputList_sS = tInputList.size();
break;
}
}
}
}
ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]);

ArrayList<FluidStack> tFluidList = getStoredFluids();
int tFluidList_sS = tFluidList.size();
for (int i = 0; i < tFluidList_sS - 1; i++) {
for (int j = i + 1; j < tFluidList_sS; j++) {
if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) {
if (tFluidList.get(i).amount >= tFluidList.get(j).amount) {
tFluidList.remove(j--);
tFluidList_sS = tFluidList.size();
} else {
tFluidList.remove(i--);
tFluidList_sS = tFluidList.size();
break;
}
}
}
}
FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]);
if (tInputList.size() > 0) {
ItemStack[] tInputs = this.getCompactedInputs();
FluidStack[] tFluids = this.getCompactedFluids();

if (tInputs.length > 0) {
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
if (tRecipe == null
|| (this.getHeatingCapacity() < tRecipe.mSpecialValue)
|| (this.getCoilHeat().getHeat() < tRecipe.mSpecialValue)
|| (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) {
return false;
}
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
int tHeatCapacityDivTiers = (this.getHeatingCapacity() - tRecipe.mSpecialValue) / 900;
int tHeatCapacityDivTiers = (int) ((this.getCoilHeat().getHeat() - tRecipe.mSpecialValue) / 900);
byte overclockCount = calculateOverclockednessEBF(tRecipe.mEUt, tRecipe.mDuration, tVoltage);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.*;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard;

import java.util.List;

Expand All @@ -52,7 +54,7 @@

public class TT_ImplosionCompressor extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable {

public TT_ImplosionCompressor(Object unused) {
public TT_ImplosionCompressor(Object unused, Object unused2) {
super(32765, "multimachine.implosioncompressor", "Implosion Compressor");
GregTech_API.METATILEENTITIES[32765] = null;
GregTech_API.METATILEENTITIES[1001] = this;
Expand Down Expand Up @@ -150,19 +152,28 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {

@Override
public String[] getDescription() {
return new String[]{
"Controller Block for the Implosion Compressor",
"Size(WxHxD): 3x3x3 (Hollow), Controller (Front centered)",
"1x Input Bus (Any casing)",
"1x Output Bus (Any casing)",
"1x Maintenance Hatch (Any casing)",
"1x Muffler Hatch (Any casing)",
"1x Energy Hatch (Any casing)",
"Solid Steel Machine Casings for the rest (16 at least!)",
"Casings can be replaced with Explosion Warning Signs",
"Causes " + 20 * getPollutionPerTick(null) + " Pollution per second",
ADV_STR_CHECK
};
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("Implosion Compressor")
.addInfo("Explosions are fun")
.addInfo("Controller block for the Implosion Compressor")
.addPollutionAmount(20 * getPollutionPerTick(null))
.addInfo(ADV_STR_CHECK)
.addSeparator()
.beginStructureBlock(3, 3, 3, true)
.addController("Front center")
.addCasingInfo("Solid Steel Machine Casing", 16)
.addStructureInfo("Casings can be replaced with Explosion Warning Signs")
.addEnergyHatch("Any casing")
.addMaintenanceHatch("Any casing")
.addMufflerHatch("Any casing")
.addInputBus("Any casing")
.addOutputBus("Any casing")
.toolTipFinisher("Gregtech");
if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
return tt.getInformation();
} else {
return tt.getStructureInformation();
}
}

@Override
Expand Down
Loading

0 comments on commit 205579b

Please sign in to comment.