diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-07-15 16:52:47 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-07-15 16:52:47 +1000 |
commit | f30e7e12e68d6c54fda520b785529fd8f3bd5d46 (patch) | |
tree | 00543747a56d1c11792f61e93b441ffd09e0396a /src/Java | |
parent | 598838f4091a45c2b8c8686c602a97383f0f3b2b (diff) | |
download | GT5-Unofficial-f30e7e12e68d6c54fda520b785529fd8f3bd5d46.tar.gz GT5-Unofficial-f30e7e12e68d6c54fda520b785529fd8f3bd5d46.tar.bz2 GT5-Unofficial-f30e7e12e68d6c54fda520b785529fd8f3bd5d46.zip |
% Changed Internal handling of air -> helium recipe.
+ Attempted to add sounds to the Maceration stack.
$ Fixed the Industrial Centrifuge inheriting it's name from the Industrial Electrolyzer.
Diffstat (limited to 'src/Java')
4 files changed, 201 insertions, 157 deletions
diff --git a/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialElectrolyzer.java b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialElectrolyzer.java index ae71e5375e..22d21bcc40 100644 --- a/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialElectrolyzer.java +++ b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialElectrolyzer.java @@ -21,7 +21,7 @@ public class GregtechIndustrialElectrolyzer private static void run1() { //Industrial Electrolyzer Multiblock - GregtechItemList.Industrial_Electrolyzer.set(new GregtechMetaTileEntityIndustrialElectrolyzer(796, "industrialcentrifuge.controller.tier.single", "Industrial Electrolyzer Controller").getStackForm(1L)); + GregtechItemList.Industrial_Electrolyzer.set(new GregtechMetaTileEntityIndustrialElectrolyzer(796, "industrialelectrolyzer.controller.tier.single", "Industrial Electrolyzer Controller").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 d6bcb71d2e..a15e82be04 100644 --- a/src/Java/miscutil/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/miscutil/core/recipe/RECIPES_GREGTECH.java @@ -90,9 +90,7 @@ 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(10L), 400, 30, false); + GT_Values.RA.addDistilleryRecipe(ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), FluidUtils.getFluidStack("air", 20000), FluidUtils.getFluidStack("helium", 1), 400, 30, false); } diff --git a/src/Java/miscutil/core/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/miscutil/core/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index fe81a22c51..ff922e5b96 100644 --- a/src/Java/miscutil/core/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/miscutil/core/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -802,4 +802,27 @@ public abstract class GregtechMeta_MultiBlockBase extends MetaTileEntity { public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return false; } + + /** + * Called whenever the Machine successfully started a Process, useful for Sound Effects + */ + public void startProcess() { + // + } + + /** + * Called whenever the Machine successfully finished a Process, useful for Sound Effects + */ + public void endProcess() { + // + } + + /** + * Called whenever the Machine aborted a Process, useful for Sound Effects + */ + public void abortProcess() { + // + } + + } 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 index 2adfbbb722..eae898958f 100644 --- 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 @@ -7,169 +7,192 @@ 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 java.util.Random; import miscutil.core.block.ModBlocks; import miscutil.core.util.Utils; +import miscutil.core.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; 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; +extends GregtechMeta_MultiBlockBase { + private static boolean controller; - public GregtechMetaTileEntityIndustrialMacerator(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } + public GregtechMetaTileEntityIndustrialMacerator(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } - public GregtechMetaTileEntityIndustrialMacerator(String aName) { - super(aName); - } + public GregtechMetaTileEntityIndustrialMacerator(String aName) { + super(aName); + } - @Override + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityIndustrialMacerator(this.mName); - } + return new GregtechMetaTileEntityIndustrialMacerator(this.mName); + } - @Override + @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 + 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[64], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[64]}; - } + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[64], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_STEAM_MACERATOR)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[64]}; + } - @Override + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png"); - } + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png"); + } - @Override + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return GT_Recipe.GT_Recipe_Map.sMaceratorRecipes; - } + return GT_Recipe.GT_Recipe_Map.sMaceratorRecipes; + } - @Override + /*@Override public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } + return true; + }*/ - @Override + @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/5)); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; - sendLoopStart((byte) 20); - updateSlots(); - return true; - } - } - return false; - } + return aFacing > 1; + } - @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, 64)) && (!addInputToMachineList(tTileEntity, 64)) && (!addOutputToMachineList(tTileEntity, 64)) && (!addEnergyInputToMachineList(tTileEntity, 64)) && (!ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO("Returned False 1"); - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 7) { - Utils.LOG_INFO("Returned False 2"); - return false; - } - tAmount++; - } - } - } - } - } - if (this.mOutputHatches.size() != 0 || this.mInputBusses.size() != 1 || this.mOutputBusses.size() != 5) { - Utils.LOG_INFO("Returned False 3"); - return false; - } - int height = this.getBaseMetaTileEntity().getYCoord(); - if (this.mInputBusses.get(0).getBaseMetaTileEntity().getYCoord() != height) { - Utils.LOG_INFO("height: "+height+" | Returned False 4"); - 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 { - Utils.LOG_INFO("Returned False 5"); - 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) { + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { + Random tRandom = aBaseMetaTileEntity.getWorld().rand; + aBaseMetaTileEntity.getWorld().spawnParticle("smoke", aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, aBaseMetaTileEntity.getYCoord() + 0.3f + tRandom.nextFloat() * 0.2F, aBaseMetaTileEntity.getZCoord() + 1.2F - tRandom.nextFloat() * 1.6F, 0.0D, 0.0D, 0.0D); + } + } + + @Override + public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 1) { + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(201)), 10, 1.0F, aX, aY, aZ); + } + } + + @Override + public void startProcess() { + sendLoopStart((byte) 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/5)); + 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, 64)) && (!addInputToMachineList(tTileEntity, 64)) && (!addOutputToMachineList(tTileEntity, 64)) && (!addEnergyInputToMachineList(tTileEntity, 64)) && (!ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Utils.LOG_INFO("Returned False 1"); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 7) { + Utils.LOG_INFO("Returned False 2"); + return false; + } + tAmount++; + } + } + } + } + } + if (this.mOutputHatches.size() != 0 || this.mInputBusses.size() != 1 || this.mOutputBusses.size() != 5) { + Utils.LOG_INFO("Returned False 3"); + return false; + } + int height = this.getBaseMetaTileEntity().getYCoord(); + if (this.mInputBusses.get(0).getBaseMetaTileEntity().getYCoord() != height) { + Utils.LOG_INFO("height: "+height+" | Returned False 4"); + 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 { + Utils.LOG_INFO("Returned False 5"); + 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)) { @@ -219,35 +242,35 @@ public class GregtechMetaTileEntityIndustrialMacerator return tAmount >= 26; }*/ - public boolean ignoreController(Block tTileEntity) { - if (!controller && tTileEntity == GregTech_API.sBlockMachines) { - return true; - } - return false; - } + public boolean ignoreController(Block tTileEntity) { + if (!controller && tTileEntity == GregTech_API.sBlockMachines) { + return true; + } + return false; + } - @Override + @Override public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } + return 10000; + } - @Override + @Override public int getPollutionPerTick(ItemStack aStack) { - return 0; - } + return 0; + } - @Override + /*@Override public int getDamageToComponent(ItemStack aStack) { - return 0; - } + return 0; + }*/ - @Override + @Override public int getAmountOfOutputs() { - return 1; - } + return 2; + } - @Override + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } + return false; + } }
\ No newline at end of file |