diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-07-14 18:26:52 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-07-14 18:26:52 +1000 |
commit | 282fcdbf4e7952d7e2c23e04b50e05be1a600335 (patch) | |
tree | d6d814e781c442e5c9d697d8a1fd367cd33e2209 /src/Java | |
parent | d07298d75d0b59e8a22a6e05b6828a9efdaa5876 (diff) | |
download | GT5-Unofficial-282fcdbf4e7952d7e2c23e04b50e05be1a600335.tar.gz GT5-Unofficial-282fcdbf4e7952d7e2c23e04b50e05be1a600335.tar.bz2 GT5-Unofficial-282fcdbf4e7952d7e2c23e04b50e05be1a600335.zip |
+ Added the Maceration Stack Multiblock
> Basic work done, shape isn't forming properly yet.
Diffstat (limited to 'src/Java')
6 files changed, 288 insertions, 6 deletions
diff --git a/src/Java/miscutil/core/handler/COMPAT_HANDLER.java b/src/Java/miscutil/core/handler/COMPAT_HANDLER.java index 2e72a4a09d..af2e1341eb 100644 --- a/src/Java/miscutil/core/handler/COMPAT_HANDLER.java +++ b/src/Java/miscutil/core/handler/COMPAT_HANDLER.java @@ -24,6 +24,7 @@ import miscutil.core.handler.registration.gregtech.GregtechEnergyBuffer; import miscutil.core.handler.registration.gregtech.GregtechIndustrialCentrifuge; import miscutil.core.handler.registration.gregtech.GregtechIndustrialCokeOven; import miscutil.core.handler.registration.gregtech.GregtechIndustrialElectrolyzer; +import miscutil.core.handler.registration.gregtech.GregtechIndustrialMacerator; import miscutil.core.handler.registration.gregtech.GregtechIndustrialPlatePress; import miscutil.core.handler.registration.gregtech.GregtechIronBlastFurnace; import miscutil.core.handler.registration.gregtech.GregtechRocketFuelGenerator; @@ -89,6 +90,7 @@ public class COMPAT_HANDLER { GregtechIndustrialPlatePress.run(); GregtechRocketFuelGenerator.run(); GregtechIndustrialElectrolyzer.run(); + GregtechIndustrialMacerator.run(); } } diff --git a/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialMacerator.java b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialMacerator.java new file mode 100644 index 0000000000..9520b140ff --- /dev/null +++ b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialMacerator.java @@ -0,0 +1,27 @@ +package miscutil.core.handler.registration.gregtech; + +import miscutil.core.util.Utils; +import miscutil.core.xmod.gregtech.api.enums.GregtechItemList; +import miscutil.core.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityIndustrialMacerator; + +public class GregtechIndustrialMacerator +{ + + + + public static void run() + { + if (miscutil.core.lib.LoadedMods.Gregtech){ + Utils.LOG_INFO("MiscUtils: Gregtech5u Content | Registering Industrial Maceration Stack Multiblock."); + run1(); + } + + } + + private static void run1() + { + //Industrial Electrolyzer Multiblock + GregtechItemList.Industrial_MacerationStack.set(new GregtechMetaTileEntityIndustrialMacerator(797, "industrialmacerator.controller.tier.single", "Industrial Maceration Stack Control Block").getStackForm(1L)); + + } +}
\ No newline at end of file diff --git a/src/Java/miscutil/core/recipe/RECIPES_GREGTECH.java b/src/Java/miscutil/core/recipe/RECIPES_GREGTECH.java index 9c26240091..d6bcb71d2e 100644 --- a/src/Java/miscutil/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/miscutil/core/recipe/RECIPES_GREGTECH.java @@ -88,10 +88,11 @@ public class RECIPES_GREGTECH { } private static void distilleryRecipes(){ + Utils.LOG_INFO("Registering Distillery Recipes."); //Distillery //OutputFluid, InputCircuit, InputFluid, Time in Ticks, EnergyUsage, isHidden //mods.gregtech.Distillery.addRecipe(<liquid:helium> * 1, <gregtech:gt.integrated_circuit:4> * 0, <liquid:air> * 20000, 400, 30, false); - GT_Values.RA.addDistilleryRecipe(ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), Materials.Air.getFluid(20000L), Materials.Helium.getFluid(1L), 400, 30, false); + GT_Values.RA.addDistilleryRecipe(ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), Materials.Air.getFluid(20000L), Materials.Helium.getFluid(10L), 400, 30, false); } diff --git a/src/Java/miscutil/core/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/miscutil/core/xmod/gregtech/api/enums/GregtechItemList.java index 2d3628b469..f56bfa758a 100644 --- a/src/Java/miscutil/core/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/miscutil/core/xmod/gregtech/api/enums/GregtechItemList.java @@ -92,7 +92,10 @@ public enum GregtechItemList implements GregtechItemContainer { Battery_RE_EV_Sodium, //Industrial Electrolyzer - Industrial_Electrolyzer; + Industrial_Electrolyzer, + + //Industrial Maceration Stack + Industrial_MacerationStack; public static final GregtechItemList[] DYE_ONLY_ITEMS = { diff --git a/src/Java/miscutil/core/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java b/src/Java/miscutil/core/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java index 36859624b3..9711915b2c 100644 --- a/src/Java/miscutil/core/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java +++ b/src/Java/miscutil/core/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java @@ -31,7 +31,7 @@ extends GregtechMetaCasingBlocksAbstract { GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Heat Proof Coke Oven Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Material Press Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Electrolyzer Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Unused Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Maceration Stack Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Unused Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Unused Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Unused Casing"); @@ -60,7 +60,7 @@ extends GregtechMetaCasingBlocksAbstract { } @Override - public IIcon getIcon(int aSide, int aMeta) { //Texture ID's. case 0 == ID[56] + public IIcon getIcon(int aSide, int aMeta) { //Texture ID's. case 0 == ID[57] if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { //Centrifuge @@ -81,6 +81,9 @@ extends GregtechMetaCasingBlocksAbstract { //Electrolyzer Casings case 5: return Textures.BlockIcons.MACHINE_CASING_FUSION_2.getIcon(); + //Maceration Stack Casings + case 6: + return Textures.BlockIcons.MACHINE_CASING_MAGIC.getIcon(); //Iron Blast Fuance Textures case 10: return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); @@ -89,9 +92,8 @@ extends GregtechMetaCasingBlocksAbstract { return Textures.BlockIcons.MACHINE_CASING_RADIOACTIVEHAZARD.getIcon(); } - //return Textures.BlockIcons.MACHINECASINGS_SIDE[aMeta].getIcon(); } - return Textures.BlockIcons.MACHINE_CASING_TURBINE.getIcon(); + return Textures.BlockIcons.MACHINE_CASING_GEARBOX_TUNGSTENSTEEL.getIcon(); } /*@Override diff --git a/src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialMacerator.java b/src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialMacerator.java new file mode 100644 index 0000000000..63e16ba9c4 --- /dev/null +++ b/src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialMacerator.java @@ -0,0 +1,247 @@ +package miscutil.core.xmod.gregtech.common.tileentities.machines.multi; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; + +import java.util.ArrayList; +import java.util.Arrays; + +import miscutil.core.block.ModBlocks; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +public class GregtechMetaTileEntityIndustrialMacerator + extends GT_MetaTileEntity_MultiBlockBase { + private static boolean controller; + + public GregtechMetaTileEntityIndustrialMacerator(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntityIndustrialMacerator(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityIndustrialMacerator(this.mName); + } + + @Override + public String[] getDescription() { + return new String[]{ + "Controller Block for the Industrial Maceration Stack", + "Size(WxHxD): 3x5x3 (Hollow)", + "Controller (Center Bottom)", + "1x Input Bus (Any bottom layer casing)", + "3x Output Bus (Any casing besides bottom layer)", + "1x Maintenance Hatch (Any casing)", + "1x Energy Hatch (Any casing)", + "Maceration Stack Casings for the rest (26 at least!)"}; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[63], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[63]}; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png"); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sMaceratorRecipes; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<ItemStack> tInputList = getStoredInputs(); + for (int i = 0; i < tInputList.size() - 1; i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { + if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + if (tInputList.size() > 0) { + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); + if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + this.mEUt = (-tRecipe.mEUt); + this.mMaxProgresstime = Math.max(1, tRecipe.mDuration); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + sendLoopStart((byte) 20); + updateSlots(); + return true; + } + } + return false; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + return false; + } + int tAmount = 0; + controller = false; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = 0; h < 6; h++) { + if (!(i == 0 && j == 0 && (h > 0 && h < 5)))//((h > 0)&&(h<5)) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0))) + { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 63)) && (!addInputToMachineList(tTileEntity, 63)) && (!addOutputToMachineList(tTileEntity, 63)) && (!addEnergyInputToMachineList(tTileEntity, 63)) && (!ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) { + return false; + } + tAmount++; + } + } + } + } + } + if (this.mOutputHatches.size() != 1 || this.mInputHatches.size() != 0 || this.mOutputBusses.size() != 5) { + return false; + } + int height = this.getBaseMetaTileEntity().getYCoord(); + if (this.mInputBusses.get(0).getBaseMetaTileEntity().getYCoord() != height || this.mOutputHatches.get(0).getBaseMetaTileEntity().getYCoord() != height) { + return false; + } + GT_MetaTileEntity_Hatch_OutputBus[] tmpHatches = new GT_MetaTileEntity_Hatch_OutputBus[5]; + for (int i = 0; i < this.mOutputBusses.size(); i++) { + int hatchNumber = this.mOutputBusses.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height; + if (tmpHatches[hatchNumber] == null) { + tmpHatches[hatchNumber] = this.mOutputBusses.get(i); + } else { + return false; + } + } + this.mOutputBusses.clear(); + for (int i = 0; i < tmpHatches.length; i++) { + this.mOutputBusses.add(tmpHatches[i]); + } + return tAmount >= 26; + } + + /*public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + return false; + } + int tAmount = 0; + controller = false; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = 0; h < 6; h++) { + if (!(i == 0 && j == 0 && (h > 0 && h < 5)))//((h > 0)&&(h<5)) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0))) + { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 63)) && (!addInputToMachineList(tTileEntity, 63)) && (!addOutputToMachineList(tTileEntity, 63)) && (!addEnergyInputToMachineList(tTileEntity, 63)) && (!ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) { + return false; + } + tAmount++; + } + } + } + } + } + if (this.mOutputBusses.size() != 5 || this.mInputBusses.size() != 1) { + return false; + } + int height = this.getBaseMetaTileEntity().getYCoord(); + if (this.mInputHatches.get(0).getBaseMetaTileEntity().getYCoord() != height) { + return false; + } + GT_MetaTileEntity_Hatch_OutputBus[] tmpHatches = new GT_MetaTileEntity_Hatch_OutputBus[5]; + for (int i = 0; i < this.mOutputBusses.size(); i++) { + int hatchNumber = this.mOutputBusses.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height; + if (tmpHatches[hatchNumber] == null) { + tmpHatches[hatchNumber] = this.mOutputBusses.get(i); + } else { + return false; + } + } + this.mOutputBusses.clear(); + for (int i = 0; i < tmpHatches.length; i++) { + this.mOutputBusses.add(tmpHatches[i]); + } + return tAmount >= 26; + }*/ + + public boolean ignoreController(Block tTileEntity) { + if (!controller && tTileEntity == GregTech_API.sBlockMachines) { + return true; + } + return false; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 1; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } +}
\ No newline at end of file |