use of net.minecraft.entity.item.EntityMinecartCommandBlock in project Railcraft by Railcraft.
the class TrackKitDetector method getComparatorInputOverride.
@Override
public int getComparatorInputOverride() {
if (isEmittingPower()) {
World world = theWorldAsserted();
List<EntityMinecart> carts = EntitySearcher.findMinecarts().around(getPos()).upTo(-0.2F).in(world);
if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1)
return carts.get(0).getComparatorLevel();
List<EntityMinecartCommandBlock> commandCarts = EntitySearcher.find(EntityMinecartCommandBlock.class).around(getPos()).upTo(-0.2F).in(world);
if (!commandCarts.isEmpty()) {
return commandCarts.get(0).getCommandBlockLogic().getSuccessCount();
}
List<EntityMinecart> chestCarts = EntitySearcher.findMinecarts().around(getPos()).upTo(-0.2F).and(EntitySelectors.HAS_INVENTORY).in(world);
if (!chestCarts.isEmpty()) {
return Container.calcRedstoneFromInventory((IInventory) chestCarts.get(0));
}
}
return 0;
}
Aggregations