Repaired liquid triggers
This commit is contained in:
parent
77529c04b2
commit
2045547ff0
1 changed files with 55 additions and 55 deletions
|
@ -11,9 +11,10 @@ package net.minecraft.src.buildcraft.transport;
|
|||
|
||||
import net.minecraft.src.buildcraft.api.Trigger;
|
||||
import net.minecraft.src.buildcraft.api.TriggerParameter;
|
||||
import net.minecraft.src.buildcraft.api.liquids.ILiquidTank;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidManager;
|
||||
import net.minecraft.src.buildcraft.api.liquids.LiquidStack;
|
||||
import net.minecraft.src.buildcraft.core.DefaultProps;
|
||||
import net.minecraft.src.buildcraft.transport.PipeTransportLiquids.LiquidBuffer;
|
||||
|
||||
public class TriggerPipeContents extends Trigger implements ITriggerPipe {
|
||||
|
||||
|
@ -73,61 +74,60 @@ public class TriggerPipeContents extends Trigger implements ITriggerPipe {
|
|||
|
||||
@Override
|
||||
public boolean isTriggerActive(Pipe pipe, TriggerParameter parameter) {
|
||||
if (pipe.transport instanceof PipeTransportItems) {
|
||||
PipeTransportItems transportItems = (PipeTransportItems) pipe.transport;
|
||||
|
||||
if (kind == Kind.Empty)
|
||||
return transportItems.travelingEntities.isEmpty();
|
||||
else if (kind == Kind.ContainsItems)
|
||||
if (parameter != null && parameter.getItem() != null) {
|
||||
for (EntityData data : transportItems.travelingEntities.values())
|
||||
if (data.item.item.itemID == parameter.getItem().itemID
|
||||
&& data.item.item.getItemDamage() == parameter.getItem().getItemDamage())
|
||||
return true;
|
||||
} else
|
||||
return !transportItems.travelingEntities.isEmpty();
|
||||
} else if (pipe.transport instanceof PipeTransportLiquids) {
|
||||
PipeTransportLiquids transportLiquids = (PipeTransportLiquids) pipe.transport;
|
||||
|
||||
LiquidStack searchedLiquid = null;
|
||||
|
||||
if (parameter != null && parameter.getItem() != null)
|
||||
searchedLiquid = LiquidManager.getLiquidForFilledItem(parameter.getItem());
|
||||
|
||||
if (kind == Kind.Empty) {
|
||||
for (ILiquidTank b : transportLiquids.getTanks())
|
||||
if (b.getLiquid() != null && b.getLiquid().amount != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
for (ILiquidTank b : transportLiquids.getTanks())
|
||||
if (b.getLiquid() != null && b.getLiquid().amount != 0)
|
||||
if (searchedLiquid == null || searchedLiquid.isLiquidEqual(b.getLiquid()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
} else if (pipe.transport instanceof PipeTransportPower) {
|
||||
PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
|
||||
|
||||
if (kind == Kind.Empty) {
|
||||
for (short s : transportPower.displayPower)
|
||||
if (s != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
for (short s : transportPower.displayPower)
|
||||
if (s != 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
// if (pipe.transport instanceof PipeTransportItems) {
|
||||
// PipeTransportItems transportItems = (PipeTransportItems) pipe.transport;
|
||||
//
|
||||
// if (kind == Kind.Empty)
|
||||
// return transportItems.travelingEntities.isEmpty();
|
||||
// else if (kind == Kind.ContainsItems)
|
||||
// if (parameter != null && parameter.getItem() != null) {
|
||||
// for (EntityData data : transportItems.travelingEntities.values())
|
||||
// if (data.item.item.itemID == parameter.getItem().itemID
|
||||
// && data.item.item.getItemDamage() == parameter.getItem().getItemDamage())
|
||||
// return true;
|
||||
// } else
|
||||
// return !transportItems.travelingEntities.isEmpty();
|
||||
// } else if (pipe.transport instanceof PipeTransportLiquids) {
|
||||
// PipeTransportLiquids transportLiquids = (PipeTransportLiquids) pipe.transport;
|
||||
//
|
||||
// int seachedLiquidId = 0;
|
||||
//
|
||||
// if (parameter != null && parameter.getItem() != null)
|
||||
// seachedLiquidId = LiquidManager.getLiquidIDForFilledItem(parameter.getItem());
|
||||
//
|
||||
// if (kind == Kind.Empty) {
|
||||
// for (LiquidBuffer b : transportLiquids.side)
|
||||
// if (b.average != 0)
|
||||
// return false;
|
||||
//
|
||||
// return true;
|
||||
// } else {
|
||||
// for (LiquidBuffer b : transportLiquids.side)
|
||||
// if (b.average != 0)
|
||||
// if (seachedLiquidId == 0 || b.liquidId == seachedLiquidId)
|
||||
// return true;
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
// } else if (pipe.transport instanceof PipeTransportPower) {
|
||||
// PipeTransportPower transportPower = (PipeTransportPower) pipe.transport;
|
||||
//
|
||||
// if (kind == Kind.Empty) {
|
||||
// for (short s : transportPower.displayPower)
|
||||
// if (s != 0)
|
||||
// return false;
|
||||
//
|
||||
// return true;
|
||||
// } else {
|
||||
// for (short s : transportPower.displayPower)
|
||||
// if (s != 0)
|
||||
// return true;
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue