diff options
Diffstat (limited to 'src/main/java/com')
18 files changed, 529 insertions, 67 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java index 2b4eafb9a1..1208a05744 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java @@ -22,6 +22,7 @@ package com.github.bartimaeusnek.ASM; +import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; import com.google.common.eventbus.EventBus; @@ -61,8 +62,11 @@ public class BWCore extends DummyModContainer { shouldTransform[0] = Loader.isModLoaded("ExtraUtilities") && ConfigHandler.enabledPatches[0]; shouldTransform[1] = Loader.isModLoaded("ExtraUtilities") && ConfigHandler.enabledPatches[1]; shouldTransform[3] = Loader.isModLoaded("Thaumcraft") && ConfigHandler.enabledPatches[3]; + shouldTransform[4] = true; + shouldTransform[5] = Loader.isModLoaded("RWG") && ConfigHandler.enabledPatches[5]; BWCore.BWCORE_LOG.info("Extra Utilities found and ASM Patch enabled? " + shouldTransform[0]); BWCore.BWCORE_LOG.info("Thaumcraft found and ASM Patch enabled? " + shouldTransform[3]); + BWCore.BWCORE_LOG.info("RWG found and ASM Patch enabled? " + shouldTransform[5]); } @Override @@ -70,6 +74,9 @@ public class BWCore extends DummyModContainer { List<ArtifactVersion> ret = new ArrayList<>(); ret.add(new DefaultArtifactVersion("ExtraUtilities", true)); ret.add(new DefaultArtifactVersion("Thaumcraft", true)); + ret.add(new DefaultArtifactVersion("RWG", true)); + ret.add(new DefaultArtifactVersion("gregtech", true)); + ret.add(new DefaultArtifactVersion(MainMod.MOD_ID, true)); ret.add(new DefaultArtifactVersion(BartWorksCrossmod.MOD_ID, true)); return ret; } diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java index 51ee9867a9..bd395ea175 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java @@ -25,6 +25,7 @@ package com.github.bartimaeusnek.ASM; import net.minecraft.launchwrapper.IClassTransformer; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.*; import java.util.Arrays; @@ -38,7 +39,8 @@ public class BWCoreTransformer implements IClassTransformer { "REMVOING CREATURES FROM LAST MILLENIUM (EXU)", "PATCHING GLOBAL RENDERER FOR USE WITH MY GALACTIC DIMS", "PATCHING THAUMCRAFT WAND PEDESTAL TO PREVENT VIS DUPLICATION", - "PLACING MY GLASS-BLOCK RUNNABLE INTO THE GT_API" + "PLACING MY GLASS-BLOCK RUNNABLE INTO THE GT_API", + "DUCTTAPING RWG WORLDEN FAILS" // "ADD EXECTION HANDLEING TO FIND OREIDS/OREDICT" }; public static final String[] CLASSESBEEINGTRANSFORMED = { @@ -46,7 +48,8 @@ public class BWCoreTransformer implements IClassTransformer { "com.rwtema.extrautils.worldgen.endoftime.ChunkProviderEndOfTime", "net.minecraft.client.renderer.RenderGlobal", "thaumcraft.common.tiles.TileWandPedestal", - "gregtech.GT_Mod" + "gregtech.GT_Mod", + "rwg.world.ChunkGeneratorRealistic" // "net.minecraftforge.oredict.OreDictionary" }; static boolean obfs; @@ -92,6 +95,7 @@ public class BWCoreTransformer implements IClassTransformer { ClassNode classNode = new ClassNode(); classReader.accept(classNode, ClassReader.SKIP_FRAMES); List<MethodNode> methods = classNode.methods; + scase: switch (id) { case 0: { BWCore.BWCORE_LOG.info("Could find: " + BWCoreTransformer.CLASSESBEEINGTRANSFORMED[id]); @@ -140,10 +144,9 @@ public class BWCoreTransformer implements IClassTransformer { toPatch.maxStack = 1; toPatch.maxLocals = 5; methods.set(i, toPatch); - break; + break scase; } } - break; } case 2: { String name_deObfs = "renderSky"; @@ -201,10 +204,9 @@ public class BWCoreTransformer implements IClassTransformer { } } toPatch.instructions = nu; - break; + break scase; } } - break; } case 3: { BWCore.BWCORE_LOG.info("Could find: " + BWCoreTransformer.CLASSESBEEINGTRANSFORMED[id]); @@ -217,10 +219,9 @@ public class BWCoreTransformer implements IClassTransformer { if (ASMUtils.isCorrectMethod(methods.get(i), name_deObfs, name_Obfs, name_src) && ASMUtils.isCorrectMethod(methods.get(i), dsc_universal, dsc_universal)) { BWCore.BWCORE_LOG.info("Found " + (name_deObfs) + "! Patching!"); methods.set(i, BWCoreTransformer.transformThaumcraftWandPedestal(methods.get(i))); - break; + break scase; } } - break; } case 4 : { BWCore.BWCORE_LOG.info("Could find: " + BWCoreTransformer.CLASSESBEEINGTRANSFORMED[id]); @@ -244,13 +245,48 @@ public class BWCoreTransformer implements IClassTransformer { nu.add(toPatch.instructions.get(j)); } toPatch.instructions = nu; - break; + break scase; } } - - break; } case 5: { + BWCore.BWCORE_LOG.info("Could find: " + BWCoreTransformer.CLASSESBEEINGTRANSFORMED[id]); + String name_deObfs = "getNewNoise"; + for (int i = 0; i < methods.size(); i++) { + MethodNode toPatch = methods.get(i); + + if (ASMUtils.isCorrectMethod(methods.get(i), name_deObfs)) { + BWCore.BWCORE_LOG.info("Found " + (name_deObfs) + "! Patching!"); + LabelNode[] LabelNodes = {new LabelNode(), new LabelNode()}; + InsnList nu = new InsnList(); + // if (x < -28675) x %= -28675; + nu.add(new VarInsnNode(ILOAD, 2)); + nu.add(new IntInsnNode(SIPUSH, -28675)); + nu.add(new JumpInsnNode(IF_ICMPGE, LabelNodes[0])); + nu.add(new VarInsnNode(ILOAD, 2)); + nu.add(new LdcInsnNode(-28675)); + nu.add(new InsnNode(IREM)); + nu.add(new VarInsnNode(ISTORE, 2)); + nu.add(LabelNodes[0]); + // if (y < -28675) y %= -28675; + nu.add(new VarInsnNode(ILOAD, 3)); + nu.add(new IntInsnNode(SIPUSH, -28675)); + nu.add(new JumpInsnNode(IF_ICMPGE, LabelNodes[1])); + nu.add(new VarInsnNode(ILOAD, 3)); + nu.add(new LdcInsnNode(-28675)); + nu.add(new InsnNode(IREM)); + nu.add(new VarInsnNode(ISTORE, 3)); + nu.add(LabelNodes[1]); + + for (int j = 1; j < methods.get(i).instructions.size(); j++) { + nu.add(methods.get(i).instructions.get(j)); + } + + methods.get(i).instructions = nu; + break scase; + } + } + // String name_deObfs = "getOreIDs"; // String dsc_deObfs = "(Lnet/minecraft/item/ItemStack;)[I"; // String dsc_Obfs = "(Ladd;)[I"; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java index 3f01018d84..6fedc29f6b 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -240,17 +240,18 @@ public final class MainMod { private static void unificationEnforcer() { for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { if (werkstoff.getGenerationFeatures().enforceUnification) { - if (werkstoff.contains(NOBLE_GAS)){ - String name = werkstoff.getFluidOrGas(1).getFluid().getName(); - String wrongname ="molten."+name; - FluidStack wrongNamedFluid = FluidRegistry.getFluidStack(wrongname,1); + if (werkstoff.contains(NOBLE_GAS)) { + String name = werkstoff.getFluidOrGas(1).getFluid().getName(); + String wrongname = "molten." + name; + FluidStack wrongNamedFluid = FluidRegistry.getFluidStack(wrongname, 1); + if (wrongNamedFluid != null) { for (GT_Recipe.GT_Recipe_Map map : GT_Recipe.GT_Recipe_Map.sMappings) { for (GT_Recipe recipe : map.mRecipeList) { for (int i = 0; i < recipe.mFluidInputs.length; i++) { if (GT_Utility.areFluidsEqual(recipe.mFluidInputs[i], wrongNamedFluid)) { Collection<GT_Recipe> col = map.mRecipeFluidMap.get(wrongNamedFluid.getFluid()); map.mRecipeFluidMap.remove(wrongNamedFluid.getFluid()); - map.mRecipeFluidMap.put(werkstoff.getFluidOrGas(1).getFluid(),col); + map.mRecipeFluidMap.put(werkstoff.getFluidOrGas(1).getFluid(), col); recipe.mFluidInputs[i] = werkstoff.getFluidOrGas(recipe.mFluidInputs[i].amount); map.mRecipeFluidNameMap.add(werkstoff.getFluidOrGas(1).getFluid().getName()); } @@ -262,7 +263,8 @@ public final class MainMod { } } } - GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.add(new BWRecipes.DynamicGTRecipe(false,null,null,null,null,new FluidStack[]{wrongNamedFluid},new FluidStack[]{werkstoff.getFluidOrGas(1)},1,1,0)); + GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.add(new BWRecipes.DynamicGTRecipe(false, null, null, null, null, new FluidStack[]{wrongNamedFluid}, new FluidStack[]{werkstoff.getFluidOrGas(1)}, 1, 1, 0)); + } } MainMod.runMoltenUnificationEnfocement(werkstoff); MainMod.runUnficationDeleter(werkstoff); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/textures/PrefixTextureLinker.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/textures/PrefixTextureLinker.java index 96e69f4cf3..29b78e568e 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/textures/PrefixTextureLinker.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/textures/PrefixTextureLinker.java @@ -23,6 +23,8 @@ public class PrefixTextureLinker implements Runnable { public void run() { for (OrePrefixes prefixes : OrePrefixes.values()) { + if (prefixes == OrePrefixes.rod) + continue; HashMap curr = new HashMap<>(); if (prefixes.mTextureIndex == -1 && Werkstoff.GenerationFeatures.prefixLogic.get(prefixes) != 0) { Arrays.stream(TextureSet.class.getFields()).filter(field -> field.getName().contains("SET")).forEach(SET -> { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java index 6e55fd509a..b23afa275c 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java @@ -37,6 +37,7 @@ import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEnti import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ElectricImplosionCompressor; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_THTR; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega.GT_TileEntity_MegaBlastFurnace; +import com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega.GT_TileEntity_MegaDistillTower; import com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega.GT_TileEntity_MegaVacuumFreezer; import com.github.bartimaeusnek.bartworks.common.tileentities.tiered.*; import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; @@ -130,7 +131,7 @@ public class ItemRegistry { public static ItemStack[] diode16A = new ItemStack[GT_Values.VN.length]; public static ItemStack[] energyDistributor = new ItemStack[GT_Values.VN.length]; public static ItemStack[] acidGens = new ItemStack[3]; - public static ItemStack[] megaMachines = new ItemStack[2]; + public static ItemStack[] megaMachines = new ItemStack[3]; public static ItemStack dehp; public static ItemStack thtr; public static ItemStack eic; @@ -192,6 +193,7 @@ public class ItemRegistry { ItemRegistry.cal = new GT_TileEntity_CircuitAssemblyLine(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 7, "CircuitAssemblyLine", "Circuit Assembly Line").getStackForm(1L); ItemRegistry.compressedHatch = new GT_MetaTileEntity_CompressedFluidHatch(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 8, "CompressedFluidHatch", "Liquid Air Fluid Hatch").getStackForm(1L); ItemRegistry.giantOutputHatch = new GT_MetaTileEntity_GiantOutputHatch(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 9, "GiantOutputHatch", "Giant Output Hatch").getStackForm(1L); + ItemRegistry.megaMachines[2] = new GT_TileEntity_MegaDistillTower(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 10, "MegaDistillationTower", "Mega Distillation Tower").getStackForm(1L); } } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java index 013a26a6aa..35be05a86e 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java @@ -254,6 +254,7 @@ public class RecipeLoader implements Runnable { GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getModItem("gregtech", "gt.blockmachines", 64, 1000), GT_Utility.getIntegratedCircuit(17), Materials.SolderingAlloy.getMolten(9216), ItemRegistry.megaMachines[0], 72000, BW_Util.getMachineVoltageFromTier(3)); GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getModItem("gregtech", "gt.blockmachines", 64, 1002), GT_Utility.getIntegratedCircuit(17), Materials.SolderingAlloy.getMolten(9216), ItemRegistry.megaMachines[1], 72000, BW_Util.getMachineVoltageFromTier(3)); + GT_Values.RA.addAssemblerRecipe(GT_ModHandler.getModItem("gregtech", "gt.blockmachines", 64, 1126), GT_Utility.getIntegratedCircuit(17), Materials.SolderingAlloy.getMolten(9216), ItemRegistry.megaMachines[2], 72000, BW_Util.getMachineVoltageFromTier(3)); GT_Values.RA.addFluidSolidifierRecipe(new ItemStack(ItemRegistry.bw_glasses[0], 1, 0), Materials.Nickel.getMolten(5184), new ItemStack(ItemRegistry.bw_glasses[0], 1, 1), 800, BW_Util.getMachineVoltageFromTier(3)); GT_Values.RA.addFluidSolidifierRecipe(new ItemStack(ItemRegistry.bw_glasses[0], 1, 1), Materials.Tungsten.getMolten(1296), new ItemStack(ItemRegistry.bw_glasses[0], 1, 2), 800, BW_Util.getMachineVoltageFromTier(4)); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java index ef71506d0e..b8c8be8e4d 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java @@ -142,6 +142,8 @@ public class GT_TileEntity_CircuitAssemblyLine extends GT_MetaTileEntity_MultiBl continue; BW_Util.calculateOverclockedNessMulti(this.bufferedRecipe.mEUt,this.bufferedRecipe.mDuration,1,this.getMaxInputVoltage(),this); + if (this.mEUt > 0) + this.mEUt = -this.mEUt; this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mOutputItems = this.bufferedRecipe.mOutputs; this.mOutputFluids = this.bufferedRecipe.mFluidOutputs; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java index 6c90893975..fc76ab719d 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java @@ -320,6 +320,9 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_MetaTileEntity_ElectricBl case 8: internalH = 10801; break; + case 9: + internalH = 21601; + break; default: break; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java new file mode 100644 index 0000000000..19e4455a08 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java @@ -0,0 +1,230 @@ +package com.github.bartimaeusnek.bartworks.common.tileentities.multis.mega; + +import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; +import com.github.bartimaeusnek.bartworks.util.BW_Util; +import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; +import com.google.common.collect.ArrayListMultimap; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_DistillationTower; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +import java.util.ArrayList; + +public class GT_TileEntity_MegaDistillTower extends GT_MetaTileEntity_DistillationTower { + + private static final int CASING_INDEX = 49; + + public GT_TileEntity_MegaDistillTower(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + private GT_TileEntity_MegaDistillTower(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_TileEntity_MegaDistillTower(this.mName); + } + + @Override + public String[] getDescription() { + return new String[]{ + "Controller Block for the Mega Distillation Tower", + "Size(WxHxD): 15xhx15 (Hollow), with h ranging from 16 to 61", + "Controller (Front bottom)", + "1+ Input Hatch (Any bottom layer casing)", + "1+ Output Bus (Any bottom layer casing)", + "An \"Output Layer\" consists of 5 layers!", + "2-11+ Output Hatch (One or more per Output Layer)", + "1x Maintenance Hatch (Any casing)", + "1+ Energy Hatch (Any casing)", + "Fluids are only put out at the correct height", + "The correct height equals the slot number in the NEI recipe", + "Clean Stainless Steel Machine Casings for the rest (15 x h - 5 at least!)", + StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks" + }; + } + + private short controllerY = 0; + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack itemStack) { + LAYERMAP.clear(); + controllerY = aBaseMetaTileEntity.getYCoord(); + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7; + int x, z, y = 0, casingAmount = 0; + boolean reachedTop = false; + + IGregTechTileEntity tileEntity; + Block block; + for (x = xDir - 7; x <= xDir + 7; ++x) { + for (z = zDir - 7; z <= zDir + 7; ++z) { + if (x != 0 || z != 0) { + tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + if (!this.addInputToMachineList(tileEntity, CASING_INDEX) && !this.addOutputToMachineList(tileEntity, CASING_INDEX) && !this.addMaintenanceToMachineList(tileEntity, CASING_INDEX) && !this.addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (block != GregTech_API.sBlockCasings4 || aBaseMetaTileEntity.getMetaIDOffset(x, y, z) != 1) { + return false; + } + + ++casingAmount; + } + } + } + } + for (y = y + 1; y <= 60 && !reachedTop; ++y) { + for (x = -7; x <= 7; ++x) { + for (z = -7; z <= 7; ++z) { + tileEntity = aBaseMetaTileEntity.getIGregTechTileEntity(aBaseMetaTileEntity.getXCoord() + xDir + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + zDir + z); + block = aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getXCoord() + xDir + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + zDir + z); + final boolean middle = Math.abs(x) < 7 && Math.abs(z) != 7; + if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getXCoord() + xDir + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + zDir + z)) { + if (!middle) { + //aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getXCoord() + xDir + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + zDir + z,GregTech_API.sBlockCasings4,1,2); + return false; + } + } else { + if (middle) { + reachedTop = true; + } + if (!this.addOutputToMachineList(tileEntity, CASING_INDEX) && !this.addMaintenanceToMachineList(tileEntity, CASING_INDEX) && !this.addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (block != GregTech_API.sBlockCasings4 || aBaseMetaTileEntity.getMetaID(aBaseMetaTileEntity.getXCoord() + xDir + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + zDir + z) != 1) { + return false; + } + + ++casingAmount; + } + } + } + } + } + + return casingAmount >= 15 * y - 5 && y >= 16 && y <= 61 && reachedTop; + } + + @Override + public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (super.addOutputToMachineList(aTileEntity, aBaseCasingIndex)) { + if (aTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Output) { + int layer = aTileEntity.getYCoord() - controllerY; + layer = (int) Math.ceil(((double)layer) /5D)-1; + LAYERMAP.put(layer,(GT_MetaTileEntity_Hatch_Output) aTileEntity.getMetaTileEntity()); + } + return true; + } + return false; + } + + @Override + protected void addFluidOutputs(FluidStack[] mOutputFluids2) { + for (int i = 0; i < mOutputFluids2.length; i++) { + for (int j = 0; j < LAYERMAP.get(i).size(); j++) { + LAYERMAP.get(i).get(j).fill(new FluidStack(mOutputFluids2[i],mOutputFluids2[i].amount/LAYERMAP.get(i).size()), true); + } + } + } + + private final ArrayListMultimap<Integer,GT_MetaTileEntity_Hatch_Output> LAYERMAP = ArrayListMultimap.create(); + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<FluidStack> tFluidList = this.getStoredFluids(); + + for (int i = 0; i < tFluidList.size() - 1; ++i) { + for (int j = i + 1; j < tFluidList.size(); ++j) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount < tFluidList.get(j).amount) { + tFluidList.remove(i--); + break; + } + tFluidList.remove(j--); + } + } + } + + long tVoltage = this.getMaxInputVoltage(); + byte tTier = (byte) Math.max(0, GT_Utility.getTier(tVoltage)); + + long nominalV = BW_Util.getnominalVoltage(this); + FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); + if (tFluids.length > 0) { + for (FluidStack tFluid : tFluids) { + ArrayList<FluidStack[]> outputFluids = new ArrayList<>(); + int processed = 0; + boolean found_Recipe = false; + FluidStack[] output; + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sDistillationRecipes.findRecipe(this.getBaseMetaTileEntity(), false, GT_Values.V[tTier], new FluidStack[]{tFluid}); + while (this.getStoredFluids().size() > 0 && processed < ConfigHandler.megaMachinesMax) { + if (tRecipe != null && (tRecipe.mEUt * (processed + 1)) < nominalV && tRecipe.isRecipeInputEqual(true, tFluids)) { + found_Recipe = true; + if (tRecipe.mFluidOutputs.length == 1 && tRecipe.mFluidOutputs[0].amount == 0) + tRecipe.mFluidOutputs[0].amount = tRecipe.mFluidInputs[0].amount; + output = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int i = 0; i < output.length; i++) { + output[i] = new FluidStack(tRecipe.mFluidOutputs[i],tRecipe.mFluidOutputs[i].amount); + } + outputFluids.add(output); + ++processed; + } else + break; + } + if (!found_Recipe) + continue; + for (int j = 1; j < outputFluids.size(); j++) { + for (int k = 0; k < outputFluids.get(j).length; k++) { + outputFluids.get(0)[k].amount += outputFluids.get(j)[k].amount; + } + } + this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + long actualEUT = (long) (tRecipe.mEUt) * processed; + if (actualEUT > Integer.MAX_VALUE) { + byte divider = 0; + while (actualEUT > Integer.MAX_VALUE) { + actualEUT = actualEUT / 2; + divider++; + } + BW_Util.calculateOverclockedNessMulti((int) (actualEUT / (divider * 2)), tRecipe.mDuration * (divider * 2), 1, nominalV, this); + } else + BW_Util.calculateOverclockedNessMulti((int) actualEUT, tRecipe.mDuration, 1, nominalV, this); + //In case recipe is too OP for that machine + if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) + return false; + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputFluids = outputFluids.get(0).clone(); + if (tRecipe.getOutput(0) != null) { + int stacks = processed / 64; + ItemStack[] outputs = new ItemStack[stacks]; + if (stacks > 0) { + for (int i = 0; i < stacks; i++) + if (i != stacks - 1) + outputs[i] = tRecipe.getOutput(0).splitStack(64); + else + outputs[i] = tRecipe.getOutput(0).splitStack(processed - (64 * i)); + this.mOutputItems = outputs; + } else + this.mOutputItems = null; + } else + this.mOutputItems = null; + this.updateSlots(); + return true; + } + } + return false; + } +}
\ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/BWGTMetaItems.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/BWGTMetaItems.java index 8cd06481d3..6befd36ba6 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/BWGTMetaItems.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/GT_Enhancement/BWGTMetaItems.java @@ -28,7 +28,7 @@ import static com.github.bartimaeusnek.bartworks.system.material.GT_Enhancement. public class BWGTMetaItems extends BW_MetaGenerated_Items { - boolean hasList; + private boolean hasList; public BWGTMetaItems(OrePrefixes orePrefixes, List noSubIDMaterials) { super(orePrefixes,null); @@ -36,7 +36,7 @@ public class BWGTMetaItems extends BW_MetaGenerated_Items { for (int i = 0; i < Materials.values().length; i++) { ItemStack tStack = new ItemStack(this, 1, i); Materials w = Materials.values()[i]; - if (!((w.getMolten(1) != null && orePrefixes == WerkstoffLoader.capsuleMolten) || ((w.getFluid(1) != null || w.getGas(1) != null) && orePrefixes == OrePrefixes.capsule))) + if (((w.getMolten(1) == null && orePrefixes == WerkstoffLoader.capsuleMolten) || ((w.getFluid(1) == null && w.getGas(1) == null) && (orePrefixes == OrePrefixes.capsule || orePrefixes == OrePrefixes.bottle)))) continue; for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) if (w.mDefaultLocalName.equalsIgnoreCase(werkstoff.getDefaultName())) @@ -54,7 +54,7 @@ public class BWGTMetaItems extends BW_MetaGenerated_Items { for (int i = 0; i < noSubIDMaterials.size(); i++) { ItemStack tStack = new ItemStack(this, 1, i+1001); Materials w = (Materials) noSubIDMaterials.get(i); - if (!((w.getMolten(1) != null && orePrefixes == WerkstoffLoader.capsuleMolten) || ((w.getFluid(1) != null || w.getGas(1) != null) && orePrefixes == OrePrefixes.capsule))) + if (((w.getMolten(1) == null && orePrefixes == WerkstoffLoader.capsuleMolten) || ((w.getFluid(1) == null && w.getGas(1) == null) && (orePrefixes == OrePrefixes.capsule || orePrefixes == OrePrefixes.bottle)))) continue; for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) if (w.mDefaultLocalName.equalsIgnoreCase(werkstoff.getDefaultName())) @@ -100,16 +100,19 @@ public class BWGTMetaItems extends BW_MetaGenerated_Items { Materials w = Materials.values()[i]; if ((w == null) || (w.mTypes & Werkstoff.GenerationFeatures.prefixLogic.get(this.orePrefixes)) == 0 && Werkstoff.GenerationFeatures.prefixLogic.get(this.orePrefixes) != 0) continue; - if ((w.getMolten(1) != null && orePrefixes == WerkstoffLoader.capsuleMolten) || ((w.getFluid(1) != null || w.getGas(1) != null) && orePrefixes == OrePrefixes.capsule)) - aList.add(new ItemStack(this, 1, i)); - } - for (int i = 0; i < NoMetaValue.size(); i++) { - Materials w = NoMetaValue.get(i); - if ((w == null) || (w.mTypes & Werkstoff.GenerationFeatures.prefixLogic.get(this.orePrefixes)) == 0 && Werkstoff.GenerationFeatures.prefixLogic.get(this.orePrefixes) != 0) + else if (((w.getMolten(1) == null && orePrefixes == WerkstoffLoader.capsuleMolten) || ((w.getFluid(1) == null && w.getGas(1) == null) && (orePrefixes == OrePrefixes.capsule || orePrefixes == OrePrefixes.bottle)))) continue; - if (hasList && ((w.getMolten(1) != null && orePrefixes |
