Fix getWorld() function
This commit is contained in:
parent
425515504d
commit
4dd867d606
5 changed files with 40 additions and 34 deletions
|
@ -43,5 +43,5 @@ public interface IPowerReceptor {
|
|||
*/
|
||||
public void doWork(PowerHandler workProvider);
|
||||
|
||||
public World getWorldObj();
|
||||
public World getWorld();
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public final class PowerHandler {
|
|||
}
|
||||
|
||||
private void applyPerdition() {
|
||||
if (perditionTracker.markTimeIfDelay(receptor.getWorldObj(), 1) && energyStored > 0) {
|
||||
if (perditionTracker.markTimeIfDelay(receptor.getWorld(), 1) && energyStored > 0) {
|
||||
float newEnergy = getPerdition().applyPerdition(this, energyStored, perditionTracker.durationOfLastDelay());
|
||||
if (newEnergy == 0 || newEnergy < energyStored) {
|
||||
energyStored = newEnergy;
|
||||
|
@ -202,14 +202,14 @@ public final class PowerHandler {
|
|||
|
||||
private void applyWork() {
|
||||
if (energyStored >= activationEnergy) {
|
||||
if (doWorkTracker.markTimeIfDelay(receptor.getWorldObj(), 1)) {
|
||||
if (doWorkTracker.markTimeIfDelay(receptor.getWorld(), 1)) {
|
||||
receptor.doWork(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSources(ForgeDirection source) {
|
||||
if (sourcesTracker.markTimeIfDelay(receptor.getWorldObj(), 1)) {
|
||||
if (sourcesTracker.markTimeIfDelay(receptor.getWorld(), 1)) {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
powerSources[i] -= sourcesTracker.durationOfLastDelay();
|
||||
if (powerSources[i] < 0) {
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class TileBuildCraft extends TileEntity implements ISynchronizedTile {
|
||||
|
||||
|
@ -109,4 +110,8 @@ public abstract class TileBuildCraft extends TileEntity implements ISynchronized
|
|||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return worldObj;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -726,7 +726,7 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
|
||||
}
|
||||
|
||||
public World getWorldObj(){
|
||||
public World getWorld(){
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
|
|
|
@ -531,39 +531,35 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof IFluidHandler && !hasPlug(from))
|
||||
return ((IFluidHandler) pipe.transport).drain(from, resource, doDrain);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof IFluidHandler && !hasPlug(from))
|
||||
return ((IFluidHandler) pipe.transport).drain(from, resource, doDrain);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof IFluidHandler && !hasPlug(from))
|
||||
return ((IFluidHandler) pipe.transport).canFill(from, fluid);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof IFluidHandler && !hasPlug(from))
|
||||
return ((IFluidHandler) pipe.transport).canFill(from, fluid);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof IFluidHandler && !hasPlug(from))
|
||||
return ((IFluidHandler) pipe.transport).canDrain(from, fluid);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof IFluidHandler && !hasPlug(from))
|
||||
return ((IFluidHandler) pipe.transport).canDrain(from, fluid);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void scheduleRenderUpdate() {
|
||||
public void scheduleRenderUpdate() {
|
||||
refreshRenderState = true;
|
||||
}
|
||||
|
||||
|
@ -714,4 +710,9 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return worldObj;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue