mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Don't hard code some machines to specific gas types
This commit is contained in:
1 parent
f8b162bc31
commit
d8b6dfbb78
21 files changed
+181
-282
No files matched your search
@@ -117,7 +117,16 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
|
||||
* @param itemstack - itemstack to check with
|
||||
* @return fuel ticks
|
||||
*/
|
||||
public abstract GasStack getItemGas(ItemStack itemstack);
|
||||
public GasStack getItemGas(ItemStack itemstack) {
|
||||
return GasUtils.getItemGas(itemstack, this::getIfValid);
|
||||
}
|
||||
|
||||
private GasStack getIfValid(Gas gas, int quantity) {
|
||||
if (gas != null && gasTank.canReceive(gas) && isValidGas(gas)) {
|
||||
return new GasStack(gas, quantity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract boolean isValidGas(Gas gas);
|
||||
|
||||
@@ -288,8 +297,9 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
|
||||
public boolean canExtractItem(int slotID, @Nonnull ItemStack itemstack, @Nonnull EnumFacing side) {
|
||||
if (slotID == 3) {
|
||||
return ChargeUtils.canBeOutputted(itemstack, false);
|
||||
} else
|
||||
} else {
|
||||
return slotID == 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user