Merge pull request #499 from MauveCloud/experimental

Improved output bus handling
This commit is contained in:
Blood-Asp 2016-04-29 20:42:55 +02:00
commit 27eb1c67e4
2 changed files with 20 additions and 11 deletions

View file

@ -562,16 +562,21 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
aStack = GT_Utility.copy(aStack); aStack = GT_Utility.copy(aStack);
// FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); // FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true);
// if (aLiquid == null) { // if (aLiquid == null) {
for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) { boolean outputSuccess = true;
if (isValidMetaTileEntity(tHatch)) { while (outputSuccess && aStack.stackSize > 0) {
for (int i = tHatch.getSizeInventory() - 1; i >= 0; i--) { outputSuccess = false;
if (tHatch.getBaseMetaTileEntity().addStackToSlot(i, aStack)) return true; ItemStack single = aStack.splitStack(1);
for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) {
if (!outputSuccess && isValidMetaTileEntity(tHatch)) {
for (int i = tHatch.getSizeInventory() - 1; i >= 0 && !outputSuccess; i--) {
if (tHatch.getBaseMetaTileEntity().addStackToSlot(i, single)) outputSuccess = true;
}
} }
} }
} for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { if (!outputSuccess && isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) {
if (isValidMetaTileEntity(tHatch) && tHatch.outputsItems()) { if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, single)) outputSuccess = true;
if (tHatch.getBaseMetaTileEntity().addStackToSlot(1, aStack)) return true; }
} }
} }
// }else { // }else {
@ -584,7 +589,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
// } // }
// } // }
// } // }
return false; return outputSuccess;
} }
public boolean depleteInput(ItemStack aStack) { public boolean depleteInput(ItemStack aStack) {

View file

@ -40,7 +40,7 @@ import java.util.Random;
public class GT_Block_Reinforced extends GT_Generic_Block { public class GT_Block_Reinforced extends GT_Generic_Block {
public GT_Block_Reinforced(String aName) { public GT_Block_Reinforced(String aName) {
super(GT_Item_Storage.class, aName, Material.rock); super(GT_Item_Storage.class, aName, new Material(net.minecraft.block.material.MapColor.stoneColor));
setStepSound(soundTypeStone); setStepSound(soundTypeStone);
setCreativeTab(GregTech_API.TAB_GREGTECH); setCreativeTab(GregTech_API.TAB_GREGTECH);
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Bronzeplate Reinforced Block"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Bronzeplate Reinforced Block");
@ -65,7 +65,8 @@ public class GT_Block_Reinforced extends GT_Generic_Block {
} }
public String getHarvestTool(int aMeta) { public String getHarvestTool(int aMeta) {
if (aMeta == 4||aMeta == 5) return "axe"; if (aMeta == 4) return "shovel";
if (aMeta == 5) return "axe";
return "pickaxe"; return "pickaxe";
} }
@ -98,6 +99,9 @@ public class GT_Block_Reinforced extends GT_Generic_Block {
if (aWorld == null) { if (aWorld == null) {
return 0.0F; return 0.0F;
} }
if (aWorld.isAirBlock(aX, aY, aZ)) {
return 0.0F;
}
int tMeta = aWorld.getBlockMetadata(aX, aY, aZ); int tMeta = aWorld.getBlockMetadata(aX, aY, aZ);
if (tMeta == 0) { if (tMeta == 0) {
return 60.0F; return 60.0F;