diff options
| author | Prometheus0000 <prometheus0000000@gmail.com> | 2021-03-03 08:29:38 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-03 08:29:38 -0500 |
| commit | 617f0c768c5bb7f2b16806e36ea80303dca261b2 (patch) | |
| tree | 6c19d551fc9d534473f92166f49bc85f11dba558 /src/main/java/gregtech/common/tileentities/machines | |
| parent | 3a027e939e2c18e165b2f1405637c92f25736582 (diff) | |
| parent | 437d41dfd788584d0d9afab8565a5de96957cd34 (diff) | |
| download | GT5-Unofficial-617f0c768c5bb7f2b16806e36ea80303dca261b2.tar.gz GT5-Unofficial-617f0c768c5bb7f2b16806e36ea80303dca261b2.tar.bz2 GT5-Unofficial-617f0c768c5bb7f2b16806e36ea80303dca261b2.zip | |
Merge pull request #24 from GTNewHorizons/experimental
update
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines')
4 files changed, 69 insertions, 30 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java index 38f36ca936..34f99510ea 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java @@ -32,11 +32,11 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc public GT_MetaTileEntity_Hatch_OutputBus_ME(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 1, new String[]{ - "Item Output for Multiblocks", "Stores directly into ME"}); + "Item Output for Multiblocks", "Stores directly into ME"}, 0); } public GT_MetaTileEntity_Hatch_OutputBus_ME(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); + super(aName, aTier, aDescription, 0, aTextures); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java index 9b9442fef2..755fae8bce 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java @@ -2,10 +2,7 @@ package gregtech.common.tileentities.machines.basic; import com.google.common.collect.ArrayListMultimap; import gregtech.api.GregTech_API; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; +import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -31,8 +28,33 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachine { + public GT_MetaTileEntity_Disassembler(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Disassembles Machines at " + Math.min(50 + 10 * aTier,100) + "% Efficiency", 1, 9, "Disassembler.png", "", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER)); + super( + aID, + aName, + aNameRegional, + aTier, + 1, + new String[]{ + "Disassembles Machines up to " + GT_Values.TIER_COLORS[aTier] + GT_Values.VOLTAGE_NAMES[aTier], + "Can also disassemble most assembler recipes!" + }, + 1, + 9, + "Disassembler.png", + "", + + //Textures + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER_ACTIVE), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER_ACTIVE), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER) + ); } public GT_MetaTileEntity_Disassembler(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -179,36 +201,30 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi inputsStacks = recipesColl.stream() .map(x -> x.mInputs) .collect(Collectors.toSet()); - ItemStack input = inputs[i]; - ItemData data = GT_OreDictUnificator.getItemData(input); - if (data == null || data.mMaterial == null || data.mMaterial.mMaterial == null || data.mPrefix == null) { - output[i] = input; - continue; - } - handleReplacement(inputsStacks, data, output, input, i); + handleRecipeTransformationInternal(inputs, output, inputsStacks, i); } addOthersAndHandleAlwaysReplace(inputs, output); } /** * Public Interface for ReverseRecipes, do not call inside of this class. - * @param inputs - * @param output - * @param inputsStacks */ public static void handleRecipeTransformation(ItemStack[] inputs, ItemStack[] output, Set<ItemStack[]> inputsStacks) { - for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++) { - ItemStack input = inputs[i]; - ItemData data = GT_OreDictUnificator.getItemData(input); - if (data == null || data.mMaterial == null || data.mMaterial.mMaterial == null || data.mPrefix == null) { - output[i] = input; - continue; - } - handleReplacement(inputsStacks, data, output, input, i); - } + for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++) + handleRecipeTransformationInternal(inputs, output, inputsStacks, i); addOthersAndHandleAlwaysReplace(inputs, output); } + private static void handleRecipeTransformationInternal(ItemStack[] inputs, ItemStack[] output, Set<ItemStack[]> inputsStacks, int i) { + ItemStack input = inputs[i]; + ItemData data = GT_OreDictUnificator.getItemData(input); + if (data == null || data.mMaterial == null || data.mMaterial.mMaterial == null || data.mPrefix == null) { + output[i] = input; + return; + } + handleReplacement(inputsStacks, data, output, input, i); + } + private static void addOthersAndHandleAlwaysReplace(ItemStack[] inputs, ItemStack[] output){ for (int i = 0; i < inputs.length; i++) { //Adds rest of Items diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java index 0eb4092e26..52a256f5a3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -215,9 +215,16 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { if (!this.wasPumping) { tMovedOneDown = moveOneDown(); if (!tMovedOneDown) { - getBaseMetaTileEntity().disableWorking(); - if (debugBlockPump) { - GT_Log.out.println("PUMP: Can't move. Retracting in next few ticks"); + if (canMoveDown(getBaseMetaTileEntity().getXCoord(), Math.max(getYOfPumpHead() - 1, 1), getBaseMetaTileEntity().getZCoord())) { + if (debugBlockPump) { + GT_Log.out.println("PUMP: No pipe left. Idle for a little longer."); + } + this.mPumpTimer = 160; + } else { + getBaseMetaTileEntity().disableWorking(); + if (debugBlockPump) { + GT_Log.out.println("PUMP: Can't move. Retracting in next few ticks"); + } } } else if (debugBlockPump) { GT_Log.out.println("PUMP: Moved down"); @@ -530,6 +537,21 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { this.mSecondaryPumpedBlock = null; } + /** only check if block below can be replaced with pipe tip. pipe stockpile condition is ignored */ + private boolean canMoveDown(int aX, int aY, int aZ) { + if (!GT_Utility.eraseBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), aX, aY, aZ, true)) return false; + + Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ); + + return GT_Utility.isBlockValid(aBlock) && + (aBlock == Blocks.water || + aBlock == Blocks.flowing_water || + aBlock == Blocks.lava || + aBlock == Blocks.flowing_lava || + aBlock instanceof IFluidBlock || + aBlock.isAir(getBaseMetaTileEntity().getWorld(), aX, aY, aZ)); + } + private boolean consumeFluid(int aX, int aY, int aZ) { // Try to consume a fluid at a location // Returns true if something was consumed, otherwise false diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index c90df2a7a7..c13d537119 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -253,6 +253,7 @@ public class GT_MetaTileEntity_AssemblyLine } public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + mDataAccessHatches.clear(); int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; if (xDir != 0) { @@ -435,4 +436,4 @@ public class GT_MetaTileEntity_AssemblyLine public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } -}
\ No newline at end of file +} |
