Consolidate in other method
This commit is contained in:
@@ -93,6 +93,10 @@ public abstract class TileBase extends TileEntity implements ITickable {
|
||||
return oldState.getBlock() != newState.getBlock();
|
||||
}
|
||||
|
||||
public TileEntity getFacingTile() {
|
||||
return worldObj.getTileEntity(pos.offset(direction));
|
||||
}
|
||||
|
||||
public IInventory getDroppedInventory() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TileExporter extends TileMachine implements ICompareConfig {
|
||||
|
||||
@Override
|
||||
public void updateMachine() {
|
||||
IItemHandler handler = RefinedStorageUtils.getItemHandler(worldObj.getTileEntity(pos.offset(getDirection())), getDirection().getOpposite());
|
||||
IItemHandler handler = RefinedStorageUtils.getItemHandler(getFacingTile(), getDirection().getOpposite());
|
||||
|
||||
if (handler != null && ticks % RefinedStorageUtils.getSpeed(upgradesInventory) == 0) {
|
||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
|
||||
import refinedstorage.RefinedStorage;
|
||||
@@ -162,16 +161,12 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider
|
||||
return false;
|
||||
}
|
||||
|
||||
public TileEntity getFront() {
|
||||
return worldObj.getTileEntity(pos.offset(getDirection()));
|
||||
}
|
||||
|
||||
public IDeepStorageUnit getStorageUnit() {
|
||||
return getFront() instanceof IDeepStorageUnit ? (IDeepStorageUnit) getFront() : null;
|
||||
return getFacingTile() instanceof IDeepStorageUnit ? (IDeepStorageUnit) getFacingTile() : null;
|
||||
}
|
||||
|
||||
public IItemHandler getItemHandler() {
|
||||
return RefinedStorageUtils.getItemHandler(getFront(), getDirection().getOpposite());
|
||||
return RefinedStorageUtils.getItemHandler(getFacingTile(), getDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import refinedstorage.RefinedStorageUtils;
|
||||
import refinedstorage.container.ContainerImporter;
|
||||
@@ -32,10 +31,9 @@ public class TileImporter extends TileMachine implements ICompareConfig, IModeCo
|
||||
|
||||
@Override
|
||||
public void updateMachine() {
|
||||
TileEntity tile = worldObj.getTileEntity(pos.offset(getDirection()));
|
||||
IItemHandler handler = RefinedStorageUtils.getItemHandler(tile, getDirection().getOpposite());
|
||||
IItemHandler handler = RefinedStorageUtils.getItemHandler(getFacingTile(), getDirection().getOpposite());
|
||||
|
||||
if (tile instanceof TileDiskDrive || handler == null) {
|
||||
if (getFacingTile() instanceof TileDiskDrive || handler == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user