本文整理汇总了Java中cyano.poweradvantage.api.fluid.FluidRequest类的典型用法代码示例。如果您正苦于以下问题:Java FluidRequest类的具体用法?Java FluidRequest怎么用?Java FluidRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FluidRequest类属于cyano.poweradvantage.api.fluid包,在下文中一共展示了FluidRequest类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPowerRequest
import cyano.poweradvantage.api.fluid.FluidRequest; //导入依赖的package包/类
@Override
public PowerRequest getPowerRequest(ConduitType offer) {
if(redstone) return PowerRequest.REQUEST_NOTHING;
if(Fluids.conduitTypeToFluid(offer) == FluidRegistry.WATER){
PowerRequest request = new FluidRequest(FluidRequest.MEDIUM_PRIORITY+1,
(getTank().getCapacity() - getTank().getFluidAmount()),
this);
return request;
} else if(ConduitType.areSameType(offer, Power.ELECTRIC_POWER)){
timeSinceLastPowerRequest = 0;
float powerWanted = (this.getEnergyCapacity(Power.GROWTHCHAMBER_POWER) - this.getEnergy(Power.GROWTHCHAMBER_POWER));
powerWanted = Math.min(powerWanted, soil / SOIL_PER_UNIT);
powerWanted = Math.min(powerWanted, tank.getFluidAmount() / WATER_PER_UNIT);
return new PowerRequest(PowerRequest.MEDIUM_PRIORITY,ELECTRICITY_PER_UNIT * powerWanted,this);
} else {
return PowerRequest.REQUEST_NOTHING;
}
}
示例2: getPowerRequest
import cyano.poweradvantage.api.fluid.FluidRequest; //导入依赖的package包/类
@Override
public PowerRequest getPowerRequest(ConduitType offer) {
if(Fluids.isFluidType(offer)
&& DistillationRecipeRegistry.getInstance().getDistillationRecipeForFluid( Fluids.conduitTypeToFluid(offer)) != null){
if(canDistill(Fluids.conduitTypeToFluid(offer))){
if(getInputTank().getFluidAmount() > 0
&& Fluids.conduitTypeToFluid(offer).equals(getInputTank().getFluid().getFluid()) == false) {
// check that the existing fluid is compatible
return PowerRequest.REQUEST_NOTHING;
}
PowerRequest request = new FluidRequest(FluidRequest.MEDIUM_PRIORITY-1,
(getInputTank().getCapacity() - getInputTank().getFluidAmount()),
this);
return request;
} else {
return PowerRequest.REQUEST_NOTHING;
}
} else{
return super.getPowerRequest(offer);
}
}
示例3: getPowerRequest
import cyano.poweradvantage.api.fluid.FluidRequest; //导入依赖的package包/类
@Override
public PowerRequest getPowerRequest(ConduitType offer) {
if(redstone) return PowerRequest.REQUEST_NOTHING;
if(Fluids.isFluidType(offer)
&& DistillationRecipeRegistry.getInstance().getDistillationRecipeForFluid( Fluids.conduitTypeToFluid(offer)) != null){
if(canDistill(Fluids.conduitTypeToFluid(offer))){
if(getInputTank().getFluidAmount() > 0
&& Fluids.conduitTypeToFluid(offer).equals(getInputTank().getFluid().getFluid()) == false) {
// check that the existing fluid is compatible
return PowerRequest.REQUEST_NOTHING;
}
PowerRequest request = new FluidRequest(FluidRequest.MEDIUM_PRIORITY-1,
(getInputTank().getCapacity() - getInputTank().getFluidAmount()),
this);
return request;
} else {
return PowerRequest.REQUEST_NOTHING;
}
} else if(ConduitType.areSameType(offer, Power.steam_power)){
return new PowerRequest(PowerRequest.MEDIUM_PRIORITY,this.getEnergyCapacity(Power.steam_power) - this.getEnergy(Power.steam_power), this);
}
return PowerRequest.REQUEST_NOTHING;
}
示例4: getFluidRequest
import cyano.poweradvantage.api.fluid.FluidRequest; //导入依赖的package包/类
/**
* Generates a request for fluid based on what is being offered.
* @param type The type of fluid being offered by a fluid producer
* @return returns <code>FluidRequest.REQUEST_NOTHING</code> because we don't want any
*/
@Override
public FluidRequest getFluidRequest(Fluid type) {
if(type == null) return FluidRequest.REQUEST_NOTHING;
if(this.canAccept(type)){
if(this.getTank().getFluidAmount() > 0 && this.getTank().getFluid().getFluid().equals(type)){
// partially filled tank
return new FluidRequest(
(this.isPowerSource(Fluids.fluidToConduitType(type)) ? this.getMinimumSinkPriority() - 1 : FluidRequest.MEDIUM_PRIORITY),
Math.min(getMaximumFluidFlux(),this.getTank().getCapacity() - this.getTank().getFluidAmount()),
this
);
} else {
// empty tank
return new FluidRequest(
(this.isPowerSource(Fluids.fluidToConduitType(type)) ? this.getMinimumSinkPriority() - 1 : FluidRequest.MEDIUM_PRIORITY),
Math.min(getMaximumFluidFlux(),this.getTank().getCapacity()),
this
);
}
}
return FluidRequest.REQUEST_NOTHING;
}
示例5: getPowerRequest
import cyano.poweradvantage.api.fluid.FluidRequest; //导入依赖的package包/类
@Override
public PowerRequest getPowerRequest(ConduitType offer) {
if(this.hasRedstoneSignal()) return PowerRequest.REQUEST_NOTHING;
if(isPlasticFluid(Fluids.conduitTypeToFluid(offer))){
PowerRequest request = new FluidRequest(FluidRequest.MEDIUM_PRIORITY+1,
(getTank().getCapacity() - getTank().getFluidAmount()),
this);
return request;
} else {
return super.getPowerRequest(offer);
}
}
示例6: getPowerRequest
import cyano.poweradvantage.api.fluid.FluidRequest; //导入依赖的package包/类
@Override
public PowerRequest getPowerRequest(ConduitType offer) {
if(Fluids.isFluidType(offer) && Fluids.conduitTypeToFluid(offer) == FluidRegistry.WATER){
PowerRequest request = new FluidRequest(FluidRequest.MEDIUM_PRIORITY+1,
(getTank().getCapacity() - getTank().getFluidAmount()),
this);
return request;
} else {
return super.getPowerRequest(offer);
}
}
示例7: getPowerRequest
import cyano.poweradvantage.api.fluid.FluidRequest; //导入依赖的package包/类
@Override
public PowerRequest getPowerRequest(ConduitType offer) {
if(Fluids.conduitTypeToFluid(offer) == FluidRegistry.WATER){
PowerRequest request = new FluidRequest(FluidRequest.MEDIUM_PRIORITY+1,
(getTank().getCapacity() - getTank().getFluidAmount()),
this);
return request;
} else {
return PowerRequest.REQUEST_NOTHING;
}
}
示例8: getPowerRequest
import cyano.poweradvantage.api.fluid.FluidRequest; //导入依赖的package包/类
@Override
public PowerRequest getPowerRequest(ConduitType type) {
Fluid f = Fluids.conduitTypeToFluid(type);
if(f == null) return PowerRequest.REQUEST_NOTHING;
FluidStack offer = new FluidStack(f,Integer.MAX_VALUE);
int demand = 0;
for(int i = 0; i < 6; i++){
IFluidHandler n = neighbors[i];
EnumFacing face = faces[i].getOpposite();
if(n != null){
demand += n.fill(face, offer, false);
}
}
return new FluidRequest(PowerRequest.LOW_PRIORITY-1,demand,this);
}