diff options
author | Martin Robertz <dream-master@gmx.net> | 2019-03-02 18:23:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-02 18:23:58 +0100 |
commit | ffb92f1d656d39814c5104d334291502101da8aa (patch) | |
tree | 970cb6399f06a8ca4dcb992ce501f0092ac2fc94 | |
parent | 89b4aa72d90a552a73e88097979e400615bf0532 (diff) | |
parent | ce2e11bd8040df5a45e362aa847db7051286de1c (diff) | |
download | GT5-Unofficial-ffb92f1d656d39814c5104d334291502101da8aa.tar.gz GT5-Unofficial-ffb92f1d656d39814c5104d334291502101da8aa.tar.bz2 GT5-Unofficial-ffb92f1d656d39814c5104d334291502101da8aa.zip |
Merge pull request #176 from GTNewHorizons/feature/fortune
Add fortune bonuses to miner and multiblock miner.
7 files changed, 19 insertions, 8 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index 6388c7044c..f77c419c0e 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -330,7 +330,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { // Now distribute
for (MutableTriple<IFluidHandler, ForgeDirection, Integer> tEntry: tTanks) {
- if (availableCapacity > tAmount) tEntry.right = (int) Math.floor(tEntry.right * tAmount / availableCapacity);
+ if (availableCapacity > tAmount) tEntry.right = (int) Math.floor(tEntry.right * tAmount / availableCapacity); // Distribue fluids based on percentage available space at destination
+ if (tEntry.right == 0) tEntry.right = (int)Math.min(1, tAmount); // If the percent is not enough to give at least 1L, try to give 1L
if (tEntry.right <= 0) continue;
int tFilledAmount = tEntry.left.fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false);
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 393b63e916..26024cafee 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -37,7 +37,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 1, new String[]{"Digging ore instead of you", ENERGY[aTier] + " EU/t, " + SPEED[aTier] / 20 + " sec per block", - "Work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1)}, 2, 2, "Miner.png", "", new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); + "Work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1), "Fortune bonus of " + aTier * 2}, 2, 2, "Miner.png", "", new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); } public GT_MetaTileEntity_Miner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -191,7 +191,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { private ArrayList<ItemStack> getBlockDrops(final Block oreBlock, int posX, int posY, int posZ) { final int blockMeta = getBaseMetaTileEntity().getMetaID(posX, posY, posZ); - return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, 1); + return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier*2 + 1); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java index bd1c07927c..f74748a364 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java @@ -8,10 +8,12 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public class GT_MetaTileEntity_OreDrillingPlant1 extends GT_MetaTileEntity_OreDrillingPlantBase { public GT_MetaTileEntity_OreDrillingPlant1(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + mTier=1; } public GT_MetaTileEntity_OreDrillingPlant1(String aName) { super(aName); + mTier=1; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java index 272ea64360..db7c4cd9e7 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java @@ -8,10 +8,12 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public class GT_MetaTileEntity_OreDrillingPlant2 extends GT_MetaTileEntity_OreDrillingPlantBase { public GT_MetaTileEntity_OreDrillingPlant2(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + mTier=2; } public GT_MetaTileEntity_OreDrillingPlant2(String aName) { super(aName); + mTier=2; } @Override @@ -53,4 +55,4 @@ public class GT_MetaTileEntity_OreDrillingPlant2 extends GT_MetaTileEntity_OreDr protected int getBaseProgressTime() { return 800; } -}
\ No newline at end of file +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java index f89c578b91..b7053a8ebd 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java @@ -8,10 +8,12 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public class GT_MetaTileEntity_OreDrillingPlant3 extends GT_MetaTileEntity_OreDrillingPlantBase { public GT_MetaTileEntity_OreDrillingPlant3(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + mTier=3; } public GT_MetaTileEntity_OreDrillingPlant3(String aName) { super(aName); + mTier=3; } @Override @@ -53,4 +55,4 @@ public class GT_MetaTileEntity_OreDrillingPlant3 extends GT_MetaTileEntity_OreDr protected int getBaseProgressTime() { return 640; } -}
\ No newline at end of file +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java index 405973547e..db86b963ca 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java @@ -8,10 +8,12 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public class GT_MetaTileEntity_OreDrillingPlant4 extends GT_MetaTileEntity_OreDrillingPlantBase { public GT_MetaTileEntity_OreDrillingPlant4(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + mTier=4; } public GT_MetaTileEntity_OreDrillingPlant4(String aName) { super(aName); + mTier=4; } @Override @@ -53,4 +55,4 @@ public class GT_MetaTileEntity_OreDrillingPlant4 extends GT_MetaTileEntity_OreDr protected int getBaseProgressTime() { return 480; } -}
\ No newline at end of file +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index 4eb8bad9bc..a528e39472 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -26,6 +26,7 @@ import static gregtech.api.enums.GT_Values.VN; public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase { private final ArrayList<ChunkPosition> oreBlockPositions = new ArrayList<>(); + protected int mTier=1; public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -138,7 +139,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile return new ArrayList<ItemStack>() {{ add(new ItemStack(oreBlock, 1, blockMeta)); }}; - } else return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, 1); + } else return oreBlock.getDrops(getBaseMetaTileEntity().getWorld(), posX, posY, posZ, blockMeta, mTier*5+1); } private boolean tryConsumeDrillingFluid() { @@ -194,6 +195,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile "1x Output Bus (Any bottom layer casing)", "1x Maintenance Hatch (Any bottom layer casing)", "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)", - "Radius is " + (getRadiusInChunks() << 4) + " blocks"}; + "Radius is " + (getRadiusInChunks() << 4) + " blocks", + "Fortune bonus of " + mTier * 5}; } }
\ No newline at end of file |