mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 06:14:41 +00:00
Base fixes
This commit is contained in:
1 parent
d4ca659ed0
commit
245d5ed471
6 files changed
+33
-33
No files matched your search
@@ -6,8 +6,7 @@ import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
@@ -18,7 +17,7 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor
|
||||
|
||||
public static EnergyAcceptorWrapper get(TileEntity tileEntity)
|
||||
{
|
||||
if(tileEntity != null && tileEntity.getWorldObj() == null)
|
||||
if(tileEntity != null && tileEntity.getWorld() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -46,7 +45,7 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
public abstract boolean needsEnergy(ForgeDirection side);
|
||||
public abstract boolean needsEnergy(EnumFacing side);
|
||||
|
||||
public static class MekanismAcceptor extends EnergyAcceptorWrapper
|
||||
{
|
||||
@@ -58,13 +57,13 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor
|
||||
}
|
||||
|
||||
@Override
|
||||
public double transferEnergyToAcceptor(ForgeDirection side, double amount)
|
||||
public double transferEnergyToAcceptor(EnumFacing side, double amount)
|
||||
{
|
||||
return acceptor.transferEnergyToAcceptor(side, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveEnergy(ForgeDirection side)
|
||||
public boolean canReceiveEnergy(EnumFacing side)
|
||||
{
|
||||
return acceptor.canReceiveEnergy(side);
|
||||
}
|
||||
@@ -88,7 +87,7 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsEnergy(ForgeDirection side)
|
||||
public boolean needsEnergy(EnumFacing side)
|
||||
{
|
||||
return acceptor.getMaxEnergy() - acceptor.getEnergy() > 0;
|
||||
}
|
||||
@@ -104,13 +103,13 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor
|
||||
}
|
||||
|
||||
@Override
|
||||
public double transferEnergyToAcceptor(ForgeDirection side, double amount)
|
||||
public double transferEnergyToAcceptor(EnumFacing side, double amount)
|
||||
{
|
||||
return fromRF(acceptor.receiveEnergy(side, toRF(amount), false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveEnergy(ForgeDirection side)
|
||||
public boolean canReceiveEnergy(EnumFacing side)
|
||||
{
|
||||
return acceptor.canConnectEnergy(side);
|
||||
}
|
||||
@@ -118,25 +117,25 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor
|
||||
@Override
|
||||
public double getEnergy()
|
||||
{
|
||||
return fromRF(acceptor.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
return fromRF(acceptor.getEnergyStored(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(double energy)
|
||||
{
|
||||
int rfToSet = toRF(energy);
|
||||
int amountToReceive = rfToSet - acceptor.getEnergyStored(ForgeDirection.UNKNOWN);
|
||||
acceptor.receiveEnergy(ForgeDirection.UNKNOWN, amountToReceive, false);
|
||||
int amountToReceive = rfToSet - acceptor.getEnergyStored(null);
|
||||
acceptor.receiveEnergy(null, amountToReceive, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxEnergy()
|
||||
{
|
||||
return fromRF(acceptor.getMaxEnergyStored(ForgeDirection.UNKNOWN));
|
||||
return fromRF(acceptor.getMaxEnergyStored(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsEnergy(ForgeDirection side)
|
||||
public boolean needsEnergy(EnumFacing side)
|
||||
{
|
||||
return acceptor.getMaxEnergyStored(side) - acceptor.getEnergyStored(side) > 0 || acceptor.receiveEnergy(side, 1, true) > 0;
|
||||
}
|
||||
@@ -162,13 +161,13 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor
|
||||
}
|
||||
|
||||
@Override
|
||||
public double transferEnergyToAcceptor(ForgeDirection side, double amount)
|
||||
public double transferEnergyToAcceptor(EnumFacing side, double amount)
|
||||
{
|
||||
return amount - fromEU(acceptor.injectEnergy(side, toEU(amount), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveEnergy(ForgeDirection side)
|
||||
public boolean canReceiveEnergy(EnumFacing side)
|
||||
{
|
||||
return acceptor.acceptsEnergyFrom(null, side);
|
||||
}
|
||||
@@ -192,7 +191,7 @@ public abstract class EnergyAcceptorWrapper implements IStrictEnergyAcceptor
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsEnergy(ForgeDirection side)
|
||||
public boolean needsEnergy(EnumFacing side)
|
||||
{
|
||||
return acceptor.getDemandedEnergy() > 0;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package mekanism.common.base;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface IEjector
|
||||
{
|
||||
@@ -11,9 +12,9 @@ public interface IEjector
|
||||
|
||||
public void setOutputColor(EnumColor color);
|
||||
|
||||
public EnumColor getInputColor(ForgeDirection side);
|
||||
public EnumColor getInputColor(EnumFacing side);
|
||||
|
||||
public void setInputColor(ForgeDirection side, EnumColor color);
|
||||
public void setInputColor(EnumFacing side, EnumColor color);
|
||||
|
||||
public boolean hasStrictInput();
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import mekanism.api.energy.ICableOutputter;
|
||||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
@@ -22,9 +22,9 @@ import java.util.EnumSet;
|
||||
})
|
||||
public interface IEnergyWrapper extends IStrictEnergyStorage, IEnergyHandler, IEnergySink, IEnergySource, IEnergyStorage, IStrictEnergyAcceptor, ICableOutputter, IInventory
|
||||
{
|
||||
public EnumSet<ForgeDirection> getOutputtingSides();
|
||||
public EnumSet<EnumFacing> getOutputtingSides();
|
||||
|
||||
public EnumSet<ForgeDirection> getConsumingSides();
|
||||
public EnumSet<EnumFacing> getConsumingSides();
|
||||
|
||||
public double getMaxOutput();
|
||||
}
|
||||
@@ -17,8 +17,8 @@ import mekanism.common.tile.TileEntityAdvancedElectricMachine;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Internal interface for managing various Factory types.
|
||||
@@ -109,7 +109,7 @@ public interface IFactory
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean canReceiveGas(ForgeDirection side, Gas type)
|
||||
public boolean canReceiveGas(EnumFacing side, Gas type)
|
||||
{
|
||||
if(usesFuel)
|
||||
{
|
||||
@@ -119,7 +119,7 @@ public interface IFactory
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canTubeConnect(ForgeDirection side)
|
||||
public boolean canTubeConnect(EnumFacing side)
|
||||
{
|
||||
if(usesFuel)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ import mekanism.common.tile.TileEntityLogisticalSorter;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface ILogisticalTransporter extends IGridTransmitter<IInventory, InventoryNetwork>, IBlockableConnection
|
||||
{
|
||||
@@ -25,9 +25,9 @@ public interface ILogisticalTransporter extends IGridTransmitter<IInventory, Inv
|
||||
|
||||
public void setColor(EnumColor c);
|
||||
|
||||
public boolean canEmitTo(TileEntity tileEntity, ForgeDirection side);
|
||||
public boolean canEmitTo(TileEntity tileEntity, EnumFacing side);
|
||||
|
||||
public boolean canReceiveFrom(TileEntity tileEntity, ForgeDirection side);
|
||||
public boolean canReceiveFrom(TileEntity tileEntity, EnumFacing side);
|
||||
|
||||
public double getCost();
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public interface ITankManager
|
||||
dropper.setGas(stack, new GasStack(drawn.getGas(), dropperStored+(drawn != null ? drawn.amount : 0)));
|
||||
}
|
||||
|
||||
((EntityPlayerMP)player).sendContainerAndContentsToPlayer(player.openContainer, player.openContainer.getInventory());
|
||||
((EntityPlayerMP)player).sendContainerToPlayer(player.openContainer);
|
||||
}
|
||||
else if(button == 1) //Extract gas from dropper
|
||||
{
|
||||
@@ -66,7 +66,7 @@ public interface ITankManager
|
||||
toExtract = gasTank.receive(new GasStack(dropper.getGas(stack).getGas(), toExtract), true);
|
||||
dropper.setGas(stack, new GasStack(dropper.getGas(stack).getGas(), dropperStored-toExtract));
|
||||
|
||||
((EntityPlayerMP)player).sendContainerAndContentsToPlayer(player.openContainer, player.openContainer.getInventory());
|
||||
((EntityPlayerMP)player).sendContainerToPlayer(player.openContainer);
|
||||
}
|
||||
else if(button == 2) //Dump the tank
|
||||
{
|
||||
@@ -98,7 +98,7 @@ public interface ITankManager
|
||||
dropper.setFluid(stack, new FluidStack(drawn.getFluid(), dropperStored+(drawn != null ? drawn.amount : 0)));
|
||||
}
|
||||
|
||||
((EntityPlayerMP)player).sendContainerAndContentsToPlayer(player.openContainer, player.openContainer.getInventory());
|
||||
((EntityPlayerMP)player).sendContainerToPlayer(player.openContainer);
|
||||
}
|
||||
else if(button == 1) //Extract fluid from dropper
|
||||
{
|
||||
@@ -111,7 +111,7 @@ public interface ITankManager
|
||||
toExtract = fluidTank.fill(new FluidStack(dropper.getFluid(stack).getFluid(), toExtract), true);
|
||||
dropper.setFluid(stack, new FluidStack(dropper.getFluid(stack).getFluid(), dropperStored-toExtract));
|
||||
|
||||
((EntityPlayerMP)player).sendContainerAndContentsToPlayer(player.openContainer, player.openContainer.getInventory());
|
||||
((EntityPlayerMP)player).sendContainerToPlayer(player.openContainer);
|
||||
}
|
||||
else if(button == 2) //Dump the tank
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user